Bug 2130938

Summary: [RFE] Support route rule in gen_conf mode
Product: Red Hat Enterprise Linux 9 Reporter: Fernando F. Mancera <ferferna>
Component: nmstateAssignee: Fernando F. Mancera <ferferna>
Status: CLOSED ERRATA QA Contact: Mingyu Shi <mshi>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 9.2CC: ferferna, jiji, jishi, network-qe, till
Target Milestone: rcKeywords: FutureFeature, Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-05-09 07:31:48 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 Fernando F. Mancera 2022-09-29 13:57:16 UTC
Description of problem:

Nmstate do not provide route rule support for gen_conf mode and it should.

Comment 5 Mingyu Shi 2022-11-16 05:14:26 UTC
Verified with:
nmstate-2.2.1-0.alpha.20221110.el9.x86_64
NetworkManager-1.41.4-2.el9.x86_64
Linux dell-per750-01.rhts.eng.pek2.redhat.com 5.14.0-194.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Sat Nov 12 06:46:54 EST 2022 x86_64 x86_64 x86_64 GNU/Linux
DISTRO=RHEL-9.2.0-20221114.3

Given YAML state:
---
interfaces:
  - name: veth0
    type: ethernet
    state: up
    ipv6:
      address:
      - ip: 100::1
        prefix-length: 64
      enabled: true
    ipv4:
      address:
      - ip: 192.0.2.251
        prefix-length: 24
      enabled: true
  - name: veth1
    type: ethernet
    state: up
    ipv6:
      address:
      - ip: 1::1
        prefix-length: 64
      enabled: true
    ipv4:
      address:
      - ip: 198.51.100.251
        prefix-length: 24
      enabled: true
route-rules:
  config:
  - ip-to: 192.0.2.0/24
    priority: 1000
    route-table: 50
  - ip-from: 192.0.2.1/24
    priority: 1001
    route-table: 50
  - ip-to: 198.51.100.99/24
    priority: 1002
    route-table: 51
  - ip-from: 198.51.100.255/24
    priority: 1003
    route-table: 51
  - ip-to: 100::/64
    priority: 1000
    route-table: 50
  - ip-from: 100::/64
    priority: 1001
    route-table: 50
  - ip-to: 1::/64
    priority: 1002
    route-table: 51
  - ip-from: 1::/64
    priority: 1003
    route-table: 51
  - ip-to: 192.0.2.0/24
    ip-from: 192.0.2.1/24
    priority: 20000
    route-table: 50
  - ip-to: 100::/64
    priority: 20000
    route-table: 50
    ip-from: 100::/64
routes:
  config:
  - destination: 0.0.0.0/0
    metric: 150
    next-hop-address: 192.0.2.1
    next-hop-interface: veth0
    table-id: 50
  - destination: ::/0
    metric: 100
    next-hop-address: 100::254
    next-hop-interface: veth0
    table-id: 50
  - destination: 0.0.0.0/0
    metric: 151
    next-hop-address: 198.51.100.1
    next-hop-interface: veth1
    table-id: 51
  - destination: ::/0
    metric: 1
    next-hop-address: 1::254
    next-hop-interface: veth1
    table-id: 51

`nmstatectl gc $YAML_file` outputs:
NetworkManager:
- - veth0.nmconnection
  - |
    [connection]
    autoconnect=true
    autoconnect-slaves=-1
    id=veth0
    interface-name=veth0
    type=802-3-ethernet
    uuid=2cc2a1da-40dc-523d-83c5-8a163e5dd245

    [ipv4]
    address0=192.0.2.251/24
    method=manual
    route0=0.0.0.0/0,192.0.2.1,150
    route0_options=table=50
    routing-rule0=priority 1000 to 192.0.2.0/24 table 50
    routing-rule1=priority 1001 from 192.0.2.0/24 table 50
    routing-rule2=priority 20000 to 192.0.2.0/24 from 192.0.2.0/24 table 50

    [ipv6]
    addr-gen-mode=0
    address0=100::1/64
    method=manual
    route0=::/0,100::254,100
    route0_options=table=50
    routing-rule0=priority 1000 to 100::/64 table 50
    routing-rule1=priority 1001 from 100::/64 table 50
    routing-rule2=priority 20000 to 100::/64 from 100::/64 table 50
- - veth1.nmconnection
  - |
    [connection]
    autoconnect=true
    autoconnect-slaves=-1
    id=veth1
    interface-name=veth1
    type=802-3-ethernet
    uuid=854773cf-cad9-5212-ac9c-d1da0de907ad

    [ipv4]
    address0=198.51.100.251/24
    method=manual
    route0=0.0.0.0/0,198.51.100.1,151
    route0_options=table=51
    routing-rule0=priority 1002 to 198.51.100.0/24 table 51
    routing-rule1=priority 1003 from 198.51.100.0/24 table 51

    [ipv6]
    addr-gen-mode=0
    address0=1::1/64
    method=manual
    route0=::/0,1::254,1
    route0_options=table=51
    routing-rule0=priority 1002 to 1::/64 table 51
    routing-rule1=priority 1003 from 1::/64 table 51

Comment 7 errata-xmlrpc 2023-05-09 07:31:48 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/RHBA-2023:2190