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

System-1: added p4rt capabilities deviation and fixed gnmi call #2605

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
19 changes: 19 additions & 0 deletions feature/system/tests/system_base_test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,22 @@ used for mTLS.
2. Each test will then create a client to those services and valid each service is properly
listening on the standard port.
3. Validate client properly connects and execute a simple RPC to validate no errors are returned.

## OpenConfig Path and RPC Coverage

```yaml
paths:
/system/state/motd-banner:
/system/state/login-banner:
/system/state/hostname:
/system/state/current-datetime:
/system/state/boot-time:
/system/clock/state/timezone-name:

rpcs:
gnmi:
gNMI.Set:
replace: true
delete: true
gNMI.Subscribe:
```
35 changes: 32 additions & 3 deletions feature/system/tests/system_base_test/g_protocol_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"testing"
"time"

"github.com/openconfig/featureprofiles/internal/deviations"
"github.com/openconfig/ondatra"
"github.com/openconfig/ondatra/binding/introspect"
"google.golang.org/grpc"
Expand Down Expand Up @@ -58,7 +59,22 @@ func TestGNMIClient(t *testing.T) {
dut := ondatra.DUT(t, "dut")
conn := dialConn(t, dut, introspect.GNMI, 9339)
c := gpb.NewGNMIClient(conn)
if _, err := c.Get(context.Background(), &gpb.GetRequest{Encoding: gpb.Encoding_JSON_IETF, Path: []*gpb.Path{{Elem: []*gpb.PathElem{}}}}); err != nil {

var req *gpb.GetRequest
Swetha-haridasula marked this conversation as resolved.
Show resolved Hide resolved
if deviations.GNMIGetOnRootUnsupported(dut) {
req = &gpb.GetRequest{
Path: []*gpb.Path{{
Elem: []*gpb.PathElem{
{Name: "system"}, {Name: "state"}, {Name: "hostname"}}},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we add a check for type config and operational as well here if it is supported

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kindly also add check for type config and operational here as per definition 'https://github.com/openconfig/reference/blob/master/rpc/gnmi/gnmi-specification.md#331-the-getrequest-message'

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kjahed - Awaiting your response on this one; We need to know if in default state we have support for "Config", "State" and "Operational".
You have responded for "Config" and "State", what about "Operational".
Can you close on this comment?

},
Type: gpb.GetRequest_STATE,
Encoding: gpb.Encoding_JSON_IETF,
}
} else {
req = &gpb.GetRequest{Encoding: gpb.Encoding_JSON_IETF, Path: []*gpb.Path{{Elem: []*gpb.PathElem{}}}}
}

if _, err := c.Get(context.Background(), req); err != nil {
t.Fatalf("gnmi.Get failed: %v", err)
}
}
Expand Down Expand Up @@ -105,7 +121,20 @@ func TestP4RTClient(t *testing.T) {
dut := ondatra.DUT(t, "dut")
conn := dialConn(t, dut, introspect.P4RT, 9559)
c := p4rtpb.NewP4RuntimeClient(conn)
if _, err := c.Capabilities(context.Background(), &p4rtpb.CapabilitiesRequest{}); err != nil {
t.Fatalf("p4rt.Capabilites failed: %v", err)
if deviations.P4RTCapabilitiesUnsupported(dut) {
dplore marked this conversation as resolved.
Show resolved Hide resolved
if _, err := c.Read(context.Background(), &p4rtpb.ReadRequest{
DeviceId: 1,
Entities: []*p4rtpb.Entity{
{
Entity: &p4rtpb.Entity_TableEntry{},
},
},
}); err != nil {
t.Fatalf("p4rt.Read failed: %v", err)
}
} else {
if _, err := c.Capabilities(context.Background(), &p4rtpb.CapabilitiesRequest{}); err != nil {
t.Fatalf("p4rt.Capabilites failed: %v", err)
}
}
}
9 changes: 9 additions & 0 deletions feature/system/tests/system_base_test/metadata.textproto
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,12 @@ platform_exceptions: {
cli_takes_precedence_over_oc: true
}
}
platform_exceptions: {
platform: {
vendor: CISCO
}
deviations: {
p4rt_capabilities_unsupported: true
gnmi_get_on_root_unsupported: true
}
}
10 changes: 10 additions & 0 deletions internal/deviations/deviations.go
Original file line number Diff line number Diff line change
Expand Up @@ -1258,3 +1258,13 @@ func IsisDisSysidUnsupported(dut *ondatra.DUTDevice) bool {
func IsisDatabaseOverloadsUnsupported(dut *ondatra.DUTDevice) bool {
return lookupDUTDeviations(dut).GetIsisDatabaseOverloadsUnsupported()
}

// P4RTCapabilitiesUnsupported returns true for devices that don't support P4RT Capabilities rpc.
func P4RTCapabilitiesUnsupported(dut *ondatra.DUTDevice) bool {
return lookupDUTDeviations(dut).GetP4RtCapabilitiesUnsupported()
}

// GNMIGetOnRootUnsupported returns true if the device does not support gNMI get on root.
func GNMIGetOnRootUnsupported(dut *ondatra.DUTDevice) bool {
return lookupDUTDeviations(dut).GetGnmiGetOnRootUnsupported()
}
6 changes: 6 additions & 0 deletions proto/metadata.proto
Original file line number Diff line number Diff line change
Expand Up @@ -664,6 +664,12 @@ message Metadata {
bool isis_dis_sysid_unsupported = 239;
// Cisco: b/378616912
bool isis_database_overloads_unsupported = 240;
// Device does not support P4RT Capabilities rpc.
// Cisco: b/385298158
bool p4rt_capabilities_unsupported = 241;
// Device does not support gNMI GET on root.
Swetha-haridasula marked this conversation as resolved.
Show resolved Hide resolved
// Cisco: b/385298159
bool gnmi_get_on_root_unsupported = 242;
// Reserved field numbers and identifiers.
reserved 84, 9, 28, 20, 90, 97, 55, 89, 19, 36, 35, 40, 173;
}
Expand Down
Loading
Loading