def _fix_ironic_tempest_flavor(self): # Update tempest configuration to contain the uuid of the baremetal # flavor for the flavor_ref and flavor_ref_alt (flavor_id, code) = utils.run_cmd_line( 'bash -c "source %s admin admin > /dev/null && ' 'openstack flavor show ' 'baremetal -f value -c id"' % OPENRC_PATH, shell=True, check_result=False) self.assertEqual( code, 0, message="Baremetal flavor doesn't exist: %s" % flavor_id) (result, code) = utils.run_cmd_line( 'bash -c "source %s admin admin > /dev/null && ' 'iniset /opt/stack/tempest/etc/tempest.conf ' 'compute flavor_ref %s"' % (OPENRC_PATH, flavor_id), shell=True, check_result=False) self.assertEqual( code, 0, message="Failed to configure flavor_ref: %s" % result) (result, code) = utils.run_cmd_line( 'bash -c "source %s admin admin > /dev/null && ' 'iniset /opt/stack/tempest/etc/tempest.conf ' 'compute flavor_ref_alt %s"' % (OPENRC_PATH, flavor_id), shell=True, check_result=False) self.assertEqual( code, 0, message="Failed to configure flavor_ref_alt: %s" % result)
def setUpClass(cls): BaseTestCase.setUpClass() cls.devstack.local_conf = LOCAL_CONF cls.devstack.clone() cls.devstack.download_gerrit_change('refs/changes/87/87987/14') my_path = os.path.join(WORKSPACE, 'my') run_cmd_line('git clone https://github.com/kshileev/my.git {d}' ''.format(d=my_path)) cls.devstack.patch(os.path.join(my_path, 'netns.diff'))
def setUpClass(cls): super(IronicTestCase, cls).setUpClass() ironic_repo = os.environ.get('IRONIC_REPO') ironic_ref = os.environ.get('IRONIC_REF') hw_file_name = os.environ.get('IRONIC_HW_FILE') hw_file = os.path.join(HW_FILE_PATH, hw_file_name) cls.hw_info = open(hw_file, 'r').readline().split() (devices, code) = utils.run_cmd_line('ifconfig | grep Ethernet | ' 'cut -d" " -f 1', shell=True) devices = devices.splitlines() for dev in devices: (ip, code) = utils.run_cmd_line('ifconfig %s | ' 'grep "inet\ addr" | ' 'cut -d: -f2 | ' 'cut -d" " -f1' % dev, shell=True) ip = ip.strip() if '10.0.199' in ip: host = ip interface = dev start = os.environ.get('IRONIC_AL_START') end = os.environ.get('IRONIC_AL_END') local_conf = LOCAL_CONF.format( host_ip=host, ironic_interface=interface, ironic_repo=ironic_repo, ironic_ref=ironic_ref, allocation_start=start, allocation_end=end, hw_file=hw_file, enabled_driver=cls.enabled_driver) cls.devstack.local_conf = local_conf cls.devstack.clone()
def run_cmd_with_openrc(self, cmd): activate_openrc = ( 'bash -c "source %s admin admin > /dev/null && ' % OPENRC_PATH) return utils.run_cmd_line( "%s%s" % (activate_openrc, cmd), shell=True, check_result=False)
def setUpClass(cls): cls.devstack = DevStack() cls.node = Node(NODE_DEFAULT_ETH) # Add fqdn to /etc/hosts run_cmd_line( 'echo "{ip} {hostname}.slave.openstack.org {hostname}"' ' | sudo tee -a /etc/hosts'.format(ip=cls.node.ip, hostname=cls.node.hostname), shell=True) # Enable kernel networking functions run_cmd_line('echo "net.ipv4.ip_forward=1" ' '| sudo tee -a /etc/sysctl.conf', shell=True) run_cmd_line('echo "net.ipv4.conf.all.rp_filter=0" ' '| sudo tee -a /etc/sysctl.conf', shell=True) run_cmd_line('echo "net.ipv4.conf.default.rp_filter=0" ' '| sudo tee -a /etc/sysctl.conf', shell=True) run_cmd_line('sudo sysctl -p', shell=True) # Install custom ncclient ncclient_dir = '/opt/git/ncclient' if os.path.exists(ncclient_dir): run_cmd_line('sudo rm -rf {0}'.format(ncclient_dir), shell=True) run_cmd_line( 'sudo pip uninstall -y ncclient', shell=True, check_result=False) run_cmd_line('sudo git clone --depth=1 -b master ' 'https://github.com/CiscoSystems/ncclient.git ' '{NCCLIENT_DIR}'.format(NCCLIENT_DIR=ncclient_dir), shell=True) try: os.chdir(ncclient_dir) run_cmd_line('sudo python setup.py install', shell=True) except Exception as e: logger.error(e) finally: os.chdir(WORKSPACE)
def setUpClass(cls): cls.devstack = DevStack() cls.node = Node(NODE_DEFAULT_ETH) # Add fqdn to /etc/hosts run_cmd_line('echo "{ip} {hostname}.slave.openstack.org {hostname}"' ' | sudo tee -a /etc/hosts'.format( ip=cls.node.ip, hostname=cls.node.hostname), shell=True) # Enable kernel networking functions run_cmd_line( 'echo "net.ipv4.ip_forward=1" ' '| sudo tee -a /etc/sysctl.conf', shell=True) run_cmd_line( 'echo "net.ipv4.conf.all.rp_filter=0" ' '| sudo tee -a /etc/sysctl.conf', shell=True) run_cmd_line( 'echo "net.ipv4.conf.default.rp_filter=0" ' '| sudo tee -a /etc/sysctl.conf', shell=True) run_cmd_line('sudo sysctl -p', shell=True) # Install custom ncclient ncclient_dir = '/opt/git/ncclient' if os.path.exists(ncclient_dir): run_cmd_line('sudo rm -rf {0}'.format(ncclient_dir), shell=True) run_cmd_line('sudo pip uninstall -y ncclient', shell=True, check_result=False) run_cmd_line('sudo git clone --depth=1 -b master ' 'https://github.com/CiscoSystems/ncclient.git ' '{NCCLIENT_DIR}'.format(NCCLIENT_DIR=ncclient_dir), shell=True) try: os.chdir(ncclient_dir) run_cmd_line('sudo python setup.py install', shell=True) except Exception as e: logger.error(e) finally: os.chdir(WORKSPACE)
def setUpClass(cls): cls.devstack = DevStack(clone_path=os.path.join(WORKSPACE, 'devstack')) if OFFLINE_NODE_WHEN_COMPLETE: cls.node = Node(NODE_DEFAULT_ETH) # Add fqdn to /etc/hosts run_cmd_line( 'echo "{ip} {hostname}.slave.openstack.org {hostname}"' ' | sudo tee -a /etc/hosts'.format(ip=cls.node.ip, hostname=cls.node.hostname), shell=True) # Enable kernel networking functions run_cmd_line('echo "net.ipv4.ip_forward=1" ' '| sudo tee -a /etc/sysctl.conf', shell=True) run_cmd_line('echo "net.ipv4.conf.all.rp_filter=0" ' '| sudo tee -a /etc/sysctl.conf', shell=True) run_cmd_line('echo "net.ipv4.conf.default.rp_filter=0" ' '| sudo tee -a /etc/sysctl.conf', shell=True) run_cmd_line('sudo sysctl -p', shell=True) # Install ncclient run_cmd_line('sudo pip install ncclient', shell=True, check_result=False)