Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7b93e46dfc | ||
|
|
ec0629c98e | ||
|
|
9399c8de37 | ||
|
|
23e759da36 | ||
|
|
16c31a29ff | ||
|
|
e584661305 | ||
|
|
fd38742d52 | ||
|
|
13ab0b98dd |
@@ -2,3 +2,4 @@
|
||||
host=review.openstack.org
|
||||
port=29418
|
||||
project=openstack/python-tackerclient.git
|
||||
defaultbranch=stable/liberty
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[DEFAULT]
|
||||
test_command=OS_STDOUT_CAPTURE=1 OS_STDERR_CAPTURE=1 ${PYTHON:-python} -m subunit.run discover -t ./ . $LISTOPT $IDOPTION
|
||||
test_command=OS_STDOUT_CAPTURE=1 OS_STDERR_CAPTURE=1 ${PYTHON:-python} -m subunit.run discover -t ./ ${OS_TEST_PATH:-./tackerclient/tests/unit/vm} $LISTOPT $IDOPTION
|
||||
test_id_option=--load-list $IDFILE
|
||||
test_list_option=--list
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Neutron Style Commandments
|
||||
Tacker Style Commandments
|
||||
================================
|
||||
|
||||
- Step 1: Read the OpenStack Style Commandments
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
|
||||
project = 'python-neutronclient'
|
||||
project = 'python-tackerclient'
|
||||
|
||||
# -- General configuration ---------------------------------------------
|
||||
|
||||
|
||||
@@ -1,19 +1,7 @@
|
||||
Python bindings to the OpenStack Network API
|
||||
Python bindings to the OpenStack Tacker API
|
||||
============================================
|
||||
|
||||
In order to use the python neutron client directly, you must first obtain an auth token and identify which endpoint you wish to speak to. Once you have done so, you can use the API like so::
|
||||
|
||||
>>> import logging
|
||||
>>> from neutronclient.neutron import client
|
||||
>>> logging.basicConfig(level=logging.DEBUG)
|
||||
>>> neutron = client.Client('2.0', endpoint_url=OS_URL, token=OS_TOKEN)
|
||||
>>> neutron.format = 'json'
|
||||
>>> network = {'name': 'mynetwork', 'admin_state_up': True}
|
||||
>>> neutron.create_network({'network':network})
|
||||
>>> networks = neutron.list_networks(name='mynetwork')
|
||||
>>> print networks
|
||||
>>> network_id = networks['networks'][0]['id']
|
||||
>>> neutron.delete_network(network_id)
|
||||
In order to use the python tacker client directly, you must first obtain an auth token and identify which endpoint you wish to speak to. Once you have done so, you can use the API.
|
||||
|
||||
|
||||
Command-line Tool
|
||||
@@ -27,37 +15,11 @@ In order to use the CLI, you must provide your OpenStack username, password, ten
|
||||
|
||||
The command line tool will attempt to reauthenticate using your provided credentials for every request. You can override this behavior by manually supplying an auth token using ``--os-url`` and ``--os-auth-token``. You can alternatively set these environment variables::
|
||||
|
||||
export OS_URL=http://neutron.example.org:9696/
|
||||
export OS_URL=http://tacker.example.org:8888/
|
||||
export OS_TOKEN=3bcc3d3a03f44e3d8377f9247b0ad155
|
||||
|
||||
If neutron server does not require authentication, besides these two arguments or environment variables (We can use any value as token.), we need manually supply ``--os-auth-strategy`` or set the environment variable::
|
||||
If tacker server does not require authentication, besides these two arguments or environment variables (We can use any value as token.), we need manually supply ``--os-auth-strategy`` or set the environment variable::
|
||||
|
||||
export OS_AUTH_STRATEGY=noauth
|
||||
|
||||
Once you've configured your authentication parameters, you can run ``neutron -h`` to see a complete listing of available commands.
|
||||
|
||||
Release Notes
|
||||
=============
|
||||
|
||||
2.0
|
||||
-----
|
||||
* support Neutron API 2.0
|
||||
|
||||
2.2.0
|
||||
-----
|
||||
* add security group commands
|
||||
* add Lbaas commands
|
||||
* allow options put after positional arguments
|
||||
* add NVP queue and net gateway commands
|
||||
* add commands for agent management extensions
|
||||
* add commands for DHCP and L3 agents scheduling
|
||||
* support XML request format
|
||||
* support pagination options
|
||||
|
||||
2.2.2
|
||||
-----
|
||||
* improved support for listing a large number of filtered subnets
|
||||
* add --endpoint-type and OS_ENDPOINT_TYPE to shell client
|
||||
* made the publicURL the default endpoint instead of adminURL
|
||||
* add ability to update security group name (requires 2013.2-Havana or later)
|
||||
* add flake8 and pbr support for testing and building
|
||||
Once you've configured your authentication parameters, you can run ``tacker -h`` to see a complete listing of available commands.
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
pbr>=0.6,!=0.7,<1.0
|
||||
# The order of packages is significant, because pip processes them in the order
|
||||
# of appearance. Changing the order has an impact on the overall integration
|
||||
# process, which may cause wedges in the gate later.
|
||||
pbr>=1.6
|
||||
argparse
|
||||
cliff>=1.4.3
|
||||
cliff>=1.14.0 # Apache-2.0
|
||||
iso8601>=0.1.9
|
||||
netaddr>=0.7.6
|
||||
requests>=1.1
|
||||
python-keystoneclient>=0.9.0
|
||||
simplejson>=2.0.9
|
||||
six>=1.6.0
|
||||
netaddr>=0.7.12,!=0.7.16
|
||||
requests>=2.5.2,!=2.8.0,!=2.9.0
|
||||
python-keystoneclient>=1.6.0,!=1.8.0
|
||||
simplejson>=2.2.0
|
||||
six>=1.9.0
|
||||
Babel>=1.3
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
[metadata]
|
||||
name = python-tackerclient
|
||||
summary = CLI and Client Library for OpenStack Networking
|
||||
summary = CLI and Client Library for OpenStack Tacker
|
||||
description-file =
|
||||
README.rst
|
||||
author = OpenStack Networking Project
|
||||
author = OpenStack
|
||||
author-email = openstack-dev@lists.openstack.org
|
||||
home-page = http://www.openstack.org/
|
||||
classifier =
|
||||
|
||||
3
setup.py
3
setup.py
@@ -1,4 +1,3 @@
|
||||
#!/usr/bin/env python
|
||||
# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -26,5 +25,5 @@ except ImportError:
|
||||
pass
|
||||
|
||||
setuptools.setup(
|
||||
setup_requires=['pbr'],
|
||||
setup_requires=['pbr>=1.8'],
|
||||
pbr=True)
|
||||
|
||||
@@ -35,5 +35,4 @@ TYPE_DICT = "dict"
|
||||
|
||||
|
||||
PLURALS = {'templates': 'template',
|
||||
'devices': 'device',
|
||||
'services': 'service'}
|
||||
'devices': 'device'}
|
||||
|
||||
@@ -18,8 +18,10 @@
|
||||
"""Utilities and helper functions."""
|
||||
|
||||
import argparse
|
||||
import functools
|
||||
import logging
|
||||
import os
|
||||
import warnings
|
||||
|
||||
from oslo_utils import encodeutils
|
||||
from oslo_utils import importutils
|
||||
@@ -171,3 +173,16 @@ def add_boolean_argument(parser, name, **kwargs):
|
||||
choices=['True', 'true', 'False', 'false'],
|
||||
default=default,
|
||||
**kwargs)
|
||||
|
||||
|
||||
def deprecated(name):
|
||||
"""This decorator can be used to mark a call as deprecated."""
|
||||
def _deprecate(func):
|
||||
@functools.wraps(func)
|
||||
def wrapper(*args, **kwargs):
|
||||
warnings.simplefilter('always', DeprecationWarning)
|
||||
warnings.warn("Call to %s deprecated, avoid its usage." % name,
|
||||
category=DeprecationWarning)
|
||||
return func(*args, **kwargs)
|
||||
return wrapper
|
||||
return _deprecate
|
||||
|
||||
@@ -23,6 +23,7 @@ import abc
|
||||
import six
|
||||
|
||||
from tackerclient.common import exceptions
|
||||
from tackerclient.common.utils import deprecated
|
||||
from tackerclient.openstack.common.gettextutils import _
|
||||
from tackerclient.tacker import v1_0 as tackerV10
|
||||
|
||||
@@ -30,6 +31,7 @@ from tackerclient.tacker import v1_0 as tackerV10
|
||||
_DEVICE = 'device'
|
||||
|
||||
|
||||
@deprecated('device-list')
|
||||
class ListDevice(tackerV10.ListCommand):
|
||||
"""List device that belong to a given tenant."""
|
||||
|
||||
@@ -37,12 +39,14 @@ class ListDevice(tackerV10.ListCommand):
|
||||
list_columns = ['id', 'name', 'description', 'mgmt_url', 'status']
|
||||
|
||||
|
||||
@deprecated('device-show')
|
||||
class ShowDevice(tackerV10.ShowCommand):
|
||||
"""show information of a given Device."""
|
||||
|
||||
resource = _DEVICE
|
||||
|
||||
|
||||
@deprecated('device-create')
|
||||
class CreateDevice(tackerV10.CreateCommand):
|
||||
"""create a Device."""
|
||||
|
||||
@@ -63,15 +67,6 @@ class CreateDevice(tackerV10.CreateCommand):
|
||||
dest='attributes',
|
||||
default=[],
|
||||
help='instance specific argument')
|
||||
parser.add_argument(
|
||||
'--service-context',
|
||||
metavar='<network-id=network-uuid,subnet-id=subnet-uuid,'
|
||||
'port-id=port-uuid,router-id=router-uuid,'
|
||||
'role=role-string,index=int>',
|
||||
action='append',
|
||||
dest='service_context',
|
||||
default=[],
|
||||
help='service context to insert service')
|
||||
|
||||
def args2body(self, parsed_args):
|
||||
body = {
|
||||
@@ -89,25 +84,12 @@ class CreateDevice(tackerV10.CreateCommand):
|
||||
raise exceptions.TackerCLIError(msg)
|
||||
if attributes:
|
||||
body[self.resource]['attributes'] = attributes
|
||||
if parsed_args.service_context:
|
||||
try:
|
||||
service_contexts = [dict(
|
||||
(k.replace('-', '_'), v)
|
||||
for k, v in (key_value.split('=', 1)
|
||||
for key_value in entry_string.split(',')))
|
||||
for entry_string in parsed_args.service_context]
|
||||
except ValueError:
|
||||
msg = (_('invalid argument for --service-context %s') %
|
||||
parsed_args.service_context)
|
||||
raise exceptions.TackerCLIError(msg)
|
||||
|
||||
if service_contexts:
|
||||
body[self.resource]['service_contexts'] = service_contexts
|
||||
|
||||
tackerV10.update_dict(parsed_args, body[self.resource], ['tenant_id'])
|
||||
return body
|
||||
|
||||
|
||||
@deprecated('device-update')
|
||||
class UpdateDevice(tackerV10.UpdateCommand):
|
||||
"""Update a given Device."""
|
||||
|
||||
@@ -138,6 +120,7 @@ class UpdateDevice(tackerV10.UpdateCommand):
|
||||
return body
|
||||
|
||||
|
||||
@deprecated('device-delete')
|
||||
class DeleteDevice(tackerV10.DeleteCommand):
|
||||
"""Delete a given Device."""
|
||||
|
||||
|
||||
@@ -19,24 +19,28 @@
|
||||
#
|
||||
# @author: Isaku Yamahata, Intel
|
||||
|
||||
from tackerclient.common.utils import deprecated
|
||||
from tackerclient.tacker import v1_0 as tackerV10
|
||||
|
||||
|
||||
_DEVICE_TEMPLATE = "device_template"
|
||||
|
||||
|
||||
@deprecated('device-template-list')
|
||||
class ListDeviceTemplate(tackerV10.ListCommand):
|
||||
"""List device template that belong to a given tenant."""
|
||||
|
||||
resource = _DEVICE_TEMPLATE
|
||||
|
||||
|
||||
@deprecated('device-template-show')
|
||||
class ShowDeviceTemplate(tackerV10.ShowCommand):
|
||||
"""show information of a given DeviceTemplate."""
|
||||
|
||||
resource = _DEVICE_TEMPLATE
|
||||
|
||||
|
||||
@deprecated('device-template-create')
|
||||
class CreateDeviceTemplate(tackerV10.CreateCommand):
|
||||
"""create a DeviceTemplate."""
|
||||
|
||||
@@ -82,6 +86,7 @@ class CreateDeviceTemplate(tackerV10.CreateCommand):
|
||||
return body
|
||||
|
||||
|
||||
@deprecated('device-template-update')
|
||||
class UpdateDeviceTemplate(tackerV10.UpdateCommand):
|
||||
"""Update a given DeviceTemplate."""
|
||||
|
||||
@@ -89,6 +94,7 @@ class UpdateDeviceTemplate(tackerV10.UpdateCommand):
|
||||
allow_names = False
|
||||
|
||||
|
||||
@deprecated('device-template-delete')
|
||||
class DeleteDeviceTemplate(tackerV10.DeleteCommand):
|
||||
"""Delete a given DeviceTemplate."""
|
||||
resource = _DEVICE_TEMPLATE
|
||||
|
||||
@@ -204,15 +204,7 @@ class CLITestV10Base(testtools.TestCase):
|
||||
self.mox.StubOutWithMock(cmd, "get_client")
|
||||
self.mox.StubOutWithMock(self.client.httpclient, "request")
|
||||
cmd.get_client().MultipleTimes().AndReturn(self.client)
|
||||
non_admin_status_resources = ['subnet', 'floatingip', 'security_group',
|
||||
'security_group_rule', 'qos_queue',
|
||||
'network_gateway', 'gateway_device',
|
||||
'credential', 'network_profile',
|
||||
'policy_profile', 'ikepolicy',
|
||||
'ipsecpolicy', 'metering_label',
|
||||
'metering_label_rule', 'net_partition',
|
||||
'device_template', 'device',
|
||||
'service_instance']
|
||||
non_admin_status_resources = ['device_template', 'device']
|
||||
if (resource in non_admin_status_resources):
|
||||
body = {resource: {}, }
|
||||
else:
|
||||
|
||||
@@ -40,36 +40,13 @@ class CLITestV10VmDeviceJSON(test_cli10.CLITestV10Base):
|
||||
template_id = 'template_id'
|
||||
key = 'key'
|
||||
value = 'value'
|
||||
network_id = 'network_id'
|
||||
subnet_id = 'subnet_id'
|
||||
port_id = 'port_id'
|
||||
router_id = 'router_id'
|
||||
role = 'role'
|
||||
index = 1
|
||||
|
||||
args = [
|
||||
'--device-template-id', template_id,
|
||||
'--kwargs', '%s=%s' % (key, value),
|
||||
'--service-context',
|
||||
('network-id=%s,subnet-id=%s,port-id=%s,router-id=%s,'
|
||||
'role=%s,index=%s' % (network_id, subnet_id, port_id, router_id,
|
||||
role, index))
|
||||
]
|
||||
'--%s' % key, value]
|
||||
position_names = ['template_id']
|
||||
position_values = [template_id]
|
||||
extra_body = {
|
||||
'kwargs': {
|
||||
key: value
|
||||
},
|
||||
'service_context': [{
|
||||
'network_id': network_id,
|
||||
'subnet_id': subnet_id,
|
||||
'port_id': port_id,
|
||||
'router_id': router_id,
|
||||
'role': role,
|
||||
'index': str(index),
|
||||
}],
|
||||
}
|
||||
extra_body = {key: value}
|
||||
self._test_create_resource(self._RESOURCE, cmd, None, my_id,
|
||||
args, position_names, position_values,
|
||||
extra_body=extra_body)
|
||||
@@ -109,18 +86,14 @@ class CLITestV10VmDeviceJSON(test_cli10.CLITestV10Base):
|
||||
def test_update_device(self):
|
||||
cmd = device.UpdateDevice(test_cli10.MyApp(sys.stdout), None)
|
||||
my_id = 'my-id'
|
||||
key = 'new-key'
|
||||
key = 'new_key'
|
||||
value = 'new-value'
|
||||
self._test_update_resource(self._RESOURCE, cmd, my_id,
|
||||
[my_id, '--kwargs', '%s=%s' % (key, value)],
|
||||
{'kwargs': {key: value}})
|
||||
[my_id, '--%s' % key, value],
|
||||
{key: value})
|
||||
|
||||
def test_delete_device(self):
|
||||
cmd = device.DeleteDevice(test_cli10.MyApp(sys.stdout), None)
|
||||
my_id = 'my-id'
|
||||
args = [my_id]
|
||||
self._test_delete_resource(self._RESOURCE, cmd, my_id, args)
|
||||
|
||||
|
||||
class CLITestV10VmDeviceXML(CLITestV10VmDeviceJSON):
|
||||
format = 'xml'
|
||||
|
||||
@@ -43,6 +43,7 @@ class CLITestV10VmDeviceTemplateJSON(test_cli10.CLITestV10Base):
|
||||
service_type = 'MY-SERVICE'
|
||||
device_driver = 'device-driver'
|
||||
mgmt_driver = 'mgmt-driver'
|
||||
infra_driver = 'infra-driver'
|
||||
attr_key = 'attr-key'
|
||||
attr_val = 'attr-val'
|
||||
args = [
|
||||
@@ -51,11 +52,14 @@ class CLITestV10VmDeviceTemplateJSON(test_cli10.CLITestV10Base):
|
||||
'--template-service-type', service_type,
|
||||
'--device-driver', device_driver,
|
||||
'--mgmt-driver', mgmt_driver,
|
||||
'--infra-driver', infra_driver,
|
||||
'--attribute', attr_key, attr_val,
|
||||
]
|
||||
position_names = ['name', 'description',
|
||||
'device_driver', 'mgmt_driver']
|
||||
position_values = [name, description, device_driver, mgmt_driver]
|
||||
'device_driver', 'mgmt_driver',
|
||||
'infra_driver']
|
||||
position_values = [name, description, device_driver,
|
||||
mgmt_driver, infra_driver]
|
||||
extra_body = {
|
||||
'service_types': [{'service_type': service_type}],
|
||||
'attributes': {attr_key: attr_val},
|
||||
@@ -71,13 +75,15 @@ class CLITestV10VmDeviceTemplateJSON(test_cli10.CLITestV10Base):
|
||||
service_type = 'MY-SERVICE'
|
||||
device_driver = 'device-driver'
|
||||
mgmt_driver = 'mgmt-driver'
|
||||
infra_driver = 'infra-driver'
|
||||
args = [
|
||||
'--template-service-type', service_type,
|
||||
'--device-driver', device_driver,
|
||||
'--mgmt-driver', mgmt_driver,
|
||||
'--infra-driver', infra_driver,
|
||||
]
|
||||
position_names = ['device_driver', 'mgmt_driver']
|
||||
position_values = [device_driver, mgmt_driver]
|
||||
position_names = ['device_driver', 'mgmt_driver', 'infra_driver']
|
||||
position_values = [device_driver, mgmt_driver, infra_driver]
|
||||
extra_body = {
|
||||
'service_types': [{'service_type': service_type}],
|
||||
}
|
||||
@@ -126,7 +132,3 @@ class CLITestV10VmDeviceTemplateJSON(test_cli10.CLITestV10Base):
|
||||
my_id = 'my-id'
|
||||
args = [my_id]
|
||||
self._test_delete_resource(self._RESOURCE, cmd, my_id, args)
|
||||
|
||||
|
||||
class CLITestV10VmDeviceTemplateXML(CLITestV10VmDeviceTemplateJSON):
|
||||
format = 'xml'
|
||||
|
||||
@@ -1,155 +0,0 @@
|
||||
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
||||
#
|
||||
# Copyright 2014 Intel
|
||||
# Copyright 2014 Isaku Yamahata <isaku.yamahata at intel com>
|
||||
# <isaku.yamahata at gmail com>
|
||||
# All Rights Reserved.
|
||||
#
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
# @author: Isaku Yamahata, Intel
|
||||
|
||||
import sys
|
||||
|
||||
from tackerclient.tacker.v1_0.vm import service_instance
|
||||
from tackerclient.tests.unit import test_cli10
|
||||
|
||||
|
||||
class CLITestV10VmServiceInstanceJSON(test_cli10.CLITestV10Base):
|
||||
_RESOURCE = 'service_instance'
|
||||
_RESOURCES = 'service_instances'
|
||||
|
||||
def setUp(self):
|
||||
plurals = {'service_instances': 'service_instance'}
|
||||
super(CLITestV10VmServiceInstanceJSON, self).setUp(plurals=plurals)
|
||||
|
||||
def test_create_service_instance_all_params(self):
|
||||
cmd = service_instance.CreateServiceInstance(
|
||||
test_cli10.MyApp(sys.stdout), None)
|
||||
my_id = 'my-id'
|
||||
name = 'my-name'
|
||||
service_type_id = 'service-type-id'
|
||||
service_table_id = 'service-table-id'
|
||||
mgmt_driver = 'mgmt-driver'
|
||||
network_id = 'network_id'
|
||||
subnet_id = 'subnet_id'
|
||||
port_id = 'port_id'
|
||||
router_id = 'router_id'
|
||||
role = 'role'
|
||||
index = 1
|
||||
|
||||
device = 'my-device'
|
||||
|
||||
key = 'key'
|
||||
value = 'value'
|
||||
|
||||
args = [
|
||||
'--name', name,
|
||||
'--service-type-id', service_type_id,
|
||||
'--service-table-id', service_table_id,
|
||||
'--mgmt-driver', mgmt_driver,
|
||||
'--service-context',
|
||||
('network-id=%s,subnet-id=%s,port-id=%s,router-id=%s,'
|
||||
'role=%s,index=%s' % (network_id, subnet_id, port_id, router_id,
|
||||
role, index)),
|
||||
'--device', device,
|
||||
'--kwargs', '%s=%s' % (key, value),
|
||||
]
|
||||
position_names = ['name', 'service_type_id', 'service_table_id',
|
||||
'mgmt_driver']
|
||||
position_values = [name, service_type_id, service_table_id,
|
||||
mgmt_driver]
|
||||
extra_body = {
|
||||
'devices': [device],
|
||||
'service_context': [{
|
||||
'network_id': network_id,
|
||||
'subnet_id': subnet_id,
|
||||
'port_id': port_id,
|
||||
'router_id': router_id,
|
||||
'role': role,
|
||||
'index': str(index),
|
||||
}],
|
||||
'kwargs': {
|
||||
key: value
|
||||
},
|
||||
}
|
||||
self._test_create_resource(self._RESOURCE, cmd, None, my_id,
|
||||
args, position_names, position_values,
|
||||
extra_body=extra_body)
|
||||
|
||||
def test_create_service_instance_with_mandatory_params(self):
|
||||
cmd = service_instance.CreateServiceInstance(
|
||||
test_cli10.MyApp(sys.stdout), None)
|
||||
my_id = 'my-id'
|
||||
service_type_id = 'service-type-id'
|
||||
service_table_id = 'service-table-id'
|
||||
device = 'my-device'
|
||||
args = [
|
||||
'--service-type-id', service_type_id,
|
||||
'--service-table-id', service_table_id,
|
||||
'--device', device,
|
||||
]
|
||||
position_names = ['service_type_id', 'service_table_id']
|
||||
position_values = [service_type_id, service_table_id]
|
||||
extra_body = {
|
||||
'devices': [device],
|
||||
}
|
||||
self._test_create_resource(self._RESOURCE, cmd, None, my_id,
|
||||
args, position_names, position_values,
|
||||
extra_body=extra_body)
|
||||
|
||||
def test_list_service_instances(self):
|
||||
cmd = service_instance.ListServiceInstance(
|
||||
test_cli10.MyApp(sys.stdout), None)
|
||||
self._test_list_resources(self._RESOURCES, cmd, True)
|
||||
|
||||
def test_list_service_instances_pagenation(self):
|
||||
cmd = service_instance.ListServiceInstance(
|
||||
test_cli10.MyApp(sys.stdout), None)
|
||||
self._test_list_resources(self._RESOURCES, cmd, True)
|
||||
|
||||
def test_show_service_instance_id(self):
|
||||
cmd = service_instance.ShowServiceInstance(
|
||||
test_cli10.MyApp(sys.stdout), None)
|
||||
args = ['--fields', 'id', self.test_id]
|
||||
self._test_show_resource(self._RESOURCE, cmd, self.test_id, args,
|
||||
['id'])
|
||||
|
||||
def test_show_service_instance_id_name(self):
|
||||
cmd = service_instance.ShowServiceInstance(
|
||||
test_cli10.MyApp(sys.stdout), None)
|
||||
args = ['--fields', 'id', '--fields', 'name', self.test_id]
|
||||
self._test_show_resource(self._RESOURCE, cmd, self.test_id,
|
||||
args, ['id', 'name'])
|
||||
|
||||
def test_update_service_instance(self):
|
||||
cmd = service_instance.UpdateServiceInstance(
|
||||
test_cli10.MyApp(sys.stdout), None)
|
||||
my_id = 'my-id'
|
||||
key = 'new-key'
|
||||
value = 'new-value'
|
||||
self._test_update_resource(self._RESOURCE, cmd, my_id,
|
||||
[my_id, '--kwargs', '%s=%s' % (key, value)],
|
||||
{'kwargs': {key: value}})
|
||||
|
||||
def test_delete_service_instance(self):
|
||||
cmd = service_instance.DeleteServiceInstance(
|
||||
test_cli10.MyApp(sys.stdout), None)
|
||||
my_id = 'my-id'
|
||||
args = [my_id]
|
||||
self._test_delete_resource(self._RESOURCE, cmd, my_id, args)
|
||||
|
||||
|
||||
class CLITestV10VmServiceInstanceXML(CLITestV10VmServiceInstanceJSON):
|
||||
format = 'xml'
|
||||
@@ -359,44 +359,54 @@ class Client(ClientBase):
|
||||
"""Fetch a list of all exts on server side."""
|
||||
return self.get(self.extension_path % ext_alias, params=_params)
|
||||
|
||||
@utils.deprecated('list_device_templates')
|
||||
def list_device_templates(self, retrieve_all=True, **_params):
|
||||
return self.list('device_templates', self.device_templates_path,
|
||||
retrieve_all, **_params)
|
||||
|
||||
@APIParamsCall
|
||||
@utils.deprecated('show_device_template')
|
||||
def show_device_template(self, device_template, **_params):
|
||||
return self.get(self.device_template_path % device_template,
|
||||
params=_params)
|
||||
|
||||
@APIParamsCall
|
||||
@utils.deprecated('update_device_template')
|
||||
def update_device_template(self, device_template, body=None):
|
||||
return self.put(self.device_template_path % device_template, body=body)
|
||||
|
||||
@APIParamsCall
|
||||
@utils.deprecated('create_device_template')
|
||||
def create_device_template(self, body=None):
|
||||
return self.post(self.device_templates_path, body=body)
|
||||
|
||||
@APIParamsCall
|
||||
@utils.deprecated('delete_device_template')
|
||||
def delete_device_template(self, device_template):
|
||||
return self.delete(self.device_template_path % device_template)
|
||||
|
||||
@APIParamsCall
|
||||
@utils.deprecated('list_devices')
|
||||
def list_devices(self, retrieve_all=True, **_params):
|
||||
return self.list('devices', self.devices_path, retrieve_all, **_params)
|
||||
|
||||
@APIParamsCall
|
||||
@utils.deprecated('show_device')
|
||||
def show_device(self, device, **_params):
|
||||
return self.get(self.device_path % device, params=_params)
|
||||
|
||||
@APIParamsCall
|
||||
@utils.deprecated('update_device')
|
||||
def update_device(self, device, body=None):
|
||||
return self.put(self.device_path % device, body=body)
|
||||
|
||||
@APIParamsCall
|
||||
@utils.deprecated('create_device')
|
||||
def create_device(self, body=None):
|
||||
return self.post(self.devices_path, body=body)
|
||||
|
||||
@APIParamsCall
|
||||
@utils.deprecated('delete_device')
|
||||
def delete_device(self, device):
|
||||
return self.delete(self.device_path % device)
|
||||
|
||||
|
||||
@@ -1,11 +1,16 @@
|
||||
hacking>=0.8.0,<0.9
|
||||
|
||||
# The order of packages is significant, because pip processes them in the order
|
||||
# of appearance. Changing the order has an impact on the overall integration
|
||||
# process, which may cause wedges in the gate later.
|
||||
hacking>=0.10.2,<0.11
|
||||
cliff-tablib>=1.0
|
||||
coverage>=3.6
|
||||
discover
|
||||
fixtures>=0.3.14
|
||||
fixtures>=1.3.1
|
||||
mox>=0.5.3
|
||||
flake8>=2.2.4,<=2.4.1
|
||||
pep8==1.5.7
|
||||
pyflakes==0.8.1
|
||||
python-subunit>=0.0.18
|
||||
sphinx>=1.1.2,<1.2
|
||||
sphinx>=1.1.2,!=1.2.0,!=1.3b1,<1.3
|
||||
testrepository>=0.0.18
|
||||
testtools>=0.9.34
|
||||
testtools>=1.4.0
|
||||
|
||||
8
tox.ini
8
tox.ini
@@ -30,6 +30,12 @@ downloadcache = ~/cache/pip
|
||||
[flake8]
|
||||
# E125 continuation line does not distinguish itself from next logical line
|
||||
# H302 import only modules
|
||||
ignore = E125,H302
|
||||
# H105 Don't use author tags
|
||||
# H405 multi line docstring summary not separated with an empty line
|
||||
# E265 block comment should start with '# '
|
||||
# H238 old style class declaration, use new style (inherit from `object`)
|
||||
# E129 visually indented line with same indent as next logical line
|
||||
# E113 unexpected indentation
|
||||
ignore = E125,H302,H105,H405,E265,H238,E129,E113
|
||||
show-source = true
|
||||
exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,tools
|
||||
|
||||
Reference in New Issue
Block a user