Skip to content

Commit

Permalink
Merge branch 'main' into RT-1.14
Browse files Browse the repository at this point in the history
  • Loading branch information
lvaish05 authored Feb 1, 2025
2 parents 0d17a34 + d0cfaae commit c984747
Show file tree
Hide file tree
Showing 24 changed files with 1,195 additions and 167 deletions.
50 changes: 17 additions & 33 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ The directory tree is organized as follows:
routers in containers on [KNE](https://github.com/openconfig/kne)
* `feature/` contains definition and tests of feature profiles.
* `internal/` contains packages used by feature profile tests.
* `internal/cfgplugins` contains packages used to generate device configuration.
* `proto/` contains protobuf files for feature profiles.
* `tools/` contains code used for CI checks.
* `topologies/` contains the testbed topology definitions.
Expand Down Expand Up @@ -135,49 +136,26 @@ For example:
* `feature/interface/singleton/otg_tests/singleton_test/rundata_test.go`
contains the rundata.

## Code Should Follow The Test Plan
## Code Should Follow The Test README

The test plan in `README.md` is generally structured like this:

```
# RT-5.1: Singleton Interface
## Summary
...
## Procedure
1. Step 1
2. Step 2
3. ...
## Config Parameter Coverage
* /interfaces/interface/config/name
* /interfaces/interface/config/description
* ...
## Telemetry Parameter Coverage
* /interfaces/interface/state/oper-status
* /interfaces/interface/state/admin-status
* ...
```
The test `README.md` should be structured following the
[test plan template]([url](https://github.com/openconfig/featureprofiles/blob/main/doc/test-requirements-template.md)).

Each step in the test plan procedure should correspond to a comment or `t.Log`
in the code. Steps not covered by code should have a TODO.
in the code. Steps not covered by code should have a TODO comment in the test
code.

In the PR, please mention any corrections made to the test plan for errors that
In the PR, please mention any corrections made to the test README for errors that
were discovered when implementing the code.

## Test Structure

Generally, a Feature Profiles ONDATRA test has the following stages: configure
DUT, configure OTG, generate and verify traffic, verify telemetry. The
configuration stages should be factored out to their own functions, and any
subtests should be run under `t.Run` so the test output clearly reflects which
parts of the test passed and which parts failed.
configuration generation code should be factored out to their own functions and
placed in the `/internal/cfgplugins` folder. Subtests should be run under `t.Run`
so the test output clearly reflects which parts of the test passed and which parts
failed.

They typically just report the error using `t.Error()` for checks. This way, the
error message is accurately attributed to the line of code where the error
Expand Down Expand Up @@ -292,6 +270,12 @@ Do not write [assertion] helpers.

[assertion]: https://go.dev/doc/faq#assertions

## Use gnmi.Watch with Await instead of sleep in tests

Avoid using time.Sleep to wait for a change to occur in a test. Instead use
gnmi.Watch with .Await in an appropriate validation function call. See the
[ONDATRA best practice on avoiding use of sleep in tests](https://pkg.go.dev/github.com/openconfig/ondatra/gnmi#hdr-Best_Practice__Avoid_time_Sleep).

## Enum

Sometimes a test may need to set a ygot field with an OpenConfig enum type, e.g.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,6 @@ func configureISIS(t *testing.T, ts *isissession.TestSession) {
globalIsis.GetOrCreateAf(oc.IsisTypes_AFI_TYPE_IPV6, oc.IsisTypes_SAFI_TYPE_UNICAST).Enabled = ygot.Bool(true)
globalIsis.LevelCapability = oc.Isis_LevelType_LEVEL_2
globalIsis.GetOrCreateTimers().LspLifetimeInterval = ygot.Uint16(lspLifetime)
if deviations.ISISLspLifetimeIntervalRequiresLspRefreshInterval(ts.DUT) {
globalIsis.GetOrCreateTimers().LspRefreshInterval = ygot.Uint16(60)
}
}

// configureOTG configures isis and traffic on OTG.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ platform_exceptions: {
interface_enabled: true
default_network_instance: "default"
isis_interface_afi_unsupported: true
isis_lsp_lifetime_interval_requires_lsp_refresh_interval: true
isis_lsp_metadata_leafs_unsupported: true
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ platform_exceptions: {
missing_value_for_defaults: true
interface_enabled: true
default_network_instance: "default"
isis_lsp_lifetime_interval_requires_lsp_refresh_interval: true
isis_timers_csnp_interval_unsupported: true
isis_counter_manual_address_drop_from_areas_unsupported: true
isis_counter_part_changes_unsupported: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ platform_exceptions: {
interface_enabled: true
default_network_instance: "default"
isis_interface_afi_unsupported: true
isis_lsp_lifetime_interval_requires_lsp_refresh_interval: true
isis_timers_csnp_interval_unsupported: true
isis_counter_manual_address_drop_from_areas_unsupported: true
isis_counter_part_changes_unsupported: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ platform_exceptions: {
interface_enabled: true
default_network_instance: "default"
isis_interface_afi_unsupported: true
isis_lsp_lifetime_interval_requires_lsp_refresh_interval: true
isis_timers_csnp_interval_unsupported: true
isis_counter_manual_address_drop_from_areas_unsupported: true
isis_counter_part_changes_unsupported: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ platform_exceptions: {
missing_value_for_defaults: true
interface_enabled: true
default_network_instance: "default"
isis_lsp_lifetime_interval_requires_lsp_refresh_interval: true
isis_timers_csnp_interval_unsupported: true
isis_counter_manual_address_drop_from_areas_unsupported: true
isis_counter_part_changes_unsupported: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,11 @@ const (
v6Flow = "v6Flow"
trafficDuration = 30 * time.Second
prefixMatch = "exact"
v4tagSet = "tag-set-v4"
v4RoutePolicy = "route-policy-v4"
v4Statement = "statement-v4"
v4PrefixSet = "prefix-set-v4"
v6tagSet = "tag-set-v6"
v6RoutePolicy = "route-policy-v6"
v6Statement = "statement-v6"
v6PrefixSet = "prefix-set-v6"
Expand Down Expand Up @@ -234,7 +236,6 @@ func configureRoutePolicy(dut *ondatra.DUTDevice, rplName string, statement stri
if err != nil {
return nil, err
}
v4tagSet := getTagSetName(dut, rplName, v4Statement, "v4")
tagSet1 := rp.GetOrCreateDefinedSets().GetOrCreateTagSet(v4tagSet)
tagSet1.SetTagValue([]oc.RoutingPolicy_DefinedSets_TagSet_TagValue_Union{oc.UnionUint32(V4tagValue)})
stmt1.GetOrCreateConditions().GetOrCreateMatchTagSet().SetTagSet(v4tagSet)
Expand All @@ -244,7 +245,6 @@ func configureRoutePolicy(dut *ondatra.DUTDevice, rplName string, statement stri
if err != nil {
return nil, err
}
v6tagSet := getTagSetName(dut, rplName, v6Statement, "v6")
tagSet2 := rp.GetOrCreateDefinedSets().GetOrCreateTagSet(v6tagSet)
tagSet2.SetTagValue([]oc.RoutingPolicy_DefinedSets_TagSet_TagValue_Union{oc.UnionUint32(V6tagValue)})
stmt2.GetOrCreateConditions().GetOrCreateMatchTagSet().SetTagSet(v6tagSet)
Expand Down Expand Up @@ -367,13 +367,6 @@ func verifyRplConfig(t *testing.T, dut *ondatra.DUTDevice, tagSetName string, ta
}
}

func getTagSetName(dut *ondatra.DUTDevice, policyName, stmtName, afStr string) string {
if deviations.RoutingPolicyTagSetEmbedded(dut) {
return fmt.Sprintf("%s %s", policyName, stmtName)
}
return fmt.Sprintf("tag-set-%s", afStr)
}

func TestStaticToISISRedistribution(t *testing.T) {
var ts *isissession.TestSession

Expand Down Expand Up @@ -506,8 +499,8 @@ func TestStaticToISISRedistribution(t *testing.T) {

if tc.TagSetCondition {
t.Run("Verify Configuration for RPL TagSet", func(t *testing.T) {
verifyRplConfig(t, ts.DUT, getTagSetName(ts.DUT, tc.RplName, v4Statement, "v4"), oc.UnionUint32(V4tagValue))
verifyRplConfig(t, ts.DUT, getTagSetName(ts.DUT, tc.RplName, v6Statement, "v6"), oc.UnionUint32(V6tagValue))
verifyRplConfig(t, ts.DUT, v4tagSet, oc.UnionUint32(V4tagValue))
verifyRplConfig(t, ts.DUT, v6tagSet, oc.UnionUint32(V6tagValue))
})
}

Expand Down
25 changes: 25 additions & 0 deletions feature/mpls/otg_tests/label_block/metadata.textproto
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# proto-file: github.com/openconfig/featureprofiles/proto/metadata.proto
# proto-message: Metadata

uuid: "a506db0a-cea0-4047-8b65-8cdc15aa9405"
plan_id: "MPLS-1.1"
description: "MPLS label blocks using ISIS"
testbed: TESTBED_DUT_ATE_2LINKS

platform_exceptions: {
platform: {
vendor: ARISTA
}
deviations: {
interface_enabled: true
default_network_instance: "default"
isis_counter_manual_address_drop_from_areas_unsupported: true
isis_counter_part_changes_unsupported: true
isis_instance_enabled_required: true
isis_interface_afi_unsupported: true
isis_metric_style_telemetry_unsupported: true
isis_timers_csnp_interval_unsupported: true
missing_isis_interface_afi_safi_enable: true
}
}

Loading

0 comments on commit c984747

Please sign in to comment.