diff --git a/vmware_nsxlib/v3/__init__.py b/vmware_nsxlib/v3/__init__.py index 1137c921..27b3244c 100644 --- a/vmware_nsxlib/v3/__init__.py +++ b/vmware_nsxlib/v3/__init__.py @@ -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)): diff --git a/vmware_nsxlib/v3/core_resources.py b/vmware_nsxlib/v3/core_resources.py index 7e4968b7..929788d1 100644 --- a/vmware_nsxlib/v3/core_resources.py +++ b/vmware_nsxlib/v3/core_resources.py @@ -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') diff --git a/vmware_nsxlib/v3/nsx_constants.py b/vmware_nsxlib/v3/nsx_constants.py index 423663d8..3eab8e88 100644 --- a/vmware_nsxlib/v3/nsx_constants.py +++ b/vmware_nsxlib/v3/nsx_constants.py @@ -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'