use of org.openkilda.model.IpSocketAddress in project open-kilda by telstra.
the class InMemoryGraphBasedTest method createTestSwitch.
protected Switch createTestSwitch(SwitchId switchId) {
Switch sw = Switch.builder().switchId(switchId).description("test_description").socketAddress(new IpSocketAddress("10.0.0.1", 30070)).controller("test_ctrl").hostname("test_host_" + switchId).status(SwitchStatus.ACTIVE).build();
repositoryFactory.createSwitchRepository().add(sw);
return sw;
}
use of org.openkilda.model.IpSocketAddress in project open-kilda by telstra.
the class SpeakerStatsRequesterBoltTest method requestGrpcStatsForNoviflowSwitchesTest.
@Test
public void requestGrpcStatsForNoviflowSwitchesTest() {
KildaFeatureToggles featureToggles = new KildaFeatureToggles(KildaFeatureToggles.DEFAULTS);
featureToggles.setCollectGrpcStats(true);
String address = "192.168.1.1";
Switch sw = Switch.builder().switchId(new SwitchId(1)).socketAddress(new IpSocketAddress(address, 20)).build();
sw.setOfDescriptionSoftware("NW500.1.1");
when(switchRepository.findActive()).thenReturn(Collections.singleton(sw));
when(featureTogglesRepository.getOrDefault()).thenReturn(featureToggles);
StatsRequesterBolt statsRequesterBolt = new StatsRequesterBolt(persistenceManager, ZooKeeperSpout.SPOUT_ID);
statsRequesterBolt.prepare(Collections.emptyMap(), topologyContext, output);
statsRequesterBolt.execute(startTuple);
verify(output).emit(eq(ZkStreams.ZK.toString()), any(Tuple.class), anyList());
statsRequesterBolt.execute(input);
ArgumentCaptor<Values> values = ArgumentCaptor.forClass(Values.class);
verify(output, times(1)).emit(eq(STATS_REQUEST_STREAM), any(Tuple.class), anyList());
verify(output, times(1)).emit(eq(GRPC_REQUEST_STREAM), any(Tuple.class), values.capture());
Values capturedValues = values.getValue();
assertTrue(capturedValues.get(0) instanceof CommandMessage);
CommandMessage commandMessage = (CommandMessage) capturedValues.get(0);
assertTrue(commandMessage.getData() instanceof GetPacketInOutStatsRequest);
GetPacketInOutStatsRequest request = (GetPacketInOutStatsRequest) commandMessage.getData();
assertEquals(address, request.getAddress());
}
Aggregations