Bridge Endpoint Profile changes.

Change-Id: I02078350c60c9e353293ed403502641b07f1d6c4
This commit is contained in:
Nilesh Lokhande 2019-04-06 11:56:27 +00:00
parent 011e157820
commit 4c4d34e231
4 changed files with 61 additions and 13 deletions

View File

@ -451,6 +451,17 @@ class FeatureManager(traffic_manager.IperfManager,
raise RuntimeError(_("NSX bridge cluster information is null"))
return [(x.get("id"), x.get("display_name")) for x in response]
def nsx_bridge_profile_info(self):
"""Collect the device and interface name of the nsx brdige profile.
:return: nsx bridge id and display name.
"""
response = self.nsx_client.get_bridge_profile_info()
if len(response) == 0:
raise RuntimeError(_("NSX bridge profile information is null"))
return [(x.get("id"), x.get("display_name")) for x in response]
def create_l2gw_connection(self, l2gwc_param):
"""Creates L2GWC and return the response.

View File

@ -45,6 +45,11 @@ class NSXClient(object):
return self.nsx.get_bridge_cluster_info(
*args, **kwargs)
def get_bridge_profile_info(self, *args, **kwargs):
if self.backend == "nsxv3":
return self.nsx.get_bridge_profile_info(
*args, **kwargs)
def get_qos_switching_profile(self, policy_name):
"""
Retrieve attributes of a given nsx switching profile

View File

@ -324,6 +324,14 @@ class NSXV3Client(object):
"""
return self.get_logical_resources("/bridge-clusters")
def get_bridge_profile_info(self):
"""
Get bridge profile information.
:return: returns bridge profile id and bridge profile name.
"""
return self.get_logical_resources("/bridge-endpoint-profiles")
def get_logical_switch(self, os_name, os_uuid):
"""
Get the logical switch based on the name and uuid provided.

View File

@ -76,7 +76,10 @@ class L2GatewayTest(L2GatewayBase):
bridge cluster UUID (device name) from NSX manager.
"""
LOG.info("Testing l2_gateway_create api")
if CONF.nsxv3.bridge_cluster:
cluster_info = self.nsx_bridge_cluster_info()
else:
cluster_info = self.nsx_bridge_profile_info()
device_name, interface_name = cluster_info[0][0], cluster_info[0][1]
l2gw_name = data_utils.rand_name(constants.L2GW)
device_1 = {"dname": device_name, "iname": interface_name}
@ -100,7 +103,10 @@ class L2GatewayTest(L2GatewayBase):
bridge cluster UUID (device name) from NSX manager and vlan id.
"""
LOG.info("Testing l2_gateway_create api with segmentation ID")
if CONF.nsxv3.bridge_cluster:
cluster_info = self.nsx_bridge_cluster_info()
else:
cluster_info = self.nsx_bridge_profile_info()
device_name, interface_name = cluster_info[0][0], cluster_info[0][1]
l2gw_name = data_utils.rand_name(constants.L2GW)
device_1 = {"dname": device_name, "iname": interface_name,
@ -136,7 +142,10 @@ class L2GatewayTest(L2GatewayBase):
bridge cluster UUID (device name) from NSX manager and vlan id.
"""
LOG.info("Testing l2_gateway_create api with segmentation ID")
if CONF.nsxv3.bridge_cluster:
cluster_info = self.nsx_bridge_cluster_info()
else:
cluster_info = self.nsx_bridge_profile_info()
device_name, interface_name = cluster_info[0][0], cluster_info[0][1]
l2gw_name = data_utils.rand_name(constants.L2GW)
device_1 = {"dname": device_name, "iname": interface_name,
@ -171,7 +180,10 @@ class L2GatewayTest(L2GatewayBase):
delete l2gw we need l2gw id.
"""
LOG.info("Testing l2_gateway_delete api")
if CONF.nsxv3.bridge_cluster:
cluster_info = self.nsx_bridge_cluster_info()
else:
cluster_info = self.nsx_bridge_profile_info()
device_name, interface_name = cluster_info[0][0], cluster_info[0][1]
l2gw_name = data_utils.rand_name(constants.L2GW)
device_1 = {"dname": device_name, "iname": interface_name}
@ -200,7 +212,10 @@ class L2GatewayTest(L2GatewayBase):
update l2gw we need l2gw id and payload to update.
"""
LOG.info("Testing l2_gateway_update api")
if CONF.nsxv3.bridge_cluster:
cluster_info = self.nsx_bridge_cluster_info()
else:
cluster_info = self.nsx_bridge_profile_info()
device_name, interface_name = cluster_info[0][0], cluster_info[0][1]
l2gw_name = data_utils.rand_name(constants.L2GW)
device_1 = {"dname": device_name, "iname": interface_name}
@ -241,7 +256,10 @@ class L2GatewayTest(L2GatewayBase):
update l2gw we need l2gw id and payload to update.
"""
LOG.info("Testing l2_gateway_update api")
if CONF.nsxv3.bridge_cluster:
cluster_info = self.nsx_bridge_cluster_info()
else:
cluster_info = self.nsx_bridge_profile_info()
device_name, interface_name = cluster_info[0][0], cluster_info[0][1]
l2gw_name = data_utils.rand_name(constants.L2GW)
device_1 = {"dname": device_name, "iname": interface_name}
@ -283,7 +301,10 @@ class L2GatewayTest(L2GatewayBase):
show l2gw based on UUID. To see l2gw info we need l2gw id.
"""
LOG.info("Testing l2_gateway_show api")
if CONF.nsxv3.bridge_cluster:
cluster_info = self.nsx_bridge_cluster_info()
else:
cluster_info = self.nsx_bridge_profile_info()
device_name, interface_name = cluster_info[0][0], cluster_info[0][1]
l2gw_name = data_utils.rand_name(constants.L2GW)
device_1 = {"dname": device_name, "iname": interface_name,
@ -325,7 +346,10 @@ class L2GatewayTest(L2GatewayBase):
list created l2gw.
"""
LOG.info("Testing l2_gateway_list api")
if CONF.nsxv3.bridge_cluster:
cluster_info = self.nsx_bridge_cluster_info()
else:
cluster_info = self.nsx_bridge_profile_info()
device_name, interface_name = cluster_info[0][0], cluster_info[0][1]
l2gw_name = data_utils.rand_name(constants.L2GW)
device_1 = {"dname": device_name, "iname": interface_name,