Giter VIP home page Giter VIP logo

edgex-ubuntu-core-testing's Introduction

EdgeX Ubuntu Core Testing

This repo contains scripts for creating an Ubuntu Core OS image, which includes the necessary EdgeX components. The image is designed for testing purposes, and the scripts automate the process of building, booting, and testing the image.

For details of creating a Ubuntu Core image with EdgeX, please refer to the documentation provided here.

Requirements

Before running the tests, you need to install the following packages:

snap install --classic snapcraft
snap install --classic ubuntu-image
snap install lxd
snap install yq
snap install curl
sudo apt update
sudo apt install qemu-kvm
kvm-ok
sudo apt install ovmf

Please refer to Testing Ubuntu Core with QEMU to learn more about it.

Additionally, you need to log into your snap account by running:

snap login
snap keys

Note: Follow the instructions here to create a developer account, if you don't already have one.

After logging in, create a key named ubuntu-core-edgex-image-test which will be used later by running:

$ snap create-key ubuntu-core-edgex-image-test
# set passphrase
$ snapcraft register-key ubuntu-core-edgex-image-test

Build, Boot and Test the Image

To build the gadget snap, run the following command:

./build-gadget.sh

To build the Ubuntu Core image:

KEY_NAME=ubuntu-core-edgex-image-test ./build-image.sh

To boot the Ubuntu Core image with EdgeX components in an emulator:

./run.sh

After the complete installation, use the wizard to setup the networking and user account.

Once you see the SSH command and the IP address, open a new terminal to test the image by running:

$ UBUNTU_USER=<your-username> ./test.sh
+ [[ -z <your-username> ]]
+ SSH_USER=<your-username>
+ SSH_PORT=8022
+ remote_call 'snap install curl'
+ ssh <your-username>@localhost -p 8022 'snap install curl'
curl 8.0.1 from Wouter van Bommel (woutervb) installed
+ ports=(59880 59881 59882)
+ for port in "${ports[@]}"
+ remote_call 'curl -s http://localhost:59880/api/v3/ping'
+ ssh <your-username>@localhost -p 8022 'curl -s http://localhost:59880/api/v3/ping'
{"apiVersion":"v3","timestamp":"Mon May 15 10:15:11 UTC 2023","serviceName":"core-data"}+ for port in "${ports[@]}"
+ remote_call 'curl -s http://localhost:59881/api/v3/ping'
+ ssh <your-username>@localhost -p 8022 'curl -s http://localhost:59881/api/v3/ping'
{"apiVersion":"v3","timestamp":"Mon May 15 10:15:11 UTC 2023","serviceName":"core-metadata"}+ for port in "${ports[@]}"
+ remote_call 'curl -s http://localhost:59882/api/v3/ping'
+ ssh <your-username>@localhost -p 8022 'curl -s http://localhost:59882/api/v3/ping'
{"apiVersion":"v3","timestamp":"Mon May 15 10:15:11 UTC 2023","serviceName":"core-command"}+ remote_call 'snap get edgexfoundry security -d'
+ ssh <your-username>@localhost -p 8022 'snap get edgexfoundry security -d'
{
        "security": false
}
+ remote_call 'snap services edgex-device-virtual'
+ ssh <your-username>@localhost -p 8022 'snap services edgex-device-virtual'
Service                              Startup  Current  Notes
edgex-device-virtual.device-virtual  enabled  active   -
+ remote_call 'snap list'
+ ssh <your-username>@localhost -p 8022 'snap list'
Name                           Version                   Rev    Tracking       Publisher    Notes
core20                         20230404                  1879   latest/stable  canonical**  base
core22                         20230503                  634    latest/stable  canonical**  base
curl                           8.0.1                     1679   latest/stable  woutervb     -
edgex-config-provider-example  v3.0.0-beta+git5.e36dfe0  27     latest/edge    farshidtz    -
edgex-device-virtual           3.0.0-dev.46              653    latest/edge    canonical**  -
edgexfoundry                   3.0.0-dev.156             4436   latest/edge    canonical**  -
pc                             22-0.3                    x1     -              -            gadget
pc-kernel                      5.15.0-71.78.1            1281   22/stable      canonical**  kernel
snapd                          2.59.2                    19122  latest/stable  canonical**  snapd
+ remote_call 'curl --silent http://localhost:59881/api/v3/deviceprofile/all'
+ jq .totalCount
+ ssh <your-username>@localhost -p 8022 'curl --silent http://localhost:59881/api/v3/deviceprofile/all'
1
+ remote_call 'snap logs -n=all edgex-device-virtual | grep "CONFIG BY EXAMPLE PROVIDER"'
+ ssh <your-username>@localhost -p 8022 'snap logs -n=all edgex-device-virtual | grep "CONFIG BY EXAMPLE PROVIDER"'
2023-05-15T10:12:51Z edgex-device-virtual.device-virtual[3228]: level=INFO ts=2023-05-15T10:12:51.529784013Z app=device-virtual source=message.go:55 msg="CONFIG BY EXAMPLE PROVIDER"

edgex-ubuntu-core-testing's People

Contributors

monicaisher avatar farshidtz avatar

Watchers

James Cloos avatar  avatar  avatar

Forkers

monicaisher

edgex-ubuntu-core-testing's Issues

Installation error on latest core22 pc-gadget

The UC installation fails with the following log:

[  OK  ] Started /run/mnt/snapd/usr/lib/snapd/snapd.
[    8.800399] systemd[1]: Started /run/mnt/snapd/usr/lib/snapd/snapd.
[    8.801206] snapd[892]: firstboot.go:401: failed to auto-import assertions: open /var/lib/snapd/seed/systems/20230517/auto-import.assert: no such file or directory
[   10.031860] systemd-timesyncd[844]: Network configuration changed, trying to establish connection.
[   10.038923] snapd[892]: stateengine.go:149: state ensure error: devicemgr: cannot seed: snap "pc" assumes unsupported features: snapd2.59.3 (try to refresh snapd)
[   12.975541] systemd[1]: Created slice Slice /system/console-conf.
[   40.336100] systemd-resolved[854]: Clock change detected. Flushing caches.
[   40.336606] systemd-timesyncd[844]: Initial synchronization to time server 185.125.190.58:123 (ntp.ubuntu.com).
[   98.020608] systemd[1]: [email protected]: start-pre operation timed out. Terminating.
[   98.021060] systemd[1]: [email protected]: Control process exited, code=killed, status=15/TERM
[   98.021140] systemd[1]: [email protected]: Failed with result 'timeout'.
[   98.022444] systemd[1]: [email protected]: Scheduled restart job, restart counter is at 1.
[   98.022531] systemd[1]: Stopped Getty on tty1.
[   98.023267] systemd[1]: Started Getty on tty1.
[  188.270217] systemd[1]: [email protected]: start-pre operation timed out. Terminating.
[  188.270633] systemd[1]: [email protected]: Control process exited, code=killed, status=15/TERM
[  188.270736] systemd[1]: [email protected]: Failed with result 'timeout'.
[  188.272781] systemd[1]: [email protected]: Scheduled restart job, restart counter is at 2.
[  188.273082] systemd[1]: Stopped Getty on tty1.
[  188.274056] systemd[1]: Started Getty on tty1.

To make the UC image build work work, one should checkout commit 1779b0de4e022ddcbefd782e0523ee9c0c7f1dea for the pc-gadget.

Originally posted by @farshidtz in canonical/edgex-snap-testing#205 (review)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.