This repository has been archived by the owner on Oct 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extend the UC testing workflow to add config provider snap (#178)
* Extend the UC testing workflow to add config provider snap Extend the UC testing workflow to add config provider snap * Update the format - disable the security feature of edgexfoundry in V2 format - directly modify the 'mmodel.yaml' file - update the format in the 'test.sh' script * Remove echo newlines * Simplfy scripts, update default channel * Update test.sh and output in readme * [skip ci] Enable debugging, add style flag to yq
- Loading branch information
1 parent
03a7263
commit f4ac775
Showing
6 changed files
with
135 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,70 @@ | ||
#!/bin/bash -ex | ||
|
||
# Remove the pc-gadget directory if it already exists | ||
rm -rf pc-gadget | ||
git clone https://github.com/snapcore/pc-gadget.git --branch=22 | ||
|
||
# build gadget snap | ||
# Build gadget snap | ||
cd pc-gadget | ||
# extend the size of disk partitions to have sufficient capacity for EdgeX snaps | ||
yq e '(.volumes.pc.structure[] | select(.name=="ubuntu-seed") | .size)="1500M"' gadget.yaml -i | ||
|
||
# setup default options for snaps | ||
# Extend the size of disk partitions to have sufficient capacity for EdgeX snaps | ||
yq e -i '(.volumes.pc.structure[] | select(.name=="ubuntu-seed") | .size)="1500M"' gadget.yaml | ||
|
||
# Set up default options for snaps | ||
# AZGf0KNnh8aqdkbGATNuRuxnt1GNRKkV (edgexfoundry snap) | ||
# AmKuVTOfsN0uEKsyJG34M8CaMfnIqxc0 (edgex-device-virtual snap) | ||
yq e '.defaults += { | ||
yq e -i '.defaults += { | ||
"AZGf0KNnh8aqdkbGATNuRuxnt1GNRKkV": { | ||
"app-options": true, | ||
"security": false | ||
"security-secret-store": "off" | ||
}, | ||
"AmKuVTOfsN0uEKsyJG34M8CaMfnIqxc0": { | ||
"autostart": true, | ||
"app-options": true, | ||
"apps": { | ||
"device-virtual": { | ||
"config": { | ||
"service-startupmsg": "Startup message from gadget!", | ||
"edgex-security-secret-store": false | ||
} | ||
} | ||
} | ||
} | ||
}' gadget.yaml -i | ||
} | .defaults.AZGf0KNnh8aqdkbGATNuRuxnt1GNRKkV.security-secret-store style="double"' gadget.yaml | ||
|
||
|
||
# Connect edgex-device-virtual's plug (consumer) to | ||
# edgex-config-provider-example's slot (provider) | ||
# to override the default configuration files. | ||
yq e -i '.connections += [ | ||
{ | ||
"plug": "AmKuVTOfsN0uEKsyJG34M8CaMfnIqxc0:device-virtual-config", | ||
"slot": "WWPGZGi1bImphPwrRfw46aP7YMyZYl6w:device-virtual-config" | ||
} | ||
] | ||
' gadget.yaml | ||
# Add kernel options for extended logging and a debugging shell | ||
cp -r ../kernel-options/ . | ||
yq e -i '.parts += { | ||
"kernel-options": | ||
{ | ||
"source": "kernel-options/", | ||
"plugin": "dump" | ||
} | ||
}' snapcraft.yaml | ||
|
||
|
||
# Build gadget snap | ||
snapcraft | ||
|
||
# configure model assertion | ||
# Configure model assertion | ||
cd ../ | ||
DEVELOPER_ID=$(snapcraft whoami | grep 'id:' | awk '{print $2}') | ||
TIMESTAMP=$(date -Iseconds --utc) | ||
yq e -i ".authority-id = \"$DEVELOPER_ID\"" model.yaml | ||
yq e -i ".brand-id = \"$DEVELOPER_ID\"" model.yaml | ||
yq e -i ".timestamp = \"$TIMESTAMP\"" model.yaml | ||
|
||
# sign the model assertion | ||
# Sign the model assertion | ||
yq eval model.yaml -o=json | snap sign -k $KEY_NAME > model.signed.yaml | ||
|
||
# check the signed model | ||
# Check the signed model | ||
cat model.signed.yaml |
29 changes: 29 additions & 0 deletions
29
test/suites/ubuntu-core-edgex-image/kernel-options/cmdline.full
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# this is the first serial console, pick a suitable one for your device | ||
console=ttyS0 | ||
|
||
# set to get more output from snapd | ||
#snapd.debug=1 | ||
|
||
# these will output more device status/logging to our console, | ||
# which is kinda annoying in that it goes to the same place we | ||
# have our shell, but I think it's more useful to be able to see | ||
# than have a perfectly pristine console, if you have multiple | ||
# consoles you could of course use a different console for | ||
# systemd output and your debug shell | ||
rd.systemd.journald.forward_to_console=1 | ||
systemd.journald.forward_to_console=1 | ||
|
||
# to disable console-conf from running on ttyS0 so we can setup | ||
# our debug shell there, this is the most key part here, without | ||
# this console-conf will kill/prevent from starting our debug shell | ||
[email protected] | ||
|
||
# create our debug shell on ttyS0 | ||
systemd.debug-shell=ttyS0 | ||
|
||
# needed in order to allow the debug-shell to run on UC20 | ||
dangerous | ||
|
||
# standard Ubuntu Core kernel command line parameters | ||
panic=-1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,35 @@ | ||
#!/bin/bash -e | ||
#!/bin/bash -ex | ||
|
||
ssh "$USER@localhost" -p 8022 "snap install curl" | ||
SSH_USER="$USER" | ||
SSH_PORT="8022" | ||
remote_call() { | ||
ssh "$SSH_USER@localhost" -p $SSH_PORT "$@" | ||
} | ||
|
||
# check status of core services inside of the emulator | ||
|
||
# Install curl on emulator | ||
remote_call "snap install curl" | ||
|
||
# Check status of core services inside of the emulator | ||
ports=(59880 59881 59882) | ||
|
||
for port in "${ports[@]}" | ||
do | ||
ssh "$USER@localhost" -p 8022 "curl -s http://localhost:$port/api/v2/ping; printf '\n'" | ||
remote_call "curl -s http://localhost:$port/api/v2/ping" | ||
done | ||
|
||
# verify that the security is avaliable as a snap option of edgexfoundry within the emulator | ||
ssh "$USER@localhost" -p 8022 "snap get edgexfoundry security -d; printf '\n'" | ||
# Verify that the security is avaliable as a snap option of edgexfoundry within the emulator | ||
remote_call "snap get edgexfoundry security-secret-store -d" | ||
|
||
# Check the status of the device-virtual service within the emulator | ||
remote_call "snap services edgex-device-virtual" | ||
|
||
# List snaps and check edgex-config-provider-example is in the list | ||
remote_call 'snap list' | ||
|
||
# check the status of the device-virtual service within the emulator | ||
ssh "$USER@localhost" -p 8022 "snap services edgex-device-virtual; printf '\n'" | ||
# Verify that Device Virtual only has one profile, as configured in the config provider | ||
remote_call 'curl --silent http://localhost:59881/api/v2/deviceprofile/all' | jq '.totalCount' | ||
|
||
# verify that device-virtual has the startup message set from the gadget within the emulator | ||
ssh "$USER@localhost" -p 8022 'snap logs -n=all edgex-device-virtual | grep "Startup message"; printf '\n'' | ||
# Verify that Device Virtual has the startup message set from the provider | ||
remote_call 'snap logs -n=all edgex-device-virtual | grep "CONFIG BY EXAMPLE PROVIDER"' | ||
|
||
# access the service endpoints via API Gateway outside of the emulator | ||
curl --insecure --show-err https://localhost:8443/core-data/api/v2/ping |