Search in sources :

Example 11 with VplsData

use of org.onosproject.vpls.api.VplsData in project onos by opennetworkinglab.

the class VplsManagerTest method hostAddEventTest.

/**
 * Trigger host event listener by HOST_ADDED event.
 */
@Test
public void hostAddEventTest() {
    VplsData vplsData = vplsManager.createVpls(VPLS1, NONE);
    vplsManager.addInterface(vplsData, V100H1);
    HostEvent hostEvent = new HostEvent(HostEvent.Type.HOST_ADDED, V100HOST1);
    hostService.postHostEvent(hostEvent);
    vplsData = vplsStore.getVpls(VPLS1);
    assertEquals(UPDATING, vplsData.state());
}
Also used : HostEvent(org.onosproject.net.host.HostEvent) VplsData(org.onosproject.vpls.api.VplsData) Test(org.junit.Test)

Example 12 with VplsData

use of org.onosproject.vpls.api.VplsData in project onos by opennetworkinglab.

the class VplsManagerTest method testRemoveInterfaces.

/**
 * Removes network interfaces from a VPLS.
 */
@Test
public void testRemoveInterfaces() {
    VplsData vplsData = vplsManager.createVpls(VPLS1, NONE);
    vplsManager.addInterface(vplsData, V100H1);
    vplsManager.addInterface(vplsData, V100H2);
    vplsManager.removeInterfaces(vplsData, ImmutableSet.of(V100H1, V100H2));
    vplsData = vplsStore.getVpls(VPLS1);
    assertNotNull(vplsData);
    assertEquals(vplsData.state(), UPDATING);
    assertEquals(0, vplsData.interfaces().size());
}
Also used : VplsData(org.onosproject.vpls.api.VplsData) Test(org.junit.Test)

Example 13 with VplsData

use of org.onosproject.vpls.api.VplsData in project onos by opennetworkinglab.

the class VplsManagerTest method testAddInterfaces.

/**
 * Adds network interfaces to a VPLS.
 */
@Test
public void testAddInterfaces() {
    VplsData vplsData = vplsManager.createVpls(VPLS1, NONE);
    vplsManager.addInterfaces(vplsData, ImmutableSet.of(V100H1, V100H2));
    vplsData = vplsStore.getVpls(VPLS1);
    assertNotNull(vplsData);
    assertEquals(vplsData.state(), UPDATING);
    assertEquals(2, vplsData.interfaces().size());
    assertTrue(vplsData.interfaces().contains(V100H1));
    assertTrue(vplsData.interfaces().contains(V100H2));
}
Also used : VplsData(org.onosproject.vpls.api.VplsData) Test(org.junit.Test)

Example 14 with VplsData

use of org.onosproject.vpls.api.VplsData in project onos by opennetworkinglab.

the class VplsManagerTest method testRemoveVpls.

/**
 * Removes a VPLS.
 */
@Test
public void testRemoveVpls() {
    VplsData vplsData = vplsManager.createVpls(VPLS1, NONE);
    vplsManager.removeVpls(vplsData);
    assertEquals(vplsData.state(), REMOVING);
    vplsData = vplsStore.getVpls(VPLS1);
    assertNull(vplsData);
    Collection<VplsData> allVpls = vplsStore.getAllVpls();
    assertEquals(0, allVpls.size());
}
Also used : VplsData(org.onosproject.vpls.api.VplsData) Test(org.junit.Test)

Example 15 with VplsData

use of org.onosproject.vpls.api.VplsData in project onos by opennetworkinglab.

the class VplsManagerTest method testCreateVpls.

/**
 * Creates VPLS by given name and encapsulation type.
 */
@Test
public void testCreateVpls() {
    VplsData vplsData = vplsManager.createVpls(VPLS1, NONE);
    assertEquals(VPLS1, vplsData.name());
    assertEquals(NONE, vplsData.encapsulationType());
    vplsData = vplsStore.getVpls(VPLS1);
    assertEquals(vplsData.state(), ADDING);
}
Also used : VplsData(org.onosproject.vpls.api.VplsData) Test(org.junit.Test)

Aggregations

VplsData (org.onosproject.vpls.api.VplsData)73 Test (org.junit.Test)44 VplsOperation (org.onosproject.vpls.api.VplsOperation)18 VplsTest (org.onosproject.vpls.VplsTest)11 ArrayDeque (java.util.ArrayDeque)10 Interface (org.onosproject.net.intf.Interface)10 Vpls (org.onosproject.vpls.api.Vpls)7 NetworkConfigEvent (org.onosproject.net.config.NetworkConfigEvent)6 Path (javax.ws.rs.Path)4 Produces (javax.ws.rs.Produces)4 Host (org.onosproject.net.Host)4 HostEvent (org.onosproject.net.host.HostEvent)4 Intent (org.onosproject.net.intent.Intent)4 ArrayNode (com.fasterxml.jackson.databind.node.ArrayNode)3 IOException (java.io.IOException)3 ArrayList (java.util.ArrayList)3 Objects (java.util.Objects)3 Set (java.util.Set)3 Collectors (java.util.stream.Collectors)3 MacAddress (org.onlab.packet.MacAddress)3