use of org.projectfloodlight.openflow.protocol.match.Match in project open-kilda by telstra.
the class SwitchManager method buildIntermediateIngressRule.
@Override
public OFFlowMod buildIntermediateIngressRule(DatapathId dpid, int port) throws SwitchNotFoundException {
IOFSwitch sw = lookupSwitch(dpid);
OFFactory ofFactory = sw.getOFFactory();
Match match = buildInPortMatch(port, ofFactory);
OFInstructionGotoTable goToTable = ofFactory.instructions().gotoTable(TableId.of(PRE_INGRESS_TABLE_ID));
return prepareFlowModBuilder(ofFactory, Cookie.encodeIngressRulePassThrough(port), INGRESS_CUSTOMER_PORT_RULE_PRIORITY_MULTITABLE, INPUT_TABLE_ID).setMatch(match).setInstructions(ImmutableList.of(goToTable)).build();
}
use of org.projectfloodlight.openflow.protocol.match.Match 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.projectfloodlight.openflow.protocol.match.Match in project open-kilda by telstra.
the class SwitchManager method removeIntermediateIngressRule.
@Override
public long removeIntermediateIngressRule(DatapathId dpid, int port) throws SwitchOperationException {
IOFSwitch sw = lookupSwitch(dpid);
OFFactory ofFactory = sw.getOFFactory();
OFFlowDelete.Builder builder = ofFactory.buildFlowDelete();
long cookie = Cookie.encodeIngressRulePassThrough(port);
builder.setCookie(U64.of(cookie));
builder.setCookieMask(U64.NO_MASK);
Match match = buildInPortMatch(port, ofFactory);
builder.setMatch(match);
OFInstructionGotoTable goToTable = ofFactory.instructions().gotoTable(TableId.of(PRE_INGRESS_TABLE_ID));
builder.setInstructions(ImmutableList.of(goToTable));
builder.setPriority(INGRESS_CUSTOMER_PORT_RULE_PRIORITY_MULTITABLE);
removeFlowByOfFlowDelete(dpid, INPUT_TABLE_ID, builder.build());
return cookie;
}
use of org.projectfloodlight.openflow.protocol.match.Match in project open-kilda by telstra.
the class DropLoopFlowGenerator method generateFlow.
@Override
public SwitchFlowTuple generateFlow(IOFSwitch sw) {
OFFactory ofFactory = sw.getOFFactory();
if (ofFactory.getVersion() == OF_12) {
return SwitchFlowTuple.getEmpty();
}
Match.Builder builder = ofFactory.buildMatch();
builder.setExact(MatchField.ETH_DST, MacAddress.of(verificationBcastPacketDst));
builder.setExact(MatchField.ETH_SRC, convertDpIdToMac(sw.getId()));
Match match = builder.build();
OFFlowMod flowMod = prepareFlowModBuilder(ofFactory, DROP_VERIFICATION_LOOP_RULE_COOKIE, DROP_VERIFICATION_LOOP_RULE_PRIORITY, INPUT_TABLE_ID).setMatch(match).build();
return SwitchFlowTuple.builder().sw(sw).flow(flowMod).build();
}
use of org.projectfloodlight.openflow.protocol.match.Match in project open-kilda by telstra.
the class ArpInputPreDropFlowGenerator method getArpFlowMod.
@Override
public OFFlowMod getArpFlowMod(IOFSwitch sw, OFInstructionMeter meter, List<OFAction> actionList) {
OFFactory ofFactory = sw.getOFFactory();
Match match = ofFactory.buildMatch().setExact(MatchField.ETH_TYPE, EthType.ARP).build();
actionList.add(actionSendToController(sw.getOFFactory()));
OFInstructionApplyActions actions = ofFactory.instructions().applyActions(actionList).createBuilder().build();
return prepareFlowModBuilder(ofFactory, getCookie(), ARP_INPUT_PRE_DROP_PRIORITY, INPUT_TABLE_ID).setMatch(match).setInstructions(meter != null ? ImmutableList.of(meter, actions) : ImmutableList.of(actions)).build();
}
Aggregations