WIP:: Initial stab at regions demo for Europe
- Added UK network
- Added France network
Also:
- Augmented "null-simulation start custom" to reset ID seeds.
Change-Id: I643ed7864da76a1077ca089c1c990e9d322bb527
diff --git a/providers/null/src/main/java/org/onosproject/provider/nil/CustomTopologySimulator.java b/providers/null/src/main/java/org/onosproject/provider/nil/CustomTopologySimulator.java
index 9470a48..9ea7138 100644
--- a/providers/null/src/main/java/org/onosproject/provider/nil/CustomTopologySimulator.java
+++ b/providers/null/src/main/java/org/onosproject/provider/nil/CustomTopologySimulator.java
@@ -107,4 +107,13 @@
@Override
protected void createHosts() {
}
+
+ /**
+ * Resets the device and host ID seeds to the default values. That is, the
+ * next assigned values will start from 1 again.
+ */
+ public void resetIdSeeds() {
+ nextDeviceId = 0;
+ nextHostId = 0;
+ }
}
diff --git a/providers/null/src/main/java/org/onosproject/provider/nil/cli/NullControlCommand.java b/providers/null/src/main/java/org/onosproject/provider/nil/cli/NullControlCommand.java
index 6edf6e5..21ed57f 100644
--- a/providers/null/src/main/java/org/onosproject/provider/nil/cli/NullControlCommand.java
+++ b/providers/null/src/main/java/org/onosproject/provider/nil/cli/NullControlCommand.java
@@ -19,7 +19,9 @@
import org.apache.karaf.shell.commands.Command;
import org.onosproject.cfg.ComponentConfigService;
import org.onosproject.cli.AbstractShellCommand;
+import org.onosproject.provider.nil.CustomTopologySimulator;
import org.onosproject.provider.nil.NullProviders;
+import org.onosproject.provider.nil.TopologySimulator;
import static org.onosproject.cli.StartStopCompleter.START;
@@ -30,13 +32,15 @@
description = "Starts or stops topology simulation")
public class NullControlCommand extends AbstractShellCommand {
+ private static final String CUSTOM = "custom";
+
@Argument(index = 0, name = "cmd", description = "Control command: start/stop",
required = true, multiValued = false)
String cmd = null;
@Argument(index = 1, name = "topoShape",
- description = "Topology shape: e.g. configured, linear, reroute, centipede, tree, spineleaf, " +
- ", mesh, fattree",
+ description = "Topology shape: e.g. configured, linear, reroute, " +
+ "centipede, tree, spineleaf, mesh, fattree, custom",
required = false, multiValued = false)
String topoShape = null;
@@ -48,6 +52,18 @@
}
service.setProperty(NullProviders.class.getName(), "enabled",
cmd.equals(START) ? "true" : "false");
+
+ // If we are re-starting the "custom" topology, reset the counts
+ // on the auto-assigned IDs for null-devices and null-hosts, so that
+ // scripts can rely on consistent assignment of IDs to nodes.
+ if (CUSTOM.equals(topoShape) && START.equals(cmd)) {
+ NullProviders npService = get(NullProviders.class);
+ TopologySimulator simulator = npService.currentSimulator();
+ if (simulator instanceof CustomTopologySimulator) {
+ CustomTopologySimulator sim = (CustomTopologySimulator) simulator;
+ sim.resetIdSeeds();
+ }
+ }
}
}