|
| 1 | +// Module included in the following assemblies: |
| 2 | +// |
| 3 | +// * networking/hardware_networks/configuring-sriov-qinq-support.adoc |
| 4 | +// * |
| 5 | +// * |
| 6 | + |
| 7 | +:_mod-docs-content-type: PROCEDURE |
| 8 | + |
| 9 | +[id="nw-configuring-qinq-sriov-proc_{context}"] |
| 10 | += Configuring QinQ support for SR-IOV enabled workloads |
| 11 | + |
| 12 | +.Prerequisites |
| 13 | + |
| 14 | +* You have installed the OpenShift CLI (`oc`). |
| 15 | +* You have access to the cluster as a user with the `cluster-admin` role. |
| 16 | +* You have installed the SR-IOV Network Operator. |
| 17 | + |
| 18 | +.Procedure |
| 19 | + |
| 20 | +. Create a file named `sriovnetpolicy-810-sriov-node-network.yaml` by using the following content: |
| 21 | ++ |
| 22 | +[source,yaml] |
| 23 | +---- |
| 24 | +apiVersion: sriovnetwork.openshift.io/v1 |
| 25 | +kind: SriovNetworkNodePolicy |
| 26 | +metadata: |
| 27 | + name: sriovnetpolicy-810 |
| 28 | + namespace: openshift-sriov-network-operator |
| 29 | +spec: |
| 30 | + deviceType: netdevice |
| 31 | + nicSelector: |
| 32 | + pfNames: |
| 33 | + - ens5f0#0-9 |
| 34 | + nodeSelector: |
| 35 | + node-role.kubernetes.io/worker-cnf: "" |
| 36 | + numVfs: 10 |
| 37 | + priority: 99 |
| 38 | + resourceName: resource810 |
| 39 | +---- |
| 40 | + |
| 41 | +. Create the `SriovNetworkNodePolicy` object by running the following command: |
| 42 | ++ |
| 43 | +[source,terminal] |
| 44 | +---- |
| 45 | +$ oc create -f sriovnetpolicy-810-sriov-node-network.yaml |
| 46 | +---- |
| 47 | + |
| 48 | +. Open a separate terminal window and monitor the synchronization status of the SR-IOV network node state for the node specified in the `openshift-sriov-network-operator` namespace by running the following command: |
| 49 | ++ |
| 50 | +[source,terminal] |
| 51 | +---- |
| 52 | +$ watch -n 1 'oc get sriovnetworknodestates -n openshift-sriov-network-operator <node_name> -o jsonpath="{.status.syncStatus}"' |
| 53 | +---- |
| 54 | ++ |
| 55 | +The synchronization status indicates a change from `InProgress` to `Succeeded`. |
| 56 | + |
| 57 | +. Create a `SriovNetwork` object, and set the outer VLAN called the S-tag, or `Service Tag`, as it belongs to the infrastructure. |
| 58 | ++ |
| 59 | +[IMPORTANT] |
| 60 | +==== |
| 61 | +You must configure the VLAN on the trunk interface of the switch. In addition, you might need to further configure some switches to support QinQ tagging. |
| 62 | +==== |
| 63 | + |
| 64 | +.. Create a file named `nad-sriovnetwork-1ad-810.yaml` by using the following content: |
| 65 | ++ |
| 66 | +[source,yaml] |
| 67 | +---- |
| 68 | +apiVersion: sriovnetwork.openshift.io/v1 |
| 69 | +kind: SriovNetwork |
| 70 | +metadata: |
| 71 | + name: sriovnetwork-1ad-810 |
| 72 | + namespace: openshift-sriov-network-operator |
| 73 | +spec: |
| 74 | + ipam: '{}' |
| 75 | + vlan: 171 <1> |
| 76 | + vlanProto: "802.1ad" <2> |
| 77 | + networkNamespace: default |
| 78 | + resourceName: resource810 |
| 79 | +---- |
| 80 | ++ |
| 81 | +<1> Sets the S-tag VLAN tag to `171`. |
| 82 | +<2> Specifies the VLAN protocol to assign to the virtual function (VF). Supported values are `802.1ad` and `802.1q`. The default value is `802.1q`. |
| 83 | + |
| 84 | +.. Create the object by running the following command: |
| 85 | ++ |
| 86 | +[source,terminal] |
| 87 | +---- |
| 88 | +$ oc create -f nad-sriovnetwork-1ad-810.yaml |
| 89 | +---- |
| 90 | + |
| 91 | +. Create a `NetworkAttachmentDefinition` object with an inner VLAN. The inner VLAN is often referred to as the C-tag, or `Customer Tag`, as it belongs to the Network Function: |
| 92 | + |
| 93 | +.. Create a file named `nad-cvlan100.yaml` by using the following content: |
| 94 | ++ |
| 95 | +[source,yaml] |
| 96 | +---- |
| 97 | +apiVersion: k8s.cni.cncf.io/v1 |
| 98 | +kind: NetworkAttachmentDefinition |
| 99 | +metadata: |
| 100 | + name: nad-cvlan100 |
| 101 | + namespace: default |
| 102 | +spec: |
| 103 | + config: '{ |
| 104 | + "name": "vlan-100", |
| 105 | + "cniVersion": "0.3.1", |
| 106 | + "type": "vlan", |
| 107 | + "linkInContainer": true, |
| 108 | + "master": "net1", <1> |
| 109 | + "vlanId": 100, |
| 110 | + "ipam": {"type": "static"} |
| 111 | + }' |
| 112 | +---- |
| 113 | ++ |
| 114 | +<1> Specifies the VF interface inside the pod. The default name is `net1` as the name is not set in the pod annotation. |
| 115 | + |
| 116 | +.. Apply the YAML file by running the following command: |
| 117 | ++ |
| 118 | +[source,terminal] |
| 119 | +---- |
| 120 | +$ oc apply -f nad-cvlan100.yaml |
| 121 | +---- |
| 122 | + |
| 123 | +.Verification |
| 124 | + |
| 125 | +* Verify QinQ is active on the node by following this procedure: |
| 126 | + |
| 127 | +. Create a file named `test-qinq-pod.yaml` by using the following content: |
| 128 | ++ |
| 129 | +[source,yaml] |
| 130 | +---- |
| 131 | +apiVersion: v1 |
| 132 | +kind: Pod |
| 133 | +metadata: |
| 134 | + name: test-pod |
| 135 | + annotations: |
| 136 | + k8s.v1.cni.cncf.io/networks: sriovnetwork-1ad-810, nad-cvlan100 |
| 137 | +spec: |
| 138 | + containers: |
| 139 | + - name: test-container |
| 140 | + image: quay.io/ocp-edge-qe/cnf-gotests-client:v4.10 |
| 141 | + imagePullPolicy: Always |
| 142 | + securityContext: |
| 143 | + privileged: true |
| 144 | +---- |
| 145 | + |
| 146 | +. Create the test pod by running the following command: |
| 147 | ++ |
| 148 | +[source,terminal] |
| 149 | +---- |
| 150 | +$ oc create -f test-qinq-pod.yaml |
| 151 | +---- |
| 152 | + |
| 153 | +. Enter into a debug session on the target node where the pod is present and display information about the network interface `ens5f0` by running the following command: |
| 154 | ++ |
| 155 | +[source,terminal] |
| 156 | +---- |
| 157 | +$ oc debug node/my-cluster-node -- bash -c "ip link show ens5f0" |
| 158 | +---- |
| 159 | ++ |
| 160 | +.Example output |
| 161 | + |
| 162 | +[source,terminal] |
| 163 | +---- |
| 164 | +6: ens5f0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000 |
| 165 | +link/ether b4:96:91:a5:22:10 brd ff:ff:ff:ff:ff:ff |
| 166 | +vf 0 link/ether a2:81:ba:d0:6f:f3 brd ff:ff:ff:ff:ff:ff, spoof checking on, link-state auto, trust off |
| 167 | +vf 1 link/ether 8a:bb:0a:36:f2:ed brd ff:ff:ff:ff:ff:ff, vlan 171, vlan protocol 802.1ad, spoof checking on, link-state auto, trust off |
| 168 | +vf 2 link/ether ca:0e:e1:5b:0c:d2 brd ff:ff:ff:ff:ff:ff, spoof checking on, link-state auto, trust off |
| 169 | +vf 3 link/ether ee:6c:e2:f5:2c:70 brd ff:ff:ff:ff:ff:ff, spoof checking on, link-state auto, trust off |
| 170 | +vf 4 link/ether 0a:d6:b7:66:5e:e8 brd ff:ff:ff:ff:ff:ff, spoof checking on, link-state auto, trust off |
| 171 | +vf 5 link/ether da:d5:e7:14:4f:aa brd ff:ff:ff:ff:ff:ff, spoof checking on, link-state auto, trust off |
| 172 | +vf 6 link/ether d6:8e:85:75:12:5c brd ff:ff:ff:ff:ff:ff, spoof checking on, link-state auto, trust off |
| 173 | +vf 7 link/ether d6:eb:ce:9c:ea:78 brd ff:ff:ff:ff:ff:ff, spoof checking on, link-state auto, trust off |
| 174 | +vf 8 link/ether 5e:c5:cc:05:93:3c brd ff:ff:ff:ff:ff:ff, spoof checking on, link-state auto, trust on |
| 175 | +vf 9 link/ether a6:5a:7c:1c:2a:16 brd ff:ff:ff:ff:ff:ff, spoof checking on, link-state auto, trust off |
| 176 | +---- |
| 177 | ++ |
| 178 | +The `vlan protocol 802.1ad` ID in the output indicates that the interface supports VLAN tagging with protocol 802.1ad (QinQ). The VLAN ID is 171. |
0 commit comments