use of org.onosproject.vpls.api.VplsData in project onos by opennetworkinglab.
the class VplsManagerTest method testRemoveHost.
/**
* Removes hosts from a VPLS.
*/
@Test
public void testRemoveHost() {
VplsData vplsData = VplsData.of(VPLS1, NONE);
vplsData.addInterface(V100H1);
vplsData.state(ADDED);
vplsStore.addVpls(vplsData);
HostEvent hostEvent = new HostEvent(HostEvent.Type.HOST_REMOVED, V100HOST1);
hostService.postHostEvent(hostEvent);
vplsData = vplsStore.getVpls(VPLS1);
assertNotNull(vplsData);
assertEquals(vplsData.state(), UPDATING);
}
use of org.onosproject.vpls.api.VplsData in project onos by opennetworkinglab.
the class VplsManagerTest method testAddInterface.
/**
* Adds network interfaces one by one to a VPLS.
*/
@Test
public void testAddInterface() {
VplsData vplsData = vplsManager.createVpls(VPLS1, NONE);
vplsManager.addInterface(vplsData, V100H1);
vplsManager.addInterface(vplsData, 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));
}
use of org.onosproject.vpls.api.VplsData in project onos by opennetworkinglab.
the class VplsManagerTest method testSetEncapsulationType.
/**
* Sets encapsulation type for a VPLS.
*/
@Test
public void testSetEncapsulationType() {
VplsData vplsData = vplsManager.createVpls(VPLS1, NONE);
vplsManager.setEncapsulationType(vplsData, EncapsulationType.VLAN);
vplsData = vplsStore.getVpls(VPLS1);
assertNotNull(vplsData);
assertEquals(vplsData.state(), UPDATING);
assertEquals(vplsData.encapsulationType(), EncapsulationType.VLAN);
}
use of org.onosproject.vpls.api.VplsData in project onos by opennetworkinglab.
the class VplsNeighbourHandler method findVpls.
/**
* Finds the VPLS with given neighbour message context.
*
* @param context the neighbour message context
* @return the VPLS for specific neighbour message context
*/
private VplsData findVpls(NeighbourMessageContext context) {
Collection<VplsData> vplses = vplsStore.getAllVpls();
for (VplsData vplsData : vplses) {
Set<Interface> interfaces = vplsData.interfaces();
ConnectPoint port = context.inPort();
VlanId vlanId = context.vlan();
boolean match = interfaces.stream().anyMatch(iface -> iface.connectPoint().equals(port) && iface.vlan().equals(vlanId));
if (match) {
return vplsData;
}
}
return null;
}
use of org.onosproject.vpls.api.VplsData in project onos by opennetworkinglab.
the class VplsOperationManagerTest method testSubmitAddOperationFail.
/**
* Submits an ADD operation to the operation manager; check the VPLS state
* from store if Intent install failed.
*/
@Test
public void testSubmitAddOperationFail() {
vplsOperationManager.intentService = new AlwaysFailureIntentService();
VplsData vplsData = VplsData.of(VPLS1);
vplsData.addInterfaces(ImmutableSet.of(V100H1, V100H2));
VplsOperation vplsOperation = VplsOperation.of(vplsData, VplsOperation.Operation.ADD);
vplsOperationManager.submit(vplsOperation);
assertAfter(OPERATION_DELAY, OPERATION_DURATION, () -> {
Collection<VplsData> vplss = vplsOperationManager.vplsStore.getAllVpls();
assertEquals(1, vplss.size());
VplsData result = vplss.iterator().next();
assertEquals(vplsData, result);
assertEquals(VplsData.VplsState.FAILED, result.state());
});
}
Aggregations