Search in sources :

Example 1 with IngressFlowSegmentBase

use of org.openkilda.floodlight.command.flow.ingress.IngressFlowSegmentBase in project open-kilda by telstra.

the class IngressFlowModFactoryTest method makeOuterVlanMatchSharedMessage.

// --- makeOuterVlanMatchSharedMessage
@Test
public void makeOuterVlanMatchSharedMessage() {
    final IngressFlowModFactory factory = makeFactory();
    final IngressFlowSegmentBase command = factory.getCommand();
    final FlowEndpoint endpoint = command.getEndpoint();
    RoutingMetadata metadata = RoutingMetadata.builder().outerVlanId(endpoint.getOuterVlanId()).build(Collections.emptySet());
    OFFlowAdd expected = of.buildFlowAdd().setTableId(getTargetPreIngressTableId()).setPriority(FlowSegmentCommand.FLOW_PRIORITY).setCookie(U64.of(FlowSharedSegmentCookie.builder(SharedSegmentType.QINQ_OUTER_VLAN).portNumber(endpoint.getPortNumber()).vlanId(endpoint.getOuterVlanId()).build().getValue())).setMatch(OfAdapter.INSTANCE.matchVlanId(of, of.buildMatch(), endpoint.getOuterVlanId()).setExact(MatchField.IN_PORT, OFPort.of(endpoint.getPortNumber())).build()).setInstructions(ImmutableList.of(of.instructions().applyActions(Collections.singletonList(of.actions().popVlan())), of.instructions().writeMetadata(metadata.getValue(), metadata.getMask()), of.instructions().gotoTable(TableId.of(SwitchManager.INGRESS_TABLE_ID)))).build();
    verifyOfMessageEquals(expected, factory.makeOuterVlanMatchSharedMessage());
}
Also used : FlowEndpoint(org.openkilda.model.FlowEndpoint) IngressFlowSegmentBase(org.openkilda.floodlight.command.flow.ingress.IngressFlowSegmentBase) RoutingMetadata(org.openkilda.floodlight.utils.metadata.RoutingMetadata) OFFlowAdd(org.projectfloodlight.openflow.protocol.OFFlowAdd) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 IngressFlowSegmentBase (org.openkilda.floodlight.command.flow.ingress.IngressFlowSegmentBase)1 RoutingMetadata (org.openkilda.floodlight.utils.metadata.RoutingMetadata)1 FlowEndpoint (org.openkilda.model.FlowEndpoint)1 OFFlowAdd (org.projectfloodlight.openflow.protocol.OFFlowAdd)1