summaryrefslogtreecommitdiffstats
path: root/lib/python/apex
diff options
context:
space:
mode:
authorTim Rozet <trozet@redhat.com>2016-06-28 18:58:11 +0000
committerGerrit Code Review <gerrit@172.30.200.206>2016-06-28 18:58:11 +0000
commit2840a7db67fdaf58567c195557c6fb8ee38f73bd (patch)
tree1beb8f677649ca6d1bf670ab4eca175fcdd5b60a /lib/python/apex
parentc5ea99b97d53ddb8451be21ffed5118125457cca (diff)
parent890ed0bcb03b61c5e5da596f89771d6196cd4231 (diff)
Merge changes from topics 'fix_dpdk', 'vlan_support'
* changes: Fixes IP failure during os-collect-config ping check Adding VLAN support
Diffstat (limited to 'lib/python/apex')
-rw-r--r--lib/python/apex/network_environment.py15
-rw-r--r--lib/python/apex/network_settings.py5
2 files changed, 18 insertions, 2 deletions
diff --git a/lib/python/apex/network_environment.py b/lib/python/apex/network_environment.py
index c6483d12..fd6f5286 100644
--- a/lib/python/apex/network_environment.py
+++ b/lib/python/apex/network_environment.py
@@ -69,6 +69,7 @@ class NetworkEnvironment:
break
if not tht_dir:
raise NetworkEnvException('Unable to parse THT Directory')
+
admin_cidr = net_settings[constants.ADMIN_NETWORK]['cidr']
admin_prefix = str(admin_cidr.prefixlen)
self.netenv_obj[param_def]['ControlPlaneSubnetCidr'] = admin_prefix
@@ -76,6 +77,9 @@ class NetworkEnvironment:
net_settings[constants.ADMIN_NETWORK]['provisioner_ip']
public_cidr = net_settings[constants.PUBLIC_NETWORK]['cidr']
self.netenv_obj[param_def]['ExternalNetCidr'] = str(public_cidr)
+ if net_settings[constants.PUBLIC_NETWORK]['vlan'] != 'native':
+ self.netenv_obj[param_def]['ExternalNetworkVlanID'] = \
+ net_settings[constants.PUBLIC_NETWORK]['vlan']
public_range = net_settings[constants.PUBLIC_NETWORK][
'usable_ip_range'].split(',')
self.netenv_obj[param_def]['ExternalAllocationPools'] = \
@@ -114,6 +118,9 @@ class NetworkEnvironment:
postfix = '/tenant_v6.yaml'
else:
postfix = '/tenant.yaml'
+ if net_settings[constants.PRIVATE_NETWORK]['vlan'] != 'native':
+ self.netenv_obj[param_def]['TenantNetworkVlanID'] = \
+ net_settings[constants.PRIVATE_NETWORK]['vlan']
else:
postfix = '/noop.yaml'
@@ -137,6 +144,9 @@ class NetworkEnvironment:
postfix = '/storage_v6.yaml'
else:
postfix = '/storage.yaml'
+ if net_settings[constants.STORAGE_NETWORK]['vlan'] != 'native':
+ self.netenv_obj[param_def]['StorageNetworkVlanID'] = \
+ net_settings[constants.STORAGE_NETWORK]['vlan']
else:
postfix = '/noop.yaml'
@@ -160,8 +170,9 @@ class NetworkEnvironment:
postfix = '/internal_api_v6.yaml'
else:
postfix = '/internal_api.yaml'
-
-
+ if net_settings[constants.API_NETWORK]['vlan'] != 'native':
+ self.netenv_obj[param_def]['InternalApiNetworkVlanID'] = \
+ net_settings[constants.API_NETWORK]['vlan']
else:
postfix = '/noop.yaml'
diff --git a/lib/python/apex/network_settings.py b/lib/python/apex/network_settings.py
index 9df8a1de..475082df 100644
--- a/lib/python/apex/network_settings.py
+++ b/lib/python/apex/network_settings.py
@@ -84,6 +84,11 @@ class NetworkSettings:
given NIC in the system. The resulting config in settings object will
be an ipaddress.network object, replacing the NIC name.
"""
+ # if vlan not defined then default it to native
+ if network is not constants.ADMIN_NETWORK:
+ if 'vlan' not in self.settings_obj[network]:
+ self.settings_obj[network]['vlan'] = 'native'
+
cidr = self.settings_obj[network].get('cidr')
nic_name = self.settings_obj[network].get('bridged_interface')