diff options
author | Mike Sul <ext-mykhaylo.sul@here.com> | 2019-05-16 22:47:12 +0300 |
---|---|---|
committer | Mike Sul <ext-mykhaylo.sul@here.com> | 2019-05-27 10:40:00 +0300 |
commit | ee23fa2bcae2fd793d62a531cb5ae0c9272d8a97 (patch) | |
tree | 00cc20fa367d716b68d2d4fed932120551fcfc7b /recipes-test/demo-network-config | |
parent | 1d05d369f2820e836e7f65aa45cf0775e6a875f0 (diff) | |
download | meta-updater-ee23fa2bcae2fd793d62a531cb5ae0c9272d8a97.tar.gz |
OTA-2541: Static IP address on Primary's and Secondary's internal NIC
Signed-off-by: Mike Sul <ext-mykhaylo.sul@here.com>
Diffstat (limited to 'recipes-test/demo-network-config')
4 files changed, 43 insertions, 6 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] | ||
2 | Name=@IFNAME@ | ||
3 | |||
4 | [Network] | ||
5 | Description=Private internal network between aktualizr Primary and Secondary nodes | ||
6 | Address=@ADDR@ | ||
7 | DHCP=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 | ||
4 | inherit allarch | 4 | inherit allarch |
5 | 5 | ||
6 | SRC_URI = "file://25-dhcp-server.network" | 6 | SRC_URI = "\ |
7 | 7 | file://27-dhcp-client-external.network \ | |
8 | " | ||
8 | 9 | ||
9 | FILES_${PN} = "/usr/lib/systemd/network" | 10 | FILES_${PN} = "/usr/lib/systemd/network" |
10 | 11 | ||
@@ -12,5 +13,11 @@ PR = "1" | |||
12 | 13 | ||
13 | do_install() { | 14 | do_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 | |||
19 | SECONDARY_NETWORK_IP_ADDR ?= "10.0.3.1" | ||
20 | |||
21 | require 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 | ||
4 | inherit allarch | 4 | inherit 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 | ||
6 | SRC_URI = "\ | 10 | SRC_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 | |||
12 | FILES_${PN} = "/usr/lib/systemd/network" | 14 | FILES_${PN} = "/usr/lib/systemd/network" |
13 | 15 | ||
14 | PR = "1" | 16 | PR = "1" |
15 | 17 | ||
16 | do_install() { | 18 | do_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 | |||
23 | SECONDARY_NETWORK_IP_ADDR ?= "10.0.3.2" | ||
24 | |||
25 | require 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 @@ | |||
1 | SRC_URI_append = "\ | ||
2 | file://26-static-client.network \ | ||
3 | " | ||
4 | |||
5 | SECONDARY_NETWORK_INTERFACE_NAME ?= "enp0s5" | ||
6 | |||
7 | do_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: | ||