Bug 2111398

Summary: [RFE] Support VLAN trunk mode and and trunk-tags range for OVS-bridge
Product: Red Hat Enterprise Linux 9 Reporter: Yossi Segev <ysegev>
Component: nmstateAssignee: Beniamino Galvani <bgalvani>
Status: CLOSED ERRATA QA Contact: Mingyu Shi <mshi>
Severity: unspecified Docs Contact:
Priority: high    
Version: 9.1CC: bgalvani, danken, ferferna, fge, jiji, jishi, network-qe, sfaye, till
Target Milestone: rcKeywords: FutureFeature, Triaged
Target Release: 9.2   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: nmstate-2.2.2-1.el9 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 2111959 (view as bug list) Environment:
Last Closed: 2023-05-09 07:31:01 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:
Bug Depends On: 2111959    
Bug Blocks:    

Description Yossi Segev 2022-07-27 08:56:37 UTC
Description of problem:
Currently nmstate doesn't suepport reating an OVS bridge, with a VLAN port in trunk mode and trunk-tags range.


Version-Release number of selected component (if applicable):
Red Hat Enterprise Linux CoreOS 411.86.202207150124-0
RHEL 8.6
NetworkManager (on cluster worker node): 1.36.0-7.el8_6
NetworkManager (on nmstate-handler pod): 1.36.0-7.el8_6
nmstate (on nmstate-handler pod): nmstate-1.2.1-3.el8_6.x86_64


How reproducible:
100%


Steps to Reproduce:
1. Create an OVS bridge with a VLAN port in trunk mode and trunk-tags range.
I used the following policy to achieve that:

apiVersion: nmstate.io/v1
kind: NodeNetworkConfigurationPolicy
metadata:
  name: ovs-bridge-policy
spec:
  desiredState:
    interfaces:
    - bridge:
        options:
          stp: false
        port:
        - name: eno4
          vlan:
            mode: trunk
            trunk-tags:
            - id-range:
                max: 1019
                min: 1000
      name: br1test
      state: up
      type: ovs-bridge
  nodeSelector:
    node-role.kubernetes.io/worker: ""

(Modify port name and VLAN id-range per according to your environment).


Actual results:
The configuration fails to configure after timeout:
$ oc get nncp -w
NAME                STATUS        REASON
ovs-bridge-policy   Progressing   ConfigurationProgressing
ovs-bridge-policy   Progressing   ConfigurationProgressing
ovs-bridge-policy   Degraded      FailedToConfigure


Expected results:
Successful configuration.


Additional info:
1. This configuration is not supported in NetworkManager as well (not only in nmstate).

2. The same configuration succeeds when the bridge type is linux-bridge, i.e.
apiVersion: nmstate.io/v1
kind: NodeNetworkConfigurationPolicy
metadata:
  name: linux-bridge-policy
spec:
  desiredState:
    interfaces:
    - bridge:
        options:
          stp: false
        port:
        - name: eno4
          vlan:
            mode: trunk
            trunk-tags:
            - id-range:
                max: 1019
                min: 1000
      name: br1test
      state: up
      type: linux-bridge
  nodeSelector:
    node-role.kubernetes.io/worker: ""

3. The same configuration (OVS bridge) succeeds, with a VLAN port in access mode and an explicit ID tag, i.e.
apiVersion: nmstate.io/v1
kind: NodeNetworkConfigurationPolicy
metadata:
  name: ovs-bridge-policy
spec:
  desiredState:
    interfaces:
    - bridge:
        options:
          stp: false
        port:
        - name: eno4
          vlan:
            mode: access
            tag: 1021
      name: br1test
      state: up
      type: ovs-bridge
  nodeSelector:
    node-role.kubernetes.io/worker: ""

4. This was found on RHEL 8.6, however it can be targeted to RHEL 9.

Comment 1 Gris Ge 2022-07-27 09:00:24 UTC
This require support from NetworkManager also.

According to manpage of `ovs-vswitchd.conf.db`, we can use `trunks` property which can hold up to 4096 integers in range of 0 - 4095.

Comment 6 Gris Ge 2022-12-14 03:27:52 UTC
Upstream patch merged.

Example yaml:

```yml
  - name: ovs0
    type: ovs-interface
    state: up
  - name: ovs-br0
    type: ovs-bridge
    state: up
    bridge:
      port:
        - name: ovs0
          vlan:
            mode: trunk
            trunk-tags:
              - id-range:
                  min: 20
                  max: 22
              - id-range:
                  min: 30
                  max: 32
              - id: 40
```

Comment 10 Mingyu Shi 2023-01-19 08:17:12 UTC
Verified with:
nmstate-2.2.3-3.el9.x86_64
nispor-1.2.9-1.el9.x86_64
NetworkManager-1.41.8-1.el9.x86_64
openvswitch2.15-2.15.0-79.el9fdp.x86_64

Comment 12 errata-xmlrpc 2023-05-09 07:31:01 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