Merge "Add new test cases for network ip availability"
diff --git a/neutron_tempest_plugin/api/base.py b/neutron_tempest_plugin/api/base.py
index c4bc71d..b200761 100644
--- a/neutron_tempest_plugin/api/base.py
+++ b/neutron_tempest_plugin/api/base.py
@@ -431,6 +431,8 @@
ip_version=ip_version, cidr=cidr, mask_bits=mask_bits):
if gateway is not None:
kwargs['gateway_ip'] = str(gateway or (subnet_cidr.ip + 1))
+ else:
+ kwargs['gateway_ip'] = None
try:
body = client.create_subnet(
network_id=network['id'],
@@ -611,7 +613,11 @@
cls.external_network_id)
if port:
- kwargs['port_id'] = port['id']
+ port_id = kwargs.setdefault('port_id', port['id'])
+ if port_id != port['id']:
+ message = "Port ID specified twice: {!s} != {!s}".format(
+ port_id, port['id'])
+ raise ValueError(message)
fip = client.create_floatingip(external_network_id,
**kwargs)['floatingip']
diff --git a/neutron_tempest_plugin/api/test_availability_zones.py b/neutron_tempest_plugin/api/test_availability_zones.py
new file mode 100644
index 0000000..9d75c28
--- /dev/null
+++ b/neutron_tempest_plugin/api/test_availability_zones.py
@@ -0,0 +1,30 @@
+# Copyright 2018 AT&T Corporation.
+# 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.
+
+from tempest.common import utils
+from tempest.lib import decorators
+
+from neutron_tempest_plugin.api import base
+
+
+class ListAvailableZonesTest(base.BaseNetworkTest):
+
+ @decorators.idempotent_id('5a8a8a1a-c265-11e8-a611-080027758b73')
+ @utils.requires_ext(extension="availability_zone",
+ service="network")
+ def test_list_available_zones(self):
+ body = self.client.list_availability_zones()
+ self.assertIsNotNone(body)
+ self.assertIsInstance(body['availability_zones'], list)
diff --git a/neutron_tempest_plugin/services/network/json/network_client.py b/neutron_tempest_plugin/services/network/json/network_client.py
index 58dfbf4..3b07e24 100644
--- a/neutron_tempest_plugin/services/network/json/network_client.py
+++ b/neutron_tempest_plugin/services/network/json/network_client.py
@@ -41,7 +41,7 @@
# The following list represents resource names that do not require
# changing underscore to a hyphen
- hyphen_exceptions = ["service_profiles"]
+ hyphen_exceptions = ["service_profiles", "availability_zones"]
# the following map is used to construct proper URI
# for the given neutron resource
service_resource_prefix_map = {