Add force keepalived restart

Change-Id: I301605fe7be68a025215d82f831393c3aa39bad1
Reviewed-on: https://review.gerrithub.io/371556
Reviewed-by: Tatyanka Leontovich <tleontovich@mirantis.com>
Tested-by: Tatyanka Leontovich <tleontovich@mirantis.com>
diff --git a/tcp_tests/tests/system/test_install_k8s.py b/tcp_tests/tests/system/test_install_k8s.py
index 0af33e3..fa8f3fc 100644
--- a/tcp_tests/tests/system/test_install_k8s.py
+++ b/tcp_tests/tests/system/test_install_k8s.py
@@ -26,7 +26,7 @@
 
     @pytest.mark.fail_snapshot
     def test_k8s_install(self, config, show_step,
-                         k8s_deployed, k8s_actions, sl_deployed):
+                         k8s_deployed, k8s_actions, sl_deployed, sl_actions):
         """Test for deploying MCP environment with k8s+stacklight and check it
 
         Scenario:
@@ -78,10 +78,21 @@
                     metric, res.text)
 
         prometheus_client = sl_deployed.api
-        current_targets = prometheus_client.get_targets()
-        #todo (tleontovich) add assertion that k8s targets here
-        LOG.debug('Current targets after install {0}'.format(current_targets))
+        try:
+            current_targets = prometheus_client.get_targets()
+            LOG.debug('Current targets after install {0}'.format(current_targets))
+        except:
+            LOG.warning('Restarting keepalived service on mon nodes...')
+            sl_actions._salt.local(tgt='mon*', fun='cmd.run',
+                                   args='systemctl restart keepalived')
+            LOG.warning(
+                'Ip states after forset restart {0}'.format(
+                    sl_actions._salt.local(tgt='mon*',
+                                           fun='cmd.run', args='ip a')))
+            current_targets = prometheus_client.get_targets()
+            LOG.debug('Current targets after install {0}'.format(current_targets))
 
+        #todo (tleontovich) add assertion that k8s targets here
         for metric in metrics:
             res = prometheus_client.get_query(metric)
             for entry in res: