Skip to content

Commit

Permalink
gNMI-1.10-Add support for GetAll gnmi requests (#3801)
Browse files Browse the repository at this point in the history
* gNMI-1.10-Add support for GetAll gnmi requests

Support added to check the following paths

 - /interfaces/interface[name=*]/state/
 - /interfaces/interface[name=*]/ethernet/
 - /components/component[name=*]/transceiver/

* Update telemetry_basic_check_test.go

* Update README.md

* Update README.md

* Update README.md

* Update README.md

---------

Co-authored-by: Swetha-haridasula <haridasula@google.com>
  • Loading branch information
AmrNJ and Swetha-haridasula authored Feb 13, 2025
1 parent 0e79595 commit 4d6df34
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 4 deletions.
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

0 comments on commit 4d6df34

Please sign in to comment.