Search in sources :

Example 6 with InstallIngressFlow

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

the class ReplaceInstallFlowTest method installIngressNoneFlow.

@Test
public void installIngressNoneFlow() throws IOException, InterruptedException {
    String value = Resources.toString(getClass().getResource("/install_ingress_none_flow.json"), Charsets.UTF_8);
    InstallIngressFlow data = (InstallIngressFlow) prepareData(value);
    OFMeterMod meterCommand = scheme.installMeter(data.getBandwidth(), 1024, data.getMeterId());
    OFFlowAdd flowCommand = scheme.ingressNoneFlowMod(data.getInputPort(), data.getOutputPort(), data.getTransitVlanId(), data.getMeterId(), 123L);
    runTest(value, flowCommand, meterCommand, null, null);
}
Also used : InstallIngressFlow(org.openkilda.messaging.command.flow.InstallIngressFlow) OFMeterMod(org.projectfloodlight.openflow.protocol.OFMeterMod) OFFlowAdd(org.projectfloodlight.openflow.protocol.OFFlowAdd) Test(org.junit.Test)

Example 7 with InstallIngressFlow

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

the class ReplaceInstallFlowTest method installIngressPopFlow.

@Test
public void installIngressPopFlow() throws IOException, InterruptedException {
    String value = Resources.toString(getClass().getResource("/install_ingress_pop_flow.json"), Charsets.UTF_8);
    InstallIngressFlow data = (InstallIngressFlow) prepareData(value);
    OFMeterMod meterCommand = scheme.installMeter(data.getBandwidth(), 1024, data.getMeterId());
    OFFlowAdd flowCommand = scheme.ingressPopFlowMod(data.getInputPort(), data.getOutputPort(), data.getInputVlanId(), data.getTransitVlanId(), data.getMeterId(), 123L);
    runTest(value, flowCommand, meterCommand, null, null);
}
Also used : InstallIngressFlow(org.openkilda.messaging.command.flow.InstallIngressFlow) OFMeterMod(org.projectfloodlight.openflow.protocol.OFMeterMod) OFFlowAdd(org.projectfloodlight.openflow.protocol.OFFlowAdd) Test(org.junit.Test)

Example 8 with InstallIngressFlow

use of org.openkilda.messaging.command.flow.InstallIngressFlow 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

InstallIngressFlow (org.openkilda.messaging.command.flow.InstallIngressFlow)8 Test (org.junit.Test)4 OFFlowAdd (org.projectfloodlight.openflow.protocol.OFFlowAdd)4 OFMeterMod (org.projectfloodlight.openflow.protocol.OFMeterMod)4 InstallEgressFlow (org.openkilda.messaging.command.flow.InstallEgressFlow)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