use of org.openkilda.floodlight.utils.metadata.RoutingMetadata 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)));
}
use of org.openkilda.floodlight.utils.metadata.RoutingMetadata 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)));
}
use of org.openkilda.floodlight.utils.metadata.RoutingMetadata in project open-kilda by telstra.
the class IngressFlowModFactory method makeDoubleVlanForwardMessage.
/**
* Make rule to match inner VLAN tag and forward in in ISL (or out port in case one-switch flow).
*/
public OFFlowMod makeDoubleVlanForwardMessage(EffectiveIds effectiveIds) {
FlowEndpoint endpoint = command.getEndpoint();
RoutingMetadata metadata = RoutingMetadata.builder().outerVlanId(endpoint.getOuterVlanId()).build(switchFeatures);
OFFlowMod.Builder builder = flowModBuilderFactory.makeBuilder(of, TableId.of(SwitchManager.INGRESS_TABLE_ID), 10).setMatch(of.buildMatch().setExact(MatchField.IN_PORT, OFPort.of(endpoint.getPortNumber())).setExact(MatchField.VLAN_VID, OFVlanVidMatch.ofVlan(endpoint.getInnerVlanId())).setMasked(MatchField.METADATA, OFMetadata.of(metadata.getValue()), OFMetadata.of(metadata.getMask())).build());
return makeForwardMessage(builder, effectiveIds, FlowEndpoint.makeVlanStack(endpoint.getInnerVlanId()));
}
use of org.openkilda.floodlight.utils.metadata.RoutingMetadata in project open-kilda by telstra.
the class IngressFlowModFactory method makeDoubleVlanFlowLoopMessage.
/**
* Make ingress flow loop rule to match all flow traffic by port and two vlans and route it back to port from
* where it came and restore vlan stack.
*/
public OFFlowMod makeDoubleVlanFlowLoopMessage() {
FlowEndpoint endpoint = command.getEndpoint();
RoutingMetadata metadata = RoutingMetadata.builder().outerVlanId(endpoint.getOuterVlanId()).build(switchFeatures);
return flowModBuilderFactory.makeBuilder(of, TableId.of(SwitchManager.INGRESS_TABLE_ID), 10).setMatch(of.buildMatch().setExact(MatchField.IN_PORT, OFPort.of(endpoint.getPortNumber())).setExact(MatchField.VLAN_VID, OFVlanVidMatch.ofVlan(endpoint.getInnerVlanId())).setMasked(MatchField.METADATA, OFMetadata.of(metadata.getValue()), OFMetadata.of(metadata.getMask())).build()).setCookie(U64.of(command.getCookie().getValue())).setInstructions(makeIngressFlowLoopInstructions(endpoint)).build();
}
use of org.openkilda.floodlight.utils.metadata.RoutingMetadata in project open-kilda by telstra.
the class IngressFlowModFactory method makeSingleVlanServer42IngressFlowMessage.
/**
* Make rule to forward server 42 traffic matched by outer VLAN tag and forward in in ISL.
*/
public OFFlowMod makeSingleVlanServer42IngressFlowMessage() {
RoutingMetadata metadata = buildServer42IngressMetadata();
OFFlowMod.Builder builder = flowModBuilderFactory.makeBuilder(of, TableId.of(SwitchManager.INGRESS_TABLE_ID)).setMatch(of.buildMatch().setExact(MatchField.IN_PORT, OFPort.of(command.getRulesContext().getServer42Port())).setMasked(MatchField.METADATA, OFMetadata.of(metadata.getValue()), OFMetadata.of(metadata.getMask())).build());
return makeServer42IngressFlowMessage(builder, Collections.emptyList());
}
Aggregations