Patch to add some fixes

- Due to upstream changes tempest cases were failing.
  This patch will fix all those issues.
- Fix for qos cases which wrere failing due to
  recent changes

Change-Id: Id91add943d628fcfc87cfa52c3c94de024c5dd32
This commit is contained in:
Shubhamk Kadam 2018-09-04 10:13:27 +00:00
parent 91a467bec0
commit 562dc10229
6 changed files with 69 additions and 59 deletions

View File

@ -69,6 +69,7 @@ class BaseQosTest(base.BaseAdminNetworkTest):
body = client_mgr.ports_client.create_port(
network_id=network['id'], **kwargs)
port = body.get('port', body)
cls.ports = []
cls.ports.append(port)
return port
@ -424,15 +425,11 @@ class QosPolicyTest(BaseQosTest):
network = self.create_shared_network('test network')
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
self.delete_network, network['id'])
port = self.create_port(network, qos_policy_id=policy['id'],
client_mgr=self.primary_mgr)
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
self.delete_port, port['id'])
retrieved_port = self.show_port(port['id'],
client_mgr=self.primary_mgr)
# check if port is not attached to the policy
self.assertIsNone(retrieved_port['qos_policy_id'],
'Error:Port is attached to qos policy')
self.assertRaises(
exceptions.NotFound,
self.create_port,
network,
qos_policy_id=policy['id'], client_mgr=self.primary_mgr)
@decorators.attr(type='nsxv3')
@decorators.idempotent_id('f8163237-fba9-4db5-9526-bad6d2343c76')

View File

@ -86,6 +86,7 @@ class BaseTestCase(base.BaseNetworkTest):
cls.subnet = cls.create_subnet(cls.network)
cls.tenant_id = cls.subnet.get('tenant_id')
cls.subnet_id = cls.subnet.get('id')
cls.ports = []
# NSX-v: load-balancer's subnet need to attach to exclusive-router
if CONF.network.backend == "nsxv3":
router_cfg = dict(

View File

@ -50,8 +50,9 @@ class NSXv3FloatingIPTest(base.BaseNetworkTest):
cls.router = cls.create_router(data_utils.rand_name('router-'),
external_network_id=cls.ext_net_id)
cls.create_router_interface(cls.router['id'], cls.subnet['id'])
cls.ports = []
for i in range(2):
cls.create_port(cls.network)
cls.ports.append(cls.create_port(cls.network))
cls.nsx = nsxv3_client.NSXV3Client(CONF.nsxv3.nsx_manager,
CONF.nsxv3.nsx_user,
CONF.nsxv3.nsx_password)

View File

@ -27,6 +27,7 @@ LOG = logging.getLogger(__name__)
class TestMDProxy(feature_manager.FeatureManager):
"""Test MDProxy.
Adding test cases to test MDProxy in different scenarios such as
@ -100,48 +101,54 @@ class TestMDProxy(feature_manager.FeatureManager):
md_counter = 0
logical_ports = self.nsx.get_os_logical_ports()
for port_index in range(len(logical_ports)):
if logical_ports[port_index]["attachment"][
"attachment_type"] == "METADATA_PROXY":
if logical_ports[port_index]["tags"][0]["tag"] == network_id:
msg = "MDproxy logical port does not have proper tenant " \
"id!!!"
if "attachment" in logical_ports[port_index]:
if logical_ports[port_index]["attachment"][
"attachment_type"] == "METADATA_PROXY":
if logical_ports[port_index][
"tags"][0]["tag"] == network_id:
msg = "MDproxy logical port does not "\
"have proper tenant "\
"id!!!"
self.assertEqual(
tenant_id, logical_ports[port_index]["tags"][1][
"tag"], msg)
md_counter += 1
msg1 = "Admin state of MDProxy logical port is DOWN!!!"
msg2 = "LS name does not start with mdproxy!!!"
msg3 = "MDproxy logical port does not have any auto tag!!!"
msg4 = "MDproxy logical port does not have scope tag as " \
"os-neutron-net-id!!!"
msg5 = "MDproxy logical port does not have scope tag as " \
"os-project-id!!!"
msg6 = "MDproxy logical port does not have scope tag as " \
"os-project-name!!!"
msg7 = "MDproxy logical port does not have scope tag as " \
"os-api-version!!!"
self.assertEqual(
tenant_id, logical_ports[port_index]["tags"][1][
"tag"], msg)
md_counter += 1
msg1 = "Admin state of MDProxy logical port is DOWN!!!"
msg2 = "LS name does not start with mdproxy!!!"
msg3 = "MDproxy logical port does not have any auto tag!!!"
msg4 = "MDproxy logical port does not have scope tag as " \
"os-neutron-net-id!!!"
msg5 = "MDproxy logical port does not have scope tag as " \
"os-project-id!!!"
msg6 = "MDproxy logical port does not have scope tag as " \
"os-project-name!!!"
msg7 = "MDproxy logical port does not have scope tag as " \
"os-api-version!!!"
self.assertEqual(
"UP", logical_ports[port_index]["admin_state"], msg1)
self.assertIn("mdproxy-",
logical_ports[port_index]["display_name"], msg2)
self.assertNotEqual(0, len(logical_ports[port_index]["tags"]),
msg3)
self.assertEqual(
"os-neutron-net-id",
logical_ports[port_index]["tags"][0]["scope"],
msg4)
self.assertEqual(
"os-project-id",
logical_ports[port_index]["tags"][1]["scope"],
msg5)
self.assertEqual(
"os-project-name",
logical_ports[port_index]["tags"][2]["scope"],
msg6)
self.assertEqual(
"os-api-version",
logical_ports[port_index]["tags"][3]["scope"],
msg7)
"UP", logical_ports[port_index]["admin_state"], msg1)
self.assertIn("mdproxy-",
logical_ports[port_index]["display_name"],
msg2)
self.assertNotEqual(
0,
len(logical_ports[port_index]["tags"]),
msg3)
self.assertEqual(
"os-neutron-net-id",
logical_ports[port_index]["tags"][0]["scope"],
msg4)
self.assertEqual(
"os-project-id",
logical_ports[port_index]["tags"][1]["scope"],
msg5)
self.assertEqual(
"os-project-name",
logical_ports[port_index]["tags"][2]["scope"],
msg6)
self.assertEqual(
"os-api-version",
logical_ports[port_index]["tags"][3]["scope"],
msg7)
self.assertNotEqual(0, md_counter, "No logical port found for MD "
"proxy!!!")

View File

@ -123,12 +123,14 @@ class TestNSXv3PortSecurityScenario(manager.NetworkScenarioTest):
def get_port_id(self, network_id, subnet_id, instance):
_, instance_addr = instance["addresses"].items()[0]
instance_fixed_ip = instance_addr[0]["addr"]
port_id = None
for port in self._list_ports():
port_fixed_ip = port["fixed_ips"][0]["ip_address"]
if port["network_id"] == network_id and port["fixed_ips"][0][
if "fixed_ips" in port:
port_fixed_ip = port["fixed_ips"][0]["ip_address"]
if port["network_id"] == network_id and port["fixed_ips"][0][
"subnet_id"] == subnet_id and instance["id"] == port[
"device_id"] and port_fixed_ip == instance_fixed_ip:
port_id = port["id"]
"device_id"] and port_fixed_ip == instance_fixed_ip:
port_id = port["id"]
self.assertIsNotNone(port_id, "Failed to find Instance's port id!!!")
return port_id

View File

@ -134,12 +134,14 @@ class TestProviderSecurityGroup(manager.NetworkScenarioTest):
def get_port_id(self, network_id, subnet_id, instance):
_, instance_addr = instance["addresses"].items()[0]
instance_fixed_ip = instance_addr[0]["addr"]
port_id = None
for port in self._list_ports():
port_fixed_ip = port["fixed_ips"][0]["ip_address"]
if port["network_id"] == network_id and port["fixed_ips"][0][
if "fixed_ips" in port:
port_fixed_ip = port["fixed_ips"][0]["ip_address"]
if port["network_id"] == network_id and port["fixed_ips"][0][
"subnet_id"] == subnet_id and instance["id"] == port[
"device_id"] and port_fixed_ip == instance_fixed_ip:
port_id = port["id"]
"device_id"] and port_fixed_ip == instance_fixed_ip:
port_id = port["id"]
self.assertIsNotNone(port_id, "Failed to find Instance's port id!!!")
return port_id