summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Sul <ext-mykhaylo.sul@here.com>2019-06-13 13:22:24 +0300
committerMike Sul <ext-mykhaylo.sul@here.com>2019-06-13 15:54:17 +0300
commit99e8cb86f6b7d02c618bbb492e776d24d22821e4 (patch)
tree609a5e034ddfce0d677e87c916a7f851fbbd260c
parent2e2fb57021d79b7fdd0fe416080c690a7d50591a (diff)
downloadmeta-updater-99e8cb86f6b7d02c618bbb492e776d24d22821e4.tar.gz
OTA-2541: Primary and Secondary network configuration in case of RPi
Signed-off-by: Mike Sul <ext-mykhaylo.sul@here.com>
-rw-r--r--recipes-test/demo-network-config/files/26-multihomed-client.network9
-rw-r--r--recipes-test/demo-network-config/network-config.inc19
-rw-r--r--recipes-test/demo-network-config/primary-network-config.bb3
-rw-r--r--recipes-test/demo-network-config/secondary-network-config.bb3
-rw-r--r--recipes-test/demo-network-config/static-network-config.inc16
5 files changed, 32 insertions, 18 deletions
diff --git a/recipes-test/demo-network-config/files/26-multihomed-client.network b/recipes-test/demo-network-config/files/26-multihomed-client.network
new file mode 100644
index 0000000..f1e6cc6
--- /dev/null
+++ b/recipes-test/demo-network-config/files/26-multihomed-client.network
@@ -0,0 +1,9 @@
1[Match]
2Name=@IFNAME@
3
4[Network]
5Description=Multihomed network. DHCP-assigned IP for Primary<->Backend. Statically assigned IP for Primary<->Secondary
6DHCP=yes
7
8[Address]
9Address=@ADDR@
diff --git a/recipes-test/demo-network-config/network-config.inc b/recipes-test/demo-network-config/network-config.inc
new file mode 100644
index 0000000..c713589
--- /dev/null
+++ b/recipes-test/demo-network-config/network-config.inc
@@ -0,0 +1,19 @@
1CONF_TYPE ?= "${@ 'multihomed' if d.getVar('MACHINE') == 'raspberrypi3' and d.getVar('IMAGE_TYPE') == 'primary' else 'static'}"
2
3SRC_URI_append = "\
4 file://26-${CONF_TYPE}-client.network \
5 "
6
7SECONDARY_INTERFACE ?= "${@ 'eth0' if d.getVar('MACHINE') == 'raspberrypi3' else 'enp0s5'}"
8
9do_install_append() {
10 bbnote "Network configuration type to be applied: ${CONF_TYPE}"
11 install -d ${D}/usr/lib/systemd/network
12 install -m 0644 ${WORKDIR}/26-${CONF_TYPE}-client.network ${D}/usr/lib/systemd/network/
13 sed -i -e 's|@ADDR@|${IP_ADDR}|g' \
14 -e 's|@IFNAME@|${SECONDARY_INTERFACE}|g' \
15 ${D}/usr/lib/systemd/network/26-${CONF_TYPE}-client.network
16
17}
18
19# vim:set ts=4 sw=4 sts=4 expandtab:
diff --git a/recipes-test/demo-network-config/primary-network-config.bb b/recipes-test/demo-network-config/primary-network-config.bb
index c7daa15..1c17e0a 100644
--- a/recipes-test/demo-network-config/primary-network-config.bb
+++ b/recipes-test/demo-network-config/primary-network-config.bb
@@ -19,7 +19,8 @@ do_install() {
19 19
20PRIMARY_IP ?= "10.0.3.1" 20PRIMARY_IP ?= "10.0.3.1"
21IP_ADDR = "${PRIMARY_IP}" 21IP_ADDR = "${PRIMARY_IP}"
22IMAGE_TYPE = "primary"
22 23
23require static-network-config.inc 24require network-config.inc
24 25
25# vim:set ts=4 sw=4 sts=4 expandtab: 26# 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 c70d88a..1c7f01c 100644
--- a/recipes-test/demo-network-config/secondary-network-config.bb
+++ b/recipes-test/demo-network-config/secondary-network-config.bb
@@ -23,7 +23,8 @@ do_install() {
23 23
24SECONDARY_IP ?= "10.0.3.2" 24SECONDARY_IP ?= "10.0.3.2"
25IP_ADDR = "${SECONDARY_IP}" 25IP_ADDR = "${SECONDARY_IP}"
26IMAGE_TYPE = "secondary"
26 27
27require static-network-config.inc 28require network-config.inc
28 29
29# vim:set ts=4 sw=4 sts=4 expandtab: 30# 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
deleted file mode 100644
index e64675e..0000000
--- a/recipes-test/demo-network-config/static-network-config.inc
+++ /dev/null
@@ -1,16 +0,0 @@
1SRC_URI_append = "\
2 file://26-static-client.network \
3 "
4
5SECONDARY_INTERFACE ?= "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@|${IP_ADDR}|g' \
11 -e 's|@IFNAME@|${SECONDARY_INTERFACE}|g' \
12 ${D}/usr/lib/systemd/network/26-static-client.network
13
14}
15
16# vim:set ts=4 sw=4 sts=4 expandtab: