use of org.openkilda.floodlight.utils.metadata.RoutingMetadata in project open-kilda by telstra.
the class IngressFlowLoopSegmentInstallCommandTest method assertMetadata.
private void assertMetadata(Match match, int expectedOuterVlan) {
RoutingMetadataBuilder metadataBuilder = RoutingMetadata32.builder();
metadataBuilder.outerVlanId(expectedOuterVlan);
RoutingMetadata metadata = metadataBuilder.build(FEATURES);
assertEquals(metadata.getValue(), match.getMasked(MatchField.METADATA).getValue().getValue());
assertEquals(metadata.getMask(), match.getMasked(MatchField.METADATA).getMask().getValue());
}
use of org.openkilda.floodlight.utils.metadata.RoutingMetadata in project open-kilda by telstra.
the class SwitchManager method installOuterVlanMatchSharedFlow.
@Override
public void installOuterVlanMatchSharedFlow(SwitchId switchId, String flowId, FlowSharedSegmentCookie cookie) throws SwitchOperationException {
IOFSwitch sw = lookupSwitch(DatapathId.of(switchId.toLong()));
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).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, flowId, flow);
}
use of org.openkilda.floodlight.utils.metadata.RoutingMetadata in project open-kilda by telstra.
the class SwitchManager method buildLldpInputCustomerFlow.
@Override
public OFFlowMod buildLldpInputCustomerFlow(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.LLDP).build();
RoutingMetadata metadata = buildMetadata(RoutingMetadata.builder().lldpFlag(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.encodeLldpInputCustomer(port), LLDP_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 ArpPostIngressOneSwitchFlowGenerator method getArpFlowMod.
@Override
OFFlowMod getArpFlowMod(IOFSwitch sw, OFInstructionMeter meter, List<OFAction> actionList) {
OFFactory ofFactory = sw.getOFFactory();
RoutingMetadata metadata = makeMetadataMatch(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, ARP_POST_INGRESS_ONE_SWITCH_COOKIE, ARP_POST_INGRESS_ONE_SWITCH_PRIORITY, POST_INGRESS_TABLE_ID).setMatch(match).setInstructions(meter != null ? ImmutableList.of(meter, actions) : ImmutableList.of(actions)).build();
}
Aggregations