use of org.onosproject.vpls.api.VplsData 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.VplsData 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.VplsData 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.VplsData 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);
}
use of org.onosproject.vpls.api.VplsData in project onos by opennetworkinglab.
the class VplsCommandTest method testCreate.
/**
* Creates a new VPLS.
*/
@Test
public void testCreate() {
vplsCommand.command = VplsCommandEnum.CREATE.toString();
vplsCommand.vplsName = VPLS1;
vplsCommand.doExecute();
Collection<VplsData> vplss = vplsCommand.vpls.getAllVpls();
assertEquals(1, vplss.size());
VplsData result = vplss.iterator().next();
VplsData expected = VplsData.of(VPLS1, EncapsulationType.NONE);
assertEquals(expected, result);
}
Aggregations