Add ability to enable/disable ipv6 forwarding

Supported since 2.5

Change-Id: Ida2946761f3c22e7405c0024b883a9f33bcc7ffc
This commit is contained in:
Anna Khmelnitsky 2019-03-25 14:27:09 -07:00
parent f91887541b
commit 207ce5eca1
3 changed files with 29 additions and 0 deletions

View File

@ -106,6 +106,8 @@ class NsxLib(lib.NsxLibBase):
self.client, self.nsxlib_config, nsxlib=self)
self.cluster_nodes = resources.NsxlibClusterNodesConfig(
self.client, self.nsxlib_config, nsxlib=self)
self.global_routing = core_resources.NsxLibGlobalRoutingConfig(
self.client, self.nsxlib_config, nsxlib=self)
# Update tag limits
self.tag_limits = self.get_tag_limits()
@ -168,6 +170,8 @@ class NsxLib(lib.NsxLibBase):
# features available since 2.5
if (feature == nsx_constants.FEATURE_CONTAINER_CLUSTER_INVENTORY):
return True
if (feature == nsx_constants.FEATURE_IPV6):
return True
if (version.LooseVersion(self.get_version()) >=
version.LooseVersion(nsx_constants.NSX_VERSION_2_4_0)):

View File

@ -1053,3 +1053,26 @@ class NsxLibFabricVirtualInterface(utils.NsxLibApiBase):
def get_by_owner_vm_id(self, owner_vm_id):
url = '%s?owner_vm_id=%s' % (self.get_path(), owner_vm_id)
return self.client.get(url)
class NsxLibGlobalRoutingConfig(utils.NsxLibApiBase):
@property
def uri_segment(self):
return 'global-configs/RoutingGlobalConfig'
@property
def resource_type(self):
return 'RoutingGlobalConfig'
def set_l3_forwarding_mode(self, mode):
config = self.client.get(self.get_path())
if config['l3_forwarding_mode'] != mode:
config['l3_forwarding_mode'] = mode
self.client.update(self.get_path(), config)
def enable_ipv6(self):
return self.set_l3_forwarding_mode('IPV4_AND_IPV6')
def disable_ipv6(self):
return self.set_l3_forwarding_mode('IPV4_ONLY')

View File

@ -174,3 +174,5 @@ FEATURE_NSX_POLICY_NETWORKING = 'NSX Policy Networking'
# FEATURE available depending on Inventory service backend version
FEATURE_CONTAINER_CLUSTER_INVENTORY = 'Container Cluster Inventory'
FEATURE_IPV6 = 'IPV6 Forwarding and Address Allocation'