def create_bms(self, bms_name, **kwargs): self.logger.info('Creating bms %s' % bms_name) kwargs['fabric_fixture'] = kwargs.get('fabric_fixture') or self.fabric bms = self.useFixture( BMSFixture(connections=self.connections, name=bms_name, **kwargs)) status, msg = bms.run_dhclient() assert status, 'DHCP failed to fetch address' bms.verify_on_setup() return bms
def create_bms(self, bms_name, **kwargs): self.logger.info('Creating bms %s' % bms_name) bms = self.useFixture( BMSFixture(connections=self.connections, name=bms_name, **kwargs)) if not kwargs.get('static_ip', False): status, msg = bms.run_dhclient() assert status, 'DHCP failed to fetch address' bms.verify_on_setup() return bms
def bms_node_add_delete(self, bms_type=None): ''' Description: Create BMS ironic node Test steps: Maintainer: [email protected] ''' bms_lcm_config = self.inputs.bms_lcm_config bms_nodes = self.inputs.bms_data base_kernel_image = bms_lcm_config["deploy_kernel"] base_ramdisk_image = bms_lcm_config["deploy_ramdisk"] single_interface_bms_nodes = [] lag_interface_bms_nodes = [] multi_homing_interface_bms_nodes = [] bms_nodes_filtered = [] for k, v in bms_nodes.items(): v['node_name'] = k if len(v['interfaces']) == 1: single_interface_bms_nodes.append(v) elif v['interfaces'][0]['tor'] != v['interfaces'][1]['tor']: multi_homing_interface_bms_nodes.append(v) elif v['interfaces'][0]['tor'] == v['interfaces'][1]['tor']: lag_interface_bms_nodes.append(v) bms_nodes_filtered = [] if bms_type == "all": bms_nodes_filtered.extend(single_interface_bms_nodes) bms_nodes_filtered.extend(lag_interface_bms_nodes) bms_nodes_filtered.extend(multi_homing_interface_bms_nodes) elif bms_type == 'link_aggregation': bms_nodes_filtered = lag_interface_bms_nodes elif bms_type == 'single_interface': bms_nodes_filtered = single_interface_bms_nodes else: bms_nodes_filtered = multi_homing_interface_bms_nodes if len(bms_nodes_filtered) == 0: self.logger.debug( "No Valid BMS Node available for the scenario: %s" % bms_type) return bms_nodes_filtered self.bms_fixture = self.useFixture( BMSFixture(self.connections, bms_nodes_filtered[0]['node_name'], is_ironic_node=True)) base_kernel_uuid = self.bms_fixture.connections.nova_h.get_image( base_kernel_image)['id'] base_ramdisk_uuid = self.bms_fixture.connections.nova_h.get_image( base_ramdisk_image)['id'] for bms_node in bms_nodes_filtered: self.bms_fixture = self.useFixture( BMSFixture(self.connections, bms_node['node_name'], is_ironic_node=True)) driver_info = bms_node["driver_info"] properties = bms_node['properties'] driver_info['deploy_ramdisk'] = base_ramdisk_uuid driver_info['deploy_kernel'] = base_kernel_uuid interfaces = bms_node['interfaces'] port_list = [] for interface in interfaces: local_link_connection = {} local_link_connection['mac_addr'] = interface['host_mac'] local_link_connection['switch_info'] = interface['tor'] local_link_connection['switch_id'] = interface['switch_id'] local_link_connection['pxe_enabled'] = interface['pxe_enabled'] local_link_connection['port_id'] = interface['tor_port'] port_list.append(local_link_connection) self.bms_fixture.create_bms_node( ironic_node_name=bms_node['node_name'], port_list=port_list, driver_info=driver_info, properties=properties) self.bms_fixture.set_bms_node_state("available") self.logger.debug( self.bms_fixture.connections.ironic_h.obj.node.list()) #self.bms_fixture.delete_ironic_node() #print self.bms_fixture.ironic_h.obj.node.list() return bms_nodes_filtered