From ac9d8932de3813e300b940fda8836a24b0507d26 Mon Sep 17 00:00:00 2001 From: Guillaume Lambert Date: Thu, 24 Jun 2021 11:24:05 +0200 Subject: [PATCH] Allow Lighty build to listen to alternative ports - 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 Change-Id: Ib49dcad14e464bdf60c70dbebf6a22c5eba06699 --- .../resources/akka-default_template.conf | 56 +++++++++++++++++++ .../resources/clean-start-controller.sh | 29 +++++++++- .../assembly/resources/config_template.json | 7 +++ 3 files changed, 90 insertions(+), 2 deletions(-) create mode 100644 lighty/src/main/assembly/resources/akka-default_template.conf create mode 100644 lighty/src/main/assembly/resources/config_template.json 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 index 000000000..a383c86ef --- /dev/null +++ b/lighty/src/main/assembly/resources/akka-default_template.conf @@ -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 + } + } +} diff --git a/lighty/src/main/assembly/resources/clean-start-controller.sh b/lighty/src/main/assembly/resources/clean-start-controller.sh index 07d6a2e91..5fc070765 100755 --- a/lighty/src/main/assembly/resources/clean-start-controller.sh +++ b/lighty/src/main/assembly/resources/clean-start-controller.sh @@ -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 index 000000000..a16c4a981 --- /dev/null +++ b/lighty/src/main/assembly/resources/config_template.json @@ -0,0 +1,7 @@ +{ + "restconf":{ + "inetAddress": "127.0.0.1", + "httpPort": ODL_RESTCONF_PORT, + "webSocketPort": ODL_WEBSOCKET_PORT + } +} -- 2.36.6