本文整理汇总了Java中org.projectfloodlight.openflow.protocol.action.OFActions类的典型用法代码示例。如果您正苦于以下问题:Java OFActions类的具体用法?Java OFActions怎么用?Java OFActions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OFActions类属于org.projectfloodlight.openflow.protocol.action包,在下文中一共展示了OFActions类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: actionReplaceVlan
import org.projectfloodlight.openflow.protocol.action.OFActions; //导入依赖的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: addQoSOFBucketToGroup
import org.projectfloodlight.openflow.protocol.action.OFActions; //导入依赖的package包/类
private void addQoSOFBucketToGroup(IOFSwitch sw, OFPort destPort, long bandwidth) {
/* creates queue using OVSDBContext on the switch */
OVSDBContext ovsdbContext = mcObject.ovsdbChannelMap.get(sw.getId());
/* FIXME: hardcoded priority '1' for all flows */
int queueId = ovsdbContext.createQueueOnPort(destPort, Long.toString(bandwidth), "1");
OFFactory of13Factory = sw.getOFFactory();
/* creates actions for the bucket */
ArrayList<OFAction> actionList = new ArrayList<OFAction>();
OFActions actions = of13Factory.actions();
OFActionSetQueue setQueue = actions.buildSetQueue().setQueueId(queueId).build();
actionList.add(setQueue);
OFActionOutput output = actions.buildOutput()
.setMaxLen(0xFFffFFff)
.setPort(destPort).build();
actionList.add(output);
/* creates a bucket */
OFBucket bucket = of13Factory.buildBucket()
.setActions(actionList)
.setWatchGroup(OFGroup.ANY)
.setWatchPort(OFPort.ANY)
.build();
/* store the bucket in multicastGroup object */
multicastGroup.addMemberOFBucket(sw.getId(),
destPort.getShortPortNumber(), bucket);
}
示例3: switchAdded
import org.projectfloodlight.openflow.protocol.action.OFActions; //导入依赖的package包/类
@Override
public void switchAdded(DatapathId switchId) {
logger.info("Detected a added switch, switch DPID:{}", switchId.toString());
OFFactory my13Factory = OFFactories.getFactory(OFVersion.OF_13);
Match myMatch = my13Factory.buildMatch()
.setExact(MatchField.IN_PORT, OFPort.of(2))
.setExact(MatchField.IP_PROTO, IpProtocol.UDP)
.build();
ArrayList<OFAction> actionList = new ArrayList<OFAction>();
OFActions actions = my13Factory.actions();
OFActionOutput output = actions.buildOutput()
.setMaxLen(0xFFffFFff)
.setPort(OFPort.CONTROLLER)
.build();
actionList.add(output);
OFFlowAdd flowAdd = my13Factory.buildFlowAdd()
.setBufferId(OFBufferId.NO_BUFFER)
.setHardTimeout(INFINITE_TIMEOUT)
.setIdleTimeout(INFINITE_TIMEOUT)
.setPriority(Integer.MAX_VALUE)
.setMatch(myMatch)
.setActions(actionList)
.setTableId(TableId.of(0))
.build();
flowEntryPusherService.addFlow(TestStaticFlowPusher.class.getSimpleName(), flowAdd, switchId);
}
示例4: actionSetDstMac
import org.projectfloodlight.openflow.protocol.action.OFActions; //导入依赖的package包/类
/**
* Create an action to set the DstMac of a packet
*
* @param sw switch object
* @param macAddress MacAddress to set
* @return {@link OFAction}
*/
private OFAction actionSetDstMac(final IOFSwitch sw, final MacAddress macAddress) {
OFOxms oxms = sw.getOFFactory().oxms();
OFActions actions = sw.getOFFactory().actions();
return actions.buildSetField()
.setField(oxms.buildEthDst().setValue(macAddress).build()).build();
}
示例5: actionSetOutputPort
import org.projectfloodlight.openflow.protocol.action.OFActions; //导入依赖的package包/类
/**
* Create an OFAction which sets the output port.
*
* @param sw switch object
* @param outputPort port to set in the action
* @return {@link OFAction}
*/
private OFAction actionSetOutputPort(final IOFSwitch sw, final int outputPort) {
OFActions actions = sw.getOFFactory().actions();
return actions.buildOutput().setMaxLen(0xFFFFFFFF).setPort(OFPort.of(outputPort)).build();
}
示例6: actionPushVlan
import org.projectfloodlight.openflow.protocol.action.OFActions; //导入依赖的package包/类
/**
* Create an OFAction to add a VLAN header.
*
* @param sw switch object
* @param etherType ethernet type of the new VLAN header
* @return {@link OFAction}
*/
private OFAction actionPushVlan(final IOFSwitch sw, final int etherType) {
OFActions actions = sw.getOFFactory().actions();
return actions.buildPushVlan().setEthertype(EthType.of(etherType)).build();
}
示例7: actionPopVlan
import org.projectfloodlight.openflow.protocol.action.OFActions; //导入依赖的package包/类
/**
* Create an OFAction to remove the outer most VLAN.
*
* @param sw - switch object
* @return {@link OFAction}
*/
private OFAction actionPopVlan(final IOFSwitch sw) {
OFActions actions = sw.getOFFactory().actions();
return actions.popVlan();
}
示例8: actionSendToController
import org.projectfloodlight.openflow.protocol.action.OFActions; //导入依赖的package包/类
/**
* Create an action to send packet to the controller.
*
* @param sw switch object
* @return {@link OFAction}
*/
private OFAction actionSendToController(final IOFSwitch sw) {
OFActions actions = sw.getOFFactory().actions();
return actions.buildOutput().setMaxLen(0xFFffFFff).setPort(OFPort.CONTROLLER)
.build();
}