Skip to content

Commit

Permalink
Merge branch 'main' into certz4
Browse files Browse the repository at this point in the history
  • Loading branch information
lvaish05 authored Feb 1, 2025
2 parents 11cb32a + d0cfaae commit beffe47
Show file tree
Hide file tree
Showing 10 changed files with 946 additions and 58 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
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 beffe47

Please sign in to comment.