suse-edge / nm-configurator

NetworkManager configuration tool
Apache License 2.0
7 stars 3 forks source link

Introduce an unified config option #78

Closed atanasdinov closed 4 months ago

atanasdinov commented 4 months ago

Closes https://github.com/suse-edge/nm-configurator/issues/67

rdoxenham commented 4 months ago

LGTM! Thanks a lot @atanasdinov for the great work!

Built a new EIB image to test this end-to-end:

rdo@woden:~/work/eib-testing% cat network/_all.yaml
interfaces:
- name: eth0
  type: ethernet
  state: up
  ipv4:
    dhcp: true
    enabled: true
  ipv6:
    enabled: false
- name: eth1
  type: ethernet
  state: up
  ipv4:
    address:
    - ip: 10.0.0.1
      prefix-length: 24
    enabled: true
    dhcp: false
  ipv6:
    enabled: false

This built successfully, and created the correct configuration files:

rdo@woden:~/work/eib-testing% tree _build/build-May25_09-31-23/combustion/network
_build/build-May25_09-31-23/combustion/network
└── _all
    ├── eth0.nmconnection
    └── eth1.nmconnection

2 directories, 2 files

Upon boot it successfully applied the unified configuration:

image

It then successfully shows the configuration at the login prompt:

image

After logging in, I can see the correctly applied configuration:

localhost:~ # nmcli con
NAME  UUID                                  TYPE      DEVICE
eth0  dfd202f5-562f-5f07-8f2a-a7717756fb70  ethernet  eth0
eth1  0523c0a1-5f5e-5603-bcf2-68155d5d322e  ethernet  eth1

localhost:~ # ip addr show dev eth0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 00:11:22:33:44:01 brd ff:ff:ff:ff:ff:ff
    altname enp1s0
    inet 192.168.122.209/24 brd 192.168.122.255 scope global dynamic noprefixroute eth0
       valid_lft 3516sec preferred_lft 3516sec

localhost:~ # ip addr show dev eth1
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 52:54:00:bf:e7:c4 brd ff:ff:ff:ff:ff:ff
    altname enp7s0
    inet 10.0.0.1/24 brd 10.0.0.255 scope global noprefixroute eth1
       valid_lft forever preferred_lft forever

localhost:~ # ip route
default via 192.168.122.1 dev eth0 proto dhcp src 192.168.122.209 metric 100
10.0.0.0/24 dev eth1 proto kernel scope link src 10.0.0.1 metric 101
192.168.122.0/24 dev eth0 proto kernel scope link src 192.168.122.209 metric 100