本文整理汇总了Java中org.openflow.protocol.action.OFActionOutput.setPort方法的典型用法代码示例。如果您正苦于以下问题:Java OFActionOutput.setPort方法的具体用法?Java OFActionOutput.setPort怎么用?Java OFActionOutput.setPort使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openflow.protocol.action.OFActionOutput
的用法示例。
在下文中一共展示了OFActionOutput.setPort方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testIsFlowModAllowedSimple
import org.openflow.protocol.action.OFActionOutput; //导入方法依赖的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));
}
示例2: updateActionOutputPort
import org.openflow.protocol.action.OFActionOutput; //导入方法依赖的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);
}
}
}
}
示例3: createLLDPPacketOut
import org.openflow.protocol.action.OFActionOutput; //导入方法依赖的package包/类
/**
* Creates packet_out LLDP for specified output port.
*
* @param port the port
* @return Packet_out message with LLDP data
* @throws PortMappingException
*/
private OFPacketOut createLLDPPacketOut(final PhysicalPort port)
throws PortMappingException {
if (port == null) {
throw new PortMappingException(
"Cannot send LLDP associated with a nonexistent port");
}
final OFPacketOut packetOut = (OFPacketOut) this.ovxMessageFactory
.getMessage(OFType.PACKET_OUT);
packetOut.setBufferId(OFPacketOut.BUFFER_ID_NONE);
final List<OFAction> actionsList = new LinkedList<OFAction>();
final OFActionOutput out = (OFActionOutput) this.ovxMessageFactory
.getAction(OFActionType.OUTPUT);
out.setPort(port.getPortNumber());
actionsList.add(out);
packetOut.setActions(actionsList);
final short alen = SwitchDiscoveryManager.countActionsLen(actionsList);
this.lldpPacket.setPort(port);
this.ethPacket.setSourceMACAddress(port.getHardwareAddress());
final byte[] lldp = this.ethPacket.serialize();
packetOut.setActionsLength(alen);
packetOut.setPacketData(lldp);
packetOut
.setLength((short) (OFPacketOut.MINIMUM_LENGTH + alen + lldp.length));
return packetOut;
}
示例4: testExpandedFlowStats
import org.openflow.protocol.action.OFActionOutput; //导入方法依赖的package包/类
@Test
public void testExpandedFlowStats(){
cache = new FlowStatCache(fsfw);
OFFlowMod mod = new OFFlowMod();
OFMatch match = new OFMatch();
match.setDataLayerVirtualLan((short)300);
match.setWildcards(match.getWildcardObj().matchOn(Flag.DL_VLAN));
mod.setMatch(match);
List<OFAction> actions = new ArrayList<OFAction>();
OFActionOutput output = new OFActionOutput();
output.setPort((short)65533);
actions.add(output);
mod.setActions(actions);
List<OFFlowMod> mods = slicerExpanded.allowedFlows(mod);
cache.addFlowMod(sw.getId(), slicerExpanded.getSliceName(), mod, mods);
log.error("Sending: " + expandedStats.size() + " flow stats!");
cache.setFlowCache(sw.getId(), expandedStats);
List<OFStatistics> slicedStats = cache.getSlicedFlowStats(sw.getId(), slicerExpanded.getSliceName());
assertNotNull("Sliced Stats with no allowed stats returend ok", slicedStats);
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());
}
示例5: testExpandedFlowStatsManaged
import org.openflow.protocol.action.OFActionOutput; //导入方法依赖的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());
}
示例6: testAllowedPacketOut
import org.openflow.protocol.action.OFActionOutput; //导入方法依赖的package包/类
/**
* tests packetOut event slicing
*/
@Test
public void testAllowedPacketOut(){
OFPacketOut out = new OFPacketOut();
List<OFAction> actions = new ArrayList<OFAction>();
OFActionOutput output = new OFActionOutput();
output.setType(OFActionType.OUTPUT);
output.setPort((short)1);
actions.add(output);
out.setActions(actions);
Ethernet pkt = new Ethernet();
pkt.setVlanID((short)1000);
pkt.setDestinationMACAddress("aa:bb:cc:dd:ee:ff");
pkt.setSourceMACAddress("ff:ee:dd:cc:bb:aa");
pkt.setEtherType((short)35020);
out.setPacketData(pkt.serialize());
List<OFMessage> outPackets = slicer.allowedPacketOut(out);
assertTrue("OutPacket size is correct, expected 1 got " + outPackets.size(), outPackets.size() == 1);
pkt.setVlanID((short)2000);
out.setPacketData(pkt.serialize());
outPackets = slicer.allowedPacketOut(out);
assertTrue("Packet out was denied", outPackets.size() == 0);
}
示例7: testIsFlowModALLAllowedExpansions
import org.openflow.protocol.action.OFActionOutput; //导入方法依赖的package包/类
/**
* tests isFlowModAllowed for expansions
*/
@Test
public void testIsFlowModALLAllowedExpansions(){
List<OFAction> actions = new ArrayList<OFAction>();
OFActionOutput output = new OFActionOutput();
OFActionVirtualLanIdentifier setVid = new OFActionVirtualLanIdentifier();
setVid.setVirtualLanIdentifier((short)1000);
actions.add(setVid);
output.setPort(OFPort.OFPP_ALL.getValue());
actions.add(output);
PortConfig pConfig5 = new PortConfig();
pConfig5.setPortName("foo5");
VLANRange range = new VLANRange();
range.setVlanAvail((short)104, true);
range.setVlanAvail((short)1000, true);
pConfig5.setVLANRange(range);
slicer.setPortConfig("foo5", pConfig5);
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);
flow.setActions(actions);
List<OFFlowMod>flows = slicer.allowedFlows(flow);
assertTrue("flow was denied",flows.size() != 0);
assertTrue("Flow Expansion worked had a size of " + flows.size(), flows.size() == 1);
OFFlowMod expanded = flows.get(0);
assertTrue("Correct number of actions", expanded.getActions().size() == 5);
}
示例8: testIsFlowModAllowedExpansions
import org.openflow.protocol.action.OFActionOutput; //导入方法依赖的package包/类
/**
* tests isFlowModAllowed for expansions
*/
@Test
public void testIsFlowModAllowedExpansions(){
List<OFAction> actions = new ArrayList<OFAction>();
OFActionOutput output = new OFActionOutput();
OFActionVirtualLanIdentifier setVid = new OFActionVirtualLanIdentifier();
setVid.setVirtualLanIdentifier((short)100);
actions.add(setVid);
output.setPort((short)1);
actions.add(output);
OFFlowMod flow = new OFFlowMod();
OFMatch match = new OFMatch();
match.setInputPort((short)0);
match.setDataLayerVirtualLan((short)1000);
match.setWildcards(match.getWildcardObj().matchOn(Flag.DL_VLAN));
flow.setMatch(match);
flow.setActions(actions);
List<OFFlowMod>flows = slicer.allowedFlows(flow);
assertTrue("flow was denied",flows.size() != 0);
assertTrue("Flow Expansion worked", flows.size() == 5);
PortConfig tmpPConfig = new PortConfig();
tmpPConfig.setPortName("foo4");
VLANRange range = new VLANRange();
range.setVlanAvail((short)100, true);
range.setVlanAvail((short)1000, true);
tmpPConfig.setVLANRange(range);
slicer.setPortConfig("foo4", tmpPConfig);
flows = slicer.allowedFlows(flow);
assertTrue("flow was denied",flows.size() != 0);
assertTrue("Flow Expansion worked, and then we detected it was total number of ports so changed to just 1, got " + flows.size(), flows.size() == 1);
}
示例9: decode_output
import org.openflow.protocol.action.OFActionOutput; //导入方法依赖的package包/类
private static SubActionStruct decode_output(String subaction, Logger log) {
SubActionStruct sa = null;
Matcher n;
n = Pattern.compile("output=(?:((?:0x)?\\d+)|(all)|(controller)|(local)|(ingress-port)|(normal)|(flood))").matcher(subaction);
if (n.matches()) {
OFActionOutput action = new OFActionOutput();
action.setMaxLength(Short.MAX_VALUE);
short port = OFPort.OFPP_NONE.getValue();
if (n.group(1) != null) {
try {
port = get_short(n.group(1));
}
catch (NumberFormatException e) {
log.debug("Invalid port in: '{}' (error ignored)", subaction);
return null;
}
}
else if (n.group(2) != null)
port = OFPort.OFPP_ALL.getValue();
else if (n.group(3) != null)
port = OFPort.OFPP_CONTROLLER.getValue();
else if (n.group(4) != null)
port = OFPort.OFPP_LOCAL.getValue();
else if (n.group(5) != null)
port = OFPort.OFPP_IN_PORT.getValue();
else if (n.group(6) != null)
port = OFPort.OFPP_NORMAL.getValue();
else if (n.group(7) != null)
port = OFPort.OFPP_FLOOD.getValue();
action.setPort(port);
log.debug("action {}", action);
sa = new SubActionStruct();
sa.action = action;
sa.len = OFActionOutput.MINIMUM_LENGTH;
}
else {
log.error("Invalid subaction: '{}'", subaction);
return null;
}
return sa;
}
示例10: decode_output
import org.openflow.protocol.action.OFActionOutput; //导入方法依赖的package包/类
@LogMessageDoc(level="ERROR",
message="Invalid subaction: '{subaction}'",
explanation="A static flow entry contained an invalid subaction",
recommendation=LogMessageDoc.REPORT_CONTROLLER_BUG)
private static SubActionStruct decode_output(String subaction, Logger log) {
SubActionStruct sa = null;
Matcher n;
n = Pattern.compile("output=(?:((?:0x)?\\d+)|(all)|(controller)|(local)|(ingress-port)|(normal)|(flood))").matcher(subaction);
if (n.matches()) {
OFActionOutput action = new OFActionOutput();
action.setMaxLength(Short.MAX_VALUE);
short port = OFPort.OFPP_NONE.getValue();
if (n.group(1) != null) {
try {
port = get_short(n.group(1));
}
catch (NumberFormatException e) {
log.debug("Invalid port in: '{}' (error ignored)", subaction);
return null;
}
}
else if (n.group(2) != null)
port = OFPort.OFPP_ALL.getValue();
else if (n.group(3) != null)
port = OFPort.OFPP_CONTROLLER.getValue();
else if (n.group(4) != null)
port = OFPort.OFPP_LOCAL.getValue();
else if (n.group(5) != null)
port = OFPort.OFPP_IN_PORT.getValue();
else if (n.group(6) != null)
port = OFPort.OFPP_NORMAL.getValue();
else if (n.group(7) != null)
port = OFPort.OFPP_FLOOD.getValue();
action.setPort(port);
log.debug("action {}", action);
sa = new SubActionStruct();
sa.action = action;
sa.len = OFActionOutput.MINIMUM_LENGTH;
}
else {
log.error("Invalid subaction: '{}'", subaction);
return null;
}
return sa;
}
示例11: decode_output
import org.openflow.protocol.action.OFActionOutput; //导入方法依赖的package包/类
@LogMessageDoc(level="ERROR",
message="Invalid subaction: '{subaction}'",
explanation="A static flow entry contained an invalid subaction",
recommendation=LogMessageDoc.REPORT_CONTROLLER_BUG)
private static SubActionStruct decode_output(String subaction, Logger log) {
SubActionStruct sa = null;
Matcher n;
n = Pattern.compile("output=(?:((?:0x)?\\d+)|(all)|(controller)|(local)|(ingress-port)|(normal)|(flood))").matcher(subaction);
if (n.matches()) {
OFActionOutput action = new OFActionOutput();
action.setMaxLength((short) Short.MAX_VALUE);
short port = OFPort.OFPP_NONE.getValue();
if (n.group(1) != null) {
try {
port = get_short(n.group(1));
}
catch (NumberFormatException e) {
log.debug("Invalid port in: '{}' (error ignored)", subaction);
return null;
}
}
else if (n.group(2) != null)
port = OFPort.OFPP_ALL.getValue();
else if (n.group(3) != null)
port = OFPort.OFPP_CONTROLLER.getValue();
else if (n.group(4) != null)
port = OFPort.OFPP_LOCAL.getValue();
else if (n.group(5) != null)
port = OFPort.OFPP_IN_PORT.getValue();
else if (n.group(6) != null)
port = OFPort.OFPP_NORMAL.getValue();
else if (n.group(7) != null)
port = OFPort.OFPP_FLOOD.getValue();
action.setPort(port);
log.debug("action {}", action);
sa = new SubActionStruct();
sa.action = action;
sa.len = OFActionOutput.MINIMUM_LENGTH;
}
else {
log.error("Invalid subaction: '{}'", subaction);
return null;
}
return sa;
}
开发者ID:vishalshubham,项目名称:Multipath-Hedera-system-in-Floodlight-controller,代码行数:49,代码来源:StaticFlowEntries.java
示例12: testManagedFlowModWithTag
import org.openflow.protocol.action.OFActionOutput; //导入方法依赖的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);
}
示例13: testAllowedPacketOutManagedMode
import org.openflow.protocol.action.OFActionOutput; //导入方法依赖的package包/类
/**
* tests packetOut event slicing
*/
@Test
public void testAllowedPacketOutManagedMode(){
OFPacketOut out = new OFPacketOut();
List<OFAction> actions = new ArrayList<OFAction>();
OFActionOutput output = new OFActionOutput();
output.setType(OFActionType.OUTPUT);
output.setPort((short)1);
actions.add(output);
out.setActions(actions);
Ethernet pkt = new Ethernet();
pkt.setDestinationMACAddress("aa:bb:cc:dd:ee:ff");
pkt.setSourceMACAddress("ff:ee:dd:cc:bb:aa");
pkt.setEtherType((short)35021);
pkt.setPad(true);
out.setPacketData(pkt.serialize());
slicer.setTagManagement(true);
pConfig = new PortConfig();
pConfig.setPortName("foo");
VLANRange range = new VLANRange();
range.setVlanAvail((short)101,true);
pConfig.setVLANRange(range);
slicer.setPortConfig("foo", pConfig);
List<OFMessage> outPackets = slicer.managedPacketOut(out);
assertTrue("OutPacket size is correct, expected 1 got " + outPackets.size(), outPackets.size() == 1);
OFPacketOut managedPacket = (OFPacketOut) outPackets.get(0);
List<OFAction> acts = managedPacket.getActions();
assertTrue("Action list size is 1!!",acts.size() == 1);
Ethernet managedEthernet = new Ethernet();
managedEthernet.deserialize(managedPacket.getPacketData(), 0, managedPacket.getPacketData().length);
assertTrue("VLAN Tag set is correct",managedEthernet.getVlanID() == 101);
assertTrue("Second action type is OUTPUT", acts.get(0).getType() == OFActionType.OUTPUT);
OFActionOutput outPort = (OFActionOutput) acts.get(0);
assertTrue("output port is 1", outPort.getPort() == 1);
pkt.setVlanID((short)2000);
out.setPacketData(pkt.serialize());
outPackets = slicer.managedPacketOut(out);
assertTrue("Packet out was denied", outPackets.size() == 0);
}
示例14: testIsFlowModALLAllowedWildcardExpansions
import org.openflow.protocol.action.OFActionOutput; //导入方法依赖的package包/类
/**
* tests isFlowModAllowed for expansions
*/
@Test
public void testIsFlowModALLAllowedWildcardExpansions(){
List<OFAction> actions = new ArrayList<OFAction>();
OFActionOutput output = new OFActionOutput();
OFActionVirtualLanIdentifier setVid = new OFActionVirtualLanIdentifier();
setVid.setVirtualLanIdentifier((short)1000);
actions.add(setVid);
output.setPort(OFPort.OFPP_ALL.getValue());
actions.add(output);
PortConfig pConfig5 = new PortConfig();
pConfig5.setPortName("foo5");
VLANRange range = new VLANRange();
range.setVlanAvail((short)104, true);
range.setVlanAvail((short)1000, true);
pConfig5.setVLANRange(range);
slicer.setPortConfig("foo5", pConfig5);
PortConfig pConfig4 = new PortConfig();
pConfig4.setPortName("foo4");
range = new VLANRange();
range.setVlanAvail((short)104, true);
range.setVlanAvail((short)1000, true);
pConfig4.setVLANRange(range);
slicer.setPortConfig("foo4", pConfig4);
OFFlowMod flow = new OFFlowMod();
OFMatch match = new OFMatch();
match.setInputPort((short)0);
match.setDataLayerVirtualLan((short)1000);
match.setWildcards(match.getWildcardObj().matchOn(Flag.DL_VLAN));
flow.setMatch(match);
flow.setActions(actions);
List<OFFlowMod>flows = slicer.allowedFlows(flow);
assertTrue("flow was denied",flows.size() != 0);
assertTrue("Flow Expansion worked had a size of " + flows.size(), flows.size() == 1);
OFFlowMod expanded = flows.get(0);
assertTrue("Correct number of actions expected 5 got " + expanded.getActions().size(), expanded.getActions().size() == 2);
}
示例15: testManagedFlowMod
import org.openflow.protocol.action.OFActionOutput; //导入方法依赖的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);
}