use of org.openkilda.floodlight.service.CommandProcessorService in project open-kilda by telstra.
the class PathVerificationPacketInTest method setUp.
@Before
public void setUp() throws Exception {
super.setUp();
cntx = new FloodlightContext();
mockFloodlightProvider = getMockFloodlightProvider();
swFeatures = factory.buildFeaturesReply().setNBuffers(1000).build();
swDescription = factory.buildDescStatsReply().build();
FloodlightModuleContext fmc = new FloodlightModuleContext();
fmc.addService(IFloodlightProviderService.class, mockFloodlightProvider);
fmc.addService(IOFSwitchService.class, getMockSwitchService());
fmc.addService(InputService.class, inputService);
fmc.addService(IKafkaProducerService.class, producerService);
fmc.addService(FeatureDetectorService.class, featureDetectorService);
KildaCore kildaCore = EasyMock.createMock(KildaCore.class);
fmc.addService(CommandProcessorService.class, new CommandProcessorService(kildaCore, commandContextFactory));
inputService.setup(fmc);
OFPacketIn.Builder packetInBuilder = factory.buildPacketIn();
packetInBuilder.setMatch(factory.buildMatch().setExact(MatchField.IN_PORT, OFPort.of(1)).build()).setData(pkt).setReason(OFPacketInReason.NO_MATCH);
pktIn = packetInBuilder.build();
System.out.print(Hex.encodeHexString(pktIn.getData()));
pvs = new PathVerificationService();
fmc.addConfigParam(pvs, "isl_bandwidth_quotient", "0.0");
fmc.addConfigParam(pvs, "hmac256-secret", "secret");
fmc.addConfigParam(pvs, "bootstrap-servers", "");
pvs.init(fmc);
srcIpTarget = new InetSocketAddress("192.168.10.1", 200);
dstIpTarget = new InetSocketAddress("192.168.10.101", 100);
sw1HwAddrTarget = "11:22:33:44:55:66";
sw2HwAddrTarget = "AA:BB:CC:DD:EE:FF";
OFPortDesc sw1Port1 = EasyMock.createMock(OFPortDesc.class);
expect(sw1Port1.getHwAddr()).andReturn(MacAddress.of(sw1HwAddrTarget)).anyTimes();
expect(sw1Port1.getVersion()).andReturn(OFVersion.OF_12).anyTimes();
expect(sw1Port1.getCurrSpeed()).andReturn(100000L).anyTimes();
OFPortDesc sw2Port1 = EasyMock.createMock(OFPortDesc.class);
expect(sw2Port1.getHwAddr()).andReturn(MacAddress.of(sw2HwAddrTarget)).anyTimes();
expect(sw2Port1.getVersion()).andReturn(OFVersion.OF_12).anyTimes();
expect(sw2Port1.getCurrSpeed()).andReturn(400000L).anyTimes();
replay(sw1Port1);
replay(sw2Port1);
sw1 = buildMockIoFSwitch(1L, sw1Port1, factory, swDescription, srcIpTarget);
sw2 = buildMockIoFSwitch(2L, sw2Port1, factory, swDescription, dstIpTarget);
replay(sw1);
replay(sw2);
}
Aggregations