Use MACRO_INSTALL_FORMULAS for model generators

Change-Id: I91ff0664c819e4fc49d334473231d387063f9910
diff --git a/tcp_tests/templates/cookied-model-generator/salt_cookied-bm-mcp-ocata-contrail.yaml b/tcp_tests/templates/cookied-model-generator/salt_cookied-bm-mcp-ocata-contrail.yaml
index c5681be..0915547 100644
--- a/tcp_tests/templates/cookied-model-generator/salt_cookied-bm-mcp-ocata-contrail.yaml
+++ b/tcp_tests/templates/cookied-model-generator/salt_cookied-bm-mcp-ocata-contrail.yaml
@@ -13,30 +13,8 @@
 {% import 'shared-salt.yaml' as SHARED with context %}
 
 {{ SHARED.MACRO_INSTALL_PACKAGES_ON_NODES(HOSTNAME_CFG01) }}
-- description: Re-install all the fromulas
-  cmd: |
-    set -e;
-    apt-get install -y salt-formula-*
-  node_name: {{ HOSTNAME_CFG01 }}
-  retry: {count: 1, delay: 1}
-  skip_fail: false
 
-- description: Sync formulas to service
-  cmd: |
-    set -e;
-    RECLASS_ROOT=${RECLASS_ROOT:-/srv/salt/reclass/};
-    FORMULAS_PATH=${FORMULAS_PATH:-/usr/share/salt-formulas};
-    [ ! -d ${RECLASS_ROOT}/classes/service ] && mkdir -p ${RECLASS_ROOT}/classes/service;
-    for formula_service in $(ls /usr/share/salt-formulas/reclass/service/); do
-        #Since some salt formula names contain "-" and in symlinks they should contain "_" adding replacement;
-        formula_service=${formula_service//-/$'_'};
-        if [ ! -L "${RECLASS_ROOT}/classes/service/${formula_service}" ]; then
-            ln -sf ${FORMULAS_PATH}/reclass/service/${formula_service} ${RECLASS_ROOT}/classes/service/${formula_service};
-        fi;
-    done
-  node_name: {{ HOSTNAME_CFG01 }}
-  retry: {count: 1, delay: 1}
-  skip_fail: false
+{{ SHARED.MACRO_INSTALL_FORMULAS('\*') }}
 
 {{ SHARED.MACRO_GENERATE_COOKIECUTTER_MODEL(CONTROL_VLAN=CONTROL_VLAN, TENANT_VLAN=TENANT_VLAN) }}
 
diff --git a/tcp_tests/templates/cookied-model-generator/salt_cookied-mcp-mitaka-dvr.yaml b/tcp_tests/templates/cookied-model-generator/salt_cookied-mcp-mitaka-dvr.yaml
index 20d39b0..22297a6 100644
--- a/tcp_tests/templates/cookied-model-generator/salt_cookied-mcp-mitaka-dvr.yaml
+++ b/tcp_tests/templates/cookied-model-generator/salt_cookied-mcp-mitaka-dvr.yaml
@@ -24,30 +24,8 @@
 {% import 'shared-salt.yaml' as SHARED with context %}
 
 {{ SHARED.MACRO_INSTALL_PACKAGES_ON_NODES(HOSTNAME_CFG01) }}
-- description: Re-install all the fromulas
-  cmd: |
-    set -e;
-    apt-get install -y salt-formula-*
-  node_name: {{ HOSTNAME_CFG01 }}
-  retry: {count: 1, delay: 1}
-  skip_fail: false
 
-- description: Sync formulas to service
-  cmd: |
-    set -e;
-    RECLASS_ROOT=${RECLASS_ROOT:-/srv/salt/reclass/};
-    FORMULAS_PATH=${FORMULAS_PATH:-/usr/share/salt-formulas};
-    [ ! -d ${RECLASS_ROOT}/classes/service ] && mkdir -p ${RECLASS_ROOT}/classes/service;
-    for formula_service in $(ls /usr/share/salt-formulas/reclass/service/); do
-        #Since some salt formula names contain "-" and in symlinks they should contain "_" adding replacement;
-        formula_service=${formula_service//-/$'_'};
-        if [ ! -L "${RECLASS_ROOT}/classes/service/${formula_service}" ]; then
-            ln -sf ${FORMULAS_PATH}/reclass/service/${formula_service} ${RECLASS_ROOT}/classes/service/${formula_service};
-        fi;
-    done
-  node_name: {{ HOSTNAME_CFG01 }}
-  retry: {count: 1, delay: 1}
-  skip_fail: false
+{{ SHARED.MACRO_INSTALL_FORMULAS('\*') }}
 
 {{ SHARED.MACRO_GENERATE_COOKIECUTTER_MODEL() }}
 
diff --git a/tcp_tests/templates/cookied-model-generator/salt_cookied-mcp-mitaka-ovs.yaml b/tcp_tests/templates/cookied-model-generator/salt_cookied-mcp-mitaka-ovs.yaml
index d89f577..48e019a 100644
--- a/tcp_tests/templates/cookied-model-generator/salt_cookied-mcp-mitaka-ovs.yaml
+++ b/tcp_tests/templates/cookied-model-generator/salt_cookied-mcp-mitaka-ovs.yaml
@@ -22,30 +22,8 @@
 {% import 'shared-salt.yaml' as SHARED with context %}
 
 {{ SHARED.MACRO_INSTALL_PACKAGES_ON_NODES(HOSTNAME_CFG01) }}
-- description: Re-install all the fromulas
-  cmd: |
-    set -e;
-    apt-get install -y salt-formula-*
-  node_name: {{ HOSTNAME_CFG01 }}
-  retry: {count: 1, delay: 1}
-  skip_fail: false
 
-- description: Sync formulas to service
-  cmd: |
-    set -e;
-    RECLASS_ROOT=${RECLASS_ROOT:-/srv/salt/reclass/};
-    FORMULAS_PATH=${FORMULAS_PATH:-/usr/share/salt-formulas};
-    [ ! -d ${RECLASS_ROOT}/classes/service ] && mkdir -p ${RECLASS_ROOT}/classes/service;
-    for formula_service in $(ls /usr/share/salt-formulas/reclass/service/); do
-        #Since some salt formula names contain "-" and in symlinks they should contain "_" adding replacement;
-        formula_service=${formula_service//-/$'_'};
-        if [ ! -L "${RECLASS_ROOT}/classes/service/${formula_service}" ]; then
-            ln -sf ${FORMULAS_PATH}/reclass/service/${formula_service} ${RECLASS_ROOT}/classes/service/${formula_service};
-        fi;
-    done
-  node_name: {{ HOSTNAME_CFG01 }}
-  retry: {count: 1, delay: 1}
-  skip_fail: false
+{{ SHARED.MACRO_INSTALL_FORMULAS('\*') }}
 
 {{ SHARED.MACRO_GENERATE_COOKIECUTTER_MODEL() }}
 
diff --git a/tcp_tests/templates/cookied-model-generator/salt_cookied-mcp-ocata-dop-sl2.yaml b/tcp_tests/templates/cookied-model-generator/salt_cookied-mcp-ocata-dop-sl2.yaml
index 6193a47..0178514 100644
--- a/tcp_tests/templates/cookied-model-generator/salt_cookied-mcp-ocata-dop-sl2.yaml
+++ b/tcp_tests/templates/cookied-model-generator/salt_cookied-mcp-ocata-dop-sl2.yaml
@@ -14,30 +14,8 @@
 {% import 'shared-salt.yaml' as SHARED with context %}
 
 {{ SHARED.MACRO_INSTALL_PACKAGES_ON_NODES(HOSTNAME_CFG01) }}
-- description: Re-install all the fromulas
-  cmd: |
-    set -e;
-    apt-get install -y salt-formula-*
-  node_name: {{ HOSTNAME_CFG01 }}
-  retry: {count: 1, delay: 1}
-  skip_fail: false
 
-- description: Sync formulas to service
-  cmd: |
-    set -e;
-    RECLASS_ROOT=${RECLASS_ROOT:-/srv/salt/reclass/};
-    FORMULAS_PATH=${FORMULAS_PATH:-/usr/share/salt-formulas};
-    [ ! -d ${RECLASS_ROOT}/classes/service ] && mkdir -p ${RECLASS_ROOT}/classes/service;
-    for formula_service in $(ls /usr/share/salt-formulas/reclass/service/); do
-        #Since some salt formula names contain "-" and in symlinks they should contain "_" adding replacement;
-        formula_service=${formula_service//-/$'_'};
-        if [ ! -L "${RECLASS_ROOT}/classes/service/${formula_service}" ]; then
-            ln -sf ${FORMULAS_PATH}/reclass/service/${formula_service} ${RECLASS_ROOT}/classes/service/${formula_service};
-        fi;
-    done
-  node_name: {{ HOSTNAME_CFG01 }}
-  retry: {count: 1, delay: 1}
-  skip_fail: false
+{{ SHARED.MACRO_INSTALL_FORMULAS('\*') }}
 
 {{ SHARED.MACRO_GENERATE_COOKIECUTTER_MODEL() }}
 
diff --git a/tcp_tests/templates/cookied-model-generator/salt_cookied-mcp-ocata-dvr-vxlan.yaml b/tcp_tests/templates/cookied-model-generator/salt_cookied-mcp-ocata-dvr-vxlan.yaml
index 10835d9..38a1d10 100644
--- a/tcp_tests/templates/cookied-model-generator/salt_cookied-mcp-ocata-dvr-vxlan.yaml
+++ b/tcp_tests/templates/cookied-model-generator/salt_cookied-mcp-ocata-dvr-vxlan.yaml
@@ -11,30 +11,8 @@
 {% import 'shared-salt.yaml' as SHARED with context %}
 
 {{ SHARED.MACRO_INSTALL_PACKAGES_ON_NODES(HOSTNAME_CFG01) }}
-- description: Re-install all the fromulas
-  cmd: |
-    set -e;
-    apt-get install -y salt-formula-*
-  node_name: {{ HOSTNAME_CFG01 }}
-  retry: {count: 1, delay: 1}
-  skip_fail: false
 
-- description: Sync formulas to service
-  cmd: |
-    set -e;
-    RECLASS_ROOT=${RECLASS_ROOT:-/srv/salt/reclass/};
-    FORMULAS_PATH=${FORMULAS_PATH:-/usr/share/salt-formulas};
-    [ ! -d ${RECLASS_ROOT}/classes/service ] && mkdir -p ${RECLASS_ROOT}/classes/service;
-    for formula_service in $(ls /usr/share/salt-formulas/reclass/service/); do
-        #Since some salt formula names contain "-" and in symlinks they should contain "_" adding replacement;
-        formula_service=${formula_service//-/$'_'};
-        if [ ! -L "${RECLASS_ROOT}/classes/service/${formula_service}" ]; then
-            ln -sf ${FORMULAS_PATH}/reclass/service/${formula_service} ${RECLASS_ROOT}/classes/service/${formula_service};
-        fi;
-    done
-  node_name: {{ HOSTNAME_CFG01 }}
-  retry: {count: 1, delay: 1}
-  skip_fail: false
+{{ SHARED.MACRO_INSTALL_FORMULAS('\*') }}
 
 {{ SHARED.MACRO_GENERATE_COOKIECUTTER_MODEL() }}
 
diff --git a/tcp_tests/templates/cookied-model-generator/salt_cookied-mcp-ocata-dvr.yaml b/tcp_tests/templates/cookied-model-generator/salt_cookied-mcp-ocata-dvr.yaml
index 29423f9..55e8c2a 100644
--- a/tcp_tests/templates/cookied-model-generator/salt_cookied-mcp-ocata-dvr.yaml
+++ b/tcp_tests/templates/cookied-model-generator/salt_cookied-mcp-ocata-dvr.yaml
@@ -14,30 +14,8 @@
 {% import 'shared-salt.yaml' as SHARED with context %}
 
 {{ SHARED.MACRO_INSTALL_PACKAGES_ON_NODES(HOSTNAME_CFG01) }}
-- description: Re-install all the fromulas
-  cmd: |
-    set -e;
-    apt-get install -y salt-formula-*
-  node_name: {{ HOSTNAME_CFG01 }}
-  retry: {count: 1, delay: 1}
-  skip_fail: false
 
-- description: Sync formulas to service
-  cmd: |
-    set -e;
-    RECLASS_ROOT=${RECLASS_ROOT:-/srv/salt/reclass/};
-    FORMULAS_PATH=${FORMULAS_PATH:-/usr/share/salt-formulas};
-    [ ! -d ${RECLASS_ROOT}/classes/service ] && mkdir -p ${RECLASS_ROOT}/classes/service;
-    for formula_service in $(ls /usr/share/salt-formulas/reclass/service/); do
-        #Since some salt formula names contain "-" and in symlinks they should contain "_" adding replacement;
-        formula_service=${formula_service//-/$'_'};
-        if [ ! -L "${RECLASS_ROOT}/classes/service/${formula_service}" ]; then
-            ln -sf ${FORMULAS_PATH}/reclass/service/${formula_service} ${RECLASS_ROOT}/classes/service/${formula_service};
-        fi;
-    done
-  node_name: {{ HOSTNAME_CFG01 }}
-  retry: {count: 1, delay: 1}
-  skip_fail: false
+{{ SHARED.MACRO_INSTALL_FORMULAS('\*') }}
 
 {{ SHARED.MACRO_GENERATE_COOKIECUTTER_MODEL() }}
 
diff --git a/tcp_tests/templates/cookied-model-generator/salt_cookied-mcp-ocata-ovs.yaml b/tcp_tests/templates/cookied-model-generator/salt_cookied-mcp-ocata-ovs.yaml
index 7a5f849..911b935 100644
--- a/tcp_tests/templates/cookied-model-generator/salt_cookied-mcp-ocata-ovs.yaml
+++ b/tcp_tests/templates/cookied-model-generator/salt_cookied-mcp-ocata-ovs.yaml
@@ -14,30 +14,8 @@
 {% import 'shared-salt.yaml' as SHARED with context %}
 
 {{ SHARED.MACRO_INSTALL_PACKAGES_ON_NODES(HOSTNAME_CFG01) }}
-- description: Re-install all the fromulas
-  cmd: |
-    set -e;
-    apt-get install -y salt-formula-*
-  node_name: {{ HOSTNAME_CFG01 }}
-  retry: {count: 1, delay: 1}
-  skip_fail: false
 
-- description: Sync formulas to service
-  cmd: |
-    set -e;
-    RECLASS_ROOT=${RECLASS_ROOT:-/srv/salt/reclass/};
-    FORMULAS_PATH=${FORMULAS_PATH:-/usr/share/salt-formulas};
-    [ ! -d ${RECLASS_ROOT}/classes/service ] && mkdir -p ${RECLASS_ROOT}/classes/service;
-    for formula_service in $(ls /usr/share/salt-formulas/reclass/service/); do
-        #Since some salt formula names contain "-" and in symlinks they should contain "_" adding replacement;
-        formula_service=${formula_service//-/$'_'};
-        if [ ! -L "${RECLASS_ROOT}/classes/service/${formula_service}" ]; then
-            ln -sf ${FORMULAS_PATH}/reclass/service/${formula_service} ${RECLASS_ROOT}/classes/service/${formula_service};
-        fi;
-    done
-  node_name: {{ HOSTNAME_CFG01 }}
-  retry: {count: 1, delay: 1}
-  skip_fail: false
+{{ SHARED.MACRO_INSTALL_FORMULAS('\*') }}
 
 {{ SHARED.MACRO_GENERATE_COOKIECUTTER_MODEL() }}
 
diff --git a/tcp_tests/templates/cookied-model-generator/salt_cookied-mcp-pike-dpdk.yaml b/tcp_tests/templates/cookied-model-generator/salt_cookied-mcp-pike-dpdk.yaml
index 02a0fd8..97313de 100644
--- a/tcp_tests/templates/cookied-model-generator/salt_cookied-mcp-pike-dpdk.yaml
+++ b/tcp_tests/templates/cookied-model-generator/salt_cookied-mcp-pike-dpdk.yaml
@@ -11,30 +11,8 @@
 {% import 'shared-salt.yaml' as SHARED with context %}
 
 {{ SHARED.MACRO_INSTALL_PACKAGES_ON_NODES(HOSTNAME_CFG01) }}
-- description: Re-install all the fromulas
-  cmd: |
-    set -e;
-    apt-get install -y salt-formula-*
-  node_name: {{ HOSTNAME_CFG01 }}
-  retry: {count: 1, delay: 1}
-  skip_fail: false
 
-- description: Sync formulas to service
-  cmd: |
-    set -e;
-    RECLASS_ROOT=${RECLASS_ROOT:-/srv/salt/reclass/};
-    FORMULAS_PATH=${FORMULAS_PATH:-/usr/share/salt-formulas};
-    [ ! -d ${RECLASS_ROOT}/classes/service ] && mkdir -p ${RECLASS_ROOT}/classes/service;
-    for formula_service in $(ls /usr/share/salt-formulas/reclass/service/); do
-        #Since some salt formula names contain "-" and in symlinks they should contain "_" adding replacement;
-        formula_service=${formula_service//-/$'_'};
-        if [ ! -L "${RECLASS_ROOT}/classes/service/${formula_service}" ]; then
-            ln -sf ${FORMULAS_PATH}/reclass/service/${formula_service} ${RECLASS_ROOT}/classes/service/${formula_service};
-        fi;
-    done
-  node_name: {{ HOSTNAME_CFG01 }}
-  retry: {count: 1, delay: 1}
-  skip_fail: false
+{{ SHARED.MACRO_INSTALL_FORMULAS('\*') }}
 
 {{ SHARED.MACRO_GENERATE_COOKIECUTTER_MODEL() }}
 
diff --git a/tcp_tests/templates/cookied-model-generator/salt_cookied-mcp-pike-dvr.yaml b/tcp_tests/templates/cookied-model-generator/salt_cookied-mcp-pike-dvr.yaml
index f069181..838bc31 100644
--- a/tcp_tests/templates/cookied-model-generator/salt_cookied-mcp-pike-dvr.yaml
+++ b/tcp_tests/templates/cookied-model-generator/salt_cookied-mcp-pike-dvr.yaml
@@ -11,30 +11,8 @@
 {% import 'shared-salt.yaml' as SHARED with context %}
 
 {{ SHARED.MACRO_INSTALL_PACKAGES_ON_NODES(HOSTNAME_CFG01) }}
-- description: Re-install all the fromulas
-  cmd: |
-    set -e;
-    apt-get install -y salt-formula-*
-  node_name: {{ HOSTNAME_CFG01 }}
-  retry: {count: 1, delay: 1}
-  skip_fail: false
 
-- description: Sync formulas to service
-  cmd: |
-    set -e;
-    RECLASS_ROOT=${RECLASS_ROOT:-/srv/salt/reclass/};
-    FORMULAS_PATH=${FORMULAS_PATH:-/usr/share/salt-formulas};
-    [ ! -d ${RECLASS_ROOT}/classes/service ] && mkdir -p ${RECLASS_ROOT}/classes/service;
-    for formula_service in $(ls /usr/share/salt-formulas/reclass/service/); do
-        #Since some salt formula names contain "-" and in symlinks they should contain "_" adding replacement;
-        formula_service=${formula_service//-/$'_'};
-        if [ ! -L "${RECLASS_ROOT}/classes/service/${formula_service}" ]; then
-            ln -sf ${FORMULAS_PATH}/reclass/service/${formula_service} ${RECLASS_ROOT}/classes/service/${formula_service};
-        fi;
-    done
-  node_name: {{ HOSTNAME_CFG01 }}
-  retry: {count: 1, delay: 1}
-  skip_fail: false
+{{ SHARED.MACRO_INSTALL_FORMULAS('\*') }}
 
 {{ SHARED.MACRO_GENERATE_COOKIECUTTER_MODEL() }}
 
diff --git a/tcp_tests/templates/cookied-model-generator/salt_cookied-mcp-pike-ovs.yaml b/tcp_tests/templates/cookied-model-generator/salt_cookied-mcp-pike-ovs.yaml
index 0bad6a2..dd6c711 100644
--- a/tcp_tests/templates/cookied-model-generator/salt_cookied-mcp-pike-ovs.yaml
+++ b/tcp_tests/templates/cookied-model-generator/salt_cookied-mcp-pike-ovs.yaml
@@ -11,30 +11,8 @@
 {% import 'shared-salt.yaml' as SHARED with context %}
 
 {{ SHARED.MACRO_INSTALL_PACKAGES_ON_NODES(HOSTNAME_CFG01) }}
-- description: Re-install all the fromulas
-  cmd: |
-    set -e;
-    apt-get install -y salt-formula-*
-  node_name: {{ HOSTNAME_CFG01 }}
-  retry: {count: 1, delay: 1}
-  skip_fail: false
 
-- description: Sync formulas to service
-  cmd: |
-    set -e;
-    RECLASS_ROOT=${RECLASS_ROOT:-/srv/salt/reclass/};
-    FORMULAS_PATH=${FORMULAS_PATH:-/usr/share/salt-formulas};
-    [ ! -d ${RECLASS_ROOT}/classes/service ] && mkdir -p ${RECLASS_ROOT}/classes/service;
-    for formula_service in $(ls /usr/share/salt-formulas/reclass/service/); do
-        #Since some salt formula names contain "-" and in symlinks they should contain "_" adding replacement;
-        formula_service=${formula_service//-/$'_'};
-        if [ ! -L "${RECLASS_ROOT}/classes/service/${formula_service}" ]; then
-            ln -sf ${FORMULAS_PATH}/reclass/service/${formula_service} ${RECLASS_ROOT}/classes/service/${formula_service};
-        fi;
-    done
-  node_name: {{ HOSTNAME_CFG01 }}
-  retry: {count: 1, delay: 1}
-  skip_fail: false
+{{ SHARED.MACRO_INSTALL_FORMULAS('\*') }}
 
 {{ SHARED.MACRO_GENERATE_COOKIECUTTER_MODEL() }}