def check_connections(self):
switch_connections = self._mdriver.get_all_switch_ips()<EOL>for switch_ip in switch_connections:<EOL><INDENT>state = self._mdriver.get_switch_ip_and_active_state(switch_ip)<EOL>config_failure = self._mdriver.get_switch_replay_failure(<EOL>const.FAIL_CONFIG, switch_ip)<EOL>contact_failure = self._mdriver.get_switch_replay_failure(<EOL>const.FAIL_CONTACT, switch_ip)<EOL>LOG.debug("<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>",<EOL>{'<STR_LIT>': threading.current_thread().ident,<EOL>'<STR_LIT>': switch_ip, '<STR_LIT:state>': state,<EOL>'<STR_LIT>': contact_failure,<EOL>'<STR_LIT>': config_failure})<EOL>try:<EOL><INDENT>nexus_type = self._driver.get_nexus_type(switch_ip)<EOL><DEDENT>except Exception:<EOL><INDENT>if state != const.SWITCH_INACTIVE:<EOL><INDENT>LOG.error("<STR_LIT>"<EOL>"<STR_LIT>", {'<STR_LIT>': switch_ip})<EOL>self._mdriver.set_switch_ip_and_active_state(<EOL>switch_ip, const.SWITCH_INACTIVE)<EOL><DEDENT>else:<EOL><INDENT>self._mdriver.incr_switch_replay_failure(<EOL>const.FAIL_CONTACT, switch_ip)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>if state == const.SWITCH_RESTORE_S2:<EOL><INDENT>try:<EOL><INDENT>self._mdriver.configure_next_batch_of_vlans(switch_ip)<EOL><DEDENT>except Exception as e:<EOL><INDENT>LOG.error("<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>",<EOL>{'<STR_LIT>': switch_ip, '<STR_LIT>': e})<EOL>self._mdriver.register_switch_as_inactive(<EOL>switch_ip, '<STR_LIT>')<EOL><DEDENT>continue<EOL><DEDENT>if state == const.SWITCH_INACTIVE:<EOL><INDENT>self._configure_nexus_type(switch_ip, nexus_type)<EOL>LOG.info("<STR_LIT>"<EOL>"<STR_LIT>",<EOL>{'<STR_LIT>': switch_ip})<EOL>self._mdriver.set_switch_ip_and_active_state(<EOL>switch_ip, const.SWITCH_RESTORE_S1)<EOL>self.replay_config(switch_ip)<EOL>if self._mdriver.get_switch_ip_and_active_state(<EOL>switch_ip) == const.SWITCH_INACTIVE:<EOL><INDENT>self._mdriver.incr_switch_replay_failure(<EOL>const.FAIL_CONFIG, switch_ip)<EOL>LOG.warning("<STR_LIT>"<EOL>"<STR_LIT>",<EOL>{'<STR_LIT>': switch_ip})<EOL><DEDENT>else:<EOL><INDENT>self._mdriver.reset_switch_replay_failure(<EOL>const.FAIL_CONFIG, switch_ip)<EOL>self._mdriver.reset_switch_replay_failure(<EOL>const.FAIL_CONTACT, switch_ip)<EOL>LOG.info("<STR_LIT>"<EOL>"<STR_LIT>",<EOL>{'<STR_LIT>': switch_ip})<EOL><DEDENT><DEDENT><DEDENT><DEDENT>
Check connection between OpenStack to Nexus device.