Search in sources :

Example 51 with VplsData

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

the class VplsIntentTest method createVplsData.

/**
 * Creates VPLS data by given name, encapsulation type and network
 * interfaces.
 *
 * @param name the VPLS name
 * @param encap the encapsulation type
 * @param interfaces the network interfaces
 * @return the VPLS data
 */
private VplsData createVplsData(String name, EncapsulationType encap, Set<Interface> interfaces) {
    VplsData vplsData = VplsData.of(name, encap);
    vplsData.addInterfaces(interfaces);
    return vplsData;
}
Also used : VplsData(org.onosproject.vpls.api.VplsData)

Example 52 with VplsData

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

the class VplsIntentTest method activateNoHosts.

/**
 * Seven ports are configured with VLANs, while three ports are not. No hosts are
 * registered by the HostService.
 *
 * The first three ports have an interface configured on VPLS 1,
 * the other three on VPLS 2. Two ports are defined for VPLS 3, while
 * the two remaining ports are configured on VPLS 4.
 *
 * The number of intents expected is 10: three for VPLS 1, three for VPLS 2,
 * two for VPLS 3, two for VPLS 4. Eight MP2SP intents.
 * Checks if the number of intents submitted to the intent framework is
 * equal to the number of intents expected and if all intents are equivalent.
 */
@Test
public void activateNoHosts() {
    List<Intent> expectedIntents = Lists.newArrayList();
    Set<FilteredConnectPoint> fcPoints;
    Set<Interface> interfaces;
    interfaces = ImmutableSet.of(V100H1, V200H1, V300H1);
    VplsData vplsData = createVplsData(VPLS1, VLAN, interfaces);
    Set<Intent> brcIntents = VplsIntentUtility.buildBrcIntents(vplsData, APPID);
    brcIntents.forEach(intentService::submit);
    fcPoints = buildFCPoints(interfaces);
    expectedIntents.addAll(generateVplsBrc(fcPoints, VPLS1, VLAN));
    checkIntents(expectedIntents);
    interfaces = ImmutableSet.of(V100H2, V200H2, V300H2);
    vplsData = createVplsData(VPLS2, NONE, interfaces);
    brcIntents = VplsIntentUtility.buildBrcIntents(vplsData, APPID);
    brcIntents.forEach(intentService::submit);
    fcPoints = buildFCPoints(interfaces);
    expectedIntents.addAll(generateVplsBrc(fcPoints, VPLS2, NONE));
    checkIntents(expectedIntents);
    interfaces = ImmutableSet.of(VNONEH1, VNONEH2);
    vplsData = createVplsData(VPLS3, NONE, interfaces);
    brcIntents = VplsIntentUtility.buildBrcIntents(vplsData, APPID);
    brcIntents.forEach(intentService::submit);
    fcPoints = buildFCPoints(interfaces);
    expectedIntents.addAll(generateVplsBrc(fcPoints, VPLS3, NONE));
    checkIntents(expectedIntents);
    interfaces = ImmutableSet.of(V400H1, VNONEH3);
    vplsData = createVplsData(VPLS4, NONE, interfaces);
    brcIntents = VplsIntentUtility.buildBrcIntents(vplsData, APPID);
    brcIntents.forEach(intentService::submit);
    fcPoints = buildFCPoints(interfaces);
    expectedIntents.addAll(generateVplsBrc(fcPoints, VPLS4, NONE));
    checkIntents(expectedIntents);
}
Also used : VplsData(org.onosproject.vpls.api.VplsData) SinglePointToMultiPointIntent(org.onosproject.net.intent.SinglePointToMultiPointIntent) MultiPointToSinglePointIntent(org.onosproject.net.intent.MultiPointToSinglePointIntent) Intent(org.onosproject.net.intent.Intent) Interface(org.onosproject.net.intf.Interface) FilteredConnectPoint(org.onosproject.net.FilteredConnectPoint) Test(org.junit.Test)

Example 53 with VplsData

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

the class VplsManagerTest method testRemoveAllVpls.

/**
 * Removes all VPLS.
 */
@Test
public void testRemoveAllVpls() {
    VplsData vplsData = VplsData.of(VPLS1);
    vplsData.state(ADDED);
    vplsStore.addVpls(vplsData);
    vplsData = VplsData.of(VPLS2, VLAN);
    vplsData.state(ADDED);
    vplsStore.addVpls(vplsData);
    vplsManager.removeAllVpls();
    assertEquals(0, vplsStore.getAllVpls().size());
}
Also used : VplsData(org.onosproject.vpls.api.VplsData) Test(org.junit.Test)

Example 54 with VplsData

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

the class VplsManagerTest method testGetVpls.

/**
 * Gets VPLS by VPLS name.
 */
@Test
public void testGetVpls() {
    VplsData vplsData = VplsData.of(VPLS1);
    vplsData.state(ADDED);
    vplsStore.addVpls(vplsData);
    VplsData result = vplsManager.getVpls(VPLS1);
    assertEquals(vplsData, result);
    result = vplsManager.getVpls(VPLS2);
    assertNull(result);
}
Also used : VplsData(org.onosproject.vpls.api.VplsData) Test(org.junit.Test)

Example 55 with VplsData

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

the class VplsManagerTest method testRemoveInterface.

/**
 * Removes network interfaces one by one from a VPLS.
 */
@Test
public void testRemoveInterface() {
    VplsData vplsData = vplsManager.createVpls(VPLS1, NONE);
    vplsManager.addInterface(vplsData, V100H1);
    vplsManager.addInterface(vplsData, V100H2);
    vplsManager.removeInterface(vplsData, V100H1);
    vplsData = vplsStore.getVpls(VPLS1);
    assertNotNull(vplsData);
    assertEquals(vplsData.state(), UPDATING);
    assertEquals(1, vplsData.interfaces().size());
    assertTrue(vplsData.interfaces().contains(V100H2));
}
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