use of org.onosproject.vpls.api.VplsOperation in project onos by opennetworkinglab.
the class VplsOperationManagerTest method testOptimizeOperationsUToR.
/**
* Optimize operations with first is UPDATE operation and last is REMOVE
* operation.
*/
@Test
public void testOptimizeOperationsUToR() {
Deque<VplsOperation> operations = new ArrayDeque<>();
VplsData vplsData = VplsData.of(VPLS1);
vplsData.addInterfaces(ImmutableSet.of(V100H1));
VplsOperation vplsOperation = VplsOperation.of(vplsData, VplsOperation.Operation.UPDATE);
operations.add(vplsOperation);
vplsData = VplsData.of(VPLS1, EncapsulationType.VLAN);
vplsData.addInterfaces(ImmutableSet.of(V100H1, V100H2));
vplsOperation = VplsOperation.of(vplsData, VplsOperation.Operation.REMOVE);
operations.add(vplsOperation);
vplsOperation = VplsOperationManager.getOptimizedVplsOperation(operations);
assertEquals(VplsOperation.of(vplsData, VplsOperation.Operation.REMOVE), vplsOperation);
}
use of org.onosproject.vpls.api.VplsOperation in project onos by opennetworkinglab.
the class VplsOperationManagerTest method testOptimizeOperationsAToA.
/**
* Optimize operations with first is ADD operation and last is also ADD
* operation.
*/
@Test
public void testOptimizeOperationsAToA() {
Deque<VplsOperation> operations = new ArrayDeque<>();
VplsData vplsData = VplsData.of(VPLS1);
vplsData.addInterfaces(ImmutableSet.of(V100H1));
VplsOperation vplsOperation = VplsOperation.of(vplsData, VplsOperation.Operation.ADD);
operations.add(vplsOperation);
vplsData = VplsData.of(VPLS1, EncapsulationType.VLAN);
vplsData.addInterfaces(ImmutableSet.of(V100H1, V100H2));
vplsOperation = VplsOperation.of(vplsData, VplsOperation.Operation.ADD);
operations.add(vplsOperation);
vplsOperation = VplsOperationManager.getOptimizedVplsOperation(operations);
assertEquals(VplsOperation.of(vplsData, VplsOperation.Operation.ADD), vplsOperation);
}
use of org.onosproject.vpls.api.VplsOperation in project onos by opennetworkinglab.
the class VplsOperationManagerTest method testDuplicateOperationInQueue.
/**
* Submits same operation twice to the manager; the manager should ignore
* duplicated operation.
*/
@Test
@Ignore("Test is brittle - revisit")
public void testDuplicateOperationInQueue() {
VplsData vplsData = VplsData.of(VPLS1);
vplsData.addInterfaces(ImmutableSet.of(V100H1, V100H2));
VplsOperation vplsOperation = VplsOperation.of(vplsData, VplsOperation.Operation.ADD);
vplsOperationManager.submit(vplsOperation);
vplsOperationManager.submit(vplsOperation);
Deque<VplsOperation> opQueue = vplsOperationManager.pendingVplsOperations.get(VPLS1);
assertEquals(1, opQueue.size());
// Clear operation queue before scheduler process it
opQueue.clear();
}
use of org.onosproject.vpls.api.VplsOperation in project onos by opennetworkinglab.
the class VplsOperationManagerTest method testOptimizeOperationsUToA.
/**
* Optimize operations with first is UPDATE operation and last is ADD
* operation.
*/
@Test
public void testOptimizeOperationsUToA() {
Deque<VplsOperation> operations = new ArrayDeque<>();
VplsData vplsData = VplsData.of(VPLS1);
vplsData.addInterfaces(ImmutableSet.of(V100H1));
VplsOperation vplsOperation = VplsOperation.of(vplsData, VplsOperation.Operation.UPDATE);
operations.add(vplsOperation);
vplsData = VplsData.of(VPLS1, EncapsulationType.VLAN);
vplsData.addInterfaces(ImmutableSet.of(V100H1, V100H2));
vplsOperation = VplsOperation.of(vplsData, VplsOperation.Operation.ADD);
operations.add(vplsOperation);
vplsOperation = VplsOperationManager.getOptimizedVplsOperation(operations);
assertEquals(VplsOperation.of(vplsData, VplsOperation.Operation.UPDATE), vplsOperation);
}
Aggregations