本文整理汇总了Java中net.floodlightcontroller.linkdiscovery.internal.LinkDiscoveryManager.getQuarantinedPorts方法的典型用法代码示例。如果您正苦于以下问题:Java LinkDiscoveryManager.getQuarantinedPorts方法的具体用法?Java LinkDiscoveryManager.getQuarantinedPorts怎么用?Java LinkDiscoveryManager.getQuarantinedPorts使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.floodlightcontroller.linkdiscovery.internal.LinkDiscoveryManager
的用法示例。
在下文中一共展示了LinkDiscoveryManager.getQuarantinedPorts方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testSwitchAdded
import net.floodlightcontroller.linkdiscovery.internal.LinkDiscoveryManager; //导入方法依赖的package包/类
@Test
public void testSwitchAdded() throws Exception {
LinkDiscoveryManager linkDiscovery = getLinkDiscoveryManager();
Capture<OFMessage> wc;
Capture<FloodlightContext> fc;
Set<Short> qPorts;
OFPhysicalPort p1 = new OFPhysicalPort();
p1.setHardwareAddress(HexString.fromHexString("5c:16:c7:00:00:01"));
p1.setCurrentFeatures(0);
IOFSwitch sw1 = createMockSwitch(1L);
// Set switch map in floodlightProvider.
Map<Long, IOFSwitch> switches = new HashMap<Long, IOFSwitch>();
switches.put(1L, sw1);
getMockFloodlightProvider().setSwitches(switches);
// Create the set of ports
List<Short> ports = new ArrayList<Short>();
for(short p=1; p<=10; ++p) {
ports.add(p);
}
// Set the captures.
wc = new Capture<OFMessage>(CaptureType.ALL);
fc = new Capture<FloodlightContext>(CaptureType.ALL);
// Expect switch to return those ports.
expect(sw1.getEnabledPortNumbers()).andReturn(ports).anyTimes();
expect(sw1.getPort(EasyMock.anyShort())).andReturn(p1).anyTimes();
sw1.write(capture(wc), capture(fc));
expectLastCall().anyTimes();
replay(sw1);
linkDiscovery.addedSwitch(sw1);
verify(sw1);
qPorts = linkDiscovery.getQuarantinedPorts(sw1.getId());
assertNotNull(qPorts);
assertFalse(qPorts.isEmpty());
Thread.sleep(100);
qPorts = linkDiscovery.getQuarantinedPorts(sw1.getId());
assertNotNull(qPorts);
assertFalse(qPorts.isEmpty());
Thread.sleep(200);
qPorts = linkDiscovery.getQuarantinedPorts(sw1.getId());
assertNotNull(qPorts);
assertTrue(qPorts.isEmpty());
// Ensure that through every switch port, an LLDP and BDDP
// packet was sent out. Total # of packets = # of ports * 2.
assertTrue(wc.hasCaptured());
List<OFMessage> msgList = wc.getValues();
assertTrue(msgList.size() == ports.size() * 2);
}