diff --git a/feature/experimental/gribi/otg_tests/backup_nhg_action/README.md b/feature/experimental/gribi/otg_tests/backup_nhg_action/README.md index 23785c6922f..366e1a8762b 100644 --- a/feature/experimental/gribi/otg_tests/backup_nhg_action/README.md +++ b/feature/experimental/gribi/otg_tests/backup_nhg_action/README.md @@ -94,11 +94,14 @@ Different test scenarios requires different setups. traffic with decapsulated traffic with destination IP as `InnerDstIP_1` at ATE port-4. -[TODO]: Repeat the above tests with one additional scenario with the following changes, and it should not change the expected test result. +Repeat the above tests with one additional scenario with the following changes, +and it should not change the expected test result. * Add an empty decap VRF, `DECAP_TE_VRF`. -* Add 4 empty encap VRFs, `ENCAP_TE_VRF_A`, `ENCAP_TE_VRF_B`, `ENCAP_TE_VRF_C` and `ENCAP_TE_VRF_D`. -* Replace the existing VRF selection policy with `vrf_selection_policy_w` as in +* Add 4 empty encap VRFs, `ENCAP_TE_VRF_A`, `ENCAP_TE_VRF_B`, `ENCAP_TE_VRF_C` + and `ENCAP_TE_VRF_D`. +* Replace the existing VRF selection policy with `vrf_selection_policy_w` as + in ## Config Parameter coverage @@ -113,3 +116,4 @@ No new telemetry covered. ## Minimum DUT platform requirement vRX if the vendor implementation supports FIB-ACK simulation, otherwise FFF. + diff --git a/feature/experimental/gribi/otg_tests/backup_nhg_action/backup_nhg_action_test.go b/feature/experimental/gribi/otg_tests/backup_nhg_action/backup_nhg_action_test.go index b2a7a843bff..97e41bd2585 100644 --- a/feature/experimental/gribi/otg_tests/backup_nhg_action/backup_nhg_action_test.go +++ b/feature/experimental/gribi/otg_tests/backup_nhg_action/backup_nhg_action_test.go @@ -1,3 +1,17 @@ +// Copyright 2024 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package backup_nhg_action_test import ( @@ -27,7 +41,6 @@ const ( ipv6PrefixLen = 126 mask = "32" outerDstIP1 = "198.51.100.1" - outerSrcIP1 = "198.51.100.2" outerDstIP2 = "203.0.113.1" outerSrcIP2 = "203.0.113.2" innerDstIP1 = "198.18.0.1" @@ -62,7 +75,6 @@ const ( ipOverIPProtocol = 4 srcTrackingName = "ipSrcTracking" dstTrackingName = "ipDstTracking" - vrfPolW = "vrf_selection_policy_w" decapFlowSrc = "198.51.100.111" dscpEncapA1 = 10 ) @@ -266,16 +278,16 @@ func TestBackupNHGAction(t *testing.T) { desc: "Usecase with 2 NHOP Groups - Backup Pointing to Decap", fn: testBackupDecap, }, - { - name: "testDecapEncap", - desc: "Usecase with 3 NHOP Groups - Redirect pointing to back up DecapEncap and its Backup Pointing to Decap", - fn: testDecapEncap, - }, { name: "testBackupDecapWithVrfPolW", desc: "Usecase with 2 NHOP Groups - Backup Pointing to Decap with vrf policy W", fn: testBackupDecapWithVrfPolW, }, + { + name: "testDecapEncap", + desc: "Usecase with 3 NHOP Groups - Redirect pointing to back up DecapEncap and its Backup Pointing to Decap", + fn: testDecapEncap, + }, { name: "testDecapEncapWithVrfPolW", desc: "Usecase with 3 NHOP Groups - Redirect pointing to back up DecapEncap and its Backup Pointing to Decap with vrf policy W", @@ -481,12 +493,12 @@ func testDecapEncap(ctx context.Context, t *testing.T, args *testArgs) { } func testBackupDecapWithVrfPolW(ctx context.Context, t *testing.T, args *testArgs) { - configureVrfSelectionPolicyW(t, args.dut) + vrfpolicy.ConfigureVRFSelectionPolicyW(t, args.dut) testBackupDecap(ctx, t, args) } func testDecapEncapWithVrfPolW(ctx context.Context, t *testing.T, args *testArgs) { - configureVrfSelectionPolicyW(t, args.dut) + vrfpolicy.ConfigureVRFSelectionPolicyW(t, args.dut) testDecapEncap(ctx, t, args) } @@ -585,28 +597,3 @@ func validateTrafficFlows(t *testing.T, ate *ondatra.ATEDevice, good []gosnappi. } } } - -func configureVrfSelectionPolicyW(t *testing.T, dut *ondatra.DUTDevice) { - p1 := dut.Port(t, "port1") - gnmi.Delete(t, dut, gnmi.OC().NetworkInstance(vrfA).Interface(p1.Name()).Config()) - t.Log("Delete existing vrf selection policy and Apply vrf selectioin policy W") - gnmi.Delete(t, dut, gnmi.OC().NetworkInstance(deviations.DefaultNetworkInstance(dut)).PolicyForwarding().Config()) - - interfaceID := p1.Name() - if deviations.InterfaceRefInterfaceIDFormat(dut) { - interfaceID = interfaceID + ".0" - } - - niP := vrfpolicy.BuildVRFSelectionPolicyW(t, dut, deviations.DefaultNetworkInstance(dut)) - dutPolFwdPath := gnmi.OC().NetworkInstance(deviations.DefaultNetworkInstance(dut)).PolicyForwarding() - gnmi.Replace(t, dut, dutPolFwdPath.Config(), niP) - - intf := niP.GetOrCreateInterface(interfaceID) - intf.ApplyVrfSelectionPolicy = ygot.String(vrfPolW) - intf.GetOrCreateInterfaceRef().Interface = ygot.String(p1.Name()) - intf.GetOrCreateInterfaceRef().Subinterface = ygot.Uint32(0) - if deviations.InterfaceRefConfigUnsupported(dut) { - intf.InterfaceRef = nil - } - gnmi.Replace(t, dut, dutPolFwdPath.Interface(interfaceID).Config(), intf) -} diff --git a/feature/gribi/ate_tests/hierarchical_weight_resolution_test/README.md b/feature/gribi/ate_tests/hierarchical_weight_resolution_test/README.md index 6a7186d11d9..ae88fcc49d8 100644 --- a/feature/gribi/ate_tests/hierarchical_weight_resolution_test/README.md +++ b/feature/gribi/ate_tests/hierarchical_weight_resolution_test/README.md @@ -25,9 +25,10 @@ Configure ATE and DUT: 192.0.2.74 and default gateways as 192.0.2.5, 192.0.2.9, ..., 192.0.2.73 respectively. -* On DUT port-1 and ATE port-1 create a single L3 interface. +* On DUT port-1 and ATE port-1 create a single L3 interface. -* On DUT, create a policy-based forwarding rule to redirect all traffic received from DUT port-1 into VRF-1 (based on src. IP match criteria). +* On DUT, create a policy-based forwarding rule to redirect all traffic + received from DUT port-1 into VRF-1 (based on src. IP match criteria). Test case for basic hierarchical weight: @@ -110,16 +111,20 @@ WCMP width of 16 nexthops: * for each VLAN ID in 4...18: - * NH: (31/32) * (16/241) ~ 6.432% traffic received by ATE port-2 VLAN ID + * NH: (31/32) * (16/241) ~ 6.432% traffic received by ATE port-2 VLAN + ID * A tolerance of 0.2% is allowed for each VLAN for now, since we only test for 2 mins. -[TODO]: Repeat the above tests with one additional scenario with the following changes, and it should not change the expected test result. +Repeat the above tests with one additional scenario with the following changes, +and it should not change the expected test result. * Add an empty decap VRF, `DECAP_TE_VRF`. -* Add 4 empty encap VRFs, `ENCAP_TE_VRF_A`, `ENCAP_TE_VRF_B`, `ENCAP_TE_VRF_C` and `ENCAP_TE_VRF_D`. -* Replace the existing VRF selection policy with `vrf_selection_policy_w` as in +* Add 4 empty encap VRFs, `ENCAP_TE_VRF_A`, `ENCAP_TE_VRF_B`, `ENCAP_TE_VRF_C` + and `ENCAP_TE_VRF_D`. +* Replace the existing VRF selection policy with `vrf_selection_policy_w` as + in ## Config Parameter Coverage @@ -143,3 +148,4 @@ TODO: ## Minimum DUT platform requirement vRX + diff --git a/feature/gribi/ate_tests/hierarchical_weight_resolution_test/hierarchical_weight_resolution_test.go b/feature/gribi/ate_tests/hierarchical_weight_resolution_test/hierarchical_weight_resolution_test.go index 726597fca40..827055bee58 100644 --- a/feature/gribi/ate_tests/hierarchical_weight_resolution_test/hierarchical_weight_resolution_test.go +++ b/feature/gribi/ate_tests/hierarchical_weight_resolution_test/hierarchical_weight_resolution_test.go @@ -62,7 +62,6 @@ const ( nonDefaultVRF = "TE_VRF_111" policyName = "redirect-to-VRF1" ipipProtocol = 4 - vrfPolW = "vrf_selection_policy_w" decapFlowSrc = "198.51.100.111" dscpEncapA1 = 10 ) @@ -696,43 +695,19 @@ func TestHierarchicalWeightResolution(t *testing.T) { testBasicHierarchicalWeight(ctx, t, dut, ate, top, gRIBI) }) - t.Run("TestHierarchicalWeightBoundaryScenario", func(t *testing.T) { - testHierarchicalWeightBoundaryScenario(ctx, t, dut, ate, top, gRIBI) - }) - t.Run("TestBasicHierarchicalWeightWithVrfPolW", func(t *testing.T) { - configureVrfSelectionPolicyW(t, dut) + vrfpolicy.ConfigureVRFSelectionPolicyW(t, dut) testBasicHierarchicalWeight(ctx, t, dut, ate, top, gRIBI) }) + t.Run("TestHierarchicalWeightBoundaryScenario", func(t *testing.T) { + testHierarchicalWeightBoundaryScenario(ctx, t, dut, ate, top, gRIBI) + }) + t.Run("TestHierarchicalWeightBoundaryScenarioWithVrfPolW", func(t *testing.T) { - configureVrfSelectionPolicyW(t, dut) + vrfpolicy.ConfigureVRFSelectionPolicyW(t, dut) testHierarchicalWeightBoundaryScenario(ctx, t, dut, ate, top, gRIBI) }) top.StopProtocols(t) } - -func configureVrfSelectionPolicyW(t *testing.T, dut *ondatra.DUTDevice) { - t.Log("Delete existing vrf selection policy and Apply vrf selectioin policy W") - gnmi.Delete(t, dut, gnmi.OC().NetworkInstance(deviations.DefaultNetworkInstance(dut)).PolicyForwarding().Config()) - - p1 := dut.Port(t, "port1") - interfaceID := p1.Name() - if deviations.InterfaceRefInterfaceIDFormat(dut) { - interfaceID = interfaceID + ".0" - } - - niP := vrfpolicy.BuildVRFSelectionPolicyW(t, dut, deviations.DefaultNetworkInstance(dut)) - dutPolFwdPath := gnmi.OC().NetworkInstance(deviations.DefaultNetworkInstance(dut)).PolicyForwarding() - gnmi.Replace(t, dut, dutPolFwdPath.Config(), niP) - - intf := niP.GetOrCreateInterface(interfaceID) - intf.ApplyVrfSelectionPolicy = ygot.String(vrfPolW) - intf.GetOrCreateInterfaceRef().Interface = ygot.String(p1.Name()) - intf.GetOrCreateInterfaceRef().Subinterface = ygot.Uint32(0) - if deviations.InterfaceRefConfigUnsupported(dut) { - intf.InterfaceRef = nil - } - gnmi.Replace(t, dut, dutPolFwdPath.Interface(interfaceID).Config(), intf) -} diff --git a/feature/gribi/otg_tests/backup_nhg_multiple_nh_test/README.md b/feature/gribi/otg_tests/backup_nhg_multiple_nh_test/README.md index 9735755f0b0..3ca584cfc1a 100644 --- a/feature/gribi/otg_tests/backup_nhg_multiple_nh_test/README.md +++ b/feature/gribi/otg_tests/backup_nhg_multiple_nh_test/README.md @@ -27,11 +27,14 @@ Ensure that backup NHGs are honoured with NextHopGroup entries containing >1 NH. * Disable ATE port-3. Ensure that traffic for the destination is received at ATE port-4. -[TODO]: Repeat the above tests with one additional scenario with the following changes, and it should not change the expected test result. +Repeat the above tests with one additional scenario with the following changes, +and it should not change the expected test result. * Add an empty decap VRF, `DECAP_TE_VRF`. -* Add 4 empty encap VRFs, `ENCAP_TE_VRF_A`, `ENCAP_TE_VRF_B`, `ENCAP_TE_VRF_C` and `ENCAP_TE_VRF_D`. -* Replace the existing VRF selection policy with `vrf_selection_policy_w` as in +* Add 4 empty encap VRFs, `ENCAP_TE_VRF_A`, `ENCAP_TE_VRF_B`, `ENCAP_TE_VRF_C` + and `ENCAP_TE_VRF_D`. +* Replace the existing VRF selection policy with `vrf_selection_policy_w` as + in ## Config Parameter coverage @@ -52,3 +55,4 @@ Ensure that backup NHGs are honoured with NextHopGroup entries containing >1 NH. ## Minimum DUT platform requirement vRX + diff --git a/feature/gribi/otg_tests/backup_nhg_multiple_nh_test/backup_nhg_multiple_nh_test.go b/feature/gribi/otg_tests/backup_nhg_multiple_nh_test/backup_nhg_multiple_nh_test.go index 946eda472dd..41c9820ccb4 100644 --- a/feature/gribi/otg_tests/backup_nhg_multiple_nh_test/backup_nhg_multiple_nh_test.go +++ b/feature/gribi/otg_tests/backup_nhg_multiple_nh_test/backup_nhg_multiple_nh_test.go @@ -50,7 +50,6 @@ const ( fps = 1000000 // traffic frames per second switchovertime = 250.0 // switchovertime during interface shut in milliseconds ethernetCsmacd = oc.IETFInterfaces_InterfaceType_ethernetCsmacd - vrfPolW = "vrf_selection_policy_w" decapFlowSrc = "198.51.100.111" dscpEncapA1 = 10 ) @@ -273,47 +272,42 @@ func TestBackup(t *testing.T) { t.Fatalf("gRIBI Connection can not be established") } - tests := []struct { - name string - desc string - vrfPolicy bool - }{ - { - name: "IPv4BackUpSwitch", - desc: "Set primary and backup path with gribi and shutdown the primary path validating traffic switching over backup path", - vrfPolicy: false, - }, - { - name: "IPv4BackUpSwitchWithVrfPolicyW", - desc: "Set primary and backup path with gribi and shutdown the primary path validating traffic switching over backup path with vrf policy W", - vrfPolicy: true, - }, - } + // Make client leader + client.BecomeLeader(t) - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - t.Logf("Name: %s", tt.name) - t.Logf("Description: %s", tt.desc) - // Make client leader - client.BecomeLeader(t) - - // Flush past entries before running the tc - client.FlushAll(t) - - tcArgs := &testArgs{ - ctx: ctx, - client: &client, - dut: dut, - ate: ate, - top: top, - } - - if tt.vrfPolicy { - configureVrfSelectionPolicyW(t, dut) - } - tcArgs.testIPv4BackUpSwitch(t) - }) - } + // Flush past entries before running the tc + client.FlushAll(t) + + t.Run("IPv4BackUpSwitch", func(t *testing.T) { + t.Logf("Name: IPv4BackUpSwitch") + t.Logf("Description: Set primary and backup path with gribi and shutdown the primary path validating traffic switching over backup path") + + tcArgs := &testArgs{ + ctx: ctx, + client: &client, + dut: dut, + ate: ate, + top: top, + } + + tcArgs.testIPv4BackUpSwitch(t) + }) + + t.Run("IPv4BackUpSwitchWithVrfPolicyW", func(t *testing.T) { + t.Logf("Name: IPv4BackUpSwitchWithVrfPolicyW") + t.Logf("Description: Set primary and backup path with gribi and shutdown the primary path validating traffic switching over backup path with vrf policy W") + + tcArgs := &testArgs{ + ctx: ctx, + client: &client, + dut: dut, + ate: ate, + top: top, + } + + vrfpolicy.ConfigureVRFSelectionPolicyW(t, dut) + tcArgs.testIPv4BackUpSwitch(t) + }) } // testIPv4BackUpSwitch Ensure that backup NHGs are honoured with NextHopGroup entries containing >1 NH @@ -523,28 +517,3 @@ func (a *testArgs) aftCheck(t testing.TB, prefix string, instance string) { t.Fatalf("Prefix %s references a NHG that has neither NH or backup NHG", prefix) } } - -func configureVrfSelectionPolicyW(t *testing.T, dut *ondatra.DUTDevice) { - p1 := dut.Port(t, "port1") - gnmi.Delete(t, dut, gnmi.OC().NetworkInstance(vrf1).Interface(p1.Name()).Config()) - t.Log("Delete existing vrf selection policy and Apply vrf selectioin policy W") - gnmi.Delete(t, dut, gnmi.OC().NetworkInstance(deviations.DefaultNetworkInstance(dut)).PolicyForwarding().Config()) - - interfaceID := p1.Name() - if deviations.InterfaceRefInterfaceIDFormat(dut) { - interfaceID = interfaceID + ".0" - } - - niP := vrfpolicy.BuildVRFSelectionPolicyW(t, dut, deviations.DefaultNetworkInstance(dut)) - dutPolFwdPath := gnmi.OC().NetworkInstance(deviations.DefaultNetworkInstance(dut)).PolicyForwarding() - gnmi.Replace(t, dut, dutPolFwdPath.Config(), niP) - - intf := niP.GetOrCreateInterface(interfaceID) - intf.ApplyVrfSelectionPolicy = ygot.String(vrfPolW) - intf.GetOrCreateInterfaceRef().Interface = ygot.String(p1.Name()) - intf.GetOrCreateInterfaceRef().Subinterface = ygot.Uint32(0) - if deviations.InterfaceRefConfigUnsupported(dut) { - intf.InterfaceRef = nil - } - gnmi.Replace(t, dut, dutPolFwdPath.Interface(interfaceID).Config(), intf) -} diff --git a/feature/gribi/otg_tests/base_hierarchical_nhg_update/README.md b/feature/gribi/otg_tests/base_hierarchical_nhg_update/README.md index 0599873d933..6cb9726073e 100644 --- a/feature/gribi/otg_tests/base_hierarchical_nhg_update/README.md +++ b/feature/gribi/otg_tests/base_hierarchical_nhg_update/README.md @@ -13,37 +13,35 @@ Validate NHG update in hierarchical resolution scenario * Use Modify RPC to install entries per the following order, and ensure FIB ACK is received for each of the AFTOperation: * Add 203.0.113.1/32 (default VRF) to NextHopGroup (NHG#42 in default VRF) - containing one NextHop (NH#40 in default VRF) that specifies DUT port-2 as + containing one NextHop (NH#40 in default VRF) that specifies DUT port-2 + as the egress interface and 00:1A:11:00:1A:BC as the destination MAC + address. + * Add 198.51.100.0/24 (VRF-1) to NextHopGroup (NHG#44 in default VRF) + containing one NextHop (NH#43 in default VRF) specified to be + 203.0.113.1/32 in the default VRF. +* Ensure that ATE port-2 receives the packets with 00:1A:11:00:1A:BC as the + destination MAC address. +* Use the Modify RPC with ADD operation to test NHG implicit in-place replace + (step by step as below): + 1. Add a new NH (NH#41) with egress interface that specifies DUT port-3 as the egress interface and 00:1A:11:00:1A:BC as the destination MAC address. - * Add 198.51.100.0/24 (VRF-1) to NextHopGroup (NHG#44 in default VRF) containing one - NextHop (NH#43 in default VRF) specified to be 203.0.113.1/32 in the default VRF. -* Ensure that ATE port-2 receives the packets with 00:1A:11:00:1A:BC as - the destination MAC address. -* Use the Modify RPC with ADD operation to test NHG implicit in-place - replace (step by step as below): - 1. Add a new NH (NH#41) with egress interface that specifies DUT port-3 as the - egress interface and 00:1A:11:00:1A:BC as the destination MAC address. - 2. Add the same NHG#42 but reference both NH#40 and NH#41. - 3. Validate that both ATE port-2 and ATE port-3 receives the packets with 00:1A:11:00:1A:BC as the destination MAC address. - 4. Add the same NHG#42 but reference only NH#41. - 5. Validate that only ATE port-3 receives the packets. - 6. Add the same NHG#42 but reference only NH#40. - 7. Validate that only ATE port-2 receives the packets + 2. Add the same NHG#42 but reference both NH#40 and NH#41. + 3. Validate that both ATE port-2 and ATE port-3 receives the packets with + 00:1A:11:00:1A:BC as the destination MAC address. + 4. Add the same NHG#42 but reference only NH#41. + 5. Validate that only ATE port-3 receives the packets. + 6. Add the same NHG#42 but reference only NH#40. + 7. Validate that only ATE port-2 receives the packets Repeat the above tests with one additional scenario with the following changes, and it should not change the expected test result. * Add an empty decap VRF, `DECAP_TE_VRF`. -* Add 4 empty encap VRFs, `ENCAP_TE_VRF_A`, `ENCAP_TE_VRF_B`, - `ENCAP_TE_VRF_C`, and `ENCAP_TE_VRF_D`. -* Add 2 empty transit VRFs, `TE_VRF_111` and `TE_VRF_222`. -* Program route 198.51.100.1/32 through gribi in `TE_VRF_111` instead of - `VRF-1`. +* Add 4 empty encap VRFs, `ENCAP_TE_VRF_A`, `ENCAP_TE_VRF_B`, `ENCAP_TE_VRF_C` + and `ENCAP_TE_VRF_D`. * Replace the existing VRF selection policy with `vrf_selection_policy_w` as - in . -* Send IP-In-IP traffic with source IP to ipv4_outer_src_111 - (`198.51.100.111`) and DSCP to dscp_encap_a_1(10). + in ## Config Parameter coverage @@ -118,23 +116,33 @@ Validate NHG update in Drain Implementation Test. * Steps: * Topology -* [ATE port-1] — [port-1 DUT port-2] — [port-2 ATE] - Port-3]—-[port-3 ATE] - Port-4]—-[port-4 ATE] -* DUT port-2, port-3 and port-4 are each making a one-member trunk port (trunk-2 and trunk-3, trunk-4). + * [ATE port-1] — [port-1 DUT port-2] — [port-2 ATE] Port-3]—-[port-3 ATE] + Port-4]—-[port-4 ATE] +* DUT port-2, port-3 and port-4 are each making a one-member trunk port + (trunk-2 and trunk-3, trunk-4). * Configure a destination network-a connected to trunk-2, trunk-3 and trunk-4. -* gRIBI installs the following routing structure (700 IPv4 prefix, NHG and NH numbers stays the same as the illustration), and expect FIB ACKs: -* In the DEFAULT VRF: - VIP1 -> NHG#1 -> [NH#1 {mac: MagicMAC, interface: DUTPort2Trunk}, NH#2 {mac: MagicMAC, interface: DUTPort3Trunk}] - NHG#10 -> NH#10 {decap, network-instance: DEFAULT VRF} - NHG#20 -> [ NH#20{ip: VIP1}, backupNH: NHG#10] - -* In a non-defualt VRF, VRF-1: - IPv4Entries(1000 /32 IPv4 entries) -> NHG#20 - -* Send 10K IPinIP traffic flows from ATE port-1 to network-a. -* Validate that traffic is going via trunk-2 and trunk-3 and there is no traffic loss. -* Send one gRIBI NHG#1 update to replace NH#1 and NH#2 with NH#3 pointing to trunk#4. -* Expect FIB ACKs, and validate that all traffic are moved to trunk#4 with no traffic loss. -* Send one gRIBI NHG#1 update to revert back the changes above. -* Expect FIB ACKs and validate that the traffic is moved back to trunk-2 and trunk-3 with less than ms traffic loss. +* gRIBI installs the following routing structure (700 IPv4 prefix, NHG and NH + numbers stays the same as the illustration), and expect FIB ACKs: +* In the DEFAULT VRF: VIP1 -> NHG#1 -> [NH#1 {mac: MagicMAC, interface: + DUTPort2Trunk}, NH#2 {mac: MagicMAC, interface: DUTPort3Trunk}] NHG#10 -> + NH#10 {decap, network-instance: DEFAULT VRF} NHG#20 -> [ NH#20{ip: VIP1}, + backupNH: NHG#10] + +* In a non-defualt VRF, VRF-1: IPv4Entries(1000 /32 IPv4 entries) -> NHG#20 + +* Send 10K IPinIP traffic flows from ATE port-1 to network-a. + +* Validate that traffic is going via trunk-2 and trunk-3 and there is no + traffic loss. + +* Send one gRIBI NHG#1 update to replace NH#1 and NH#2 with NH#3 pointing to + trunk#4. + +* Expect FIB ACKs, and validate that all traffic are moved to trunk#4 with no + traffic loss. + +* Send one gRIBI NHG#1 update to revert back the changes above. + +* Expect FIB ACKs and validate that the traffic is moved back to trunk-2 and + trunk-3 with less than ms traffic loss. + diff --git a/feature/gribi/otg_tests/base_hierarchical_nhg_update/base_hierarchical_nhg_update_test.go b/feature/gribi/otg_tests/base_hierarchical_nhg_update/base_hierarchical_nhg_update_test.go index fde852f4890..8dfa9a82ed6 100644 --- a/feature/gribi/otg_tests/base_hierarchical_nhg_update/base_hierarchical_nhg_update_test.go +++ b/feature/gribi/otg_tests/base_hierarchical_nhg_update/base_hierarchical_nhg_update_test.go @@ -275,36 +275,12 @@ func TestBaseHierarchicalNHGUpdate(t *testing.T) { }() } -func configureVrfSelectionPolicyW(t *testing.T, dut *ondatra.DUTDevice) { - t.Log("Delete existing vrf selection policy and Apply vrf selectioin policy W") - gnmi.Delete(t, dut, gnmi.OC().NetworkInstance(deviations.DefaultNetworkInstance(dut)).PolicyForwarding().Config()) - - p1 := dut.Port(t, "port1") - interfaceID := p1.Name() - if deviations.InterfaceRefInterfaceIDFormat(dut) { - interfaceID = interfaceID + ".0" - } - - niP := vrfpolicy.BuildVRFSelectionPolicyW(t, dut, deviations.DefaultNetworkInstance(dut)) - dutPolFwdPath := gnmi.OC().NetworkInstance(deviations.DefaultNetworkInstance(dut)).PolicyForwarding() - gnmi.Replace(t, dut, dutPolFwdPath.Config(), niP) - - intf := niP.GetOrCreateInterface(interfaceID) - intf.ApplyVrfSelectionPolicy = ygot.String(vrfPolW) - intf.GetOrCreateInterfaceRef().Interface = ygot.String(p1.Name()) - intf.GetOrCreateInterfaceRef().Subinterface = ygot.Uint32(0) - if deviations.InterfaceRefConfigUnsupported(dut) { - intf.InterfaceRef = nil - } - gnmi.Replace(t, dut, dutPolFwdPath.Interface(interfaceID).Config(), intf) -} - type transitKey struct{} // testBaseHierarchialNHGwithVrfPolW verifies recursive IPv4 Entry for // 198.51.100.0/24 (a) with vrf selection w func testBaseHierarchialNHGwithVrfPolW(ctx context.Context, t *testing.T, args *testArgs) { - configureVrfSelectionPolicyW(t, args.dut) + vrfpolicy.ConfigureVRFSelectionPolicyW(t, args.dut) ctx = context.WithValue(ctx, transitKey{}, true) testBaseHierarchialNHG(ctx, t, args) diff --git a/internal/vrfpolicy/vrfpolicy.go b/internal/vrfpolicy/vrfpolicy.go index e5a0399a5eb..2c35c500671 100644 --- a/internal/vrfpolicy/vrfpolicy.go +++ b/internal/vrfpolicy/vrfpolicy.go @@ -18,6 +18,7 @@ package vrfpolicy import ( "testing" + "github.com/openconfig/featureprofiles/internal/deviations" "github.com/openconfig/ondatra" "github.com/openconfig/ondatra/gnmi" "github.com/openconfig/ondatra/gnmi/oc" @@ -174,3 +175,30 @@ func BuildVRFSelectionPolicyW(t *testing.T, dut *ondatra.DUTDevice, niName strin return niP } + +// ConfigureVRFSelectionPolicyW configures vrf selection policy W on default NI and applies to DUT port1 +func ConfigureVRFSelectionPolicyW(t *testing.T, dut *ondatra.DUTDevice) { + t.Helper() + + t.Log("Delete existing vrf selection policy and Apply vrf selectioin policy W") + gnmi.Delete(t, dut, gnmi.OC().NetworkInstance(deviations.DefaultNetworkInstance(dut)).PolicyForwarding().Config()) + + port1 := dut.Port(t, "port1") + interfaceID := port1.Name() + if deviations.InterfaceRefInterfaceIDFormat(dut) { + interfaceID = interfaceID + ".0" + } + + niForwarding := BuildVRFSelectionPolicyW(t, dut, deviations.DefaultNetworkInstance(dut)) + dutForwardingPath := gnmi.OC().NetworkInstance(deviations.DefaultNetworkInstance(dut)).PolicyForwarding() + gnmi.Replace(t, dut, dutForwardingPath.Config(), niForwarding) + + interface1 := niForwarding.GetOrCreateInterface(interfaceID) + interface1.ApplyVrfSelectionPolicy = ygot.String(vrfPolW) + interface1.GetOrCreateInterfaceRef().Interface = ygot.String(port1.Name()) + interface1.GetOrCreateInterfaceRef().Subinterface = ygot.Uint32(0) + if deviations.InterfaceRefConfigUnsupported(dut) { + interface1.InterfaceRef = nil + } + gnmi.Replace(t, dut, dutForwardingPath.Interface(interfaceID).Config(), interface1) +}