Search in sources :

Example 11 with MirrorGroup

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

the class FermaMirrorGroupRepositoryTest method shouldDeleteMirrorGroup.

@Test
public void shouldDeleteMirrorGroup() {
    MirrorGroup mirrorGroup = createMirrorGroup();
    transactionManager.doInTransaction(() -> mirrorGroupRepository.remove(mirrorGroup));
    assertEquals(0, mirrorGroupRepository.findAll().size());
}
Also used : MirrorGroup(org.openkilda.model.MirrorGroup) InMemoryGraphBasedTest(org.openkilda.persistence.inmemory.InMemoryGraphBasedTest) Test(org.junit.Test)

Example 12 with MirrorGroup

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

the class FermaMirrorGroupRepositoryTest method findUnassignedMirrorGroupAndCreate.

private long findUnassignedMirrorGroupAndCreate(String flowId, String pathId) {
    GroupId availableGroupId = mirrorGroupRepository.findFirstUnassignedGroupId(theSwitch.getSwitchId(), MIN_GROUP_ID, MAX_GROUP_ID).get();
    MirrorGroup mirrorGroup = MirrorGroup.builder().switchId(theSwitch.getSwitchId()).groupId(availableGroupId).pathId(new PathId(flowId + "_" + pathId)).flowId(flowId).mirrorGroupType(MirrorGroupType.TRAFFIC_INTEGRITY).mirrorDirection(MirrorDirection.INGRESS).build();
    mirrorGroupRepository.add(mirrorGroup);
    return availableGroupId.getValue();
}
Also used : PathId(org.openkilda.model.PathId) MirrorGroup(org.openkilda.model.MirrorGroup) GroupId(org.openkilda.model.GroupId)

Example 13 with MirrorGroup

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

the class FermaMirrorGroupRepositoryTest method shouldCreateMirrorGroup.

@Test
public void shouldCreateMirrorGroup() {
    createMirrorGroup();
    Collection<MirrorGroup> allMirrorGroups = mirrorGroupRepository.findAll();
    MirrorGroup foundMirrorGroup = allMirrorGroups.iterator().next();
    assertEquals(theSwitch.getSwitchId(), foundMirrorGroup.getSwitchId());
    assertEquals(TEST_FLOW_ID, foundMirrorGroup.getFlowId());
}
Also used : MirrorGroup(org.openkilda.model.MirrorGroup) InMemoryGraphBasedTest(org.openkilda.persistence.inmemory.InMemoryGraphBasedTest) Test(org.junit.Test)

Aggregations

MirrorGroup (org.openkilda.model.MirrorGroup)13 GroupId (org.openkilda.model.GroupId)7 Test (org.junit.Test)6 PathId (org.openkilda.model.PathId)6 InMemoryGraphBasedTest (org.openkilda.persistence.inmemory.InMemoryGraphBasedTest)6 Switch (org.openkilda.model.Switch)5 FlowMirrorPoints (org.openkilda.model.FlowMirrorPoints)4 String.format (java.lang.String.format)2 Collections (java.util.Collections)2 List (java.util.List)2 Map (java.util.Map)2 Optional (java.util.Optional)2 Set (java.util.Set)2 Collectors (java.util.stream.Collectors)2 Slf4j (lombok.extern.slf4j.Slf4j)2 FlowPath (org.openkilda.model.FlowPath)2 SwitchId (org.openkilda.model.SwitchId)2 Generators (com.fasterxml.uuid.Generators)1 NoArgGenerator (com.fasterxml.uuid.NoArgGenerator)1 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1