use of org.openkilda.floodlight.model.OfInput in project open-kilda by telstra.
the class PingResponseCommandTest method skipByCookie.
@Test
public void skipByCookie() throws Exception {
replayAll();
OFFactory ofFactory = new OFFactoryVer13();
OFMessage message = ofFactory.buildPacketIn().setReason(OFPacketInReason.ACTION).setXid(1).setCookie(U64.of(PingService.OF_CATCH_RULE_COOKIE.hashCode() + 1)).build();
FloodlightContext floodlightContext = new FloodlightContext();
OfInput input = new OfInput(iofSwitch, message, floodlightContext);
PingResponseCommand command = makeCommand(input);
expectSkip(command);
}
use of org.openkilda.floodlight.model.OfInput in project open-kilda by telstra.
the class PathVerificationPacketSignTest method testSignPacketPositive.
@Test
public void testSignPacketPositive() throws Exception {
producerService.sendMessageAndTrackWithZk(anyObject(), anyObject(), anyObject(Message.class));
expectLastCall().times(2);
replay(producerService);
pvs.handlePacketIn(new OfInput(sw2, ofPacketIn, context));
verify(producerService);
}
use of org.openkilda.floodlight.model.OfInput in project open-kilda by telstra.
the class PathVerificationPacketSignTest method testSignPacketInvalidSign.
@Test
public void testSignPacketInvalidSign() throws FloodlightModuleException {
replay(producerService);
pvs.initAlgorithm("secret2");
pvs.handlePacketIn(new OfInput(sw2, ofPacketIn, context));
verify(producerService);
}
use of org.openkilda.floodlight.model.OfInput in project open-kilda by telstra.
the class PathVerificationPacketSignTest method testInputSwitchNotFound.
@Test
public void testInputSwitchNotFound() {
producerService.sendMessageAndTrack(anyObject(), anyObject(), anyObject(Message.class));
expectLastCall().andAnswer((IAnswer) () -> {
Assert.fail();
return null;
}).anyTimes();
replay(producerService);
IOFSwitch sw = buildMockIoFSwitch(13L, null, factory, swDescription, dstIpTarget);
replay(sw);
pvs.handlePacketIn(new OfInput(sw, ofPacketIn, context));
}
use of org.openkilda.floodlight.model.OfInput in project open-kilda by telstra.
the class InputService method receive.
@Override
@NewCorrelationContextRequired
public Command receive(IOFSwitch sw, OFMessage message, FloodlightContext context) {
// must be constructed as early as possible
final OfInput input = new OfInput(sw, message, context);
final String packetIdentity = String.format("(dpId: %s, xId: %s, version: %s, type: %s)", sw.getId(), message.getXid(), message.getVersion(), message.getType());
log.debug("{} - receive message {}", getClass().getCanonicalName(), packetIdentity);
try {
handle(input);
} catch (Exception e) {
log.error(String.format("Unhandled exception during processing %s", packetIdentity), e);
}
return Command.CONTINUE;
}
Aggregations