SwitchNodeConnector extends NodeConnector { public GetSwitchesResponse getSwitchNodes() { GetSwitchesResponse switchesResponse = new GetSwitchesResponse(); for ( String s : switchNodeMap.keySet() ) { SwitchNode val = switchNodeMap.get( s ); ISwitchService switchService = switchServiceMap.get( s ); GetSwitchesResponseItem item = new GetSwitchesResponseItem( s, val.getIpAddress() ); item.setType( switchService != null ? switchService.getSwitchType() : null ); switchesResponse.add( item ); } return switchesResponse; } private  SwitchNodeConnector(); static SwitchNodeConnector getInstance(); GetSwitchesResponse getSwitchNodes(); boolean contains( String switchId ); SwitchNode getSwitchNode( String switchId ); void setSwitchNode( String switchId, SwitchNode switchNode ); ISwitchService getSwitchService( String switchId ); GetSwitchResponse getSwitchNodeInfo( String switchId, boolean refresh ); SwitchInfo getSwitchInfo( String switchId, boolean refresh ); void updateSwitchNodeInfo( String switchId, SwitchUpdateInfo switchUpdateInfo ); List<String> getSwitchPorts( String switchId ); List<SwitchPort> getSwitchPortsBulk( String switchId ); SwitchPort getSwitchPort( String switchId, String portName ); SwitchSnmpConfig getSnmp( String switchId ); void changeSwitchPortStatus( String switchId, String portName, SwitchPort.PortStatus portStatus ); void updateSwitchPort( String switchId, String portName, SwitchPort portInfo ); void switchPortEnable( String switchId, String portName, boolean isEnabled ); void rebootSwitch( String switchId ); void setPassword( String switchId, SetNodePassword nodePassword ); void upgradeSwitch( String switchId, SwitchUpgradeInfo upgradeInfo ); List<String> getSwitchLacpGroups( String switchId ); SwitchLacpGroup getSwitchLacpGroup( String switchId, String lacpGroupName ); void createLacpGroup( String switchId, SwitchLacpGroup lacpGroup ); void deleteLacpGroup( String switchId, String lacpGroupName ); List<String> getSwitchVlans( String switchId ); List<SwitchVlan> getSwitchVlansBulk( String switchId ); SwitchVlan getSwitchVlan( String switchId, String vlanName ); void createVlan( String switchId, SwitchVlan vlan ); void updateVlan( String switchId, String vlanName, SwitchVlan vlan ); void deleteVlan( String switchId, String vlanName ); List<SwitchVxlan> getSwitchVxlans( String switchId ); List<SwitchVxlan> getSwitchVxlansMatchingVlan( String switchId, String vlanName ); void createVxlan( String switchId, SwitchVxlan vxlan ); void deleteVxlan( String switchId, String vxlanName, String vlanName ); void configureOspf( String switchId, SwitchOspfConfig ospf ); SwitchOspfConfig getOspf( String switchId ); void configureBgp( String switchId, SwitchBgpConfig bgp ); void configureMclag( String switchId, SwitchMclagInfo mclag ); void applyNetworkConfiguration( String switchId, String configName ); void applySwitchBulkConfigs( String switchId, List<PluginSwitchBulkConfig> configs ); void configureIpv4DefaultRoute( String switchId, String gateway, String portId ); void deleteIpv4DefaultRoute( String switchId ); void deletePortOrBondFromVlan( String switchId, String vlanId, String portOrBondName ); void deletePortFromLacpGroup( String switchId, String lacpGroupId, String portName ); void setSwitchTime( String switchId, long time ); void configureSnmp( String switchId, SwitchSnmpConfig config ); void configureSwitchNtp( NBSwitchNtpConfig ntpConfig ); void reloadRackInventoryConfig( HmsInventoryConfiguration hic ); void parseRackInventoryConfig(); void executeSwitchNodeRefresh( List<SwitchNode> switchNodes ); static List<SwitchComponentEnum> getMonitoredSwitchComponents(); void initSwitchMonitoring(); public Map<String, SwitchNode> switchNodeMap; }
@Test public void testGetSwitchNodes() { logger.info( "[TS] : testGetSwitchNodes" ); GetSwitchesResponse result = SwitchNodeConnector.getInstance().getSwitchNodes(); logger.info( "[TS] : Expected result : Result(String Array) length = 1 or more than 1, actual result : Result(String Array) length = " + result.getSwitchList().size() ); assertNotNull( result.getSwitchList() ); }