本文整理汇总了Java中org.openflow.protocol.OFFlowMod.getActions方法的典型用法代码示例。如果您正苦于以下问题:Java OFFlowMod.getActions方法的具体用法?Java OFFlowMod.getActions怎么用?Java OFFlowMod.getActions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openflow.protocol.OFFlowMod
的用法示例。
在下文中一共展示了OFFlowMod.getActions方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: OVXFlowMod
import org.openflow.protocol.OFFlowMod; //导入方法依赖的package包/类
public OVXFlowMod(final OFFlowMod fm) {
super();
this.match = fm.getMatch();
this.cookie = fm.getCookie();
this.command = fm.getCommand();
this.idleTimeout = fm.getIdleTimeout();
this.hardTimeout = fm.getHardTimeout();
this.priority = fm.getPriority();
this.bufferId = fm.getBufferId();
this.outPort = fm.getOutPort();
this.flags = fm.getFlags();
this.actions = fm.getActions();
// Start with this in childrenFlowMods.
this.childrenFlowMods.add(this);
this.log.info("Hi, I'm a new OVXFlowMod: " + toString());
}
示例2: verifyActions
import org.openflow.protocol.OFFlowMod; //导入方法依赖的package包/类
private void verifyActions(OFFlowMod testFlowMod, OFFlowMod goodFlowMod) {
List<OFAction> goodActions = goodFlowMod.getActions();
List<OFAction> testActions = testFlowMod.getActions();
assertNotNull(goodActions);
assertNotNull(testActions);
assertEquals(goodActions.size(), testActions.size());
// assumes actions are marshalled in same order; should be safe
for(int i = 0; i < goodActions.size(); i++) {
assertEquals(goodActions.get(i), testActions.get(i));
}
}
示例3: updateActionOutputPort
import org.openflow.protocol.OFFlowMod; //导入方法依赖的package包/类
private void updateActionOutputPort(OFFlowMod fm) {
for (OFAction action : fm.getActions()) {
if (action instanceof OFActionOutput) {
OFActionOutput actionOutput = (OFActionOutput) action;
short outport = actionOutput.getPort();
Short physicalOutPort = this.getPhysicalPort(outport);
if (physicalOutPort != null) {
actionOutput.setPort(physicalOutPort);
}
}
}
}
示例4: OFFlowTableEntry
import org.openflow.protocol.OFFlowMod; //导入方法依赖的package包/类
/**
* Constructor
*
* @param flow_mod to read fields
*/
public OFFlowTableEntry(OFFlowMod flow_mod) {
this.nanoTime = System.nanoTime();
this.actionList = new ArrayList<>(flow_mod.getActions());
this.priority = flow_mod.getPriority();
this.hardTimeOut = flow_mod.getHardTimeout();
this.idleTimeOut = flow_mod.getIdleTimeout();
this.cookie = flow_mod.getCookie();
this.byteCount = 0;
this.packetCount = 0;
this.flowCount = 0;
this.notifyOnDelete = flow_mod.getFlags() == OFFlowMod.OFPFF_SEND_FLOW_REM;
}
示例5: removeFlows
import org.openflow.protocol.OFFlowMod; //导入方法依赖的package包/类
public void removeFlows(){
List<OFStatistics> results = this.parent.getSlicedFlowStats(mySwitch.getId(), this.mySlicer.getSliceName());
if(results == null){
log.debug("Slicing failed!");
return;
}
List<OFMessage> deletes = new ArrayList<OFMessage>();
for(OFStatistics stat : results){
OFFlowStatisticsReply flowStat = (OFFlowStatisticsReply) stat;
OFFlowMod flow = new OFFlowMod();
flow.setMatch(flowStat.getMatch());
flow.setActions(flowStat.getActions());
int length = 0;
for(OFAction act: flow.getActions()){
length += act.getLength();
}
flow.setLengthU(OFFlowMod.MINIMUM_LENGTH + length);
flow.setCommand(OFFlowMod.OFPFC_DELETE);
deletes.add(flow);
this.flowCount = this.flowCount - 1;
}
try {
this.mySwitch.write(deletes, null);
} catch (IOException e) {
e.printStackTrace();
}
}
示例6: flowModToStorageEntry
import org.openflow.protocol.OFFlowMod; //导入方法依赖的package包/类
/**
* Parses an OFFlowMod (and it's inner OFMatch) to the storage entry format.
* @param fm The FlowMod to parse
* @param sw The switch the FlowMod is going to be installed on
* @param name The name of this static flow entry
* @return A Map representation of the storage entry
*/
public static Map<String, Object> flowModToStorageEntry(OFFlowMod fm, String sw, String name) {
Map<String, Object> entry = new HashMap<String, Object>();
OFMatch match = fm.getMatch();
entry.put(StaticFlowEntryPusher.COLUMN_NAME, name);
entry.put(StaticFlowEntryPusher.COLUMN_SWITCH, sw);
entry.put(StaticFlowEntryPusher.COLUMN_ACTIVE, Boolean.toString(true));
entry.put(StaticFlowEntryPusher.COLUMN_PRIORITY, Short.toString(fm.getPriority()));
entry.put(StaticFlowEntryPusher.COLUMN_WILDCARD, Integer.toString(match.getWildcards()));
if ((fm.getActions() != null) && (fm.getActions().size() > 0))
entry.put(StaticFlowEntryPusher.COLUMN_ACTIONS, StaticFlowEntries.flowModActionsToString(fm.getActions()));
if (match.getInputPort() != 0)
entry.put(StaticFlowEntryPusher.COLUMN_IN_PORT, Short.toString(match.getInputPort()));
if (!Arrays.equals(match.getDataLayerSource(), zeroMac))
entry.put(StaticFlowEntryPusher.COLUMN_DL_SRC, HexString.toHexString(match.getDataLayerSource()));
if (!Arrays.equals(match.getDataLayerDestination(), zeroMac))
entry.put(StaticFlowEntryPusher.COLUMN_DL_DST, HexString.toHexString(match.getDataLayerDestination()));
if (match.getDataLayerVirtualLan() != -1)
entry.put(StaticFlowEntryPusher.COLUMN_DL_VLAN, Short.toString(match.getDataLayerVirtualLan()));
if (match.getDataLayerVirtualLanPriorityCodePoint() != 0)
entry.put(StaticFlowEntryPusher.COLUMN_DL_VLAN_PCP, Short.toString(match.getDataLayerVirtualLanPriorityCodePoint()));
if (match.getDataLayerType() != 0)
entry.put(StaticFlowEntryPusher.COLUMN_DL_TYPE, Short.toString(match.getDataLayerType()));
if (match.getNetworkTypeOfService() != 0)
entry.put(StaticFlowEntryPusher.COLUMN_NW_TOS, Short.toString(match.getNetworkTypeOfService()));
if (match.getNetworkProtocol() != 0)
entry.put(StaticFlowEntryPusher.COLUMN_NW_PROTO, Short.toString(match.getNetworkProtocol()));
if (match.getNetworkSource() != 0)
entry.put(StaticFlowEntryPusher.COLUMN_NW_SRC, IPv4.fromIPv4Address(match.getNetworkSource()));
if (match.getNetworkDestination() != 0)
entry.put(StaticFlowEntryPusher.COLUMN_NW_DST, IPv4.fromIPv4Address(match.getNetworkDestination()));
if (match.getTransportSource() != 0)
entry.put(StaticFlowEntryPusher.COLUMN_TP_SRC, Short.toString(match.getTransportSource()));
if (match.getTransportDestination() != 0)
entry.put(StaticFlowEntryPusher.COLUMN_TP_DST, Short.toString(match.getTransportDestination()));
return entry;
}
示例7: flowModToStorageEntry
import org.openflow.protocol.OFFlowMod; //导入方法依赖的package包/类
/**
* Parses an OFFlowMod (and it's inner OFMatch) to the storage entry format.
* @param fm The FlowMod to parse
* @param sw The switch the FlowMod is going to be installed on
* @param name The name of this static flow entry
* @return A Map representation of the storage entry
*/
public static Map<String, Object> flowModToStorageEntry(OFFlowMod fm, String sw, String name) {
Map<String, Object> entry = new HashMap<String, Object>();
OFMatch match = fm.getMatch();
entry.put(StaticFlowEntryPusher.COLUMN_NAME, name);
entry.put(StaticFlowEntryPusher.COLUMN_SWITCH, sw);
entry.put(StaticFlowEntryPusher.COLUMN_ACTIVE, Boolean.toString(true));
entry.put(StaticFlowEntryPusher.COLUMN_PRIORITY, Short.toString(fm.getPriority()));
entry.put(StaticFlowEntryPusher.COLUMN_WILDCARD, Integer.toString(match.getWildcards()));
entry.put(StaticFlowEntryPusher.COLUMN_HARD_TIMEOUT,Short.toString(fm.getHardTimeout()));
entry.put(StaticFlowEntryPusher.COLUMN_IDLE_TIMEOUT,Short.toString(fm.getIdleTimeout()));
if ((fm.getActions() != null) && (fm.getActions().size() > 0))
entry.put(StaticFlowEntryPusher.COLUMN_ACTIONS, StaticFlowEntries.flowModActionsToString(fm.getActions()));
if (match.getInputPort() != 0)
entry.put(StaticFlowEntryPusher.COLUMN_IN_PORT, Short.toString(match.getInputPort()));
if (!Arrays.equals(match.getDataLayerSource(), zeroMac))
entry.put(StaticFlowEntryPusher.COLUMN_DL_SRC, HexString.toHexString(match.getDataLayerSource()));
if (!Arrays.equals(match.getDataLayerDestination(), zeroMac))
entry.put(StaticFlowEntryPusher.COLUMN_DL_DST, HexString.toHexString(match.getDataLayerDestination()));
if (match.getDataLayerVirtualLan() != -1)
entry.put(StaticFlowEntryPusher.COLUMN_DL_VLAN, Short.toString(match.getDataLayerVirtualLan()));
if (match.getDataLayerVirtualLanPriorityCodePoint() != 0)
entry.put(StaticFlowEntryPusher.COLUMN_DL_VLAN_PCP, Short.toString(match.getDataLayerVirtualLanPriorityCodePoint()));
if (match.getDataLayerType() != 0)
entry.put(StaticFlowEntryPusher.COLUMN_DL_TYPE, Short.toString(match.getDataLayerType()));
if (match.getNetworkTypeOfService() != 0)
entry.put(StaticFlowEntryPusher.COLUMN_NW_TOS, Short.toString(match.getNetworkTypeOfService()));
if (match.getNetworkProtocol() != 0)
entry.put(StaticFlowEntryPusher.COLUMN_NW_PROTO, Short.toString(match.getNetworkProtocol()));
if (match.getNetworkSource() != 0)
entry.put(StaticFlowEntryPusher.COLUMN_NW_SRC, IPv4.fromIPv4Address(match.getNetworkSource()));
if (match.getNetworkDestination() != 0)
entry.put(StaticFlowEntryPusher.COLUMN_NW_DST, IPv4.fromIPv4Address(match.getNetworkDestination()));
if (match.getTransportSource() != 0)
entry.put(StaticFlowEntryPusher.COLUMN_TP_SRC, Short.toString(match.getTransportSource()));
if (match.getTransportDestination() != 0)
entry.put(StaticFlowEntryPusher.COLUMN_TP_DST, Short.toString(match.getTransportDestination()));
return entry;
}
示例8: testManagedFlowMod
import org.openflow.protocol.OFFlowMod; //导入方法依赖的package包/类
@Test
public void testManagedFlowMod(){
VLANSlicer otherSlicer = new VLANSlicer();
otherSlicer.setTagManagement(true);
pConfig = new PortConfig();
pConfig.setPortName("foo");
VLANRange range = new VLANRange();
range.setVlanAvail((short)101,true);
pConfig.setVLANRange(range);
otherSlicer.setPortConfig("foo", pConfig);
pConfig2 = new PortConfig();
pConfig2.setPortName("foo2");
range = new VLANRange();
range.setVlanAvail((short)103,true);
pConfig2.setVLANRange(range);
otherSlicer.setPortConfig("foo2", pConfig2);
pConfig3 = new PortConfig();
pConfig3.setPortName("foo3");
range = new VLANRange();
range.setVlanAvail((short)104,true);
pConfig3.setVLANRange(range);
otherSlicer.setPortConfig("foo3", pConfig3);
pConfig5 = new PortConfig();
pConfig5.setPortName("foo5");
range = new VLANRange();
range.setVlanAvail((short)106,true);
pConfig5.setVLANRange(range);
otherSlicer.setPortConfig("foo5", pConfig5);
pConfig6 = new PortConfig();
pConfig6.setPortName("foo6");
range = new VLANRange();
range.setVlanAvail((short)107,true);
pConfig6.setVLANRange(range);
otherSlicer.setPortConfig("foo6", pConfig6);
otherSlicer.setSwitch(sw);
OFFlowMod flowMod = new OFFlowMod();
OFMatch match = new OFMatch();
match.setInputPort((short)3);
match.setWildcards(match.getWildcardObj().matchOn(Flag.IN_PORT));
flowMod.setMatch(match);
List<OFAction> actions = new ArrayList<OFAction>();
OFActionOutput out = new OFActionOutput();
out.setPort((short)1);
actions.add(out);
flowMod.setActions(actions);
flowMod.setLength((short)(OFFlowMod.MINIMUM_LENGTH + OFActionOutput.MINIMUM_LENGTH));
List<OFFlowMod> managedFlows = otherSlicer.managedFlows(flowMod);
assertTrue(managedFlows.size() == 1);
OFFlowMod processedFlow = managedFlows.get(0);
assertTrue(processedFlow.getMatch().getDataLayerVirtualLan() == 104);
List<OFAction> processedActions = processedFlow.getActions();
assertTrue(processedActions.size() == 2);
assertTrue(processedActions.get(0).getType() == OFActionType.SET_VLAN_ID);
OFActionVirtualLanIdentifier set_vlan_vid = (OFActionVirtualLanIdentifier)processedActions.get(0);
assertTrue(set_vlan_vid.getVirtualLanIdentifier() == 101);
actions = new ArrayList<OFAction>();
OFActionVirtualLanIdentifier set_vlan = new OFActionVirtualLanIdentifier();
set_vlan.setVirtualLanIdentifier((short)100);
actions.add(set_vlan);
actions.add(out);
flowMod.setActions(actions);
flowMod.setLength((short)(OFFlowMod.MINIMUM_LENGTH + OFActionOutput.MINIMUM_LENGTH + OFActionVirtualLanIdentifier.MINIMUM_LENGTH));
managedFlows = otherSlicer.managedFlows(flowMod);
assertTrue(managedFlows.size() == 0);
}