Dennis Dmitriev | 2cbf235 | 2016-11-11 15:34:21 +0200 | [diff] [blame^] | 1 | # Copyright 2016 Mirantis, Inc. |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 4 | # not use this file except in compliance with the License. You may obtain |
| 5 | # a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 11 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 12 | # License for the specific language governing permissions and limitations |
| 13 | # under the License. |
| 14 | |
| 15 | class OpenContrailManager(object): |
| 16 | """docstring for OpenstackManager""" |
| 17 | |
| 18 | __config = None |
| 19 | __underlay = None |
| 20 | __openstack_actions = None |
| 21 | |
| 22 | def __init__(self, config, underlay, openstack_deployed): |
| 23 | self.__config = config |
| 24 | self.__underlay = underlay |
| 25 | self.__openstack_actions = openstack_deployed |
| 26 | super(OpenContrailManager, self).__init__() |
| 27 | |
| 28 | def prepare_tests(commands): |
| 29 | self.__underlay.execute_commands(commands=commands, |
| 30 | label="Prepare Juniper contrail-test") |
| 31 | |
| 32 | def run_tests(tags='', features=''): |
| 33 | cmd = "salt 'ctl01*' grains.get fqdn|tail -n1" |
| 34 | result = self.__underlay.check_call( |
| 35 | cmd, host=self.__config.salt.salt_master_host) |
| 36 | |
| 37 | ctl01_name = result['stdout'].strip() |
| 38 | |
| 39 | |
| 40 | cmd = '. /etc/contrail/openstackrc; cd /opt/contrail-test; ./run_tests.sh' |
| 41 | if tags != '': |
| 42 | cmd += ' --tags ' + tags |
| 43 | |
| 44 | if features != '': |
| 45 | cmd += ' --features ' + features |
| 46 | |
| 47 | self.__underlay.check_call( |
| 48 | cmd, |
| 49 | node_name=ctl01_name) |