Allow Lighty build to listen to alternative ports 62/96662/14
authorGuillaume Lambert <guillaume.lambert@orange.com>
Thu, 24 Jun 2021 09:24:05 +0000 (11:24 +0200)
committerguillaume.lambert <guillaume.lambert@orange.com>
Tue, 17 Aug 2021 23:05:44 +0000 (01:05 +0200)
- Add lighty configuration files templates for akka and RESTCONF
- Update lighty clean start script to generate from environment
  variables its configuration files (based on the new templates)

Allowing the controller configuration to listen to alternative ports
is a commodity to run functional tests in parallel.

JIRA: TRNSPRTPCE-482
Signed-off-by: Guillaume Lambert <guillaume.lambert@orange.com>
Change-Id: Ib49dcad14e464bdf60c70dbebf6a22c5eba06699

lighty/src/main/assembly/resources/akka-default_template.conf [new file with mode: 0644]
lighty/src/main/assembly/resources/clean-start-controller.sh
lighty/src/main/assembly/resources/config_template.json [new file with mode: 0644]

diff --git a/lighty/src/main/assembly/resources/akka-default_template.conf b/lighty/src/main/assembly/resources/akka-default_template.conf
new file mode 100644 (file)
index 0000000..a383c86
--- /dev/null
@@ -0,0 +1,56 @@
+akka {
+  remote {
+    artery {
+      enabled = off
+      canonical.hostname = "127.0.0.1"
+      canonical.port = ODL_AKKA_PORT
+    }
+    classic.netty.tcp {
+      hostname = "127.0.0.1"
+      port = ODL_AKKA_PORT
+    }
+    # when under load we might trip a false positive on the failure detector
+    # transport-failure-detector {
+    # heartbeat-interval = 4 s
+    # acceptable-heartbeat-pause = 16s
+    # }
+  }
+
+  actor {
+    provider = "akka.cluster.ClusterActorRefProvider"
+  }
+
+  discovery {
+    method = akka-dns
+  }
+
+  cluster {
+    # Remove ".tcp" when using artery.
+    seed-nodes = ["akka.tcp://opendaylight-cluster-data@127.0.0.1:ODL_AKKA_PORT"]
+
+    roles = [
+      "member-1"
+    ]
+
+  }
+
+  persistence {
+    # By default the snapshots/journal directories live in KARAF_HOME. You can choose to put it somewhere else by
+    # modifying the following two properties. The directory location specified may be a relative or absolute path.
+    # The relative path is always relative to KARAF_HOME.
+
+    snapshot-store.local.dir = "target/snapshots"
+
+    # Use lz4 compression for LocalSnapshotStore snapshots
+    snapshot-store.local.use-lz4-compression = false
+    # Size of blocks for lz4 compression: 64KB, 256KB, 1MB or 4MB
+    snapshot-store.local.lz4-blocksize = 256KB
+
+  }
+  disable-default-actor-system-quarantined-event-handling = "false"
+  management {
+      http {
+         port = ODL_AKKA_MGT_PORT
+      }
+  }
+}
index 07d6a2e916d5ce213f153add1ebbbad2e7e8c705..5fc0707656b937ef9ae8b379ed69e1d81295399e 100755 (executable)
@@ -1,11 +1,36 @@
 #!/bin/sh
 
 BASEDIR=$(dirname "$0")
-#echo "${BASEDIR}"
 cd ${BASEDIR}
 
 rm -rf cache
 rm -rf target
 
+# check if default ports must be overriden
+if [ -z "$USE_ODL_ALT_RESTCONF_PORT" ]; then
+    RESTCONF_PORT=8181
+else
+    RESTCONF_PORT=$USE_ODL_ALT_RESTCONF_PORT
+fi
+if [ -z "$USE_ODL_ALT_WEBSOCKET_PORT" ]; then
+    WEBSOCKET_PORT=8185
+else
+    WEBSOCKET_PORT=$USE_ODL_ALT_WEBSOCKET_PORT
+fi
+if [ -z "$USE_ODL_ALT_AKKA_PORT" ]; then
+    AKKA_PORT=2550
+else
+    AKKA_PORT=$USE_ODL_ALT_AKKA_PORT
+fi
+if [ -z "$USE_ODL_ALT_AKKA_MGT_PORT" ]; then
+    AKKA_MGT_PORT=8558
+else
+    AKKA_MGT_PORT=$USE_ODL_ALT_AKKA_MGT_PORT
+fi
+
+# generate appropriate configuration files
+cat config_template.json | sed -e "s/ODL_RESTCONF_PORT/$RESTCONF_PORT/" -e "s/ODL_WEBSOCKET_PORT/$WEBSOCKET_PORT/" >config.json
+cat akka-default_template.conf | sed -e "s/ODL_AKKA_PORT/$AKKA_PORT/" -e "s/ODL_AKKA_MGT_PORT/$AKKA_MGT_PORT/" >singlenode/akka-default.conf
+
 #start controller
-java -ms128m -mx512m -XX:MaxMetaspaceSize=128m -jar tpce.jar
+java -ms128m -mx512m -XX:MaxMetaspaceSize=128m -jar tpce.jar -restconf config.json
diff --git a/lighty/src/main/assembly/resources/config_template.json b/lighty/src/main/assembly/resources/config_template.json
new file mode 100644 (file)
index 0000000..a16c4a9
--- /dev/null
@@ -0,0 +1,7 @@
+{
+    "restconf":{
+        "inetAddress": "127.0.0.1",
+        "httpPort": ODL_RESTCONF_PORT,
+        "webSocketPort": ODL_WEBSOCKET_PORT
+    }
+}