add workarounds for cinder and keystone
diff --git a/tcp_tests/managers/tcpmanager.py b/tcp_tests/managers/tcpmanager.py
index 40df81d..c71bf89 100644
--- a/tcp_tests/managers/tcpmanager.py
+++ b/tcp_tests/managers/tcpmanager.py
@@ -52,9 +52,10 @@
     def install_tcp(self):
         raise Exception("Not implemented!")
 
-    def check_salt_service(self, service_name, node_name, check_cmd):
-        cmd = "service {0} status | grep -q 'start/running'".format(
-            service_name)
+    def check_salt_service(self, service_name, node_name, check_cmd,
+                           state_running='start/running'):
+        cmd = "service {0} status | grep -q '{1}'".format(
+            service_name, state_running)
         with self.__underlay.remote(node_name=node_name) as remote:
             result = remote.execute(cmd)
             if result.exit_code != 0:
diff --git a/tcp_tests/templates/tcpcloud--user-data-master-node.yaml b/tcp_tests/templates/tcpcloud--user-data-master-node.yaml
index 2c2875b..bfbb85f 100644
--- a/tcp_tests/templates/tcpcloud--user-data-master-node.yaml
+++ b/tcp_tests/templates/tcpcloud--user-data-master-node.yaml
@@ -19,7 +19,7 @@
    # Block access to SSH while node is preparing
    - cloud-init-per once sudo iptables -A INPUT -p tcp --dport 22 -j DROP
    # Enable root access
-   - sed -i'.orig' -e's/without-password/yes/' /etc/ssh/sshd_config
+   - sed -i -e '/^PermitRootLogin/s/^.*$/PermitRootLogin yes/' /etc/ssh/sshd_config
    - service sshd restart
   output:
     all: '| tee -a /var/log/cloud-init-output.log /dev/tty0'
@@ -38,7 +38,7 @@
    - echo "Preparing base OS"
    - which wget >/dev/null || (apt-get update; apt-get install -y wget)
 
-   - echo "deb [arch=amd64] http://apt.tcpcloud.eu/nightly/ trusty main security extra tcp tcp-salt" > /etc/apt/sources.list
+   - echo "deb [arch=amd64] http://apt.tcpcloud.eu/nightly/ xenial main security extra tcp tcp-salt" > /etc/apt/sources.list
    - wget -O - http://apt.tcpcloud.eu/public.gpg | apt-key add -
 
    - apt-get clean
@@ -103,6 +103,7 @@
 
    - echo "Restarting services with workarounds..."
    - service salt-master restart
+   - sleep 60
    - rm -f /etc/salt/pki/minion/minion_master.pub
    - service salt-minion restart
 
@@ -111,22 +112,6 @@
    - salt-call --no-color pillar.data
    - reclass -n {hostname}
 
-   - echo "Running complete state ..."
-   - salt-call --no-color state.sls linux openssh salt.minion
-   - salt-call --no-color state.sls salt.master
-   - rm -f /etc/salt/pki/minion/minion_master.pub
-   - service salt-minion stop
-   - sleep 5
-   - service salt-master stop
-   - sleep 5
-   - killall -9 salt-master
-   - sleep 5
-   - service salt-master start
-   - sleep 60
-   - rm -f /etc/salt/pki/minion/minion_master.pub
-   - service salt-minion restart
-   # - salt-call --no-color state.highstate
-
    ########################################################
    # Node is ready, allow SSH access
    - echo "Allow SSH access ..."
diff --git a/tcp_tests/templates/tcpcloud-default.yaml b/tcp_tests/templates/tcpcloud-default.yaml
index 32b5d8a..0a8cbdc 100644
--- a/tcp_tests/templates/tcpcloud-default.yaml
+++ b/tcp_tests/templates/tcpcloud-default.yaml
@@ -17,6 +17,14 @@
           ip_reserved:
             gateway: +1
             l2_network_device: +1
+            default_cfg01.mk22-lab-advanced.local: +100
+            default_ctl01.mk22-lab-advanced.local: +101
+            default_ctl02.mk22-lab-advanced.local: +102
+            default_ctl03.mk22-lab-advanced.local: +103
+            default_web01.mk22-lab-advanced.local: +104
+            default_cmp01.mk22-lab-advanced.local: +105
+            default_mtr01.mk22-lab-advanced.local: +106
+            default_mon01.mk22-lab-advanced.local: +107
           ip_ranges:
             dhcp: [+100, -2]
 
diff --git a/tcp_tests/tests/system/test_tcp_install.py b/tcp_tests/tests/system/test_tcp_install.py
index cf933cc..685d3e9 100644
--- a/tcp_tests/tests/system/test_tcp_install.py
+++ b/tcp_tests/tests/system/test_tcp_install.py
@@ -38,14 +38,14 @@
     steps_mk22_lab_advanced = [
         {
             'description': "Run 'linux' formula on cfg01",
-            'cmd': salt_cmd + "'cfg01*' state.sls linux",
+            'cmd': salt_call_cmd + "state.sls linux",
             'node_name': 'cfg01.mk22-lab-advanced.local',  # hardcoded for now
             'retry': {'count': 3, 'delay': 5},
             'skip_fail': False,
         },
         {
             'description': "Run 'openssh' formula on cfg01",
-            'cmd': (salt_cmd + "'cfg01*' state.sls openssh;"
+            'cmd': (salt_call_cmd + "state.sls openssh;"
                     "sed -i 's/PasswordAuthentication no/"
                     "PasswordAuthentication yes/' "
                     "/etc/ssh/sshd_config && service ssh restart"),
@@ -63,10 +63,10 @@
         },
         {
             'description': "Run 'salt' formula on cfg01",
-            'cmd': salt_cmd + "'cfg01*' state.sls salt",
+            'cmd': salt_call_cmd + " state.sls salt",
             'node_name': 'cfg01.mk22-lab-advanced.local',  # hardcoded for now
             'retry': {'count': 3, 'delay': 5},
-            'skip_fail': False,
+            'skip_fail': True,
         },
         {
             'description': "Accept salt keys from all the nodes",
@@ -78,7 +78,7 @@
         {
             'description': ("Generate inventory for all the nodes to the"
                             " /srv/salt/reclass/nodes/_generated"),
-            'cmd': salt_cmd + "'cfg01*' state.sls reclass.storage",
+            'cmd': salt_call_cmd + "state.sls reclass.storage",
             'node_name': 'cfg01.mk22-lab-advanced.local',  # hardcoded for now
             'retry': {'count': 3, 'delay': 5},
             'skip_fail': False,
@@ -91,6 +91,24 @@
             'skip_fail': False,
         },
         {
+            'description': ("*Workaround* for the bug"
+                            " https://mirantis.jira.com/browse/PROD-8025"),
+            'cmd': (salt_cmd + "'*' cmd.run 'apt-get update &&"
+                    " apt-get -y upgrade'"),
+            'node_name': 'cfg01.mk22-lab-advanced.local',  # hardcoded for now
+            'retry': {'count': 3, 'delay': 5},
+            'skip_fail': False,
+        },
+        {
+            'description': ("*Workaround* for the bug"
+                            " https://mirantis.jira.com/browse/PROD-8021"),
+            'cmd': (salt_cmd + "'*' cmd.run 'apt-get -y install"
+                    " linux-image-extra-$(uname -r)'"),
+            'node_name': 'cfg01.mk22-lab-advanced.local',  # hardcoded for now
+            'retry': {'count': 3, 'delay': 5},
+            'skip_fail': False,
+        },
+        {
             'description': "Configure ntp on controllers",
             'cmd': salt_cmd + "'ctl*' state.sls ntp",
             'node_name': 'cfg01.mk22-lab-advanced.local',  # hardcoded for now
@@ -244,6 +262,13 @@
             'skip_fail': False,
         },
         {
+            'description': "Configure keystone client access from cfg01 node",
+            'cmd': salt_call_cmd + "state.sls keystone.client",
+            'node_name': 'cfg01.mk22-lab-advanced.local',  # hardcoded for now
+            'retry': {'count': 3, 'delay': 5},
+            'skip_fail': False,
+        },
+        {
             'description': "Check keystone user-list",
             'cmd': "source ~/keystonerc; keystone user-list",
             'node_name': 'ctl01.mk22-lab-advanced.local',  # hardcoded for now
@@ -316,14 +341,14 @@
         },
         {
             'description': "Install cinder on controllers",
-            'cmd': salt_cmd + "'ctl*' cinder",
+            'cmd': salt_cmd + "'ctl*' state.sls cinder",
             'node_name': 'cfg01.mk22-lab-advanced.local',  # hardcoded for now
             'retry': {'count': 3, 'delay': 5},
             'skip_fail': False,
         },
         {
             'description': "Install nova on controllers",
-            'cmd': salt_cmd + "'ctl*' nova",
+            'cmd': salt_cmd + "'ctl*' state.sls nova",
             'node_name': 'cfg01.mk22-lab-advanced.local',  # hardcoded for now
             'retry': {'count': 3, 'delay': 5},
             'skip_fail': False,
@@ -406,7 +431,7 @@
 
             with underlay.remote(node_name=step['node_name']) as remote:
                 for x in range(step['retry']['count'], 0, -1):
-
+                    time.sleep(3)
                     result = remote.execute(step['cmd'], verbose=True)
 
                     # Workaround of exit code 0 from salt in case of failures
@@ -429,11 +454,13 @@
                         tcp_actions.check_salt_service(
                             "salt-master",
                             "cfg01.mk22-lab-advanced.local",
-                            "salt-call pillar.items") # Hardcoded for now
+                            "salt-call pillar.items",
+                            'active (running)') # Hardcoded for now
                         tcp_actions.check_salt_service(
                             "salt-minion",
                             "cfg01.mk22-lab-advanced.local",
-                            "salt 'cfg01*' pillar.items") # Hardcoded for now
+                            "salt 'cfg01*' pillar.items",
+                            "active (running)") # Hardcoded for now
                         break
 
                     if x == 1 and step['skip_fail'] == False: