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);
}
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);
}
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;
}
Aggregations