Skip to content

Commit

Permalink
fix: rename my to third
Browse files Browse the repository at this point in the history
Signed-off-by: Boris Glimcher <Boris.Glimcher@emc.com>
  • Loading branch information
glimchb committed Jun 12, 2024
1 parent 1d09bff commit 7e7c500
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 24 deletions.
8 changes: 5 additions & 3 deletions scripts/tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 0 additions & 2 deletions sztp-server/config/my-post-configuration-script.sh

This file was deleted.

2 changes: 0 additions & 2 deletions sztp-server/config/my-pre-configuration-script.sh

This file was deleted.

32 changes: 16 additions & 16 deletions sztp-server/config/sztpd.running.json.template
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@
"response": {
"conveyed-information": {
"onboarding-information": {
"reference": "my-onboarding-information"
"reference": "third-onboarding-information"
}
}
}
Expand Down Expand Up @@ -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"
}
]
}
Expand All @@ -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": [
Expand All @@ -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"
}
]
},
Expand All @@ -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"
}
]
},
Expand All @@ -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"
}
}
]
Expand Down
File renamed without changes.
2 changes: 2 additions & 0 deletions sztp-server/config/third-post-configuration-script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
echo "inside the third-post-configuration-script..."
2 changes: 2 additions & 0 deletions sztp-server/config/third-pre-configuration-script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
echo "inside the third-pre-configuration-script..."
2 changes: 1 addition & 1 deletion sztp-server/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}')"
Expand Down
File renamed without changes.

0 comments on commit 7e7c500

Please sign in to comment.