Expose description attribute on trunk API
This is available in the data model, but it is currently
left unset. Expose and process it so that users can
add fancy descriptions to their trunk resources.
Partially-implements: blueprint vlan-aware-vms
Change-Id: Ie3149e206fe8a83631dd9d42d344fea3f03dc0db
diff --git a/neutron/tests/tempest/api/test_trunk.py b/neutron/tests/tempest/api/test_trunk.py
index c22c334..a371366 100644
--- a/neutron/tests/tempest/api/test_trunk.py
+++ b/neutron/tests/tempest/api/test_trunk.py
@@ -98,6 +98,7 @@
res = self.client.show_trunk(trunk_id)
self.assertTrue(res['trunk']['admin_state_up'])
self.assertEqual("", res['trunk']['name'])
+ self.assertEqual("", res['trunk']['description'])
res = self.client.update_trunk(
trunk_id, name='foo', admin_state_up=False)
self.assertFalse(res['trunk']['admin_state_up'])
@@ -105,6 +106,15 @@
# enable the trunk so that it can be managed
self.client.update_trunk(trunk_id, admin_state_up=True)
+ @test.idempotent_id('5ff46c22-a2b6-5559-bc5a-0ef2463cab32')
+ def test_create_update_trunk_with_description(self):
+ trunk = self._create_trunk_with_network_and_parent(
+ None, description="foo description")
+ trunk_id = trunk['trunk']['id']
+ self.assertEqual("foo description", trunk['trunk']['description'])
+ trunk = self.client.update_trunk(trunk_id, description='')
+ self.assertEqual('', trunk['trunk']['description'])
+
@test.idempotent_id('73365f73-bed6-42cd-960b-ec04e0c99d85')
def test_list_trunks(self):
trunk1 = self._create_trunk_with_network_and_parent(None)
diff --git a/neutron/tests/tempest/services/network/json/network_client.py b/neutron/tests/tempest/services/network/json/network_client.py
index 54a1fc3..fa31daa 100644
--- a/neutron/tests/tempest/services/network/json/network_client.py
+++ b/neutron/tests/tempest/services/network/json/network_client.py
@@ -660,7 +660,8 @@
return service_client.ResponseBody(resp, body)
def create_trunk(self, parent_port_id, subports,
- tenant_id=None, name=None, admin_state_up=None):
+ tenant_id=None, name=None, admin_state_up=None,
+ description=None):
uri = '%s/trunks' % self.uri_prefix
post_data = {
'trunk': {
@@ -673,6 +674,8 @@
post_data['trunk']['tenant_id'] = tenant_id
if name is not None:
post_data['trunk']['name'] = name
+ if description is not None:
+ post_data['trunk']['description'] = description
if admin_state_up is not None:
post_data['trunk']['admin_state_up'] = admin_state_up
resp, body = self.post(uri, self.serialize(post_data))