From fc8f9b4b1721a029a30bf41e6086cfbff085089d Mon Sep 17 00:00:00 2001 From: Phil Wise Date: Mon, 19 Mar 2018 16:31:31 +0100 Subject: Add a --secondary-network option to run-qemu-ota This sets up a simulated 'in vehicle' network. Add support for a Primary node with a DHCP server and a secondary node with a DHCP client. --- .../demo-network-config/files/25-dhcp-server.network | 12 ++++++++++++ .../demo-network-config/files/26-dhcp-client.network | 6 ++++++ .../demo-network-config/primary-network-config.bb | 16 ++++++++++++++++ .../demo-network-config/secondary-network-config.bb | 16 ++++++++++++++++ recipes-test/images/primary-image.bb | 12 ++++++++++++ recipes-test/images/secondary-image.bb | 5 ++++- 6 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 recipes-test/demo-network-config/files/25-dhcp-server.network create mode 100644 recipes-test/demo-network-config/files/26-dhcp-client.network create mode 100644 recipes-test/demo-network-config/primary-network-config.bb create mode 100644 recipes-test/demo-network-config/secondary-network-config.bb create mode 100644 recipes-test/images/primary-image.bb (limited to 'recipes-test') diff --git a/recipes-test/demo-network-config/files/25-dhcp-server.network b/recipes-test/demo-network-config/files/25-dhcp-server.network new file mode 100644 index 0000000..4766f9a --- /dev/null +++ b/recipes-test/demo-network-config/files/25-dhcp-server.network @@ -0,0 +1,12 @@ +[Match] +Name=enp0s4 + +[Network] +Description=Private internal network between aktualizr Primary and Secondary nodes +DHCPServer=yes +Address=10.0.3.1/24 +IPForward=yes +IPMasquerade=yes + +[DHCPServer] +PoolOffset=10 \ No newline at end of file diff --git a/recipes-test/demo-network-config/files/26-dhcp-client.network b/recipes-test/demo-network-config/files/26-dhcp-client.network new file mode 100644 index 0000000..319664f --- /dev/null +++ b/recipes-test/demo-network-config/files/26-dhcp-client.network @@ -0,0 +1,6 @@ +[Match] +Name=enp0s4 + +[Network] +Description=Private internal network between aktualizr Primary and Secondary nodes +DHCP=yes diff --git a/recipes-test/demo-network-config/primary-network-config.bb b/recipes-test/demo-network-config/primary-network-config.bb new file mode 100644 index 0000000..78678a2 --- /dev/null +++ b/recipes-test/demo-network-config/primary-network-config.bb @@ -0,0 +1,16 @@ +DESCRIPTION = "Sample network configuration for an Uptane Primary" +LICENSE = "CLOSED" + +inherit allarch + +SRC_URI = "file://25-dhcp-server.network" + + +FILES_${PN} = "/usr/lib/systemd/network" + +PR = "1" + +do_install() { + install -d ${D}/usr/lib/systemd/network + install -m 0644 ${WORKDIR}/25-dhcp-server.network ${D}/usr/lib/systemd/network/ +} diff --git a/recipes-test/demo-network-config/secondary-network-config.bb b/recipes-test/demo-network-config/secondary-network-config.bb new file mode 100644 index 0000000..492d3ca --- /dev/null +++ b/recipes-test/demo-network-config/secondary-network-config.bb @@ -0,0 +1,16 @@ +DESCRIPTION = "Sample network configuration for an Uptane Secondary" +LICENSE = "CLOSED" + +inherit allarch + +SRC_URI = "file://26-dhcp-client.network" + + +FILES_${PN} = "/usr/lib/systemd/network" + +PR = "1" + +do_install() { + install -d ${D}/usr/lib/systemd/network + install -m 0644 ${WORKDIR}/26-dhcp-client.network ${D}/usr/lib/systemd/network/ +} diff --git a/recipes-test/images/primary-image.bb b/recipes-test/images/primary-image.bb new file mode 100644 index 0000000..6c06527 --- /dev/null +++ b/recipes-test/images/primary-image.bb @@ -0,0 +1,12 @@ +include recipes-core/images/core-image-minimal.bb + +SUMMARY = "A minimal Uptane Primary image running aktualizr, for testing with a Linux secondary" + +LICENSE = "MIT" + +IMAGE_INSTALL_remove = " \ + " + +IMAGE_INSTALL_append = " \ + primary-network-config \ + " diff --git a/recipes-test/images/secondary-image.bb b/recipes-test/images/secondary-image.bb index c7a91db..c1ce57a 100644 --- a/recipes-test/images/secondary-image.bb +++ b/recipes-test/images/secondary-image.bb @@ -15,4 +15,7 @@ IMAGE_INSTALL_remove = " \ aktualizr-implicit-prov \ " -IMAGE_INSTALL_append = " aktualizr-secondary " \ No newline at end of file +IMAGE_INSTALL_append = " \ + aktualizr-secondary \ + secondary-network-config \ + " -- cgit v1.2.3-54-g00ecf