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);
}
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());
}
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;
}
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());
}
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();
}
Aggregations