use of org.openkilda.floodlight.utils.metadata.RoutingMetadata in project open-kilda by telstra.
the class IngressFlowModFactory method makeDoubleVlanServer42IngressFlowMessage.
/**
* Make rule to match server 42 packets by inner VLAN tag and forward in in ISL.
*/
public OFFlowMod makeDoubleVlanServer42IngressFlowMessage() {
FlowEndpoint endpoint = command.getEndpoint();
RoutingMetadata metadata = buildServer42IngressMetadata();
OFFlowMod.Builder builder = flowModBuilderFactory.makeBuilder(of, TableId.of(SwitchManager.INGRESS_TABLE_ID), SERVER_42_INGRESS_DOUBLE_VLAN_FLOW_PRIORITY_OFFSET).setMatch(of.buildMatch().setExact(MatchField.IN_PORT, OFPort.of(getCommand().getRulesContext().getServer42Port())).setExact(MatchField.VLAN_VID, OFVlanVidMatch.ofVlan(endpoint.getInnerVlanId())).setMasked(MatchField.METADATA, OFMetadata.of(metadata.getValue()), OFMetadata.of(metadata.getMask())).build());
return makeServer42IngressFlowMessage(builder, FlowEndpoint.makeVlanStack(endpoint.getInnerVlanId()));
}
use of org.openkilda.floodlight.utils.metadata.RoutingMetadata in project open-kilda by telstra.
the class OneSwitchFlowInstallFlowModFactory method makeMetadataInstructions.
@Override
protected List<OFInstruction> makeMetadataInstructions() {
RoutingMetadata metadata = RoutingMetadata.builder().oneSwitchFlowFlag(true).build(switchFeatures);
OFInstructionWriteMetadata writeMetadata = of.instructions().buildWriteMetadata().setMetadata(metadata.getValue()).setMetadataMask(metadata.getMask()).build();
return Lists.newArrayList(writeMetadata);
}
use of org.openkilda.floodlight.utils.metadata.RoutingMetadata in project open-kilda by telstra.
the class SwitchManager method installServer42OuterVlanMatchSharedFlow.
@Override
public void installServer42OuterVlanMatchSharedFlow(DatapathId dpid, FlowSharedSegmentCookie cookie) throws SwitchOperationException {
IOFSwitch sw = lookupSwitch(dpid);
OFFactory of = sw.getOFFactory();
RoutingMetadata metadata = RoutingMetadata.builder().outerVlanId(cookie.getVlanId()).build(featureDetectorService.detectSwitch(sw));
ImmutableList<OFInstruction> instructions = ImmutableList.of(of.instructions().applyActions(ImmutableList.of(of.actions().popVlan())), of.instructions().writeMetadata(metadata.getValue(), metadata.getMask()), of.instructions().gotoTable(TableId.of(SwitchManager.INGRESS_TABLE_ID)));
OFFlowMod flow = prepareFlowModBuilder(of, cookie.getValue(), FLOW_PRIORITY, PRE_INGRESS_TABLE_ID).setCookie(U64.of(cookie.getValue())).setMatch(of.buildMatch().setExact(MatchField.IN_PORT, OFPort.of(cookie.getPortNumber())).setExact(MatchField.VLAN_VID, OFVlanVidMatch.ofVlan(cookie.getVlanId())).build()).setInstructions(instructions).build();
pushFlow(sw, "--server 42 shared rule--", flow);
}
use of org.openkilda.floodlight.utils.metadata.RoutingMetadata in project open-kilda by telstra.
the class SwitchManager method buildArpInputCustomerFlow.
@Override
public OFFlowMod buildArpInputCustomerFlow(DatapathId dpid, int port) throws SwitchNotFoundException {
IOFSwitch sw = lookupSwitch(dpid);
OFFactory ofFactory = sw.getOFFactory();
Match match = ofFactory.buildMatch().setExact(MatchField.IN_PORT, OFPort.of(port)).setExact(MatchField.ETH_TYPE, EthType.ARP).build();
RoutingMetadata metadata = buildMetadata(RoutingMetadata.builder().arpFlag(true), sw);
OFInstructionWriteMetadata writeMetadata = ofFactory.instructions().buildWriteMetadata().setMetadata(metadata.getValue()).setMetadataMask(metadata.getMask()).build();
OFInstructionGotoTable goToTable = ofFactory.instructions().gotoTable(TableId.of(PRE_INGRESS_TABLE_ID));
return prepareFlowModBuilder(ofFactory, Cookie.encodeArpInputCustomer(port), ARP_INPUT_CUSTOMER_PRIORITY, INPUT_TABLE_ID).setMatch(match).setInstructions(ImmutableList.of(goToTable, writeMetadata)).build();
}
use of org.openkilda.floodlight.utils.metadata.RoutingMetadata in project open-kilda by telstra.
the class LldpPostIngressFlowGenerator method getLldpFlowMod.
@Override
OFFlowMod getLldpFlowMod(IOFSwitch sw, OFInstructionMeter meter, List<OFAction> actionList) {
OFFactory ofFactory = sw.getOFFactory();
RoutingMetadata metadata = buildMetadata(RoutingMetadata.builder().lldpFlag(true), sw);
Match match = ofFactory.buildMatch().setMasked(MatchField.METADATA, OFMetadata.of(metadata.getValue()), OFMetadata.of(metadata.getMask())).build();
actionList.add(actionSendToController(sw.getOFFactory()));
OFInstructionApplyActions actions = ofFactory.instructions().applyActions(actionList).createBuilder().build();
return prepareFlowModBuilder(ofFactory, LLDP_POST_INGRESS_COOKIE, LLDP_POST_INGRESS_PRIORITY, POST_INGRESS_TABLE_ID).setMatch(match).setInstructions(meter != null ? ImmutableList.of(meter, actions) : ImmutableList.of(actions)).build();
}
Aggregations