Search in sources :

Example 1 with Vxlan

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

the class PersistenceDummyEntityFactory method makeTransitVxLan.

private Vxlan makeTransitVxLan(String flowId, PathId pathId) {
    Vxlan entity = Vxlan.builder().flowId(flowId).pathId(pathId).vni(idProvider.provideTransitVxLanId()).build();
    transitVxLanRepository.add(entity);
    return entity;
}
Also used : Vxlan(org.openkilda.model.Vxlan)

Example 2 with Vxlan

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

the class FermaVxlanRepositoryTest method findUnassignedVxlanAndCreate.

private int findUnassignedVxlanAndCreate(String flowId) {
    int availableVni = vxlanRepository.findFirstUnassignedVxlan(MIN_VNI, MAX_VNI).get();
    Vxlan vxlan = Vxlan.builder().vni(availableVni).pathId(new PathId(TEST_FLOW_ID + "_path")).flowId(flowId).build();
    vxlanRepository.add(vxlan);
    return availableVni;
}
Also used : PathId(org.openkilda.model.PathId) Vxlan(org.openkilda.model.Vxlan)

Example 3 with Vxlan

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

the class FermaVxlanRepositoryTest method createVxlan.

private Vxlan createVxlan() {
    Vxlan vxlan = Vxlan.builder().vni(1).pathId(new PathId(TEST_FLOW_ID + "_path")).flowId(TEST_FLOW_ID).build();
    vxlanRepository.add(vxlan);
    return vxlan;
}
Also used : PathId(org.openkilda.model.PathId) Vxlan(org.openkilda.model.Vxlan)

Example 4 with Vxlan

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

the class PersistenceDataAdapterTest method shouldProvideCorrectVxlanEncapsulation.

@Test
public void shouldProvideCorrectVxlanEncapsulation() {
    PathId pathId = new PathId("path1");
    Set<PathId> pathIds = Sets.newHashSet(pathId);
    Vxlan vxlan = Vxlan.builder().flowId("flowId").pathId(pathId).vni(8).build();
    when(vxlanRepository.findByPathId(pathId, null)).thenReturn(Collections.singletonList(vxlan));
    adapter = PersistenceDataAdapter.builder().pathIds(pathIds).persistenceManager(persistenceManager).build();
    FlowTransitEncapsulation actual = adapter.getTransitEncapsulation(pathId, null);
    assertEquals(FlowEncapsulationType.VXLAN, actual.getType());
    assertEquals(vxlan.getVni(), actual.getId().intValue());
    adapter.getTransitEncapsulation(pathId, null);
    verify(transitVlanRepository).findByPathId(pathId, null);
    verify(vxlanRepository).findByPathId(pathId, null);
    verifyNoMoreInteractions(transitVlanRepository);
    verifyNoMoreInteractions(vxlanRepository);
}
Also used : PathId(org.openkilda.model.PathId) Vxlan(org.openkilda.model.Vxlan) FlowTransitEncapsulation(org.openkilda.model.FlowTransitEncapsulation) Test(org.junit.Test)

Example 5 with Vxlan

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

the class VxlanPool method addVxlan.

private VxlanEncapsulation addVxlan(Flow flow, PathId pathId, int vxlan) {
    Vxlan vxlanEntity = Vxlan.builder().vni(vxlan).flowId(flow.getFlowId()).pathId(pathId).build();
    vxlanRepository.add(vxlanEntity);
    return VxlanEncapsulation.builder().vxlan(new Vxlan(vxlanEntity)).build();
}
Also used : Vxlan(org.openkilda.model.Vxlan)

Aggregations

Vxlan (org.openkilda.model.Vxlan)9 Test (org.junit.Test)4 PathId (org.openkilda.model.PathId)3 InMemoryGraphBasedTest (org.openkilda.persistence.inmemory.InMemoryGraphBasedTest)3 FlowTransitEncapsulation (org.openkilda.model.FlowTransitEncapsulation)1