summaryrefslogtreecommitdiff
path: root/openstackclient/tests/unit/network
diff options
context:
space:
mode:
authorAradhana Singh <aradhana1.singh>2016-10-06 21:51:01 +0000
committerAradhana Singh <aradhana1.singh@intel.com>2016-10-17 22:21:34 +0000
commitc99ec284db181c7f9c72ce1163ba1ea45fe369d0 (patch)
tree1eabccbbeee1928c4248f115a613e4d174d50ca3 /openstackclient/tests/unit/network
parent0f02f7ea1ed285ca08ad5f1423fdf0671a3b9920 (diff)
downloadpython-openstackclient-c99ec284db181c7f9c72ce1163ba1ea45fe369d0.tar.gz
Add description field port create & port set
This patchset 1. adds description field to openstack port create and openstack port set. 2. updates method _add_updatable_args with 4 spaces instead of existing 8 spaces Partially Implements: blueprint neutron-client-descriptions Partially Implements: blueprint network-commands-options Change-Id: I4598e555722b1de7bc47f3a9be0fd81eacfcb572
Diffstat (limited to 'openstackclient/tests/unit/network')
-rw-r--r--openstackclient/tests/unit/network/v2/fakes.py1
-rw-r--r--openstackclient/tests/unit/network/v2/test_port.py8
2 files changed, 9 insertions, 0 deletions
diff --git a/openstackclient/tests/unit/network/v2/fakes.py b/openstackclient/tests/unit/network/v2/fakes.py
index 94727ae3..8994517e 100644
--- a/openstackclient/tests/unit/network/v2/fakes.py
+++ b/openstackclient/tests/unit/network/v2/fakes.py
@@ -427,6 +427,7 @@ class FakePort(object):
'binding:vif_details': {},
'binding:vif_type': 'ovs',
'binding:vnic_type': 'normal',
+ 'description': 'description-' + uuid.uuid4().hex,
'device_id': 'device-id-' + uuid.uuid4().hex,
'device_owner': 'compute:nova',
'dns_assignment': [{}],
diff --git a/openstackclient/tests/unit/network/v2/test_port.py b/openstackclient/tests/unit/network/v2/test_port.py
index a2aceab1..110f713e 100644
--- a/openstackclient/tests/unit/network/v2/test_port.py
+++ b/openstackclient/tests/unit/network/v2/test_port.py
@@ -41,6 +41,7 @@ class TestPort(network_fakes.TestNetworkV2):
'binding_vif_details',
'binding_vif_type',
'binding_vnic_type',
+ 'description',
'device_id',
'device_owner',
'dns_assignment',
@@ -65,6 +66,7 @@ class TestPort(network_fakes.TestNetworkV2):
utils.format_dict(fake_port.binding_vif_details),
fake_port.binding_vif_type,
fake_port.binding_vnic_type,
+ fake_port.description,
fake_port.device_id,
fake_port.device_owner,
utils.format_list_of_dicts(fake_port.dns_assignment),
@@ -130,6 +132,7 @@ class TestCreatePort(TestPort):
'--mac-address', 'aa:aa:aa:aa:aa:aa',
'--fixed-ip', 'subnet=%s,ip-address=10.0.0.2'
% self.fake_subnet.id,
+ '--description', self._port.description,
'--device', 'deviceid',
'--device-owner', 'fakeowner',
'--disable',
@@ -146,6 +149,7 @@ class TestCreatePort(TestPort):
'fixed_ip',
[{'subnet': self.fake_subnet.id, 'ip-address': '10.0.0.2'}]
),
+ ('description', self._port.description),
('device', 'deviceid'),
('device_owner', 'fakeowner'),
('disable', True),
@@ -163,6 +167,7 @@ class TestCreatePort(TestPort):
'mac_address': 'aa:aa:aa:aa:aa:aa',
'fixed_ips': [{'subnet_id': self.fake_subnet.id,
'ip_address': '10.0.0.2'}],
+ 'description': self._port.description,
'device_id': 'deviceid',
'device_owner': 'fakeowner',
'admin_state_up': False,
@@ -565,6 +570,7 @@ class TestSetPort(TestPort):
def test_set_that(self):
arglist = [
+ '--description', 'newDescription',
'--enable',
'--vnic-type', 'macvtap',
'--binding-profile', 'foo=bar',
@@ -573,6 +579,7 @@ class TestSetPort(TestPort):
self._port.name,
]
verifylist = [
+ ('description', 'newDescription'),
('enable', True),
('vnic_type', 'macvtap'),
('binding_profile', {'foo': 'bar'}),
@@ -589,6 +596,7 @@ class TestSetPort(TestPort):
'binding:vnic_type': 'macvtap',
'binding:profile': {'foo': 'bar'},
'binding:host_id': 'binding-host-id-xxxx',
+ 'description': 'newDescription',
'name': 'newName',
}
self.network.update_port.assert_called_once_with(self._port, **attrs)