def test_bmc_interface(args): check_sspl_ll_is_running() # backup active bmc interface BMC_IF_CONSUL_KEY, BMC_IF_CONSUL_VAL = backup_bmc_config() if BMC_IF_CONSUL_VAL == "lan": simulate_bmc_interface_alert.lan_channel_alert(BMC_IF_CONSUL_KEY, BMC_IF_CONSUL_VAL) else: simulate_bmc_interface_alert.kcs_channel_alert(BMC_IF_CONSUL_KEY, BMC_IF_CONSUL_VAL) bmc_interface_message = None for i in range(30): if world.sspl_modules[ IngressProcessorTests.name()]._is_my_msgQ_empty(): time.sleep(2) while not world.sspl_modules[ IngressProcessorTests.name()]._is_my_msgQ_empty(): ingressMsg = world.sspl_modules[ IngressProcessorTests.name()]._read_my_msgQ() print("Received: %s" % ingressMsg) try: # Make sure we get back the message type that matches the request msg_type = ingressMsg.get("sensor_response_type") if msg_type["info"]["resource_type"] == "node:bmc:interface:kcs" or \ msg_type["info"]["resource_type"] == "node:bmc:interface:rmcp": bmc_interface_message = msg_type break except Exception as exception: print(exception) if bmc_interface_message: break time.sleep(1) #restore bmc config and activate ipmisimtool simulate_bmc_interface_alert.restore_config() assert (bmc_interface_message is not None) assert (bmc_interface_message.get("alert_type") is not None) alert_type = bmc_interface_message.get("alert_type") assert (alert_type == "fault") assert (bmc_interface_message.get("alert_id") is not None) assert (bmc_interface_message.get("severity") is not None) assert (bmc_interface_message.get("host_id") is not None) assert (bmc_interface_message.get("info") is not None) bmc_interface_info = bmc_interface_message.get("info") assert (bmc_interface_info.get("site_id") is not None) assert (bmc_interface_info.get("rack_id") is not None) assert (bmc_interface_info.get("node_id") is not None) assert (bmc_interface_info.get("cluster_id") is not None) assert (bmc_interface_info.get("resource_id") is not None) assert (bmc_interface_info.get("description") is not None) bmc_interface_specific_info = bmc_interface_message.get("specific_info") if bmc_interface_specific_info: assert (bmc_interface_specific_info.get("channel info") is not None)
def request(self): # backup active bmc interface BMC_IF_CONSUL_KEY, BMC_IF_CONSUL_VAL = self.backup_bmc_config() if BMC_IF_CONSUL_VAL == "lan": simulate_bmc_interface_alert.lan_channel_alert( BMC_IF_CONSUL_KEY, BMC_IF_CONSUL_VAL) else: simulate_bmc_interface_alert.kcs_channel_alert( BMC_IF_CONSUL_KEY, BMC_IF_CONSUL_VAL)