nmstate/kubernetes-nmstate

Error messages are malformed in NNCE

Closed this issue · 1 comments

What happened:

When applying the following desiredState:

interfaces:
- ipv4:
    address:
    - ip: 192.168.0.1
      prefix-length: 24
    enabled: true
    state: absent
  name: eth1
  state: up
  type: ethernet

The output of nmstatectl is:

Traceback (most recent call last):
  File "/usr/bin/nmstatectl", line 11, in <module>
    load_entry_point('nmstate==1.1.0', 'console_scripts', 'nmstatectl')()
  File "/usr/lib/python3.6/site-packages/nmstatectl/nmstatectl.py", line 74, in main
    return args.func(args)
  File "/usr/lib/python3.6/site-packages/nmstatectl/nmstatectl.py", line 338, in set
    return apply(args)
  File "/usr/lib/python3.6/site-packages/nmstatectl/nmstatectl.py", line 355, in apply
    args.save_to_disk,
  File "/usr/lib/python3.6/site-packages/nmstatectl/nmstatectl.py", line 419, in apply_state
    save_to_disk=save_to_disk,
  File "/usr/lib/python3.6/site-packages/libnmstate/netapplier.py", line 90, in apply
    _apply_ifaces_state(plugins, net_state, verify_change, save_to_disk)
  File "/usr/lib/python3.6/site-packages/libnmstate/netapplier.py", line 141, in _apply_ifaces_state
    _verify_change(plugins, net_state)
  File "/usr/lib/python3.6/site-packages/libnmstate/netapplier.py", line 156, in _verify_change
    net_state.verify(current_state)
  File "/usr/lib/python3.6/site-packages/libnmstate/net_state.py", line 86, in verify
    self._ifaces.verify(current_state.get(Interface.KEY))
  File "/usr/lib/python3.6/site-packages/libnmstate/ifaces/ifaces.py", line 665, in verify
    cur_iface.state_for_verify(),
libnmstate.error.NmstateVerificationError: 
desired
=======
---
name: eth1
type: ethernet
state: up
ipv4:
  state: absent
  enabled: true
  address:
  - ip: 192.168.0.1
    prefix-length: 24

current
=======
---
name: eth1
type: ethernet
state: up
accept-all-mac-addresses: false
ethernet:
  auto-negotiation: false
ethtool:
  feature:
    rx-gro: true
    rx-gro-list: false
    rx-udp-gro-forwarding: false
    tx-checksum-ip-generic: true
    tx-generic-segmentation: true
    tx-nocache-copy: false
    tx-tcp-ecn-segmentation: true
    tx-tcp-mangleid-segmentation: false
    tx-tcp-segmentation: true
    tx-tcp6-segmentation: true
  ring:
    rx: 256
    tx: 256
ipv4:
  enabled: true
  address:
  - ip: 192.168.0.1
    prefix-length: 24
  dhcp: false
ipv6:
  enabled: false
lldp:
  enabled: false
mac-address: 52:55:00:D1:56:02
mtu: 1500

difference
==========
--- desired
+++ current
@@ -2,9 +2,33 @@
 name: eth1
 type: ethernet
 state: up
+accept-all-mac-addresses: false
+ethernet:
+  auto-negotiation: false
+ethtool:
+  feature:
+    rx-gro: true
+    rx-gro-list: false
+    rx-udp-gro-forwarding: false
+    tx-checksum-ip-generic: true
+    tx-generic-segmentation: true
+    tx-nocache-copy: false
+    tx-tcp-ecn-segmentation: true
+    tx-tcp-mangleid-segmentation: false
+    tx-tcp-segmentation: true
+    tx-tcp6-segmentation: true
+  ring:
+    rx: 256
+    tx: 256
 ipv4:
-  state: absent
   enabled: true
   address:
   - ip: 192.168.0.1
     prefix-length: 24
+  dhcp: false
+ipv6:
+  enabled: false
+lldp:
+  enabled: false
+mac-address: 52:55:00:D1:56:02
+mtu: 1500

The output of NNCE is

      error reconciling NodeNetworkConfigurationPolicy at desired state apply: ,
      failed to execute nmstatectl set --no-commit --timeout 480: 'exit status 1'
      libnmstate.error.NmstateVerificationError:
      desired
      =======
      ---
      name
        eth1
      type
        ethernet
      state
        up
      ipv4:
        state
        absent
        enabled
        true
        address:
        - ip
        192.168.0.1
          prefix-length
        24
      current
      =======
      ---
      name
        eth1
      type
        ethernet
      state
        up
      accept-all-mac-addresses
        false
      ethernet:
        auto-negotiation
        false
      ethtool:
        feature:
          rx-gro
        true
          rx-gro-list
        false
          rx-udp-gro-forwarding
        false
          tx-checksum-ip-generic
        true
          tx-generic-segmentation
        true
          tx-nocache-copy
        false
          tx-tcp-ecn-segmentation
        true
          tx-tcp-mangleid-segmentation
        false
          tx-tcp-segmentation
        true
          tx-tcp6-segmentation
        true
        ring:
          rx
        256
          tx
        256
      ipv4:
        enabled
        true
        address:
        - ip
        192.168.0.1
          prefix-length
        24
        dhcp
        false
      ipv6:
        enabled
        false
      lldp:
        enabled
        false
      mac-address
        52:55:00:D1:56:02
      mtu
        1500
      difference
      ==========
      --- desired
      +++ current
      @@ -2,9 +2,33 @@
       name
        eth1
       type
        ethernet
       state
        up
      +accept-all-mac-addresses
        false
      +ethernet:
      +  auto-negotiation
        false
      +ethtool:
      +  feature:
      +    rx-gro
        true
      +    rx-gro-list
        false
      +    rx-udp-gro-forwarding
        false
      +    tx-checksum-ip-generic
        true
      +    tx-generic-segmentation
        true
      +    tx-nocache-copy
        false
      +    tx-tcp-ecn-segmentation
        true
      +    tx-tcp-mangleid-segmentation
        false
      +    tx-tcp-segmentation
        true
      +    tx-tcp6-segmentation
        true
      +  ring:
      +    rx
        256
      +    tx
        256
       ipv4:
      -  state
        absent
         enabled
        true
         address:
         - ip
        192.168.0.1
           prefix-length
        24
      +  dhcp
        false
      +ipv6:
      +  enabled
        false
      +lldp:
      +  enabled
        false
      +mac-address
        52:55:00:D1:56:02
      +mtu
        1500

What you expected to happen:
The output in NNCE is missing : after properties and values are indented on new line.
It's expected from the NNCE to yield the same formatting as from nmstatectl

How to reproduce it (as minimally and precisely as possible):

Anything else we need to know?:

Environment:

  • NodeNetworkState on affected nodes (use kubectl get nodenetworkstate <node_name> -o yaml):
  • Problematic NodeNetworkConfigurationPolicy:
  • kubernetes-nmstate image (use kubectl get pods --all-namespaces -l app=kubernetes-nmstate -o jsonpath='{.items[0].spec.containers[0].image}'):
  • NetworkManager version (use nmcli --version)
  • Kubernetes version (use kubectl version):
  • OS (e.g. from /etc/os-release):
  • Others:

/assign @tompsota