Search in sources :

Example 1 with OfInput

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);
}
Also used : OfInput(org.openkilda.floodlight.model.OfInput) OFMessage(org.projectfloodlight.openflow.protocol.OFMessage) OFFactoryVer13(org.projectfloodlight.openflow.protocol.ver13.OFFactoryVer13) OFFactory(org.projectfloodlight.openflow.protocol.OFFactory) FloodlightContext(net.floodlightcontroller.core.FloodlightContext) Test(org.junit.Test)

Example 2 with OfInput

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);
}
Also used : OfInput(org.openkilda.floodlight.model.OfInput) Message(org.openkilda.messaging.Message) Test(org.junit.Test)

Example 3 with OfInput

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);
}
Also used : OfInput(org.openkilda.floodlight.model.OfInput) Test(org.junit.Test)

Example 4 with OfInput

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));
}
Also used : OfInput(org.openkilda.floodlight.model.OfInput) IAnswer(org.easymock.IAnswer) IOFSwitch(net.floodlightcontroller.core.IOFSwitch) Message(org.openkilda.messaging.Message) Test(org.junit.Test)

Example 5 with OfInput

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;
}
Also used : OfInput(org.openkilda.floodlight.model.OfInput) NewCorrelationContextRequired(org.openkilda.floodlight.utils.NewCorrelationContextRequired)

Aggregations

OfInput (org.openkilda.floodlight.model.OfInput)8 Test (org.junit.Test)7 Ethernet (net.floodlightcontroller.packet.Ethernet)3 Message (org.openkilda.messaging.Message)3 FloodlightContext (net.floodlightcontroller.core.FloodlightContext)2 IPacket (net.floodlightcontroller.packet.IPacket)2 OFFactory (org.projectfloodlight.openflow.protocol.OFFactory)2 OFMessage (org.projectfloodlight.openflow.protocol.OFMessage)2 OFFactoryVer13 (org.projectfloodlight.openflow.protocol.ver13.OFFactoryVer13)2 IOFSwitch (net.floodlightcontroller.core.IOFSwitch)1 IAnswer (org.easymock.IAnswer)1 PingData (org.openkilda.floodlight.model.PingData)1 PathVerificationService (org.openkilda.floodlight.pathverification.PathVerificationService)1 InputService (org.openkilda.floodlight.service.of.InputService)1 PingService (org.openkilda.floodlight.service.ping.PingService)1 ISwitchManager (org.openkilda.floodlight.switchmanager.ISwitchManager)1 SwitchManager (org.openkilda.floodlight.switchmanager.SwitchManager)1 NewCorrelationContextRequired (org.openkilda.floodlight.utils.NewCorrelationContextRequired)1 PingResponse (org.openkilda.messaging.floodlight.response.PingResponse)1 InfoMessage (org.openkilda.messaging.info.InfoMessage)1