summaryrefslogtreecommitdiff
path: root/openstackclient/tests/functional/network
diff options
context:
space:
mode:
authorNakul Dahiwade <nakul.dahiwade@intel.com>2016-11-11 21:42:24 +0000
committerNakul Dahiwade <nakul.dahiwade@intel.com>2017-03-20 16:24:27 +0000
commit7ef1e9ea96ef15b63304a6bccaf30f8c269f2b76 (patch)
tree4ab88bee8ac05e515ee8203e52b53b4f3c14d053 /openstackclient/tests/functional/network
parent69b7b9b0592d3699a02bb8d17539c20749281b8d (diff)
downloadpython-openstackclient-7ef1e9ea96ef15b63304a6bccaf30f8c269f2b76.tar.gz
OSC Network Flavor Profile
Implement Neutron feature of Network Flavor Profile into OpenstackClient This patch implements the following commands: network flavor profile create network flavor profile delete network flavor profile list network flavor profile show network flavor profile set SDK Version needed: 0.9.9 Change-Id: Ie6fe5e53122cfb2eda8d326851d54562739a8386 Partially-Implements: blueprint neutron-client-flavors
Diffstat (limited to 'openstackclient/tests/functional/network')
-rw-r--r--openstackclient/tests/functional/network/v2/test_network_flavor_profile.py151
1 files changed, 151 insertions, 0 deletions
diff --git a/openstackclient/tests/functional/network/v2/test_network_flavor_profile.py b/openstackclient/tests/functional/network/v2/test_network_flavor_profile.py
new file mode 100644
index 00000000..1a82c82b
--- /dev/null
+++ b/openstackclient/tests/functional/network/v2/test_network_flavor_profile.py
@@ -0,0 +1,151 @@
+# 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.
+
+import json
+
+from openstackclient.tests.functional import base
+
+
+class NetworkFlavorProfileTests(base.TestCase):
+ """Functional tests for network flavor-profile."""
+
+ DESCRIPTION = 'fakedescription'
+ METAINFO = 'Extrainfo'
+
+ def test_network_flavor_profile_create(self):
+ json_output = json.loads(self.openstack(
+ ' network flavor profile create -f json --description '
+ + self.DESCRIPTION + ' --enable --metainfo ' + self.METAINFO))
+ ID = json_output.get('id')
+ self.assertIsNotNone(ID)
+ self.assertEqual(
+ True,
+ json_output.get('enabled'))
+ self.assertEqual(
+ 'fakedescription',
+ json_output.get('description'))
+ self.assertEqual(
+ 'Extrainfo',
+ json_output.get('meta_info')
+ )
+
+ # Clean up
+ raw_output = self.openstack('network flavor profile delete ' + ID)
+ self.assertOutput('', raw_output)
+
+ def test_network_flavor_profile_list(self):
+ json_output = json.loads(self.openstack(
+ ' network flavor profile create -f json --description '
+ + self.DESCRIPTION + ' --enable --metainfo ' + self.METAINFO))
+ ID1 = json_output.get('id')
+ self.assertIsNotNone(ID1)
+ self.assertEqual(
+ True,
+ json_output.get('enabled'))
+ self.assertEqual(
+ 'fakedescription',
+ json_output.get('description'))
+ self.assertEqual(
+ 'Extrainfo',
+ json_output.get('meta_info')
+ )
+
+ json_output = json.loads(self.openstack(
+ ' network flavor profile create -f json --description '
+ + self.DESCRIPTION + ' --disable --metainfo ' + self.METAINFO))
+ ID2 = json_output.get('id')
+ self.assertIsNotNone(ID2)
+ self.assertEqual(
+ False,
+ json_output.get('enabled'))
+ self.assertEqual(
+ 'fakedescription',
+ json_output.get('description'))
+ self.assertEqual(
+ 'Extrainfo',
+ json_output.get('meta_info')
+ )
+
+ # Test list
+ json_output = json.loads(self.openstack(
+ 'network flavor profile list -f json'))
+ self.assertIsNotNone(json_output)
+
+ id_list = [item.get('ID') for item in json_output]
+ self.assertIn(ID1, id_list)
+ self.assertIn(ID2, id_list)
+
+ # Clean up
+ raw_output = self.openstack(
+ 'network flavor profile delete ' + ID1 + " " + ID2)
+ self.assertOutput('', raw_output)
+
+ def test_network_flavor_profile_set(self):
+ json_output_1 = json.loads(self.openstack(
+ ' network flavor profile create -f json --description '
+ + self.DESCRIPTION + ' --enable --metainfo ' + self.METAINFO))
+ ID = json_output_1.get('id')
+ self.assertIsNotNone(ID)
+ self.assertEqual(
+ True,
+ json_output_1.get('enabled'))
+ self.assertEqual(
+ 'fakedescription',
+ json_output_1.get('description'))
+ self.assertEqual(
+ 'Extrainfo',
+ json_output_1.get('meta_info')
+ )
+
+ self.openstack('network flavor profile set --disable ' + ID)
+
+ json_output = json.loads(self.openstack('network flavor profile show '
+ '-f json ' + ID))
+ self.assertEqual(
+ False,
+ json_output.get('enabled'))
+ self.assertEqual(
+ 'fakedescription',
+ json_output.get('description'))
+ self.assertEqual(
+ 'Extrainfo',
+ json_output.get('meta_info')
+ )
+
+ # Clean up
+ raw_output = self.openstack('network flavor profile delete ' + ID)
+ self.assertOutput('', raw_output)
+
+ def test_network_flavor_profile_show(self):
+ json_output_1 = json.loads(self.openstack(
+ ' network flavor profile create -f json --description '
+ + self.DESCRIPTION + ' --enable --metainfo ' + self.METAINFO))
+ ID = json_output_1.get('id')
+ self.assertIsNotNone(ID)
+ json_output = json.loads(self.openstack('network flavor profile show '
+ '-f json ' + ID))
+ self.assertEqual(
+ ID,
+ json_output["id"])
+ self.assertEqual(
+ True,
+ json_output["enabled"])
+ self.assertEqual(
+ 'fakedescription',
+ json_output["description"])
+ self.assertEqual(
+ 'Extrainfo',
+ json_output["meta_info"])
+
+ # Clean up
+ raw_output = self.openstack('network flavor profile delete ' + ID)
+ self.assertOutput('', raw_output)