本文整理汇总了Java中org.openflow.protocol.OFFlowMod.getMatch方法的典型用法代码示例。如果您正苦于以下问题:Java OFFlowMod.getMatch方法的具体用法?Java OFFlowMod.getMatch怎么用?Java OFFlowMod.getMatch使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openflow.protocol.OFFlowMod
的用法示例。
在下文中一共展示了OFFlowMod.getMatch方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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;
}
示例3: testPacketInBlockHost
import org.openflow.protocol.OFFlowMod; //导入方法依赖的package包/类
/**
* With throttling enabled, if rate of unique flows from a host
* exceeds set threshold, a flow mod should be emitted to block host
*/
@Test
public void testPacketInBlockHost() {
floodlightProvider.addSwitchEvent(anyLong(),
(String)anyObject(), anyBoolean());
expectLastCall().times(2);
replay(floodlightProvider);
int high = 500;
int perMac = 50;
sw.setThresholds(high, 10, perMac, 200);
// First, enable throttling
for (int i = 0; i < 1000; i++) {
assertFalse(sw.inputThrottleEnabled());
assertFalse(sw.inputThrottled(pi));
}
assertTrue(sw.inputThrottleEnabled());
assertTrue(blockMessage == null);
// Build unique flows with the same source mac
for (int j = 0; j < perMac - 1; j++) {
testPacketSerialized[5]++;
pi.setPacketData(testPacketSerialized);
assertFalse(sw.inputThrottled(pi));
}
assertTrue(blockMessage == null);
testPacketSerialized[5]++;
pi.setPacketData(testPacketSerialized);
assertFalse(sw.inputThrottled(pi));
// Verify the message is a flowmod with a hard timeout and srcMac
assertTrue(blockMessage != null);
assertTrue(blockMessage instanceof OFFlowMod);
OFFlowMod fm = (OFFlowMod) blockMessage;
assertTrue(fm.getHardTimeout() == 5);
OFMatch match = fm.getMatch();
assertTrue((match.getWildcards() & OFMatch.OFPFW_DL_SRC) == 0);
assertTrue(Arrays.equals(match.getDataLayerSource(),
HexString.fromHexString(srcMac)));
// Verify non-unique OFMatches are throttled
assertTrue(sw.inputThrottled(pi));
}
示例4: testPacketInBlockPort
import org.openflow.protocol.OFFlowMod; //导入方法依赖的package包/类
/**
* With throttling enabled, if rate of unique flows from a port
* exceeds set threshold, a flow mod should be emitted to block port
*/
@Test
public void testPacketInBlockPort() {
floodlightProvider.addSwitchEvent(anyLong(),
(String)anyObject(), anyBoolean());
expectLastCall().times(2);
replay(floodlightProvider);
int high = 500;
int perPort = 200;
sw.setThresholds(high, 10, 50, perPort);
// First, enable throttling
for (int i = 0; i < 1000; i++) {
assertFalse(sw.inputThrottleEnabled());
assertFalse(sw.inputThrottled(pi));
}
assertTrue(sw.inputThrottleEnabled());
assertTrue(blockMessage == null);
// Build unique flows with different source mac
for (int j = 0; j < perPort - 1; j++) {
testPacketSerialized[11]++;
pi.setPacketData(testPacketSerialized);
assertFalse(sw.inputThrottled(pi));
}
assertTrue(blockMessage == null);
testPacketSerialized[11]++;
pi.setPacketData(testPacketSerialized);
assertFalse(sw.inputThrottled(pi));
// Verify the message is a flowmod with a hard timeout and per port
assertTrue(blockMessage != null);
assertTrue(blockMessage instanceof OFFlowMod);
OFFlowMod fm = (OFFlowMod) blockMessage;
assertTrue(fm.getHardTimeout() == 5);
OFMatch match = fm.getMatch();
assertTrue((match.getWildcards() & OFMatch.OFPFW_DL_SRC) != 0);
assertTrue((match.getWildcards() & OFMatch.OFPFW_IN_PORT) == 0);
assertTrue(match.getInputPort() == 1);
// Verify non-unique OFMatches are throttled
assertTrue(sw.inputThrottled(pi));
}
示例5: 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;
}