Search in sources :

Example 11 with TransitVlan

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);
    });
}
Also used : PathId(org.openkilda.model.PathId) TransitVlan(org.openkilda.model.TransitVlan) Flow(org.openkilda.model.Flow) InMemoryGraphBasedTest(org.openkilda.persistence.inmemory.InMemoryGraphBasedTest) Test(org.junit.Test)

Example 12 with TransitVlan

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;
}
Also used : PathId(org.openkilda.model.PathId) TransitVlan(org.openkilda.model.TransitVlan)

Example 13 with 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());
}
Also used : TransitVlan(org.openkilda.model.TransitVlan) InMemoryGraphBasedTest(org.openkilda.persistence.inmemory.InMemoryGraphBasedTest) Test(org.junit.Test)

Example 14 with TransitVlan

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());
}
Also used : TransitVlan(org.openkilda.model.TransitVlan) InMemoryGraphBasedTest(org.openkilda.persistence.inmemory.InMemoryGraphBasedTest) Test(org.junit.Test)

Example 15 with TransitVlan

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());
}
Also used : TransitVlan(org.openkilda.model.TransitVlan) InMemoryGraphBasedTest(org.openkilda.persistence.inmemory.InMemoryGraphBasedTest) Test(org.junit.Test)

Aggregations

TransitVlan (org.openkilda.model.TransitVlan)15 Test (org.junit.Test)7 PathId (org.openkilda.model.PathId)6 InMemoryGraphBasedTest (org.openkilda.persistence.inmemory.InMemoryGraphBasedTest)5 Flow (org.openkilda.model.Flow)3 FlowTransitEncapsulation (org.openkilda.model.FlowTransitEncapsulation)1 MeterId (org.openkilda.model.MeterId)1 Switch (org.openkilda.model.Switch)1