Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-57020

Nmpolicy cannot refer an interfaces.name which differs with iface when identifier is mac-address

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Normal Normal
    • None
    • rhel-9.5
    • nmstate
    • nmstate-2.2.35-1.el9
    • No
    • Low
    • 1
    • rhel-sst-network-management
    • ssg_networking
    • 2
    • False
    • Hide

      None

      Show
      None
    • No
    • NMT - RHEL-9.5 DTM 24
    • Hide

      Given a system administrator creates an nmpolicy.yaml file where the identifier for an interface is set to mac-address,

      When they apply the policy using nmstatectl,

      Then, the system should correctly resolve the interface by its MAC address and apply the desired state without throwing an error.

      Definition of Done:

      • The implementation meets the acceptance criteria
      • Integration tests are written and pass
      • The code is part of a downstream build attached to an errata
      Show
      Given a system administrator creates an nmpolicy.yaml file where the identifier for an interface is set to mac-address, When they apply the policy using nmstatectl, Then, the system should correctly resolve the interface by its MAC address and apply the desired state without throwing an error. Definition of Done: The implementation meets the acceptance criteria Integration tests are written and pass The code is part of a downstream build attached to an errata
    • Pass
    • None
    • Unspecified Release Note Type - Unknown
    • None

      What were you trying to do that didn't work?

      In general, when using identifier=mac-address, interfaces.name will be used as NM profile/connection name, but this doesn't work when using nmpolicy.

      Please provide the package NVR for which bug is seen:

      nmstate-2.2.35-1.el9.x86_64

      How reproducible:

      100%

      Steps to reproduce

      cat << EOF > nmpolicy.yaml
      ---
      capture:
        gw: routes.running.destination=="0.0.0.0/0"
        gw-iface: interfaces.name==capture.gw.routes.running.0.next-hop-interface
      desiredState:
        interfaces:
          - name: test0-eth0
            identifier: mac-address
            mac-address: "{{ capture.gw-iface.interfaces.0.mac-address }}"
      EOF
      
      nmstatectl apply nmpolicy.yaml --no-commit --timeout 10
      

      Expected results

      Actual results

      [root@vm-10-0-185-109 ~]# nmstatectl set nmpolicy.yaml --no-commit --timeout 10
      [2024-09-04T06:53:12Z INFO  nmstatectl] Nmstate version: 2.2.35
      Using 'set' is deprecated, use 'apply' instead.
      [2024-09-04T06:53:12Z ERROR nmstate::ifaces::inter_ifaces] InvalidArgument: Failed to find unknown type interface test0-eth0 in current state
      NmstateError: InvalidArgument: Failed to find unknown type interface test0-eth0 in current state
      [root@vm-10-0-185-109 ~]#
      [root@vm-10-0-185-109 ~]# cat nmpolicy.yaml
      ---
      capture:
        gw: routes.running.destination=="0.0.0.0/0"
        gw-iface: interfaces.name==capture.gw.routes.running.0.next-hop-interface
      desiredState:
        interfaces:
          - name: test0-eth0
            identifier: mac-address
            mac-address: "{{ capture.gw-iface.interfaces.0.mac-address }}"
      

              rh-ee-sfaye Stanislas Faye
              rh-ee-mshi1 Mingyu Shi
              Network Management Team Network Management Team
              Mingyu Shi Mingyu Shi
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated: