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