Merge "Default ctlplane to native VLAN"
authorFeng Pan <fpan@redhat.com>
Tue, 29 May 2018 17:13:01 +0000 (17:13 +0000)
committerGerrit Code Review <gerrit@opnfv.org>
Tue, 29 May 2018 17:13:01 +0000 (17:13 +0000)
apex/settings/network_settings.py
apex/tests/test_apex_network_settings.py

index f656683..36d143c 100644 (file)
@@ -167,10 +167,13 @@ class NetworkSettings(dict):
         """
         _network = self.get_network(network)
         # if vlan not defined then default it to native
-        if network is not ADMIN_NETWORK:
-            for role in ROLES:
+        for role in ROLES:
+            if network is not ADMIN_NETWORK:
                 if 'vlan' not in _network['nic_mapping'][role]:
                     _network['nic_mapping'][role]['vlan'] = 'native'
+            else:
+                # ctlplane network must be native
+                _network['nic_mapping'][role]['vlan'] = 'native'
 
         cidr = _network.get('cidr')
 
index 5e2fa07..764c9ef 100644 (file)
@@ -112,6 +112,9 @@ class TestNetworkSettings:
         # remove vlan from storage net
         storage_net_nicmap['compute'].pop('vlan', None)
         assert_is_instance(NetworkSettings(ns), NetworkSettings)
+        for role in ('compute', 'controller'):
+            assert_equal(ns['networks'][ADMIN_NETWORK]['nic_mapping'][
+                         role]['vlan'], 'native')
 
 # TODO
 # need to manipulate interfaces some how