Renders service net map for THT
[apex.git] / apex / network / network_environment.py
index 0a4d103..52b4452 100644 (file)
@@ -186,6 +186,8 @@ class NetworkEnvironment(dict):
             for flag in IPV6_FLAGS:
                 self[param_def][flag] = True
 
+        self._update_service_netmap(net_settings.enabled_network_list)
+
     def _get_vlan(self, network):
         if isinstance(network['nic_mapping'][CONTROLLER]['vlan'], int):
             return network['nic_mapping'][CONTROLLER]['vlan']
@@ -218,6 +220,13 @@ class NetworkEnvironment(dict):
                 prefix = ''
             self[reg][key] = self.tht_dir + prefix + postfix
 
+    def _update_service_netmap(self, network_list):
+        if 'ServiceNetMap' not in self[param_def]:
+            return
+        for service, network in self[param_def]['ServiceNetMap'].items():
+            if network not in network_list:
+                self[param_def]['ServiceNetMap'][service] = 'ctlplane'
+
 
 class NetworkEnvException(Exception):
     def __init__(self, value):