use of org.openkilda.model.TransitVlan in project open-kilda by telstra.
the class TransitVlanPoolTest method gotSameVlanForOppositePath.
@Test
public void gotSameVlanForOppositePath() {
Flow flow = Flow.builder().flowId("flow_1").srcSwitch(SWITCH_A).destSwitch(SWITCH_B).build();
final PathId forwardPathId = new PathId("forward");
final PathId reversePathId = new PathId("reverse");
transactionManager.doInTransaction(() -> {
TransitVlan forward = transitVlanPool.allocate(flow, forwardPathId, reversePathId).getTransitVlan();
TransitVlan reverse = transitVlanPool.allocate(flow, reversePathId, forwardPathId).getTransitVlan();
Assert.assertEquals(forward, reverse);
});
}
use of org.openkilda.model.TransitVlan in project open-kilda by telstra.
the class FermaTransitVlanRepositoryTest method createTransitVlan.
private TransitVlan createTransitVlan() {
TransitVlan transitVlan = TransitVlan.builder().vlan(1).pathId(new PathId(TEST_FLOW_ID + "_path")).flowId(TEST_FLOW_ID).build();
transitVlanRepository.add(transitVlan);
return transitVlan;
}
use of org.openkilda.model.TransitVlan in project open-kilda by telstra.
the class FermaTransitVlanRepositoryTest method shouldDeleteTransitVlan.
@Test
public void shouldDeleteTransitVlan() {
TransitVlan vlan = createTransitVlan();
transactionManager.doInTransaction(() -> transitVlanRepository.remove(vlan));
assertEquals(0, transitVlanRepository.findAll().size());
}
use of org.openkilda.model.TransitVlan in project open-kilda by telstra.
the class FermaTransitVlanRepositoryTest method shouldCreateTransitVlan.
@Test
public void shouldCreateTransitVlan() {
TransitVlan vlan = createTransitVlan();
Collection<TransitVlan> allVlans = transitVlanRepository.findAll();
TransitVlan foundVlan = allVlans.iterator().next();
assertEquals(vlan.getVlan(), foundVlan.getVlan());
assertEquals(TEST_FLOW_ID, foundVlan.getFlowId());
}
use of org.openkilda.model.TransitVlan in project open-kilda by telstra.
the class FermaTransitVlanRepositoryTest method shouldDeleteFoundTransitVlan.
@Test
public void shouldDeleteFoundTransitVlan() {
createTransitVlan();
Collection<TransitVlan> allVlans = transitVlanRepository.findAll();
TransitVlan foundVlan = allVlans.iterator().next();
transactionManager.doInTransaction(() -> transitVlanRepository.remove(foundVlan));
assertEquals(0, transitVlanRepository.findAll().size());
}
Aggregations