Skip to content

Commit

Permalink
RT-6.1 Fix (openconfig#3369)
Browse files Browse the repository at this point in the history
* RT-6.1 Fix

use GetOrCreate() for lldp interface configs
ref b/358044619
  • Loading branch information
MarcCharlebois authored and frasieroh committed Aug 14, 2024
1 parent 1a91907 commit 063cf04
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 54 deletions.
48 changes: 25 additions & 23 deletions feature/lldp/ate_tests/core_lldp_tlv_population_test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,29 +17,31 @@ Determine LLDP advertisement and reception operates correctly.
configuration of lldp/interfaces/interface/config/enabled (TRUE or
FALSE) on any interface.

## Config Parameter coverage

* /lldp/config/enabled
* /lldp/interfaces/interface/config/enabled

## Telemetry Parameter coverage

* /lldp/interfaces/interface/neighbors/neighbor/state/chassis-id
* /lldp/interfaces/interface/neighbors/neighbor/state/chassis-id-subtype
* /lldp/interfaces/interface/neighbors/neighbor/state/port-id
* /lldp/interfaces/interface/neighbors/neighbor/state/port-id-subtype
* /lldp/interfaces/interface/neighbors/neighbor/state/system-name
* /lldp/interfaces/interface/state/name
* /lldp/state/chassis-id
* /lldp/state/chassis-id-type
* /lldp/state/system-name

## Protocol/RPC Parameter coverage

LLDP:

* /lldp/config/enabled = true
* /lldp/interfaces/interface/config/enabled = true
## OpenConfig Path and RPC Coverage

The below yaml defines the OC paths intended to be covered by this test. OC paths used for test setup are not listed here.

```yaml
paths:
## Config Paths ##
/lldp/config/enabled:
/lldp/interfaces/interface/config/enabled:

## State Paths ##
/lldp/interfaces/interface/neighbors/neighbor/state/chassis-id:
/lldp/interfaces/interface/neighbors/neighbor/state/port-id:
/lldp/interfaces/interface/neighbors/neighbor/state/system-name:
/lldp/interfaces/interface/state/name:
/lldp/state/chassis-id:
/lldp/state/chassis-id-type:
/lldp/state/system-name:

rpcs:
gnmi:
gNMI.Get:
gNMI.Set:

```

## Minimum DUT platform requirement

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,19 +94,21 @@ func TestCoreLLDPTLVPopulation(t *testing.T) {
func configureNode(t *testing.T, name string, lldpEnabled bool) (*ondatra.DUTDevice, *oc.Lldp) {
node := ondatra.DUT(t, name)
p := node.Port(t, portName)
lldp := gnmi.OC().Lldp()
d := &oc.Root{}
lldp := d.GetOrCreateLldp()
llint := lldp.GetOrCreateInterface(p.Name())

gnmi.Replace(t, node, lldp.Enabled().Config(), lldpEnabled)
gnmi.Replace(t, node, gnmi.OC().Lldp().Enabled().Config(), lldpEnabled)

if lldpEnabled {
gnmi.Replace(t, node, lldp.Interface(p.Name()).Enabled().Config(), lldpEnabled)
gnmi.Replace(t, node, gnmi.OC().Lldp().Interface(p.Name()).Config(), llint)
}

if deviations.InterfaceEnabled(node) {
gnmi.Replace(t, node, gnmi.OC().Interface(p.Name()).Enabled().Config(), true)
}

return node, gnmi.Get(t, node, lldp.Config())
return node, gnmi.Get(t, node, gnmi.OC().Lldp().Config())
}

// verifyNodeConfig verifies the config by comparing against the telemetry state object.
Expand Down
48 changes: 25 additions & 23 deletions feature/lldp/otg_tests/core_lldp_tlv_population_test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,29 +17,31 @@ Determine LLDP advertisement and reception operates correctly.
configuration of lldp/interfaces/interface/config/enabled (TRUE or
FALSE) on any interface.

## Config Parameter coverage

* /lldp/config/enabled
* /lldp/interfaces/interface/config/enabled

## Telemetry Parameter coverage

* /lldp/interfaces/interface/neighbors/neighbor/state/chassis-id
* /lldp/interfaces/interface/neighbors/neighbor/state/chassis-id-subtype
* /lldp/interfaces/interface/neighbors/neighbor/state/port-id
* /lldp/interfaces/interface/neighbors/neighbor/state/port-id-subtype
* /lldp/interfaces/interface/neighbors/neighbor/state/system-name
* /lldp/interfaces/interface/state/name
* /lldp/state/chassis-id
* /lldp/state/chassis-id-type
* /lldp/state/system-name

## Protocol/RPC Parameter coverage

LLDP:

* /lldp/config/enabled = true
* /lldp/interfaces/interface/config/enabled = true
## OpenConfig Path and RPC Coverage

The below yaml defines the OC paths intended to be covered by this test. OC paths used for test setup are not listed here.

```yaml
paths:
## Config Paths ##
/lldp/config/enabled:
/lldp/interfaces/interface/config/enabled:

## State Paths ##
/lldp/interfaces/interface/neighbors/neighbor/state/chassis-id:
/lldp/interfaces/interface/neighbors/neighbor/state/port-id:
/lldp/interfaces/interface/neighbors/neighbor/state/system-name:
/lldp/interfaces/interface/state/name:
/lldp/state/chassis-id:
/lldp/state/chassis-id-type:
/lldp/state/system-name:

rpcs:
gnmi:
gNMI.Get:
gNMI.Set:

```

## Minimum DUT platform requirement

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,18 +138,21 @@ func TestLLDPDisabled(t *testing.T) {
func configureDUT(t *testing.T, name string, lldpEnabled bool) (*ondatra.DUTDevice, *oc.Lldp) {
node := ondatra.DUT(t, name)
p := node.Port(t, portName)
lldp := gnmi.OC().Lldp()
d := &oc.Root{}
lldp := d.GetOrCreateLldp()
llint := lldp.GetOrCreateInterface(p.Name())

gnmi.Replace(t, node, lldp.Enabled().Config(), lldpEnabled)
gnmi.Replace(t, node, gnmi.OC().Lldp().Enabled().Config(), lldpEnabled)

if lldpEnabled {
gnmi.Replace(t, node, lldp.Interface(p.Name()).Enabled().Config(), lldpEnabled)
gnmi.Replace(t, node, gnmi.OC().Lldp().Interface(p.Name()).Config(), llint)
}

if deviations.InterfaceEnabled(node) {
gnmi.Replace(t, node, gnmi.OC().Interface(p.Name()).Enabled().Config(), true)
}

return node, gnmi.Get(t, node, lldp.Config())
return node, gnmi.Get(t, node, gnmi.OC().Lldp().Config())
}

func configureATE(t *testing.T, otg *otg.OTG) gosnappi.Config {
Expand Down

0 comments on commit 063cf04

Please sign in to comment.