Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1911397

Summary: cannot reapply route rules without priority
Product: Red Hat Enterprise Linux 8 Reporter: Mingyu Shi <mshi>
Component: nmstateAssignee: Gris Ge <fge>
Status: CLOSED ERRATA QA Contact: Mingyu Shi <mshi>
Severity: low Docs Contact:
Priority: low    
Version: 8.4CC: ferferna, jiji, jishi, network-qe, till
Target Milestone: rcKeywords: Triaged
Target Release: 8.4Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: nmstate-1.2.1-0.1.alpha1.el8 Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-05-10 13:34:46 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Mingyu Shi 2020-12-29 05:58:49 UTC
Description of problem:
User can add a route rule without priority, after that, nmstate or NM will write the real priority into NM connection. When apply again, nmstate will regard it as another rule and cause a failure.

Notice when priority not mentioned, NM automatically sets it to 30000. I think we can follow this process.

Version-Release number of selected component (if applicable):
nmstate-1.0.0-1.el8.noarch
nispor-1.0.1-2.el8.x86_64
NetworkManager-1.30.0-0.5.el8.x86_64

How reproducible:
100%

Steps to Reproduce:
cat << EOF > rules.yaml
routes:
  config:
  - destination: 0.0.0.0/0
    next-hop-address: 100.1.1.254
    next-hop-interface: dummy0
    table-id: 100
route-rules:
  config:
  - ip-from: 8.8.8.8/24
    ip-to: 200.1.1.1/24
    route-table: 100
interfaces:
- name: dummy0
  type: dummy
  state: up
  ipv4:
    enabled: true
    address:
    - ip: 100.1.1.1
      prefix-length: 24
EOF
nmstatectl set rules.yaml   # ok
nmstatectl set rules.yaml   # failed

Actual results:
Failed at second applying

Expected results:
No failure

Additional info:
Traceback (most recent call last):
  File "/usr/bin/nmstatectl", line 11, in <module>
    load_entry_point('nmstate==1.0.0', 'console_scripts', 'nmstatectl')()
  File "/usr/lib/python3.6/site-packages/nmstatectl/nmstatectl.py", line 70, in main
    return args.func(args)
  File "/usr/lib/python3.6/site-packages/nmstatectl/nmstatectl.py", line 280, in apply
    args.save_to_disk,
  File "/usr/lib/python3.6/site-packages/nmstatectl/nmstatectl.py", line 309, in apply_state
    save_to_disk=save_to_disk,
  File "/usr/lib/python3.6/site-packages/libnmstate/netapplier.py", line 71, in apply
    _apply_ifaces_state(plugins, net_state, verify_change, save_to_disk)
  File "/usr/lib/python3.6/site-packages/libnmstate/netapplier.py", line 115, in _apply_ifaces_state
    _verify_change(plugins, net_state)
  File "/usr/lib/python3.6/site-packages/libnmstate/netapplier.py", line 120, in _verify_change
    net_state.verify(current_state)
  File "/usr/lib/python3.6/site-packages/libnmstate/net_state.py", line 67, in verify
    self._route_rule.verify(current_state.get(RouteRule.KEY))
  File "/usr/lib/python3.6/site-packages/libnmstate/route_rule.py", line 175, in verify
    {RouteRule.KEY: {RouteRule.CONFIG: cur_rule_info}},
libnmstate.error.NmstateVerificationError: 
desired
=======
---
route-rules:
  config:
  - ip-from: 8.8.8.0/24
    ip-to: 200.1.1.0/24
    route-table: 100
  - ip-from: 8.8.8.0/24
    ip-to: 200.1.1.0/24
    priority: 30000
    route-table: 100
  - ip-from: 9.9.9.0/24
    ip-to: ''
    priority: 29999
    route-table: 100

current
=======
---
route-rules:
  config:
  - ip-from: 8.8.8.0/24
    ip-to: 200.1.1.0/24
    priority: 30000
    route-table: 100
  - ip-from: 9.9.9.0/24
    ip-to: ''
    priority: 29999
    route-table: 100

difference
==========
--- desired
+++ current
@@ -1,9 +1,6 @@
 ---
 route-rules:
   config:
-  - ip-from: 8.8.8.0/24
-    ip-to: 200.1.1.0/24
-    route-table: 100
   - ip-from: 8.8.8.0/24
     ip-to: 200.1.1.0/24
     priority: 30000

Comment 4 Fernando F. Mancera 2022-01-11 20:31:56 UTC
This is fixed on nmstatectl-rust. Please verify this bug on nmstatectl-rust. Thank you!

Comment 6 Mingyu Shi 2022-02-06 07:18:25 UTC
Verified with versions:
nmstate-1.2.1-0.2.alpha2.el8.x86_64
nispor-1.2.2-1.el8.x86_64

Notice it is only fixed in nmstate-rust:
[15:14:44@mshi860 ~]0# nmstatectl-rust set rules.yaml 
---
dns: {}
rules:
  config:
    - ip-from: 8.8.8.8/24
      ip-to: 200.1.1.1/24
      route-table: 100
routes:
  config:
    - destination: 0.0.0.0/0
      next-hop-interface: dummy0
      next-hop-address: 100.1.1.254
      table-id: 100
interfaces:
  - name: dummy0
    type: dummy
    state: up
    ipv4:
      enabled: true
      address:
        - ip: 100.1.1.1
          prefix-length: 24
ovs-db: {}

[15:14:50@mshi860 ~]0# ip rule
0:	from all lookup local
30000:	from 8.8.8.8/24 to 200.1.1.1/24 lookup 100
32766:	from all lookup main
32767:	from all lookup default
[15:14:52@mshi860 ~]0# nmstatectl-rust set rules.yaml 
---
dns: {}
rules:
  config:
    - ip-from: 8.8.8.8/24
      ip-to: 200.1.1.1/24
      route-table: 100
routes:
  config:
    - destination: 0.0.0.0/0
      next-hop-interface: dummy0
      next-hop-address: 100.1.1.254
      table-id: 100
interfaces:
  - name: dummy0
    type: dummy
    state: up
    ipv4:
      enabled: true
      address:
        - ip: 100.1.1.1
          prefix-length: 24
ovs-db: {}

[15:14:54@mshi860 ~]0# ip rule
0:	from all lookup local
30000:	from 8.8.8.8/24 to 200.1.1.1/24 lookup 100
32766:	from all lookup main
32767:	from all lookup default

Comment 8 errata-xmlrpc 2022-05-10 13:34:46 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (nmstate bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHEA-2022:1772