Fix tests

* replace service to systemctl call for sync time
* Add forward policy accept after docker install
due to https://github.com/moby/moby/pull/28257 break gtw node

Change-Id: I790bc9c1b2f203119d4142ec25956634bf6bb94f
diff --git a/tcp_tests/managers/openstack_manager.py b/tcp_tests/managers/openstack_manager.py
index bbf9315..275ef57 100644
--- a/tcp_tests/managers/openstack_manager.py
+++ b/tcp_tests/managers/openstack_manager.py
@@ -105,6 +105,10 @@
         with self.__underlay.remote(node_name=target_name[0]) as node_remote:
             result = node_remote.execute(cmd, verbose=True)
 
+        cmd_iptables = "iptables --policy FORWARD ACCEPT"
+        with self.__underlay.remote(node_name=target_name[0]) as node_remote:
+            result = node_remote.execute(cmd_iptables, verbose=True)
+
         with self.__underlay.remote(
                 host=self.__config.salt.salt_master_host) as node_remote:
             result = node_remote.execute(
diff --git a/tcp_tests/managers/rallymanager.py b/tcp_tests/managers/rallymanager.py
index ae72941..d5b8782 100644
--- a/tcp_tests/managers/rallymanager.py
+++ b/tcp_tests/managers/rallymanager.py
@@ -96,6 +96,9 @@
                                                        version=version))
         self._underlay.check_call(cmd, node_name=self._node_name)
 
+        cmd_iptables = "iptables --policy FORWARD ACCEPT"
+        self._underlay.check_call(cmd_iptables, node_name=self._node_name)
+
         LOG.info("Create rally workdir")
         cmd = 'mkdir -p /root/rally; chown 65500 /root/rally'
         self._underlay.check_call(cmd, node_name=self._node_name)
diff --git a/tcp_tests/templates/cookied-bm-mcp-dvr-vxlan/openstack.yaml b/tcp_tests/templates/cookied-bm-mcp-dvr-vxlan/openstack.yaml
index 342e4c8..f64d8ca 100644
--- a/tcp_tests/templates/cookied-bm-mcp-dvr-vxlan/openstack.yaml
+++ b/tcp_tests/templates/cookied-bm-mcp-dvr-vxlan/openstack.yaml
@@ -280,6 +280,12 @@
   retry: {count: 1, delay: 30}
   skip_fail: false
 
+- description: Enable forward policy
+  cmd: salt "gtw01*" cmd.run 'iptables --policy FORWARD ACCEPT'
+  node_name: {{ HOSTNAME_CFG01 }}
+  retry: {count: 1, delay: 30}
+  skip_fail: false
+
 - description: create rc file on cfg
   cmd: scp ctl01:/root/keystonercv3 /root
   node_name: {{ HOSTNAME_CFG01 }}
diff --git a/tcp_tests/templates/cookied-bm-mcp-ocata-contrail/openstack.yaml b/tcp_tests/templates/cookied-bm-mcp-ocata-contrail/openstack.yaml
index 1434a32..992ef9f 100644
--- a/tcp_tests/templates/cookied-bm-mcp-ocata-contrail/openstack.yaml
+++ b/tcp_tests/templates/cookied-bm-mcp-ocata-contrail/openstack.yaml
@@ -338,6 +338,11 @@
   retry: {count: 1, delay: 30}
   skip_fail: false
 
+- description: Enable forward policy
+  cmd: salt "ctl01*" cmd.run 'iptables --policy FORWARD ACCEPT'
+  node_name: {{ HOSTNAME_CFG01 }}
+  retry: {count: 1, delay: 30}
+  skip_fail: false
 #- description: create rc file on cfg
 #  cmd: scp ctl01:/root/keystonercv3 /root
 #  node_name: {{ HOSTNAME_CFG01 }}
diff --git a/tcp_tests/templates/cookied-mcp-ocata-dop-sl2/openstack.yaml b/tcp_tests/templates/cookied-mcp-ocata-dop-sl2/openstack.yaml
index 8c214e3..43483ae 100644
--- a/tcp_tests/templates/cookied-mcp-ocata-dop-sl2/openstack.yaml
+++ b/tcp_tests/templates/cookied-mcp-ocata-dop-sl2/openstack.yaml
@@ -319,6 +319,12 @@
   retry: {count: 1, delay: 30}
   skip_fail: false
 
+- description: Enable forward policy
+  cmd: salt "gtw01*" cmd.run 'iptables --policy FORWARD ACCEPT'
+  node_name: {{ HOSTNAME_CFG01 }}
+  retry: {count: 1, delay: 30}
+  skip_fail: false
+
 - description: create rc file on cfg
   cmd: scp ctl01:/root/keystonercv3 /root
   node_name: {{ HOSTNAME_CFG01 }}
diff --git a/tcp_tests/templates/cookied-mcp-ocata-dvr-vxlan/openstack.yaml b/tcp_tests/templates/cookied-mcp-ocata-dvr-vxlan/openstack.yaml
index 3882976..a4b52a5 100644
--- a/tcp_tests/templates/cookied-mcp-ocata-dvr-vxlan/openstack.yaml
+++ b/tcp_tests/templates/cookied-mcp-ocata-dvr-vxlan/openstack.yaml
@@ -361,6 +361,12 @@
   retry: {count: 1, delay: 30}
   skip_fail: false
 
+- description: Enable forward policy
+  cmd: iptables --policy FORWARD ACCEPT
+  node_name: {{ HOSTNAME_GTW01 }}
+  retry: {count: 1, delay: 30}
+  skip_fail: false
+
 - description: create rc file on cfg
   cmd: scp ctl01:/root/keystonercv3 /root
   node_name: {{ HOSTNAME_CFG01 }}
diff --git a/tcp_tests/templates/cookied-mcp-pike-dvr/openstack.yaml b/tcp_tests/templates/cookied-mcp-pike-dvr/openstack.yaml
index b81cef5..61d4a8f 100644
--- a/tcp_tests/templates/cookied-mcp-pike-dvr/openstack.yaml
+++ b/tcp_tests/templates/cookied-mcp-pike-dvr/openstack.yaml
@@ -375,6 +375,12 @@
   retry: {count: 1, delay: 30}
   skip_fail: false
 
+- description: Enable forward policy
+  cmd: salt iptables --policy FORWARD ACCEPT
+  node_name: {{ HOSTNAME_GTW01 }}
+  retry: {count: 1, delay: 30}
+  skip_fail: false
+
 - description: Restart cinder volume
   cmd: |
     salt -C 'I@cinder:controller' service.restart cinder-volume;
diff --git a/tcp_tests/templates/cookied-mcp-pike-ovs/openstack.yaml b/tcp_tests/templates/cookied-mcp-pike-ovs/openstack.yaml
index 3ee578d..c0d2330 100644
--- a/tcp_tests/templates/cookied-mcp-pike-ovs/openstack.yaml
+++ b/tcp_tests/templates/cookied-mcp-pike-ovs/openstack.yaml
@@ -361,6 +361,12 @@
   retry: {count: 1, delay: 30}
   skip_fail: false
 
+- description: Enable forward policy
+  cmd: iptables --policy FORWARD ACCEPT
+  node_name: {{ HOSTNAME_GTW0101 }}
+  retry: {count: 1, delay: 30}
+  skip_fail: false
+
 - description: create rc file on cfg
   cmd: scp ctl01:/root/keystonercv3 /root
   node_name: {{ HOSTNAME_CFG01 }}
diff --git a/tcp_tests/templates/mcp-ocata-local-repo-dvr/openstack.yaml b/tcp_tests/templates/mcp-ocata-local-repo-dvr/openstack.yaml
index 8802687..f3c5c1b 100644
--- a/tcp_tests/templates/mcp-ocata-local-repo-dvr/openstack.yaml
+++ b/tcp_tests/templates/mcp-ocata-local-repo-dvr/openstack.yaml
@@ -373,6 +373,12 @@
   retry: {count: 1, delay: 30}
   skip_fail: false
 
+- description: Enable forward policy
+  cmd: iptables --policy FORWARD ACCEPT
+  node_name: {{ HOSTNAME_GTW0101 }}
+  retry: {count: 1, delay: 30}
+  skip_fail: false
+
 - description: create rc file on cfg
   cmd: scp ctl01:/root/keystonercv3 /root
   node_name: {{ HOSTNAME_CFG01 }}
diff --git a/tcp_tests/templates/virtual-mcp-ocata-ceph-offline/openstack.yaml b/tcp_tests/templates/virtual-mcp-ocata-ceph-offline/openstack.yaml
index 1783d6d..827b16a 100644
--- a/tcp_tests/templates/virtual-mcp-ocata-ceph-offline/openstack.yaml
+++ b/tcp_tests/templates/virtual-mcp-ocata-ceph-offline/openstack.yaml
@@ -259,6 +259,12 @@
   retry: {count: 1, delay: 30}
   skip_fail: false
 
+- description: Enable forward policy
+  cmd: iptables --policy FORWARD ACCEPT
+  node_name: {{ HOSTNAME_GTW01 }}
+  retry: {count: 1, delay: 30}
+  skip_fail: false
+
 - description: create rc file on cfg
   cmd: scp ctl01:/root/keystonercv3 /root
   node_name: {{ HOSTNAME_CFG01 }}
diff --git a/tcp_tests/templates/virtual-mcp-ocata-dvr/openstack.yaml b/tcp_tests/templates/virtual-mcp-ocata-dvr/openstack.yaml
index ed0ee59..f823c2f 100644
--- a/tcp_tests/templates/virtual-mcp-ocata-dvr/openstack.yaml
+++ b/tcp_tests/templates/virtual-mcp-ocata-dvr/openstack.yaml
@@ -375,6 +375,12 @@
   retry: {count: 1, delay: 30}
   skip_fail: false
 
+- description: Enable forward policy
+  cmd: iptables --policy FORWARD ACCEPT
+  node_name: {{ HOSTNAME_GTW01 }}
+  retry: {count: 1, delay: 30}
+  skip_fail: false
+
 - description: Restart cinder volume
   cmd: |
     salt -C 'I@cinder:controller' service.restart cinder-volume;
diff --git a/tcp_tests/templates/virtual-mcp-ocata-ovs-ceph/openstack.yaml b/tcp_tests/templates/virtual-mcp-ocata-ovs-ceph/openstack.yaml
index f35c749..4fbecca 100644
--- a/tcp_tests/templates/virtual-mcp-ocata-ovs-ceph/openstack.yaml
+++ b/tcp_tests/templates/virtual-mcp-ocata-ovs-ceph/openstack.yaml
@@ -259,6 +259,12 @@
   retry: {count: 1, delay: 30}
   skip_fail: false
 
+- description: Enable forward policy
+  cmd: iptables --policy FORWARD ACCEPT
+  node_name: {{ HOSTNAME_GTW01 }}
+  retry: {count: 1, delay: 30}
+  skip_fail: false
+
 - description: create rc file on cfg
   cmd: scp ctl01:/root/keystonercv3 /root
   node_name: {{ HOSTNAME_CFG01 }}
diff --git a/tcp_tests/templates/virtual-mcp-ocata-ovs/openstack.yaml b/tcp_tests/templates/virtual-mcp-ocata-ovs/openstack.yaml
index a82a5f6..613814a 100644
--- a/tcp_tests/templates/virtual-mcp-ocata-ovs/openstack.yaml
+++ b/tcp_tests/templates/virtual-mcp-ocata-ovs/openstack.yaml
@@ -361,6 +361,12 @@
   retry: {count: 1, delay: 30}
   skip_fail: false
 
+- description: Enable forward policy
+  cmd: iptables --policy FORWARD ACCEPT
+  node_name: {{ HOSTNAME_GTW01 }}
+  retry: {count: 1, delay: 30}
+  skip_fail: false
+
 - description: create rc file on cfg
   cmd: scp ctl01:/root/keystonercv3 /root
   node_name: {{ HOSTNAME_CFG01 }}
diff --git a/tcp_tests/templates/virtual-mcp-pike-dvr-ceph-rgw/openstack.yaml b/tcp_tests/templates/virtual-mcp-pike-dvr-ceph-rgw/openstack.yaml
index f4903a9..c5f0593 100644
--- a/tcp_tests/templates/virtual-mcp-pike-dvr-ceph-rgw/openstack.yaml
+++ b/tcp_tests/templates/virtual-mcp-pike-dvr-ceph-rgw/openstack.yaml
@@ -259,6 +259,12 @@
   retry: {count: 1, delay: 30}
   skip_fail: false
 
+- description: Enable forward policy
+  cmd: iptables --policy FORWARD ACCEPT
+  node_name: {{ HOSTNAME_GTW01 }}
+  retry: {count: 1, delay: 30}
+  skip_fail: false
+
 - description: create rc file on cfg
   cmd: scp ctl01:/root/keystonercv3 /root
   node_name: {{ HOSTNAME_CFG01 }}
diff --git a/tcp_tests/templates/virtual-mcp-pike-dvr-ssl/openstack.yaml b/tcp_tests/templates/virtual-mcp-pike-dvr-ssl/openstack.yaml
index 5d573d7..5fdf941 100644
--- a/tcp_tests/templates/virtual-mcp-pike-dvr-ssl/openstack.yaml
+++ b/tcp_tests/templates/virtual-mcp-pike-dvr-ssl/openstack.yaml
@@ -381,6 +381,12 @@
   retry: {count: 1, delay: 30}
   skip_fail: false
 
+- description: Enable forward policy
+  cmd: iptables --policy FORWARD ACCEPT
+  node_name: {{ HOSTNAME_GTW01 }}
+  retry: {count: 1, delay: 30}
+  skip_fail: false
+
 - description: Restart cinder volume
   cmd: |
     salt -C 'I@cinder:controller' service.restart cinder-volume;
diff --git a/tcp_tests/templates/virtual-mcp-pike-dvr/openstack.yaml b/tcp_tests/templates/virtual-mcp-pike-dvr/openstack.yaml
index 45ededb..8276b67 100644
--- a/tcp_tests/templates/virtual-mcp-pike-dvr/openstack.yaml
+++ b/tcp_tests/templates/virtual-mcp-pike-dvr/openstack.yaml
@@ -375,6 +375,12 @@
   retry: {count: 1, delay: 30}
   skip_fail: false
 
+- description: Enable forward policy
+  cmd: iptables --policy FORWARD ACCEPT
+  node_name: {{ HOSTNAME_GTW01 }}
+  retry: {count: 1, delay: 30}
+  skip_fail: false
+
 - description: Restart cinder volume
   cmd: |
     salt -C 'I@cinder:controller' service.restart cinder-volume;
diff --git a/tcp_tests/templates/virtual-mcp-pike-ovs-ceph/openstack.yaml b/tcp_tests/templates/virtual-mcp-pike-ovs-ceph/openstack.yaml
index 9d7dbf4..34692c7 100644
--- a/tcp_tests/templates/virtual-mcp-pike-ovs-ceph/openstack.yaml
+++ b/tcp_tests/templates/virtual-mcp-pike-ovs-ceph/openstack.yaml
@@ -259,6 +259,12 @@
   retry: {count: 1, delay: 30}
   skip_fail: false
 
+- description: Enable forward policy
+  cmd: iptables --policy FORWARD ACCEPT
+  node_name: {{ HOSTNAME_GTW01 }}
+  retry: {count: 1, delay: 30}
+  skip_fail: false
+
 - description: create rc file on cfg
   cmd: scp ctl01:/root/keystonercv3 /root
   node_name: {{ HOSTNAME_CFG01 }}
diff --git a/tcp_tests/templates/virtual-mcp-pike-ovs/openstack.yaml b/tcp_tests/templates/virtual-mcp-pike-ovs/openstack.yaml
index f804ead..fa6aa9c 100644
--- a/tcp_tests/templates/virtual-mcp-pike-ovs/openstack.yaml
+++ b/tcp_tests/templates/virtual-mcp-pike-ovs/openstack.yaml
@@ -409,6 +409,12 @@
   retry: {count: 1, delay: 30}
   skip_fail: false
 
+- description: Enable forward policy
+  cmd: iptables --policy FORWARD ACCEPT
+  node_name: {{ HOSTNAME_GTW01 }}
+  retry: {count: 1, delay: 30}
+  skip_fail: false
+
 - description: create rc file on cfg
   cmd: scp ctl01:/root/keystonercv3 /root
   node_name: {{ HOSTNAME_CFG01 }}
diff --git a/tcp_tests/templates/virtual-mcp-sl-os/openstack.yaml b/tcp_tests/templates/virtual-mcp-sl-os/openstack.yaml
index 9c2b134..fe35460 100644
--- a/tcp_tests/templates/virtual-mcp-sl-os/openstack.yaml
+++ b/tcp_tests/templates/virtual-mcp-sl-os/openstack.yaml
@@ -281,6 +281,14 @@
   retry: {count: 1, delay: 30}
   skip_fail: false
 
+- description: Enable forward policy on gtw
+  cmd: |
+    set -e;
+    iptables --policy FORWARD ACCEPT;
+  node_name: {{ HOSTNAME_GTW01 }}
+  retry: {count: 1, delay: 30}
+  skip_fail: false
+
 - description: create rc file on cfg
   cmd: scp ctl01:/root/keystonercv3 /root
   node_name: {{ HOSTNAME_CFG01 }}
diff --git a/tcp_tests/templates/virtual-offline-pike-ovs/openstack.yaml b/tcp_tests/templates/virtual-offline-pike-ovs/openstack.yaml
index 0575c58..1e5d62e 100644
--- a/tcp_tests/templates/virtual-offline-pike-ovs/openstack.yaml
+++ b/tcp_tests/templates/virtual-offline-pike-ovs/openstack.yaml
@@ -344,6 +344,14 @@
   retry: {count: 1, delay: 30}
   skip_fail: false
 
+- description: Enable forward policy on gtw
+  cmd: |
+    set -e;
+    iptables --policy FORWARD ACCEPT;
+  node_name: {{ HOSTNAME_GTW01 }}
+  retry: {count: 1, delay: 30}
+  skip_fail: false
+
 - description: create rc file on cfg
   cmd: scp ctl01:/root/keystonercv3 /root
   node_name: {{ HOSTNAME_CFG01 }}