Move installation steps to YAML filex
- move installation steps to YAML files
- add fixtures and snapshots for install salt, common services
and openstack
- fixtures in conftest.py now are included by python instead of
using pytest plugins
diff --git a/README.md b/README.md
index 0d5a6b0..fd1fb9f 100644
--- a/README.md
+++ b/README.md
@@ -52,3 +52,17 @@
Then, wait until cloud-init is finished and port 22 is open (~3-4 minutes), and login with root:r00tme
+
+
+Additional info
+---------------
+
+Installation steps are placed in YAML files and executed in the following order:
+
+- Hardware (VMs) environment is created from tcp-qa/tcp_tests/templates/underlay/mk22-lab-advanced.yaml
+
+- Salt installation and configuration steps tcp-qa/tcp_tests/templates/salt/mk22-lab-advanced-salt.yaml
+
+- Common services installation steps tcp-qa/tcp_tests/templates/common-services/mk22-lab-advanced-common-services.yaml
+
+- OpenStack services installation steps tcp-qa/tcp_tests/templates/openstack/mk22-lab-advanced-openstack.yaml
diff --git a/tcp_tests/fixtures/tcp_fixtures.py b/tcp_tests/fixtures/common_services_fixtures.py
similarity index 71%
copy from tcp_tests/fixtures/tcp_fixtures.py
copy to tcp_tests/fixtures/common_services_fixtures.py
index 27b8a1f..4a4ee1d 100644
--- a/tcp_tests/fixtures/tcp_fixtures.py
+++ b/tcp_tests/fixtures/common_services_fixtures.py
@@ -13,18 +13,20 @@
# under the License.
import os
+
import pytest
+import yaml
from tcp_tests import logger
from tcp_tests.helpers import ext
from tcp_tests import settings
-from tcp_tests.managers import tcpmanager
+from tcp_tests.managers import common_services_manager
LOG = logger.logger
@pytest.fixture(scope='function')
-def tcp_actions(config, underlay):
+def common_services_actions(config, underlay):
"""Fixture that provides various actions for K8S
:param config: fixture provides oslo.config
@@ -33,12 +35,13 @@
For use in tests or fixtures to deploy a custom K8S
"""
- return tcpmanager.TCPManager(config, underlay)
+ return common_services_manager.CommonServicesManager(config, underlay)
@pytest.fixture(scope='function')
-def tcpcluster(revert_snapshot, request, config,
- hardware, underlay, tcp_actions):
+def common_services_deployed(revert_snapshot, request, config,
+ hardware, underlay, salt_deployed,
+ common_services_actions):
"""Fixture to get or install TCP on environment
:param request: fixture provides pytest data
@@ -65,15 +68,17 @@
# that belongs to the fixture.
# Note: keep fixtures in strict dependences from each other!
if not revert_snapshot:
- if hardware.has_snapshot(ext.SNAPSHOT.tcp_deployed) and \
- hardware.has_snapshot_config(ext.SNAPSHOT.tcp_deployed):
- hardware.revert_snapshot(ext.SNAPSHOT.tcp_deployed)
+ if hardware.has_snapshot(ext.SNAPSHOT.common_services_deployed) and \
+ hardware.has_snapshot_config(
+ ext.SNAPSHOT.common_services_deployed):
+ hardware.revert_snapshot(ext.SNAPSHOT.common_services_deployed)
- # Create TCP cluster
- if config.tcp.tcp_host == '0.0.0.0':
-
- tcp_actions.install_tcp()
- hardware.create_snapshot(ext.SNAPSHOT.tcp_deployed)
+ # Create Salt cluster
+ if not config.common_services.installed:
+ steps_path = config.common_services_deploy.common_services_steps_path
+ with underlay.yaml_editor(steps_path) as commands:
+ common_services_actions.install(commands.content)
+ hardware.create_snapshot(ext.SNAPSHOT.common_services_deployed)
else:
# 1. hardware environment created and powered on
@@ -83,4 +88,4 @@
# installed TCP API endpoint
pass
- return tcp_actions
+ return common_services_actions
diff --git a/tcp_tests/fixtures/config_fixtures.py b/tcp_tests/fixtures/config_fixtures.py
index ffcaea9..8a2aa27 100644
--- a/tcp_tests/fixtures/config_fixtures.py
+++ b/tcp_tests/fixtures/config_fixtures.py
@@ -20,7 +20,7 @@
@pytest.fixture(scope='session')
def config():
-
+ """Get the global config options from oslo.config INI file"""
config_files = []
tests_configs = os.environ.get('TESTS_CONFIGS', None)
diff --git a/tcp_tests/fixtures/tcp_fixtures.py b/tcp_tests/fixtures/openstack_fixtures.py
similarity index 73%
copy from tcp_tests/fixtures/tcp_fixtures.py
copy to tcp_tests/fixtures/openstack_fixtures.py
index 27b8a1f..48e9125 100644
--- a/tcp_tests/fixtures/tcp_fixtures.py
+++ b/tcp_tests/fixtures/openstack_fixtures.py
@@ -13,18 +13,20 @@
# under the License.
import os
+
import pytest
+import yaml
from tcp_tests import logger
from tcp_tests.helpers import ext
from tcp_tests import settings
-from tcp_tests.managers import tcpmanager
+from tcp_tests.managers import openstack_manager
LOG = logger.logger
@pytest.fixture(scope='function')
-def tcp_actions(config, underlay):
+def openstack_actions(config, underlay):
"""Fixture that provides various actions for K8S
:param config: fixture provides oslo.config
@@ -33,12 +35,13 @@
For use in tests or fixtures to deploy a custom K8S
"""
- return tcpmanager.TCPManager(config, underlay)
+ return openstack_manager.OpenstackManager(config, underlay)
@pytest.fixture(scope='function')
-def tcpcluster(revert_snapshot, request, config,
- hardware, underlay, tcp_actions):
+def openstack_deployed(revert_snapshot, request, config,
+ hardware, underlay, common_services_deployed,
+ openstack_actions):
"""Fixture to get or install TCP on environment
:param request: fixture provides pytest data
@@ -65,15 +68,16 @@
# that belongs to the fixture.
# Note: keep fixtures in strict dependences from each other!
if not revert_snapshot:
- if hardware.has_snapshot(ext.SNAPSHOT.tcp_deployed) and \
- hardware.has_snapshot_config(ext.SNAPSHOT.tcp_deployed):
- hardware.revert_snapshot(ext.SNAPSHOT.tcp_deployed)
+ if hardware.has_snapshot(ext.SNAPSHOT.openstack_deployed) and \
+ hardware.has_snapshot_config(ext.SNAPSHOT.openstack_deployed):
+ hardware.revert_snapshot(ext.SNAPSHOT.openstack_deployed)
- # Create TCP cluster
- if config.tcp.tcp_host == '0.0.0.0':
-
- tcp_actions.install_tcp()
- hardware.create_snapshot(ext.SNAPSHOT.tcp_deployed)
+ # Create Salt cluster
+ if not config.openstack.installed:
+ steps_path = config.openstack_deploy.openstack_steps_path
+ with underlay.yaml_editor(steps_path) as commands:
+ openstack_actions.install(commands.content)
+ hardware.create_snapshot(ext.SNAPSHOT.openstack_deployed)
else:
# 1. hardware environment created and powered on
@@ -83,4 +87,4 @@
# installed TCP API endpoint
pass
- return tcp_actions
+ return openstack_actions
diff --git a/tcp_tests/fixtures/tcp_fixtures.py b/tcp_tests/fixtures/salt_fixtures.py
similarity index 76%
rename from tcp_tests/fixtures/tcp_fixtures.py
rename to tcp_tests/fixtures/salt_fixtures.py
index 27b8a1f..e22b16f 100644
--- a/tcp_tests/fixtures/tcp_fixtures.py
+++ b/tcp_tests/fixtures/salt_fixtures.py
@@ -13,18 +13,20 @@
# under the License.
import os
+
import pytest
+import yaml
from tcp_tests import logger
from tcp_tests.helpers import ext
from tcp_tests import settings
-from tcp_tests.managers import tcpmanager
+from tcp_tests.managers import saltmanager
LOG = logger.logger
@pytest.fixture(scope='function')
-def tcp_actions(config, underlay):
+def salt_actions(config, underlay):
"""Fixture that provides various actions for K8S
:param config: fixture provides oslo.config
@@ -33,12 +35,12 @@
For use in tests or fixtures to deploy a custom K8S
"""
- return tcpmanager.TCPManager(config, underlay)
+ return saltmanager.SaltManager(config, underlay)
@pytest.fixture(scope='function')
-def tcpcluster(revert_snapshot, request, config,
- hardware, underlay, tcp_actions):
+def salt_deployed(revert_snapshot, request, config,
+ hardware, underlay, salt_actions):
"""Fixture to get or install TCP on environment
:param request: fixture provides pytest data
@@ -65,15 +67,16 @@
# that belongs to the fixture.
# Note: keep fixtures in strict dependences from each other!
if not revert_snapshot:
- if hardware.has_snapshot(ext.SNAPSHOT.tcp_deployed) and \
- hardware.has_snapshot_config(ext.SNAPSHOT.tcp_deployed):
- hardware.revert_snapshot(ext.SNAPSHOT.tcp_deployed)
+ if hardware.has_snapshot(ext.SNAPSHOT.salt_deployed) and \
+ hardware.has_snapshot_config(ext.SNAPSHOT.salt_deployed):
+ hardware.revert_snapshot(ext.SNAPSHOT.salt_deployed)
- # Create TCP cluster
- if config.tcp.tcp_host == '0.0.0.0':
-
- tcp_actions.install_tcp()
- hardware.create_snapshot(ext.SNAPSHOT.tcp_deployed)
+ # Create Salt cluster
+ if config.salt.salt_master_host == '0.0.0.0':
+ with underlay.yaml_editor(
+ config.salt_deploy.salt_steps_path) as commands:
+ salt_actions.install(commands.content)
+ hardware.create_snapshot(ext.SNAPSHOT.salt_deployed)
else:
# 1. hardware environment created and powered on
@@ -83,4 +86,4 @@
# installed TCP API endpoint
pass
- return tcp_actions
+ return salt_actions
diff --git a/tcp_tests/helpers/ext.py b/tcp_tests/helpers/ext.py
index 5369535..9147fb8 100644
--- a/tcp_tests/helpers/ext.py
+++ b/tcp_tests/helpers/ext.py
@@ -36,8 +36,9 @@
SNAPSHOT = enum(
'hardware',
'underlay',
- 'tcp_deployed',
- 'os_deployed',
+ 'salt_deployed',
+ 'common_services_deployed',
+ 'openstack_deployed',
)
LOG_LEVELS = enum(
diff --git a/tcp_tests/managers/common_services_manager.py b/tcp_tests/managers/common_services_manager.py
new file mode 100644
index 0000000..add159f
--- /dev/null
+++ b/tcp_tests/managers/common_services_manager.py
@@ -0,0 +1,28 @@
+# Copyright 2016 Mirantis, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+class CommonServicesManager(object):
+ """docstring for CommonServicesManager"""
+
+ __config = None
+ __underlay = None
+
+ def __init__(self, config, underlay):
+ self.__config = config
+ self.__underlay = underlay
+ super(CommonServicesManager, self).__init__()
+
+ def install(self, commands):
+ self.__underlay.execute_commands(commands)
+ self.__config.common_services.installed = True
diff --git a/tcp_tests/managers/openstack_manager.py b/tcp_tests/managers/openstack_manager.py
new file mode 100644
index 0000000..9727ac4
--- /dev/null
+++ b/tcp_tests/managers/openstack_manager.py
@@ -0,0 +1,28 @@
+# Copyright 2016 Mirantis, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+class OpenstackManager(object):
+ """docstring for OpenstackManager"""
+
+ __config = None
+ __underlay = None
+
+ def __init__(self, config, underlay):
+ self.__config = config
+ self.__underlay = underlay
+ super(OpenstackManager, self).__init__()
+
+ def install(self, commands):
+ self.__underlay.execute_commands(commands)
+ self.__config.openstack.installed = True
diff --git a/tcp_tests/managers/saltmanager.py b/tcp_tests/managers/saltmanager.py
new file mode 100644
index 0000000..2e539bc
--- /dev/null
+++ b/tcp_tests/managers/saltmanager.py
@@ -0,0 +1,35 @@
+# Copyright 2016 Mirantis, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+class SaltManager(object):
+ """docstring for SaltManager"""
+
+ __config = None
+ __underlay = None
+
+ def __init__(self, config, underlay):
+ self.__config = config
+ self.__underlay = underlay
+
+
+ super(SaltManager, self).__init__()
+
+ def install(self, commands):
+ if self.__config.salt.salt_master_host == '0.0.0.0':
+ # Temporary workaround. Underlay should be extended with roles
+ salt_nodes = self.__underlay.node_names()
+ self.__config.salt.salt_master_host = \
+ self.__underlay.host_by_node_name(salt_nodes[0])
+
+ self.__underlay.execute_commands(commands)
diff --git a/tcp_tests/managers/tcpmanager.py b/tcp_tests/managers/tcpmanager.py
deleted file mode 100644
index c71bf89..0000000
--- a/tcp_tests/managers/tcpmanager.py
+++ /dev/null
@@ -1,71 +0,0 @@
-# Copyright 2016 Mirantis, Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-import copy
-import os
-
-import yaml
-
-from devops.helpers import helpers
-
-from tcp_tests.helpers import exceptions
-from tcp_tests import logger
-from tcp_tests import settings
-
-LOG = logger.logger
-
-
-class TCPManager(object):
- """docstring for TCPManager"""
-
- __config = None
- __underlay = None
-
- def __init__(self, config, underlay):
- self.__config = config
- self.__underlay = underlay
- self._api_client = None
-
- if self.__config.tcp.tcp_host == '0.0.0.0':
- # Temporary workaround. Underlay should be extended with roles
- tcp_nodes = self.__underlay.node_names()
- self.__config.tcp.tcp_host = \
- self.__underlay.host_by_node_name(tcp_nodes[0])
-
- super(TCPManager, self).__init__()
-
- def show_tcp_config(self):
- cmd = 'reclass -n {0}'.format(self.__underlay.node_names()[0])
- self.__underlay.sudo_check_call(cmd, host=self.__config.tcp.tcp_host,
- verbose=True)
-
- def install_tcp(self):
- raise Exception("Not implemented!")
-
- def check_salt_service(self, service_name, node_name, check_cmd,
- state_running='start/running'):
- cmd = "service {0} status | grep -q '{1}'".format(
- service_name, state_running)
- with self.__underlay.remote(node_name=node_name) as remote:
- result = remote.execute(cmd)
- if result.exit_code != 0:
- LOG.info("{0} is not in running state on the node {1},"
- " restarting".format(service_name, node_name))
- cmd = ("service {0} stop;"
- " sleep 3; killall -9 {0};"
- "service {0} start; sleep 5;"
- .format(service_name))
- remote.execute(cmd)
-
- remote.execute(check_cmd)
- remote.execute(check_cmd)
diff --git a/tcp_tests/managers/underlay_ssh_manager.py b/tcp_tests/managers/underlay_ssh_manager.py
index 578768a..90f3924 100644
--- a/tcp_tests/managers/underlay_ssh_manager.py
+++ b/tcp_tests/managers/underlay_ssh_manager.py
@@ -13,6 +13,7 @@
# under the License.
import random
+import time
from devops.helpers import helpers
from devops.helpers import ssh_client
@@ -363,3 +364,66 @@
username=ssh_data['login'],
password=ssh_data['password'],
private_keys=ssh_data['keys'])
+
+ def ensure_running_service(self, service_name, node_name, check_cmd,
+ state_running='start/running'):
+ cmd = "service {0} status | grep -q '{1}'".format(
+ service_name, state_running)
+ with self.remote(node_name=node_name) as remote:
+ result = remote.execute(cmd)
+ if result.exit_code != 0:
+ LOG.info("{0} is not in running state on the node {1},"
+ " restarting".format(service_name, node_name))
+ cmd = ("service {0} stop;"
+ " sleep 3; killall -9 {0};"
+ "service {0} start; sleep 5;"
+ .format(service_name))
+ remote.execute(cmd)
+
+ remote.execute(check_cmd)
+ remote.execute(check_cmd)
+
+ def execute_commands(self, commands):
+ for n, step in enumerate(commands):
+ LOG.info(" ####################################################")
+ LOG.info(" *** [ Command #{0} ] {1} ***"
+ .format(n+1, step['description']))
+
+ with self.remote(node_name=step['node_name']) as remote:
+ for x in range(step['retry']['count'], 0, -1):
+ time.sleep(3)
+ result = remote.execute(step['cmd'], verbose=True)
+
+ # Workaround of exit code 0 from salt in case of failures
+ failed = 0
+ for s in result['stdout']:
+ if s.startswith("Failed:"):
+ failed += int(s.split("Failed:")[1])
+
+ if result.exit_code != 0:
+ time.sleep(step['retry']['delay'])
+ LOG.info(" === RETRY ({0}/{1}) ========================="
+ .format(x-1, step['retry']['count']))
+ elif failed != 0:
+ LOG.error(" === SALT returned exit code = 0 while "
+ "there are failed modules! ===")
+ LOG.info(" === RETRY ({0}/{1}) ======================="
+ .format(x-1, step['retry']['count']))
+ else:
+ # Workarounds for crashed services
+ self.ensure_running_service(
+ "salt-master",
+ "cfg01.mk22-lab-advanced.local",
+ "salt-call pillar.items",
+ 'active (running)') # Hardcoded for now
+ self.ensure_running_service(
+ "salt-minion",
+ "cfg01.mk22-lab-advanced.local",
+ "salt 'cfg01*' pillar.items",
+ "active (running)") # Hardcoded for now
+ break
+
+ if x == 1 and step['skip_fail'] == False:
+ # In the last retry iteration, raise an exception
+ raise Exception("Step '{0}' failed"
+ .format(step['description']))
diff --git a/tcp_tests/templates/common-services/mk22-lab-advanced-common-services.yaml b/tcp_tests/templates/common-services/mk22-lab-advanced-common-services.yaml
new file mode 100644
index 0000000..1460405
--- /dev/null
+++ b/tcp_tests/templates/common-services/mk22-lab-advanced-common-services.yaml
@@ -0,0 +1,96 @@
+# Install support services
+- description: Install keepalived on primary controller
+ cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' state.sls
+ keepalived
+ node_name: cfg01.mk22-lab-advanced.local
+ retry: {count: 3, delay: 5}
+ skip_fail: false
+- description: Install keepalived on other controllers
+ cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl*' state.sls
+ keepalived -b 1
+ node_name: cfg01.mk22-lab-advanced.local
+ retry: {count: 3, delay: 5}
+ skip_fail: false
+- description: Check the VIP
+ cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl*' cmd.run
+ 'ip a | grep 172.16.10.254' | grep -B1 172.16.10.254
+ node_name: cfg01.mk22-lab-advanced.local
+ retry: {count: 3, delay: 5}
+ skip_fail: false
+- description: Install glusterfs on all controllers
+ cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl*' state.sls
+ glusterfs.server.service
+ node_name: cfg01.mk22-lab-advanced.local
+ retry: {count: 3, delay: 5}
+ skip_fail: false
+- description: Setup glusterfs on primary controller
+ cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' state.sls
+ glusterfs.server.setup
+ node_name: cfg01.mk22-lab-advanced.local
+ retry: {count: 3, delay: 5}
+ skip_fail: false
+- description: Setup glusterfs on other controllers
+ cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl*' state.sls
+ glusterfs.server.setup -b 1
+ node_name: cfg01.mk22-lab-advanced.local
+ retry: {count: 3, delay: 5}
+ skip_fail: false
+- description: Check the gluster status
+ cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
+ 'gluster peer status; gluster volume status'
+ node_name: cfg01.mk22-lab-advanced.local
+ retry: {count: 3, delay: 5}
+ skip_fail: false
+- description: Install RabbitMQ on all controllers
+ cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl*' state.sls
+ rabbitmq
+ node_name: cfg01.mk22-lab-advanced.local
+ retry: {count: 3, delay: 5}
+ skip_fail: false
+- description: Check the rabbitmq status
+ cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl*' cmd.run
+ 'rabbitmqctl cluster_status'
+ node_name: cfg01.mk22-lab-advanced.local
+ retry: {count: 3, delay: 5}
+ skip_fail: false
+- description: '*Workaround* Update salt-formula-galera on config node to the latest
+ version'
+ cmd: apt-get -y --force-yes install salt-formula-galera
+ node_name: cfg01.mk22-lab-advanced.local
+ retry: {count: 3, delay: 5}
+ skip_fail: false
+- description: Install Galera on primary controller
+ cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' state.sls
+ galera
+ node_name: cfg01.mk22-lab-advanced.local
+ retry: {count: 3, delay: 5}
+ skip_fail: false
+- description: Install Galera on other controllers
+ cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl*' state.sls
+ galera
+ node_name: cfg01.mk22-lab-advanced.local
+ retry: {count: 3, delay: 5}
+ skip_fail: false
+- description: Check mysql status
+ cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl*' mysql.status
+ node_name: cfg01.mk22-lab-advanced.local
+ retry: {count: 3, delay: 5}
+ skip_fail: true
+- description: Install haproxy on all controllers
+ cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl*' state.sls
+ haproxy
+ node_name: cfg01.mk22-lab-advanced.local
+ retry: {count: 3, delay: 5}
+ skip_fail: false
+- description: Check haproxy status
+ cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl*' service.status
+ haproxy
+ node_name: cfg01.mk22-lab-advanced.local
+ retry: {count: 3, delay: 5}
+ skip_fail: false
+- description: Install memcached on all controllers
+ cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl*' state.sls
+ memcached
+ node_name: cfg01.mk22-lab-advanced.local
+ retry: {count: 3, delay: 5}
+ skip_fail: false
diff --git a/tcp_tests/templates/openstack/mk22-lab-advanced-openstack.yaml b/tcp_tests/templates/openstack/mk22-lab-advanced-openstack.yaml
new file mode 100644
index 0000000..bdb7006
--- /dev/null
+++ b/tcp_tests/templates/openstack/mk22-lab-advanced-openstack.yaml
@@ -0,0 +1,201 @@
+# Install OpenStack control services
+- description: Install keystone on primary controller
+ cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' state.sls
+ keystone
+ node_name: cfg01.mk22-lab-advanced.local
+ retry: {count: 3, delay: 5}
+ skip_fail: false
+- description: Install keystone on all controllers
+ cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl*' state.sls
+ keystone -b 1
+ node_name: cfg01.mk22-lab-advanced.local
+ retry: {count: 3, delay: 5}
+ skip_fail: false
+- description: Populate keystone services/tenants/admins
+ cmd: salt-call --hard-crash --state-output=mixed --state-verbose=False state.sls
+ keystone.client
+ node_name: cfg01.mk22-lab-advanced.local
+ retry: {count: 3, delay: 5}
+ skip_fail: false
+- description: Check keystone service-list
+ cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
+ '. /root/keystonerc; keystone service-list'
+ node_name: cfg01.mk22-lab-advanced.local
+ retry: {count: 3, delay: 5}
+ skip_fail: false
+- description: Install glance on primary controller
+ cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' state.sls
+ glance
+ node_name: cfg01.mk22-lab-advanced.local
+ retry: {count: 3, delay: 5}
+ skip_fail: false
+- description: Install glance on all controllers
+ cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl*' state.sls
+ glance -b 1
+ node_name: cfg01.mk22-lab-advanced.local
+ retry: {count: 3, delay: 5}
+ skip_fail: false
+- description: Configure glusterfs.client on all controllers
+ cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl*' state.sls
+ glusterfs.client
+ node_name: cfg01.mk22-lab-advanced.local
+ retry: {count: 3, delay: 5}
+ skip_fail: false
+- description: Configure(re-install) keystone on all controllers
+ cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl*' state.sls
+ keystone -b 1
+ node_name: cfg01.mk22-lab-advanced.local
+ retry: {count: 3, delay: 5}
+ skip_fail: false
+- description: Check glance image-list
+ cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
+ '. /root/keystonerc; glance image-list'
+ node_name: cfg01.mk22-lab-advanced.local
+ retry: {count: 3, delay: 5}
+ skip_fail: false
+- description: Install cinder on all controllers
+ cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl*' state.sls
+ cinder -b 1
+ node_name: cfg01.mk22-lab-advanced.local
+ retry: {count: 3, delay: 5}
+ skip_fail: false
+- description: Check cinder list
+ cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
+ '. /root/keystonerc; cinder list'
+ node_name: cfg01.mk22-lab-advanced.local
+ retry: {count: 3, delay: 5}
+ skip_fail: false
+- description: Install nova on ctl01
+ cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' state.sls
+ nova
+ node_name: cfg01.mk22-lab-advanced.local
+ retry: {count: 3, delay: 5}
+ skip_fail: false
+- description: Install nova on all controllers
+ cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl*' state.sls
+ nova
+ node_name: cfg01.mk22-lab-advanced.local
+ retry: {count: 3, delay: 5}
+ skip_fail: false
+- description: Check nova service-list
+ cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
+ '. /root/keystonerc; nova service-list'
+ node_name: cfg01.mk22-lab-advanced.local
+ retry: {count: 3, delay: 5}
+ skip_fail: false
+- description: Install neutron on ctl01
+ cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' state.sls
+ neutron
+ node_name: cfg01.mk22-lab-advanced.local
+ retry: {count: 3, delay: 5}
+ skip_fail: false
+- description: Install neutron on all controllers
+ cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl*' state.sls
+ neutron
+ node_name: cfg01.mk22-lab-advanced.local
+ retry: {count: 3, delay: 5}
+ skip_fail: false
+- description: Check neutron agent-list
+ cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
+ '. /root/keystonerc; neutron agent-list'
+ node_name: cfg01.mk22-lab-advanced.local
+ retry: {count: 3, delay: 5}
+ skip_fail: false
+- description: Deploy dashboard on prx*
+ cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'prx*' state.apply
+ node_name: cfg01.mk22-lab-advanced.local
+ retry: {count: 3, delay: 5}
+ skip_fail: true
+- description: Deploy nginx proxy
+ cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'cfg*' state.sls
+ nginx
+ node_name: cfg01.mk22-lab-advanced.local
+ retry: {count: 3, delay: 5}
+ skip_fail: true
+
+# Install contrail on controllers
+- description: Install contrail database on controllers
+ cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl*' state.sls
+ opencontrail.database -b 1
+ node_name: cfg01.mk22-lab-advanced.local
+ retry: {count: 3, delay: 5}
+ skip_fail: false
+- description: Check cassandra status on ctl01
+ cmd: salt 'ctl01*' cmd.run 'nodetool status;nodetool compactionstats;nodetool describecluster;'
+ node_name: cfg01.mk22-lab-advanced.local
+ retry: {count: 3, delay: 5}
+ skip_fail: false
+- description: Install contrail database on controllers
+ cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl*' state.sls
+ opencontrail -b 1
+ node_name: cfg01.mk22-lab-advanced.local
+ retry: {count: 3, delay: 5}
+ skip_fail: false
+- description: Check contrail status
+ cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
+ '. /root/keystonerc; contrail-status; neutron net-list; nova net-list'
+ node_name: cfg01.mk22-lab-advanced.local
+ retry: {count: 3, delay: 5}
+ skip_fail: false
+- description: Add contrail bgp router on ctl01
+ cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
+ '/usr/share/contrail-utils/provision_control.py --oper add --api_server_ip 172.16.10.254
+ --api_server_port 8082 --host_name ctl01 --host_ip 172.16.10.101 --router_asn
+ 64512 --admin_user admin --admin_password workshop --admin_tenant_name admin'
+ node_name: cfg01.mk22-lab-advanced.local
+ retry: {count: 3, delay: 5}
+ skip_fail: false
+- description: Add contrail bgp router on ctl02
+ cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl02*' cmd.run
+ '/usr/share/contrail-utils/provision_control.py --oper add --api_server_ip 172.16.10.254
+ --api_server_port 8082 --host_name ctl02 --host_ip 172.16.10.102 --router_asn
+ 64512 --admin_user admin --admin_password workshop --admin_tenant_name admin'
+ node_name: cfg01.mk22-lab-advanced.local
+ retry: {count: 3, delay: 5}
+ skip_fail: false
+- description: Add contrail bgp router on ctl03
+ cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl03*' cmd.run
+ '/usr/share/contrail-utils/provision_control.py --oper add --api_server_ip 172.16.10.254
+ --api_server_port 8082 --host_name ctl03 --host_ip 172.16.10.103 --router_asn
+ 64512 --admin_user admin --admin_password workshop --admin_tenant_name admin'
+ node_name: cfg01.mk22-lab-advanced.local
+ retry: {count: 3, delay: 5}
+ skip_fail: false
+
+
+# Install compute node
+- description: Apply formulas for compute node
+ cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'cmp*' state.apply
+ node_name: cfg01.mk22-lab-advanced.local
+ retry: {count: 3, delay: 5}
+ skip_fail: false
+- description: Re-apply(as in doc) formulas for compute node
+ cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'cmp*' state.apply
+ node_name: cfg01.mk22-lab-advanced.local
+ retry: {count: 3, delay: 5}
+ skip_fail: false
+- description: Add vrouter for cmp01
+ cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
+ '/usr/share/contrail-utils/provision_vrouter.py --oper add --host_name cmp01 --host_ip
+ 172.16.10.105 --api_server_ip 172.16.10.254 --api_server_port 8082 --admin_user
+ admin --admin_password workshop --admin_tenant_name admin'
+ node_name: cfg01.mk22-lab-advanced.local
+ retry: {count: 3, delay: 5}
+ skip_fail: false
+- description: Reboot compute nodes
+ cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'cmp*' system.reboot
+ node_name: cfg01.mk22-lab-advanced.local
+ retry: {count: 3, delay: 5}
+ skip_fail: false
+- description: Check IP on computes
+ cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'cmp*' cmd.run
+ 'ip a'
+ node_name: cfg01.mk22-lab-advanced.local
+ retry: {count: 3, delay: 5}
+ skip_fail: false
+- description: Check contrail status on computes
+ cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'cmp*' cmd.run
+ 'contrail-status'
+ node_name: cfg01.mk22-lab-advanced.local
+ retry: {count: 3, delay: 5}
+ skip_fail: false
diff --git a/tcp_tests/templates/salt/mk22-lab-advanced-salt.yaml b/tcp_tests/templates/salt/mk22-lab-advanced-salt.yaml
new file mode 100644
index 0000000..707cef2
--- /dev/null
+++ b/tcp_tests/templates/salt/mk22-lab-advanced-salt.yaml
@@ -0,0 +1,232 @@
+# Install salt to the config node
+- description: Configure tcpcloud repository on the cfg01 node
+ cmd: echo 'deb [arch=amd64] http://apt.tcpcloud.eu/nightly/ xenial main security extra tcp tcp-salt' > /etc/apt/sources.list;
+ echo 'deb [arch=amd64] http://apt.tcpcloud.eu/nightly/ trusty tcp-salt' >> /etc/apt/sources.list;
+ wget -O - http://apt.tcpcloud.eu/public.gpg | apt-key add -
+ node_name: cfg01.mk22-lab-advanced.local
+ retry: {count: 1, delay: 1}
+ skip_fail: false
+
+#- description: Configure tcpcloud and saltstack repositories on the rest of nodes
+# cmd: echo 'deb [arch=amd64] http://apt.tcpcloud.eu/nightly/ trusty main security extra tcp tcp-salt' > /etc/apt/sources.list;
+# wget -O - http://apt.tcpcloud.eu/public.gpg | apt-key add - ;
+# echo 'deb http://repo.saltstack.com/apt/ubuntu/14.04/amd64/latest trusty main' > /etc/apt/sources.list.d/saltstack.list;
+# wget -O - https://repo.saltstack.com/apt/ubuntu/14.04/amd64/latest/SALTSTACK-GPG-KEY.pub | apt-key add -
+# node_name: ***
+# retry: {count: 1, delay: 1}
+# skip_fail: false
+
+- description: Update packages on cfg01
+ cmd: apt-get clean; apt-get update && apt-get -y upgrade
+ node_name: cfg01.mk22-lab-advanced.local
+ retry: {count: 3, delay: 10}
+ skip_fail: false
+
+- description: Install common packages on cfg01
+ cmd: apt-get install -y python-pip wget curl tmux byobu iputils-ping traceroute htop tree
+ node_name: cfg01.mk22-lab-advanced.local
+ retry: {count: 3, delay: 10}
+ skip_fail: false
+
+- description: Install salt formulas, master and minion on cfg01
+ cmd: apt-get install -y salt-formula-* salt-master salt-minion reclass
+ node_name: cfg01.mk22-lab-advanced.local
+ retry: {count: 3, delay: 10}
+ skip_fail: false
+
+- description: Configure salt-master on cfg01
+ cmd: |
+ cat << 'EOF' >> /etc/salt/master.d/master.conf
+ file_roots:
+ base:
+ - /usr/share/salt-formulas/env
+ pillar_opts: False
+ open_mode: True
+ reclass: &reclass
+ storage_type: yaml_fs
+ inventory_base_uri: /srv/salt/reclass
+ ext_pillar:
+ - reclass: *reclass
+ master_tops:
+ reclass: *reclass
+ EOF
+ node_name: cfg01.mk22-lab-advanced.local
+ retry: {count: 1, delay: 1}
+ skip_fail: false
+
+- description: Configure GIT settings and certificates
+ cmd: touch /root/.git_trusted_certs.pem;
+ for server in git.tcpcloud.eu github.com; do
+ openssl s_client -showcerts -connect $server:443 </dev/null
+ | openssl x509 -outform PEM
+ >> /root/.git_trusted_certs.pem;
+ done;
+ HOME=/root git config --global http.sslCAInfo /root/.git_trusted_certs.pem;
+ HOME=/root git config --global user.email "tcp-qa@example.com";
+ HOME=/root git config --global user.name "TCP QA";
+ node_name: cfg01.mk22-lab-advanced.local
+ retry: {count: 1, delay: 1}
+ skip_fail: false
+
+- description: Clone reclass models and perform a workaround for https://mirantis.jira.com/browse/PROD-8078
+ cmd: |
+ #git clone https://github.com/Mirantis/mk-lab-salt-model.git /srv/salt/reclass -b dash;
+ git clone https://github.com/dis-xcom/mk-lab-salt-model.git /srv/salt/reclass -b dash;
+ cat << 'EOF' >> /srv/salt/reclass/nodes/control/cfg01.mk22-lab-advanced.local.yml
+ # local storage
+ reclass:
+ storage:
+ data_source:
+ engine: local
+ EOF
+ sed -i '/nagios/d' /srv/salt/reclass/classes/system/salt/master/formula/pkg/stacklight.yml
+ cd /srv/salt/reclass; git add -A;git commit -m"use dash repo";
+ node_name: cfg01.mk22-lab-advanced.local
+ retry: {count: 1, delay: 1}
+ skip_fail: false
+
+- description: Configure reclass
+ cmd: |
+ mkdir -p /srv/salt/reclass/classes/service;
+ for i in /usr/share/salt-formulas/reclass/service/*; do
+ ln -s $i /srv/salt/reclass/classes/service/;
+ done;
+ [ ! -d /etc/reclass ] && mkdir /etc/reclass;
+ cat << 'EOF' >> /etc/reclass/reclass-config.yml
+ storage_type: yaml_fs
+ pretty_print: True
+ output: yaml
+ inventory_base_uri: /srv/salt/reclass
+ EOF
+ node_name: cfg01.mk22-lab-advanced.local
+ retry: {count: 1, delay: 1}
+ skip_fail: false
+
+- description: Configure salt-minion on cfg01
+ cmd: |
+ [ ! -d /etc/salt/minion.d ] && mkdir -p /etc/salt/minion.d;
+ cat << "EOF" >> /etc/salt/minion.d/minion.conf
+ id: cfg01.mk22-lab-advanced.local
+ master: localhost
+ EOF
+ node_name: cfg01.mk22-lab-advanced.local
+ retry: {count: 1, delay: 1}
+ skip_fail: false
+
+- description: Restarting salt services with workarounds
+ cmd: service salt-master restart;
+ sleep 60;
+ rm -f /etc/salt/pki/minion/minion_master.pub;
+ service salt-minion restart;
+ reclass -n cfg01.mk22-lab-advanced.local;
+ node_name: cfg01.mk22-lab-advanced.local
+ retry: {count: 3, delay: 10}
+ skip_fail: false
+
+
+# Prepare salt services and nodes settings
+- description: Run 'linux' formula on cfg01
+ cmd: salt-call --hard-crash --state-output=mixed --state-verbose=False state.sls
+ linux
+ node_name: cfg01.mk22-lab-advanced.local
+ retry: {count: 3, delay: 5}
+ skip_fail: false
+
+- description: Run 'openssh' formula on cfg01
+ cmd: salt-call --hard-crash --state-output=mixed --state-verbose=False state.sls
+ openssh;sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config
+ && service ssh restart
+ node_name: cfg01.mk22-lab-advanced.local
+ retry: {count: 3, delay: 5}
+ skip_fail: false
+
+- description: '*Workaround* of the bug https://mirantis.jira.com/browse/PROD-7962'
+ cmd: echo ' StrictHostKeyChecking no' >> /root/.ssh/config
+ node_name: cfg01.mk22-lab-advanced.local
+ retry: {count: 1, delay: 1}
+ skip_fail: false
+
+- description: Run 'salt' formula on cfg01
+ cmd: salt-call --hard-crash --state-output=mixed --state-verbose=False state.sls
+ salt
+ node_name: cfg01.mk22-lab-advanced.local
+ retry: {count: 3, delay: 5}
+ skip_fail: true
+
+- description: Accept salt keys from all the nodes
+ cmd: salt-key -A -y
+ node_name: cfg01.mk22-lab-advanced.local
+ retry: {count: 1, delay: 5}
+ skip_fail: false
+
+- description: Generate inventory for all the nodes to the /srv/salt/reclass/nodes/_generated
+ cmd: salt-call --hard-crash --state-output=mixed --state-verbose=False state.sls
+ reclass.storage
+ node_name: cfg01.mk22-lab-advanced.local
+ retry: {count: 3, delay: 5}
+ skip_fail: false
+
+- description: Refresh pillars on all minions
+ cmd: salt --hard-crash --state-output=mixed --state-verbose=False '*' saltutil.refresh_pillar
+ node_name: cfg01.mk22-lab-advanced.local
+ retry: {count: 3, delay: 5}
+ skip_fail: false
+
+# Bootstrap all nodes
+- description: Configure linux on controllers
+ cmd: salt --hard-crash --state-output=mixed --state-verbose=False '*' state.sls
+ linux
+ node_name: cfg01.mk22-lab-advanced.local
+ retry: {count: 5, delay: 5}
+ skip_fail: false
+
+- description: Configure openssh on controllers
+ cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C '* and not
+ cfg*' state.sls openssh;salt --hard-crash --state-output=mixed --state-verbose=False
+ -C '* and not cfg*' cmd.run "sed -i 's/PasswordAuthentication no/PasswordAuthentication
+ yes/' /etc/ssh/sshd_config && service ssh restart"
+ node_name: cfg01.mk22-lab-advanced.local
+ retry: {count: 3, delay: 5}
+ skip_fail: false
+
+- description: '*Workaround* for the bug https://mirantis.jira.com/browse/PROD-8025'
+ cmd: salt --hard-crash --state-output=mixed --state-verbose=False '*' cmd.run 'apt-get
+ update && apt-get -y upgrade'
+ node_name: cfg01.mk22-lab-advanced.local
+ retry: {count: 3, delay: 5}
+ skip_fail: false
+
+- description: '*Workaround* for the bug https://mirantis.jira.com/browse/PROD-8021'
+ cmd: salt --hard-crash --state-output=mixed --state-verbose=False '*' cmd.run 'apt-get
+ -y install linux-image-extra-$(uname -r)'
+ node_name: cfg01.mk22-lab-advanced.local
+ retry: {count: 3, delay: 5}
+ skip_fail: false
+
+- description: '*Workaround* for the bug https://mirantis.jira.com/browse/PROD-8025'
+ cmd: salt --hard-crash --state-output=mixed --state-verbose=False '*' cmd.run 'apt-get
+ -y install python-requests'
+ node_name: cfg01.mk22-lab-advanced.local
+ retry: {count: 3, delay: 5}
+ skip_fail: false
+
+- description: '*Workaround* of the bug https://mirantis.jira.com/browse/PROD-8063'
+ cmd: salt --hard-crash --state-output=mixed --state-verbose=False '*' cmd.run 'dhclient
+ -r;dhclient'
+ node_name: cfg01.mk22-lab-advanced.local
+ retry: {count: 1, delay: 1}
+ skip_fail: false
+
+- description: Configure salt.minion on controllers
+ cmd: salt --hard-crash --state-output=mixed --state-verbose=False '*' state.sls
+ salt.minion
+ node_name: cfg01.mk22-lab-advanced.local
+ retry: {count: 3, delay: 5}
+ skip_fail: false
+
+- description: Configure ntp on controllers
+ cmd: salt --hard-crash --state-output=mixed --state-verbose=False '*' state.sls
+ ntp
+ node_name: cfg01.mk22-lab-advanced.local
+ retry: {count: 5, delay: 10}
+ skip_fail: false
diff --git a/tcp_tests/templates/tcpcloud--user-data-master-node.yaml b/tcp_tests/templates/tcpcloud--user-data-master-node.yaml
deleted file mode 100644
index fa24840..0000000
--- a/tcp_tests/templates/tcpcloud--user-data-master-node.yaml
+++ /dev/null
@@ -1,183 +0,0 @@
-| # All the data below will be stored as a string object
- #cloud-config, see http://cloudinit.readthedocs.io/en/latest/topics/examples.html
-
- ssh_pwauth: True
- users:
- - name: root
- sudo: ALL=(ALL) NOPASSWD:ALL
- shell: /bin/bash
- ssh_authorized_keys:
- - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDGwjUlYn9UsmWmAGSuEA2sICad7WqxgsJR0HKcMbbxi0tn96h4Cq2iGYmzlJ48egLm5R5pxyWnFvL4b/2zb+kKTPCMwRc9nv7xEGosEFNQEoSDd+gYu2CO0dgS2bX/7m2DXmzvhqPjxWQUXXsb0OYAS1r9Es65FE8y4rLaegz8V35xfH45bTCA0W8VSKh264XtGz12hacqsttE/UvyjJTZe+/XV+xJy3WAWxe8J/MuW1VqbqNewTmpTE/LJU8i6pG4msU6+wH99UvsGAOKQOduynUHKWG3VZg5YCjpbbV/t/pfW/vHB3b3jiifQmNhulyiG/CNnSQ5BahtV/7qPsYt vagrant@cfg01
-
- disable_root: false
- chpasswd:
- list: |
- root:r00tme
- expire: False
-
- bootcmd:
- # Block access to SSH while node is preparing
- - cloud-init-per once sudo iptables -A INPUT -p tcp --dport 22 -j DROP
- # Enable root access
- - sed -i -e '/^PermitRootLogin/s/^.*$/PermitRootLogin yes/' /etc/ssh/sshd_config
- - service sshd restart
- output:
- all: '| tee -a /var/log/cloud-init-output.log /dev/tty0'
-
- runcmd:
- # Configure dhclient
- - sudo echo "nameserver {gateway}" >> /etc/resolvconf/resolv.conf.d/base
- - sudo resolvconf -u
-
- # Prepare network connection
- - sudo ifup {interface_name}
- - sudo route add default gw {gateway} {interface_name}
- - sudo ifup eth1
-
- ############## TCP Cloud cfg01 node ##################
- - echo "Preparing base OS"
- - which wget >/dev/null || (apt-get update; apt-get install -y wget)
-
- - echo "deb [arch=amd64] http://apt.tcpcloud.eu/nightly/ xenial main security extra tcp tcp-salt" > /etc/apt/sources.list
- # 'tcp-salt' from trusty is for temporary workaround until formulas will be fixed in xenial
- - echo "deb [arch=amd64] http://apt.tcpcloud.eu/nightly/ trusty tcp-salt" >> /etc/apt/sources.list
- - wget -O - http://apt.tcpcloud.eu/public.gpg | apt-key add -
-
- - apt-get clean
- - apt-get update
- - apt-get -y upgrade
-
- # Install common packages
- - apt-get install -y python-pip
- - apt-get install -y curl tmux byobu iputils-ping traceroute htop tree
-
- - echo "Configuring salt master ..."
- - apt-get install -y salt-master reclass
- - apt-get install -y salt-formula-*
-
- - |
- cat << 'EOF' >> /etc/salt/master.d/master.conf
- file_roots:
- base:
- - /usr/share/salt-formulas/env
- pillar_opts: False
- open_mode: True
- reclass: &reclass
- storage_type: yaml_fs
- inventory_base_uri: /srv/salt/reclass
- ext_pillar:
- - reclass: *reclass
- master_tops:
- reclass: *reclass
- EOF
-
- - echo "Configure git settings and certificate"
- - touch /root/.git_trusted_certs.pem
- - for server in git.tcpcloud.eu github.com; do openssl s_client -showcerts -connect $server:443 </dev/null | openssl x509 -outform PEM >> /root/.git_trusted_certs.pem; done
- - HOME=/root git config --global http.sslCAInfo /root/.git_trusted_certs.pem
- - HOME=/root git config --global user.email "tcp-qa@example.com"
- - HOME=/root git config --global user.name "TCP QA"
-
- - echo "Configuring reclass ..."
- - git clone https://github.com/Mirantis/mk-lab-salt-model.git /srv/salt/reclass -b dash
- - sed -i 's/ master/ dash/' /srv/salt/reclass/classes/cluster/mk20_lab_advanced/openstack_config.yml
- - |
- cat << 'EOF' >> /srv/salt/reclass/nodes/control/{hostname}.yml
- # local storage
- reclass:
- storage:
- data_source:
- engine: local
- EOF
- - cd /srv/salt/reclass; git add -A;git commit -m"use dash repo"
-
- - mkdir -p /srv/salt/reclass/classes/service
- - for i in /usr/share/salt-formulas/reclass/service/*; do ln -s $i /srv/salt/reclass/classes/service/; done
-
- - '[ ! -d /etc/reclass ] && mkdir /etc/reclass'
- - |
- cat << 'EOF' >> /etc/reclass/reclass-config.yml
- storage_type: yaml_fs
- pretty_print: True
- output: yaml
- inventory_base_uri: /srv/salt/reclass
- EOF
-
- - echo "Configuring salt minion ..."
- - apt-get install -y salt-minion
- - '[ ! -d /etc/salt/minion.d ] && mkdir -p /etc/salt/minion.d'
-
- - |
- cat << "EOF" >> /etc/salt/minion.d/minion.conf
- id: {hostname}
- master: localhost
- EOF
-
- - echo "Restarting services with workarounds..."
- - service salt-master restart
- - sleep 60
- - rm -f /etc/salt/pki/minion/minion_master.pub
- - service salt-minion restart
-
- - echo "Showing system info and metadata ..."
- - salt-call --no-color grains.items
- - salt-call --no-color pillar.data
- - reclass -n {hostname}
-
- ########################################################
- # Node is ready, allow SSH access
- - echo "Allow SSH access ..."
- - sudo iptables -D INPUT -p tcp --dport 22 -j DROP
- ########################################################
-
- write_files:
- - path: /etc/network/interfaces.d/99-tcp-tests.cfg
- content: |
- auto eth0
- iface eth0 inet dhcp
-
- # 2nd interface should be UP without IP address
- auto eth1
- iface eth1 inet dhcp
-
- - path: /root/.ssh/id_rsa
- owner: root:root
- permissions: '0600'
- content: |
- -----BEGIN RSA PRIVATE KEY-----
- MIIEpAIBAAKCAQEAxsI1JWJ/VLJlpgBkrhANrCAmne1qsYLCUdBynDG28YtLZ/eo
- eAqtohmJs5SePHoC5uUeacclpxby+G/9s2/pCkzwjMEXPZ7+8RBqLBBTUBKEg3fo
- GLtgjtHYEtm1/+5tg15s74aj48VkFF17G9DmAEta/RLOuRRPMuKy2noM/Fd+cXx+
- OW0wgNFvFUioduuF7Rs9doWnKrLbRP1L8oyU2Xvv11fsSct1gFsXvCfzLltVam6j
- XsE5qUxPyyVPIuqRuJrFOvsB/fVL7BgDikDnbsp1Bylht1WYOWAo6W21f7f6X1v7
- xwd2944on0JjYbpcohvwjZ0kOQWobVf+6j7GLQIDAQABAoIBAF0tAAMlmLGY7CQU
- /R3IctBlRhU1DpZmyTfXc1MbzzqO5Wu44yZbQyjBthcUrdWGEUQy1r4Z2OHq1T54
- KcPry6DDjuU9Q+rkVXmnC07a3GOmOq7zEEA/3zU01ImJvFNdb8NtCb6ELOKDT7Zo
- WGUi2h/7M41+OqDzD2m4csYO/3Vvr12sMhn9BfwU4OPpL44A4PJiEryEAw9o5/j/
- 73eyPvgf6tkC4l0mMtfHB9tg/F++iH8fiEr1SMvHGIc9gZNmFYMrs2XfLkAejPfH
- XrOyw6eqd+kluqw51gHhdeQYwBx6mfOkbhPHWU79FzpH5M1ikdfImZmPCxVf3Ykj
- nxLoK9UCgYEA4c9agPb/OFyN00nnUMBxzQt1pErpOf/7QhnvNZThomzSV7PyefxF
- H6G/VlS3gCcrWBCh7mqOSxGcNQwgudVqzUm7QXruQeg4nWcCGSxg7lGYSEf0MyWL
- 5wrd+f9MoV/VV8udIPENjp96o5kwQEVRfsTBNwmk54kup2+br5q8re8CgYEA4VT8
- UeIN+plP6FjZYITI+SO/ou5goKIhfBrqa5gOXXPc2y6sIu9wBWCr+T7FAF/2gGhS
- rpVx76zcmx05nwkxIlJh58+G3MVyUDFoWnrtL38vdkBSuOGgNfzcBsFpQvFs8WaW
- otbuTtkPcXbVdYRr32/C620MxXhUO+svo3CLaaMCgYEA1rjlF8NHl+Gy31rkQg5t
- aIxgFpVBR+zZkNa2d94V3Ozb65fqmALB/D1Dg6VVROB6P+i5AsyCeHHLd0oMCIof
- YAyfqrlpvHRE+bAM98ESfyxJwVnipYwrh8z2nZYd2UoWxcCRrtRpjtipts2ha0w/
- HWudS2e5To5NNdxUT9y1VDMCgYEAxkQiE+ZkyGiXv+hVtLCBqX4EA9fdm9msvudr
- 9qn/kcj9vrntanvlxEWQbCoH61GEsu2YOtdyPiKKpc1sQvwyiHGWhgK7NoxhDiC7
- IknhYxZ064ajgtu8PWS1MRiDhwypACt1Rej6HNSu2vZl0hZnWF2dU8tLHoHHFEXX
- T+caNCMCgYBZpD6XBiiEXf0ikXYnXKOmbsyVG80V+yqfLo85qb2RW9TaviOSP43g
- nB22ReMSHq2cOrs6VTTgfhxefBwzdDFbfKMf6ZU82jCNlpetAZOrhdMHUvcsjSQk
- XKI6Ldfq6TU3xKujRHfGP+oQ6GLwVCL/kjGxOuSRLFGfRiiqYI3nww==
- -----END RSA PRIVATE KEY-----
-
- - path: /root/.ssh/config
- owner: root:root
- permissions: '0600'
- content: |
- Host *
- ServerAliveInterval 300
- ServerAliveCountMax 10
- StrictHostKeyChecking no
- UserKnownHostsFile /dev/null
diff --git a/tcp_tests/templates/tcpcloud--meta-data.yaml b/tcp_tests/templates/underlay/mk22-lab-advanced--meta-data.yaml
similarity index 100%
rename from tcp_tests/templates/tcpcloud--meta-data.yaml
rename to tcp_tests/templates/underlay/mk22-lab-advanced--meta-data.yaml
diff --git a/tcp_tests/templates/underlay/mk22-lab-advanced--user-data-cfg01.yaml b/tcp_tests/templates/underlay/mk22-lab-advanced--user-data-cfg01.yaml
new file mode 100644
index 0000000..ef53c9b
--- /dev/null
+++ b/tcp_tests/templates/underlay/mk22-lab-advanced--user-data-cfg01.yaml
@@ -0,0 +1,92 @@
+| # All the data below will be stored as a string object
+ #cloud-config, see http://cloudinit.readthedocs.io/en/latest/topics/examples.html
+
+ ssh_pwauth: True
+ users:
+ - name: root
+ sudo: ALL=(ALL) NOPASSWD:ALL
+ shell: /bin/bash
+ ssh_authorized_keys:
+ - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDGwjUlYn9UsmWmAGSuEA2sICad7WqxgsJR0HKcMbbxi0tn96h4Cq2iGYmzlJ48egLm5R5pxyWnFvL4b/2zb+kKTPCMwRc9nv7xEGosEFNQEoSDd+gYu2CO0dgS2bX/7m2DXmzvhqPjxWQUXXsb0OYAS1r9Es65FE8y4rLaegz8V35xfH45bTCA0W8VSKh264XtGz12hacqsttE/UvyjJTZe+/XV+xJy3WAWxe8J/MuW1VqbqNewTmpTE/LJU8i6pG4msU6+wH99UvsGAOKQOduynUHKWG3VZg5YCjpbbV/t/pfW/vHB3b3jiifQmNhulyiG/CNnSQ5BahtV/7qPsYt vagrant@cfg01
+
+ disable_root: false
+ chpasswd:
+ list: |
+ root:r00tme
+ expire: False
+
+ bootcmd:
+ # Block access to SSH while node is preparing
+ - cloud-init-per once sudo iptables -A INPUT -p tcp --dport 22 -j DROP
+ # Enable root access
+ - sed -i -e '/^PermitRootLogin/s/^.*$/PermitRootLogin yes/' /etc/ssh/sshd_config
+ - service sshd restart
+ output:
+ all: '| tee -a /var/log/cloud-init-output.log /dev/tty0'
+
+ runcmd:
+ # Configure dhclient
+ - sudo echo "nameserver {gateway}" >> /etc/resolvconf/resolv.conf.d/base
+ - sudo resolvconf -u
+
+ # Prepare network connection
+ - sudo ifup ens3
+ #- sudo route add default gw {gateway} {interface_name}
+ - sudo ifup ens4
+
+
+ ########################################################
+ # Node is ready, allow SSH access
+ - echo "Allow SSH access ..."
+ - sudo iptables -D INPUT -p tcp --dport 22 -j DROP
+ ########################################################
+
+ write_files:
+ - path: /etc/network/interfaces.d/99-tcp-tests.cfg
+ content: |
+ auto ens3
+ iface ens3 inet dhcp
+ auto ens4
+ iface ens4 inet dhcp
+
+ - path: /root/.ssh/id_rsa
+ owner: root:root
+ permissions: '0600'
+ content: |
+ -----BEGIN RSA PRIVATE KEY-----
+ MIIEpAIBAAKCAQEAxsI1JWJ/VLJlpgBkrhANrCAmne1qsYLCUdBynDG28YtLZ/eo
+ eAqtohmJs5SePHoC5uUeacclpxby+G/9s2/pCkzwjMEXPZ7+8RBqLBBTUBKEg3fo
+ GLtgjtHYEtm1/+5tg15s74aj48VkFF17G9DmAEta/RLOuRRPMuKy2noM/Fd+cXx+
+ OW0wgNFvFUioduuF7Rs9doWnKrLbRP1L8oyU2Xvv11fsSct1gFsXvCfzLltVam6j
+ XsE5qUxPyyVPIuqRuJrFOvsB/fVL7BgDikDnbsp1Bylht1WYOWAo6W21f7f6X1v7
+ xwd2944on0JjYbpcohvwjZ0kOQWobVf+6j7GLQIDAQABAoIBAF0tAAMlmLGY7CQU
+ /R3IctBlRhU1DpZmyTfXc1MbzzqO5Wu44yZbQyjBthcUrdWGEUQy1r4Z2OHq1T54
+ KcPry6DDjuU9Q+rkVXmnC07a3GOmOq7zEEA/3zU01ImJvFNdb8NtCb6ELOKDT7Zo
+ WGUi2h/7M41+OqDzD2m4csYO/3Vvr12sMhn9BfwU4OPpL44A4PJiEryEAw9o5/j/
+ 73eyPvgf6tkC4l0mMtfHB9tg/F++iH8fiEr1SMvHGIc9gZNmFYMrs2XfLkAejPfH
+ XrOyw6eqd+kluqw51gHhdeQYwBx6mfOkbhPHWU79FzpH5M1ikdfImZmPCxVf3Ykj
+ nxLoK9UCgYEA4c9agPb/OFyN00nnUMBxzQt1pErpOf/7QhnvNZThomzSV7PyefxF
+ H6G/VlS3gCcrWBCh7mqOSxGcNQwgudVqzUm7QXruQeg4nWcCGSxg7lGYSEf0MyWL
+ 5wrd+f9MoV/VV8udIPENjp96o5kwQEVRfsTBNwmk54kup2+br5q8re8CgYEA4VT8
+ UeIN+plP6FjZYITI+SO/ou5goKIhfBrqa5gOXXPc2y6sIu9wBWCr+T7FAF/2gGhS
+ rpVx76zcmx05nwkxIlJh58+G3MVyUDFoWnrtL38vdkBSuOGgNfzcBsFpQvFs8WaW
+ otbuTtkPcXbVdYRr32/C620MxXhUO+svo3CLaaMCgYEA1rjlF8NHl+Gy31rkQg5t
+ aIxgFpVBR+zZkNa2d94V3Ozb65fqmALB/D1Dg6VVROB6P+i5AsyCeHHLd0oMCIof
+ YAyfqrlpvHRE+bAM98ESfyxJwVnipYwrh8z2nZYd2UoWxcCRrtRpjtipts2ha0w/
+ HWudS2e5To5NNdxUT9y1VDMCgYEAxkQiE+ZkyGiXv+hVtLCBqX4EA9fdm9msvudr
+ 9qn/kcj9vrntanvlxEWQbCoH61GEsu2YOtdyPiKKpc1sQvwyiHGWhgK7NoxhDiC7
+ IknhYxZ064ajgtu8PWS1MRiDhwypACt1Rej6HNSu2vZl0hZnWF2dU8tLHoHHFEXX
+ T+caNCMCgYBZpD6XBiiEXf0ikXYnXKOmbsyVG80V+yqfLo85qb2RW9TaviOSP43g
+ nB22ReMSHq2cOrs6VTTgfhxefBwzdDFbfKMf6ZU82jCNlpetAZOrhdMHUvcsjSQk
+ XKI6Ldfq6TU3xKujRHfGP+oQ6GLwVCL/kjGxOuSRLFGfRiiqYI3nww==
+ -----END RSA PRIVATE KEY-----
+
+ - path: /root/.ssh/config
+ owner: root:root
+ permissions: '0600'
+ content: |
+ Host *
+ ServerAliveInterval 300
+ ServerAliveCountMax 10
+ StrictHostKeyChecking no
+ UserKnownHostsFile /dev/null
diff --git a/tcp_tests/templates/underlay/mk22-lab-advanced--user-data-cfg01.yaml.bak b/tcp_tests/templates/underlay/mk22-lab-advanced--user-data-cfg01.yaml.bak
new file mode 100644
index 0000000..ee37d88
--- /dev/null
+++ b/tcp_tests/templates/underlay/mk22-lab-advanced--user-data-cfg01.yaml.bak
@@ -0,0 +1,181 @@
+| # All the data below will be stored as a string object
+ #cloud-config, see http://cloudinit.readthedocs.io/en/latest/topics/examples.html
+
+ ssh_pwauth: True
+ users:
+ - name: root
+ sudo: ALL=(ALL) NOPASSWD:ALL
+ shell: /bin/bash
+ ssh_authorized_keys:
+ - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDGwjUlYn9UsmWmAGSuEA2sICad7WqxgsJR0HKcMbbxi0tn96h4Cq2iGYmzlJ48egLm5R5pxyWnFvL4b/2zb+kKTPCMwRc9nv7xEGosEFNQEoSDd+gYu2CO0dgS2bX/7m2DXmzvhqPjxWQUXXsb0OYAS1r9Es65FE8y4rLaegz8V35xfH45bTCA0W8VSKh264XtGz12hacqsttE/UvyjJTZe+/XV+xJy3WAWxe8J/MuW1VqbqNewTmpTE/LJU8i6pG4msU6+wH99UvsGAOKQOduynUHKWG3VZg5YCjpbbV/t/pfW/vHB3b3jiifQmNhulyiG/CNnSQ5BahtV/7qPsYt vagrant@cfg01
+
+ disable_root: false
+ chpasswd:
+ list: |
+ root:r00tme
+ expire: False
+
+ bootcmd:
+ # Block access to SSH while node is preparing
+ - cloud-init-per once sudo iptables -A INPUT -p tcp --dport 22 -j DROP
+ # Enable root access
+ - sed -i -e '/^PermitRootLogin/s/^.*$/PermitRootLogin yes/' /etc/ssh/sshd_config
+ - service sshd restart
+ output:
+ all: '| tee -a /var/log/cloud-init-output.log /dev/tty0'
+
+ runcmd:
+ # Configure dhclient
+ - sudo echo "nameserver {gateway}" >> /etc/resolvconf/resolv.conf.d/base
+ - sudo resolvconf -u
+
+ # Prepare network connection
+ - sudo ifup ens3
+ #- sudo route add default gw {gateway} {interface_name}
+ - sudo ifup ens4
+
+# ############## TCP Cloud cfg01 node ##################
+# - echo "Preparing base OS"
+# - which wget >/dev/null || (apt-get update; apt-get install -y wget)
+
+# - echo "deb [arch=amd64] http://apt.tcpcloud.eu/nightly/ xenial main security extra tcp tcp-salt" > /etc/apt/sources.list
+# # 'tcp-salt' from trusty is for temporary workaround until formulas will be fixed in xenial
+# - echo "deb [arch=amd64] http://apt.tcpcloud.eu/nightly/ trusty tcp-salt" >> /etc/apt/sources.list
+# - wget -O - http://apt.tcpcloud.eu/public.gpg | apt-key add -
+
+# - apt-get clean
+# - apt-get update
+# - apt-get -y upgrade
+#
+# # Install common packages
+# - apt-get install -y python-pip
+# - apt-get install -y curl tmux byobu iputils-ping traceroute htop tree
+#
+# - echo "Configuring salt master ..."
+# - apt-get install -y salt-master reclass
+# - apt-get install -y salt-formula-*
+#
+# - |
+# cat << 'EOF' >> /etc/salt/master.d/master.conf
+# file_roots:
+# base:
+# - /usr/share/salt-formulas/env
+# pillar_opts: False
+# open_mode: True
+# reclass: &reclass
+# storage_type: yaml_fs
+# inventory_base_uri: /srv/salt/reclass
+# ext_pillar:
+# - reclass: *reclass
+# master_tops:
+# reclass: *reclass
+# EOF
+#
+# - echo "Configure git settings and certificate"
+# - touch /root/.git_trusted_certs.pem
+# - for server in git.tcpcloud.eu github.com; do openssl s_client -showcerts -connect $server:443 </dev/null | openssl x509 -outform PEM >> /root/.git_trusted_certs.pem; done
+# - HOME=/root git config --global http.sslCAInfo /root/.git_trusted_certs.pem
+# - HOME=/root git config --global user.email "tcp-qa@example.com"
+# - HOME=/root git config --global user.name "TCP QA"
+#
+# - echo "Configuring reclass ..."
+# - git clone https://github.com/Mirantis/mk-lab-salt-model.git /srv/salt/reclass -b dash
+# - sed -i 's/ master/ dash/' /srv/salt/reclass/classes/cluster/mk20_lab_advanced/openstack_config.yml
+# - |
+# cat << 'EOF' >> /srv/salt/reclass/nodes/control/{hostname}.yml
+# # local storage
+# reclass:
+# storage:
+# data_source:
+# engine: local
+# EOF
+# - cd /srv/salt/reclass; git add -A;git commit -m"use dash repo"
+
+# - mkdir -p /srv/salt/reclass/classes/service
+# - for i in /usr/share/salt-formulas/reclass/service/*; do ln -s $i /srv/salt/reclass/classes/service/; done
+
+# - '[ ! -d /etc/reclass ] && mkdir /etc/reclass'
+# - |
+# cat << 'EOF' >> /etc/reclass/reclass-config.yml
+# storage_type: yaml_fs
+# pretty_print: True
+# output: yaml
+# inventory_base_uri: /srv/salt/reclass
+# EOF
+
+# - echo "Configuring salt minion ..."
+# - apt-get install -y salt-minion
+# - '[ ! -d /etc/salt/minion.d ] && mkdir -p /etc/salt/minion.d'
+
+# - |
+# cat << "EOF" >> /etc/salt/minion.d/minion.conf
+# id: {hostname}
+# master: localhost
+# EOF
+
+# - echo "Restarting services with workarounds..."
+# - service salt-master restart
+# - sleep 60
+# - rm -f /etc/salt/pki/minion/minion_master.pub
+# - service salt-minion restart
+
+# - echo "Showing system info and metadata ..."
+# - salt-call --no-color grains.items
+# - salt-call --no-color pillar.data
+# - reclass -n {hostname}
+
+ ########################################################
+ # Node is ready, allow SSH access
+ - echo "Allow SSH access ..."
+ - sudo iptables -D INPUT -p tcp --dport 22 -j DROP
+ ########################################################
+
+ write_files:
+ - path: /etc/network/interfaces.d/99-tcp-tests.cfg
+ content: |
+ auto ens3
+ iface ens3 inet dhcp
+ auto ens4
+ iface ens4 inet dhcp
+
+ - path: /root/.ssh/id_rsa
+ owner: root:root
+ permissions: '0600'
+ content: |
+ -----BEGIN RSA PRIVATE KEY-----
+ MIIEpAIBAAKCAQEAxsI1JWJ/VLJlpgBkrhANrCAmne1qsYLCUdBynDG28YtLZ/eo
+ eAqtohmJs5SePHoC5uUeacclpxby+G/9s2/pCkzwjMEXPZ7+8RBqLBBTUBKEg3fo
+ GLtgjtHYEtm1/+5tg15s74aj48VkFF17G9DmAEta/RLOuRRPMuKy2noM/Fd+cXx+
+ OW0wgNFvFUioduuF7Rs9doWnKrLbRP1L8oyU2Xvv11fsSct1gFsXvCfzLltVam6j
+ XsE5qUxPyyVPIuqRuJrFOvsB/fVL7BgDikDnbsp1Bylht1WYOWAo6W21f7f6X1v7
+ xwd2944on0JjYbpcohvwjZ0kOQWobVf+6j7GLQIDAQABAoIBAF0tAAMlmLGY7CQU
+ /R3IctBlRhU1DpZmyTfXc1MbzzqO5Wu44yZbQyjBthcUrdWGEUQy1r4Z2OHq1T54
+ KcPry6DDjuU9Q+rkVXmnC07a3GOmOq7zEEA/3zU01ImJvFNdb8NtCb6ELOKDT7Zo
+ WGUi2h/7M41+OqDzD2m4csYO/3Vvr12sMhn9BfwU4OPpL44A4PJiEryEAw9o5/j/
+ 73eyPvgf6tkC4l0mMtfHB9tg/F++iH8fiEr1SMvHGIc9gZNmFYMrs2XfLkAejPfH
+ XrOyw6eqd+kluqw51gHhdeQYwBx6mfOkbhPHWU79FzpH5M1ikdfImZmPCxVf3Ykj
+ nxLoK9UCgYEA4c9agPb/OFyN00nnUMBxzQt1pErpOf/7QhnvNZThomzSV7PyefxF
+ H6G/VlS3gCcrWBCh7mqOSxGcNQwgudVqzUm7QXruQeg4nWcCGSxg7lGYSEf0MyWL
+ 5wrd+f9MoV/VV8udIPENjp96o5kwQEVRfsTBNwmk54kup2+br5q8re8CgYEA4VT8
+ UeIN+plP6FjZYITI+SO/ou5goKIhfBrqa5gOXXPc2y6sIu9wBWCr+T7FAF/2gGhS
+ rpVx76zcmx05nwkxIlJh58+G3MVyUDFoWnrtL38vdkBSuOGgNfzcBsFpQvFs8WaW
+ otbuTtkPcXbVdYRr32/C620MxXhUO+svo3CLaaMCgYEA1rjlF8NHl+Gy31rkQg5t
+ aIxgFpVBR+zZkNa2d94V3Ozb65fqmALB/D1Dg6VVROB6P+i5AsyCeHHLd0oMCIof
+ YAyfqrlpvHRE+bAM98ESfyxJwVnipYwrh8z2nZYd2UoWxcCRrtRpjtipts2ha0w/
+ HWudS2e5To5NNdxUT9y1VDMCgYEAxkQiE+ZkyGiXv+hVtLCBqX4EA9fdm9msvudr
+ 9qn/kcj9vrntanvlxEWQbCoH61GEsu2YOtdyPiKKpc1sQvwyiHGWhgK7NoxhDiC7
+ IknhYxZ064ajgtu8PWS1MRiDhwypACt1Rej6HNSu2vZl0hZnWF2dU8tLHoHHFEXX
+ T+caNCMCgYBZpD6XBiiEXf0ikXYnXKOmbsyVG80V+yqfLo85qb2RW9TaviOSP43g
+ nB22ReMSHq2cOrs6VTTgfhxefBwzdDFbfKMf6ZU82jCNlpetAZOrhdMHUvcsjSQk
+ XKI6Ldfq6TU3xKujRHfGP+oQ6GLwVCL/kjGxOuSRLFGfRiiqYI3nww==
+ -----END RSA PRIVATE KEY-----
+
+ - path: /root/.ssh/config
+ owner: root:root
+ permissions: '0600'
+ content: |
+ Host *
+ ServerAliveInterval 300
+ ServerAliveCountMax 10
+ StrictHostKeyChecking no
+ UserKnownHostsFile /dev/null
diff --git a/tcp_tests/templates/tcpcloud--user-data.yaml b/tcp_tests/templates/underlay/mk22-lab-advanced--user-data.yaml
similarity index 95%
rename from tcp_tests/templates/tcpcloud--user-data.yaml
rename to tcp_tests/templates/underlay/mk22-lab-advanced--user-data.yaml
index ecde655..b0dee66 100644
--- a/tcp_tests/templates/tcpcloud--user-data.yaml
+++ b/tcp_tests/templates/underlay/mk22-lab-advanced--user-data.yaml
@@ -30,8 +30,8 @@
- sudo resolvconf -u
# Prepare network connection
- - sudo ifup {interface_name}
- - sudo route add default gw {gateway} {interface_name}
+ - sudo ifup eth0
+ #- sudo route add default gw {gateway} {interface_name}
- sudo ifup eth1
############## TCP Cloud cfg01 node ##################
@@ -83,7 +83,5 @@
content: |
auto eth0
iface eth0 inet dhcp
-
- # 2nd interface should be UP without IP address
auto eth1
iface eth1 inet dhcp
diff --git a/tcp_tests/templates/tcpcloud-default.yaml b/tcp_tests/templates/underlay/mk22-lab-advanced.yaml
similarity index 70%
rename from tcp_tests/templates/tcpcloud-default.yaml
rename to tcp_tests/templates/underlay/mk22-lab-advanced.yaml
index 597a759..e7195db 100644
--- a/tcp_tests/templates/tcpcloud-default.yaml
+++ b/tcp_tests/templates/underlay/mk22-lab-advanced.yaml
@@ -32,6 +32,12 @@
ip_reserved:
gateway: +1
l2_network_device: +1
+ default_cfg01.mk22-lab-advanced.local: +100
+ default_ctl01.mk22-lab-advanced.local: +101
+ default_ctl02.mk22-lab-advanced.local: +102
+ default_ctl03.mk22-lab-advanced.local: +103
+ default_prx01.mk22-lab-advanced.local: +104
+ default_cmp01.mk22-lab-advanced.local: +105
ip_ranges:
dhcp: [+100, -2]
@@ -55,12 +61,14 @@
public:
address_pool: public-pool01
dhcp: true
- forward:
- mode: nat
+# forward:
+# mode: nat
private:
address_pool: private-pool01
dhcp: true
+ forward:
+ mode: nat
group_volumes:
- name: cloudimage1404 # This name is used for 'backing_store' option for node volumes.
@@ -81,7 +89,7 @@
boot:
- hd
cloud_init_volume_name: iso
- cloud_init_iface_up: eth0
+ cloud_init_iface_up: ens3
volumes:
- name: system
capacity: !os_env NODE_VOLUME_SIZE, 150
@@ -93,23 +101,23 @@
format: raw
device: cdrom
bus: ide
- cloudinit_meta_data: !include tcpcloud--meta-data.yaml
- cloudinit_user_data: !include tcpcloud--user-data-master-node.yaml
+ cloudinit_meta_data: !include mk22-lab-advanced--meta-data.yaml
+ cloudinit_user_data: !include mk22-lab-advanced--user-data-cfg01.yaml
interfaces:
- - label: eth0
- l2_network_device: public
- interface_model: *interface_model
- - label: eth1
+ - label: ens3
l2_network_device: private
interface_model: *interface_model
+ - label: ens4
+ l2_network_device: public
+ interface_model: *interface_model
network_config:
- eth0: # Will get an IP from DHCP public-pool01
- networks:
- - public
- eth1:
+ ens3:
networks:
- private
+ ens4:
+ networks:
+ - public
- name: ctl01.mk22-lab-advanced.local
role: salt_minion
@@ -131,23 +139,23 @@
format: raw
device: cdrom
bus: ide
- cloudinit_meta_data: !include tcpcloud--meta-data.yaml
- cloudinit_user_data: !include tcpcloud--user-data.yaml
+ cloudinit_meta_data: !include mk22-lab-advanced--meta-data.yaml
+ cloudinit_user_data: !include mk22-lab-advanced--user-data.yaml
- interfaces:
+ interfaces: &interfaces
- label: eth0
- l2_network_device: public
- interface_model: *interface_model
- - label: eth1
l2_network_device: private
interface_model: *interface_model
- network_config:
- eth0: # Will get an IP from DHCP public-pool01
- networks:
- - public
- eth1:
+ - label: eth1
+ l2_network_device: public
+ interface_model: *interface_model
+ network_config: &network_config
+ eth0:
networks:
- private
+ eth1:
+ networks:
+ - public
- name: ctl02.mk22-lab-advanced.local
role: salt_minion
@@ -169,23 +177,11 @@
format: raw
device: cdrom
bus: ide
- cloudinit_meta_data: !include tcpcloud--meta-data.yaml
- cloudinit_user_data: !include tcpcloud--user-data.yaml
+ cloudinit_meta_data: !include mk22-lab-advanced--meta-data.yaml
+ cloudinit_user_data: !include mk22-lab-advanced--user-data.yaml
- interfaces:
- - label: eth0
- l2_network_device: public
- interface_model: *interface_model
- - label: eth1
- l2_network_device: private
- interface_model: *interface_model
- network_config:
- eth0: # Will get an IP from DHCP public-pool01
- networks:
- - public
- eth1:
- networks:
- - private
+ interfaces: *interfaces
+ network_config: *network_config
- name: ctl03.mk22-lab-advanced.local
role: salt_minion
@@ -207,23 +203,11 @@
format: raw
device: cdrom
bus: ide
- cloudinit_meta_data: !include tcpcloud--meta-data.yaml
- cloudinit_user_data: !include tcpcloud--user-data.yaml
+ cloudinit_meta_data: !include mk22-lab-advanced--meta-data.yaml
+ cloudinit_user_data: !include mk22-lab-advanced--user-data.yaml
- interfaces:
- - label: eth0
- l2_network_device: public
- interface_model: *interface_model
- - label: eth1
- l2_network_device: private
- interface_model: *interface_model
- network_config:
- eth0: # Will get an IP from DHCP public-pool01
- networks:
- - public
- eth1:
- networks:
- - private
+ interfaces: *interfaces
+ network_config: *network_config
- name: prx01.mk22-lab-advanced.local
role: salt_minion
@@ -245,23 +229,11 @@
format: raw
device: cdrom
bus: ide
- cloudinit_meta_data: !include tcpcloud--meta-data.yaml
- cloudinit_user_data: !include tcpcloud--user-data.yaml
+ cloudinit_meta_data: !include mk22-lab-advanced--meta-data.yaml
+ cloudinit_user_data: !include mk22-lab-advanced--user-data.yaml
- interfaces:
- - label: eth0
- l2_network_device: public
- interface_model: *interface_model
- - label: eth1
- l2_network_device: private
- interface_model: *interface_model
- network_config:
- eth0: # Will get an IP from DHCP public-pool01
- networks:
- - public
- eth1:
- networks:
- - private
+ interfaces: *interfaces
+ network_config: *network_config
- name: cmp01.mk22-lab-advanced.local
role: salt_minion
@@ -283,20 +255,8 @@
format: raw
device: cdrom
bus: ide
- cloudinit_meta_data: !include tcpcloud--meta-data.yaml
- cloudinit_user_data: !include tcpcloud--user-data.yaml
+ cloudinit_meta_data: !include mk22-lab-advanced--meta-data.yaml
+ cloudinit_user_data: !include mk22-lab-advanced--user-data.yaml
- interfaces:
- - label: eth0
- l2_network_device: public
- interface_model: *interface_model
- - label: eth1
- l2_network_device: private
- interface_model: *interface_model
- network_config:
- eth0: # Will get an IP from DHCP public-pool01
- networks:
- - public
- eth1:
- networks:
- - private
+ interfaces: *interfaces
+ network_config: *network_config
diff --git a/tcp_tests/templates/tcpcloud-default.yaml b/tcp_tests/templates/underlay/mk22-lab-advanced.yaml.bak
similarity index 70%
copy from tcp_tests/templates/tcpcloud-default.yaml
copy to tcp_tests/templates/underlay/mk22-lab-advanced.yaml.bak
index 597a759..4c011eb 100644
--- a/tcp_tests/templates/tcpcloud-default.yaml
+++ b/tcp_tests/templates/underlay/mk22-lab-advanced.yaml.bak
@@ -81,7 +81,7 @@
boot:
- hd
cloud_init_volume_name: iso
- cloud_init_iface_up: eth0
+ cloud_init_iface_up: ens3
volumes:
- name: system
capacity: !os_env NODE_VOLUME_SIZE, 150
@@ -93,21 +93,21 @@
format: raw
device: cdrom
bus: ide
- cloudinit_meta_data: !include tcpcloud--meta-data.yaml
- cloudinit_user_data: !include tcpcloud--user-data-master-node.yaml
+ cloudinit_meta_data: !include mk22-lab-advanced--meta-data.yaml
+ cloudinit_user_data: !include mk22-lab-advanced--user-data-cfg01.yaml
interfaces:
- - label: eth0
+ - label: ens3
l2_network_device: public
interface_model: *interface_model
- - label: eth1
+ - label: ens4
l2_network_device: private
interface_model: *interface_model
network_config:
- eth0: # Will get an IP from DHCP public-pool01
+ ens3:
networks:
- public
- eth1:
+ ens4:
networks:
- private
@@ -131,18 +131,18 @@
format: raw
device: cdrom
bus: ide
- cloudinit_meta_data: !include tcpcloud--meta-data.yaml
- cloudinit_user_data: !include tcpcloud--user-data.yaml
+ cloudinit_meta_data: !include mk22-lab-advanced--meta-data.yaml
+ cloudinit_user_data: !include mk22-lab-advanced--user-data.yaml
- interfaces:
+ interfaces: &interfaces
- label: eth0
l2_network_device: public
interface_model: *interface_model
- label: eth1
l2_network_device: private
interface_model: *interface_model
- network_config:
- eth0: # Will get an IP from DHCP public-pool01
+ network_config: &network_config
+ eth0:
networks:
- public
eth1:
@@ -169,23 +169,11 @@
format: raw
device: cdrom
bus: ide
- cloudinit_meta_data: !include tcpcloud--meta-data.yaml
- cloudinit_user_data: !include tcpcloud--user-data.yaml
+ cloudinit_meta_data: !include mk22-lab-advanced--meta-data.yaml
+ cloudinit_user_data: !include mk22-lab-advanced--user-data.yaml
- interfaces:
- - label: eth0
- l2_network_device: public
- interface_model: *interface_model
- - label: eth1
- l2_network_device: private
- interface_model: *interface_model
- network_config:
- eth0: # Will get an IP from DHCP public-pool01
- networks:
- - public
- eth1:
- networks:
- - private
+ interfaces: *interfaces
+ network_config: *network_config
- name: ctl03.mk22-lab-advanced.local
role: salt_minion
@@ -207,23 +195,11 @@
format: raw
device: cdrom
bus: ide
- cloudinit_meta_data: !include tcpcloud--meta-data.yaml
- cloudinit_user_data: !include tcpcloud--user-data.yaml
+ cloudinit_meta_data: !include mk22-lab-advanced--meta-data.yaml
+ cloudinit_user_data: !include mk22-lab-advanced--user-data.yaml
- interfaces:
- - label: eth0
- l2_network_device: public
- interface_model: *interface_model
- - label: eth1
- l2_network_device: private
- interface_model: *interface_model
- network_config:
- eth0: # Will get an IP from DHCP public-pool01
- networks:
- - public
- eth1:
- networks:
- - private
+ interfaces: *interfaces
+ network_config: *network_config
- name: prx01.mk22-lab-advanced.local
role: salt_minion
@@ -245,23 +221,11 @@
format: raw
device: cdrom
bus: ide
- cloudinit_meta_data: !include tcpcloud--meta-data.yaml
- cloudinit_user_data: !include tcpcloud--user-data.yaml
+ cloudinit_meta_data: !include mk22-lab-advanced--meta-data.yaml
+ cloudinit_user_data: !include mk22-lab-advanced--user-data.yaml
- interfaces:
- - label: eth0
- l2_network_device: public
- interface_model: *interface_model
- - label: eth1
- l2_network_device: private
- interface_model: *interface_model
- network_config:
- eth0: # Will get an IP from DHCP public-pool01
- networks:
- - public
- eth1:
- networks:
- - private
+ interfaces: *interfaces
+ network_config: *network_config
- name: cmp01.mk22-lab-advanced.local
role: salt_minion
@@ -283,20 +247,8 @@
format: raw
device: cdrom
bus: ide
- cloudinit_meta_data: !include tcpcloud--meta-data.yaml
- cloudinit_user_data: !include tcpcloud--user-data.yaml
+ cloudinit_meta_data: !include mk22-lab-advanced--meta-data.yaml
+ cloudinit_user_data: !include mk22-lab-advanced--user-data.yaml
- interfaces:
- - label: eth0
- l2_network_device: public
- interface_model: *interface_model
- - label: eth1
- l2_network_device: private
- interface_model: *interface_model
- network_config:
- eth0: # Will get an IP from DHCP public-pool01
- networks:
- - public
- eth1:
- networks:
- - private
+ interfaces: *interfaces
+ network_config: *network_config
diff --git a/tcp_tests/tests/system/conftest.py b/tcp_tests/tests/system/conftest.py
index c02e7a1..eec0242 100644
--- a/tcp_tests/tests/system/conftest.py
+++ b/tcp_tests/tests/system/conftest.py
@@ -12,7 +12,31 @@
# License for the specific language governing permissions and limitations
# under the License.
-pytest_plugins = ['tcp_tests.fixtures.common_fixtures',
- 'tcp_tests.fixtures.config_fixtures',
- 'tcp_tests.fixtures.underlay_fixtures',
- 'tcp_tests.fixtures.tcp_fixtures']
+#from tcp_tests.fixtures import *
+from tcp_tests.fixtures.common_fixtures import *
+from tcp_tests.fixtures.config_fixtures import *
+from tcp_tests.fixtures.underlay_fixtures import *
+from tcp_tests.fixtures.salt_fixtures import *
+from tcp_tests.fixtures.common_services_fixtures import *
+from tcp_tests.fixtures.openstack_fixtures import *
+
+__all__ = sorted([ # sort for documentation
+ # common_fixtures
+ 'show_step',
+ 'revert_snapshot',
+ 'snapshot',
+ # config_fixtures
+ 'config',
+ #underlay_fixtures
+ 'hardware',
+ 'underlay',
+ # salt_fixtures
+ 'salt_actions',
+ 'salt_deployed',
+ # common_services_fixtures
+ 'common_services_actions',
+ 'common_services_deployed',
+ # openstack_fixtures
+ 'openstack_actions',
+ 'openstack_deployed',
+])
diff --git a/tcp_tests/tests/system/test_tcp_install.py b/tcp_tests/tests/system/test_tcp_install.py
index f9ab672..02aa73e 100644
--- a/tcp_tests/tests/system/test_tcp_install.py
+++ b/tcp_tests/tests/system/test_tcp_install.py
@@ -34,561 +34,10 @@
#salt_cmd = 'salt --state-output=terse --state-verbose=False ' # For reduced output
#salt_call_cmd = 'salt-call --state-output=terse --state-verbose=False ' # For reduced output
- steps_mk22_advanced_lab = [
- # Prepare salt services and nodes settings
- {
- 'description': "Run 'linux' formula on cfg01",
- 'cmd': salt_call_cmd + "state.sls linux",
- 'node_name': 'cfg01.mk22-lab-advanced.local', # hardcoded for now
- 'retry': {'count': 3, 'delay': 5},
- 'skip_fail': False,
- },
- {
- 'description': "Run 'openssh' formula on cfg01",
- 'cmd': (salt_call_cmd + "state.sls openssh;"
- "sed -i 's/PasswordAuthentication no/"
- "PasswordAuthentication yes/' "
- "/etc/ssh/sshd_config && service ssh restart"),
- 'node_name': 'cfg01.mk22-lab-advanced.local', # hardcoded for now
- 'retry': {'count': 3, 'delay': 5},
- 'skip_fail': False,
- },
- {
- 'description': ("*Workaround* of the bug"
- " https://mirantis.jira.com/browse/PROD-7962"),
- 'cmd': "echo ' StrictHostKeyChecking no' >> /root/.ssh/config",
- 'node_name': 'cfg01.mk22-lab-advanced.local', # hardcoded for now
- 'retry': {'count': 1, 'delay': 1},
- 'skip_fail': False,
- },
- {
- 'description': "Run 'salt' formula on cfg01",
- 'cmd': salt_call_cmd + " state.sls salt",
- 'node_name': 'cfg01.mk22-lab-advanced.local', # hardcoded for now
- 'retry': {'count': 3, 'delay': 5},
- 'skip_fail': True,
- },
- {
- 'description': "Accept salt keys from all the nodes",
- 'cmd': "salt-key -A -y",
- 'node_name': 'cfg01.mk22-lab-advanced.local', # hardcoded for now
- 'retry': {'count': 1, 'delay': 5},
- 'skip_fail': False,
- },
- {
- 'description': ("Generate inventory for all the nodes to the"
- " /srv/salt/reclass/nodes/_generated"),
- 'cmd': salt_call_cmd + "state.sls reclass.storage",
- 'node_name': 'cfg01.mk22-lab-advanced.local', # hardcoded for now
- 'retry': {'count': 3, 'delay': 5},
- 'skip_fail': False,
- },
- {
- 'description': "Refresh pillars on all minions",
- 'cmd': salt_cmd + "'*' saltutil.refresh_pillar",
- 'node_name': 'cfg01.mk22-lab-advanced.local', # hardcoded for now
- 'retry': {'count': 3, 'delay': 5},
- 'skip_fail': False,
- },
-
-
- # Bootstrap all nodes
- {
- 'description': "Configure linux on controllers",
- 'cmd': salt_cmd + "'*' state.sls linux",
- 'node_name': 'cfg01.mk22-lab-advanced.local', # hardcoded for now
- 'retry': {'count': 5, 'delay': 5},
- 'skip_fail': False,
- },
- {
- 'description': "Configure openssh on controllers",
- 'cmd': (salt_cmd + "-C '* and not cfg*' state.sls openssh;"
- + salt_cmd + "-C '* and not cfg*' cmd.run "
- "\"sed -i 's/PasswordAuthentication no/"
- "PasswordAuthentication yes/' /etc/ssh/sshd_config && "
- "service ssh restart\""),
- 'node_name': 'cfg01.mk22-lab-advanced.local', # hardcoded for now
- 'retry': {'count': 3, 'delay': 5},
- 'skip_fail': False,
- },
- {
- 'description': ("*Workaround* for the bug"
- " https://mirantis.jira.com/browse/PROD-8025"),
- 'cmd': (salt_cmd + "'*' cmd.run 'apt-get update &&"
- " apt-get -y upgrade'"),
- 'node_name': 'cfg01.mk22-lab-advanced.local', # hardcoded for now
- 'retry': {'count': 3, 'delay': 5},
- 'skip_fail': False,
- },
- {
- 'description': ("*Workaround* for the bug"
- " https://mirantis.jira.com/browse/PROD-8021"),
- 'cmd': (salt_cmd + "'*' cmd.run 'apt-get -y install"
- " linux-image-extra-$(uname -r)'"),
- 'node_name': 'cfg01.mk22-lab-advanced.local', # hardcoded for now
- 'retry': {'count': 3, 'delay': 5},
- 'skip_fail': False,
- },
- {
- 'description': ("*Workaround* for the bug"
- " https://mirantis.jira.com/browse/PROD-XXXXX"),
- 'cmd': (salt_cmd + "'*' cmd.run 'apt-get -y install python-requests'"),
- 'node_name': 'cfg01.mk22-lab-advanced.local', # hardcoded for now
- 'retry': {'count': 3, 'delay': 5},
- 'skip_fail': False,
- },
- {
- 'description': "Configure salt.minion on controllers",
- 'cmd': salt_cmd + "'*' state.sls salt.minion",
- 'node_name': 'cfg01.mk22-lab-advanced.local', # hardcoded for now
- 'retry': {'count': 3, 'delay': 5},
- 'skip_fail': False,
- },
- {
- 'description': "Configure ntp on controllers",
- 'cmd': salt_cmd + "'*' state.sls ntp",
- 'node_name': 'cfg01.mk22-lab-advanced.local', # hardcoded for now
- 'retry': {'count': 5, 'delay': 10},
- 'skip_fail': False,
- },
-
- # Install support services
- {
- 'description': "Install keepalived on primary controller",
- 'cmd': salt_cmd + "'ctl01*' state.sls keepalived",
- 'node_name': 'cfg01.mk22-lab-advanced.local', # hardcoded for now
- 'retry': {'count': 3, 'delay': 5},
- 'skip_fail': False,
- },
- {
- 'description': "Install keepalived on other controllers",
- 'cmd': salt_cmd + "'ctl*' state.sls keepalived -b 1",
- 'node_name': 'cfg01.mk22-lab-advanced.local', # hardcoded for now
- 'retry': {'count': 3, 'delay': 5},
- 'skip_fail': False,
- },
- {
- 'description': "Check the VIP",
- # First grep finds the IP, second is to get the correct exit code
- 'cmd': (salt_cmd + "'ctl*' cmd.run 'ip a | grep 172.16.10.254' |"
- " grep -B1 172.16.10.254"),
- 'node_name': 'cfg01.mk22-lab-advanced.local', # hardcoded for now
- 'retry': {'count': 3, 'delay': 5},
- 'skip_fail': False,
- },
-
-
-
-
- {
- 'description': "Install glusterfs on all controllers",
- 'cmd': salt_cmd + "'ctl*' state.sls glusterfs.server.service",
- 'node_name': 'cfg01.mk22-lab-advanced.local', # hardcoded for now
- 'retry': {'count': 3, 'delay': 5},
- 'skip_fail': False,
- },
- {
- 'description': "Setup glusterfs on primary controller",
- 'cmd': salt_cmd + "'ctl01*' state.sls glusterfs.server.setup",
- 'node_name': 'cfg01.mk22-lab-advanced.local', # hardcoded for now
- 'retry': {'count': 3, 'delay': 5},
- 'skip_fail': False,
- },
- {
- 'description': "Setup glusterfs on other controllers",
- 'cmd': salt_cmd + "'ctl*' state.sls glusterfs.server.setup -b 1",
- 'node_name': 'cfg01.mk22-lab-advanced.local', # hardcoded for now
- 'retry': {'count': 3, 'delay': 5},
- 'skip_fail': False,
- },
- {
- 'description': "Check the gluster status",
- 'cmd': salt_cmd + "'ctl01*' cmd.run 'gluster peer status; gluster volume status'",
- 'node_name': 'cfg01.mk22-lab-advanced.local', # hardcoded for now
- 'retry': {'count': 3, 'delay': 5},
- 'skip_fail': False,
- },
-
-
-
-
- {
- 'description': "Install RabbitMQ on all controllers",
- 'cmd': salt_cmd + "'ctl*' state.sls rabbitmq",
- 'node_name': 'cfg01.mk22-lab-advanced.local', # hardcoded for now
- 'retry': {'count': 3, 'delay': 5},
- 'skip_fail': False,
- },
- {
- 'description': "Check the rabbitmq status",
- 'cmd': salt_cmd + "'ctl*' cmd.run 'rabbitmqctl cluster_status'",
- 'node_name': 'cfg01.mk22-lab-advanced.local', # hardcoded for now
- 'retry': {'count': 3, 'delay': 5},
- 'skip_fail': False,
- },
-
-
-
- {
- 'description': ("*Workaround* Update salt-formula-galera on"
- " config node to the latest version"),
- 'cmd': "apt-get -y --force-yes install salt-formula-galera",
- 'node_name': 'cfg01.mk22-lab-advanced.local', # hardcoded for now
- 'retry': {'count': 3, 'delay': 5},
- 'skip_fail': False,
- },
- {
- 'description': "Install Galera on primary controller",
- 'cmd': salt_call_cmd + "state.sls galera",
- 'node_name': 'ctl01.mk22-lab-advanced.local', # hardcoded for now
- 'retry': {'count': 3, 'delay': 5},
- 'skip_fail': False,
- },
- {
- 'description': "Install Galera on other controllers",
- 'cmd': salt_cmd + "'ctl*' state.sls galera",
- 'node_name': 'cfg01.mk22-lab-advanced.local', # hardcoded for now
- 'retry': {'count': 3, 'delay': 5},
- 'skip_fail': False,
- },
- {
- 'description': "Check mysql status",
- 'cmd': salt_cmd + "'ctl*' mysql.status",
- 'node_name': 'cfg01.mk22-lab-advanced.local', # hardcoded for now
- 'retry': {'count': 3, 'delay': 5},
- 'skip_fail': True,
- },
-
-
-
-
- {
- 'description': "Install haproxy on all controllers",
- 'cmd': salt_cmd + "'ctl*' state.sls haproxy",
- 'node_name': 'cfg01.mk22-lab-advanced.local', # hardcoded for now
- 'retry': {'count': 3, 'delay': 5},
- 'skip_fail': False,
- },
- {
- 'description': "Check haproxy status",
- 'cmd': salt_cmd + "'ctl*' service.status haproxy",
- 'node_name': 'cfg01.mk22-lab-advanced.local', # hardcoded for now
- 'retry': {'count': 3, 'delay': 5},
- 'skip_fail': False,
- },
-
-
- {
- 'description': "Install memcached on all controllers",
- 'cmd': salt_cmd + "'ctl*' state.sls memcached",
- 'node_name': 'cfg01.mk22-lab-advanced.local', # hardcoded for now
- 'retry': {'count': 3, 'delay': 5},
- 'skip_fail': False,
- },
-
-
- # Install OpenStack control services
-
-
- {
- 'description': "Install keystone on primary controller",
- 'cmd': salt_cmd + "'ctl01*' state.sls keystone",
- 'node_name': 'cfg01.mk22-lab-advanced.local', # hardcoded for now
- 'retry': {'count': 3, 'delay': 5},
- 'skip_fail': False,
- },
- {
- 'description': "Install keystone on all controllers",
- 'cmd': salt_cmd + "'ctl*' state.sls keystone -b 1",
- 'node_name': 'cfg01.mk22-lab-advanced.local', # hardcoded for now
- 'retry': {'count': 3, 'delay': 5},
- 'skip_fail': False,
- },
- {
- 'description': "Populate keystone services/tenants/admins",
- 'cmd': salt_call_cmd + "state.sls keystone.client",
- 'node_name': 'cfg01.mk22-lab-advanced.local', # hardcoded for now
- 'retry': {'count': 3, 'delay': 5},
- 'skip_fail': False,
- },
- {
- 'description': "Check keystone service-list",
- 'cmd': salt_cmd + "'ctl01*' cmd.run '. /root/keystonerc; keystone service-list'",
- 'node_name': 'cfg01.mk22-lab-advanced.local', # hardcoded for now
- 'retry': {'count': 3, 'delay': 5},
- 'skip_fail': False,
- },
-
-
-
- {
- 'description': "Install glance on primary controller",
- 'cmd': salt_cmd + "'ctl01*' state.sls glance",
- 'node_name': 'cfg01.mk22-lab-advanced.local', # hardcoded for now
- 'retry': {'count': 3, 'delay': 5},
- 'skip_fail': False,
- },
- {
- 'description': "Install glance on all controllers",
- 'cmd': salt_cmd + "'ctl*' state.sls glance -b 1",
- 'node_name': 'cfg01.mk22-lab-advanced.local', # hardcoded for now
- 'retry': {'count': 3, 'delay': 5},
- 'skip_fail': False,
- },
- {
- 'description': "Configure glusterfs.client on all controllers",
- 'cmd': salt_cmd + "'ctl*' state.sls glusterfs.client",
- 'node_name': 'cfg01.mk22-lab-advanced.local', # hardcoded for now
- 'retry': {'count': 3, 'delay': 5},
- 'skip_fail': False,
- },
- {
- 'description': "Configure(re-install) keystone on all controllers",
- 'cmd': salt_cmd + "'ctl*' state.sls keystone -b 1",
- 'node_name': 'cfg01.mk22-lab-advanced.local', # hardcoded for now
- 'retry': {'count': 3, 'delay': 5},
- 'skip_fail': False,
- },
- {
- 'description': "Check glance image-list",
- 'cmd': salt_cmd + "'ctl01*' cmd.run '. /root/keystonerc; glance image-list'",
- 'node_name': 'cfg01.mk22-lab-advanced.local', # hardcoded for now
- 'retry': {'count': 3, 'delay': 5},
- 'skip_fail': False,
- },
-
-
-
- {
- 'description': "Install cinder on all controllers",
- 'cmd': salt_cmd + "'ctl*' state.sls cinder -b 1",
- 'node_name': 'cfg01.mk22-lab-advanced.local', # hardcoded for now
- 'retry': {'count': 3, 'delay': 5},
- 'skip_fail': False,
- },
- {
- 'description': "Check cinder list",
- 'cmd': salt_cmd + "'ctl01*' cmd.run '. /root/keystonerc; cinder list'",
- 'node_name': 'cfg01.mk22-lab-advanced.local', # hardcoded for now
- 'retry': {'count': 3, 'delay': 5},
- 'skip_fail': False,
- },
-
-
- {
- 'description': "Install nova on ctl01",
- 'cmd': salt_cmd + "'ctl01*' state.sls nova",
- 'node_name': 'cfg01.mk22-lab-advanced.local', # hardcoded for now
- 'retry': {'count': 3, 'delay': 5},
- 'skip_fail': False,
- },
- {
- 'description': "Install nova on all controllers",
- 'cmd': salt_cmd + "'ctl*' state.sls nova",
- 'node_name': 'cfg01.mk22-lab-advanced.local', # hardcoded for now
- 'retry': {'count': 3, 'delay': 5},
- 'skip_fail': False,
- },
- {
- 'description': "Check nova service-list",
- 'cmd': salt_cmd + "'ctl01*' cmd.run '. /root/keystonerc; nova service-list'",
- 'node_name': 'cfg01.mk22-lab-advanced.local', # hardcoded for now
- 'retry': {'count': 3, 'delay': 5},
- 'skip_fail': False,
- },
-
-
- {
- 'description': "Install neutron on ctl01",
- 'cmd': salt_cmd + "'ctl01*' state.sls neutron",
- 'node_name': 'cfg01.mk22-lab-advanced.local', # hardcoded for now
- 'retry': {'count': 3, 'delay': 5},
- 'skip_fail': False,
- },
- {
- 'description': "Install neutron on all controllers",
- 'cmd': salt_cmd + "'ctl*' state.sls neutron",
- 'node_name': 'cfg01.mk22-lab-advanced.local', # hardcoded for now
- 'retry': {'count': 3, 'delay': 5},
- 'skip_fail': False,
- },
- {
- 'description': "Check neutron agent-list",
- 'cmd': salt_cmd + "'ctl01*' cmd.run '. /root/keystonerc; neutron agent-list'",
- 'node_name': 'cfg01.mk22-lab-advanced.local', # hardcoded for now
- 'retry': {'count': 3, 'delay': 5},
- 'skip_fail': False,
- },
-
-
- {
- 'description': "Deploy dashboard on prx*",
- 'cmd': salt_cmd + "'prx*' state.apply",
- 'node_name': 'cfg01.mk22-lab-advanced.local', # hardcoded for now
- 'retry': {'count': 3, 'delay': 5},
- 'skip_fail': True,
- },
-
-
- {
- 'description': "Deploy nginx proxy",
- 'cmd': salt_cmd + "'cfg*' state.sls nginx",
- 'node_name': 'cfg01.mk22-lab-advanced.local', # hardcoded for now
- 'retry': {'count': 3, 'delay': 5},
- 'skip_fail': True,
- },
-
-
-
- # Install contrail on controllers
- {
- 'description': "Install contrail database on controllers",
- 'cmd': salt_cmd + "'ctl*' state.sls opencontrail.database -b 1",
- 'node_name': 'cfg01.mk22-lab-advanced.local', # hardcoded for now
- 'retry': {'count': 3, 'delay': 5},
- 'skip_fail': False,
- },
- {
- 'description': "Check cassandra status on ctl01",
- 'cmd': ("nodetool status;"
- "nodetool compactionstats;"
- "nodetool describecluster;"),
- 'node_name': 'ctl01.mk22-lab-advanced.local', # hardcoded for now
- 'retry': {'count': 3, 'delay': 5},
- 'skip_fail': False,
- },
- {
- 'description': "Install contrail database on controllers",
- 'cmd': salt_cmd + "'ctl*' state.sls opencontrail -b 1",
- 'node_name': 'cfg01.mk22-lab-advanced.local', # hardcoded for now
- 'retry': {'count': 3, 'delay': 5},
- 'skip_fail': False,
- },
- {
- 'description': "Check contrail status",
- 'cmd': (salt_cmd + "'ctl01*' cmd.run '. /root/keystonerc;"
- " contrail-status; neutron net-list; nova net-list'"),
- 'node_name': 'cfg01.mk22-lab-advanced.local', # hardcoded for now
- 'retry': {'count': 3, 'delay': 5},
- 'skip_fail': False,
- },
- {
- 'description': "Add contrail bgp router on ctl01",
- 'cmd': (salt_cmd + "'ctl01*' cmd.run "
- "'/usr/share/contrail-utils/provision_control.py"
- " --oper add"
- " --api_server_ip 172.16.10.254"
- " --api_server_port 8082"
- " --host_name ctl01"
- " --host_ip 172.16.10.101"
- " --router_asn 64512"
- " --admin_user admin"
- " --admin_password workshop"
- " --admin_tenant_name admin"
- "'"),
- 'node_name': 'cfg01.mk22-lab-advanced.local', # hardcoded for now
- 'retry': {'count': 3, 'delay': 5},
- 'skip_fail': False,
- },
- {
- 'description': "Add contrail bgp router on ctl02",
- 'cmd': (salt_cmd + "'ctl02*' cmd.run "
- "'/usr/share/contrail-utils/provision_control.py"
- " --oper add"
- " --api_server_ip 172.16.10.254"
- " --api_server_port 8082"
- " --host_name ctl02"
- " --host_ip 172.16.10.102"
- " --router_asn 64512"
- " --admin_user admin"
- " --admin_password workshop"
- " --admin_tenant_name admin"
- "'"),
- 'node_name': 'cfg01.mk22-lab-advanced.local', # hardcoded for now
- 'retry': {'count': 3, 'delay': 5},
- 'skip_fail': False,
- },
- {
- 'description': "Add contrail bgp router on ctl03",
- 'cmd': (salt_cmd + "'ctl03*' cmd.run "
- "'/usr/share/contrail-utils/provision_control.py"
- " --oper add"
- " --api_server_ip 172.16.10.254"
- " --api_server_port 8082"
- " --host_name ctl03"
- " --host_ip 172.16.10.103"
- " --router_asn 64512"
- " --admin_user admin"
- " --admin_password workshop"
- " --admin_tenant_name admin"
- "'"),
- 'node_name': 'cfg01.mk22-lab-advanced.local', # hardcoded for now
- 'retry': {'count': 3, 'delay': 5},
- 'skip_fail': False,
- },
-
-
- # Install compute node
- {
- 'description': "Apply formulas for compute node",
- 'cmd': salt_cmd + "'cmp*' state.apply",
- 'node_name': 'cfg01.mk22-lab-advanced.local', # hardcoded for now
- 'retry': {'count': 3, 'delay': 5},
- 'skip_fail': False,
- },
- {
- 'description': "Re-apply(as in doc) formulas for compute node",
- 'cmd': salt_cmd + "'cmp*' state.apply",
- 'node_name': 'cfg01.mk22-lab-advanced.local', # hardcoded for now
- 'retry': {'count': 3, 'delay': 5},
- 'skip_fail': False,
- },
- {
- 'description': "Add vrouter for cmp01",
- 'cmd': (salt_cmd + "'ctl01*' cmd.run "
- "'/usr/share/contrail-utils/provision_vrouter.py"
- " --oper add"
- " --host_name cmp01"
- " --host_ip 172.16.10.105"
- " --api_server_ip 172.16.10.254"
- " --api_server_port 8082"
- " --admin_user admin"
- " --admin_password workshop"
- " --admin_tenant_name admin"
- "'"),
- 'node_name': 'cfg01.mk22-lab-advanced.local', # hardcoded for now
- 'retry': {'count': 3, 'delay': 5},
- 'skip_fail': False,
- },
- {
- 'description': "Reboot compute nodes",
- 'cmd': salt_cmd + "'cmp*' system.reboot",
- 'node_name': 'cfg01.mk22-lab-advanced.local', # hardcoded for now
- 'retry': {'count': 3, 'delay': 5},
- 'skip_fail': False,
- },
- {
- 'description': "Check IP on computes",
- 'cmd': salt_cmd + "'cmp*' cmd.run 'ip a'",
- 'node_name': 'cfg01.mk22-lab-advanced.local', # hardcoded for now
- 'retry': {'count': 3, 'delay': 5},
- 'skip_fail': False,
- },
- {
- 'description': "Check contrail status on computes",
- 'cmd': salt_cmd + "'cmp*' cmd.run 'contrail-status'",
- 'node_name': 'cfg01.mk22-lab-advanced.local', # hardcoded for now
- 'retry': {'count': 3, 'delay': 5},
- 'skip_fail': False,
- },
- ]
-
-
- @pytest.mark.steps(steps_mk22_advanced_lab)
- @pytest.mark.revert_snapshot(ext.SNAPSHOT.underlay)
+ @pytest.mark.revert_snapshot(ext.SNAPSHOT.openstack_deployed)
# @pytest.mark.snapshot_needed
# @pytest.mark.fail_snapshot
- def test_tcp_install_default(self, underlay, tcp_actions, steps, show_step):
+ def test_tcp_install_default(self, underlay, openstack_deployed, show_step):
"""Test for deploying an tcp environment and check it
Scenario:
@@ -597,46 +46,4 @@
3. Setup compute nodes
"""
- for n, step in enumerate(steps):
- LOG.info(" ####################################################")
- LOG.info(" *** [ STEP #{0} ] {1} ***"
- .format(n+1, step['description']))
-
- with underlay.remote(node_name=step['node_name']) as remote:
- for x in range(step['retry']['count'], 0, -1):
- time.sleep(3)
- result = remote.execute(step['cmd'], verbose=True)
-
- # Workaround of exit code 0 from salt in case of failures
- failed = 0
- for s in result['stdout']:
- if s.startswith("Failed:"):
- failed += int(s.split("Failed:")[1])
-
- if result.exit_code != 0:
- time.sleep(step['retry']['delay'])
- LOG.info(" === RETRY ({0}/{1}) ========================="
- .format(x-1, step['retry']['count']))
- elif failed != 0:
- LOG.error(" === SALT returned exit code = 0 while "
- "there are failed modules! ===")
- LOG.info(" === RETRY ({0}/{1}) ======================="
- .format(x-1, step['retry']['count']))
- else:
- # Workarounds for crashed services
- tcp_actions.check_salt_service(
- "salt-master",
- "cfg01.mk22-lab-advanced.local",
- "salt-call pillar.items",
- 'active (running)') # Hardcoded for now
- tcp_actions.check_salt_service(
- "salt-minion",
- "cfg01.mk22-lab-advanced.local",
- "salt 'cfg01*' pillar.items",
- "active (running)") # Hardcoded for now
- break
-
- if x == 1 and step['skip_fail'] == False:
- # In the last retry iteration, raise an exception
- raise Exception("Step '{0}' failed"
- .format(step['description']))
+ underlay.check_call("ip a")