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


Java OFFlowMod.getMatch方法代码示例

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

示例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;
}
 
开发者ID:JianqingJiang,项目名称:QoS-floodlight,代码行数:58,代码来源:StaticFlowEntries.java

示例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));
}
 
开发者ID:JianqingJiang,项目名称:QoS-floodlight,代码行数:47,代码来源:OFSwitchBaseTest.java

示例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));
}
 
开发者ID:JianqingJiang,项目名称:QoS-floodlight,代码行数:47,代码来源:OFSwitchBaseTest.java

示例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;
}
 
开发者ID:jimmyoic,项目名称:floodlight-qosmanager,代码行数:59,代码来源:StaticFlowEntries.java


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