grpc_rpc_statistics_bounding - openconfig/featureprofiles GitHub Wiki
Verify that DUT gRPC servers (gRIBI and P4RT) strictly bound per-RPC
authorization telemetry state entries under wildcard and explicit allowlist
gNSI.authz policies without creating persistent YANG state entries for
unvalidated or non-existent HTTP/2 :path strings, and validate gRPC/P4RT
negative error-path hygiene and AAA session cleanup.
- Input arguments:
-
test_infra_id: the SPIFFE ID used by test infrastructure clients.
-
- Configure the DUT so that
gNMI,gNOI,gNSI,gRIBI, andP4RTgRPC services are enabled and use mTLS (transport-security = true,certificate-id = "server-mtls-cert",listen-addresses = ["ANY"]) under/system/grpc-servers/grpc-server:-
gribi-server:services = ["GRIBI"],port = 9340,enable = true -
p4rt-server:services = ["P4RT"],port = 9559,enable = true
-
- Configure P4RT on an integrated-circuit component (
node-id = 100) using/components/component/integrated-circuit/config/node-idand configure a P4RT port ID (id = 20) on a DUT interface using/interfaces/interface/config/id. - Generate two mTLS client certificates (SVIDs) signed by the test CA bundle:
-
cert_conformance_client:spiffe://test-abc.foo.bar/xyz/conformance-probe -
cert_denied_client:spiffe://test-abc.foo.bar/xyz/deny-all
-
- Policy evaluation precedence parameters:
-
deny_rulesare evaluated first, followed byallow_rules, and finally default implicit deny (PERMISSION_DENIED). - At no evaluation stage may an unvalidated, unimplemented, or unauthorized
HTTP/2
:pathstring create a persistent per-RPC state entry under/system/grpc-servers/grpc-server/authz-policy-counters/rpcs/rpc.
-
- Step 1 - Record initial policy and rotate baseline
gNSI.authzpolicy: Record the initial authorization policy on the DUT usinggNSI.authz.v1.Authz.Get(if present), then push and finalizepolicy-grpc-rpc-statistics-bounding(version = "policy-grpc-rpc-statistics-bounding-v1",created_on = 100) usinggNSI.authz.v1.Authz.Rotate:
{
"name": "policy-grpc-rpc-statistics-bounding",
"allow_rules": [
{
"name": "allow-test-infra",
"source": {
"principals": [
"<test_infra_id>"
]
},
"request": {
"paths": [
"/*"
]
}
},
{
"name": "allow-gribi-wildcard",
"source": {
"principals": [
"spiffe://test-abc.foo.bar/xyz/conformance-probe"
]
},
"request": {
"paths": [
"/gribi.gRIBI/*"
]
}
},
{
"name": "allow-p4rt-explicit-methods",
"source": {
"principals": [
"spiffe://test-abc.foo.bar/xyz/conformance-probe"
]
},
"request": {
"paths": [
"/p4.v1.P4Runtime/Write",
"/p4.v1.P4Runtime/Read",
"/p4.v1.P4Runtime/SetForwardingPipelineConfig",
"/p4.v1.P4Runtime/GetForwardingPipelineConfig",
"/p4.v1.P4Runtime/StreamChannel",
"/p4.v1.P4Runtime/Capabilities"
]
}
}
],
"deny_rules": [
{
"name": "deny-explicit-prober",
"source": {
"principals": [
"spiffe://test-abc.foo.bar/xyz/deny-all"
]
},
"request": {
"paths": [
"/*"
]
}
}
]
}- Step 2 - Establish baseline
gRIBIandP4RTsessions: Usingcert_conformance_client, invokegribi.gRIBI.Getongribi-server(port9340), establishP4Runtime.StreamChannelmastership (device_id = 100,election_id = 100) onp4rt-server(port9559), push the WBBP4Infopipeline viaP4Runtime.SetForwardingPipelineConfig, and invokeP4Runtime.CapabilitiesandP4Runtime.Read. - Step 3 - Validation with pass/fail criteria: Validate policy activation and
baseline per-RPC counters using
gNMI.Subscribe(ON_CHANGE/SAMPLE) andgNMI.Get:- Verify
/system/aaa/authorization/state/grpc-authz-policy-version=="policy-grpc-rpc-statistics-bounding-v1" - Verify
/system/aaa/authorization/state/grpc-authz-policy-created-on==100 - Verify
/system/grpc-servers/grpc-server[name=gribi-server]/state/enable==trueand/system/grpc-servers/grpc-server[name=gribi-server]/state/port==9340 - Verify
/system/grpc-servers/grpc-server[name=p4rt-server]/state/enable==trueand/system/grpc-servers/grpc-server[name=p4rt-server]/state/port==9559 - Verify
/system/grpc-servers/grpc-server[name=gribi-server]/authz-policy-counters/rpcs/rpc[name=/gribi.gRIBI/Get]/state/access-accepts>=1 - Verify
/system/grpc-servers/grpc-server[name=p4rt-server]/authz-policy-counters/rpcs/rpc[name=/p4.v1.P4Runtime/Read]/state/access-accepts>=1 - Record the baseline set of registered RPC names under
/system/grpc-servers/grpc-server/authz-policy-counters/rpcs/rpc/state/name.
- Verify
Ensure that explicit deny rules, unsupported compression encodings, malformed
P4RT requests, and unfinalized policy rotations are properly rejected without
leaking AAA sessions or corrupting DUT state.
-
Negative Test 1 (Explicit Deny Rule Precedence): Using
cert_denied_client(spiffe://test-abc.foo.bar/xyz/deny-all), invoke registered RPCs/gribi.gRIBI/Getand/p4.v1.P4Runtime/Read. Verify both calls fail withPERMISSION_DENIED(7) and increment/system/grpc-servers/grpc-server/authz-policy-counters/rpcs/rpc/state/access-rejectson their respective registered RPC entries. -
Negative Test 2 (Unsupported gRPC Encoding and Error-Path AAA Session
Cleanup): Using
cert_conformance_client, send150sequentialgribi.gRIBI.Getrequests across new gRPC connections with an unsupported compression header (grpc-encoding: invalid-codec) to exceed the128concurrent AAA session threshold. Verify each request is rejected withUNIMPLEMENTED(12) rather thanOK, and verify that a subsequent validgribi.gRIBI.GetandP4Runtime.Capabilitiesrequest on the 151st connection succeeds withOK(0) rather than failing withRESOURCE_EXHAUSTED(8) due to leaked AAA sessions. -
Negative Test 3 (Malformed P4RT StreamChannel and Invalid Read Entity):
Using
cert_conformance_client, send aP4Runtime.StreamChannelStreamMessageRequestwith an emptyupdateoneof field and aP4Runtime.Readrequest referencing a non-existenttable_id = 0xFFFFFFFF. Verify both requests are rejected withINVALID_ARGUMENT(3) (orNOT_FOUND(5) for the unknown table ID) rather thanOK. -
Negative Test 4 (Unfinalized gNSI Authz Rotate Rollback): Open a
gNSI.authz.v1.Authz.Rotatestream, send anUploadRequestwithversion = "policy-unfinalized-rollback-v2", and close the stream without sendingFinalizeRequest. Verify viagNSI.authz.v1.Authz.GetandgNMI.Geton/system/aaa/authorization/state/grpc-authz-policy-versionthat the active policy rolls back to"policy-grpc-rpc-statistics-bounding-v1".
- Step 1 - Close test streams, restore initial authorization policy, and revert
configurations: Close the
P4Runtime.StreamChannelsession, restore the initialgNSI.authzpolicy recorded during setup usinggNSI.authz.v1.Authz.Rotate, and revert the P4RTnode-id, interfaceid, andgrpc-serversconfigurations to their pre-test states. - Step 2 - Validation with pass/fail criteria:
- Verify via
gNSI.authz.v1.Authz.GetandgNMI.Geton/system/aaa/authorization/state/grpc-authz-policy-versionthat the pre-test authorization policy version and content are restored, and that the DUT is restored to its baseline operational state.
- Verify via
{
"components": {
"component": [
{
"config": {
"name": "ic0"
},
"integrated-circuit": {
"config": {
"node-id": "100"
}
},
"name": "ic0"
}
]
},
"interfaces": {
"interface": [
{
"config": {
"enabled": true,
"id": 20,
"name": "port-1",
"type": "iana-if-type:ethernetCsmacd"
},
"name": "port-1"
}
]
},
"system": {
"grpc-servers": {
"grpc-server": [
{
"config": {
"certificate-id": "server-mtls-cert",
"enable": true,
"listen-addresses": [
"ANY"
],
"name": "gribi-server",
"port": 9340,
"services": [
"openconfig-system-grpc:GRIBI"
],
"transport-security": true
},
"name": "gribi-server"
},
{
"config": {
"certificate-id": "server-mtls-cert",
"enable": true,
"listen-addresses": [
"ANY"
],
"name": "p4rt-server",
"port": 9559,
"services": [
"openconfig-system-grpc:P4RT"
],
"transport-security": true
},
"name": "p4rt-server"
}
]
}
}
}The below yaml defines the OC paths intended to be covered by this test. OC paths used for test setup are not listed here.
paths:
## Config paths
/components/component/integrated-circuit/config/node-id:
platform_type: ["INTEGRATED_CIRCUIT"]
/interfaces/interface/config/id:
/system/grpc-servers/grpc-server/config/name:
/system/grpc-servers/grpc-server/config/enable:
/system/grpc-servers/grpc-server/config/port:
/system/grpc-servers/grpc-server/config/services:
/system/grpc-servers/grpc-server/config/transport-security:
/system/grpc-servers/grpc-server/config/certificate-id:
/system/grpc-servers/grpc-server/config/listen-addresses:
## State paths
/system/aaa/authorization/state/grpc-authz-policy-version:
/system/aaa/authorization/state/grpc-authz-policy-created-on:
/system/grpc-servers/grpc-server/state/name:
/system/grpc-servers/grpc-server/state/enable:
/system/grpc-servers/grpc-server/state/port:
/system/grpc-servers/grpc-server/authz-policy-counters/rpcs/rpc/state/name:
/system/grpc-servers/grpc-server/authz-policy-counters/rpcs/rpc/state/access-accepts:
/system/grpc-servers/grpc-server/authz-policy-counters/rpcs/rpc/state/access-rejects:
/system/grpc-servers/grpc-server/authz-policy-counters/rpcs/rpc/state/last-access-accept:
/system/grpc-servers/grpc-server/authz-policy-counters/rpcs/rpc/state/last-access-reject:
rpcs:
gnmi:
gNMI.Get:
gNMI.Set:
replace: true
gNMI.Subscribe:
on_change: true
gnsi:
authz.v1.Authz.Rotate:
authz.v1.Authz.Get:
authz.v1.Authz.Probe:
gribi:
gRIBI.Get:
# P4Runtime RPCs (github.com/p4lang/p4runtime; commented out as validate_readme_spec only clones github.com/openconfig/<api>.git):
# p4runtime:
# p4.v1.P4Runtime.StreamChannel:
# p4.v1.P4Runtime.SetForwardingPipelineConfig:
# p4.v1.P4Runtime.GetForwardingPipelineConfig:
# p4.v1.P4Runtime.Capabilities:
# p4.v1.P4Runtime.Write:
# p4.v1.P4Runtime.Read:- FFF