Update virtual-mcp11-k8s-contrail template

* Turn on virtlet by default
* Put all salt/model hacks in one place

Change-Id: I8b9bb809daf00e57145743da0acf642dbd9d15d2
Reviewed-on: https://review.gerrithub.io/370484
Reviewed-by: Dennis Dmitriev <dis.xcom@gmail.com>
Tested-by: Tatyanka Leontovich <tleontovich@mirantis.com>
diff --git a/tcp_tests/settings_oslo.py b/tcp_tests/settings_oslo.py
index f1bb073..e0dd605 100644
--- a/tcp_tests/settings_oslo.py
+++ b/tcp_tests/settings_oslo.py
@@ -249,7 +249,7 @@
     ct.Cfg('kubernetes_helm_enabled', ct.Boolean(),
            help="", default=True),
     ct.Cfg('kubernetes_virtlet_enabled', ct.Boolean(),
-           help="", default=False),
+           help="", default=True),
     ct.Cfg('kubernetes_virtlet_image', ct.String(),
            help="", default='mirantis/virtlet:latest')
 ]
diff --git a/tcp_tests/templates/virtual-mcp11-k8s-contrail/common-services.yaml b/tcp_tests/templates/virtual-mcp11-k8s-contrail/common-services.yaml
index cc5b267..4f9acc5 100644
--- a/tcp_tests/templates/virtual-mcp11-k8s-contrail/common-services.yaml
+++ b/tcp_tests/templates/virtual-mcp11-k8s-contrail/common-services.yaml
@@ -1,12 +1,5 @@
 {% from 'virtual-mcp11-k8s-contrail/underlay.yaml' import HOSTNAME_CFG01 with context %}
 
-- description: Temporary fix to untie k8s API from Opencontrail haproxy
-    That allows kube-api to be available over private network.
-  cmd: sed -i "s/vhost0/ens4/g" /srv/salt/reclass/classes/cluster/virtual-mcp11-k8s-contrail/kubernetes/control.yml
-  node_name: {{ HOSTNAME_CFG01 }}
-  retry: {count: 1, delay: 5}
-  skip_fail: true
-
 # Install support services
 - description: Create and distribute SSL certificates for services using salt state
   cmd: salt --hard-crash --state-output=mixed --state-verbose=False '*' state.sls salt
diff --git a/tcp_tests/templates/virtual-mcp11-k8s-contrail/k8s.yaml b/tcp_tests/templates/virtual-mcp11-k8s-contrail/k8s.yaml
index 725e21e..51984cc 100644
--- a/tcp_tests/templates/virtual-mcp11-k8s-contrail/k8s.yaml
+++ b/tcp_tests/templates/virtual-mcp11-k8s-contrail/k8s.yaml
@@ -1,14 +1,5 @@
 {% from 'virtual-mcp11-k8s-contrail/underlay.yaml' import HOSTNAME_CFG01 with context %}
 
-# Change environment configuration before deploy
-
-- description: Add workaround for linklocal incorrect installation
-  cmd: sed -i "s/ipf_addresses:.*/ipf_addresses:\ \${_param:cluster_node01_address}/g"
-    /srv/salt/reclass/classes/system/opencontrail/client/resource/k8s_api.yml
-  node_name: {{ HOSTNAME_CFG01 }}
-  retry: {count: 1, delay: 1}
-  skip_fail: false
-
 - description: Sync time on nodes
   cmd: salt '*' cmd.run "service ntp stop; ntpd -gq ;
     service ntp start; ntp-wait || exit 1"
diff --git a/tcp_tests/templates/virtual-mcp11-k8s-contrail/salt.yaml b/tcp_tests/templates/virtual-mcp11-k8s-contrail/salt.yaml
index fa45940..bfeed34 100644
--- a/tcp_tests/templates/virtual-mcp11-k8s-contrail/salt.yaml
+++ b/tcp_tests/templates/virtual-mcp11-k8s-contrail/salt.yaml
@@ -84,7 +84,12 @@
     find /srv/salt/reclass/ -type f -exec sed -i 's/==IPV4_NET_CONTROL_PREFIX==/{{ IPV4_NET_CONTROL_PREFIX }}./g' {} +
 
     find /srv/salt/reclass/ -type f -exec sed -i 's/apt_mk_version:.*/apt_mk_version: {{ REPOSITORY_SUITE }}/g' {} +
+
+    # vSRX IPs for tcp-qa images have 172.16.10.90 hardcoded
     find /srv/salt/reclass/ -type f -exec sed -i 's/opencontrail_router01_address:.*/opencontrail_router01_address: 172.16.10.90/g' {} +
+    # Replace VIP with IP of first controller. It should be removed when Kube-API VIP will be moved out of ens4/vhost0
+    find /srv/salt/reclass/ -type f -exec sed -i 's/ipf_addresses:.*/ipf_addresses: ${_param:cluster_node01_address}/g' {} +
+    perl -pi -e 's/vhost0/ens4/g' /srv/salt/reclass/classes/cluster/virtual-mcp11-k8s-contrail/kubernetes/control.yml
 
     # Disable checkouting the model from remote repository
     cat << 'EOF' >> /srv/salt/reclass/nodes/{{ HOSTNAME_CFG01 }}.yml