From 99e8cb86f6b7d02c618bbb492e776d24d22821e4 Mon Sep 17 00:00:00 2001 From: Mike Sul Date: Thu, 13 Jun 2019 13:22:24 +0300 Subject: OTA-2541: Primary and Secondary network configuration in case of RPi Signed-off-by: Mike Sul --- .../files/26-multihomed-client.network | 9 +++++++++ recipes-test/demo-network-config/network-config.inc | 19 +++++++++++++++++++ .../demo-network-config/primary-network-config.bb | 3 ++- .../demo-network-config/secondary-network-config.bb | 3 ++- .../demo-network-config/static-network-config.inc | 16 ---------------- 5 files changed, 32 insertions(+), 18 deletions(-) create mode 100644 recipes-test/demo-network-config/files/26-multihomed-client.network create mode 100644 recipes-test/demo-network-config/network-config.inc delete mode 100644 recipes-test/demo-network-config/static-network-config.inc 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 @@ +[Match] +Name=@IFNAME@ + +[Network] +Description=Multihomed network. DHCP-assigned IP for Primary<->Backend. Statically assigned IP for Primary<->Secondary +DHCP=yes + +[Address] +Address=@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 @@ +CONF_TYPE ?= "${@ 'multihomed' if d.getVar('MACHINE') == 'raspberrypi3' and d.getVar('IMAGE_TYPE') == 'primary' else 'static'}" + +SRC_URI_append = "\ + file://26-${CONF_TYPE}-client.network \ + " + +SECONDARY_INTERFACE ?= "${@ 'eth0' if d.getVar('MACHINE') == 'raspberrypi3' else 'enp0s5'}" + +do_install_append() { + bbnote "Network configuration type to be applied: ${CONF_TYPE}" + install -d ${D}/usr/lib/systemd/network + install -m 0644 ${WORKDIR}/26-${CONF_TYPE}-client.network ${D}/usr/lib/systemd/network/ + sed -i -e 's|@ADDR@|${IP_ADDR}|g' \ + -e 's|@IFNAME@|${SECONDARY_INTERFACE}|g' \ + ${D}/usr/lib/systemd/network/26-${CONF_TYPE}-client.network + +} + +# 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() { PRIMARY_IP ?= "10.0.3.1" IP_ADDR = "${PRIMARY_IP}" +IMAGE_TYPE = "primary" -require static-network-config.inc +require network-config.inc # 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() { SECONDARY_IP ?= "10.0.3.2" IP_ADDR = "${SECONDARY_IP}" +IMAGE_TYPE = "secondary" -require static-network-config.inc +require network-config.inc # 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 @@ -SRC_URI_append = "\ - file://26-static-client.network \ - " - -SECONDARY_INTERFACE ?= "enp0s5" - -do_install_append() { - install -d ${D}/usr/lib/systemd/network - install -m 0644 ${WORKDIR}/26-static-client.network ${D}/usr/lib/systemd/network/ - sed -i -e 's|@ADDR@|${IP_ADDR}|g' \ - -e 's|@IFNAME@|${SECONDARY_INTERFACE}|g' \ - ${D}/usr/lib/systemd/network/26-static-client.network - -} - -# vim:set ts=4 sw=4 sts=4 expandtab: -- cgit v1.2.3-54-g00ecf From fcf3daa7d63bf9a9948bafb2cc0472dc7d08d401 Mon Sep 17 00:00:00 2001 From: Mike Sul Date: Tue, 18 Jun 2019 10:11:18 +0300 Subject: OTA-2294: Use WiFi on Primary (if enabled) to communicate with the backend in case of RPi target Signed-off-by: Mike Sul --- conf/include/bblayers/sota_raspberrypi3.inc | 1 + recipes-test/demo-network-config/network-config.inc | 2 -- recipes-test/demo-network-config/primary-network-config.bb | 3 ++- recipes-test/demo-network-config/secondary-network-config.bb | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/conf/include/bblayers/sota_raspberrypi3.inc b/conf/include/bblayers/sota_raspberrypi3.inc index ea420ba..7e320af 100644 --- a/conf/include/bblayers/sota_raspberrypi3.inc +++ b/conf/include/bblayers/sota_raspberrypi3.inc @@ -1,2 +1,3 @@ BBLAYERS += "${METADIR}/meta-updater-raspberrypi" BBLAYERS += "${METADIR}/meta-raspberrypi" +BBLAYERS += "${METADIR}/meta-openembedded/meta-networking" diff --git a/recipes-test/demo-network-config/network-config.inc b/recipes-test/demo-network-config/network-config.inc index c713589..ed623d4 100644 --- a/recipes-test/demo-network-config/network-config.inc +++ b/recipes-test/demo-network-config/network-config.inc @@ -1,5 +1,3 @@ -CONF_TYPE ?= "${@ 'multihomed' if d.getVar('MACHINE') == 'raspberrypi3' and d.getVar('IMAGE_TYPE') == 'primary' else 'static'}" - SRC_URI_append = "\ file://26-${CONF_TYPE}-client.network \ " diff --git a/recipes-test/demo-network-config/primary-network-config.bb b/recipes-test/demo-network-config/primary-network-config.bb index 1c17e0a..d840a95 100644 --- a/recipes-test/demo-network-config/primary-network-config.bb +++ b/recipes-test/demo-network-config/primary-network-config.bb @@ -18,8 +18,9 @@ do_install() { } PRIMARY_IP ?= "10.0.3.1" + IP_ADDR = "${PRIMARY_IP}" -IMAGE_TYPE = "primary" +CONF_TYPE ?= "${@ 'multihomed' if d.getVar('MACHINE') == 'raspberrypi3' and d.getVar('RPI_WIFI_ENABLE') != '1' else 'static'}" require network-config.inc diff --git a/recipes-test/demo-network-config/secondary-network-config.bb b/recipes-test/demo-network-config/secondary-network-config.bb index 1c7f01c..b1d70f1 100644 --- a/recipes-test/demo-network-config/secondary-network-config.bb +++ b/recipes-test/demo-network-config/secondary-network-config.bb @@ -23,7 +23,7 @@ do_install() { SECONDARY_IP ?= "10.0.3.2" IP_ADDR = "${SECONDARY_IP}" -IMAGE_TYPE = "secondary" +CONF_TYPE = "static" require network-config.inc -- cgit v1.2.3-54-g00ecf