use of org.openkilda.tools.mininet.MininetController in project open-kilda by telstra.
the class MininetTest method testTDD.
@Test
public void testTDD() throws Exception {
String controllerAddress = "kilda";
TransportPort controllerPort = TransportPort.of(6653);
OFVersion ofVersion = OFVersion.OF_13;
IMininetController controller = new MininetController().setIP(controllerAddress).setPort(controllerPort).setVersion(ofVersion).setName("floodlight").build();
IMininet mininet = new Mininet().addMininetServer(MININET_ADDRESS, MININET_PORT).clear().addController(controller).addSwitch("sw1", DatapathId.of(1)).addSwitch("sw2", DatapathId.of(2)).addLink("sw1", "sw2").build();
List<MininetSwitch> switches = mininet.switches().getSwitches();
assertEquals("failure - should have exactly 2 switches", 2, switches.size());
Thread.sleep(MAX_CONNECT_TIME);
switches = mininet.switches().getSwitches();
for (MininetSwitch sw : switches) {
assertTrue(String.format("failure - %s should be connected", sw.getName()), sw.getConnected());
}
List<MininetLink> links = mininet.links().getLinks();
for (MininetLink link : links) {
assertTrue(String.format("failure - %s should be up", link.getName()), link.isUp());
}
}
Aggregations