lists.osmocom.org
Sign In Sign Up
Manage this list Sign In Sign Up

Keyboard Shortcuts

Thread View

  • j: Next unread message
  • k: Previous unread message
  • j a: Jump to all threads
  • j l: Jump to MailingList overview

gerrit-log

Thread Start a new thread
Download
Threads by month
  • ----- 2026 -----
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2025 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2024 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2023 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2022 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
gerrit-log@lists.osmocom.org

January 2023

  • 1 participants
  • 2205 discussions
Change in docker-playground[master]: network_create: find free subnet automatically
by osmith 16 Jan '23

16 Jan '23
osmith has submitted this change. ( https://gerrit.osmocom.org/c/docker-playground/+/30770 ) Change subject: network_create: find free subnet automatically ...................................................................... network_create: find free subnet automatically Try multiple subnet numbers until successfully creating a network. This way we can run the same ttcn3 testsuite multiple times in parallel without conflicts (e.g. once against latest, once against nightly). Also we don't need to make sure each new testsuite has a unique subnet number anymore. I've considered also adjusting network_bridge_create, but that gets used exclusively by osmo-ran/jenkins.sh, a script which we don't actually run in jenkins. It seems that in this script it makes more sense to not get a random subnet number. Related: OS#5802 Change-Id: I57152b08ef0f38e17e7019a8df032189b03f56cf --- M jenkins-common.sh M nplab-m3ua-test/jenkins.sh M nplab-sua-test/jenkins.sh M osmo-gsm-tester/jenkins.sh M scripts/regen_doc.sh M ttcn3-bsc-test-vamos/jenkins.sh M ttcn3-bsc-test/jenkins-sccplite.sh M ttcn3-bsc-test/jenkins.sh M ttcn3-bscnat-test/jenkins.sh M ttcn3-bts-test/jenkins.sh M ttcn3-cbc-test/jenkins.sh M ttcn3-fr-test/jenkins.sh M ttcn3-gbproxy-test-fr/jenkins.sh M ttcn3-gbproxy-test/jenkins.sh M ttcn3-ggsn-test/jenkins-ogs.sh M ttcn3-ggsn-test/jenkins.sh M ttcn3-hlr-test/jenkins.sh M ttcn3-hnbgw-test/jenkins.sh M ttcn3-hnodeb-test/jenkins.sh M ttcn3-mgw-test/jenkins.sh M ttcn3-msc-test/jenkins.sh M ttcn3-nitb-sysinfo/jenkins.sh M ttcn3-ns-test/jenkins-fr.sh M ttcn3-ns-test/jenkins-sgsn-sns.sh M ttcn3-ns-test/jenkins-sns.sh M ttcn3-ns-test/jenkins.sh M ttcn3-pcap-client-test/jenkins.sh M ttcn3-pcu-test/jenkins-sns.sh M ttcn3-pcu-test/jenkins.sh M ttcn3-pgw-test/jenkins.sh M ttcn3-remsim-test/jenkins.sh M ttcn3-sccp-test/jenkins.sh M ttcn3-sgsn-test/jenkins.sh M ttcn3-sip-test/jenkins.sh M ttcn3-smlc-test/jenkins.sh M ttcn3-stp-test/jenkins.sh M ttcn3-upf-test/jenkins.sh 37 files changed, 156 insertions(+), 96 deletions(-) Approvals: fixeria: Looks good to me, approved pespin: Looks good to me, but someone else must approve Jenkins Builder: Verified diff --git a/jenkins-common.sh b/jenkins-common.sh index 3a30ea0..758c4d0 100644 --- a/jenkins-common.sh +++ b/jenkins-common.sh @@ -195,8 +195,9 @@ docker network inspect $NET_NAME | grep Name | cut -d : -f2 | awk -F\" 'NR>1{print $2}' | xargs -rn1 docker kill } +# Create network and find a free subnet automatically. The global variable +# SUBNET gets set to the subnet number that has been used. network_create() { - NET=$1 if docker network ls | grep -q $NET_NAME; then set +x echo "Removing stale network and containers..." @@ -204,12 +205,33 @@ network_clean network_remove fi - SUB4="172.18.$NET.0/24" - SUB6="fd02:db8:$NET::/64" + + SUBNET="$PPID" + for i in $(seq 1 30); do + SUBNET="$(echo "($SUBNET + 1) % 256" | bc)" + SUB4="172.18.$SUBNET.0/24" + SUB6="fd02:db8:$SUBNET::/64" + set +x + echo "Creating network $NET_NAME, trying SUBNET=$SUBNET..." + set -x + if docker network create \ + --internal \ + --subnet "$SUB4" \ + --ipv6 \ + --subnet "$SUB6" \ + "$NET_NAME"; then + set +x + echo + echo "### Network $NET_NAME created (SUBNET=$SUBNET) ###" + echo + set -x + return + fi + done + set +x - echo "Creating network $NET_NAME" - set -x - docker network create --internal --subnet $SUB4 --ipv6 --subnet $SUB6 $NET_NAME + echo "ERROR: failed to create docker network" + exit 1 } network_bridge_create() { @@ -241,8 +263,40 @@ docker network remove $NET_NAME } +network_replace_subnet_in_configs() { + set +x + + local i + local files="$(find \ + "$VOL_BASE_DIR" \ + -name '*.cfg' -o \ + -name '*.conf' -o \ + -name '*.sh' -o \ + -name '*.txt' -o \ + -name '*.yaml' \ + )" + + if [ -z "$files" ]; then + echo "ERROR: network_replace_subnet_in_configs:" \ + "no config files found!" + exit 1 + fi + + for i in $files; do + echo "Applying SUBNET=$SUBNET to: $i" + sed \ + -i \ + -E \ + -e "s/172\.18\.[0-9]{1,3}\./172.18.$SUBNET./g" \ + -e "s/fd02:db8:[0-9]{1,3}:/fd02:db8:$SUBNET:/g" \ + "$i" + done + + set -x +} + # Generates list of params to pass to "docker run" to configure IP addresses -# $1: SUBNET to use, same as passed to network_create() +# $1: SUBNET to use, same as set by network_create() # $2: Address suffix from SUBNET to apply to the container docker_network_params() { NET=$1 diff --git a/nplab-m3ua-test/jenkins.sh b/nplab-m3ua-test/jenkins.sh index 87035f3..1b71671 100755 --- a/nplab-m3ua-test/jenkins.sh +++ b/nplab-m3ua-test/jenkins.sh @@ -18,8 +18,8 @@ mkdir $VOL_BASE_DIR/stp cp osmo-stp.cfg $VOL_BASE_DIR/stp/ -SUBNET=7 -network_create $SUBNET +network_create +network_replace_subnet_in_configs # start container with STP in background docker run --rm \ diff --git a/nplab-sua-test/jenkins.sh b/nplab-sua-test/jenkins.sh index 4be00c8..6ee52ee 100755 --- a/nplab-sua-test/jenkins.sh +++ b/nplab-sua-test/jenkins.sh @@ -18,8 +18,8 @@ mkdir $VOL_BASE_DIR/stp cp osmo-stp.cfg $VOL_BASE_DIR/stp/ -SUBNET=6 -network_create $SUBNET +network_create +network_replace_subnet_in_configs # start container with STP in background docker run --rm \ diff --git a/osmo-gsm-tester/jenkins.sh b/osmo-gsm-tester/jenkins.sh index 85e6a69..ae04d1e 100755 --- a/osmo-gsm-tester/jenkins.sh +++ b/osmo-gsm-tester/jenkins.sh @@ -72,15 +72,15 @@ set_clean_up_trap set -e -SUBNET=50 -network_create $SUBNET - mkdir $VOL_BASE_DIR/ogt-slave cp osmo-gsm-tester-slave.sh $VOL_BASE_DIR/ogt-slave/ mkdir $VOL_BASE_DIR/ogt-master cp osmo-gsm-tester-master.sh $VOL_BASE_DIR/ogt-master/ +network_create +network_replace_subnet_in_configs + echo Starting container with osmo-gsm-tester slave docker run --rm \ --cap-add=NET_ADMIN \ diff --git a/scripts/regen_doc.sh b/scripts/regen_doc.sh index 012c12a..27c3138 100755 --- a/scripts/regen_doc.sh +++ b/scripts/regen_doc.sh @@ -21,8 +21,7 @@ docker_images_require \ "$NAME-$IMAGE_SUFFIX" -SUBNET=16 -network_create "$SUBNET" +network_create container_create() { CONTAINERNAME=$1 diff --git a/ttcn3-bsc-test-vamos/jenkins.sh b/ttcn3-bsc-test-vamos/jenkins.sh index 3f7f1ec..c859fd6 100755 --- a/ttcn3-bsc-test-vamos/jenkins.sh +++ b/ttcn3-bsc-test-vamos/jenkins.sh @@ -23,8 +23,8 @@ mkdir $VOL_BASE_DIR/bts-omldummy -SUBNET=31 -network_create $SUBNET +network_create +network_replace_subnet_in_configs echo Starting container with STP docker run --rm \ diff --git a/ttcn3-bsc-test/jenkins-sccplite.sh b/ttcn3-bsc-test/jenkins-sccplite.sh index 6dac56a..2343b4a 100755 --- a/ttcn3-bsc-test/jenkins-sccplite.sh +++ b/ttcn3-bsc-test/jenkins-sccplite.sh @@ -22,8 +22,8 @@ mkdir $VOL_BASE_DIR/bts-omldummy -SUBNET=12 -network_create $SUBNET +network_create +network_replace_subnet_in_configs echo Starting container with BSC docker run --rm \ diff --git a/ttcn3-bsc-test/jenkins.sh b/ttcn3-bsc-test/jenkins.sh index 2138169..149e0d1 100755 --- a/ttcn3-bsc-test/jenkins.sh +++ b/ttcn3-bsc-test/jenkins.sh @@ -23,8 +23,8 @@ mkdir $VOL_BASE_DIR/bts-omldummy -SUBNET=2 -network_create $SUBNET +network_create +network_replace_subnet_in_configs echo Starting container with STP docker run --rm \ diff --git a/ttcn3-bscnat-test/jenkins.sh b/ttcn3-bscnat-test/jenkins.sh index a63cdad..7837476 100755 --- a/ttcn3-bscnat-test/jenkins.sh +++ b/ttcn3-bscnat-test/jenkins.sh @@ -17,8 +17,8 @@ cp osmo-bsc-nat.cfg $VOL_BASE_DIR/bscnat/ cp bscs.config $VOL_BASE_DIR/bscnat/ -SUBNET=15 -network_create $SUBNET +network_create +network_replace_subnet_in_configs echo Starting container with BSCNAT docker run --rm \ diff --git a/ttcn3-bts-test/jenkins.sh b/ttcn3-bts-test/jenkins.sh index 3f1f2f1..691c753 100755 --- a/ttcn3-bts-test/jenkins.sh +++ b/ttcn3-bts-test/jenkins.sh @@ -121,8 +121,7 @@ $REPO_USER/ttcn3-bts-test } -SUBNET=9 -network_create $SUBNET +network_create mkdir $VOL_BASE_DIR/bts-tester-generic cp generic/BTS_Tests.cfg $VOL_BASE_DIR/bts-tester-generic/ @@ -162,6 +161,7 @@ mkdir $VOL_BASE_DIR/virtphy # 1) classic test suite with BSC for OML and trxcon+fake_trx +network_replace_subnet_in_configs start_bsc start_bts trx 1 start_fake_trx @@ -180,6 +180,7 @@ sed -i "/^ logging level osmux info/d" $VOL_BASE_DIR/bts/osmo-bts.gen.cfg sed -i "/^ osmux/{N;N;N;N;d;}" $VOL_BASE_DIR/bts/osmo-bts.gen.cfg fi +network_replace_subnet_in_configs start_bts virtual 0 start_virtphy # ... and execute the testsuite again with different cfg @@ -197,6 +198,7 @@ sed -i "/^ logging level osmux info/d" $VOL_BASE_DIR/bts/osmo-bts.gen.cfg sed -i "/^ osmux/{N;N;N;N;d;}" $VOL_BASE_DIR/bts/osmo-bts.gen.cfg fi +network_replace_subnet_in_configs start_bts trx 1 start_fake_trx start_trxcon @@ -213,6 +215,7 @@ fi # restart the BSC/BTS and run the testsuite again docker container kill ${BUILD_TAG}-bts +network_replace_subnet_in_configs start_bsc start_bts trx 1 start_testsuite hopping diff --git a/ttcn3-cbc-test/jenkins.sh b/ttcn3-cbc-test/jenkins.sh index 63bf3f9..e1958ef 100755 --- a/ttcn3-cbc-test/jenkins.sh +++ b/ttcn3-cbc-test/jenkins.sh @@ -16,8 +16,8 @@ mkdir $VOL_BASE_DIR/cbc cp osmo-cbc.cfg $VOL_BASE_DIR/cbc/ -SUBNET=27 -network_create $SUBNET +network_create +network_replace_subnet_in_configs echo Starting container with CBC docker run --rm \ diff --git a/ttcn3-fr-test/jenkins.sh b/ttcn3-fr-test/jenkins.sh index 182f512..9122063 100755 --- a/ttcn3-fr-test/jenkins.sh +++ b/ttcn3-fr-test/jenkins.sh @@ -18,9 +18,6 @@ docker container rm ${BUILD_TAG}-frnet ${BUILD_TAG}-ttcn3-fr-test } -SUBNET=26 -network_create $SUBNET - mkdir $VOL_BASE_DIR/fr-tester # if we don't change permissions, dumpcap fails to write (despite starting it as root!) chmod a+w $VOL_BASE_DIR/fr-tester @@ -33,6 +30,9 @@ mkdir $VOL_BASE_DIR/unix +network_create +network_replace_subnet_in_configs + echo Starting container with FRNET docker run \ `# --rm is done in clean_up()` \ diff --git a/ttcn3-gbproxy-test-fr/jenkins.sh b/ttcn3-gbproxy-test-fr/jenkins.sh index f4827a8..ab62bc1 100755 --- a/ttcn3-gbproxy-test-fr/jenkins.sh +++ b/ttcn3-gbproxy-test-fr/jenkins.sh @@ -22,9 +22,6 @@ set_clean_up_trap set -e -SUBNET=25 -network_create $SUBNET - mkdir $VOL_BASE_DIR/gbproxy-tester # if we don't change permissions, dumpcap fails to write (despite starting it as root!) chmod a+w $VOL_BASE_DIR/gbproxy-tester @@ -36,6 +33,9 @@ mkdir $VOL_BASE_DIR/unix +network_create +network_replace_subnet_in_configs + echo Starting container with gbproxy docker run --rm \ --cap-add=NET_RAW --cap-add=SYS_RAWIO \ diff --git a/ttcn3-gbproxy-test/jenkins.sh b/ttcn3-gbproxy-test/jenkins.sh index f8fae0f..0ee7a5f 100755 --- a/ttcn3-gbproxy-test/jenkins.sh +++ b/ttcn3-gbproxy-test/jenkins.sh @@ -9,9 +9,6 @@ set_clean_up_trap set -e -SUBNET=24 -network_create $SUBNET - mkdir $VOL_BASE_DIR/gbproxy-tester # if we don't change permissions, dumpcap fails to write (despite starting it as root!) chmod a+w $VOL_BASE_DIR/gbproxy-tester @@ -24,6 +21,9 @@ mkdir $VOL_BASE_DIR/unix +network_create +network_replace_subnet_in_configs + echo Starting container with gbproxy docker run --rm \ $(docker_network_params $SUBNET 10) \ diff --git a/ttcn3-ggsn-test/jenkins-ogs.sh b/ttcn3-ggsn-test/jenkins-ogs.sh index b6500f0..93cc33a 100755 --- a/ttcn3-ggsn-test/jenkins-ogs.sh +++ b/ttcn3-ggsn-test/jenkins-ogs.sh @@ -24,8 +24,8 @@ cp ogs/upfd.sh $VOL_BASE_DIR/ggsn/ cp ogs/upfd-setup.sh $VOL_BASE_DIR/ggsn/ -SUBNET=3 -network_create $SUBNET +network_create +network_replace_subnet_in_configs # start container with ggsn (smf+upf) in background docker run --cap-add=NET_ADMIN \ diff --git a/ttcn3-ggsn-test/jenkins.sh b/ttcn3-ggsn-test/jenkins.sh index 0797f76..00995bf 100755 --- a/ttcn3-ggsn-test/jenkins.sh +++ b/ttcn3-ggsn-test/jenkins.sh @@ -23,8 +23,7 @@ mkdir $VOL_BASE_DIR/ggsn -SUBNET=3 -network_create $SUBNET +network_create # start container with ggsn in background GGSN_CMD="osmo-ggsn -c /data/osmo-ggsn.cfg" @@ -32,6 +31,7 @@ if [ "$KERNEL_TEST" = "1" ]; then cp osmo-ggsn-kernel-gtp.cfg $VOL_BASE_DIR/ggsn/osmo-ggsn.cfg cp initrd-ggsn.sh $VOL_BASE_DIR/ggsn/ + network_replace_subnet_in_configs kernel_test_prepare \ "defconfig" \ @@ -50,6 +50,7 @@ OSMO_SUT_HOST="172.18.$SUBNET.200" else cp osmo-ggsn.cfg $VOL_BASE_DIR/ggsn/ + network_replace_subnet_in_configs GGSN_DOCKER_ARGS=" $(docker_network_params $SUBNET 201) diff --git a/ttcn3-hlr-test/jenkins.sh b/ttcn3-hlr-test/jenkins.sh index 317f141..66d102e 100755 --- a/ttcn3-hlr-test/jenkins.sh +++ b/ttcn3-hlr-test/jenkins.sh @@ -9,9 +9,6 @@ set_clean_up_trap set -e -SUBNET=10 -network_create $SUBNET - mkdir $VOL_BASE_DIR/hlr-tester cp HLR_Tests.cfg $VOL_BASE_DIR/hlr-tester/ write_mp_osmo_repo "$VOL_BASE_DIR/hlr-tester/HLR_Tests.cfg" @@ -19,6 +16,9 @@ mkdir $VOL_BASE_DIR/hlr cp osmo-hlr.cfg $VOL_BASE_DIR/hlr/ +network_create +network_replace_subnet_in_configs + echo Starting container with HLR docker run --rm \ $(docker_network_params $SUBNET 20) \ diff --git a/ttcn3-hnbgw-test/jenkins.sh b/ttcn3-hnbgw-test/jenkins.sh index fee2728..5a40e5b 100755 --- a/ttcn3-hnbgw-test/jenkins.sh +++ b/ttcn3-hnbgw-test/jenkins.sh @@ -19,8 +19,7 @@ $VOL_BASE_DIR_PFCP/hnbgw-tester/junit-xml-with-pfcp-*.log } -SUBNET=35 -network_create $SUBNET +network_create run_tests() { base_dir="$1" @@ -42,6 +41,8 @@ mkdir $base_dir/unix + network_replace_subnet_in_configs + echo Starting container with STP docker run --rm \ $(docker_network_params $SUBNET 200) \ diff --git a/ttcn3-hnodeb-test/jenkins.sh b/ttcn3-hnodeb-test/jenkins.sh index 358280d..21e72c0 100755 --- a/ttcn3-hnodeb-test/jenkins.sh +++ b/ttcn3-hnodeb-test/jenkins.sh @@ -20,8 +20,8 @@ mkdir $VOL_BASE_DIR/unix -SUBNET=33 -network_create $SUBNET +network_create +network_replace_subnet_in_configs echo Starting container with HNodeB docker run --rm \ diff --git a/ttcn3-mgw-test/jenkins.sh b/ttcn3-mgw-test/jenkins.sh index 2dee534..7b31f6d 100755 --- a/ttcn3-mgw-test/jenkins.sh +++ b/ttcn3-mgw-test/jenkins.sh @@ -20,8 +20,8 @@ sed -i "/^ osmux bind-ip-v6 fd02:db8:4::180/d" $VOL_BASE_DIR/mgw/osmo-mgw.cfg fi -SUBNET=4 -network_create $SUBNET +network_create +network_replace_subnet_in_configs # start container with mgw in background docker run --rm \ diff --git a/ttcn3-msc-test/jenkins.sh b/ttcn3-msc-test/jenkins.sh index a8e6229..6a0f3d5 100755 --- a/ttcn3-msc-test/jenkins.sh +++ b/ttcn3-msc-test/jenkins.sh @@ -10,9 +10,6 @@ set_clean_up_trap set -e -SUBNET=20 -network_create $SUBNET - mkdir $VOL_BASE_DIR/msc-tester mkdir $VOL_BASE_DIR/msc-tester/unix cp MSC_Tests.cfg $VOL_BASE_DIR/msc-tester/ @@ -27,6 +24,9 @@ mkdir $VOL_BASE_DIR/unix +network_create +network_replace_subnet_in_configs + echo Starting container with STP docker run --rm \ $(docker_network_params $SUBNET 200) \ diff --git a/ttcn3-nitb-sysinfo/jenkins.sh b/ttcn3-nitb-sysinfo/jenkins.sh index e2cc494..7a912f8 100755 --- a/ttcn3-nitb-sysinfo/jenkins.sh +++ b/ttcn3-nitb-sysinfo/jenkins.sh @@ -19,8 +19,8 @@ docker container stop -t 0 ${BUILD_TAG}-sysinfo-helper } -SUBNET=5 -network_create $SUBNET +network_create +network_replace_subnet_in_configs # start container with nitb in background docker volume rm nitb-vol diff --git a/ttcn3-ns-test/jenkins-fr.sh b/ttcn3-ns-test/jenkins-fr.sh index e30f6f9..3b609ab 100755 --- a/ttcn3-ns-test/jenkins-fr.sh +++ b/ttcn3-ns-test/jenkins-fr.sh @@ -22,9 +22,6 @@ set_clean_up_trap set -e -SUBNET=30 -network_create $SUBNET - mkdir $VOL_BASE_DIR/ns-tester cp fr/NS_Tests.cfg $VOL_BASE_DIR/ns-tester/ write_mp_osmo_repo "$VOL_BASE_DIR/ns-tester/NS_Tests.cfg" @@ -32,6 +29,9 @@ mkdir $VOL_BASE_DIR/ns cp fr/osmo-ns-dummy.cfg $VOL_BASE_DIR/ns/ +network_create +network_replace_subnet_in_configs + echo Starting container with osmo-ns-dummy docker run --rm \ --cap-add=NET_RAW --cap-add=SYS_RAWIO \ diff --git a/ttcn3-ns-test/jenkins-sgsn-sns.sh b/ttcn3-ns-test/jenkins-sgsn-sns.sh index 4f90421..712b38c 100755 --- a/ttcn3-ns-test/jenkins-sgsn-sns.sh +++ b/ttcn3-ns-test/jenkins-sgsn-sns.sh @@ -9,9 +9,6 @@ set_clean_up_trap set -e -SUBNET=32 -network_create $SUBNET - mkdir $VOL_BASE_DIR/ns-tester cp sgsn-sns/NS_Tests.cfg $VOL_BASE_DIR/ns-tester/ write_mp_osmo_repo "$VOL_BASE_DIR/ns-tester/NS_Tests.cfg" @@ -19,6 +16,9 @@ mkdir $VOL_BASE_DIR/ns cp sgsn-sns/osmo-ns-dummy.cfg $VOL_BASE_DIR/ns/ +network_create +network_replace_subnet_in_configs + echo Starting container with osmo-ns-dummy docker run --rm \ $(docker_network_params $SUBNET 101) \ diff --git a/ttcn3-ns-test/jenkins-sns.sh b/ttcn3-ns-test/jenkins-sns.sh index c2fd651..1ed983b 100755 --- a/ttcn3-ns-test/jenkins-sns.sh +++ b/ttcn3-ns-test/jenkins-sns.sh @@ -9,9 +9,6 @@ set_clean_up_trap set -e -SUBNET=29 -network_create $SUBNET - mkdir $VOL_BASE_DIR/ns-tester cp sns/NS_Tests.cfg $VOL_BASE_DIR/ns-tester/ write_mp_osmo_repo "$VOL_BASE_DIR/ns-tester/NS_Tests.cfg" @@ -19,6 +16,9 @@ mkdir $VOL_BASE_DIR/ns cp sns/osmo-ns-dummy.cfg $VOL_BASE_DIR/ns/ +network_create +network_replace_subnet_in_configs + echo Starting container with osmo-ns-dummy docker run --rm \ $(docker_network_params $SUBNET 101) \ diff --git a/ttcn3-ns-test/jenkins.sh b/ttcn3-ns-test/jenkins.sh index af0552c..755af51 100755 --- a/ttcn3-ns-test/jenkins.sh +++ b/ttcn3-ns-test/jenkins.sh @@ -9,9 +9,6 @@ set_clean_up_trap set -e -SUBNET=28 -network_create $SUBNET - mkdir $VOL_BASE_DIR/ns-tester cp NS_Tests.cfg $VOL_BASE_DIR/ns-tester/ write_mp_osmo_repo "$VOL_BASE_DIR/ns-tester/NS_Tests.cfg" @@ -19,6 +16,9 @@ mkdir $VOL_BASE_DIR/ns cp osmo-ns-dummy.cfg $VOL_BASE_DIR/ns/ +network_create +network_replace_subnet_in_configs + echo Starting container with osmo-ns-dummy docker run --rm \ $(docker_network_params $SUBNET 101) \ diff --git a/ttcn3-pcap-client-test/jenkins.sh b/ttcn3-pcap-client-test/jenkins.sh index 253b6c2..a5769a4 100755 --- a/ttcn3-pcap-client-test/jenkins.sh +++ b/ttcn3-pcap-client-test/jenkins.sh @@ -16,8 +16,8 @@ mkdir $VOL_BASE_DIR/pcap-client cp osmo-pcap-client.cfg $VOL_BASE_DIR/pcap-client/ -SUBNET=31 -network_create $SUBNET +network_create +network_replace_subnet_in_configs echo Starting container with pcap-client docker run --rm \ diff --git a/ttcn3-pcu-test/jenkins-sns.sh b/ttcn3-pcu-test/jenkins-sns.sh index dfcf403..393e828 100755 --- a/ttcn3-pcu-test/jenkins-sns.sh +++ b/ttcn3-pcu-test/jenkins-sns.sh @@ -9,9 +9,6 @@ set_clean_up_trap set -e -SUBNET=14 -network_create $SUBNET - mkdir $VOL_BASE_DIR/pcu-tester mkdir $VOL_BASE_DIR/pcu-tester/unix cp sns/PCU_Tests.cfg $VOL_BASE_DIR/pcu-tester/ @@ -23,6 +20,9 @@ mkdir $VOL_BASE_DIR/unix +network_create +network_replace_subnet_in_configs + echo Starting container with PCU docker run --rm \ $(docker_network_params $SUBNET 101) \ diff --git a/ttcn3-pcu-test/jenkins.sh b/ttcn3-pcu-test/jenkins.sh index 4c0455d..ee53bb7 100755 --- a/ttcn3-pcu-test/jenkins.sh +++ b/ttcn3-pcu-test/jenkins.sh @@ -9,9 +9,6 @@ set_clean_up_trap set -e -SUBNET=13 -network_create $SUBNET - mkdir $VOL_BASE_DIR/pcu-tester mkdir $VOL_BASE_DIR/pcu-tester/unix cp PCU_Tests.cfg $VOL_BASE_DIR/pcu-tester/ @@ -23,6 +20,9 @@ mkdir $VOL_BASE_DIR/unix +network_create +network_replace_subnet_in_configs + echo Starting container with PCU docker run --rm \ $(docker_network_params $SUBNET 101) \ diff --git a/ttcn3-pgw-test/jenkins.sh b/ttcn3-pgw-test/jenkins.sh index 2810899..a61584d 100755 --- a/ttcn3-pgw-test/jenkins.sh +++ b/ttcn3-pgw-test/jenkins.sh @@ -19,8 +19,8 @@ cp upfd.sh $VOL_BASE_DIR/pgw/ cp upfd-setup.sh $VOL_BASE_DIR/pgw/ -SUBNET=18 -network_create $SUBNET +network_create +network_replace_subnet_in_configs # start container with open5gs-nrfd in background docker run --rm \ diff --git a/ttcn3-remsim-test/jenkins.sh b/ttcn3-remsim-test/jenkins.sh index b9e74b4..a7325e7 100755 --- a/ttcn3-remsim-test/jenkins.sh +++ b/ttcn3-remsim-test/jenkins.sh @@ -62,8 +62,7 @@ $REPO_USER/ttcn3-remsim-test } -SUBNET=17 -network_create $SUBNET +network_create mkdir $VOL_BASE_DIR/remsim-tester @@ -76,23 +75,26 @@ # 1) server test suite -start_server cp REMSIM_Tests.cfg $VOL_BASE_DIR/remsim-tester/ write_mp_osmo_repo "$VOL_BASE_DIR/remsim-tester/REMSIM_Tests.cfg" +network_replace_subnet_in_configs +start_server start_testsuite docker container kill ${BUILD_TAG}-server # 2) bankd test suite echo "Changing to bankd configuration" -start_bankd cp bankd/REMSIM_Tests.cfg $VOL_BASE_DIR/remsim-tester/ write_mp_osmo_repo "$VOL_BASE_DIR/remsim-tester/REMSIM_Tests.cfg" +network_replace_subnet_in_configs +start_bankd start_testsuite docker container kill ${BUILD_TAG}-bankd # 3) client test suite echo "Changing to client configuration" -start_client cp client/REMSIM_Tests.cfg $VOL_BASE_DIR/remsim-tester/ write_mp_osmo_repo "$VOL_BASE_DIR/remsim-tester/REMSIM_Tests.cfg" +network_replace_subnet_in_configs +start_client start_testsuite diff --git a/ttcn3-sccp-test/jenkins.sh b/ttcn3-sccp-test/jenkins.sh index 3a3346a..7eadd5d 100755 --- a/ttcn3-sccp-test/jenkins.sh +++ b/ttcn3-sccp-test/jenkins.sh @@ -17,8 +17,8 @@ mkdir $VOL_BASE_DIR/sccp cp sccp_demo_user.cfg $VOL_BASE_DIR/sccp/ -SUBNET=22 -network_create $SUBNET +network_create +network_replace_subnet_in_configs echo Starting container with sccp_demo_user docker run --rm \ diff --git a/ttcn3-sgsn-test/jenkins.sh b/ttcn3-sgsn-test/jenkins.sh index dde90a2..9238096 100755 --- a/ttcn3-sgsn-test/jenkins.sh +++ b/ttcn3-sgsn-test/jenkins.sh @@ -10,9 +10,6 @@ set_clean_up_trap set -e -SUBNET=8 -network_create $SUBNET - mkdir $VOL_BASE_DIR/sgsn-tester cp SGSN_Tests.cfg $VOL_BASE_DIR/sgsn-tester/ write_mp_osmo_repo "$VOL_BASE_DIR/sgsn-tester/SGSN_Tests.cfg" @@ -25,6 +22,9 @@ mkdir $VOL_BASE_DIR/unix +network_create +network_replace_subnet_in_configs + echo Starting container with STP docker run --rm \ $(docker_network_params $SUBNET 200) \ diff --git a/ttcn3-sip-test/jenkins.sh b/ttcn3-sip-test/jenkins.sh index 334f791..2a20dcc 100755 --- a/ttcn3-sip-test/jenkins.sh +++ b/ttcn3-sip-test/jenkins.sh @@ -9,9 +9,6 @@ set_clean_up_trap set -e -SUBNET=11 -network_create $SUBNET - mkdir $VOL_BASE_DIR/sip-tester mkdir $VOL_BASE_DIR/sip-tester/unix cp SIP_Tests.cfg $VOL_BASE_DIR/sip-tester/ @@ -23,6 +20,9 @@ mkdir $VOL_BASE_DIR/unix +network_create +network_replace_subnet_in_configs + echo Starting container with osmo-sip-connector docker run --rm \ $(docker_network_params $SUBNET 10) \ diff --git a/ttcn3-smlc-test/jenkins.sh b/ttcn3-smlc-test/jenkins.sh index 8aeed92..33a1293 100755 --- a/ttcn3-smlc-test/jenkins.sh +++ b/ttcn3-smlc-test/jenkins.sh @@ -20,8 +20,8 @@ mkdir $VOL_BASE_DIR/smlc cp osmo-smlc.cfg $VOL_BASE_DIR/smlc/ -SUBNET=23 -network_create $SUBNET +network_create +network_replace_subnet_in_configs echo Starting container with STP docker run --rm \ diff --git a/ttcn3-stp-test/jenkins.sh b/ttcn3-stp-test/jenkins.sh index 23434f3..006bb3b 100755 --- a/ttcn3-stp-test/jenkins.sh +++ b/ttcn3-stp-test/jenkins.sh @@ -16,8 +16,8 @@ mkdir $VOL_BASE_DIR/stp cp osmo-stp.cfg $VOL_BASE_DIR/stp/ -SUBNET=19 -network_create $SUBNET +network_create +network_replace_subnet_in_configs echo Starting container with STP docker run --rm \ diff --git a/ttcn3-upf-test/jenkins.sh b/ttcn3-upf-test/jenkins.sh index 2fb6d43..f814975 100755 --- a/ttcn3-upf-test/jenkins.sh +++ b/ttcn3-upf-test/jenkins.sh @@ -16,8 +16,8 @@ mkdir $VOL_BASE_DIR/upf cp osmo-upf.cfg $VOL_BASE_DIR/upf/ -SUBNET=34 -network_create $SUBNET +network_create +network_replace_subnet_in_configs echo Starting container with UPF docker run --rm \ -- To view, visit https://gerrit.osmocom.org/c/docker-playground/+/30770 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: docker-playground Gerrit-Branch: master Gerrit-Change-Id: I57152b08ef0f38e17e7019a8df032189b03f56cf Gerrit-Change-Number: 30770 Gerrit-PatchSet: 3 Gerrit-Owner: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de> Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
Change in libosmocore[master]: socket.h: Introduce API osmo_sockaddr_netmask_to_prefixlen()
by pespin 16 Jan '23

16 Jan '23
Attention is currently required from: pespin. Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/libosmocore/+/30986 to look at the new patch set (#2). Change subject: socket.h: Introduce API osmo_sockaddr_netmask_to_prefixlen() ...................................................................... socket.h: Introduce API osmo_sockaddr_netmask_to_prefixlen() Implementation is imported from osmo-ggsn.git 97f60e3dca581797007524e0006ca9fafad59713 in46a_netmasklen() and adapter to work with an osmo_sockaddr. This will be used by osmocom-bb's "modem" app. Change-Id: I75e75e251c6776801fffdde745aebedf21c68799 --- M TODO-RELEASE M include/osmocom/core/socket.h M src/socket.c M tests/socket/socket_test.c 4 files changed, 118 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/86/30986/2 -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/30986 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I75e75e251c6776801fffdde745aebedf21c68799 Gerrit-Change-Number: 30986 Gerrit-PatchSet: 2 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Attention: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newpatchset
1 0
0 0
Change in osmo-ci[master]: jobs/gerrit-verifications-comment: rename
by pespin 16 Jan '23

16 Jan '23
Attention is currently required from: osmith. pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-ci/+/30987 ) Change subject: jobs/gerrit-verifications-comment: rename ...................................................................... Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/osmo-ci/+/30987 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ci Gerrit-Branch: master Gerrit-Change-Id: I1b947522aa5f2bb21f5e438db9df3420c998f1bc Gerrit-Change-Number: 30987 Gerrit-PatchSet: 1 Gerrit-Owner: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: osmith <osmith(a)sysmocom.de> Gerrit-Comment-Date: Mon, 16 Jan 2023 15:07:57 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
Change in osmo-ci[master]: jobs/gerrit-verifications: osmo-trx: fix matrix
by osmith 16 Jan '23

16 Jan '23
osmith has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ci/+/30985 ) Change subject: jobs/gerrit-verifications: osmo-trx: fix matrix ...................................................................... jobs/gerrit-verifications: osmo-trx: fix matrix Add the missing comma between "--without-sse, --without-neon", so the matrix works as expected. Without this patch, the two builds with these flags didn't run. Change-Id: I51e58765dd33b15df2e9f2eb09c1260724e4ec9c --- M jobs/gerrit-verifications.yml 1 file changed, 1 insertion(+), 1 deletion(-) Approvals: Jenkins Builder: Verified pespin: Looks good to me, but someone else must approve Hoernchen: Looks good to me, approved diff --git a/jobs/gerrit-verifications.yml b/jobs/gerrit-verifications.yml index 10cc91b..0f35fcd 100644 --- a/jobs/gerrit-verifications.yml +++ b/jobs/gerrit-verifications.yml @@ -281,7 +281,7 @@ - osmo-trx: slave_axis: !!python/tuple [osmocom-gerrit,rpi4-raspbian11] a1_name: INSTR - a1: !!python/tuple [--with-sse, --without-sse --with-neon, --with-neon-vfpv4] + a1: !!python/tuple [--with-sse, --without-sse, --with-neon, --with-neon-vfpv4] a2_name: WITH_MANUALS a2: !!python/tuple ["1", "0"] combination_filter: > -- To view, visit https://gerrit.osmocom.org/c/osmo-ci/+/30985 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ci Gerrit-Branch: master Gerrit-Change-Id: I51e58765dd33b15df2e9f2eb09c1260724e4ec9c Gerrit-Change-Number: 30985 Gerrit-PatchSet: 1 Gerrit-Owner: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: Hoernchen <ewild(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: merged
1 0
0 0
Change in docker-playground[master]: network_create: find free subnet automatically
by fixeria 16 Jan '23

16 Jan '23
Attention is currently required from: osmith, daniel. fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/docker-playground/+/30770 ) Change subject: network_create: find free subnet automatically ...................................................................... Patch Set 2: Code-Review+2 (1 comment) File jenkins-common.sh: https://gerrit.osmocom.org/c/docker-playground/+/30770/comment/01963a39_19c… PS2, Line 211: SUBNET="$(echo "($SUBNET + 1) % 256" | bc)" I was about to say that with $(expr ...) this can be done simpler: SUBNET=$(expr ($SUBNET + 1) % 256) but as it turned out it requires escaping of the parentheses: SUBNET=$(expr \( $SUBNET + 1 \) % 256) -- To view, visit https://gerrit.osmocom.org/c/docker-playground/+/30770 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: docker-playground Gerrit-Branch: master Gerrit-Change-Id: I57152b08ef0f38e17e7019a8df032189b03f56cf Gerrit-Change-Number: 30770 Gerrit-PatchSet: 2 Gerrit-Owner: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de> Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de> Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: osmith <osmith(a)sysmocom.de> Gerrit-Attention: daniel <dwillmann(a)sysmocom.de> Gerrit-Comment-Date: Mon, 16 Jan 2023 15:00:05 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
Change in osmo-ci[master]: jobs/gerrit-verifications: osmo-trx: fix matrix
by Hoernchen 16 Jan '23

16 Jan '23
Attention is currently required from: osmith. Hoernchen has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-ci/+/30985 ) Change subject: jobs/gerrit-verifications: osmo-trx: fix matrix ...................................................................... Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/osmo-ci/+/30985 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ci Gerrit-Branch: master Gerrit-Change-Id: I51e58765dd33b15df2e9f2eb09c1260724e4ec9c Gerrit-Change-Number: 30985 Gerrit-PatchSet: 1 Gerrit-Owner: osmith <osmith(a)sysmocom.de> Gerrit-Reviewer: Hoernchen <ewild(a)sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: pespin <pespin(a)sysmocom.de> Gerrit-Attention: osmith <osmith(a)sysmocom.de> Gerrit-Comment-Date: Mon, 16 Jan 2023 14:49:38 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
1 0
0 0
Change in osmo-ci[master]: jobs/gerrit-verifications-comment: rename
by osmith 16 Jan '23

16 Jan '23
osmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ci/+/30987 ) Change subject: jobs/gerrit-verifications-comment: rename ...................................................................... jobs/gerrit-verifications-comment: rename Rename the jenkins job from gerrit-pipeline-result to gerrit-verifications-comment, as the next patch will not only use this job to post a comment at the end of the gerrit verification, but also at the beginning when the pipeline starts. Give the pipeline_summary* scripts more generic names as well. Change-Id: I1b947522aa5f2bb21f5e438db9df3420c998f1bc --- R jobs/gerrit-verifications-comment.yml M jobs/gerrit-verifications.yml R scripts/jenkins-gerrit/comment_generate.py R scripts/jenkins-gerrit/comment_send.sh 4 files changed, 9 insertions(+), 9 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ci refs/changes/87/30987/1 diff --git a/jobs/gerrit-pipeline-result.yml b/jobs/gerrit-verifications-comment.yml similarity index 92% rename from jobs/gerrit-pipeline-result.yml rename to jobs/gerrit-verifications-comment.yml index e1a7a74..1c672b9 100644 --- a/jobs/gerrit-pipeline-result.yml +++ b/jobs/gerrit-verifications-comment.yml @@ -2,12 +2,12 @@ # post a list of failed/successful job links to gerrit and to vote +V/-V. - project: - name: gerrit-pipeline-result + name: gerrit-verifications-comment jobs: - - 'gerrit-pipeline-result' + - 'gerrit-verifications-comment' - job: - name: 'gerrit-pipeline-result' + name: 'gerrit-verifications-comment' project-type: freestyle node: osmocom-gerrit retry-count: 3 # scm checkout @@ -68,7 +68,7 @@ wipe-workspace: true builders: - - shell: 'cd scripts/jenkins-gerrit && ./pipeline_summary_send.sh' + - shell: 'cd scripts/jenkins-gerrit && ./comment_send.sh' wrappers: - ansicolor: diff --git a/jobs/gerrit-verifications.yml b/jobs/gerrit-verifications.yml index 10cc91b..cf2ceb4 100644 --- a/jobs/gerrit-verifications.yml +++ b/jobs/gerrit-verifications.yml @@ -501,17 +501,17 @@ }} }} }} - stage("Result") {{ + stage("Result Comment") {{ steps {{ echo "PIPELINE_BUILD_PASSED=${{env.PIPELINE_BUILD_PASSED}}" echo "PIPELINE_LINT_PASSED=${{env.PIPELINE_LINT_PASSED}}" echo "PIPELINE_DEB_PASSED=${{env.PIPELINE_DEB_PASSED}}" echo "PIPELINE_RPM_PASSED=${{env.PIPELINE_RPM_PASSED}}" - // Run the result job to get successful/failed links and add a + // Run the comment job to get successful/failed links and add a // comment + vote to gerrit script {{ - build job: 'gerrit-pipeline-result', parameters: [ + build job: 'gerrit-verifications-comment', parameters: [ string(name: "GERRIT_PROJECT", value: "${{env.GERRIT_PROJECT}}"), string(name: "GERRIT_CHANGE_NUMBER", value: "${{env.GERRIT_CHANGE_NUMBER}}"), string(name: "GERRIT_PATCHSET_NUMBER", value: "${{env.GERRIT_PATCHSET_NUMBER}}"), diff --git a/scripts/jenkins-gerrit/pipeline_summary.py b/scripts/jenkins-gerrit/comment_generate.py similarity index 98% rename from scripts/jenkins-gerrit/pipeline_summary.py rename to scripts/jenkins-gerrit/comment_generate.py index 53c0f4a..d4937c0 100755 --- a/scripts/jenkins-gerrit/pipeline_summary.py +++ b/scripts/jenkins-gerrit/comment_generate.py @@ -28,7 +28,7 @@ def stage_from_job_name(job_name): - if job_name == "gerrit-pipeline-result": + if job_name == "gerrit-verifications-comment": # The job that runs this script. Don't include it in the summary. return None if job_name == "gerrit-lint": diff --git a/scripts/jenkins-gerrit/pipeline_summary_send.sh b/scripts/jenkins-gerrit/comment_send.sh similarity index 92% rename from scripts/jenkins-gerrit/pipeline_summary_send.sh rename to scripts/jenkins-gerrit/comment_send.sh index 29ea860..bd7b81d 100755 --- a/scripts/jenkins-gerrit/pipeline_summary_send.sh +++ b/scripts/jenkins-gerrit/comment_send.sh @@ -16,7 +16,7 @@ set -x -./pipeline_summary.py "$PIPELINE_BUILD_URL" \ +./comment_generate.py "$PIPELINE_BUILD_URL" \ -o gerrit_report.json \ $arg_notify -- To view, visit https://gerrit.osmocom.org/c/osmo-ci/+/30987 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ci Gerrit-Branch: master Gerrit-Change-Id: I1b947522aa5f2bb21f5e438db9df3420c998f1bc Gerrit-Change-Number: 30987 Gerrit-PatchSet: 1 Gerrit-Owner: osmith <osmith(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
Change in osmo-ci[master]: jobs/gerrit-verifications: post comment on start
by osmith 16 Jan '23

16 Jan '23
osmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ci/+/30988 ) Change subject: jobs/gerrit-verifications: post comment on start ...................................................................... jobs/gerrit-verifications: post comment on start Post a link to gerrit when starting the build that contains the link to the pipeline, without sending mail notifications. This is useful when a gerrit verification build takes rather long, and it's not clear if a build for gerrit verification was actually started or not. Also I find this useful when debugging the CI scripts. Change-Id: I75c5b8874f606739ff557ff0711bb9449a2b4259 --- M jobs/gerrit-verifications-comment.yml M jobs/gerrit-verifications.yml M scripts/jenkins-gerrit/comment_generate.py M scripts/jenkins-gerrit/comment_send.sh 4 files changed, 52 insertions(+), 10 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ci refs/changes/88/30988/1 diff --git a/jobs/gerrit-verifications-comment.yml b/jobs/gerrit-verifications-comment.yml index 1c672b9..f781bf8 100644 --- a/jobs/gerrit-verifications-comment.yml +++ b/jobs/gerrit-verifications-comment.yml @@ -1,5 +1,6 @@ -# This job runs at the end of the pipeline in gerrit-verififactions.yml, to -# post a list of failed/successful job links to gerrit and to vote +V/-V. +# This job runs at the start/end of the pipeline in gerrit-verifications.yml. +# On start it posts a link to the pipeline to gerrit, and on end a list of +# failed/successful job links together with a vote +V/-V. - project: name: gerrit-verifications-comment @@ -18,7 +19,7 @@ artifact-days-to-keep: -1 artifact-num-to-keep: -1 description: | - Result job of CI for patches sent to <a href="https://gerrit.osmocom.org">gerrit</a>. + Send start and result comments to <a href="https://gerrit.osmocom.org">gerrit</a>. </br></br> Related issue: <a href="https://osmocom.org/issues/2385">OS#2385</a> @@ -29,6 +30,9 @@ osmo-ci.git branch default: 'master' - string: + name: COMMENT_TYPE + description: set by gerrit verification pipeline job + - string: name: GERRIT_PROJECT description: set by gerrit verification pipeline job - string: diff --git a/jobs/gerrit-verifications.yml b/jobs/gerrit-verifications.yml index cf2ceb4..c59c6f9 100644 --- a/jobs/gerrit-verifications.yml +++ b/jobs/gerrit-verifications.yml @@ -416,6 +416,29 @@ stages {{ stage("Verification") {{ parallel {{ + stage("Start Comment") {{ + steps {{ + // Run the comment job to add the pipeline link to gerrit + script {{ + // Keep going on failure + catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {{ + build job: 'gerrit-verifications-comment', parameters: [ + string(name: "COMMENT_TYPE", value: "start"), + string(name: "GERRIT_PROJECT", value: "${{env.GERRIT_PROJECT}}"), + string(name: "GERRIT_CHANGE_NUMBER", value: "${{env.GERRIT_CHANGE_NUMBER}}"), + string(name: "GERRIT_PATCHSET_NUMBER", value: "${{env.GERRIT_PATCHSET_NUMBER}}"), + string(name: "GERRIT_BRANCH", value: "${{env.GERRIT_BRANCH}}"), + string(name: "GERRIT_HOST", value: "${{env.GERRIT_HOST}}"), + string(name: "GERRIT_PATCHSET_REVISION", value: "${{env.GERRIT_PATCHSET_REVISION}}"), + string(name: "GERRIT_PATCHSET_UPLOADER_NAME", value: "${{env.GERRIT_PATCHSET_UPLOADER_NAME}}"), + string(name: "GERRIT_PORT", value: "${{env.GERRIT_PORT}}"), + string(name: "GERRIT_REFSPEC", value: "${{env.GERRIT_REFSPEC}}"), + string(name: "PIPELINE_BUILD_URL", value: "${{env.BUILD_URL}}"), + ] + }} + }} + }} + }} stage("Build") {{ when {{ expression {{ params.PIPELINE_BUILD }} @@ -512,6 +535,7 @@ // comment + vote to gerrit script {{ build job: 'gerrit-verifications-comment', parameters: [ + string(name: "COMMENT_TYPE", value: "result"), string(name: "GERRIT_PROJECT", value: "${{env.GERRIT_PROJECT}}"), string(name: "GERRIT_CHANGE_NUMBER", value: "${{env.GERRIT_CHANGE_NUMBER}}"), string(name: "GERRIT_PATCHSET_NUMBER", value: "${{env.GERRIT_PATCHSET_NUMBER}}"), diff --git a/scripts/jenkins-gerrit/comment_generate.py b/scripts/jenkins-gerrit/comment_generate.py index d4937c0..dc69f8f 100755 --- a/scripts/jenkins-gerrit/comment_generate.py +++ b/scripts/jenkins-gerrit/comment_generate.py @@ -15,12 +15,16 @@ def parse_args(): parser = argparse.ArgumentParser( - description="Get a summary of failed / successful builds from the CI" - " pipeline we run for patches submitted to gerrit.") + description="Prepare a comment to be submitted to gerrit. Depending on" + " the comment type, (start) either a link to the pipeline," + " or (result) a summary of failed / successful builds from" + " the pipeline we run for patches submitted to gerrit.") parser.add_argument("build_url", help="$BUILD_URL of the pipeline job, e.g." " https://jenkins.osmocom.org/jenkins/job/gerrit-osmo-bsc-nat/17/") parser.add_argument("-o", "--output", help="output json file") + parser.add_argument("-t", "--type", help="comment type", + choices=["start", "result"], required=True) parser.add_argument("-n", "--notify-on-success", action="store_true", help="always indicate in json that the owner should be" " notified via mail, not only on failure") @@ -153,7 +157,7 @@ return ret -def get_pipeline_summary(build_url, notify_on_success): +def get_comment_result(build_url, notify_on_success): """ Generate a summary of failed and successful builds for gerrit. :returns: a dict that is expected by gerrit's set-review api, e.g. {"tag": "jenkins", @@ -211,17 +215,26 @@ "notify": notify} +def get_comment_start(build_url): + return {"tag": "jenkins", + "message": f"Build Started\n{build_url}consoleFull", + "notify": "NONE"} + + def main(): args = parse_args() - summary = get_pipeline_summary(args.build_url, args.notify_on_success) + if args.type == "result": + comment = get_comment_result(args.build_url, args.notify_on_success) + else: + comment = get_comment_start(args.build_url) print() - print(summary["message"]) - print(f"notify: {summary['notify']}") + print(comment["message"]) + print(f"notify: {comment['notify']}") if args.output: with open(args.output, "w") as handle: - json.dump(summary, handle, indent=4) + json.dump(comment, handle, indent=4) if __name__ == "__main__": main() diff --git a/scripts/jenkins-gerrit/comment_send.sh b/scripts/jenkins-gerrit/comment_send.sh index bd7b81d..24fec27 100755 --- a/scripts/jenkins-gerrit/comment_send.sh +++ b/scripts/jenkins-gerrit/comment_send.sh @@ -18,6 +18,7 @@ ./comment_generate.py "$PIPELINE_BUILD_URL" \ -o gerrit_report.json \ + -t "$COMMENT_TYPE" \ $arg_notify ssh \ -- To view, visit https://gerrit.osmocom.org/c/osmo-ci/+/30988 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ci Gerrit-Branch: master Gerrit-Change-Id: I75c5b8874f606739ff557ff0711bb9449a2b4259 Gerrit-Change-Number: 30988 Gerrit-PatchSet: 1 Gerrit-Owner: osmith <osmith(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
Change in libosmocore[master]: socket.h: Introduce API osmo_sockaddr_netmask_to_prefixlen()
by Jenkins Builder 16 Jan '23

16 Jan '23
Jenkins Builder has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/30986 ) Change subject: socket.h: Introduce API osmo_sockaddr_netmask_to_prefixlen() ...................................................................... Patch Set 1: (2 comments) File src/socket.c: Robot Comment from checkpatch (run ID jenkins-gerrit-lint-2772): https://gerrit.osmocom.org/c/libosmocore/+/30986/comment/bb81ad80_e3e7da64 PS1, Line 1306: uint8_t *b = (uint8_t*) &bits; "(foo*)" should be "(foo *)" Robot Comment from checkpatch (run ID jenkins-gerrit-lint-2772): https://gerrit.osmocom.org/c/libosmocore/+/30986/comment/710472e9_5703c1d3 PS1, Line 1323: uint8_t *b = (uint8_t*) &bits; "(foo*)" should be "(foo *)" -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/30986 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I75e75e251c6776801fffdde745aebedf21c68799 Gerrit-Change-Number: 30986 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-CC: Jenkins Builder Gerrit-Comment-Date: Mon, 16 Jan 2023 13:57:22 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Gerrit-MessageType: comment
1 0
0 0
Change in libosmocore[master]: socket.h: Introduce API osmo_sockaddr_netmask_to_prefixlen()
by pespin 16 Jan '23

16 Jan '23
pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/30986 ) Change subject: socket.h: Introduce API osmo_sockaddr_netmask_to_prefixlen() ...................................................................... socket.h: Introduce API osmo_sockaddr_netmask_to_prefixlen() Implementation is imported from osmo-ggsn.git 97f60e3dca581797007524e0006ca9fafad59713 in46a_netmasklen() and adapter to work with an osmo_sockaddr. This will be used by osmocom-bb's "modem" app. Change-Id: I75e75e251c6776801fffdde745aebedf21c68799 --- M TODO-RELEASE M include/osmocom/core/socket.h M src/socket.c M tests/socket/socket_test.c 4 files changed, 118 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/86/30986/1 diff --git a/TODO-RELEASE b/TODO-RELEASE index 6ac8db8..86363e1 100644 --- a/TODO-RELEASE +++ b/TODO-RELEASE @@ -7,5 +7,5 @@ # If any interfaces have been added since the last public release: c:r:a + 1. # If any interfaces have been removed or changed since the last public release: c:r:0. #library what description / commit summary line -libosmocore new API osmo_sockaddr_is_any() +libosmocore new API osmo_sockaddr_is_any(), osmo_sockaddr_netmask_to_prefixlen() libosmocore ABI breakage OSMO_NUM_DLIB change affecting internal_cat[] diff --git a/include/osmocom/core/socket.h b/include/osmocom/core/socket.h index 06db5d0..3ed9cc6 100644 --- a/include/osmocom/core/socket.h +++ b/include/osmocom/core/socket.h @@ -50,6 +50,8 @@ int osmo_sockaddr_to_octets(uint8_t *dst, size_t dst_maxlen, const struct osmo_sockaddr *os); int osmo_sockaddr_from_octets(struct osmo_sockaddr *os, const void *src, size_t src_len); +int osmo_sockaddr_netmask_to_prefixlen(const struct osmo_sockaddr *addr); + const char *osmo_sockaddr_to_str(const struct osmo_sockaddr *sockaddr); char *osmo_sockaddr_to_str_buf(char *buf, size_t buf_len, const struct osmo_sockaddr *sockaddr); diff --git a/src/socket.c b/src/socket.c index 3d945e7..9ce3d1e 100644 --- a/src/socket.c +++ b/src/socket.c @@ -1291,6 +1291,63 @@ } } +static unsigned int in6_addr_netmask_to_prefixlen(const struct in6_addr *netmask) +{ + #if defined(__linux__) + #define ADDRFIELD(i) s6_addr32[i] + #else + #define ADDRFIELD(i) __u6_addr.__u6_addr32[i] + #endif + + unsigned int i, j, prefix = 0; + + for (j = 0; j < 4; j++) { + uint32_t bits = netmask->ADDRFIELD(j); + uint8_t *b = (uint8_t*) &bits; + for (i = 0; i < 4; i++) { + while (b[i] & 0x80) { + prefix++; + b[i] = b[i] << 1; + } + } + } + + #undef ADDRFIELD + + return prefix; +} + +static unsigned int in_addr_netmask_to_prefixlen(const struct in_addr *netmask) +{ + uint32_t bits = netmask->s_addr; + uint8_t *b = (uint8_t*) &bits; + unsigned int i, prefix = 0; + + for (i = 0; i < 4; i++) { + while (b[i] & 0x80) { + prefix++; + b[i] = b[i] << 1; + } + } + return prefix; +} + +/*! Convert netmask to prefix length representation + * \param[in] netmask sockaddr containing a netmask (consecutive list of 1-bit followed by consecutive list of 0-bit) + * \returns prefix length representation of the netmask (count of 1-bit from the start of the netmask), negative on error. + */ +int osmo_sockaddr_netmask_to_prefixlen(const struct osmo_sockaddr *netmask) +{ + switch (netmask->u.sa.sa_family) { + case AF_INET6: + return in6_addr_netmask_to_prefixlen(&netmask->u.sin6.sin6_addr); + case AF_INET: + return in_addr_netmask_to_prefixlen(&netmask->u.sin.sin_addr); + default: + return -ENOTSUP; + } +} + /*! Initialize a unix domain socket (including bind/connect) * \param[in] type Socket type like SOCK_DGRAM, SOCK_STREAM * \param[in] proto Protocol like IPPROTO_TCP, IPPROTO_UDP diff --git a/tests/socket/socket_test.c b/tests/socket/socket_test.c index d090fba..62a5e28 100644 --- a/tests/socket/socket_test.c +++ b/tests/socket/socket_test.c @@ -385,6 +385,63 @@ OSMO_ASSERT(!strncmp("[2003:1234:5678:90ab:cdef:1234:4321:4321]:23420", result, sizeof(buf))); } +static void test_osa_netmask_prefixlen(void) +{ + struct osmo_sockaddr ipv4; + struct osmo_sockaddr ipv6; + int rc; + + ipv4.u.sin = (struct sockaddr_in){ + .sin_family = AF_INET, + }; + + ipv4.u.sin.sin_addr.s_addr = inet_addr("0.0.0.0"); + rc = osmo_sockaddr_netmask_to_prefixlen(&ipv4); + OSMO_ASSERT(rc == 0); + + ipv4.u.sin.sin_addr.s_addr = inet_addr("255.0.0.0"); + rc = osmo_sockaddr_netmask_to_prefixlen(&ipv4); + OSMO_ASSERT(rc == 8); + + ipv4.u.sin.sin_addr.s_addr = inet_addr("255.255.0.0"); + rc = osmo_sockaddr_netmask_to_prefixlen(&ipv4); + OSMO_ASSERT(rc == 16); + + ipv4.u.sin.sin_addr.s_addr = inet_addr("255.255.255.0"); + rc = osmo_sockaddr_netmask_to_prefixlen(&ipv4); + OSMO_ASSERT(rc == 24); + + ipv4.u.sin.sin_addr.s_addr = inet_addr("255.255.255.255"); + rc = osmo_sockaddr_netmask_to_prefixlen(&ipv4); + OSMO_ASSERT(rc == 32); + + ipv4.u.sin.sin_addr.s_addr = inet_addr("0.255.0.0"); + rc = osmo_sockaddr_netmask_to_prefixlen(&ipv4); + /* FIXME: This shows the implementation is not that robust chcking validity of input netmask: */ + OSMO_ASSERT(rc == 8); + + ipv6.u.sin6 = (struct sockaddr_in6){ + .sin6_family = AF_INET6, + }; + + inet_pton(AF_INET6, "fe::", &ipv6.u.sin6.sin6_addr); + rc = osmo_sockaddr_netmask_to_prefixlen(&ipv6); + OSMO_ASSERT(rc == 7); + + inet_pton(AF_INET6, "ff::", &ipv6.u.sin6.sin6_addr); + rc = osmo_sockaddr_netmask_to_prefixlen(&ipv6); + OSMO_ASSERT(rc == 8); + + inet_pton(AF_INET6, "ff:ff::", &ipv6.u.sin6.sin6_addr); + rc = osmo_sockaddr_netmask_to_prefixlen(&ipv6); + OSMO_ASSERT(rc == 16); + + inet_pton(AF_INET6, "ff:ff::ff", &ipv6.u.sin6.sin6_addr); + rc = osmo_sockaddr_netmask_to_prefixlen(&ipv6); + /* FIXME: This shows the implementation is not that robust chcking validity of input netmask: */ + OSMO_ASSERT(rc == 24); +} + const struct log_info_cat default_categories[] = { }; @@ -407,6 +464,7 @@ test_get_ip_and_port(); test_sockinit_osa(); test_osa_str(); + test_osa_netmask_prefixlen(); return EXIT_SUCCESS; } -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/30986 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I75e75e251c6776801fffdde745aebedf21c68799 Gerrit-Change-Number: 30986 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin(a)sysmocom.de> Gerrit-MessageType: newchange
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • ...
  • 221
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.