Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OTG Test Update - RT 6.1 - LLDP neighbor verification change #1887

Open
wants to merge 107 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
Show all changes
107 commits
Select commit Hold shift + click to select a range
73a4759
verifying state not config of the lldp neighbours
octpetre Jul 14, 2023
9f1a2df
Merge branch 'main' into lldp_verification_changes
octpetre Jul 14, 2023
ced594f
Merge branch 'main' into lldp_verification_changes
octpetre Jul 17, 2023
d308e34
Merge branch 'main' into lldp_verification_changes
octpetre Jul 19, 2023
0c62e78
Merge branch 'main' into lldp_verification_changes
octpetre Jul 19, 2023
cf5a286
Merge branch 'main' into lldp_verification_changes
octpetre Jul 21, 2023
ed0326c
Merge branch 'main' into lldp_verification_changes
octpetre Jul 21, 2023
3b9043b
Merge branch 'openconfig:main' into lldp_verification_changes
octpetre Jul 24, 2023
fc35c0f
Merge branch 'openconfig:main' into lldp_verification_changes
octpetre Jul 25, 2023
f791da9
Added portId and portIdType verification
octpetre Jul 25, 2023
7caf3fb
Merge branch 'main' into lldp_verification_changes
octpetre Jul 27, 2023
bb816c2
Merge branch 'main' into lldp_verification_changes
octpetre Aug 8, 2023
a59a086
Merge branch 'main' into lldp_verification_changes
octpetre Aug 11, 2023
ccc9fa7
Merge branch 'main' into lldp_verification_changes
octpetre Aug 16, 2023
5bba382
Merge branch 'main' into lldp_verification_changes
octpetre Aug 17, 2023
85d75a4
Merge branch 'main' into lldp_verification_changes
octpetre Aug 18, 2023
be31d50
Merge branch 'main' into lldp_verification_changes
octpetre Aug 22, 2023
cbf48b6
Merge branch 'main' into lldp_verification_changes
octpetre Aug 24, 2023
81e51fa
Merge branch 'main' into lldp_verification_changes
octpetre Aug 29, 2023
b5249cc
Merge branch 'main' into lldp_verification_changes
octpetre Aug 30, 2023
ac1bbe6
Merge branch 'main' into lldp_verification_changes
octpetre Aug 31, 2023
7bdbbf3
Merge branch 'main' into lldp_verification_changes
octpetre Sep 5, 2023
ceb0f40
Merge branch 'main' into lldp_verification_changes
octpetre Sep 6, 2023
f64824e
Merge branch 'main' into lldp_verification_changes
octpetre Sep 11, 2023
286f362
Merge branch 'main' into lldp_verification_changes
octpetre Sep 12, 2023
c27c3b6
Merge branch 'main' into lldp_verification_changes
octpetre Sep 12, 2023
bd8ce37
created lldpNeighbors struct
octpetre Sep 12, 2023
ad07921
Merge branch 'main' into lldp_verification_changes
octpetre Sep 13, 2023
bd8f16e
Merge branch 'main' into lldp_verification_changes
octpetre Sep 18, 2023
adf1e93
Merge branch 'main' into lldp_verification_changes
octpetre Sep 19, 2023
7d2833e
Merge branch 'main' into lldp_verification_changes
octpetre Sep 20, 2023
a045cc2
Merge branch 'main' into lldp_verification_changes
octpetre Sep 21, 2023
4c294a4
Merge branch 'main' into lldp_verification_changes
octpetre Sep 22, 2023
6e357b6
Merge branch 'main' into lldp_verification_changes
octpetre Sep 25, 2023
b92b003
Merge branch 'main' into lldp_verification_changes
octpetre Sep 26, 2023
6d0a8e6
Merge branch 'main' into lldp_verification_changes
octpetre Sep 27, 2023
e4889ce
Merge branch 'main' into lldp_verification_changes
octpetre Oct 4, 2023
30bb4d9
Merge branch 'main' into lldp_verification_changes
octpetre Oct 5, 2023
cc96542
Merge branch 'main' into lldp_verification_changes
octpetre Oct 6, 2023
2aa4dbe
Merge branch 'openconfig:main' into lldp_verification_changes
octpetre Oct 6, 2023
26c1ce6
Merge branch 'main' into lldp_verification_changes
octpetre Oct 9, 2023
3c796ee
Merge branch 'main' into lldp_verification_changes
octpetre Oct 11, 2023
1cf6696
Merge branch 'main' into lldp_verification_changes
octpetre Oct 12, 2023
72f6567
Merge branch 'main' into lldp_verification_changes
octpetre Oct 13, 2023
1f22c79
Merge branch 'main' into lldp_verification_changes
octpetre Oct 16, 2023
6bd401b
Merge branch 'main' into lldp_verification_changes
octpetre Oct 18, 2023
66bcbd2
Merge branch 'main' into lldp_verification_changes
octpetre Oct 19, 2023
0ae7a82
Merge branch 'main' into lldp_verification_changes
octpetre Oct 23, 2023
09882d6
Merge branch 'main' into lldp_verification_changes
octpetre Oct 25, 2023
433b631
Merge branch 'main' into lldp_verification_changes
octpetre Oct 26, 2023
a7078d7
Merge branch 'main' into lldp_verification_changes
octpetre Nov 1, 2023
8c2a54c
Merge branch 'main' into lldp_verification_changes
octpetre Nov 6, 2023
b2e91eb
Merge branch 'main' into lldp_verification_changes
octpetre Nov 8, 2023
d39a798
Merge branch 'main' into lldp_verification_changes
octpetre Nov 9, 2023
12cf508
Merge branch 'main' into lldp_verification_changes
octpetre Nov 10, 2023
8d84abc
Merge branch 'main' into lldp_verification_changes
octpetre Nov 14, 2023
d49eac9
Merge branch 'main' into lldp_verification_changes
octpetre Nov 16, 2023
0dbace6
Merge branch 'main' into lldp_verification_changes
octpetre Nov 20, 2023
2f225b2
Merge branch 'main' into lldp_verification_changes
octpetre Nov 28, 2023
30c40f9
Merge branch 'main' into lldp_verification_changes
octpetre Dec 7, 2023
d09c619
Merge branch 'main' into lldp_verification_changes
octpetre Dec 14, 2023
ab3ed10
Merge branch 'main' into lldp_verification_changes
octpetre Dec 20, 2023
395ca8f
Merge branch 'main' into lldp_verification_changes
octpetre Jan 5, 2024
2b35245
Merge branch 'main' into lldp_verification_changes
octpetre Jan 9, 2024
0ad0e63
Merge branch 'main' into lldp_verification_changes
octpetre Jan 12, 2024
a154d47
Merge branch 'main' into lldp_verification_changes
octpetre Jan 17, 2024
12b8e2f
Merge branch 'main' into lldp_verification_changes
octpetre Jan 19, 2024
2f9deb7
Merge branch 'main' into lldp_verification_changes
octpetre Jan 22, 2024
e341ac6
Merge branch 'main' into lldp_verification_changes
octpetre Jan 24, 2024
bd372b2
Merge branch 'main' into lldp_verification_changes
octpetre Jan 26, 2024
aff8638
Merge branch 'main' into lldp_verification_changes
octpetre Jan 31, 2024
ea52b3d
Merge branch 'main' into lldp_verification_changes
octpetre Feb 5, 2024
6cafa73
Merge branch 'main' into lldp_verification_changes
octpetre Feb 14, 2024
bcf194b
Merge branch 'main' into lldp_verification_changes
octpetre Feb 15, 2024
a2ffc10
Merge branch 'main' into lldp_verification_changes
octpetre Feb 22, 2024
0591e7e
Merge branch 'main' into lldp_verification_changes
octpetre Feb 27, 2024
03bab01
Merge branch 'main' into lldp_verification_changes
octpetre Feb 28, 2024
623b2a1
Merge branch 'main' into lldp_verification_changes
octpetre Feb 29, 2024
dff712c
Merge branch 'main' into lldp_verification_changes
octpetre Mar 1, 2024
d46b127
Merge branch 'main' into lldp_verification_changes
octpetre Mar 4, 2024
2184405
Merge branch 'main' into lldp_verification_changes
octpetre Mar 6, 2024
bd2f44a
Merge branch 'main' into lldp_verification_changes
octpetre Mar 7, 2024
e78e623
Merge branch 'main' into lldp_verification_changes
octpetre Mar 8, 2024
62e4081
Merge branch 'main' into lldp_verification_changes
octpetre Mar 11, 2024
2d525e6
Merge branch 'main' into lldp_verification_changes
octpetre Mar 12, 2024
b2652e6
Merge branch 'main' into lldp_verification_changes
octpetre Mar 14, 2024
57ce98c
Merge branch 'main' into lldp_verification_changes
octpetre Mar 15, 2024
15f3f8b
Merge branch 'main' into lldp_verification_changes
octpetre Mar 15, 2024
60abd8e
Merge branch 'main' into lldp_verification_changes
octpetre Mar 18, 2024
01c8e5a
Merge branch 'main' into lldp_verification_changes
octpetre Mar 20, 2024
350e95f
Merge branch 'main' into lldp_verification_changes
octpetre Mar 21, 2024
48ee2f8
Merge branch 'main' into lldp_verification_changes
octpetre Mar 27, 2024
5d0c888
Merge branch 'main' into lldp_verification_changes
octpetre Mar 28, 2024
f9a6b99
Merge branch 'main' into lldp_verification_changes
octpetre Mar 28, 2024
6604d86
Merge branch 'main' into lldp_verification_changes
octpetre Apr 3, 2024
37e29ab
Merge branch 'main' into lldp_verification_changes
octpetre Apr 16, 2024
6a84d59
Merge branch 'main' into lldp_verification_changes
octpetre Apr 18, 2024
86bb195
Merge branch 'main' into lldp_verification_changes
octpetre May 31, 2024
7142e71
Merge branch 'main' into lldp_verification_changes
octpetre Jun 17, 2024
8dbbb47
Merge branch 'main' into lldp_verification_changes
octpetre Aug 5, 2024
c9a7121
Merge branch 'main' into lldp_verification_changes
octpetre Aug 13, 2024
bde4ffe
Merge branch 'main' into lldp_verification_changes
octpetre Sep 25, 2024
2457b30
Merge branch 'main' into lldp_verification_changes
octpetre Oct 22, 2024
a376368
Merge branch 'main' into lldp_verification_changes
octpetre Nov 19, 2024
b45453d
Merge branch 'main' into lldp_verification_changes
octpetre Dec 5, 2024
4d430e0
Merge branch 'main' into lldp_verification_changes
octpetre Dec 16, 2024
4a79fba
Merge branch 'openconfig:main' into lldp_verification_changes
arkajyoti-cloud Jan 20, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ import (
gpb "github.com/openconfig/gnmi/proto/gnmi"
)

type stateParams struct {
systemName string
chassisId string
chassisIdType oc.E_Lldp_ChassisIdType
}

type lldpTestParameters struct {
systemName string
macAddress string
Expand All @@ -44,10 +50,10 @@ type lldpTestParameters struct {

type lldpNeighbors struct {
systemName string
portId string
octpetre marked this conversation as resolved.
Show resolved Hide resolved
portIdType otgtelemetry.E_LldpNeighbor_PortIdType
chassisId string
chassisIdType otgtelemetry.E_LldpNeighbor_ChassisIdType
portId string
portIdType otgtelemetry.E_LldpNeighbor_PortIdType
}

const (
Expand Down Expand Up @@ -82,7 +88,7 @@ func TestLLDPEnabled(t *testing.T) {
dut, dutConf := configureDUT(t, "dut", lldpEnabled)
disableP4RTLLDP(t, dut)
dutPort := dut.Port(t, portName)
verifyNodeConfig(t, dut, dutPort, dutConf, lldpEnabled)
stateValues := verifyNodeConfig(t, dut, dutPort, dutConf, lldpEnabled)

// ATE Configuration.
t.Log("Configure ATE.")
Expand All @@ -102,11 +108,11 @@ func TestLLDPEnabled(t *testing.T) {
verifyDUTTelemetry(t, dut, dutPort, dutConf, dutPeerState)

expOtgLLDPNeighbor := lldpNeighbors{
systemName: dutConf.GetSystemName(),
portId: dutPort.Name(),
systemName: stateValues.systemName,
chassisId: strings.ToUpper(stateValues.chassisId),
chassisIdType: otgtelemetry.E_LldpNeighbor_ChassisIdType(stateValues.chassisIdType),
portId: dut.Port(t, portName).Name(),
portIdType: otgtelemetry.LldpNeighbor_PortIdType_INTERFACE_NAME,
chassisId: strings.ToUpper(dutConf.GetChassisId()),
chassisIdType: otgtelemetry.E_LldpNeighbor_ChassisIdType(dutConf.GetChassisIdType()),
}
checkOTGLLDPNeighbor(t, otg, otgConfig, expOtgLLDPNeighbor)

Expand Down Expand Up @@ -179,27 +185,21 @@ func configureATE(t *testing.T, otg *otg.OTG) gosnappi.Config {
}

// verifyNodeConfig verifies the config by comparing against the telemetry state object.
func verifyNodeConfig(t *testing.T, node gnmi.DeviceOrOpts, port *ondatra.Port, conf *oc.Lldp, lldpEnabled bool) {
func verifyNodeConfig(t *testing.T, node gnmi.DeviceOrOpts, port *ondatra.Port, conf *oc.Lldp, lldpEnabled bool) stateParams {
statePath := gnmi.OC().Lldp()
state := gnmi.Get(t, node, statePath.State())
fptest.LogQuery(t, "Node LLDP", statePath.State(), state)

if lldpEnabled != state.GetEnabled() {
t.Errorf("LLDP enabled got: %t, want: %t.", state.GetEnabled(), lldpEnabled)
}
if state.GetChassisId() != "" {
t.Logf("LLDP ChassisId got: %s", state.GetChassisId())
} else {
if state.GetChassisId() == "" {
t.Errorf("LLDP chassisID is not proper, got %s", state.GetChassisId())
}
if state.GetChassisIdType() != 0 {
t.Logf("LLDP ChassisIdType got: %s", state.GetChassisIdType())
} else {
if state.GetChassisIdType() == 0 {
t.Errorf("LLDP chassisIdType is not proper, got %s", state.GetChassisIdType())
}
if state.GetSystemName() != "" {
t.Logf("LLDP SystemName got: %s", state.GetSystemName())
} else {
if state.GetSystemName() == "" {
t.Errorf("LLDP SystemName is not proper, got %s", state.GetSystemName())
}

Expand All @@ -209,6 +209,7 @@ func verifyNodeConfig(t *testing.T, node gnmi.DeviceOrOpts, port *ondatra.Port,
if lldpEnabled && got != want {
t.Errorf("LLDP interfaces/interface/state/name = %s, want %s", got, want)
}
return stateParams{state.GetSystemName(), state.GetChassisId(), state.GetChassisIdType()}
}

// checkLLDPMetricsOTG verifies OTG side lldp Metrics values based on DUT side lldp is enabled or not
Expand All @@ -224,7 +225,8 @@ func checkLLDPMetricsOTG(t *testing.T, otg *otg.OTG, c gosnappi.Config, lldpEnab
}
framesIn, _ := gnmi.Watch(t, otg, gnmi.OTG().LldpInterface(lldp.Name()).Counters().FrameIn().State(), time.Minute, func(v *ygnmi.Value[uint64]) bool {
time.Sleep(1 * time.Second)
return v.IsPresent()
rxFrames, ok := v.Val()
return ok && rxFrames > 0
}).Await(t)
otgutils.LogLLDPMetrics(t, otg, c)
if lldpEnabled {
Expand Down Expand Up @@ -289,18 +291,17 @@ func verifyDUTTelemetry(t *testing.T, dut *ondatra.DUTDevice, nodePort *ondatra.
wantNbrState := &oc.Lldp_Interface_Neighbor{
ChassisId: &dutPeerState.chassisId,
ChassisIdType: oc.E_Lldp_ChassisIdType(dutPeerState.chassisIdType),
SystemName: &dutPeerState.systemName,
PortId: &dutPeerState.portId,
PortIdType: oc.E_Lldp_PortIdType(dutPeerState.portIdType),
SystemName: &dutPeerState.systemName,
}
confirm.State(t, wantNbrState, gotNbrState)
}

func (expLldpNeighbor *lldpNeighbors) Equal(neighbour *otgtelemetry.LldpInterface_LldpNeighborDatabase_LldpNeighbor) bool {

return neighbour.GetChassisId() == expLldpNeighbor.chassisId &&
neighbour.GetChassisIdType() == expLldpNeighbor.chassisIdType &&
neighbour.GetPortId() == expLldpNeighbor.portId &&
neighbour.GetPortIdType() == expLldpNeighbor.portIdType &&
neighbour.GetSystemName() == expLldpNeighbor.systemName
}

Expand Down
Loading