Add k8s ingress and metallb features

- enable ingress-nginx and metallb features
  for the configurations:
  - cookiecutter-context-k8s-sl
  - cookied-cicd-k8s-genie
  - cookied-bm-k8s-contrail

- add 'external' network on cfg, ctl, cmp and prx nodes

- enable DHCP in 'external' network for auto configuration
  of the external interfaces

- get the status of the ingress and metallb features from
  the salt pillar instead of environment variables to
  run the tests on the existing deployments

Related-Task: PROD-22687
Closes-Bug: PROD-24580

Change-Id: Ifee60814718abc604008af5e2058a6db1bf92d6d
diff --git a/tcp_tests/managers/k8smanager.py b/tcp_tests/managers/k8smanager.py
index d84451f..7ca518e 100644
--- a/tcp_tests/managers/k8smanager.py
+++ b/tcp_tests/managers/k8smanager.py
@@ -112,6 +112,41 @@
         names.sort()
         return names[0]
 
+    @property
+    def controller_minion_id(self):
+        """ Return node name of controller node that used for all actions """
+        minion_ids = [minion_id['minion_id'] for minion_id in
+                      self.get_controllers()]
+        # we want to return same controller name every time
+        minion_ids.sort()
+        return minion_ids[0]
+
+    @property
+    def is_metallb_enabled(self):
+        ctl_tgt = self.controller_minion_id
+        LOG.debug("Controller target: {}".format(ctl_tgt))
+
+        result = self._salt.get_pillar(
+            tgt=ctl_tgt,
+            pillar='kubernetes:common:addons:metallb:enabled')
+        metallb = result[0].get(ctl_tgt, False)
+        LOG.info("{} kubernetes:common:addons:metallb:enabled: {}"
+                 .format(ctl_tgt, bool(metallb)))
+        return metallb
+
+    @property
+    def is_ingress_nginx_enabled(self):
+        ctl_tgt = self.controller_minion_id
+        LOG.debug("Controller target: {}".format(ctl_tgt))
+
+        result = self._salt.get_pillar(
+            tgt=ctl_tgt,
+            pillar='kubernetes:common:addons:ingress-nginx:enabled')
+        ingress_nginx = result[0].get(ctl_tgt, False)
+        LOG.info("{} kubernetes:common:addons:ingress-nginx:enabled: {}"
+                 .format(ctl_tgt, bool(ingress_nginx)))
+        return ingress_nginx
+
     def controller_check_call(self, cmd, **kwargs):
         """ Run command on controller and return result """
         LOG.info("running cmd on k8s controller: {}".format(cmd))
diff --git a/tcp_tests/managers/sl_manager.py b/tcp_tests/managers/sl_manager.py
index 3bb0a1f..f3ccef8 100644
--- a/tcp_tests/managers/sl_manager.py
+++ b/tcp_tests/managers/sl_manager.py
@@ -41,7 +41,6 @@
     def install(self, commands, label='Install SL services'):
         self.execute_commands(commands, label=label)
         self.__config.stack_light.stacklight_installed = True
-        self.__config.stack_light.sl_vip_host = self.get_sl_vip()
 
     def get_sl_vip(self):
         tgt = 'I@prometheus:server:enabled:True'
@@ -76,6 +75,7 @@
     @property
     def api(self):
         if self._p_client is None:
+            self.__config.stack_light.sl_vip_host = self.get_sl_vip()
             self._p_client = prometheus_client.PrometheusClient(
                 host=self.__config.stack_light.sl_vip_host,
                 port=self.__config.stack_light.sl_prometheus_port,