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


Java Flag类代码示例

本文整理汇总了Java中org.openflow.protocol.Wildcards.Flag的典型用法代码示例。如果您正苦于以下问题:Java Flag类的具体用法?Java Flag怎么用?Java Flag使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Flag类属于org.openflow.protocol.Wildcards包,在下文中一共展示了Flag类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testAll

import org.openflow.protocol.Wildcards.Flag; //导入依赖的package包/类
@Test
public void testAll() {
    Wildcards all = Wildcards.FULL;
    assertTrue(all.isFull());
    assertFalse(all.isExact());
    assertEquals(0, all.getNwDstMask());
    assertEquals(0, all.getNwSrcMask());

    // unsetting flags from NONE is a no-op
    Wildcards stillAll = all.wildcard(Flag.IN_PORT);
    assertTrue(stillAll.isFull());
    assertEquals(all, stillAll);

    // so is setting a >= 32 netmask

    stillAll = all.withNwSrcMask(0);
    assertTrue(stillAll.isFull());
    assertEquals(all, stillAll);

    stillAll = all.withNwDstMask(0);
    assertTrue(stillAll.isFull());
    assertEquals(all, stillAll);
}
 
开发者ID:JianqingJiang,项目名称:QoS-floodlight,代码行数:24,代码来源:WildcardsTest.java

示例2: testNone

import org.openflow.protocol.Wildcards.Flag; //导入依赖的package包/类
@Test
public void testNone() {
    Wildcards none = Wildcards.EXACT;
    assertTrue(none.isExact());
    assertEquals(32, none.getNwDstMask());
    assertEquals(32, none.getNwSrcMask());

    // unsetting flags from NONE is a no-op
    Wildcards stillNone = none.matchOn(Flag.IN_PORT);
    assertTrue(stillNone.isExact());
    assertEquals(none, stillNone);

    // so is setting a >= 32 netmask
    stillNone = none.withNwSrcMask(32);
    assertTrue(stillNone.isExact());
    assertEquals(none, stillNone);

    stillNone = none.withNwDstMask(32);
    assertTrue(stillNone.isExact());
    assertEquals(none, stillNone);
}
 
开发者ID:JianqingJiang,项目名称:QoS-floodlight,代码行数:22,代码来源:WildcardsTest.java

示例3: testSetTwoFlags

import org.openflow.protocol.Wildcards.Flag; //导入依赖的package包/类
@Test
public void testSetTwoFlags() {
    Wildcards none = Wildcards.EXACT;

    // set two flags
    Wildcards two = none.wildcard(Flag.DL_SRC, Flag.DL_DST);
    assertFalse(two.isExact());
    assertTrue(two.isWildcarded(Flag.DL_SRC));
    assertTrue(two.isWildcarded(Flag.DL_DST));
    assertEquals(OFMatch.OFPFW_DL_SRC | OFMatch.OFPFW_DL_DST, two.getInt());
    assertEquals(EnumSet.of(Flag.DL_SRC, Flag.DL_DST), two.getWildcardedFlags());

    // unset dl_dst
    Wildcards gone = two.matchOn(Flag.DL_DST);
    assertFalse(gone.isExact());
    assertTrue(gone.isWildcarded(Flag.DL_SRC));
    assertFalse(gone.isWildcarded(Flag.DL_DST));
    assertEquals(OFMatch.OFPFW_DL_SRC, gone.getInt());
    assertEquals(EnumSet.of(Flag.DL_SRC), gone.getWildcardedFlags());
}
 
开发者ID:JianqingJiang,项目名称:QoS-floodlight,代码行数:21,代码来源:WildcardsTest.java

示例4: testInvert

import org.openflow.protocol.Wildcards.Flag; //导入依赖的package包/类
@Test
public void testInvert() {
    assertEquals(Wildcards.FULL, Wildcards.EXACT.inverted());

    Wildcards some = Wildcards.of(Flag.DL_VLAN, Flag.DL_VLAN_PCP);
    Wildcards inv = some.inverted();

    for(Flag f : Flag.values()) {
        boolean shouldBeSet = (f == Flag.DL_VLAN || f == Flag.DL_VLAN_PCP);

        assertEquals("Flag " + f + " "
                     + (shouldBeSet ? "should be set " : "should not be set"),
                shouldBeSet, some.isWildcarded(f));
        assertEquals(!(f == Flag.DL_VLAN || f == Flag.DL_VLAN_PCP), inv.isWildcarded(f));
    }
    assertEquals(0, inv.getNwDstMask());
    assertEquals(0, inv.getNwSrcMask());
}
 
开发者ID:JianqingJiang,项目名称:QoS-floodlight,代码行数:19,代码来源:WildcardsTest.java

示例5: prependRewriteActions

import org.openflow.protocol.Wildcards.Flag; //导入依赖的package包/类
public static List<OFAction> prependRewriteActions(final Integer tenantId,
        final OFMatch match) {
    final List<OFAction> actions = new LinkedList<OFAction>();
    if (!match.getWildcardObj().isWildcarded(Flag.NW_SRC)) {
        final OVXActionNetworkLayerSource srcAct = new OVXActionNetworkLayerSource();
        srcAct.setNetworkAddress(getPhysicalIp(tenantId,
                match.getNetworkSource()));
        actions.add(srcAct);
    }
    if (!match.getWildcardObj().isWildcarded(Flag.NW_DST)) {
        final OVXActionNetworkLayerDestination dstAct = new OVXActionNetworkLayerDestination();
        dstAct.setNetworkAddress(getPhysicalIp(tenantId,
                match.getNetworkDestination()));
        actions.add(dstAct);
    }
    return actions;
}
 
开发者ID:CoVisor,项目名称:CoVisor,代码行数:18,代码来源:IPMapper.java

示例6: learnHostIP

import org.openflow.protocol.Wildcards.Flag; //导入依赖的package包/类
private void learnHostIP(OFMatch match, Mappable map) {
    if (!match.getWildcardObj().isWildcarded(Flag.NW_SRC)) {

        try {
            map.getVirtualNetwork(tenantId).getHost(ovxPort)
                    .setIPAddress(match.getNetworkSource());
        } catch (NetworkMappingException e) {
            log.warn("Failed to lookup virtual network {}", this.tenantId);
            return;
        } catch (NullPointerException npe) {
            log.warn("No host attached at {} port {}", this.ovxPort
                    .getParentSwitch().getSwitchName(), this.ovxPort
                    .getPhysicalPortNumber());
        }
    }

}
 
开发者ID:CoVisor,项目名称:CoVisor,代码行数:18,代码来源:OVXPacketIn.java

示例7: testIsFlowModAllowedSimple

import org.openflow.protocol.Wildcards.Flag; //导入依赖的package包/类
@Test
public void testIsFlowModAllowedSimple(){
	OFFlowMod flow = new OFFlowMod();
	OFMatch match = new OFMatch();
	match.setInputPort((short)1);
	match.setDataLayerVirtualLan((short)1000);
	match.setWildcards(match.getWildcardObj().matchOn(Flag.DL_VLAN));
	match.setWildcards(match.getWildcardObj().matchOn(Flag.IN_PORT));
	flow.setMatch(match);
	List<OFAction> actions = new ArrayList<OFAction>();
	OFActionVirtualLanIdentifier setVid = new OFActionVirtualLanIdentifier();
	setVid.setVirtualLanIdentifier((short)102);		
	OFActionOutput output = new OFActionOutput();
	output.setPort((short)2);
	actions.add(setVid);
	actions.add(output);
	flow.setActions(actions);
	
	List <OFFlowMod> flows = slicer.allowedFlows(flow);
	assertTrue("flows is the right size", flows.size() == 1);
	assertEquals("flow was allowed and matches", flow, flows.get(0));
	
}
 
开发者ID:GlobalNOC,项目名称:FlowSpaceFirewall,代码行数:24,代码来源:VLANSlicerTest.java

示例8: testSetOneFlag

import org.openflow.protocol.Wildcards.Flag; //导入依赖的package包/类
@Test
public void testSetOneFlag() {
    Wildcards none = Wildcards.EXACT;
    assertTrue(none.isExact());
    assertFalse(none.isWildcarded(Flag.DL_SRC));
    Wildcards one = none.wildcard(Flag.DL_SRC);
    assertFalse(one.isExact());
    assertTrue(one.isWildcarded(Flag.DL_SRC));
    assertEquals(OFMatch.OFPFW_DL_SRC, one.getInt());
    assertEquals(EnumSet.of(Flag.DL_SRC), one.getWildcardedFlags());
}
 
开发者ID:JianqingJiang,项目名称:QoS-floodlight,代码行数:12,代码来源:WildcardsTest.java

示例9: testSetNwSrc

import org.openflow.protocol.Wildcards.Flag; //导入依赖的package包/类
@Test
public void testSetNwSrc() {
    Wildcards none = Wildcards.EXACT;
    assertEquals(32, none.getNwSrcMask());

    // unsetting flags from NONE is a no-op
    Wildcards nwSet = none.withNwSrcMask(8);
    assertFalse(nwSet.isExact());
    assertEquals(EnumSet.noneOf(Flag.class), nwSet.getWildcardedFlags());
    assertEquals(8, nwSet.getNwSrcMask());
    assertEquals((32 - 8) << OFMatch.OFPFW_NW_SRC_SHIFT, nwSet.getInt());
}
 
开发者ID:JianqingJiang,项目名称:QoS-floodlight,代码行数:13,代码来源:WildcardsTest.java

示例10: testSetNwDst

import org.openflow.protocol.Wildcards.Flag; //导入依赖的package包/类
@Test
public void testSetNwDst() {
    Wildcards none = Wildcards.EXACT;
    assertEquals(32, none.getNwDstMask());

    // unsetting flags from NONE is a no-op
    Wildcards nwSet = none.withNwDstMask(8);
    assertFalse(nwSet.isExact());
    assertEquals(EnumSet.noneOf(Flag.class), nwSet.getWildcardedFlags());
    assertEquals(8, nwSet.getNwDstMask());
    assertEquals((32 - 8) << OFMatch.OFPFW_NW_DST_SHIFT, nwSet.getInt());
}
 
开发者ID:JianqingJiang,项目名称:QoS-floodlight,代码行数:13,代码来源:WildcardsTest.java


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