summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/oeqa/selftest/cases/updater.py41
-rw-r--r--recipes-sota/aktualizr/aktualizr-auto-prov.bb4
-rw-r--r--recipes-sota/aktualizr/aktualizr_git.bb3
-rw-r--r--recipes-test/demo-network-config/files/27-dhcp-client-external.network6
-rw-r--r--recipes-test/demo-network-config/secondary-network-config.bb6
-rw-r--r--recipes-test/images/secondary-image.bb2
-rw-r--r--scripts/qemucommand.py2
7 files changed, 60 insertions, 4 deletions
diff --git a/lib/oeqa/selftest/cases/updater.py b/lib/oeqa/selftest/cases/updater.py
index 06884e5..e459ffb 100644
--- a/lib/oeqa/selftest/cases/updater.py
+++ b/lib/oeqa/selftest/cases/updater.py
@@ -548,6 +548,47 @@ class SecondaryTests(OESelftestTestCase):
548 stdout, stderr, retcode = self.qemu_command('echo test | nc localhost 9030') 548 stdout, stderr, retcode = self.qemu_command('echo test | nc localhost 9030')
549 self.assertEqual(retcode, 0, "Unable to connect to secondary") 549 self.assertEqual(retcode, 0, "Unable to connect to secondary")
550 550
551
552class PrimaryTests(OESelftestTestCase):
553 @classmethod
554 def setUpClass(cls):
555 super(PrimaryTests, cls).setUpClass()
556 logger = logging.getLogger("selftest")
557 logger.info('Running bitbake to build primary-image')
558 bitbake('primary-image')
559
560 def setUpLocal(self):
561 layer = "meta-updater-qemux86-64"
562 result = runCmd('bitbake-layers show-layers')
563 if re.search(layer, result.output) is None:
564 # Assume the directory layout for finding other layers. We could also
565 # make assumptions by using 'show-layers', but either way, if the
566 # layers we need aren't where we expect them, we are out of like.
567 path = os.path.abspath(os.path.dirname(__file__))
568 metadir = path + "/../../../../../"
569 self.meta_qemu = metadir + layer
570 runCmd('bitbake-layers add-layer "%s"' % self.meta_qemu)
571 else:
572 self.meta_qemu = None
573 self.append_config('MACHINE = "qemux86-64"')
574 self.append_config('SOTA_CLIENT_PROV = " aktualizr-auto-prov "')
575 self.append_config('SOTA_CLIENT_FEATURES = "secondary-network"')
576 self.qemu, self.s = qemu_launch(machine='qemux86-64', imagename='primary-image')
577
578 def tearDownLocal(self):
579 qemu_terminate(self.s)
580 if self.meta_qemu:
581 runCmd('bitbake-layers remove-layer "%s"' % self.meta_qemu, ignore_status=True)
582
583 def qemu_command(self, command):
584 return qemu_send_command(self.qemu.ssh_port, command)
585
586 def test_aktualizr_present(self):
587 print('Checking aktualizr is present')
588 stdout, stderr, retcode = self.qemu_command('aktualizr --help')
589 self.assertEqual(retcode, 0, "Unable to run aktualizr --help")
590 self.assertEqual(stderr, b'', 'Error: ' + stderr.decode())
591
551def qemu_launch(efi=False, machine=None, imagename=None): 592def qemu_launch(efi=False, machine=None, imagename=None):
552 logger = logging.getLogger("selftest") 593 logger = logging.getLogger("selftest")
553 logger.info('Running bitbake to build core-image-minimal') 594 logger.info('Running bitbake to build core-image-minimal')
diff --git a/recipes-sota/aktualizr/aktualizr-auto-prov.bb b/recipes-sota/aktualizr/aktualizr-auto-prov.bb
index 2190512..07e5bb8 100644
--- a/recipes-sota/aktualizr/aktualizr-auto-prov.bb
+++ b/recipes-sota/aktualizr/aktualizr-auto-prov.bb
@@ -35,7 +35,9 @@ do_install() {
35 install -d ${D}${libdir}/sota 35 install -d ${D}${libdir}/sota
36 install -d ${D}${localstatedir}/sota 36 install -d ${D}${localstatedir}/sota
37 if [ -n "${SOTA_PACKED_CREDENTIALS}" ]; then 37 if [ -n "${SOTA_PACKED_CREDENTIALS}" ]; then
38 install -m 0644 ${STAGING_DIR_NATIVE}${libdir}/sota/sota_autoprov.toml ${D}${libdir}/sota/sota.toml 38 aktualizr_toml=${@bb.utils.contains('SOTA_CLIENT_FEATURES', 'secondary-network', 'sota_autoprov_primary.toml', 'sota_autoprov.toml', d)}
39
40 install -m 0644 ${STAGING_DIR_NATIVE}${libdir}/sota/${aktualizr_toml} ${D}${libdir}/sota/sota.toml
39 41
40 # deploy SOTA credentials 42 # deploy SOTA credentials
41 if [ -e ${SOTA_PACKED_CREDENTIALS} ]; then 43 if [ -e ${SOTA_PACKED_CREDENTIALS} ]; then
diff --git a/recipes-sota/aktualizr/aktualizr_git.bb b/recipes-sota/aktualizr/aktualizr_git.bb
index 79a89ef..ba0a261 100644
--- a/recipes-sota/aktualizr/aktualizr_git.bb
+++ b/recipes-sota/aktualizr/aktualizr_git.bb
@@ -22,7 +22,7 @@ SRC_URI = " \
22 file://aktualizr-secondary.socket \ 22 file://aktualizr-secondary.socket \
23 file://aktualizr-serialcan.service \ 23 file://aktualizr-serialcan.service \
24 " 24 "
25SRCREV = "7d1d71a28a9ff0b14240b98600de3d541835b278" 25SRCREV = "3fc94e7ed20a486da0067f01906250e9d4868931"
26BRANCH ?= "master" 26BRANCH ?= "master"
27 27
28S = "${WORKDIR}/git" 28S = "${WORKDIR}/git"
@@ -59,6 +59,7 @@ do_install_append_class-target () {
59do_install_append_class-native () { 59do_install_append_class-native () {
60 install -d ${D}${libdir}/sota 60 install -d ${D}${libdir}/sota
61 install -m 0644 ${S}/config/sota_autoprov.toml ${D}/${libdir}/sota/sota_autoprov.toml 61 install -m 0644 ${S}/config/sota_autoprov.toml ${D}/${libdir}/sota/sota_autoprov.toml
62 install -m 0644 ${S}/config/sota_autoprov_primary.toml ${D}/${libdir}/sota/sota_autoprov_primary.toml
62 install -m 0644 ${S}/config/sota_hsm_prov.toml ${D}/${libdir}/sota/sota_hsm_prov.toml 63 install -m 0644 ${S}/config/sota_hsm_prov.toml ${D}/${libdir}/sota/sota_hsm_prov.toml
63 install -m 0644 ${S}/config/sota_implicit_prov.toml ${D}/${libdir}/sota/sota_implicit_prov.toml 64 install -m 0644 ${S}/config/sota_implicit_prov.toml ${D}/${libdir}/sota/sota_implicit_prov.toml
64 install -m 0644 ${S}/config/sota_implicit_prov_ca.toml ${D}/${libdir}/sota/sota_implicit_prov_ca.toml 65 install -m 0644 ${S}/config/sota_implicit_prov_ca.toml ${D}/${libdir}/sota/sota_implicit_prov_ca.toml
diff --git a/recipes-test/demo-network-config/files/27-dhcp-client-external.network b/recipes-test/demo-network-config/files/27-dhcp-client-external.network
new file mode 100644
index 0000000..ba49593
--- /dev/null
+++ b/recipes-test/demo-network-config/files/27-dhcp-client-external.network
@@ -0,0 +1,6 @@
1[Match]
2Name=enp0s3
3
4[Network]
5Description=External network for secondary
6DHCP=yes
diff --git a/recipes-test/demo-network-config/secondary-network-config.bb b/recipes-test/demo-network-config/secondary-network-config.bb
index 492d3ca..9091c65 100644
--- a/recipes-test/demo-network-config/secondary-network-config.bb
+++ b/recipes-test/demo-network-config/secondary-network-config.bb
@@ -3,7 +3,10 @@ LICENSE = "CLOSED"
3 3
4inherit allarch 4inherit allarch
5 5
6SRC_URI = "file://26-dhcp-client.network" 6SRC_URI = "\
7 file://26-dhcp-client.network \
8 file://27-dhcp-client-external.network \
9 "
7 10
8 11
9FILES_${PN} = "/usr/lib/systemd/network" 12FILES_${PN} = "/usr/lib/systemd/network"
@@ -13,4 +16,5 @@ PR = "1"
13do_install() { 16do_install() {
14 install -d ${D}/usr/lib/systemd/network 17 install -d ${D}/usr/lib/systemd/network
15 install -m 0644 ${WORKDIR}/26-dhcp-client.network ${D}/usr/lib/systemd/network/ 18 install -m 0644 ${WORKDIR}/26-dhcp-client.network ${D}/usr/lib/systemd/network/
19 install -m 0644 ${WORKDIR}/27-dhcp-client-external.network ${D}/usr/lib/systemd/network/
16} 20}
diff --git a/recipes-test/images/secondary-image.bb b/recipes-test/images/secondary-image.bb
index c1ce57a..02153d0 100644
--- a/recipes-test/images/secondary-image.bb
+++ b/recipes-test/images/secondary-image.bb
@@ -13,6 +13,8 @@ IMAGE_INSTALL_remove = " \
13 aktualizr-ca-implicit-prov \ 13 aktualizr-ca-implicit-prov \
14 aktualizr-hsm-prov \ 14 aktualizr-hsm-prov \
15 aktualizr-implicit-prov \ 15 aktualizr-implicit-prov \
16 connman \
17 connman-client \
16 " 18 "
17 19
18IMAGE_INSTALL_append = " \ 20IMAGE_INSTALL_append = " \
diff --git a/scripts/qemucommand.py b/scripts/qemucommand.py
index e209a07..4918314 100644
--- a/scripts/qemucommand.py
+++ b/scripts/qemucommand.py
@@ -108,7 +108,7 @@ class QemuCommand(object):
108 if self.secondary_network: 108 if self.secondary_network:
109 cmdline += [ 109 cmdline += [
110 '-net', 'nic,vlan=1,macaddr='+random_mac(), 110 '-net', 'nic,vlan=1,macaddr='+random_mac(),
111 '-net', 'socket,vlan=1,mcast=230.0.0.1:1234', 111 '-net', 'socket,vlan=1,mcast=230.0.0.1:1234,localaddr=127.0.0.1',
112 ] 112 ]
113 if self.gui: 113 if self.gui:
114 cmdline += ["-serial", "stdio"] 114 cmdline += ["-serial", "stdio"]