Merge "Add feature for policy networking support"

This commit is contained in:
Zuul 2018-09-11 10:28:53 +00:00 committed by Gerrit Code Review
commit 5007ca3e3f
2 changed files with 31 additions and 2 deletions

View File

@ -396,7 +396,33 @@ class NsxPolicyLib(NsxLibBase):
def keepalive_section(self):
return 'infra'
def get_version(self):
"""Get the NSX Policy manager version
Currently the backend does not support it, so the nsx-manager api
will be used temporarily.
"""
if self.nsx_version:
return self.nsx_version
manager_client = client.NSX3Client(
self.cluster,
nsx_api_managers=self.nsxlib_config.nsx_api_managers,
max_attempts=self.nsxlib_config.max_attempts,
url_path_base=client.NSX3Client.NSX_V1_API_PREFIX,
rate_limit_retry=self.nsxlib_config.rate_limit_retry)
node = manager_client.get('node')
self.nsx_version = node.get('node_version')
return self.nsx_version
def feature_supported(self, feature):
if (version.LooseVersion(self.get_version()) >=
version.LooseVersion(nsx_constants.NSX_VERSION_2_4_0)):
# Features available since 2.4
if (feature == nsx_constants.FEATURE_NSX_POLICY_NETWORKING):
return True
return (feature == nsx_constants.FEATURE_NSX_POLICY)
@property

View File

@ -130,14 +130,13 @@ NSX_VERSION_2_3_0 = '2.3.0'
NSX_VERSION_2_4_0 = '2.4.0'
NSX_VERSION_3_0_0 = '3.0.0'
# Features available depending on the backend version
# Features available depending on the NSX Manager backend version
FEATURE_MAC_LEARNING = 'MAC Learning'
FEATURE_DYNAMIC_CRITERIA = 'Dynamic criteria'
FEATURE_EXCLUDE_PORT_BY_TAG = 'Exclude Port by Tag'
FEATURE_ROUTER_FIREWALL = 'Router Firewall'
FEATURE_LOAD_BALANCER = 'Load Balancer'
FEATURE_DHCP_RELAY = 'DHCP Relay'
FEATURE_NSX_POLICY = 'NSX Policy'
FEATURE_VLAN_ROUTER_INTERFACE = 'VLAN Router Interface'
FEATURE_RATE_LIMIT = 'Requests Rate Limit'
FEATURE_IPSEC_VPN = 'IPSec VPN'
@ -148,3 +147,7 @@ FEATURE_NO_DNAT_NO_SNAT = 'No DNAT/No SNAT'
FEATURE_ENS_WITH_SEC = 'ENS with security'
FEATURE_ICMP_STRICT = 'Strict list of supported ICMP types and codes'
FEATURE_ROUTER_ALLOCATION_PROFILE = 'Router Allocation Profile'
# Features available depending on the Policy Manager backend version
FEATURE_NSX_POLICY = 'NSX Policy'
FEATURE_NSX_POLICY_NETWORKING = 'NSX Policy Networking'