本文整理汇总了Java中org.projectfloodlight.openflow.types.OFVlanVidMatch类的典型用法代码示例。如果您正苦于以下问题:Java OFVlanVidMatch类的具体用法?Java OFVlanVidMatch怎么用?Java OFVlanVidMatch使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OFVlanVidMatch类属于org.projectfloodlight.openflow.types包,在下文中一共展示了OFVlanVidMatch类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: actionReplaceVlan
import org.projectfloodlight.openflow.types.OFVlanVidMatch; //导入依赖的package包/类
/**
* Create an OFAction to change the outer most vlan.
*
* @param sw switch object
* @param newVlan final VLAN to be set on the packet
* @return {@link OFAction}
*/
private OFAction actionReplaceVlan(final IOFSwitch sw, final int newVlan) {
OFFactory factory = sw.getOFFactory();
OFOxms oxms = factory.oxms();
OFActions actions = factory.actions();
if (OF_12.compareTo(factory.getVersion()) == 0) {
return actions.buildSetField().setField(oxms.buildVlanVid()
.setValue(OFVlanVidMatch.ofRawVid((short) newVlan))
.build()).build();
} else {
return actions.buildSetField().setField(oxms.buildVlanVid()
.setValue(OFVlanVidMatch.ofVlan(newVlan))
.build()).build();
}
}
示例2: transitFlowMod
import org.projectfloodlight.openflow.types.OFVlanVidMatch; //导入依赖的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();
}
示例3: oneSwitchPopFlowMod
import org.projectfloodlight.openflow.types.OFVlanVidMatch; //导入依赖的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();
}
示例4: egressPopFlowMod
import org.projectfloodlight.openflow.types.OFVlanVidMatch; //导入依赖的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();
}
示例5: egressNoneFlowMod
import org.projectfloodlight.openflow.types.OFVlanVidMatch; //导入依赖的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();
}
示例6: mapSelector
import org.projectfloodlight.openflow.types.OFVlanVidMatch; //导入依赖的package包/类
@Override
public OFOxm<?> mapSelector(OFFactory factory, ExtensionSelector extensionSelector) {
ExtensionSelectorType type = extensionSelector.type();
if (type.equals(ExtensionSelectorType.ExtensionSelectorTypes.OFDPA_MATCH_VLAN_VID.type())) {
VlanId vlanId = ((OfdpaMatchVlanVid) extensionSelector).vlanId();
// Special VLAN 0x0000/0x1FFF required by OFDPA
if (vlanId.equals(VlanId.NONE)) {
OFVlanVidMatch vid = OFVlanVidMatch.ofRawVid((short) 0x0000);
OFVlanVidMatch mask = OFVlanVidMatch.ofRawVid((short) 0x1FFF);
return factory.oxms().vlanVidMasked(vid, mask);
// Normal case
} else if (vlanId.equals(VlanId.ANY)) {
return factory.oxms().vlanVidMasked(OFVlanVidMatch.PRESENT, OFVlanVidMatch.PRESENT);
} else {
return factory.oxms().vlanVid(OFVlanVidMatch.ofVlanVid(VlanVid.ofVlan(vlanId.toShort())));
}
}
throw new UnsupportedOperationException(
"Unexpected ExtensionSelector: " + extensionSelector.toString());
}
示例7: createMatchFromPacket
import org.projectfloodlight.openflow.types.OFVlanVidMatch; //导入依赖的package包/类
protected Match createMatchFromPacket(IOFSwitch sw, OFPort inPort, FloodlightContext cntx) {
// The packet in match will only contain the port number.
// We need to add in specifics for the hosts we're routing between.
Ethernet eth = IFloodlightProviderService.bcStore.get(cntx, IFloodlightProviderService.CONTEXT_PI_PAYLOAD);
VlanVid vlan = VlanVid.ofVlan(eth.getVlanID());
MacAddress srcMac = eth.getSourceMACAddress();
MacAddress dstMac = eth.getDestinationMACAddress();
Match.Builder mb = sw.getOFFactory().buildMatch();
mb.setExact(MatchField.IN_PORT, inPort)
.setExact(MatchField.ETH_SRC, srcMac)
.setExact(MatchField.ETH_DST, dstMac);
if (!vlan.equals(VlanVid.ZERO)) {
mb.setExact(MatchField.VLAN_VID, OFVlanVidMatch.ofVlanVid(vlan));
}
return mb.build();
}
示例8: matchFlow
import org.projectfloodlight.openflow.types.OFVlanVidMatch; //导入依赖的package包/类
/**
* Creates a Match based on an inputPort and VlanID.
* NB1: that this match only matches on the outer most tag which must be of ether-type 0x8100.
* NB2: vlanId of 0 means match on port, not vlan
*
* @param sw switch object
* @param inputPort input port for the match
* @param vlanId vlanID to match on; 0 means match on port
* @return {@link Match}
*/
private Match matchFlow(final IOFSwitch sw, final int inputPort, final int vlanId) {
Match.Builder mb = sw.getOFFactory().buildMatch();
//
// Extra emphasis: vlan of 0 means match on port on not VLAN.
//
if (vlanId > 0) {
mb.setExact(MatchField.IN_PORT, OFPort.of(inputPort))
.setExact(MatchField.VLAN_VID, OFVlanVidMatch.ofVlan(vlanId));
} else {
mb.setExact(MatchField.IN_PORT, OFPort.of(inputPort));
}
return mb.build();
}
示例9: oneSwitchReplaceFlowMod
import org.projectfloodlight.openflow.types.OFVlanVidMatch; //导入依赖的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();
}
示例10: oneSwitchPushFlowMod
import org.projectfloodlight.openflow.types.OFVlanVidMatch; //导入依赖的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();
}
示例11: ingressMatchVlanIdFlowMod
import org.projectfloodlight.openflow.types.OFVlanVidMatch; //导入依赖的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();
}
示例12: egressPushFlowMod
import org.projectfloodlight.openflow.types.OFVlanVidMatch; //导入依赖的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();
}
示例13: ingressMatchVlanIdFlowMod
import org.projectfloodlight.openflow.types.OFVlanVidMatch; //导入依赖的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();
}
示例14: ingressNoMatchVlanIdFlowMod
import org.projectfloodlight.openflow.types.OFVlanVidMatch; //导入依赖的package包/类
@Override
public OFFlowAdd ingressNoMatchVlanIdFlowMod(int inputPort, int outputPort, 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))
.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();
}
示例15: egressPushFlowMod
import org.projectfloodlight.openflow.types.OFVlanVidMatch; //导入依赖的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().popVlan(),
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();
}