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;
}
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);
}
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());
}
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);
}
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));
}
Aggregations