From edff2695d6956d59b22951043f970fc55cddbe16 Mon Sep 17 00:00:00 2001 From: Nikolas Hermanns Date: Tue, 13 Dec 2016 15:09:04 +0100 Subject: test_environment upload the cloner info to jenkins Change-Id: If2f4d548a85732f3ef8e5412e67c377024f7d63b Signed-off-by: Nikolas Hermanns --- .../lib/test_environment/test_environment.py | 27 +++++++++++++++++++--- odl-pipeline/odl-pipeline-common.sh | 6 +++++ odl-pipeline/vjumphost.yaml | 19 +++++++++++++++ 3 files changed, 49 insertions(+), 3 deletions(-) create mode 100644 odl-pipeline/odl-pipeline-common.sh create mode 100644 odl-pipeline/vjumphost.yaml (limited to 'odl-pipeline') diff --git a/odl-pipeline/lib/test_environment/test_environment.py b/odl-pipeline/lib/test_environment/test_environment.py index 481f38d..8af6b58 100755 --- a/odl-pipeline/lib/test_environment/test_environment.py +++ b/odl-pipeline/lib/test_environment/test_environment.py @@ -5,6 +5,7 @@ from utils.service import Service from utils.processutils import execute from utils import utils_yaml from utils.shutil import shutil +from utils.node_manager import NodeManager MAX_NODES = 5 @@ -21,9 +22,10 @@ class TestEnvironment(Service): self.cleanup() if sys_args.cleanup: return - if not sys_args.cloner_info or not sys_args.snapshot_disks: - LOG.error('--cloner-info, --snapshot-disks have to be given if not' - ' only cleanup.') + if not sys_args.cloner_info or not sys_args.snapshot_disk\ + or not sys_args.vjump_hosts: + LOG.error('--cloner-info, --snapshot-disks and --vjump-hosts ' + ' have to be given if not only --cleanup.') exit(1) node_info = utils_yaml.read_dict_from_yaml(sys_args.cloner_info + '/node.yaml') @@ -85,6 +87,22 @@ class TestEnvironment(Service): 'nodes_cpu': i, 'host_cpu': cores}) + # Upload cloner_info to jenkins slave + jenkins_slaves = NodeManager( + utils_yaml.read_dict_from_yaml( + sys_args.vjump_hosts)['servers']).get_nodes() + if 'CLONER_INFO' in os.environ: + cloner_info_path = os.environ['CLONER_INFO'] + else: + cloner_info_path = '/home/jenkins/cloner-info/' + node_name = 'jenkins%s' % self.env + if node_name not in jenkins_slaves: + raise Exception('Jenkins host %s not provided in %s' + % (node_name, + sys_args.vjump_hosts)) + jenkins_slaves[node_name].copy('to', sys_args.cloner_info, + cloner_info_path) + def check_if_br_exists(self, bridge): _, (_, rc) = execute('ovs-vsctl br-exists %s' % bridge, check_exit_code=[0, 2], as_root=True) @@ -118,6 +136,9 @@ class TestEnvironment(Service): required=False) parser.add_argument('--snapshot-disks', help="Path to the snapshots", required=False) + parser.add_argument('--vjump-hosts', help=("Path to the information of" + " the virtual jumphosts"), + required=False) parser.add_argument('--cleanup', help="Only Cleanup", required=False, action='store_true') return parser diff --git a/odl-pipeline/odl-pipeline-common.sh b/odl-pipeline/odl-pipeline-common.sh new file mode 100644 index 0000000..6d7cd71 --- /dev/null +++ b/odl-pipeline/odl-pipeline-common.sh @@ -0,0 +1,6 @@ +#!/bin/bash +PIPELINE_HOME=$WORKSPACE/sdnvpn/odl-pipeline +LIB=$PIPELINE_HOME/lib +CLONER_INFO=/home/jenkins/cloner-info/ +SNAPSHOT_DISKS=/home/jenkins/snapshot-disks/ +VIRTUAL_JUMPHOSTS=$PIPELINE_HOME/vjumphost.yaml \ No newline at end of file diff --git a/odl-pipeline/vjumphost.yaml b/odl-pipeline/vjumphost.yaml new file mode 100644 index 0000000..2e24cd1 --- /dev/null +++ b/odl-pipeline/vjumphost.yaml @@ -0,0 +1,19 @@ +servers: + jenkins0: + address: '192.168.122.100' + user: 'jenkins' + jenkins1: + address: '192.168.122.101' + user: 'jenkins' + jenkins2: + address: '192.168.122.102' + user: 'jenkins' + jenkins3: + address: '192.168.122.103' + user: 'jenkins' + jenkins4: + address: '192.168.122.104' + user: 'jenkins' + jenkins5: + address: '192.168.122.105' + user: 'jenkins' \ No newline at end of file -- cgit 1.2.3-korg