NSX|v3 replace dhcp profile and metadata proxy uuids with names

Support configuration of name or uuid (instead of only uuid) for
2 nsx_v3 parameters: dhcp_profile, metadata_proxy.

nsxlib part was cherry picked from: Ife6263b7cf1759a2fc309205552eb79138d512a1

Change-Id: If82e5090426cd4198c8ff4d9bd79b3ea53046112
changes/67/385267/5
Adit Sarfaty 6 years ago
parent 73c80d18c5
commit 1eda9e1cdc
  1. 30
      vmware_nsxlib/v3/__init__.py
  2. 1
      vmware_nsxlib/v3/native_dhcp.py

@ -60,6 +60,10 @@ class NsxLib(object):
self.client, nsxlib_config)
self.transport_zone = NsxLibTransportZone(
self.client, nsxlib_config)
self.native_dhcp_profile = NsxLibDhcpProfile(
self.client, nsxlib_config)
self.native_md_proxy = NsxLibMetadataProxy(
self.client, nsxlib_config)
self.firewall_section = security.NsxLibFirewallSection(
self.client, nsxlib_config)
self.ns_group = security.NsxLibNsGroup(
@ -424,6 +428,32 @@ class NsxLibTransportZone(utils.NsxLibApiBase):
'transport-zones')
class NsxLibDhcpProfile(utils.NsxLibApiBase):
def get_id_by_name_or_id(self, name_or_id):
"""Get a dhcp profile by it's display name or uuid
Return the dhcp profile data, or raise an exception if not found or
not unique
"""
return self._get_resource_by_name_or_id(name_or_id,
'dhcp/server-profiles')
class NsxLibMetadataProxy(utils.NsxLibApiBase):
def get_id_by_name_or_id(self, name_or_id):
"""Get a metadata proxy by it's display name or uuid
Return the metadata proxy data, or raise an exception if not found or
not unique
"""
return self._get_resource_by_name_or_id(name_or_id,
'md-proxies')
class NsxLibBridgeCluster(utils.NsxLibApiBase):
def get_id_by_name_or_id(self, name_or_id):

@ -55,7 +55,6 @@ class NsxLibNativeDhcp(utils.NsxLibApiBase):
name = utils.get_name_and_uuid(network['name'] or 'dhcpserver',
network['id'])
return {'name': name,
'dhcp_profile_id': self.nsxlib_config.dhcp_profile_uuid,
'server_ip': server_ip,
'dns_nameservers': dns_nameservers,
'domain_name': self.nsxlib_config.dns_domain,

Loading…
Cancel
Save