summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--recipes-test/demo-network-config/files/26-static-client.network7
-rw-r--r--recipes-test/demo-network-config/primary-network-config.bb13
-rw-r--r--recipes-test/demo-network-config/secondary-network-config.bb13
-rw-r--r--recipes-test/demo-network-config/static-network-config.inc16
-rw-r--r--recipes-test/demo-secondary-config/files/30-fake_pacman.toml2
-rw-r--r--recipes-test/demo-secondary-config/secondary-config.bb20
-rw-r--r--recipes-test/images/primary-image.bb1
-rw-r--r--recipes-test/images/secondary-image.bb1
-rw-r--r--scripts/qemucommand.py4
9 files changed, 69 insertions, 8 deletions
diff --git a/recipes-test/demo-network-config/files/26-static-client.network b/recipes-test/demo-network-config/files/26-static-client.network
new file mode 100644
index 0000000..19a6b83
--- /dev/null
+++ b/recipes-test/demo-network-config/files/26-static-client.network
@@ -0,0 +1,7 @@
1[Match]
2Name=@IFNAME@
3
4[Network]
5Description=Private internal network between aktualizr Primary and Secondary nodes
6Address=@ADDR@
7DHCP=no
diff --git a/recipes-test/demo-network-config/primary-network-config.bb b/recipes-test/demo-network-config/primary-network-config.bb
index 78678a2..ce19f07 100644
--- a/recipes-test/demo-network-config/primary-network-config.bb
+++ b/recipes-test/demo-network-config/primary-network-config.bb
@@ -3,8 +3,9 @@ LICENSE = "CLOSED"
3 3
4inherit allarch 4inherit allarch
5 5
6SRC_URI = "file://25-dhcp-server.network" 6SRC_URI = "\
7 7 file://27-dhcp-client-external.network \
8 "
8 9
9FILES_${PN} = "/usr/lib/systemd/network" 10FILES_${PN} = "/usr/lib/systemd/network"
10 11
@@ -12,5 +13,11 @@ PR = "1"
12 13
13do_install() { 14do_install() {
14 install -d ${D}/usr/lib/systemd/network 15 install -d ${D}/usr/lib/systemd/network
15 install -m 0644 ${WORKDIR}/25-dhcp-server.network ${D}/usr/lib/systemd/network/ 16 install -m 0644 ${WORKDIR}/27-dhcp-client-external.network ${D}/usr/lib/systemd/network/
16} 17}
18
19SECONDARY_NETWORK_IP_ADDR ?= "10.0.3.1"
20
21require static-network-config.inc
22
23# vim:set ts=4 sw=4 sts=4 expandtab:
diff --git a/recipes-test/demo-network-config/secondary-network-config.bb b/recipes-test/demo-network-config/secondary-network-config.bb
index 9091c65..6473e05 100644
--- a/recipes-test/demo-network-config/secondary-network-config.bb
+++ b/recipes-test/demo-network-config/secondary-network-config.bb
@@ -3,18 +3,25 @@ LICENSE = "CLOSED"
3 3
4inherit allarch 4inherit allarch
5 5
6# TODO: It configures the 'user' interface in NAT mode and provides an access to public Inet via it
7# which is not desired for Secondary. It cannot be just removed since we get SSH access to Secondary
8# VM via this interface. So, the task is to configure the interface in such way that it does provide access
9# via SSH from a host machine and forbids an access to Inet
6SRC_URI = "\ 10SRC_URI = "\
7 file://26-dhcp-client.network \
8 file://27-dhcp-client-external.network \ 11 file://27-dhcp-client-external.network \
9 " 12 "
10 13
11
12FILES_${PN} = "/usr/lib/systemd/network" 14FILES_${PN} = "/usr/lib/systemd/network"
13 15
14PR = "1" 16PR = "1"
15 17
16do_install() { 18do_install() {
17 install -d ${D}/usr/lib/systemd/network 19 install -d ${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/ 20 install -m 0644 ${WORKDIR}/27-dhcp-client-external.network ${D}/usr/lib/systemd/network/
20} 21}
22
23SECONDARY_NETWORK_IP_ADDR ?= "10.0.3.2"
24
25require static-network-config.inc
26
27# vim:set ts=4 sw=4 sts=4 expandtab:
diff --git a/recipes-test/demo-network-config/static-network-config.inc b/recipes-test/demo-network-config/static-network-config.inc
new file mode 100644
index 0000000..27d2a20
--- /dev/null
+++ b/recipes-test/demo-network-config/static-network-config.inc
@@ -0,0 +1,16 @@
1SRC_URI_append = "\
2 file://26-static-client.network \
3 "
4
5SECONDARY_NETWORK_INTERFACE_NAME ?= "enp0s5"
6
7do_install_append() {
8 install -d ${D}/usr/lib/systemd/network
9 install -m 0644 ${WORKDIR}/26-static-client.network ${D}/usr/lib/systemd/network/
10 sed -i -e 's|@ADDR@|${SECONDARY_NETWORK_IP_ADDR}|g' \
11 -e 's|@IFNAME@|${SECONDARY_NETWORK_INTERFACE_NAME}|g' \
12 ${D}/usr/lib/systemd/network/26-static-client.network
13
14}
15
16# vim:set ts=4 sw=4 sts=4 expandtab:
diff --git a/recipes-test/demo-secondary-config/files/30-fake_pacman.toml b/recipes-test/demo-secondary-config/files/30-fake_pacman.toml
new file mode 100644
index 0000000..3fb5cf2
--- /dev/null
+++ b/recipes-test/demo-secondary-config/files/30-fake_pacman.toml
@@ -0,0 +1,2 @@
1[pacman]
2type = "fake"
diff --git a/recipes-test/demo-secondary-config/secondary-config.bb b/recipes-test/demo-secondary-config/secondary-config.bb
new file mode 100644
index 0000000..3187ff0
--- /dev/null
+++ b/recipes-test/demo-secondary-config/secondary-config.bb
@@ -0,0 +1,20 @@
1DESCRIPTION = "Sample configuration for an Uptane Secondary"
2LICENSE = "CLOSED"
3
4inherit allarch
5
6SRC_URI = "\
7 file://30-fake_pacman.toml \
8 "
9
10do_install () {
11 install -m 0700 -d ${D}${libdir}/sota/conf.d
12 install -m 0644 ${WORKDIR}/30-fake_pacman.toml ${D}/${libdir}/sota/conf.d/30-fake_pacman.toml
13}
14
15FILES_${PN} = " \
16 ${libdir}/sota/conf.d \
17 ${libdir}/sota/conf.d/30-fake_pacman.toml \
18 "
19
20# vim:set ts=4 sw=4 sts=4 expandtab:
diff --git a/recipes-test/images/primary-image.bb b/recipes-test/images/primary-image.bb
index 6d2df94..ac14233 100644
--- a/recipes-test/images/primary-image.bb
+++ b/recipes-test/images/primary-image.bb
@@ -5,6 +5,7 @@ SUMMARY = "A minimal Uptane Primary image running aktualizr, for testing with a
5LICENSE = "MIT" 5LICENSE = "MIT"
6 6
7IMAGE_INSTALL_remove = " \ 7IMAGE_INSTALL_remove = " \
8 virtual/network-configuration \
8 " 9 "
9 10
10IMAGE_INSTALL_append = " \ 11IMAGE_INSTALL_append = " \
diff --git a/recipes-test/images/secondary-image.bb b/recipes-test/images/secondary-image.bb
index 61df85b..46be3d1 100644
--- a/recipes-test/images/secondary-image.bb
+++ b/recipes-test/images/secondary-image.bb
@@ -21,6 +21,7 @@ IMAGE_INSTALL_remove = " \
21IMAGE_INSTALL_append = " \ 21IMAGE_INSTALL_append = " \
22 aktualizr-secondary \ 22 aktualizr-secondary \
23 secondary-network-config \ 23 secondary-network-config \
24 secondary-config \
24 " 25 "
25 26
26# vim:set ts=4 sw=4 sts=4 expandtab: 27# vim:set ts=4 sw=4 sts=4 expandtab:
diff --git a/scripts/qemucommand.py b/scripts/qemucommand.py
index cafab6d..1049d7c 100644
--- a/scripts/qemucommand.py
+++ b/scripts/qemucommand.py
@@ -109,8 +109,8 @@ class QemuCommand(object):
109 cmdline += ['-net', 'dump,file=' + self.pcap] 109 cmdline += ['-net', 'dump,file=' + self.pcap]
110 if self.secondary_network: 110 if self.secondary_network:
111 cmdline += [ 111 cmdline += [
112 '-net', 'nic,vlan=1,macaddr='+random_mac(), 112 '-netdev', 'socket,id=vlan1,mcast=230.0.0.1:1234,localaddr=127.0.0.1',
113 '-net', 'socket,vlan=1,mcast=230.0.0.1:1234,localaddr=127.0.0.1', 113 '-device', 'e1000,netdev=vlan1,mac='+random_mac(),
114 ] 114 ]
115 if self.gui: 115 if self.gui:
116 cmdline += ["-serial", "stdio"] 116 cmdline += ["-serial", "stdio"]