Fix for ONOS-2567. Restricting the max out port to 65279
Change-Id: Ic5184d8a389ab5eb4fbe83300764fc39773995cf
diff --git a/cli/src/main/java/org/onosproject/cli/net/AddTestFlowsCommand.java b/cli/src/main/java/org/onosproject/cli/net/AddTestFlowsCommand.java
index 23032ca..3469f57 100644
--- a/cli/src/main/java/org/onosproject/cli/net/AddTestFlowsCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/AddTestFlowsCommand.java
@@ -53,6 +53,8 @@
description = "Installs a number of test flow rules - for testing only")
public class AddTestFlowsCommand extends AbstractShellCommand {
+ private static final int MAX_OUT_PORT = 65279;
+
private CountDownLatch latch;
@Argument(index = 0, name = "flowPerDevice", description = "Number of flows to add per device",
@@ -78,7 +80,7 @@
ArrayList<Long> results = Lists.newArrayList();
Iterable<Device> devices = deviceService.getDevices();
TrafficTreatment treatment = DefaultTrafficTreatment.builder()
- .setOutput(PortNumber.portNumber(RandomUtils.nextInt())).build();
+ .setOutput(PortNumber.portNumber(RandomUtils.nextInt(MAX_OUT_PORT))).build();
TrafficSelector.Builder sbuilder;
FlowRuleOperations.Builder rules = FlowRuleOperations.builder();
FlowRuleOperations.Builder remove = FlowRuleOperations.builder();