From ec7a58284db81088b9a395ff1395f219c80a8f62 Mon Sep 17 00:00:00 2001 From: Boris Glimcher Date: Thu, 13 Jun 2024 02:34:26 +0300 Subject: [PATCH] fix: rename my to third Signed-off-by: Boris Glimcher --- scripts/tests.sh | 8 +++-- .../config/my-post-configuration-script.sh | 2 -- .../config/my-pre-configuration-script.sh | 2 -- .../config/sztpd.running.json.template | 32 +++++++++--------- ...figuration.xml => third-configuration.xml} | 0 .../config/third-post-configuration-script.sh | 2 ++ .../config/third-pre-configuration-script.sh | 2 ++ sztp-server/docker-entrypoint.sh | 2 +- ...my-boot-image.img => third-boot-image.img} | Bin 9 files changed, 26 insertions(+), 24 deletions(-) delete mode 100644 sztp-server/config/my-post-configuration-script.sh delete mode 100644 sztp-server/config/my-pre-configuration-script.sh rename sztp-server/config/{my-configuration.xml => third-configuration.xml} (100%) create mode 100644 sztp-server/config/third-post-configuration-script.sh create mode 100644 sztp-server/config/third-pre-configuration-script.sh rename sztp-server/images/{my-boot-image.img => third-boot-image.img} (100%) diff --git a/scripts/tests.sh b/scripts/tests.sh index fa7b71e8..e1981460 100755 --- a/scripts/tests.sh +++ b/scripts/tests.sh @@ -67,18 +67,20 @@ jq -r .\"ietf-sztp-conveyed-info:onboarding-information\".\"configuration\" /tmp # parse and execute pre-configuration-script jq -r .\"ietf-sztp-conveyed-info:onboarding-information\".\"pre-configuration-script\" /tmp/post_rpc_fixed.json | base64 --decode -jq -r .\"ietf-sztp-conveyed-info:onboarding-information\".\"pre-configuration-script\" /tmp/post_rpc_fixed.json | base64 --decode | sh | grep "inside the pre-configuration-script..." +jq -r .\"ietf-sztp-conveyed-info:onboarding-information\".\"pre-configuration-script\" /tmp/post_rpc_fixed.json | base64 --decode | sh | grep "inside the third-pre-configuration-script..." # parse and execute post-configuration-script jq -r .\"ietf-sztp-conveyed-info:onboarding-information\".\"post-configuration-script\" /tmp/post_rpc_fixed.json | base64 --decode -jq -r .\"ietf-sztp-conveyed-info:onboarding-information\".\"post-configuration-script\" /tmp/post_rpc_fixed.json | base64 --decode | sh | grep "inside the post-configuration-script..." +jq -r .\"ietf-sztp-conveyed-info:onboarding-information\".\"post-configuration-script\" /tmp/post_rpc_fixed.json | base64 --decode | sh | grep "inside the third-post-configuration-script..." # parse image URL and SHA jq -r .\"ietf-sztp-conveyed-info:onboarding-information\".\"boot-image\".\"download-uri\"[] /tmp/post_rpc_fixed.json jq -r .\"ietf-sztp-conveyed-info:onboarding-information\".\"boot-image\".\"image-verification\"[] /tmp/post_rpc_fixed.json # TODO: remove --insecure -docker-compose run -T agent curl --insecure --fail --key /certs/private_key.pem --cert /certs/my_cert.pem --cacert /certs/opi.pem --output /tmp/my-boot-image.tst https://web:443/my-boot-image.img +docker-compose run -T agent curl --insecure --fail --key /certs/private_key.pem --cert /certs/my_cert.pem --cacert /certs/opi.pem --output /tmp/first-boot-image.tst https://web:443/first-boot-image.img +docker-compose run -T agent curl --insecure --fail --key /certs/private_key.pem --cert /certs/my_cert.pem --cacert /certs/opi.pem --output /tmp/second-boot-image.tst https://web:443/second-boot-image.img +docker-compose run -T agent curl --insecure --fail --key /certs/private_key.pem --cert /certs/my_cert.pem --cacert /certs/opi.pem --output /tmp/third-boot-image.tst https://web:443/third-boot-image.img # actually go and download the image from the web server URL=$(jq -r .\"ietf-sztp-conveyed-info:onboarding-information\".\"boot-image\".\"download-uri\"[0] /tmp/post_rpc_fixed.json) diff --git a/sztp-server/config/my-post-configuration-script.sh b/sztp-server/config/my-post-configuration-script.sh deleted file mode 100644 index 9de18c6a..00000000 --- a/sztp-server/config/my-post-configuration-script.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -echo "inside the post-configuration-script..." diff --git a/sztp-server/config/my-pre-configuration-script.sh b/sztp-server/config/my-pre-configuration-script.sh deleted file mode 100644 index 7b13c2a1..00000000 --- a/sztp-server/config/my-pre-configuration-script.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -echo "inside the pre-configuration-script..." diff --git a/sztp-server/config/sztpd.running.json.template b/sztp-server/config/sztpd.running.json.template index 9e75ca9a..61228d52 100644 --- a/sztp-server/config/sztpd.running.json.template +++ b/sztp-server/config/sztpd.running.json.template @@ -155,7 +155,7 @@ "response": { "conveyed-information": { "onboarding-information": { - "reference": "my-onboarding-information" + "reference": "third-onboarding-information" } } } @@ -194,15 +194,15 @@ ] }, { - "name": "my-boot-image.img", + "name": "third-boot-image.img", "download-uri": [ - "https://web:443/my-boot-image.img", - "ftps://web:990/my-boot-image.img" + "https://web:443/third-boot-image.img", + "ftps://web:990/third-boot-image.img" ], "image-verification": [ { "hash-algorithm": "ietf-sztp-conveyed-info:sha-256", - "hash-value": "$MY_BOOT_IMG_HASH_VAL" + "hash-value": "$THIRD_BOOT_IMG_HASH_VAL" } ] } @@ -219,8 +219,8 @@ "script": "$SECOND_PRE_SCRIPT_B64" }, { - "name": "my-pre-configuration-script", - "script": "$MY_PRE_SCRIPT_B64" + "name": "third-pre-configuration-script", + "script": "$THIRD_PRE_SCRIPT_B64" } ], "post-configuration-script": [ @@ -233,8 +233,8 @@ "script": "$SECOND_POST_SCRIPT_B64" }, { - "name": "my-post-configuration-script", - "script": "$MY_POST_SCRIPT_B64" + "name": "third-post-configuration-script", + "script": "$THIRD_POST_SCRIPT_B64" } ] }, @@ -251,9 +251,9 @@ "config": "$SECOND_CONFIG_B64" }, { - "name": "my-configuration", + "name": "third-configuration", "configuration-handling": "merge", - "config": "$MY_CONFIG_B64" + "config": "$THIRD_CONFIG_B64" } ] }, @@ -278,12 +278,12 @@ } }, { - "name": "my-onboarding-information", + "name": "third-onboarding-information", "onboarding-information": { - "boot-image": "my-boot-image.img", - "pre-configuration-script": "my-pre-configuration-script", - "configuration": "my-configuration", - "post-configuration-script": "my-post-configuration-script" + "boot-image": "third-boot-image.img", + "pre-configuration-script": "third-pre-configuration-script", + "configuration": "third-configuration", + "post-configuration-script": "third-post-configuration-script" } } ] diff --git a/sztp-server/config/my-configuration.xml b/sztp-server/config/third-configuration.xml similarity index 100% rename from sztp-server/config/my-configuration.xml rename to sztp-server/config/third-configuration.xml diff --git a/sztp-server/config/third-post-configuration-script.sh b/sztp-server/config/third-post-configuration-script.sh new file mode 100644 index 00000000..fa8aa57d --- /dev/null +++ b/sztp-server/config/third-post-configuration-script.sh @@ -0,0 +1,2 @@ +#!/bin/bash +echo "inside the third-post-configuration-script..." diff --git a/sztp-server/config/third-pre-configuration-script.sh b/sztp-server/config/third-pre-configuration-script.sh new file mode 100644 index 00000000..af6e98da --- /dev/null +++ b/sztp-server/config/third-pre-configuration-script.sh @@ -0,0 +1,2 @@ +#!/bin/bash +echo "inside the third-pre-configuration-script..." diff --git a/sztp-server/docker-entrypoint.sh b/sztp-server/docker-entrypoint.sh index bb1c3eb1..e7a8e3b8 100755 --- a/sztp-server/docker-entrypoint.sh +++ b/sztp-server/docker-entrypoint.sh @@ -21,7 +21,7 @@ declare -a names # files and configs -for vendor in first second my +for vendor in first second third do names+=("${vendor^^}_BOOT_IMG_HASH_VAL" "${vendor^^}_CONFIG_B64") export ${vendor^^}_BOOT_IMG_HASH_VAL="$(openssl dgst -sha256 -c /media/${vendor,,}-boot-image.img | awk '{print $2}')" diff --git a/sztp-server/images/my-boot-image.img b/sztp-server/images/third-boot-image.img similarity index 100% rename from sztp-server/images/my-boot-image.img rename to sztp-server/images/third-boot-image.img