Search in sources :

Example 1 with OFFactoryVer12Mock

use of org.openkilda.floodlight.OFFactoryVer12Mock in project open-kilda by telstra.

the class SwitchManagerOF12Test method installTransitFlow.

@Test
public void installTransitFlow() throws Exception {
    Capture<OFFlowMod> capture = prepareForInstallFlowOperation();
    String flowId = "test-transit-flow-rule";
    int inputPort = 2;
    int outputPort = 4;
    int transitVlanId = 512;
    switchManager.installTransitFlow(switchDpId, flowId, commonFlowCookie, inputPort, outputPort, transitVlanId);
    OFFactory referenceOfFactory = new OFFactoryVer12Mock();
    OFFlowMod expected = referenceOfFactory.buildFlowAdd().setCookie(U64.of(commonFlowCookie).applyMask(U64.of(SwitchManager.FLOW_COOKIE_MASK))).setPriority(FlowModUtils.PRIORITY_VERY_HIGH).setMatch(referenceOfFactory.buildMatch().setExact(MatchField.IN_PORT, OFPort.of(inputPort)).setMasked(MatchField.VLAN_VID, OFVlanVidMatch.ofVlan(transitVlanId), OFVlanVidMatch.ofRawVid((short) 0x0FFF)).build()).setInstructions(singletonList(referenceOfFactory.instructions().applyActions(singletonList(referenceOfFactory.actions().buildOutput().setMaxLen(0xFFFFFFFF).setPort(OFPort.of(outputPort)).build())).createBuilder().build())).build();
    assertEquals(expected, capture.getValue());
}
Also used : OFFactory(org.projectfloodlight.openflow.protocol.OFFactory) OFFactoryVer12Mock(org.openkilda.floodlight.OFFactoryVer12Mock) OFFlowMod(org.projectfloodlight.openflow.protocol.OFFlowMod) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 OFFactoryVer12Mock (org.openkilda.floodlight.OFFactoryVer12Mock)1 OFFactory (org.projectfloodlight.openflow.protocol.OFFactory)1 OFFlowMod (org.projectfloodlight.openflow.protocol.OFFlowMod)1