Search in sources :

Example 1 with EffectiveIds

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

the class IngressServer42FlowInstallCommandTest method server42IngressFlowDefaultSingleTableVlan.

@Test
public void server42IngressFlowDefaultSingleTableVlan() throws Exception {
    IngressServer42FlowInstallCommand command = createCommand(0, 0, VLAN_ENCAPSULATION, false);
    OFFlowMod mod = assertModCountAndReturnMod(command.makeFlowModMessages(new EffectiveIds()));
    assertCommonSingleTable(mod);
    assertEquals(5, stream(mod.getMatch().getMatchFields().spliterator(), false).count());
    assertNull(mod.getMatch().get(MatchField.VLAN_VID));
    List<OFAction> applyActions = ((OFInstructionApplyActions) mod.getInstructions().get(0)).getActions();
    assertEquals(7, applyActions.size());
    assertSetField(applyActions.get(0), OFOxmEthSrc.class, MacAddress.of(INGRESS_SWITCH_ID.toMacAddress()));
    assertSetField(applyActions.get(1), OFOxmEthDst.class, MacAddress.of(EGRESS_SWITCH_ID.toMacAddress()));
    assertSetField(applyActions.get(2), OFOxmUdpSrc.class, TransportPort.of(SERVER_42_FLOW_RTT_FORWARD_UDP_PORT));
    assertSetField(applyActions.get(3), OFOxmUdpDst.class, TransportPort.of(SERVER_42_FLOW_RTT_FORWARD_UDP_PORT));
    assertPushVlanAction(applyActions.get(4));
    assertSetField(applyActions.get(5), OFOxmVlanVid.class, OFVlanVidMatch.ofVlan(VLAN_ENCAPSULATION.getId()));
    assertOutputAction(applyActions.get(6));
}
Also used : OFInstructionApplyActions(org.projectfloodlight.openflow.protocol.instruction.OFInstructionApplyActions) EffectiveIds(org.openkilda.floodlight.model.EffectiveIds) OFAction(org.projectfloodlight.openflow.protocol.action.OFAction) OFFlowMod(org.projectfloodlight.openflow.protocol.OFFlowMod) Test(org.junit.Test)

Example 2 with EffectiveIds

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

the class IngressServer42FlowInstallCommandTest method server42IngressFlowSingleTagSingleTableVlan.

@Test
public void server42IngressFlowSingleTagSingleTableVlan() throws Exception {
    IngressServer42FlowInstallCommand command = createCommand(VLAN_1, 0, VLAN_ENCAPSULATION, false);
    OFFlowMod mod = assertModCountAndReturnMod(command.makeFlowModMessages(new EffectiveIds()));
    assertCommonSingleTable(mod);
    assertEquals(6, stream(mod.getMatch().getMatchFields().spliterator(), false).count());
    assertEquals(VLAN_1, mod.getMatch().get(MatchField.VLAN_VID).getVlan());
    List<OFAction> applyActions = ((OFInstructionApplyActions) mod.getInstructions().get(0)).getActions();
    assertEquals(6, applyActions.size());
    assertSetField(applyActions.get(0), OFOxmEthSrc.class, MacAddress.of(INGRESS_SWITCH_ID.toMacAddress()));
    assertSetField(applyActions.get(1), OFOxmEthDst.class, MacAddress.of(EGRESS_SWITCH_ID.toMacAddress()));
    assertSetField(applyActions.get(2), OFOxmUdpSrc.class, TransportPort.of(SERVER_42_FLOW_RTT_FORWARD_UDP_PORT));
    assertSetField(applyActions.get(3), OFOxmUdpDst.class, TransportPort.of(SERVER_42_FLOW_RTT_FORWARD_UDP_PORT));
    assertSetField(applyActions.get(4), OFOxmVlanVid.class, OFVlanVidMatch.ofVlan(VLAN_ENCAPSULATION.getId()));
    assertOutputAction(applyActions.get(5));
}
Also used : OFInstructionApplyActions(org.projectfloodlight.openflow.protocol.instruction.OFInstructionApplyActions) EffectiveIds(org.openkilda.floodlight.model.EffectiveIds) OFAction(org.projectfloodlight.openflow.protocol.action.OFAction) OFFlowMod(org.projectfloodlight.openflow.protocol.OFFlowMod) Test(org.junit.Test)

Example 3 with EffectiveIds

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

the class IngressServer42FlowInstallCommandTest method server42IngressFlowDefaultSingleTableVxlan.

@Test
public void server42IngressFlowDefaultSingleTableVxlan() throws Exception {
    IngressServer42FlowInstallCommand command = createCommand(0, 0, VXLAN_ENCAPSULATION, false);
    OFFlowMod mod = assertModCountAndReturnMod(command.makeFlowModMessages(new EffectiveIds()));
    assertCommonSingleTable(mod);
    assertEquals(5, stream(mod.getMatch().getMatchFields().spliterator(), false).count());
    assertNull(mod.getMatch().get(MatchField.VLAN_VID));
    List<OFAction> applyActions = ((OFInstructionApplyActions) mod.getInstructions().get(0)).getActions();
    assertEquals(2, applyActions.size());
    assertPushVxlanAction(applyActions.get(0));
    assertOutputAction(applyActions.get(1));
}
Also used : OFInstructionApplyActions(org.projectfloodlight.openflow.protocol.instruction.OFInstructionApplyActions) EffectiveIds(org.openkilda.floodlight.model.EffectiveIds) OFAction(org.projectfloodlight.openflow.protocol.action.OFAction) OFFlowMod(org.projectfloodlight.openflow.protocol.OFFlowMod) Test(org.junit.Test)

Example 4 with EffectiveIds

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

the class OneSwitchFlowInstallFlowModFactoryTest method testMakeDoubleVlanForwardMessageVlanEncoded.

private void testMakeDoubleVlanForwardMessageVlanEncoded(MeterConfig meter) {
    OneSwitchFlowInstallCommand command = makeCommand(endpointDoubleVlan, egressEndpointDoubleVlan, meter);
    FlowEndpoint endpoint = command.getEndpoint();
    RoutingMetadata metadata = RoutingMetadata.builder().outerVlanId(endpoint.getOuterVlanId()).build(Collections.emptySet());
    OFFlowAdd expected = makeForwardingMessage(command, 10, OfAdapter.INSTANCE.matchVlanId(of, of.buildMatch(), endpoint.getInnerVlanId()).setExact(MatchField.IN_PORT, OFPort.of(endpoint.getPortNumber())).setMasked(MatchField.METADATA, OFMetadata.of(metadata.getValue()), OFMetadata.of(metadata.getMask())).build(), getTargetIngressTableId(), FlowEndpoint.makeVlanStack(endpoint.getInnerVlanId()));
    IngressFlowModFactory factory = makeFactory(command);
    verifyOfMessageEquals(expected, factory.makeDoubleVlanForwardMessage(new EffectiveIds(getEffectiveMeterId(command.getMeterConfig()), null)));
}
Also used : FlowEndpoint(org.openkilda.model.FlowEndpoint) EffectiveIds(org.openkilda.floodlight.model.EffectiveIds) OneSwitchFlowInstallCommand(org.openkilda.floodlight.command.flow.ingress.OneSwitchFlowInstallCommand) RoutingMetadata(org.openkilda.floodlight.utils.metadata.RoutingMetadata) OFFlowAdd(org.projectfloodlight.openflow.protocol.OFFlowAdd)

Example 5 with EffectiveIds

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

the class OneSwitchFlowInstallFlowModFactoryTest method testMakeSingleVlanForwardMessage.

private void testMakeSingleVlanForwardMessage(MeterConfig meter) {
    OneSwitchFlowInstallCommand command = makeCommand(endpointSingleVlan, egressEndpointSingleVlan, meter);
    FlowEndpoint endpoint = command.getEndpoint();
    RoutingMetadata metadata = RoutingMetadata.builder().outerVlanId(endpoint.getOuterVlanId()).build(Collections.emptySet());
    OFFlowAdd expected = makeForwardingMessage(command, 0, of.buildMatch().setExact(MatchField.IN_PORT, OFPort.of(endpoint.getPortNumber())).setMasked(MatchField.METADATA, OFMetadata.of(metadata.getValue()), OFMetadata.of(metadata.getMask())).build(), getTargetIngressTableId(), FlowEndpoint.makeVlanStack(endpoint.getInnerVlanId()));
    IngressFlowModFactory factory = makeFactory(command);
    verifyOfMessageEquals(expected, factory.makeSingleVlanForwardMessage(new EffectiveIds(getEffectiveMeterId(command.getMeterConfig()), null)));
}
Also used : FlowEndpoint(org.openkilda.model.FlowEndpoint) EffectiveIds(org.openkilda.floodlight.model.EffectiveIds) OneSwitchFlowInstallCommand(org.openkilda.floodlight.command.flow.ingress.OneSwitchFlowInstallCommand) RoutingMetadata(org.openkilda.floodlight.utils.metadata.RoutingMetadata) OFFlowAdd(org.projectfloodlight.openflow.protocol.OFFlowAdd)

Aggregations

EffectiveIds (org.openkilda.floodlight.model.EffectiveIds)45 Test (org.junit.Test)24 OFAction (org.projectfloodlight.openflow.protocol.action.OFAction)21 OFFlowMod (org.projectfloodlight.openflow.protocol.OFFlowMod)15 OFInstructionApplyActions (org.projectfloodlight.openflow.protocol.instruction.OFInstructionApplyActions)15 OFFlowAdd (org.projectfloodlight.openflow.protocol.OFFlowAdd)12 FlowEndpoint (org.openkilda.model.FlowEndpoint)9 IngressFlowSegmentInstallCommand (org.openkilda.floodlight.command.flow.ingress.IngressFlowSegmentInstallCommand)8 RoutingMetadata (org.openkilda.floodlight.utils.metadata.RoutingMetadata)6 FlowSegmentReport (org.openkilda.floodlight.command.flow.FlowSegmentReport)5 SwitchErrorResponseException (org.openkilda.floodlight.error.SwitchErrorResponseException)3 OneSwitchFlowInstallCommand (org.openkilda.floodlight.command.flow.ingress.OneSwitchFlowInstallCommand)2 UnsupportedSwitchOperationException (org.openkilda.floodlight.error.UnsupportedSwitchOperationException)2