Skip to content

Commit

Permalink
networking-tools: Add nmstate
Browse files Browse the repository at this point in the history
As discussed at [1] the nmstatectl tool is going to be added to FCOS, it
will allow to declare the network configuration at boot time

[1] coreos/fedora-coreos-tracker#1175

Signed-off-by: Enrique Llorente <[email protected]>
  • Loading branch information
qinqon committed Mar 6, 2023
1 parent 7205d41 commit 8373814
Show file tree
Hide file tree
Showing 12 changed files with 100 additions and 0 deletions.
3 changes: 3 additions & 0 deletions manifest-lock.aarch64.json
Original file line number Diff line number Diff line change
Expand Up @@ -909,6 +909,9 @@
"nftables": {
"evra": "1:1.0.4-3.fc37.aarch64"
},
"nmstate": {
"evra": "2.2.5-1.fc37.aarch64"
},
"npth": {
"evra": "1.6-9.fc37.aarch64"
},
Expand Down
3 changes: 3 additions & 0 deletions manifest-lock.ppc64le.json
Original file line number Diff line number Diff line change
Expand Up @@ -906,6 +906,9 @@
"nftables": {
"evra": "1:1.0.4-3.fc37.ppc64le"
},
"nmstate": {
"evra": "2.2.5-1.fc37.ppc64le"
},
"npth": {
"evra": "1.6-9.fc37.ppc64le"
},
Expand Down
3 changes: 3 additions & 0 deletions manifest-lock.s390x.json
Original file line number Diff line number Diff line change
Expand Up @@ -849,6 +849,9 @@
"nftables": {
"evra": "1:1.0.4-3.fc37.s390x"
},
"nmstate": {
"evra": "2.2.5-1.fc37.s390x"
},
"npth": {
"evra": "1.6-9.fc37.s390x"
},
Expand Down
3 changes: 3 additions & 0 deletions manifest-lock.x86_64.json
Original file line number Diff line number Diff line change
Expand Up @@ -921,6 +921,9 @@
"nftables": {
"evra": "1:1.0.4-3.fc37.x86_64"
},
"nmstate": {
"evra": "2.2.5-1.fc37.x86_64"
},
"npth": {
"evra": "1.6-9.fc37.x86_64"
},
Expand Down
3 changes: 3 additions & 0 deletions manifests/networking-tools.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@ packages:
- iptables nftables
# Interactive network tools for admins
- socat net-tools bind-utils
# Declarative network configuration
# https://github.com/coreos/fedora-coreos-tracker/issues/1175
- nmstate
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,5 @@ enable rtas_errd.service
enable clevis-luks-askpass.path
# Provide status information about the Ignition run
enable coreos-ignition-write-issues.service
# Apply network configuration from /etc/nmstate/*.yml
enable nmstate.service
24 changes: 24 additions & 0 deletions tests/kola/networking/nmstate/policy/config.bu
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
variant: fcos
version: 1.4.0
storage:
files:
- path: /etc/nmstate/br-ex-policy.yaml
contents:
inline: |
capture:
default-gw-route: routes.running.destination=="::/0"
default-gw-iface: interfaces.name==capture.default-gw-route.routes.running.0.next-hop-interface
desiredState:
interfaces:
- name: "{{ capture.default-gw-iface.interfaces.0.name }}"
type: ethernet
state: up
- name: br-ex
type: linux-bridge
copy-mac-from: "{{ capture.default-gw-iface.interfaces.0.name }}"
state: up
ipv4: "{{ capture.default-gw-iface.interfaces.0.ipv4 }}"
ipv6: "{{ capture.default-gw-iface.interfaces.0.ipv4 }}"
bridge:
port:
- name: "{{ capture.default-gw-iface.interfaces.0.name }}"
1 change: 1 addition & 0 deletions tests/kola/networking/nmstate/policy/data/commonlib.sh
16 changes: 16 additions & 0 deletions tests/kola/networking/nmstate/policy/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash
## kola:
## tags: "platform-independent"
#
# Configure a DHCP linux bridge using butane and nmstate service

set -xeuo pipefail

. $KOLA_EXT_DATA/commonlib.sh

if ! ip l show dev br-ex ; then
fatal "bridge not configured"
fi

ok "bridge configured correctly"

25 changes: 25 additions & 0 deletions tests/kola/networking/nmstate/state/config.bu
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
variant: fcos
version: 1.4.0
storage:
files:
- path: /etc/nmstate/br-ex.yaml
contents:
inline: |
interfaces:
- name: ens4
type: ethernet
state: up
- name: br-ex
type: linux-bridge
copy-mac-from: ens4
state: up
ipv4:
enabled: true
dhcp: true
ipv6:
enabled: true
dhcp: true
autoconf: true
bridge:
port:
- name: ens4
1 change: 1 addition & 0 deletions tests/kola/networking/nmstate/state/data/commonlib.sh
16 changes: 16 additions & 0 deletions tests/kola/networking/nmstate/state/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash
## kola:
## tags: "platform-independent"
#
# Configure a DHCP linux bridge using butane and nmstate service

set -xeuo pipefail

. $KOLA_EXT_DATA/commonlib.sh

if ! ip l show dev br-ex ; then
fatal "bridge not configured"
fi

ok "bridge configured correctly"

0 comments on commit 8373814

Please sign in to comment.