当前位置: 首页>>代码示例>>Java>>正文


Java OFActions类代码示例

本文整理汇总了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();
    }
}
 
开发者ID:telstra,项目名称:open-kilda,代码行数:23,代码来源:SwitchManager.java

示例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);
	}
 
开发者ID:hksoni,项目名称:SDN-Multicast,代码行数:31,代码来源:MulticastTree.java

示例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);
	
}
 
开发者ID:sammyyx,项目名称:ACAMPController,代码行数:28,代码来源:TestStaticFlowPusher.java

示例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();
}
 
开发者ID:telstra,项目名称:open-kilda,代码行数:14,代码来源:SwitchManager.java

示例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();
}
 
开发者ID:telstra,项目名称:open-kilda,代码行数:12,代码来源:SwitchManager.java

示例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();
}
 
开发者ID:telstra,项目名称:open-kilda,代码行数:12,代码来源:SwitchManager.java

示例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();
}
 
开发者ID:telstra,项目名称:open-kilda,代码行数:11,代码来源:SwitchManager.java

示例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();
}
 
开发者ID:telstra,项目名称:open-kilda,代码行数:12,代码来源:SwitchManager.java


注:本文中的org.projectfloodlight.openflow.protocol.action.OFActions类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。