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

gNMI-1.10-Add support for GetAll gnmi requests #3801

Merged
merged 7 commits into from
Feb 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
23 changes: 19 additions & 4 deletions feature/gnmi/otg_tests/telemetry_basic_check_test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,21 @@ following features:
* Ethernet interface

* Check the telemetry port-speed exists with correct speed.
* /interfaces/interfaces/interface/ethernet/state/port-speed
* Check the telemetry mac-address with correct format.
* /interfaces/interfaces/interface/ethernet/state/mac-address
* Check if the telemetry get all path exists and returns correct responses for mac address and port-speed
* /interfaces/interface/ethernet/state/port-speed
* /interfaces/interface/ethernet/state/mac-address


* Interface status

* Check admin-status and oper-status exist and correct.
* /interfaces/interfaces/interface/state/admin-status
* /interfaces/interfaces/interface/state/oper-status
* Check if the telemetry get all path exists and returns correct responses for admin-status, admin-status and last-change
* /interfaces/interface/state/


* Interface physical channel

* Check interface physical-channel exists.
Expand Down Expand Up @@ -68,6 +72,10 @@ following features:
* Check the following component paths exists
* /components/component/integrated-circuit/state/node-id
* /components/component/state/parent

* Check if the telemetry get all path exists and returns correct responses for transceiver state
* /components/component/state/transceiver/state


* CPU component state

Expand Down Expand Up @@ -125,6 +133,8 @@ paths:

## State Paths ##
/interfaces/interface/state/admin-status:
/interfaces/interface/state/oper-status:
/interfaces/interface/state/last-change:
/lacp/interfaces/interface/members/member/state/interface:
/lacp/interfaces/interface/members/member/state/counters/lacp-in-pkts:
/lacp/interfaces/interface/members/member/state/counters/lacp-out-pkts:
Expand All @@ -135,10 +145,9 @@ paths:
/lacp/interfaces/interface/members/member/state/partner-key:
/lacp/interfaces/interface/members/member/state/partner-port-num:
/interfaces/interface/ethernet/state/mac-address:
/interfaces/interface/ethernet/state/port-speed:
/interfaces/interface/state/hardware-port:
/interfaces/interface/state/id:
/interfaces/interface/state/oper-status:
/interfaces/interface/ethernet/state/port-speed:
/interfaces/interface/state/physical-channel:
/components/component/integrated-circuit/state/node-id:
platform_type: [ "INTEGRATED_CIRCUIT" ]
Expand All @@ -150,6 +159,12 @@ paths:
"POWER_SUPPLY",
"INTEGRATED_CIRCUIT"
]
/components/component/transceiver/state/form-factor:
platform_type: [ "TRANSCEIVER" ]
/components/component/transceiver/state/serial-no:
platform_type: [ "TRANSCEIVER" ]
/components/component/transceiver/state/present:
platform_type: [ "TRANSCEIVER" ]
/interfaces/interface/state/counters/in-octets:
/interfaces/interface/state/counters/in-unicast-pkts:
/interfaces/interface/state/counters/in-broadcast-pkts:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,20 @@ func TestEthernetMacAddress(t *testing.T) {
}
}

func TestEthernetWildcard(t *testing.T) {
t.Helper()
dut := ondatra.DUT(t, "dut")
portsSpeeds := gnmi.LookupAll(t, dut, gnmi.OC().InterfaceAny().Ethernet().PortSpeed().State())
// Iterate over the retrieved port speeds.
for _, portSpeed := range portsSpeeds {
t.Logf("Ethernet path and speed: %v", portSpeed)
}
macAddresses := gnmi.LookupAll(t, dut, gnmi.OC().InterfaceAny().Ethernet().MacAddress().State())
for _, macAddress := range macAddresses {
t.Logf("Ethernet path and MacAddress: %v", macAddress)
}
}

func TestInterfaceAdminStatus(t *testing.T) {
dut := ondatra.DUT(t, "dut")
dp := dut.Port(t, "port1")
Expand Down Expand Up @@ -358,6 +372,14 @@ func TestQoSCounters(t *testing.T) {
}
}

func TestInterfaceWildcard(t *testing.T) {
dut := ondatra.DUT(t, "dut")
interfaceStates := gnmi.GetAll(t, dut, gnmi.OC().InterfaceAny().State())
for _, intf := range interfaceStates {
t.Logf("Interface Name: %v, Interface AdminStatus: %v, Interface OperStatus: %v, Last change: %v", intf.GetName(), intf.GetAdminStatus(), intf.GetOperStatus(), intf.GetLastChange())
}
}

func findComponentsListByType(t *testing.T, dut *ondatra.DUTDevice) map[string][]string {
t.Helper()
componentType := map[string]oc.E_PlatformTypes_OPENCONFIG_HARDWARE_COMPONENT{
Expand Down Expand Up @@ -467,6 +489,19 @@ func TestComponentParent(t *testing.T) {
}
}

func TestComponentTransceiverWildcard(t *testing.T) {
dut := ondatra.DUT(t, "dut")
transceivers := gnmi.GetAll(t, dut, gnmi.OC().ComponentAny().Transceiver().State())
for _, tcv := range transceivers {
if tcv.GetPresent() == oc.Transceiver_Present_PRESENT {
t.Logf("Serial Number: %s, Transceiver Form Factor: %v", tcv.GetSerialNo(), tcv.GetFormFactor())
}
if tcv.GetPresent() != oc.Transceiver_Present_PRESENT {
t.Logf("Transceiver Not Present : %v", tcv)
}
}
}

func TestSoftwareVersion(t *testing.T) {
dut := ondatra.DUT(t, "dut")

Expand Down
Loading