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 <ellorent@redhat.com>
  • Loading branch information
qinqon committed Mar 2, 2023
1 parent 7205d41 commit 77c3560
Show file tree
Hide file tree
Showing 7 changed files with 83 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
54 changes: 54 additions & 0 deletions tests/kola/nmstate/config.bu
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
variant: fcos
version: 1.4.0
storage:
files:
- path: /etc/nmstate/br-ex-policy.yaml
overwrite: true
contents:
inline: |
capture:
default-gw-route: routes.running.destination=="0.0.0.0/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 }}"
description: configured by nmstatectl
type: ethernet
state: up
- name: br-ex
description: configured by nmstatectl
type: ovs-interface
copy-mac-from: "{{ capture.default-gw-iface.interfaces.0.name }}"
state: up
ipv4:
enabled: true
dhcp: true
ipv6:
enabled: true
dhcp: true
autoconf: true
- name: br-ex
description: ovs bridge with eth1 as a port configured by nmstatectl
type: ovs-bridge
state: up
bridge:
port:
- name: br-ex
- name: "{{ capture.default-gw-iface.interfaces.0.name }}"
systemd:
units:
- name: nmstatectl.service
enabled: true
contents: |
[Unit]
Description=Nmstate apply
After=network-online.target openvswitch.service
Wants=network-online.target
Requires=openvswitch.service

[Service]
Type=oneshot
ExecStart=nmstatectl apply /etc/nmstate/br-ex.yaml

[Install]
WantedBy=multi-user.target
14 changes: 14 additions & 0 deletions tests/kola/nmstate/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash
#
# Configure an ovs-bridge using nmstate and butane

set -xeuo pipefail

. $KOLA_EXT_DATA/commonlib.sh

if ! nmstatectl show; then
fatal "ovs-bridge not configured"
fi

ok "ok ovs-bridge configured correctly with nmstate"

0 comments on commit 77c3560

Please sign in to comment.