Search in sources :

Example 1 with TransitVlan

use of org.openkilda.model.TransitVlan in project open-kilda by telstra.

the class FlowValidationTestBase method buildTransitVlanFlow.

protected void buildTransitVlanFlow(String endpointSwitchManufacturer) {
    buildFlow(FlowEncapsulationType.TRANSIT_VLAN, endpointSwitchManufacturer);
    TransitVlan transitVlan = TransitVlan.builder().flowId(TEST_FLOW_ID_A).pathId(FLOW_A_FORWARD_PATH_ID).vlan(FLOW_A_ENCAP_ID).build();
    transitVlanRepository.add(transitVlan);
    TransitVlan transitVlanProtected = TransitVlan.builder().flowId(TEST_FLOW_ID_A).pathId(FLOW_A_FORWARD_PATH_ID_PROTECTED).vlan(FLOW_A_ENCAP_ID_PROTECTED).build();
    transitVlanRepository.add(transitVlanProtected);
}
Also used : TransitVlan(org.openkilda.model.TransitVlan)

Example 2 with TransitVlan

use of org.openkilda.model.TransitVlan in project open-kilda by telstra.

the class FermaTransitVlanRepositoryTest method shouldFindTransitVlan.

@Test
public void shouldFindTransitVlan() {
    TransitVlan vlan = createTransitVlan();
    vlan.setVlan(VLAN);
    Optional<TransitVlan> foundVlan = transitVlanRepository.findByVlan(VLAN);
    assertTrue(foundVlan.isPresent());
    assertEquals(vlan.getVlan(), foundVlan.get().getVlan());
    assertEquals(vlan.getFlowId(), foundVlan.get().getFlowId());
    assertEquals(vlan.getPathId(), foundVlan.get().getPathId());
}
Also used : TransitVlan(org.openkilda.model.TransitVlan) InMemoryGraphBasedTest(org.openkilda.persistence.inmemory.InMemoryGraphBasedTest) Test(org.junit.Test)

Example 3 with TransitVlan

use of org.openkilda.model.TransitVlan in project open-kilda by telstra.

the class FermaTransitVlanRepositoryTest method findUnassignedTransitVlanAndCreate.

private int findUnassignedTransitVlanAndCreate(String flowId) {
    int availableVlan = transitVlanRepository.findFirstUnassignedVlan(MIN_TRANSIT_VLAN, MAX_TRANSIT_VLAN).get();
    TransitVlan transitVlan = TransitVlan.builder().vlan(availableVlan).pathId(new PathId(TEST_FLOW_ID + "_path")).flowId(flowId).build();
    transitVlanRepository.add(transitVlan);
    return availableVlan;
}
Also used : PathId(org.openkilda.model.PathId) TransitVlan(org.openkilda.model.TransitVlan)

Example 4 with TransitVlan

use of org.openkilda.model.TransitVlan in project open-kilda by telstra.

the class SimpleSwitchRuleConverterTest method convertFlowWithIngressVlanIdMatchesTransitVlanId.

@Test
public void convertFlowWithIngressVlanIdMatchesTransitVlanId() {
    Flow flow = buildFlow(FlowEncapsulationType.TRANSIT_VLAN);
    Assert.assertNotEquals(0, flow.getSrcVlan());
    Assert.assertNotNull(flow.getForwardPath());
    TransitVlan encapsulation = TransitVlan.builder().flowId(flow.getFlowId()).pathId(flow.getForwardPathId()).vlan(flow.getSrcVlan()).build();
    List<SimpleSwitchRule> pathView = simpleSwitchRuleConverter.convertFlowPathToSimpleSwitchRules(flow, flow.getForwardPath(), encapsulation, MIN_BURST_SIZE_IN_KBITS, BURST_COEFFICIENT);
    Assert.assertFalse(pathView.isEmpty());
    SimpleSwitchRule ingress = pathView.get(0);
    Assert.assertEquals(Collections.emptyList(), ingress.getOutVlan());
}
Also used : TransitVlan(org.openkilda.model.TransitVlan) Flow(org.openkilda.model.Flow) Test(org.junit.Test)

Example 5 with TransitVlan

use of org.openkilda.model.TransitVlan in project open-kilda by telstra.

the class TransitVlanPool method addVlan.

private TransitVlanEncapsulation addVlan(Flow flow, PathId pathId, int vlan) {
    TransitVlan transitVlanEntity = TransitVlan.builder().vlan(vlan).flowId(flow.getFlowId()).pathId(pathId).build();
    transitVlanRepository.add(transitVlanEntity);
    return TransitVlanEncapsulation.builder().transitVlan(new TransitVlan(transitVlanEntity)).build();
}
Also used : TransitVlan(org.openkilda.model.TransitVlan)

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