本文整理汇总了Java中net.floodlightcontroller.util.FlowModUtils类的典型用法代码示例。如果您正苦于以下问题:Java FlowModUtils类的具体用法?Java FlowModUtils怎么用?Java FlowModUtils使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FlowModUtils类属于net.floodlightcontroller.util包,在下文中一共展示了FlowModUtils类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: installTransitFlow
import net.floodlightcontroller.util.FlowModUtils; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public ImmutablePair<Long, Boolean> installTransitFlow(final DatapathId dpid, final String flowId,
final Long cookie, final int inputPort, final int outputPort,
final int transitVlanId) {
List<OFAction> actionList = new ArrayList<>();
IOFSwitch sw = ofSwitchService.getSwitch(dpid);
// build match by input port and transit vlan id
Match match = matchFlow(sw, inputPort, transitVlanId);
// transmit packet from outgoing port
actionList.add(actionSetOutputPort(sw, outputPort));
// build instruction with action list
OFInstructionApplyActions actions = buildInstructionApplyActions(sw, actionList);
// build FLOW_MOD command, no meter
OFFlowMod flowMod = buildFlowMod(sw, match, null, actions,
cookie & FLOW_COOKIE_MASK, FlowModUtils.PRIORITY_VERY_HIGH);
// send FLOW_MOD to the switch
boolean response = pushFlow(flowId, dpid, flowMod);
return new ImmutablePair<>(flowMod.getXid(), response);
}
示例2: buildFlowMod
import net.floodlightcontroller.util.FlowModUtils; //导入依赖的package包/类
/**
* Create an OFFlowMod that can be passed to StaticEntryPusher.
*
* @param sw switch object
* @param match match for the flow
* @param meter meter for the flow
* @param actions actions for the flow
* @param cookie cookie for the flow
* @param priority priority to set on the flow
* @return {@link OFFlowMod}
*/
private OFFlowMod buildFlowMod(final IOFSwitch sw, final Match match, final OFInstructionMeter meter,
final OFInstructionApplyActions actions, final long cookie, final int priority) {
OFFlowMod.Builder fmb = sw.getOFFactory().buildFlowAdd();
fmb.setIdleTimeout(FlowModUtils.INFINITE_TIMEOUT);
fmb.setHardTimeout(FlowModUtils.INFINITE_TIMEOUT);
fmb.setBufferId(OFBufferId.NO_BUFFER);
fmb.setCookie(U64.of(cookie));
fmb.setPriority(priority);
List<OFInstruction> instructions = new ArrayList<>(2);
if (meter != null) { // If no meter then no bandwidth limit
instructions.add(meter);
}
if (actions != null) { // If no instruction then Drops packet
instructions.add(actions);
}
if (match != null) { // If no then match everything
fmb.setMatch(match);
}
return fmb.setInstructions(instructions).build();
}
示例3: installVerificationRule
import net.floodlightcontroller.util.FlowModUtils; //导入依赖的package包/类
/**
* Installs the verification rule
*
* @param dpid datapathId of switch
* @param isBroadcast if broadcast then set a generic match; else specific to switch Id
* @return true if the command is accepted to be sent to switch, false otherwise - switch is disconnected or in
* SLAVE mode
*/
private boolean installVerificationRule(final DatapathId dpid, final boolean isBroadcast) {
IOFSwitch sw = ofSwitchService.getSwitch(dpid);
Match match = matchVerification(sw, isBroadcast);
ArrayList<OFAction> actionList = new ArrayList<>(2);
actionList.add(actionSendToController(sw));
actionList.add(actionSetDstMac(sw, dpidToMac(sw)));
OFInstructionApplyActions instructionApplyActions = sw.getOFFactory().instructions()
.applyActions(actionList).createBuilder().build();
final long cookie = isBroadcast ? 0x8000000000000002L : 0x8000000000000003L;
OFFlowMod flowMod = buildFlowMod(sw, match, null, instructionApplyActions,
cookie, FlowModUtils.PRIORITY_VERY_HIGH);
String flowname = (isBroadcast) ? "Broadcast" : "Unicast";
flowname += "--VerificationFlow--" + dpid.toString();
return pushFlow(flowname, dpid, flowMod);
}
示例4: transitFlowMod
import net.floodlightcontroller.util.FlowModUtils; //导入依赖的package包/类
default OFFlowAdd transitFlowMod(int inputPort, int outputPort, int transitVlan, long cookie) {
return ofFactory.buildFlowAdd()
.setCookie(U64.of(cookie & FLOW_COOKIE_MASK))
.setHardTimeout(FlowModUtils.INFINITE_TIMEOUT)
.setIdleTimeout(FlowModUtils.INFINITE_TIMEOUT)
.setBufferId(OFBufferId.NO_BUFFER)
.setPriority(FlowModUtils.PRIORITY_VERY_HIGH)
.setMatch(ofFactory.buildMatch()
.setExact(MatchField.IN_PORT, OFPort.of(inputPort))
.setExact(MatchField.VLAN_VID, OFVlanVidMatch.ofVlan(transitVlan))
.build())
.setInstructions(singletonList(
ofFactory.instructions().applyActions(singletonList(
ofFactory.actions().buildOutput()
.setMaxLen(0xFFFFFFFF)
.setPort(OFPort.of(outputPort))
.build()))
.createBuilder()
.build()))
.setXid(0L)
.build();
}
示例5: oneSwitchNoneFlowMod
import net.floodlightcontroller.util.FlowModUtils; //导入依赖的package包/类
default OFFlowAdd oneSwitchNoneFlowMod(int inputPort, int outputPort, long meterId, long cookie) {
return ofFactory.buildFlowAdd()
.setCookie(U64.of(cookie & FLOW_COOKIE_MASK))
.setHardTimeout(FlowModUtils.INFINITE_TIMEOUT)
.setIdleTimeout(FlowModUtils.INFINITE_TIMEOUT)
.setBufferId(OFBufferId.NO_BUFFER)
.setPriority(FlowModUtils.PRIORITY_VERY_HIGH)
.setMatch(ofFactory.buildMatch()
.setExact(MatchField.IN_PORT, OFPort.of(inputPort))
.build())
.setInstructions(Arrays.asList(
ofFactory.instructions().buildMeter().setMeterId(meterId).build(),
ofFactory.instructions().applyActions(singletonList(
ofFactory.actions().buildOutput()
.setMaxLen(0xFFFFFFFF)
.setPort(OFPort.of(outputPort))
.build()))
.createBuilder()
.build()))
.setXid(0L)
.build();
}
示例6: oneSwitchPopFlowMod
import net.floodlightcontroller.util.FlowModUtils; //导入依赖的package包/类
default OFFlowAdd oneSwitchPopFlowMod(int inputPort, int outputPort, int inputVlan, long meterId, long cookie) {
return ofFactory.buildFlowAdd()
.setCookie(U64.of(cookie & FLOW_COOKIE_MASK))
.setHardTimeout(FlowModUtils.INFINITE_TIMEOUT)
.setIdleTimeout(FlowModUtils.INFINITE_TIMEOUT)
.setBufferId(OFBufferId.NO_BUFFER)
.setPriority(FlowModUtils.PRIORITY_VERY_HIGH)
.setMatch(ofFactory.buildMatch()
.setExact(MatchField.IN_PORT, OFPort.of(inputPort))
.setExact(MatchField.VLAN_VID, OFVlanVidMatch.ofVlan(inputVlan))
.build())
.setInstructions(Arrays.asList(
ofFactory.instructions().buildMeter().setMeterId(meterId).build(),
ofFactory.instructions().applyActions(Arrays.asList(
ofFactory.actions().popVlan(),
ofFactory.actions().buildOutput()
.setMaxLen(0xFFFFFFFF)
.setPort(OFPort.of(outputPort))
.build()))
.createBuilder()
.build()))
.setXid(0L)
.build();
}
示例7: egressPopFlowMod
import net.floodlightcontroller.util.FlowModUtils; //导入依赖的package包/类
@Override
public OFFlowAdd egressPopFlowMod(int inputPort, int outputPort, int transitVlan, long cookie) {
return ofFactory.buildFlowAdd()
.setCookie(U64.of(cookie & FLOW_COOKIE_MASK))
.setHardTimeout(FlowModUtils.INFINITE_TIMEOUT)
.setIdleTimeout(FlowModUtils.INFINITE_TIMEOUT)
.setBufferId(OFBufferId.NO_BUFFER)
.setPriority(FlowModUtils.PRIORITY_VERY_HIGH)
.setMatch(ofFactory.buildMatch()
.setExact(MatchField.IN_PORT, OFPort.of(inputPort))
.setExact(MatchField.VLAN_VID, OFVlanVidMatch.ofVlan(transitVlan))
.build())
.setInstructions(singletonList(
ofFactory.instructions().applyActions(Arrays.asList(
ofFactory.actions().popVlan(),
ofFactory.actions().popVlan(),
ofFactory.actions().buildOutput()
.setMaxLen(0xFFFFFFFF)
.setPort(OFPort.of(outputPort))
.build()))
.createBuilder()
.build()))
.setXid(0L)
.build();
}
示例8: egressNoneFlowMod
import net.floodlightcontroller.util.FlowModUtils; //导入依赖的package包/类
@Override
public OFFlowAdd egressNoneFlowMod(int inputPort, int outputPort, int transitVlan, long cookie) {
return ofFactory.buildFlowAdd()
.setCookie(U64.of(cookie & FLOW_COOKIE_MASK))
.setHardTimeout(FlowModUtils.INFINITE_TIMEOUT)
.setIdleTimeout(FlowModUtils.INFINITE_TIMEOUT)
.setBufferId(OFBufferId.NO_BUFFER)
.setPriority(FlowModUtils.PRIORITY_VERY_HIGH)
.setMatch(ofFactory.buildMatch()
.setExact(MatchField.IN_PORT, OFPort.of(inputPort))
.setExact(MatchField.VLAN_VID, OFVlanVidMatch.ofVlan(transitVlan))
.build())
.setInstructions(singletonList(
ofFactory.instructions().applyActions(Arrays.asList(
ofFactory.actions().popVlan(),
ofFactory.actions().buildOutput()
.setMaxLen(0xFFFFFFFF)
.setPort(OFPort.of(outputPort))
.build()))
.createBuilder()
.build()))
.setXid(0L)
.build();
}
示例9: createFRESCOFlowMod
import net.floodlightcontroller.util.FlowModUtils; //导入依赖的package包/类
private OFFlowMod createFRESCOFlowMod(IOFSwitch sw, Match match, List<OFAction> actions, int priority){
OFFlowMod.Builder fmb = sw.getOFFactory().buildFlowAdd();;
fmb.setIdleTimeout(FlowModUtils.INFINITE_TIMEOUT);
fmb.setHardTimeout(FlowModUtils.INFINITE_TIMEOUT);
fmb.setBufferId(OFBufferId.NO_BUFFER);
fmb.setOutPort(OFPort.ANY);
fmb.setCookie(U64.of(0));
fmb.setPriority(U16.t(priority));
fmb.setMatch(match);
fmb.setActions(actions);
return fmb.build();
}
示例10: installEgressFlow
import net.floodlightcontroller.util.FlowModUtils; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public ImmutablePair<Long, Boolean> installEgressFlow(final DatapathId dpid, String flowId, final Long cookie,
final int inputPort, final int outputPort,
final int transitVlanId, final int outputVlanId,
final OutputVlanType outputVlanType) {
List<OFAction> actionList = new ArrayList<>();
IOFSwitch sw = ofSwitchService.getSwitch(dpid);
// build match by input port and transit vlan id
Match match = matchFlow(sw, inputPort, transitVlanId);
// output action based on encap scheme
actionList.addAll(outputVlanTypeToOFActionList(sw, outputVlanId, outputVlanType));
// transmit packet from outgoing port
actionList.add(actionSetOutputPort(sw, outputPort));
// build instruction with action list
OFInstructionApplyActions actions = buildInstructionApplyActions(sw, actionList);
// build FLOW_MOD command, no meter
OFFlowMod flowMod = buildFlowMod(sw, match, null, actions,
cookie & FLOW_COOKIE_MASK, FlowModUtils.PRIORITY_VERY_HIGH);
// send FLOW_MOD to the switch
boolean response = pushFlow(flowId, dpid, flowMod);
return new ImmutablePair<>(flowMod.getXid(), response);
}
示例11: oneSwitchReplaceFlowMod
import net.floodlightcontroller.util.FlowModUtils; //导入依赖的package包/类
default OFFlowAdd oneSwitchReplaceFlowMod(int inputPort, int outputPort, int inputVlan, int outputVlan,
long meterId, long cookie) {
return ofFactory.buildFlowAdd()
.setCookie(U64.of(cookie & FLOW_COOKIE_MASK))
.setHardTimeout(FlowModUtils.INFINITE_TIMEOUT)
.setIdleTimeout(FlowModUtils.INFINITE_TIMEOUT)
.setBufferId(OFBufferId.NO_BUFFER)
.setPriority(FlowModUtils.PRIORITY_VERY_HIGH)
.setMatch(ofFactory.buildMatch()
.setExact(MatchField.IN_PORT, OFPort.of(inputPort))
.setExact(MatchField.VLAN_VID, OFVlanVidMatch.ofVlan(inputVlan))
.build())
.setInstructions(Arrays.asList(
ofFactory.instructions().buildMeter().setMeterId(meterId).build(),
ofFactory.instructions().applyActions(Arrays.asList(
ofFactory.actions().buildSetField()
.setField(ofFactory.oxms().buildVlanVid()
.setValue(OFVlanVidMatch.ofVlan(outputVlan))
.build())
.build(),
ofFactory.actions().buildOutput()
.setMaxLen(0xFFFFFFFF)
.setPort(OFPort.of(outputPort))
.build()))
.createBuilder()
.build()))
.setXid(0L)
.build();
}
示例12: oneSwitchPushFlowMod
import net.floodlightcontroller.util.FlowModUtils; //导入依赖的package包/类
default OFFlowAdd oneSwitchPushFlowMod(int inputPort, int outputPort, int outputVlan, long meterId, long cookie) {
return ofFactory.buildFlowAdd()
.setCookie(U64.of(cookie & FLOW_COOKIE_MASK))
.setHardTimeout(FlowModUtils.INFINITE_TIMEOUT)
.setIdleTimeout(FlowModUtils.INFINITE_TIMEOUT)
.setBufferId(OFBufferId.NO_BUFFER)
.setPriority(FlowModUtils.PRIORITY_VERY_HIGH)
.setMatch(ofFactory.buildMatch()
.setExact(MatchField.IN_PORT, OFPort.of(inputPort))
.build())
.setInstructions(Arrays.asList(
ofFactory.instructions().buildMeter().setMeterId(meterId).build(),
ofFactory.instructions().applyActions(Arrays.asList(
ofFactory.actions().buildPushVlan()
.setEthertype(EthType.of(ETH_TYPE))
.build(),
ofFactory.actions().buildSetField()
.setField(ofFactory.oxms().buildVlanVid()
.setValue(OFVlanVidMatch.ofVlan(outputVlan))
.build())
.build(),
ofFactory.actions().buildOutput()
.setMaxLen(0xFFFFFFFF)
.setPort(OFPort.of(outputPort))
.build()))
.createBuilder()
.build()))
.setXid(0L)
.build();
}
示例13: ingressMatchVlanIdFlowMod
import net.floodlightcontroller.util.FlowModUtils; //导入依赖的package包/类
@Override
public OFFlowAdd ingressMatchVlanIdFlowMod(int inputPort, int outputPort, int inputVlan, int transitVlan,
long meterId, long cookie) {
return ofFactory.buildFlowAdd()
.setCookie(U64.of(cookie & FLOW_COOKIE_MASK))
.setHardTimeout(FlowModUtils.INFINITE_TIMEOUT)
.setIdleTimeout(FlowModUtils.INFINITE_TIMEOUT)
.setBufferId(OFBufferId.NO_BUFFER)
.setPriority(FlowModUtils.PRIORITY_VERY_HIGH)
.setMatch(ofFactory.buildMatch()
.setExact(MatchField.IN_PORT, OFPort.of(inputPort))
.setExact(MatchField.VLAN_VID, OFVlanVidMatch.ofVlan(inputVlan))
.build())
.setInstructions(Arrays.asList(
ofFactory.instructions().buildMeter().setMeterId(meterId).build(),
ofFactory.instructions().applyActions(Arrays.asList(
ofFactory.actions().buildSetField()
.setField(ofFactory.oxms().buildVlanVid()
.setValue(OFVlanVidMatch.ofVlan(transitVlan))
.build())
.build(),
ofFactory.actions().buildOutput()
.setMaxLen(0xFFFFFFFF)
.setPort(OFPort.of(outputPort))
.build()))
.createBuilder()
.build()))
.setXid(0L)
.build();
}
示例14: egressPushFlowMod
import net.floodlightcontroller.util.FlowModUtils; //导入依赖的package包/类
@Override
public OFFlowAdd egressPushFlowMod(int inputPort, int outputPort, int transitVlan, int outputVlan, long cookie) {
return ofFactory.buildFlowAdd()
.setCookie(U64.of(cookie & FLOW_COOKIE_MASK))
.setHardTimeout(FlowModUtils.INFINITE_TIMEOUT)
.setIdleTimeout(FlowModUtils.INFINITE_TIMEOUT)
.setBufferId(OFBufferId.NO_BUFFER)
.setPriority(FlowModUtils.PRIORITY_VERY_HIGH)
.setMatch(ofFactory.buildMatch()
.setExact(MatchField.IN_PORT, OFPort.of(inputPort))
.setExact(MatchField.VLAN_VID, OFVlanVidMatch.ofVlan(transitVlan))
.build())
.setInstructions(singletonList(
ofFactory.instructions().applyActions(Arrays.asList(
ofFactory.actions().buildSetField()
.setField(ofFactory.oxms().buildVlanVid()
.setValue(OFVlanVidMatch.ofVlan(outputVlan))
.build())
.build(),
ofFactory.actions().buildOutput()
.setMaxLen(0xFFFFFFFF)
.setPort(OFPort.of(outputPort))
.build()))
.createBuilder()
.build()))
.setXid(0L)
.build();
}
示例15: ingressMatchVlanIdFlowMod
import net.floodlightcontroller.util.FlowModUtils; //导入依赖的package包/类
@Override
public OFFlowAdd ingressMatchVlanIdFlowMod(int inputPort, int outputPort, int inputVlan, int transitVlan,
long meterId, long cookie) {
return ofFactory.buildFlowAdd()
.setCookie(U64.of(cookie & FLOW_COOKIE_MASK))
.setHardTimeout(FlowModUtils.INFINITE_TIMEOUT)
.setIdleTimeout(FlowModUtils.INFINITE_TIMEOUT)
.setBufferId(OFBufferId.NO_BUFFER)
.setPriority(FlowModUtils.PRIORITY_VERY_HIGH)
.setMatch(ofFactory.buildMatch()
.setExact(MatchField.IN_PORT, OFPort.of(inputPort))
.setExact(MatchField.VLAN_VID, OFVlanVidMatch.ofVlan(inputVlan))
.build())
.setInstructions(Arrays.asList(
ofFactory.instructions().buildMeter().setMeterId(meterId).build(),
ofFactory.instructions().applyActions(Arrays.asList(
ofFactory.actions().buildPushVlan()
.setEthertype(EthType.of(ETH_TYPE))
.build(),
ofFactory.actions().buildSetField()
.setField(ofFactory.oxms().buildVlanVid()
.setValue(OFVlanVidMatch.ofVlan(transitVlan))
.build())
.build(),
ofFactory.actions().buildOutput()
.setMaxLen(0xFFFFFFFF)
.setPort(OFPort.of(outputPort))
.build()))
.createBuilder()
.build()))
.setXid(0L)
.build();
}