Minor fixes for contrail4.0 model

Change-Id: I47938c2b0b7d0ef94dc6f6d2dfa86683d690f507
diff --git a/tcp_tests/templates/cookied-bm-contrail40/lab04-physical-inventory.yaml b/tcp_tests/templates/cookied-bm-contrail40/lab04-physical-inventory.yaml
index c4f342f..5cb47fb 100644
--- a/tcp_tests/templates/cookied-bm-contrail40/lab04-physical-inventory.yaml
+++ b/tcp_tests/templates/cookied-bm-contrail40/lab04-physical-inventory.yaml
@@ -55,8 +55,6 @@
         enp5s0f0:

           role: bond0_ab_contrail

           tenant_address: 192.168.0.101

-          dpdk_pci: "'0000:05:00.0'"

-          dpdk_mac: '90:e2:ba:19:c2:18'

         enp5s0f1:

           role: single_vlan_ctl

           single_address: 10.167.8.101

@@ -74,37 +72,6 @@
         enp5s0f0:

           role: bond0_ab_contrail

           tenant_address: 192.168.0.102

-          dpdk_pci: "'0000:05:00.0'"

-          dpdk_mac: '00:1b:21:87:21:98'

         enp5s0f1:

           role: single_vlan_ctl

           single_address: 10.167.8.102

-

-    # Physical nodes for manual testing replacing resources

-    #    kvm04.cookied-bm-contrail40.local:

-    #      reclass_storage_name: infra_kvm_node04

-    #      roles:

-    #      - infra_kvm

-    #      - linux_system_codename_xenial

-    #      interfaces:

-    #        enp2s0f0:

-    #          role: single_mgm

-    #        enp2s0f1:

-    #          role: bond0_ab_ovs_vlan_ctl

-

-          #    cmp003.cookied-bm-contrail40.local:

-          #      reclass_storage_name: openstack_compute_node03

-          #      roles:

-          #      - openstack_compute

-          #      - features_lvm_backend

-          #      - linux_system_codename_xenial

-          #      interfaces:

-          #        enp2s0f0:

-          #          role: single_mgm

-          #          deploy_address: 172.16.49.122

-          #        enp2s0f1:

-          #          role: bond0_ab_ctl_contrail

-          #          tenant_address: 192.168.0.103

-          #          single_address: 10.167.8.103

-          #          dpdk_pci: "'0000:05:00.0'"

-          #          dpdk_mac: '00:1b:21:87:21:98'

diff --git a/tcp_tests/templates/cookied-bm-contrail40/salt.yaml b/tcp_tests/templates/cookied-bm-contrail40/salt.yaml
index cc5b43d..1b97dc7 100644
--- a/tcp_tests/templates/cookied-bm-contrail40/salt.yaml
+++ b/tcp_tests/templates/cookied-bm-contrail40/salt.yaml
@@ -1,9 +1,6 @@
 {% from 'cookied-bm-contrail40/underlay.yaml' import HOSTNAME_CFG01 with context %}
 {% from 'cookied-bm-contrail40/underlay.yaml' import LAB_CONFIG_NAME with context %}
 {% from 'cookied-bm-contrail40/underlay.yaml' import DOMAIN_NAME with context %}
-{% from 'cookied-bm-contrail40/underlay.yaml' import HOSTNAME_KVM01 with context %}
-{% from 'cookied-bm-contrail40/underlay.yaml' import HOSTNAME_KVM02 with context %}
-{% from 'cookied-bm-contrail40/underlay.yaml' import HOSTNAME_KVM03 with context %}
 
 {% set SALT_MODELS_REPOSITORY = os_env('SALT_MODELS_REPOSITORY','https://gerrit.mcp.mirantis.net/salt-models/mcp-virtual-lab') %}
 # Other salt model repository parameters see in shared-salt.yaml
@@ -43,15 +40,15 @@
   retry: {count: 1, delay: 10}
   skip_fail: false
 
-  #- description: "WR for changing image to proposed"
-  #  cmd: |
-  #    set -e;
+- description: "WR for changing image to proposed"
+  cmd: |
+    set -e;
     # Add message_queu host for opencontrail
-    #    . /root/venv-reclass-tools/bin/activate;
-    #    reclass-tools add-key parameters._param.salt_control_xenial_image 'http://ci.mcp.mirantis.net:8085/images/ubuntu-16-04-x64-mcp{{ SHARED.REPOSITORY_SUITE }}.qcow2' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/init.yml;
-    #  node_name: {{ HOSTNAME_CFG01 }}
-    #  retry: {count: 1, delay: 10}
-    #  skip_fail: false
+    . /root/venv-reclass-tools/bin/activate;
+    reclass-tools add-key parameters._param.salt_control_xenial_image 'http://ci.mcp.mirantis.net:8085/images/ubuntu-16-04-x64-mcp{{ SHARED.REPOSITORY_SUITE }}.qcow2' /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/init.yml;
+  node_name: {{ HOSTNAME_CFG01 }}
+  retry: {count: 1, delay: 10}
+  skip_fail: false
 
 - description: Temporary workaround for removing cinder-volume from CTL nodes
   cmd: |
@@ -127,7 +124,7 @@
 
 - description: Hack resolv.conf on VCP nodes for internal services access
   cmd: |
-    salt --hard-crash --state-output=mixed --state-verbose=False -C '* and not kvm* and not cmp* and not gtw* and not cfg*' cmd.run "echo 'nameserver 172.18.208.44' > /etc/resolv.conf;"
+    salt --hard-crash --state-output=mixed --state-verbose=False -C '* and not cfg*' cmd.run "echo 'nameserver 172.18.208.44' > /etc/resolv.conf;"
   node_name: {{ HOSTNAME_CFG01 }}
   retry: {count: 1, delay: 5}
   skip_fail: false
@@ -152,6 +149,10 @@
 
 {{ SHARED.MACRO_BOOTSTRAP_ALL_MINIONS() }}
 
+{{SHARED.MACRO_CHECK_SALT_VERSION_SERVICES_ON_CFG()}}
+
+{{SHARED.MACRO_CHECK_SALT_VERSION_ON_NODES()}}
+
 - description: "Lab04 workaround: Give each node root acces with key from cfg01"
   cmd: |
     set -e;
diff --git a/tcp_tests/templates/cookied-bm-contrail40/sl.yaml b/tcp_tests/templates/cookied-bm-contrail40/sl.yaml
index 3e07967..87651f8 100644
--- a/tcp_tests/templates/cookied-bm-contrail40/sl.yaml
+++ b/tcp_tests/templates/cookied-bm-contrail40/sl.yaml
@@ -107,11 +107,19 @@
   cmd: |
     if salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@prometheus:exporters' match.pillar 'prometheus:exporters' ; then
       salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@prometheus:exporters' state.sls prometheus
-      salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@prometheus:exporters' state.sls prometheus.collector
     fi
   node_name: {{ HOSTNAME_CFG01 }}
   retry: {count: 1, delay: 10}
-  skip_fail: true
+  skip_fail: false
+
+- description: Configure Prometheus exporters, if pillar 'prometheus:collector' exists on any server
+  cmd: |
+    if salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@prometheus:collector' match.pillar 'prometheus:collector' ; then
+      salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@prometheus:collector' state.sls prometheus.collector
+    fi
+  node_name: {{ HOSTNAME_CFG01 }}
+  retry: {count: 1, delay: 10}
+  skip_fail: false
 
 - description: Install elasticsearch server
   cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@elasticsearch:server' state.sls elasticsearch.server -b 1
@@ -255,4 +263,4 @@
   cmd: salt --hard-crash --state-output=mixed --state-verbose=False "*" state.sls salt.minion
   node_name: {{ HOSTNAME_CFG01 }}
   retry: {count: 3, delay: 15}
-  skip_fail: true
+  skip_fail: false