Search in sources :

Example 1 with MininetController

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());
    }
}
Also used : Mininet(org.openkilda.tools.mininet.Mininet) TransportPort(org.projectfloodlight.openflow.types.TransportPort) MininetController(org.openkilda.tools.mininet.MininetController) OFVersion(org.projectfloodlight.openflow.protocol.OFVersion) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 Mininet (org.openkilda.tools.mininet.Mininet)1 MininetController (org.openkilda.tools.mininet.MininetController)1 OFVersion (org.projectfloodlight.openflow.protocol.OFVersion)1 TransportPort (org.projectfloodlight.openflow.types.TransportPort)1