ffdc: Limit protocol checking.
- Set 1: Only checking protocols that are specified in the config file for
the user targeted machine/OS type.
- Set 2: Also limit checking to the CLI input remote_protocol if it is not ALL.
Tests:
- Set 1: Regression tested.
- Set 2: Regression tested.
Signed-off-by: Peter D Phan <peterp@us.ibm.com>
Change-Id: Icb3e9a69805fc8d8341f1e987c1a490bef314d8d
diff --git a/ffdc/ffdc_collector.py b/ffdc/ffdc_collector.py
index 4e11529..a761451 100644
--- a/ffdc/ffdc_collector.py
+++ b/ffdc/ffdc_collector.py
@@ -188,28 +188,51 @@
working_protocol_list = []
if self.target_is_pingable():
working_protocol_list.append("SHELL")
- # Check supported protocol ping,ssh, redfish are working.
- if self.ssh_to_target_system():
- working_protocol_list.append("SSH")
- working_protocol_list.append("SCP")
- # Redfish
- if self.verify_redfish():
- working_protocol_list.append("REDFISH")
- self.logger.info("\n\t[Check] %s Redfish Service.\t\t [OK]" % self.hostname)
- else:
- self.logger.info("\n\t[Check] %s Redfish Service.\t\t [NOT AVAILABLE]" % self.hostname)
+ for machine_type in self.ffdc_actions.keys():
+ if self.target_type != machine_type:
+ continue
- # IPMI
- if self.verify_ipmi():
- working_protocol_list.append("IPMI")
- self.logger.info("\n\t[Check] %s IPMI LAN Service.\t\t [OK]" % self.hostname)
- else:
- self.logger.info("\n\t[Check] %s IPMI LAN Service.\t\t [NOT AVAILABLE]" % self.hostname)
+ for k, v in self.ffdc_actions[machine_type].items():
- # Telnet
- if self.telnet_to_target_system():
- working_protocol_list.append("TELNET")
+ # If config protocol is SSH or SCP
+ if (self.ffdc_actions[machine_type][k]['PROTOCOL'][0] == 'SSH'
+ or self.ffdc_actions[machine_type][k]['PROTOCOL'][0] == 'SCP') \
+ and (self.remote_protocol == 'ALL'
+ or self.remote_protocol == 'SSH' or self.remote_protocol == 'SCP'):
+
+ # Only check SSH/SCP once for both protocols
+ if 'SSH' not in working_protocol_list \
+ and 'SCP' not in working_protocol_list:
+ if self.ssh_to_target_system():
+ working_protocol_list.append("SSH")
+ working_protocol_list.append("SCP")
+
+ # If config protocol is TELNET
+ if (self.ffdc_actions[machine_type][k]['PROTOCOL'][0] == 'TELNET') \
+ and (self.remote_protocol == 'ALL' or self.remote_protocol == 'TELNET'):
+ if self.telnet_to_target_system():
+ working_protocol_list.append("TELNET")
+
+ # If config protocol is REDFISH
+ if (self.ffdc_actions[machine_type][k]['PROTOCOL'][0] == 'REDFISH') \
+ and (self.remote_protocol == 'ALL' or self.remote_protocol == 'REDFISH'):
+ if self.verify_redfish():
+ working_protocol_list.append("REDFISH")
+ self.logger.info("\n\t[Check] %s Redfish Service.\t\t [OK]" % self.hostname)
+ else:
+ self.logger.info(
+ "\n\t[Check] %s Redfish Service.\t\t [NOT AVAILABLE]" % self.hostname)
+
+ # If config protocol is IPMI
+ if (self.ffdc_actions[machine_type][k]['PROTOCOL'][0] == 'IPMI') \
+ and (self.remote_protocol == 'ALL' or self.remote_protocol == 'IPMI'):
+ if self.verify_ipmi():
+ working_protocol_list.append("IPMI")
+ self.logger.info("\n\t[Check] %s IPMI LAN Service.\t\t [OK]" % self.hostname)
+ else:
+ self.logger.info(
+ "\n\t[Check] %s IPMI LAN Service.\t\t [NOT AVAILABLE]" % self.hostname)
# Verify top level directory exists for storage
self.validate_local_store(self.location)
@@ -319,8 +342,10 @@
# Close network connection after collecting all files
self.elapsed_time = time.strftime("%H:%M:%S", time.gmtime(time.time() - self.start_time))
- self.ssh_remoteclient.ssh_remoteclient_disconnect()
- self.telnet_remoteclient.tn_remoteclient_disconnect()
+ if self.ssh_remoteclient:
+ self.ssh_remoteclient.ssh_remoteclient_disconnect()
+ if self.telnet_remoteclient:
+ self.telnet_remoteclient.tn_remoteclient_disconnect()
def protocol_ssh(self,
ffdc_actions,