Merge "Bridge Gateway Testcase"

This commit is contained in:
Zuul 2019-06-03 08:08:50 +00:00 committed by Gerrit Code Review
commit f90d69a829

View File

@ -38,7 +38,8 @@ class L2GatewayBase(feature_manager.FeatureManager):
Skip running test if we do not meet criteria to run the tests.
"""
super(L2GatewayBase, cls).skip_checks()
if not test.is_extension_enabled("l2-gateway", "network"):
if not test.is_extension_enabled("l2-gateway", "network") \
or CONF.network.backend == 'nsxp':
raise cls.skipException("l2-gateway extension not enabled.")
@classmethod
@ -425,6 +426,67 @@ class L2GatewayConnectionTest(L2GatewayBase):
"network id is not same as expected in "
"create l2gw connection response")
@decorators.attr(type="nsxv3")
@decorators.idempotent_id("81edfb9e-4722-4565-939c-6593b8406ff4")
def test_l2_gateway_two_connections_create(self):
"""
Create l2 gateway connection using one vlan. Vlan parameter is
passed into L2GW create.
"""
LOG.info("Testing test_l2_gateway_connection_create api")
self.deploy_l2gateway_topology()
if CONF.nsxv3.bridge_cluster:
cluster_info = self.nsx_bridge_cluster_info()
else:
cluster_info = self.nsx_bridge_profile_info()
transport_zone = self.nsx_transport_zone_info()
device_name, interface_name = cluster_info[0][0], transport_zone
l2gw_name = data_utils.rand_name(constants.L2GW)
device_1 = {"dname": device_name, "iname": interface_name}
l2gw_param = [device_1]
l2gw_rsp, _ = self.create_l2gw(l2gw_name, l2gw_param)
l2gwc_param = {"l2_gateway_id": l2gw_rsp[constants.L2GW]["id"],
"network_id":
self.topology_networks["network_l2gateway"]["id"],
"segmentation_id": self.VLAN_1}
l2gwc_rsp = self.create_l2gw_connection(l2gwc_param)
l2gw_name2 = data_utils.rand_name(constants.L2GW)
device_2 = {"dname": device_name, "iname": interface_name}
l2gw_param2 = [device_2]
l2gw_rsp2, _ = self.create_l2gw(l2gw_name2, l2gw_param2)
l2gwc_param2 = {"l2_gateway_id": l2gw_rsp2[constants.L2GW]["id"],
"network_id":
self.topology_networks["network_l2gateway"]["id"],
"segmentation_id": self.VLAN_2}
l2gwc_rsp2 = self.create_l2gw_connection(l2gwc_param2)
# Assert if create fails.
self.assertEqual(constants.EXPECTED_HTTP_RESPONSE_201,
l2gwc_rsp.response["status"],
"Response code is not %(code)s" % {
"code": constants.EXPECTED_HTTP_RESPONSE_201})
self.assertEqual(l2gwc_param["l2_gateway_id"],
l2gwc_rsp[constants.L2GWC]["l2_gateway_id"],
"l2gw id is not same as expected in "
"create l2gw connection response")
self.assertEqual(l2gwc_param["network_id"],
l2gwc_rsp[constants.L2GWC]["network_id"],
"network id is not same as expected in "
"create l2gw connection response")
# Assert if create fails.
self.assertEqual(constants.EXPECTED_HTTP_RESPONSE_201,
l2gwc_rsp2.response["status"],
"Response code is not %(code)s" % {
"code": constants.EXPECTED_HTTP_RESPONSE_201})
self.assertEqual(l2gwc_param2["l2_gateway_id"],
l2gwc_rsp2[constants.L2GWC]["l2_gateway_id"],
"l2gw id is not same as expected in "
"create l2gw connection response")
self.assertEqual(l2gwc_param2["network_id"],
l2gwc_rsp2[constants.L2GWC]["network_id"],
"network id is not same as expected in "
"create l2gw connection response")
@decorators.attr(type="nsxv3")
@decorators.idempotent_id("7db4f6c9-18c5-4a99-93c1-68bc2ecb48a7")
def test_l2_gateway_connection_create_with_multiple_vlans(self):