Search in sources :

Example 6 with IslStatus

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

the class InMemoryPathComputerBaseTest method createDiamond.

void createDiamond(IslStatus pathBstatus, IslStatus pathCstatus, int pathBcost, int pathCcost, String switchStart, int startIndex, long pathBlatency, long pathClatency) {
    // A - B - D
    // + C +
    int index = startIndex;
    Switch nodeA = createSwitch(switchStart + format("%02X", index++));
    Switch nodeB = createSwitch(switchStart + format("%02X", index++));
    Switch nodeC = createSwitch(switchStart + format("%02X", index++));
    Switch nodeD = createSwitch(switchStart + format("%02X", index));
    IslStatus actual = (pathBstatus == IslStatus.ACTIVE) && (pathCstatus == IslStatus.ACTIVE) ? IslStatus.ACTIVE : IslStatus.INACTIVE;
    createIsl(nodeA, nodeB, pathBstatus, actual, pathBcost, 1000, 5, pathBlatency);
    createIsl(nodeA, nodeC, pathCstatus, actual, pathCcost, 1000, 6, pathClatency);
    createIsl(nodeB, nodeD, pathBstatus, actual, pathBcost, 1000, 6, pathBlatency);
    createIsl(nodeC, nodeD, pathCstatus, actual, pathCcost, 1000, 5, pathClatency);
    createIsl(nodeB, nodeA, pathBstatus, actual, pathBcost, 1000, 5, pathBlatency);
    createIsl(nodeC, nodeA, pathCstatus, actual, pathCcost, 1000, 6, pathClatency);
    createIsl(nodeD, nodeB, pathBstatus, actual, pathBcost, 1000, 6, pathBlatency);
    createIsl(nodeD, nodeC, pathCstatus, actual, pathCcost, 1000, 5, pathClatency);
}
Also used : Switch(org.openkilda.model.Switch) IslStatus(org.openkilda.model.IslStatus)

Example 7 with IslStatus

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

the class InMemoryPathComputerBaseTest method createTestTopologyForAffinityTesting.

// A - B - C - D    and A-B-C-D is used in flow affinity group
// |   |   |   |
// E   F   \   |
// |   |     \ |
// G - H - - - Z
void createTestTopologyForAffinityTesting() {
    final Switch nodeA = createSwitch("00:0A");
    final Switch nodeB = createSwitch("00:0B");
    final Switch nodeC = createSwitch("00:0C");
    final Switch nodeD = createSwitch("00:0D");
    final Switch nodeE = createSwitch("00:0E");
    final Switch nodeF = createSwitch("00:0F");
    final Switch nodeG = createSwitch("00:01");
    final Switch nodeH = createSwitch("00:02");
    final Switch nodeZ = createSwitch("00:03");
    IslStatus status = IslStatus.ACTIVE;
    int cost = 100;
    long bw = 1000;
    long latency = 1000;
    createBiIsl(nodeA, nodeB, status, status, cost, bw, 1, latency);
    createBiIsl(nodeB, nodeC, status, status, cost, bw, 2, latency);
    createBiIsl(nodeC, nodeD, status, status, cost, bw, 3, latency);
    createBiIsl(nodeA, nodeE, status, status, cost, bw, 4, latency);
    createBiIsl(nodeE, nodeG, status, status, cost, bw, 5, latency);
    createBiIsl(nodeG, nodeH, status, status, cost, bw, 6, latency);
    createBiIsl(nodeB, nodeF, status, status, cost, bw, 7, latency);
    createBiIsl(nodeF, nodeH, status, status, cost, bw, 8, latency);
    createBiIsl(nodeH, nodeZ, status, status, cost, bw, 9, latency);
    createBiIsl(nodeC, nodeZ, status, status, cost, bw, 10, latency);
    createBiIsl(nodeD, nodeZ, status, status, cost, bw, 11, latency);
    int bandwidth = 10;
    Flow flow = Flow.builder().flowId(TEST_FLOW_ID).srcSwitch(nodeA).srcPort(15).destSwitch(nodeD).destPort(16).affinityGroupId(TEST_FLOW_ID).bandwidth(bandwidth).encapsulationType(FlowEncapsulationType.TRANSIT_VLAN).build();
    FlowPath forwardPath = FlowPath.builder().pathId(new PathId(UUID.randomUUID().toString())).srcSwitch(nodeA).destSwitch(nodeD).bandwidth(bandwidth).cookie(new FlowSegmentCookie(1L).toBuilder().direction(FlowPathDirection.FORWARD).build()).build();
    flow.setForwardPath(forwardPath);
    addPathSegment(forwardPath, nodeA, nodeB, 1, 1);
    addPathSegment(forwardPath, nodeB, nodeC, 2, 2);
    addPathSegment(forwardPath, nodeC, nodeD, 3, 3);
    FlowPath reversePath = FlowPath.builder().pathId(new PathId(UUID.randomUUID().toString())).srcSwitch(nodeD).destSwitch(nodeA).bandwidth(bandwidth).cookie(new FlowSegmentCookie(1L).toBuilder().direction(FlowPathDirection.REVERSE).build()).build();
    flow.setReversePath(reversePath);
    addPathSegment(reversePath, nodeD, nodeC, 3, 3);
    addPathSegment(reversePath, nodeC, nodeB, 2, 2);
    addPathSegment(reversePath, nodeB, nodeA, 1, 1);
    flowRepository.add(flow);
}
Also used : PathId(org.openkilda.model.PathId) FlowSegmentCookie(org.openkilda.model.cookie.FlowSegmentCookie) Switch(org.openkilda.model.Switch) IslStatus(org.openkilda.model.IslStatus) FlowPath(org.openkilda.model.FlowPath) Flow(org.openkilda.model.Flow)

Example 8 with IslStatus

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

the class InMemoryPathComputerBaseTest method createDiamondWithDiversity.

// A - B - D    and A-B-D is used in flow diverse group
// + C +
void createDiamondWithDiversity() {
    Switch nodeA = createSwitch("00:0A");
    Switch nodeB = createSwitch("00:0B");
    Switch nodeC = createSwitch("00:0C");
    Switch nodeD = createSwitch("00:0D");
    IslStatus status = IslStatus.ACTIVE;
    int cost = 100;
    createIsl(nodeA, nodeB, status, status, cost, 1000, 1);
    createIsl(nodeA, nodeC, status, status, cost * 2, 1000, 2);
    createIsl(nodeB, nodeD, status, status, cost, 1000, 3);
    createIsl(nodeC, nodeD, status, status, cost * 2, 1000, 4);
    createIsl(nodeB, nodeA, status, status, cost, 1000, 1);
    createIsl(nodeC, nodeA, status, status, cost * 2, 1000, 2);
    createIsl(nodeD, nodeB, status, status, cost, 1000, 3);
    createIsl(nodeD, nodeC, status, status, cost * 2, 1000, 4);
    int bandwith = 10;
    String flowId = "existed-flow";
    String diverseGroupId = "diverse";
    Flow flow = Flow.builder().flowId(flowId).srcSwitch(nodeA).srcPort(15).destSwitch(nodeD).destPort(16).diverseGroupId(diverseGroupId).bandwidth(bandwith).encapsulationType(FlowEncapsulationType.TRANSIT_VLAN).build();
    FlowPath forwardPath = FlowPath.builder().pathId(new PathId(UUID.randomUUID().toString())).srcSwitch(nodeA).destSwitch(nodeD).bandwidth(bandwith).build();
    addPathSegment(forwardPath, nodeA, nodeB, 1, 1);
    addPathSegment(forwardPath, nodeB, nodeD, 3, 3);
    flow.setForwardPath(forwardPath);
    FlowPath reversePath = FlowPath.builder().pathId(new PathId(UUID.randomUUID().toString())).srcSwitch(nodeD).destSwitch(nodeA).bandwidth(bandwith).build();
    addPathSegment(reversePath, nodeD, nodeB, 3, 3);
    addPathSegment(reversePath, nodeB, nodeA, 1, 1);
    flow.setReversePath(reversePath);
    flowRepository.add(flow);
}
Also used : PathId(org.openkilda.model.PathId) Switch(org.openkilda.model.Switch) IslStatus(org.openkilda.model.IslStatus) FlowPath(org.openkilda.model.FlowPath) Flow(org.openkilda.model.Flow)

Aggregations

IslStatus (org.openkilda.model.IslStatus)8 Switch (org.openkilda.model.Switch)4 Flow (org.openkilda.model.Flow)3 FlowPath (org.openkilda.model.FlowPath)3 PathId (org.openkilda.model.PathId)3 FlowSegmentCookie (org.openkilda.model.cookie.FlowSegmentCookie)2 IslDownReason (org.openkilda.model.IslDownReason)1 IslFsmEvent (org.openkilda.wfm.topology.network.controller.isl.IslFsm.IslFsmEvent)1