Update 'mcp-ocata-local-repo-dvr' to use parametrized repo URLs
See mcp-ocata-local-repo-dvr/run_test.sh for environment
variables details
Change-Id: Ice126c5ce729cb932bb93b0b7e5297630d043f50
diff --git a/tcp_tests/templates/mcp-ocata-local-repo-dvr/run_test.sh b/tcp_tests/templates/mcp-ocata-local-repo-dvr/run_test.sh
new file mode 100644
index 0000000..8958ee8
--- /dev/null
+++ b/tcp_tests/templates/mcp-ocata-local-repo-dvr/run_test.sh
@@ -0,0 +1,21 @@
+export REPOSITORY_SUITE=2017.12
+export SALT_MODELS_SYSTEM_REPOSITORY=https://gerrit.mcp.mirantis.local.test/salt-models/reclass-system
+export SALT_FORMULAS_REPO=https://gerrit.mcp.mirantis.local.test/salt-formulas
+
+# Offline deployment simulation, requests to the apt01 node are redirected to publicly available repositories
+export FORMULA_REPOSITORY="deb [arch=amd64] http://apt.mirantis.local.test/xenial ${REPOSITORY_SUITE} salt"
+export FORMULA_GPG="http://apt.mirantis.local.test/public.gpg"
+export SALT_REPOSITORY="deb http://apt.mirantis.com/xenial/salt/2016.3/ ${REPOSITORY_SUITE} main"
+export SALT_GPG="http://apt.mirantis.local.test/public.gpg"
+export UBUNTU_REPOSITORY="deb http://mirror.mcp.mirantis.local.test/${REPOSITORY_SUITE}/ubuntu xenial main universe restricted"
+export UBUNTU_UPDATES_REPOSITORY="deb http://mirror.mcp.mirantis.local.test/${REPOSITORY_SUITE}/ubuntu xenial-updates main universe restricted"
+export UBUNTU_SECURITY_REPOSITORY="deb http://mirror.mcp.mirantis.local.test/${REPOSITORY_SUITE}/ubuntu xenial-security main universe restricted"
+
+# Offline deployment simulation, requests to the apt01 node are redirected to an 'offline apt node' with mirrors of repositories
+export FORMULA_REPOSITORY="deb [arch=amd64] http://apt.mirantis.local.test/ubuntu-xenial ${REPOSITORY_SUITE} salt extra"
+export FORMULA_GPG="http://apt.mirantis.local.test/public.gpg"
+export SALT_REPOSITORY="deb [arch=amd64] http://apt.mirantis.local.test/ubuntu-xenial/salt/2016.3/ ${REPOSITORY_SUITE} main"
+export SALT_GPG="http://apt.mirantis.local.test/public.gpg"
+export UBUNTU_REPOSITORY="deb http://mirror.mcp.mirantis.local.test/ubuntu xenial main universe restricted"
+export UBUNTU_UPDATES_REPOSITORY="deb http://mirror.mcp.mirantis.local.test/ubuntu xenial-updates main universe restricted"
+export UBUNTU_SECURITY_REPOSITORY="deb http://mirror.mcp.mirantis.local.test/ubuntu xenial-security main universe restricted"
diff --git a/tcp_tests/templates/mcp-ocata-local-repo-dvr/salt.yaml b/tcp_tests/templates/mcp-ocata-local-repo-dvr/salt.yaml
index 78a2ef6..260aeef 100644
--- a/tcp_tests/templates/mcp-ocata-local-repo-dvr/salt.yaml
+++ b/tcp_tests/templates/mcp-ocata-local-repo-dvr/salt.yaml
@@ -17,7 +17,7 @@
# Other salt model repository parameters see in shared-salt.yaml
-{% import 'shared-salt-offline.yaml' as SHARED with context %}
+{% import 'shared-salt.yaml' as SHARED with context %}
{% from 'shared-salt.yaml' import IPV4_NET_CONTROL_PREFIX with context %}
#- description: 'Generate nginx cert'
@@ -57,6 +57,13 @@
{{ SHARED.MACRO_CLONE_RECLASS_MODELS() }}
+- description: 'Workaround of local_repo_url - set to offline image repository structure'
+ cmd: |
+ find /srv/salt/reclass/classes/cluster -type f -exec sed -i 's/local_repo_url: .*/local_repo_url: mirror.mcp.mirantis.local.test/g' {} +
+ node_name: {{ HOSTNAME_CFG01 }}
+ retry: {count: 1, delay: 10}
+ skip_fail: false
+
{{ SHARED.MACRO_CONFIGURE_RECLASS(FORMULA_SERVICES='"linux" "reclass" "salt" "openssh" "ntp" "git" "nginx" "collectd" "sensu" "heka" "sphinx" "keystone" "mysql" "grafana" "haproxy" "rsyslog" "horizon" "prometheus" "telegraf" "elasticsearch" "powerdns"') }}
{{ SHARED.MACRO_INSTALL_SALT_MINIONS() }}
diff --git a/tcp_tests/templates/mcp-ocata-local-repo-dvr/underlay--user-data-apt01.yaml b/tcp_tests/templates/mcp-ocata-local-repo-dvr/underlay--user-data-apt01.yaml
index 8a29259..7faeee0 100644
--- a/tcp_tests/templates/mcp-ocata-local-repo-dvr/underlay--user-data-apt01.yaml
+++ b/tcp_tests/templates/mcp-ocata-local-repo-dvr/underlay--user-data-apt01.yaml
@@ -78,6 +78,13 @@
- cp /srv/pillar/top_localdns.sls /srv/pillar/top.sls;
- cp /srv/salt/top_localdns.sls /srv/salt/top.sls;
- find /srv/pillar/ -type f -exec sed -i "s/==LOCAL_DNS_IP==/${LOCAL_DNS_IP}/g" {} +
+ - find /srv/pillar/ -type f -exec sed -i "s/==HOST_APT==/{{ os_env('HOST_APT', 'apt.mirantis.com') }}/g" {} +
+ - find /srv/pillar/ -type f -exec sed -i "s/==HOST_SALTSTACK==/{{ os_env('HOST_SALTSTACK', 'repo.saltstack.com') }}/g" {} +
+ - find /srv/pillar/ -type f -exec sed -i "s/==HOST_ARCHIVE_UBUNTU==/{{ os_env('HOST_ARCHIVE_UBUNTU', 'archive.ubuntu.com') }}/g" {} +
+ - find /srv/pillar/ -type f -exec sed -i "s/==HOST_MIRROR_MCP_MIRANTIS==/{{ os_env('HOST_MIRROR_MCP_MIRANTIS', 'mirror.mcp.mirantis.net') }}/g" {} +
+ - find /srv/pillar/ -type f -exec sed -i "s/==HOST_MIRROR_FUEL_INFRA==/{{ os_env('HOST_MIRROR_FUEL_INFRA', 'mirror.fuel-infra.org') }}/g" {} +
+ - find /srv/pillar/ -type f -exec sed -i "s/==HOST_PPA_LAUNCHPAD==/{{ os_env('HOST_PPA_LAUNCHPAD', 'ppa.launchpad.net') }}/g" {} +
+ - find /srv/pillar/ -type f -exec sed -i "s/==HOST_GERRIT_MCP_MIRANTIS==/{{ os_env('HOST_GERRIT_MCP_MIRANTIS', 'gerrit.mcp.mirantis.net') }}/g" {} +
- salt-call --local --state-output=mixed state.sls dnsmasq;
- salt-call --local --state-output=mixed state.sls nginx;
########################################################
diff --git a/tcp_tests/templates/mcp-ocata-local-repo-dvr/underlay.yaml b/tcp_tests/templates/mcp-ocata-local-repo-dvr/underlay.yaml
index a9ac4c0..cb0b188 100644
--- a/tcp_tests/templates/mcp-ocata-local-repo-dvr/underlay.yaml
+++ b/tcp_tests/templates/mcp-ocata-local-repo-dvr/underlay.yaml
@@ -15,7 +15,8 @@
- &cloudinit_user_data_1604 {{ CLOUDINIT_USER_DATA_1604 }}
- &cloudinit_user_data_apt01 {{ CLOUDINIT_USER_DATA_APT01 }}
-{% set DOMAIN_NAME = os_env('LAB_CONFIG_NAME', 'mcp-ocata-local-repo-dvr') + '.local' %}
+{% set LAB_CONFIG_NAME = os_env('LAB_CONFIG_NAME', 'mcp-ocata-local-repo-dvr') %}
+{% set DOMAIN_NAME = os_env('DOMAIN_NAME', LAB_CONFIG_NAME + '.local') %}
{% set HOSTNAME_APT01 = os_env('HOSTNAME_APT01', 'apt01.' + DOMAIN_NAME) %}
{% set HOSTNAME_CFG01 = os_env('HOSTNAME_CFG01', 'cfg01.' + DOMAIN_NAME) %}
{% set HOSTNAME_CTL01 = os_env('HOSTNAME_CTL01', 'ctl01.' + DOMAIN_NAME) %}