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")) raise RuntimeError(_("NSX bridge cluster information is null"))
return [(x.get("id"), x.get("display_name")) for x in response] 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): def create_l2gw_connection(self, l2gwc_param):
"""Creates L2GWC and return the response. """Creates L2GWC and return the response.

View File

@ -37,7 +37,7 @@ class NSXClient(object):
firewall_section) firewall_section)
return firewall_section, firewall_section_rules return firewall_section, firewall_section_rules
else: else:
#TODO(ddoshi) define else for nsxv # TODO(ddoshi) define else for nsxv
pass pass
def get_bridge_cluster_info(self, *args, **kwargs): def get_bridge_cluster_info(self, *args, **kwargs):
@ -45,6 +45,11 @@ class NSXClient(object):
return self.nsx.get_bridge_cluster_info( return self.nsx.get_bridge_cluster_info(
*args, **kwargs) *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): def get_qos_switching_profile(self, policy_name):
""" """
Retrieve attributes of a given nsx switching profile Retrieve attributes of a given nsx switching profile
@ -52,11 +57,11 @@ class NSXClient(object):
if self.backend == "nsxv3": if self.backend == "nsxv3":
qos_policies = self.nsx.get_switching_profiles() qos_policies = self.nsx.get_switching_profiles()
nsx_policy = self.nsx.get_nsx_resource_by_name(qos_policies, nsx_policy = self.nsx.get_nsx_resource_by_name(qos_policies,
policy_name) policy_name)
qos_policy = self.nsx.get_switching_profile(nsx_policy['id']) qos_policy = self.nsx.get_switching_profile(nsx_policy['id'])
return qos_policy return qos_policy
else: else:
#TODO(dkandavarajay) define else for NSXV # TODO(dkandavarajay) define else for NSXV
pass pass
def get_qos_bandwidth_rule(self, nsx_policy_id): def get_qos_bandwidth_rule(self, nsx_policy_id):
@ -73,7 +78,7 @@ class NSXClient(object):
max_burst = cfg['burst_size_bytes'] max_burst = cfg['burst_size_bytes']
return avg_bw, peak_bw, max_burst return avg_bw, peak_bw, max_burst
else: else:
#TODO(dkandavarajay) define else for NSXV # TODO(dkandavarajay) define else for NSXV
pass pass
def get_qos_dscp_rule(self, nsx_policy_id): def get_qos_dscp_rule(self, nsx_policy_id):
@ -85,7 +90,7 @@ class NSXClient(object):
shaper_cfg = sw_profiles['dscp'] shaper_cfg = sw_profiles['dscp']
return shaper_cfg['priority'] return shaper_cfg['priority']
else: else:
#TODO(dkandavarajay) define else for NSXV # TODO(dkandavarajay) define else for NSXV
pass pass
return None return None

View File

@ -324,6 +324,14 @@ class NSXV3Client(object):
""" """
return self.get_logical_resources("/bridge-clusters") 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): def get_logical_switch(self, os_name, os_uuid):
""" """
Get the logical switch based on the name and uuid provided. 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. bridge cluster UUID (device name) from NSX manager.
""" """
LOG.info("Testing l2_gateway_create api") LOG.info("Testing l2_gateway_create api")
cluster_info = self.nsx_bridge_cluster_info() 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] device_name, interface_name = cluster_info[0][0], cluster_info[0][1]
l2gw_name = data_utils.rand_name(constants.L2GW) l2gw_name = data_utils.rand_name(constants.L2GW)
device_1 = {"dname": device_name, "iname": interface_name} 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. bridge cluster UUID (device name) from NSX manager and vlan id.
""" """
LOG.info("Testing l2_gateway_create api with segmentation ID") LOG.info("Testing l2_gateway_create api with segmentation ID")
cluster_info = self.nsx_bridge_cluster_info() 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] device_name, interface_name = cluster_info[0][0], cluster_info[0][1]
l2gw_name = data_utils.rand_name(constants.L2GW) l2gw_name = data_utils.rand_name(constants.L2GW)
device_1 = {"dname": device_name, "iname": interface_name, 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. bridge cluster UUID (device name) from NSX manager and vlan id.
""" """
LOG.info("Testing l2_gateway_create api with segmentation ID") LOG.info("Testing l2_gateway_create api with segmentation ID")
cluster_info = self.nsx_bridge_cluster_info() 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] device_name, interface_name = cluster_info[0][0], cluster_info[0][1]
l2gw_name = data_utils.rand_name(constants.L2GW) l2gw_name = data_utils.rand_name(constants.L2GW)
device_1 = {"dname": device_name, "iname": interface_name, device_1 = {"dname": device_name, "iname": interface_name,
@ -171,7 +180,10 @@ class L2GatewayTest(L2GatewayBase):
delete l2gw we need l2gw id. delete l2gw we need l2gw id.
""" """
LOG.info("Testing l2_gateway_delete api") LOG.info("Testing l2_gateway_delete api")
cluster_info = self.nsx_bridge_cluster_info() 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] device_name, interface_name = cluster_info[0][0], cluster_info[0][1]
l2gw_name = data_utils.rand_name(constants.L2GW) l2gw_name = data_utils.rand_name(constants.L2GW)
device_1 = {"dname": device_name, "iname": interface_name} 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. update l2gw we need l2gw id and payload to update.
""" """
LOG.info("Testing l2_gateway_update api") LOG.info("Testing l2_gateway_update api")
cluster_info = self.nsx_bridge_cluster_info() 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] device_name, interface_name = cluster_info[0][0], cluster_info[0][1]
l2gw_name = data_utils.rand_name(constants.L2GW) l2gw_name = data_utils.rand_name(constants.L2GW)
device_1 = {"dname": device_name, "iname": interface_name} 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. update l2gw we need l2gw id and payload to update.
""" """
LOG.info("Testing l2_gateway_update api") LOG.info("Testing l2_gateway_update api")
cluster_info = self.nsx_bridge_cluster_info() 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] device_name, interface_name = cluster_info[0][0], cluster_info[0][1]
l2gw_name = data_utils.rand_name(constants.L2GW) l2gw_name = data_utils.rand_name(constants.L2GW)
device_1 = {"dname": device_name, "iname": interface_name} 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. show l2gw based on UUID. To see l2gw info we need l2gw id.
""" """
LOG.info("Testing l2_gateway_show api") LOG.info("Testing l2_gateway_show api")
cluster_info = self.nsx_bridge_cluster_info() 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] device_name, interface_name = cluster_info[0][0], cluster_info[0][1]
l2gw_name = data_utils.rand_name(constants.L2GW) l2gw_name = data_utils.rand_name(constants.L2GW)
device_1 = {"dname": device_name, "iname": interface_name, device_1 = {"dname": device_name, "iname": interface_name,
@ -325,7 +346,10 @@ class L2GatewayTest(L2GatewayBase):
list created l2gw. list created l2gw.
""" """
LOG.info("Testing l2_gateway_list api") LOG.info("Testing l2_gateway_list api")
cluster_info = self.nsx_bridge_cluster_info() 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] device_name, interface_name = cluster_info[0][0], cluster_info[0][1]
l2gw_name = data_utils.rand_name(constants.L2GW) l2gw_name = data_utils.rand_name(constants.L2GW)
device_1 = {"dname": device_name, "iname": interface_name, device_1 = {"dname": device_name, "iname": interface_name,