Search in sources :

Example 6 with InstallEgressFlow

use of org.openkilda.messaging.command.flow.InstallEgressFlow in project open-kilda by telstra.

the class ReplaceInstallFlowTest method installEgressPushFlow.

@Test
public void installEgressPushFlow() throws IOException, InterruptedException {
    String value = Resources.toString(getClass().getResource("/install_egress_push_flow.json"), Charsets.UTF_8);
    InstallEgressFlow data = (InstallEgressFlow) prepareData(value);
    OFFlowAdd flowCommand = scheme.egressPushFlowMod(data.getInputPort(), data.getOutputPort(), data.getTransitVlanId(), data.getOutputVlanId(), 123L);
    runTest(value, flowCommand, null, null, null);
}
Also used : InstallEgressFlow(org.openkilda.messaging.command.flow.InstallEgressFlow) OFFlowAdd(org.projectfloodlight.openflow.protocol.OFFlowAdd) Test(org.junit.Test)

Example 7 with InstallEgressFlow

use of org.openkilda.messaging.command.flow.InstallEgressFlow in project open-kilda by telstra.

the class ReplaceInstallFlowTest method installEgressPopFlow.

@Test
public void installEgressPopFlow() throws IOException, InterruptedException {
    String value = Resources.toString(getClass().getResource("/install_egress_pop_flow.json"), Charsets.UTF_8);
    InstallEgressFlow data = (InstallEgressFlow) prepareData(value);
    OFFlowAdd flowCommand = scheme.egressPopFlowMod(data.getInputPort(), data.getOutputPort(), data.getTransitVlanId(), 123L);
    runTest(value, flowCommand, null, null, null);
}
Also used : InstallEgressFlow(org.openkilda.messaging.command.flow.InstallEgressFlow) OFFlowAdd(org.projectfloodlight.openflow.protocol.OFFlowAdd) Test(org.junit.Test)

Example 8 with InstallEgressFlow

use of org.openkilda.messaging.command.flow.InstallEgressFlow in project open-kilda by telstra.

the class Flow method getInstallationCommands.

/**
 * Returns set of installation commands.
 *
 * @param path          sorted path
 * @param correlationId correlation id
 * @return set of {@link CommandMessage} instances
 */
public Set<CommandMessage> getInstallationCommands(final List<Isl> path, final String correlationId) {
    Set<CommandMessage> commands = new HashSet<>();
    Isl firstIsl = path.get(0);
    Isl lastIsl = path.get(path.size() - 1);
    if ((cookie & DIRECT_FLOW_COOKIE) == DIRECT_FLOW_COOKIE) {
        commands.add(new CommandMessage(new InstallIngressFlow(0L, flowId, cookie, sourceSwitch, sourcePort, firstIsl.getSourcePort(), sourceVlan, transitVlan, flowType, bandwidth, 0L), now(), correlationId, Destination.WFM));
        commands.add(new CommandMessage(new InstallEgressFlow(0L, flowId, cookie, destinationSwitch, lastIsl.getDestinationPort(), destinationPort, transitVlan, destinationVlan, flowType), now(), correlationId, Destination.WFM));
    } else {
        commands.add(new CommandMessage(new InstallIngressFlow(0L, flowId, cookie, destinationSwitch, sourcePort, lastIsl.getDestinationPort(), destinationVlan, transitVlan, getReverseFlowType(flowType), bandwidth, 0L), now(), correlationId, Destination.WFM));
        commands.add(new CommandMessage(new InstallEgressFlow(0L, flowId, cookie, sourceSwitch, firstIsl.getSourcePort(), sourcePort, transitVlan, sourceVlan, getReverseFlowType(flowType)), now(), correlationId, Destination.WFM));
    }
    for (int i = 0; i < path.size() - 1; i++) {
        Isl currentIsl = path.get(i);
        Isl nextIsl = path.get(i + 1);
        if ((cookie & DIRECT_FLOW_COOKIE) == DIRECT_FLOW_COOKIE) {
            commands.add(new CommandMessage(new InstallTransitFlow(0L, flowId, cookie, currentIsl.getDestinationSwitch(), currentIsl.getDestinationPort(), nextIsl.getSourcePort(), transitVlan), now(), correlationId, Destination.WFM));
        } else {
            commands.add(new CommandMessage(new InstallTransitFlow(0L, flowId, cookie, currentIsl.getDestinationSwitch(), nextIsl.getSourcePort(), currentIsl.getDestinationPort(), transitVlan), now(), correlationId, Destination.WFM));
        }
    }
    return commands;
}
Also used : InstallIngressFlow(org.openkilda.messaging.command.flow.InstallIngressFlow) InstallTransitFlow(org.openkilda.messaging.command.flow.InstallTransitFlow) InstallEgressFlow(org.openkilda.messaging.command.flow.InstallEgressFlow) CommandMessage(org.openkilda.messaging.command.CommandMessage) HashSet(java.util.HashSet)

Aggregations

InstallEgressFlow (org.openkilda.messaging.command.flow.InstallEgressFlow)8 Test (org.junit.Test)4 OFFlowAdd (org.projectfloodlight.openflow.protocol.OFFlowAdd)4 InstallIngressFlow (org.openkilda.messaging.command.flow.InstallIngressFlow)3 InstallTransitFlow (org.openkilda.messaging.command.flow.InstallTransitFlow)3 HashSet (java.util.HashSet)2 SwitchOperationException (org.openkilda.floodlight.switchmanager.SwitchOperationException)2 CommandMessage (org.openkilda.messaging.command.CommandMessage)2 BaseInstallFlow (org.openkilda.messaging.command.flow.BaseInstallFlow)1 InstallOneSwitchFlow (org.openkilda.messaging.command.flow.InstallOneSwitchFlow)1 InstallMissedFlowsRequest (org.openkilda.messaging.command.switches.InstallMissedFlowsRequest)1 IslInfoData (org.openkilda.messaging.info.event.IslInfoData)1 PathNode (org.openkilda.messaging.info.event.PathNode)1 SwitchInfoData (org.openkilda.messaging.info.event.SwitchInfoData)1