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


Java OFFlowMod.setLength方法代码示例

本文整理汇总了Java中org.openflow.protocol.OFFlowMod.setLength方法的典型用法代码示例。如果您正苦于以下问题:Java OFFlowMod.setLength方法的具体用法?Java OFFlowMod.setLength怎么用?Java OFFlowMod.setLength使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.openflow.protocol.OFFlowMod的用法示例。


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

示例1: testExpandedFlowStatsManaged

import org.openflow.protocol.OFFlowMod; //导入方法依赖的package包/类
@Test
public void testExpandedFlowStatsManaged(){
	cache = new FlowStatCache(fsfw);
	
	
	OFFlowMod mod = new OFFlowMod();
	OFMatch match = new OFMatch();

	match.setWildcards(match.getWildcardObj().matchOn(Flag.DL_DST));
	match.setDataLayerDestination("78:2B:CB:48:FF:73");


	mod.setMatch(match);
	List<OFAction> actions = new ArrayList<OFAction>();
	OFActionOutput output = new OFActionOutput();
	output.setPort((short)1);
	actions.add(output);
	mod.setActions(actions);
	mod.setLength((short)(OFFlowMod.MINIMUM_LENGTH + output.getLength()));
	
	List<OFFlowMod> mods = managedExpandedSlicer.managedFlows(mod);
	assertEquals("Proper number of total flow mods", 4,mods.size());
	cache.addFlowMod(sw.getId(), managedExpandedSlicer.getSliceName(), mod, mods);
	cache.setFlowCache(sw.getId(), expandedManagedStats);
	List<OFStatistics> slicedStats = cache.getSlicedFlowStats(sw.getId(), managedExpandedSlicer.getSliceName());	
	assertNotNull("Sliced Stats with no allowed stats returend ok", slicedStats);
	for(OFStatistics stat : slicedStats){
		log.error(stat.toString());
	}
	assertEquals("Sliced stats", 6, slicedStats.size());
	log.error(slicedStats.get(0).toString());
	OFFlowStatisticsReply flowStat = (OFFlowStatisticsReply) slicedStats.get(0);
	assertEquals("flowStat byte count is correct", 4L,flowStat.getByteCount());
	assertEquals("flowStat packet count is correct", 4L,flowStat.getPacketCount());
}
 
开发者ID:GlobalNOC,项目名称:FlowSpaceFirewall,代码行数:36,代码来源:FlowStatSlicerTest.java

示例2: writeFlowMod

import org.openflow.protocol.OFFlowMod; //导入方法依赖的package包/类
/**
 * Writes a OFFlowMod to a switch.
 * @param sw The switch tow rite the flowmod to.
 * @param command The FlowMod actions (add, delete, etc).
 * @param bufferId The buffer ID if the switch has buffered the packet.
 * @param match The OFMatch structure to write.
 * @param outPort The switch port to output it to.
 */
private void writeFlowMod(IOFSwitch sw, short command, int bufferId,
        OFMatch match, short outPort) {
    // from openflow 1.0 spec - need to set these on a struct ofp_flow_mod:
    // struct ofp_flow_mod {
    //    struct ofp_header header;
    //    struct ofp_match match; /* Fields to match */
    //    uint64_t cookie; /* Opaque controller-issued identifier. */
    //
    //    /* Flow actions. */
    //    uint16_t command; /* One of OFPFC_*. */
    //    uint16_t idle_timeout; /* Idle time before discarding (seconds). */
    //    uint16_t hard_timeout; /* Max time before discarding (seconds). */
    //    uint16_t priority; /* Priority level of flow entry. */
    //    uint32_t buffer_id; /* Buffered packet to apply to (or -1).
    //                           Not meaningful for OFPFC_DELETE*. */
    //    uint16_t out_port; /* For OFPFC_DELETE* commands, require
    //                          matching entries to include this as an
    //                          output port. A value of OFPP_NONE
    //                          indicates no restriction. */
    //    uint16_t flags; /* One of OFPFF_*. */
    //    struct ofp_action_header actions[0]; /* The action length is inferred
    //                                            from the length field in the
    //                                            header. */
    //    };

    OFFlowMod flowMod = (OFFlowMod) floodlightProvider.getOFMessageFactory().getMessage(OFType.FLOW_MOD);
    flowMod.setMatch(match);
    flowMod.setCookie(LearningSwitch.LEARNING_SWITCH_COOKIE);
    flowMod.setCommand(command);
    flowMod.setIdleTimeout(LearningSwitch.FLOWMOD_DEFAULT_IDLE_TIMEOUT);
    flowMod.setHardTimeout(LearningSwitch.FLOWMOD_DEFAULT_HARD_TIMEOUT);
    flowMod.setPriority(LearningSwitch.FLOWMOD_PRIORITY);
    flowMod.setBufferId(bufferId);
    flowMod.setOutPort((command == OFFlowMod.OFPFC_DELETE) ? outPort : OFPort.OFPP_NONE.getValue());
    flowMod.setFlags((command == OFFlowMod.OFPFC_DELETE) ? 0 : (short) (1 << 0)); // OFPFF_SEND_FLOW_REM

    // set the ofp_action_header/out actions:
    // from the openflow 1.0 spec: need to set these on a struct ofp_action_output:
    // uint16_t type; /* OFPAT_OUTPUT. */
    // uint16_t len; /* Length is 8. */
    // uint16_t port; /* Output port. */
    // uint16_t max_len; /* Max length to send to controller. */
    // type/len are set because it is OFActionOutput,
    // and port, max_len are arguments to this constructor
    flowMod.setActions(Arrays.asList((OFAction) new OFActionOutput(outPort, (short) 0xffff)));
    flowMod.setLength((short) (OFFlowMod.MINIMUM_LENGTH + OFActionOutput.MINIMUM_LENGTH));

    if (log.isTraceEnabled()) {
        log.trace("{} {} flow mod {}",
                  new Object[]{ sw, (command == OFFlowMod.OFPFC_DELETE) ? "deleting" : "adding", flowMod });
    }

    counterStore.updatePktOutFMCounterStoreLocal(sw, flowMod);

    // and write it out
    try {
        sw.write(flowMod, null);
    } catch (IOException e) {
        log.error("Failed to write {} to switch {}", new Object[]{ flowMod, sw }, e);
    }
}
 
开发者ID:JianqingJiang,项目名称:QoS-floodlight,代码行数:70,代码来源:LearningSwitch.java

示例3: writeFlowMod

import org.openflow.protocol.OFFlowMod; //导入方法依赖的package包/类
/**
 * Writes a OFFlowMod to a switch.
 * @param sw The switch tow rite the flowmod to.
 * @param command The FlowMod actions (add, delete, etc).
 * @param bufferId The buffer ID if the switch has buffered the packet.
 * @param match The OFMatch structure to write.
 * @param outPort The switch port to output it to.
 */
private void writeFlowMod(IOFSwitch sw, short command, int bufferId,
        OFMatch match, short outPort) {
    // from openflow 1.0 spec - need to set these on a struct ofp_flow_mod:
    // struct ofp_flow_mod {
    //    struct ofp_header header;
    //    struct ofp_match match; /* Fields to match */
    //    uint64_t cookie; /* Opaque controller-issued identifier. */
    //
    //    /* Flow actions. */
    //    uint16_t command; /* One of OFPFC_*. */
    //    uint16_t idle_timeout; /* Idle time before discarding (seconds). */
    //    uint16_t hard_timeout; /* Max time before discarding (seconds). */
    //    uint16_t priority; /* Priority level of flow entry. */
    //    uint32_t buffer_id; /* Buffered packet to apply to (or -1).
    //                           Not meaningful for OFPFC_DELETE*. */
    //    uint16_t out_port; /* For OFPFC_DELETE* commands, require
    //                          matching entries to include this as an
    //                          output port. A value of OFPP_NONE
    //                          indicates no restriction. */
    //    uint16_t flags; /* One of OFPFF_*. */
    //    struct ofp_action_header actions[0]; /* The action length is inferred
    //                                            from the length field in the
    //                                            header. */
    //    };
       
    OFFlowMod flowMod = (OFFlowMod) floodlightProvider.getOFMessageFactory().getMessage(OFType.FLOW_MOD);
    flowMod.setMatch(match);
    flowMod.setCookie(LearningSwitch.LEARNING_SWITCH_COOKIE);
    flowMod.setCommand(command);
    flowMod.setIdleTimeout(LearningSwitch.IDLE_TIMEOUT_DEFAULT);
    flowMod.setHardTimeout(LearningSwitch.HARD_TIMEOUT_DEFAULT);
    flowMod.setPriority(LearningSwitch.PRIORITY_DEFAULT);
    flowMod.setBufferId(bufferId);
    flowMod.setOutPort((command == OFFlowMod.OFPFC_DELETE) ? outPort : OFPort.OFPP_NONE.getValue());
    flowMod.setFlags((command == OFFlowMod.OFPFC_DELETE) ? 0 : (short) (1 << 0)); // OFPFF_SEND_FLOW_REM

    // set the ofp_action_header/out actions:
    // from the openflow 1.0 spec: need to set these on a struct ofp_action_output:
    // uint16_t type; /* OFPAT_OUTPUT. */
    // uint16_t len; /* Length is 8. */
    // uint16_t port; /* Output port. */
    // uint16_t max_len; /* Max length to send to controller. */
    // type/len are set because it is OFActionOutput,
    // and port, max_len are arguments to this constructor
    flowMod.setActions(Arrays.asList((OFAction) new OFActionOutput(outPort, (short) 0xffff)));
    flowMod.setLength((short) (OFFlowMod.MINIMUM_LENGTH + OFActionOutput.MINIMUM_LENGTH));

    if (log.isTraceEnabled()) {
        log.trace("{} {} flow mod {}", 
                  new Object[]{ sw, (command == OFFlowMod.OFPFC_DELETE) ? "deleting" : "adding", flowMod });
    }

    counterStore.updatePktOutFMCounterStore(sw, flowMod);
    
    // and write it out
    try {
        sw.write(flowMod, null);
    } catch (IOException e) {
        log.error("Failed to write {} to switch {}", new Object[]{ flowMod, sw }, e);
    }
}
 
开发者ID:vishalshubham,项目名称:Multipath-Hedera-system-in-Floodlight-controller,代码行数:70,代码来源:LearningSwitch.java

示例4: writeFlowMod

import org.openflow.protocol.OFFlowMod; //导入方法依赖的package包/类
/**
 * Writes a OFFlowMod to a switch.
 * @param sw The switch tow rite the flowmod to.
 * @param command The FlowMod actions (add, delete, etc).
 * @param bufferId The buffer ID if the switch has buffered the packet.
 * @param match The OFMatch structure to write.
 * @param outPort The switch port to output it to.
 */
private void writeFlowMod(IOFSwitch sw, short command, int bufferId,
        OFMatch match, short outPort) {
    // from openflow 1.0 spec - need to set these on a struct ofp_flow_mod:
    // struct ofp_flow_mod {
    //    struct ofp_header header;
    //    struct ofp_match match; /* Fields to match */
    //    uint64_t cookie; /* Opaque controller-issued identifier. */
    //
    //    /* Flow actions. */
    //    uint16_t command; /* One of OFPFC_*. */
    //    uint16_t idle_timeout; /* Idle time before discarding (seconds). */
    //    uint16_t hard_timeout; /* Max time before discarding (seconds). */
    //    uint16_t priority; /* Priority level of flow entry. */
    //    uint32_t buffer_id; /* Buffered packet to apply to (or -1).
    //                           Not meaningful for OFPFC_DELETE*. */
    //    uint16_t out_port; /* For OFPFC_DELETE* commands, require
    //                          matching entries to include this as an
    //                          output port. A value of OFPP_NONE
    //                          indicates no restriction. */
    //    uint16_t flags; /* One of OFPFF_*. */
    //    struct ofp_action_header actions[0]; /* The action length is inferred
    //                                            from the length field in the
    //                                            header. */
    //    };
       
    OFFlowMod flowMod = (OFFlowMod) controllerProvider.getOFMessageFactory().getMessage(OFType.FLOW_MOD);
    flowMod.setMatch(match);
    flowMod.setCookie(LearningSwitch.LEARNING_SWITCH_COOKIE);
    flowMod.setCommand(command);
    flowMod.setIdleTimeout(LearningSwitch.FLOWMOD_DEFAULT_IDLE_TIMEOUT);
    flowMod.setHardTimeout(LearningSwitch.FLOWMOD_DEFAULT_HARD_TIMEOUT);
    flowMod.setPriority(LearningSwitch.FLOWMOD_PRIORITY);
    flowMod.setBufferId(bufferId);
    flowMod.setOutPort((command == OFFlowMod.OFPFC_DELETE) ? outPort : OFPort.OFPP_NONE.getValue());
    flowMod.setFlags((command == OFFlowMod.OFPFC_DELETE) ? 0 : (short) (1 << 0)); // OFPFF_SEND_FLOW_REM

    // set the ofp_action_header/out actions:
    // from the openflow 1.0 spec: need to set these on a struct ofp_action_output:
    // uint16_t type; /* OFPAT_OUTPUT. */
    // uint16_t len; /* Length is 8. */
    // uint16_t port; /* Output port. */
    // uint16_t max_len; /* Max length to send to controller. */
    // type/len are set because it is OFActionOutput,
    // and port, max_len are arguments to this constructor
    flowMod.setActions(Arrays.asList((OFAction) new OFActionOutput(outPort, (short) 0xffff)));
    flowMod.setLength((short) (OFFlowMod.MINIMUM_LENGTH + OFActionOutput.MINIMUM_LENGTH));

    if (log.isTraceEnabled()) {
        log.trace("{} {} flow mod {}", 
                  new Object[]{ sw, (command == OFFlowMod.OFPFC_DELETE) ? "deleting" : "adding", flowMod });
    }

    counterStore.updatePktOutFMCounterStore(sw, flowMod);
    
    // and write it out
    try {
        sw.write(flowMod, null);
    } catch (IOException e) {
        log.error("Failed to write {} to switch {}", new Object[]{ flowMod, sw }, e);
    }
}
 
开发者ID:opendaylight,项目名称:archived-net-virt-platform,代码行数:70,代码来源:LearningSwitch.java

示例5: testBrokenStats

import org.openflow.protocol.OFFlowMod; //导入方法依赖的package包/类
@Test
public void testBrokenStats(){
	List<HashMap<Long, Slicer>> tmp = new ArrayList<HashMap<Long, Slicer>>();
	HashMap<Long, Slicer> tmpMap = new HashMap<Long, Slicer>();
	tmpMap.put(sw.getId(), slicer);
	tmp.add(tmpMap);
	
	tmpMap = new HashMap<Long, Slicer>();
	tmpMap.put(sw.getId(), managedSlicer);
	tmp.add(tmpMap);
	
	tmpMap = new HashMap<Long, Slicer>();
	tmpMap.put(sw.getId(), slicerExpanded);
	tmp.add(tmpMap);
	
	tmpMap = new HashMap<Long, Slicer>();
	tmpMap.put(sw.getId(), managedExpandedSlicer);
	tmp.add(tmpMap);
	
	Proxy proxy = createMock(Proxy.class);
	expect(proxy.getSlicer()).andReturn(managedExpandedSlicer).anyTimes();
	proxy.setFlowCount(EasyMock.anyInt());
	EasyMock.expectLastCall().anyTimes();
	EasyMock.replay(proxy);
	
	fsfw = createMock(FlowSpaceFirewall.class);
	List<IOFSwitch> switches = new ArrayList<IOFSwitch>();
	switches.add(sw);
	expect(fsfw.getSlices()).andReturn(tmp).anyTimes();
	expect(fsfw.getSwitches()).andReturn(switches).anyTimes();
	expect(fsfw.getProxy(EasyMock.anyLong(), EasyMock.anyObject(String.class))).andReturn(proxy).anyTimes();
	HashMap<Long, Slicer> sliceMap = new HashMap<Long, Slicer>();
	sliceMap.put(sw.getId(), managedExpandedSlicer);
	expect(fsfw.getSlice(EasyMock.anyObject(String.class))).andReturn(sliceMap).anyTimes();
	EasyMock.replay(fsfw);
	
	cache = new FlowStatCache(fsfw);
	
	OFFlowMod mod = new OFFlowMod();
	OFMatch match = new OFMatch();

	match.setWildcards(match.getWildcardObj().matchOn(Flag.DL_DST));
	match.setDataLayerDestination("78:2B:CB:48:FF:73");


	mod.setMatch(match);
	List<OFAction> actions = new ArrayList<OFAction>();
	OFActionOutput output = new OFActionOutput();
	output.setPort((short)1);
	actions.add(output);
	mod.setActions(actions);
	mod.setLength((short)(OFFlowMod.MINIMUM_LENGTH + output.getLength()));

	List<OFStatistics>bustedExpandedManagedStats = new ArrayList<OFStatistics>(expandedManagedStats);
	OFFlowStatisticsReply stat = (OFFlowStatisticsReply) bustedExpandedManagedStats.get(5);
	OFActionVirtualLanIdentifier set_vlan_vid = new OFActionVirtualLanIdentifier();
	set_vlan_vid.setVirtualLanIdentifier((short)500);
	List<OFAction> newActs = new ArrayList<OFAction>();
	newActs.add(set_vlan_vid);
	newActs.add(output);
	stat.setActions(newActs);
	bustedExpandedManagedStats.set(5, stat);
	
	List<OFFlowMod> mods = managedExpandedSlicer.managedFlows(mod);
	assertEquals("Proper number of total flow mods", 4,mods.size());
	cache.addFlowMod(sw.getId(), managedExpandedSlicer.getSliceName(), mod, mods);
	cache.setFlowCache(sw.getId(), expandedManagedStats);
	
	List<OFStatistics> slicedStats = cache.getSlicedFlowStats(sw.getId(), managedExpandedSlicer.getSliceName());	
	assertNotNull("Sliced Stats with no allowed stats returned ok", slicedStats);
	assertEquals("Sliced stats", 5, slicedStats.size());
	
	log.error(slicedStats.get(0).toString());
	OFFlowStatisticsReply flowStat = (OFFlowStatisticsReply) slicedStats.get(0);
	assertEquals("flowStat byte count is correct", 1L,flowStat.getByteCount());
	assertEquals("flowStat packet count is correct", 1L,flowStat.getPacketCount());
	
}
 
开发者ID:GlobalNOC,项目名称:FlowSpaceFirewall,代码行数:79,代码来源:FlowStatSlicerTest.java

示例6: 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);
	
}
 
开发者ID:GlobalNOC,项目名称:FlowSpaceFirewall,代码行数:74,代码来源:VLANSlicerTest.java

示例7: testManagedFlowModWithTag

import org.openflow.protocol.OFFlowMod; //导入方法依赖的package包/类
@Test
public void testManagedFlowModWithTag(){
	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.setDataLayerVirtualLan((short)200);
	match.setWildcards(match.getWildcardObj().matchOn(Flag.IN_PORT));
	match.setWildcards(match.getWildcardObj().matchOn(Flag.DL_VLAN));
	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() == 0);
	
	actions.clear();
	OFActionVirtualLanIdentifier set_vlan_vid = new OFActionVirtualLanIdentifier();
	set_vlan_vid.setVirtualLanIdentifier((short)100);
	actions.add(set_vlan_vid);
	actions.add(out);
	flowMod.setActions(actions);
	flowMod.getMatch().setDataLayerVirtualLan((short)0);
	flowMod.setLength((short)(OFFlowMod.MINIMUM_LENGTH + OFActionOutput.MINIMUM_LENGTH + OFActionVirtualLanIdentifier.MINIMUM_LENGTH));
	managedFlows = otherSlicer.managedFlows(flowMod);
	assertTrue(managedFlows.size() == 0);
}
 
开发者ID:GlobalNOC,项目名称:FlowSpaceFirewall,代码行数:69,代码来源:VLANSlicerTest.java

示例8: testManagedFlowModWithNoPort

import org.openflow.protocol.OFFlowMod; //导入方法依赖的package包/类
@Test
public void testManagedFlowModWithNoPort(){
	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)4);
	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() == 0);
	
	flowMod.getMatch().setInputPort((short)3);
	out.setPort((short)4);
	actions.clear();
	actions.add(out);
	flowMod.setActions(actions);
	managedFlows = otherSlicer.managedFlows(flowMod);
	assertTrue(managedFlows.size() == 0);
}
 
开发者ID:GlobalNOC,项目名称:FlowSpaceFirewall,代码行数:64,代码来源:VLANSlicerTest.java


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