From a22774970d5cb2bcd31afb02db6c01d7563db221 Mon Sep 17 00:00:00 2001 From: "guillaume.lambert" Date: Mon, 28 Jun 2021 13:48:33 +0200 Subject: [PATCH] Allow Karaf to use altern. RESTCONF and akka ports In tests post install script - generate configuration files templates for akka and RESTCONF - patch Karaf exec to generate configuration files from environment variables and 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: Id068b557c7cb4676c7d7b742eb939a34a43e70ff --- .../ressources/post_install_for_tests.sh | 21 ++++++++++++++++++- tox.ini | 8 +++---- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/karaf/src/main/assembly/ressources/post_install_for_tests.sh b/karaf/src/main/assembly/ressources/post_install_for_tests.sh index 3e24b8892..60f382369 100755 --- a/karaf/src/main/assembly/ressources/post_install_for_tests.sh +++ b/karaf/src/main/assembly/ressources/post_install_for_tests.sh @@ -3,4 +3,23 @@ cd $(dirname $0) sed -i'_' -e '1 a\ \ -. \$(dirname \$0)/\.\./\.\./\.\./\.\./tests/reflectwarn.sh' ../bin/karaf +. \$(dirname \$0)/\.\./\.\./\.\./\.\./tests/reflectwarn.sh\ +mkdir -p \$(dirname \$0)/\.\./configuration/initial/\ +if [ -z "$USE_ODL_ALT_RESTCONF_PORT" ]; then\ + RESTCONF_PORT=8181\ +else\ + RESTCONF_PORT=$USE_ODL_ALT_RESTCONF_PORT\ +fi\ +sed -e "s/ODL_RESTCONF_PORT/$RESTCONF_PORT/" \$(dirname \$0)/\.\./ressources/org.ops4j.pax.web._template.cfg >\$(dirname \$0)/\.\./etc/org.ops4j.pax.web.cfg\ +sed -e "s/ODL_RESTCONF_PORT/$RESTCONF_PORT/" \$(dirname \$0)/\.\./ressources/jetty_template.xml >\$(dirname \$0)/\.\./etc/jetty.xml\ +if [ -z "$USE_ODL_ALT_AKKA_PORT" ]; then\ + AKKA_PORT=2550\ +else\ + AKKA_PORT=$USE_ODL_ALT_AKKA_PORT\ +fi\ +sed -e "s/ODL_AKKA_PORT/$AKKA_PORT/" \$(dirname \$0)/\.\./ressources/akka-default_template.conf >\$(dirname \$0)/\.\./configuration/initial/akka.conf\ +' ../bin/karaf + +sed 's/2550/ODL_AKKA_PORT/' ../system/org/opendaylight/controller/sal-clustering-config/*/sal-clustering-config-*-akkaconf.xml >akka-default_template.conf +sed 's/8181/ODL_RESTCONF_PORT/' ../etc/org.ops4j.pax.web.cfg > org.ops4j.pax.web._template.cfg +sed 's/8181/ODL_RESTCONF_PORT/' ../etc/jetty.xml > jetty_template.xml diff --git a/tox.ini b/tox.ini index b763ce428..a26f0dd10 100644 --- a/tox.ini +++ b/tox.ini @@ -34,7 +34,7 @@ commands = #build controller, source JDK_JAVA_OPTIONS to remove illegal reflective acces warnings introduced by Java11 sh -c ". $PWD/reflectwarn.sh && cd .. && mvn clean install -B -q -s tests/odl_settings.xml -DskipTests -Dmaven.javadoc.skip=true -Dodlparent.spotbugs.skip -Dodlparent.checkstyle.skip" sh -c "mv ../olm/src/main/java/org/opendaylight/transportpce/olm/util/OlmUtils.java_ ../olm/src/main/java/org/opendaylight/transportpce/olm/util/OlmUtils.java" -#patch Karaf exec for the same reason at runtime +#patch Karaf exec for the same reason at runtime and also to have the possibility to use alternative ports sh -c "../karaf/target/assembly/ressources/post_install_for_tests.sh" #build Lighty if needed sh -c 'if [ "$USE_LIGHTY" = "True" ]; then (cd ../lighty && ./build.sh); fi' @@ -76,7 +76,7 @@ setenv = USE_ODL_ALT_WEBSOCKET_PORT=8186 USE_ODL_ALT_AKKA_PORT=2551 USE_ODL_ALT_AKKA_MGT_PORT=8559 -# USE_ODL_ALT_RESTCONF_PORT=8182 + USE_ODL_ALT_RESTCONF_PORT=8182 commands = ./launch_tests.sh 1.2.1 {posargs:} # By default, all tests in the folder transportpce_tests/1.2.1/ are run. @@ -98,7 +98,7 @@ setenv = USE_ODL_ALT_WEBSOCKET_PORT=8187 USE_ODL_ALT_AKKA_PORT=2552 USE_ODL_ALT_AKKA_MGT_PORT=8560 -# USE_ODL_ALT_RESTCONF_PORT=8183 + USE_ODL_ALT_RESTCONF_PORT=8183 commands = ./launch_tests.sh 2.2.1 {posargs:} @@ -111,7 +111,7 @@ setenv = USE_ODL_ALT_WEBSOCKET_PORT=8188 USE_ODL_ALT_AKKA_PORT=2553 USE_ODL_ALT_AKKA_MGT_PORT=8561 -# USE_ODL_ALT_RESTCONF_PORT=8184 + USE_ODL_ALT_RESTCONF_PORT=8184 commands = ./launch_tests.sh 7.1 {posargs:} -- 2.36.6