def test_start_node_with_conflict_ipmi_console_ssh_port(self): """ Port test: after node1 start, if node2 also use the same ipmi_console_ssh_port to start, it won't start """ socat_result = run_command(PS_SOCAT, True, subprocess.PIPE, subprocess.PIPE)[1] ipmi_result = run_command(PS_IPMI, True, subprocess.PIPE, subprocess.PIPE)[1] qemu_result = run_command(PS_QEMU, True, subprocess.PIPE, subprocess.PIPE)[1] if 'dell' in self.node_info['type']: racadm_result = run_command(PS_RACADM, True, subprocess.PIPE, subprocess.PIPE)[1] # check if node test1 is running assert "test1" in socat_result assert "test1" in ipmi_result assert "test1-node" in qemu_result if 'dell' in self.node_info['type']: assert "test1" in racadm_result ipmi_console_thread = threading.Thread(target=ipmiconsole.start, args=(self.node_info["name"], )) ipmi_console_thread.setDaemon(True) ipmi_console_thread.start() time.sleep(20) self.node_info_2['name'] = "test2" # modify node configuration to resolve port conflict self.node_info_2['ipmi_console_port'] = 9001 self.node_info_2['bmc_connection_port'] = 9101 if 'dell' in self.node_info_2['type']: self.node_info_2['racadm'] = {} self.node_info_2['racadm']['port'] = 10023 self.node_info_2['compute']['vnc_display'] = 2 self.node_info_2['monitor'] = { 'enable': True, 'interface': None, 'port': 9006 } node2 = model.CNode(self.node_info_2) node2.init() node2.precheck() node2.start() # FIXME: Sleep is not a good way to wait for vbmc start time.sleep(5) ipmi_console_cmd = "sudo ipmi-console start test2" self.assertRaises(Exception, run_command, cmd=ipmi_console_cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) ipmiconsole.stop(self.node_info["name"]) node2.stop()
def test_start_node_with_conflict_ipmi_console_ssh_port(self): """ Port test: after node1 start, if node2 also use the same ipmi_console_ssh_port to start, it won't start """ socat_result = run_command(PS_SOCAT, True, subprocess.PIPE, subprocess.PIPE)[1] ipmi_result = run_command(PS_IPMI, True, subprocess.PIPE, subprocess.PIPE)[1] qemu_result = run_command(PS_QEMU, True, subprocess.PIPE, subprocess.PIPE)[1] if 'dell' in self.node_info['type']: racadm_result = run_command(PS_RACADM, True, subprocess.PIPE, subprocess.PIPE)[1] # check if node test1 is running assert "test1" in socat_result assert "test1" in ipmi_result assert "test1-node" in qemu_result if 'dell' in self.node_info['type']: assert "test1" in racadm_result ipmi_console_thread = threading.Thread( target=ipmiconsole.start, args=(self.node_info["name"],)) ipmi_console_thread.setDaemon(True) ipmi_console_thread.start() time.sleep(20) self.node_info_2['name'] = "test2" # modify node configuration to resolve port conflict self.node_info_2['ipmi_console_port'] = 9001 self.node_info_2['bmc_connection_port'] = 9101 if 'dell' in self.node_info_2['type']: self.node_info_2['racadm'] = {} self.node_info_2['racadm']['port'] = 10023 self.node_info_2['compute']['vnc_display'] = 2 self.node_info_2['monitor'] = { 'enable': True, 'interface': None, 'port': 9006 } node2 = model.CNode(self.node_info_2) node2.init() node2.precheck() node2.start() # FIXME: Sleep is not a good way to wait for vbmc start time.sleep(5) ipmi_console_cmd = "sudo ipmi-console start test2" self.assertRaises( Exception, run_command, cmd=ipmi_console_cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) ipmiconsole.stop(self.node_info["name"]) node2.stop()
def tearDownClass(cls): with open(cls.TMP_CONF_FILE, "r") as yml_file: node_info = yaml.load(yml_file) ipmiconsole.stop(node_info["name"]) node = CNode(node_info) node.init() node.stop() if os.path.exists(cls.TMP_CONF_FILE): os.unlink(cls.TMP_CONF_FILE) workspace = os.path.join(config.infrasim_home, "test") if os.path.exists(workspace): shutil.rmtree(workspace)