Skip to content

Commit

Permalink
Split TE backup NHG action into DCGate and POPGate tests (openconfig#…
Browse files Browse the repository at this point in the history
  • Loading branch information
self-maurya authored Feb 26, 2024
1 parent e314365 commit 2b6def9
Show file tree
Hide file tree
Showing 7 changed files with 753 additions and 49 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,6 @@ Different test scenarios requires different setups.
traffic with decapsulated traffic with destination IP as `InnerDstIP_1`
at ATE port-4.
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 <https://github.com/openconfig/featureprofiles/pull/2217>
## Config Parameter coverage
No new configuration covered.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,33 +21,32 @@ import (
"time"

"github.com/open-traffic-generator/snappi/gosnappi"
"github.com/openconfig/gribigo/fluent"
"github.com/openconfig/ondatra"
"github.com/openconfig/ondatra/gnmi"
"github.com/openconfig/ondatra/gnmi/oc"
"github.com/openconfig/ygot/ygot"

"github.com/openconfig/featureprofiles/internal/attrs"
"github.com/openconfig/featureprofiles/internal/deviations"
"github.com/openconfig/featureprofiles/internal/fptest"
"github.com/openconfig/featureprofiles/internal/gribi"
"github.com/openconfig/featureprofiles/internal/otgutils"
"github.com/openconfig/featureprofiles/internal/vrfpolicy"
"github.com/openconfig/gribigo/client"
"github.com/openconfig/gribigo/fluent"
"github.com/openconfig/ondatra"
"github.com/openconfig/ondatra/gnmi"
"github.com/openconfig/ondatra/gnmi/oc"
"github.com/openconfig/ygot/ygot"
)

const (
ipv4PrefixLen = 30
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"
innerSrcIP1 = "198.18.0.255"
vip1 = "198.18.1.1"
vip2 = "198.18.1.2"
vrfA = "TE_VRF_111"
vrfA = "VRF-A"
vrfB = "VRF-B"
vrfC = "VRF-C"
nh1ID = 1
Expand All @@ -64,7 +63,7 @@ const (
nhg103ID = 103
nh104ID = 104
nhg104ID = 104
baseSrcFlowFilter = "0x0f" // hexadecimal value of last 5 bits of src 198.51.100.111
baseSrcFlowFilter = "0x02" // hexadecimal value of last 5 bits of src 198.51.100.2
baseDstFlowFilter = "0x18" // hexadecimal value of first 5 bits of dst 198.51.100.1
encapSrcFlowFilter = "0x02" // hexadecimal value of last 5 bits of src 203.0.113.2
encapDstFlowFilter = "0x19" // hexadecimal value of first 5 bits of dst 203.0.113.1
Expand All @@ -75,8 +74,6 @@ const (
ipOverIPProtocol = 4
srcTrackingName = "ipSrcTracking"
dstTrackingName = "ipDstTracking"
decapFlowSrc = "198.51.100.111"
dscpEncapA1 = 10
)

// testArgs holds the objects needed by a test case.
Expand Down Expand Up @@ -278,21 +275,11 @@ func TestBackupNHGAction(t *testing.T) {
desc: "Usecase with 2 NHOP Groups - Backup Pointing to Decap",
fn: testBackupDecap,
},
{
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",
fn: testDecapEncapWithVrfPolW,
},
}
// Configure the gRIBI client
client := gribi.Client{
Expand Down Expand Up @@ -492,22 +479,6 @@ func testDecapEncap(ctx context.Context, t *testing.T, args *testArgs) {
})
}

func testBackupDecapWithVrfPolW(ctx context.Context, t *testing.T, args *testArgs) {
if deviations.SkipPbfWithDecapEncapVrf(args.dut) {
t.Skip("Skipping test as PBF with decap encap vrf is not supported")
}
vrfpolicy.ConfigureVRFSelectionPolicyW(t, args.dut)
testBackupDecap(ctx, t, args)
}

func testDecapEncapWithVrfPolW(ctx context.Context, t *testing.T, args *testArgs) {
if deviations.SkipPbfWithDecapEncapVrf(args.dut) {
t.Skip("Skipping test as PBF with decap encap vrf is not supported")
}
vrfpolicy.ConfigureVRFSelectionPolicyW(t, args.dut)
testDecapEncap(ctx, t, args)
}

// createFlow returns a flow name from atePort1 to the dstPfx.
func createFlow(t *testing.T, ate *ondatra.ATEDevice, top gosnappi.Config, name string, dst *attrs.Attributes) gosnappi.Flow {
flow := gosnappi.NewFlow().SetName(name)
Expand All @@ -516,9 +487,8 @@ func createFlow(t *testing.T, ate *ondatra.ATEDevice, top gosnappi.Config, name
ethHeader := flow.Packet().Add().Ethernet()
ethHeader.Src().SetValue(atePort1.MAC)
outerIPHeader := flow.Packet().Add().Ipv4()
outerIPHeader.Src().SetValue(decapFlowSrc)
outerIPHeader.Src().SetValue(outerSrcIP1)
outerIPHeader.Dst().Increment().SetStart(outerDstIP1).SetCount(1)
outerIPHeader.Priority().Dscp().Phb().SetValues([]uint32{dscpEncapA1})
innerIPHeader := flow.Packet().Add().Ipv4()
innerIPHeader.Src().SetValue(innerSrcIP1)
innerIPHeader.Dst().Increment().SetStart(innerDstIP1).SetCount(1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ platform_exceptions: {
explicit_interface_in_default_vrf: true
static_protocol_name: "static"
interface_enabled: true
skip_pbf_with_decap_encap_vrf: true
}
}
platform_exceptions: {
Expand All @@ -37,3 +36,4 @@ platform_exceptions: {
default_network_instance: "default"
}
}
tags: TAGS_TRANSIT
115 changes: 115 additions & 0 deletions feature/experimental/gribi/otg_tests/backup_nhg_action_pbf/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
# TE-11.31: Backup NHG: Actions with PBF

## Summary

Validate gRIBI Backup NHG actions with PBF.

## Topology

* Connect ATE port-1 to DUT port-1, ATE port-2 to DUT port-2, ATE port-3 to
DUT port-3, and ATE port-4 to DUT port-4.
* Create a 3 non-default VRF:
* `VRF-A` that includes DUT port-1.
* `VRF-B` that includes no interface.
* `VRF-C` that includes no interface.
* `OuterDstIP_1`, `OuterSrcIP_1`, `OuterDstIP_2`, `OuterSrcIP_2`: IPinIP outer
IP addresses.
* `InnerDstIP_1`, `InnerSrcIP_1`: IPinIP inner IP addresses.
* `VIP_1`, `VIP_2`: IP addresses used for recursive resolution.
* `ATEPort2IP`: testbed assigned interface IP to ATE port 2
* `ATEPort3IP`: testbed assigned interface IP to ATE port 3
* All the NHG and NH objects injected by gRIBI are in the DEFAULT VRF.
* 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 <https://github.com/openconfig/featureprofiles/pull/2217>

## Setups

Different test scenarios requires different setups.

* Setup#1

* Make sure DUT port-2, port-3 and port-4 are up.
* Make sure there is a static route in the default VRF for `InnerDstIP_1`,
pointing to ATE port-4.
* Connect a gRIBI client to DUT with session parameters
`{persistence=PRESERVE Redundancy=SINGLE_PRIMARY}`
* gRIBI Flush the DUT.
* Inject the following gRIBI structure to the DTU:

```text
VIP_1/32 {DEFAULT VRF} --> NHG#1 --> NH#1 {next-hop: ATEPort2IP}
NHG#100 --> NH#100 {decap, network-instance:DEFAULT}
NHG#101 --> [NH#101 {next-hop: VIP1}, backupNHG: NHG#100]
OuterDstIP_1/32 {VRF-A} --> NHG#101
```
* Setup#2
* Make sure DUT port-2, port-3 and port-4 are up.
* Make sure there is a static route in the default VRF for `InnerDstIP_1`,
pointing to ATE port-4.
* Connect a gRIBI client to DUT with session parameters
`{persistence=PRESERVE Redundancy=SINGLE_PRIMARY}`
* gRIBI Flush the DUT.
* Inject the following gRIBI structure to the DTU:
```text
VIP_1/32 {DEFAULT VRF} --> NHG#1 --> NH#1 {next-hop: ATEPort2IP}
VIP_2/32 {DEFAULT VRF} --> NHG#2 --> NH#2 {next-hop: ATEPort3IP}
NHG#100 --> NH#100 {network-instance:VRF-B}
NHG#101 --> [NH#101 {next-hop: VIP1}, backupNHG: NHG#100]
OuterDstIP_1/32 {VRF-A} --> NHG#101
NHG#103 --> NH#103 {decap, network-instance:DEFAULT}
NHG#102 --> [NH#102 {decap-encap, src:`OuterSrcIP_2`, dst:`OuterDstIP_2`, network-instance: VRF-C}, backupNHG: NHG#103]
OuterDstIP_1/32 {VRF-B} --> NHG#102
NHG#104 --> [NH#104 {next-hop: VIP-2}, backupNHG: NHG#103]
OuterDstIP_2/32 {VRF-C} --> NHG#104
```
## Procedure
* TEST#1 - (next-hop viability triggers decap in backup NHG):
1. Deploy Setup#1 as above.
2. Send IPinIP traffic to `OuterDstIP_1` with inner IP as `InnerDstIP_1`,
and validate that ATE port-2 receives the IPinIP traffic.
* Shutdown DUT port-2 interface, and validate that ATE port-4 receives the
decapsulated traffic with `InnerDstIP_1`.
* Test#2 - (tunnel viability triggers decap and encap in the backup NHG):
* Deploy Setup#2 as above.
* Send IPinIP traffic to `OuterDstIP_1`. Validate that ATE port-2 receives
the IPinIP traffic with outer IP as `OuterDstIP_1`.
* Shutdown DUT port-2 interface, and validate that ATE port-3 receives the
IPinIP traffic with outer destination IP as `OuterDstIP_2`, and outer
source IP as `OuterSrcIP_2`
* Shutdown DUT port-3 interface, and validate that ATE port-4 receives the
traffic with decapsulated traffic with destination IP as `InnerDstIP_1`
at ATE port-4.
## Config Parameter coverage
No new configuration covered.
## Telemetry Parameter coverage
No new telemetry covered.
## Protocol/RPC Parameter coverage
## Minimum DUT platform requirement
vRX if the vendor implementation supports FIB-ACK simulation, otherwise FFF.
Loading

0 comments on commit 2b6def9

Please sign in to comment.