From 3c810f3b1168e74de473d0d0592151cfbffd27b5 Mon Sep 17 00:00:00 2001 From: sallylsy <108024270+sallylsy@users.noreply.github.com> Date: Thu, 30 May 2024 16:09:52 -0700 Subject: [PATCH] Support gNPSI in OpenConfig (#1085) * (M) release/models/gnpsi/openconfig-gnpsi-types.yang * (M) release/models/grpc/openconfig-grpc-types.yang * (M) release/models/system/openconfig-system-grpc.yang * Add gRPC connections and statistics in OpenConfig * Add gNPSI as a gRPC service type --------- Co-authored-by: Darren Loher --- release/models/gnpsi/.spec.yml | 6 + .../models/gnpsi/openconfig-gnpsi-types.yang | 38 +++++++ release/models/grpc/.spec.yml | 6 + .../models/grpc/openconfig-grpc-types.yang | 36 ++++++ .../models/system/openconfig-system-grpc.yang | 103 +++++++++++++++++- 5 files changed, 188 insertions(+), 1 deletion(-) create mode 100644 release/models/gnpsi/.spec.yml create mode 100644 release/models/gnpsi/openconfig-gnpsi-types.yang create mode 100644 release/models/grpc/.spec.yml create mode 100644 release/models/grpc/openconfig-grpc-types.yang diff --git a/release/models/gnpsi/.spec.yml b/release/models/gnpsi/.spec.yml new file mode 100644 index 000000000..a38191a7f --- /dev/null +++ b/release/models/gnpsi/.spec.yml @@ -0,0 +1,6 @@ +- name: openconfig-gnpsi + docs: + - yang/gnpsi/openconfig-gnpsi-types.yang + build: + - yang/gnpsi/openconfig-gnpsi-types.yang + run-ci: false diff --git a/release/models/gnpsi/openconfig-gnpsi-types.yang b/release/models/gnpsi/openconfig-gnpsi-types.yang new file mode 100644 index 000000000..ef241b635 --- /dev/null +++ b/release/models/gnpsi/openconfig-gnpsi-types.yang @@ -0,0 +1,38 @@ +module openconfig-gnpsi-types { + yang-version "1"; + namespace "http://openconfig.net/yang/gnpsi/types"; + prefix "oc-gnpsit"; + + import openconfig-extensions { + prefix oc-ext; + } + + import openconfig-grpc-types { + prefix oc-grpct; + } + + organization + "OpenConfig working group"; + contact + "www.openconfig.net"; + + description + "This module adds gRPC server type relating to gNPSI running on + a network device."; + + oc-ext:openconfig-version "0.1.0"; + oc-ext:catalog-organization "openconfig"; + oc-ext:origin "openconfig"; + + revision 2024-05-29 { + description + "Initial revision."; + reference "0.1.0"; + } + + identity GNPSI { + base oc-grpct:GRPC_SERVICE; + description + "gNMI: gRPC Network Management Interface"; + } +} diff --git a/release/models/grpc/.spec.yml b/release/models/grpc/.spec.yml new file mode 100644 index 000000000..5e9761d03 --- /dev/null +++ b/release/models/grpc/.spec.yml @@ -0,0 +1,6 @@ +- name: openconfig-grpc + docs: + - yang/grpc/openconfig-grpc-types.yang + build: + - yang/grpc/openconfig-grpc-types.yang + run-ci: false diff --git a/release/models/grpc/openconfig-grpc-types.yang b/release/models/grpc/openconfig-grpc-types.yang new file mode 100644 index 000000000..d9944070b --- /dev/null +++ b/release/models/grpc/openconfig-grpc-types.yang @@ -0,0 +1,36 @@ +module openconfig-grpc-types { + yang-version "1"; + namespace "http://openconfig.net/yang/grpc/types"; + prefix "oc-grpct"; + + import openconfig-extensions { + prefix oc-ext; + } + + organization + "OpenConfig working group"; + contact + "www.openconfig.net"; + + description + "This module adds gRPC server type relating to gRPC services running on + a network device. + The GRPC_SERVICE identity is used to create an extensible list of services + that can be instantiated, with a base set defined in this module. New + services can extend the identity to be included in the list."; + + oc-ext:openconfig-version "0.1.0"; + oc-ext:catalog-organization "openconfig"; + oc-ext:origin "openconfig"; + + revision "2024-05-29" { + description + "Initial revision."; + reference "0.1.0"; + } + + identity GRPC_SERVICE { + description + "Base identity for a gRPC-based service."; + } +} diff --git a/release/models/system/openconfig-system-grpc.yang b/release/models/system/openconfig-system-grpc.yang index fb16870a2..6560806c1 100644 --- a/release/models/system/openconfig-system-grpc.yang +++ b/release/models/system/openconfig-system-grpc.yang @@ -8,6 +8,7 @@ module openconfig-system-grpc { import openconfig-system { prefix oc-sys; } import openconfig-inet-types { prefix oc-inet; } import openconfig-network-instance { prefix oc-ni; } + import openconfig-yang-types { prefix oc-yang; } organization "OpenConfig working group"; @@ -22,10 +23,16 @@ module openconfig-system-grpc { to be included in the list."; - oc-ext:openconfig-version "1.0.0"; + oc-ext:openconfig-version "1.1.0"; oc-ext:catalog-organization "openconfig"; oc-ext:origin "openconfig"; + revision "2024-05-29" { + description + "Add support for gRPC connections."; + reference "1.1.0"; + } + revision "2022-04-19" { description "Description and default value updates for grpc-server @@ -97,6 +104,7 @@ module openconfig-system-grpc { "Operational state relating to the gRPC service."; uses grpc-server-config; } + uses connections-top; } } } @@ -200,6 +208,99 @@ module openconfig-system-grpc { } } + grouping grpc-counters { + description + "Top-level container for gRPC counters."; + container counters { + description + "Operational data for gRPC counters."; + uses grpc-counters-top; + } + } + + grouping grpc-counters-top { + description + "Top-level container of operational data for gRPC counters."; + + leaf bytes-sent { + type oc-yang:counter64; + description + "The total number of bytes sent to the client."; + } + + leaf packets-sent { + type oc-yang:counter64; + description + "The total number of packets sent to the client."; + } + + leaf data-send-error { + type oc-yang:counter64; + description + "A count of errors the gRPC server encountered when + sending data to a grpc client."; + } + } + + grouping grpc-server-connections-state { + description + "Operational data for gRPC server connections."; + + leaf address { + type oc-inet:ip-address; + description + "IPv4/IPv6 address of the gRPC server connection."; + } + + leaf port { + type oc-inet:port-number; + description + "TCP/UDP port number for the gRPC server connection."; + } + } + + grouping connections-top { + description + "Top-level grouping for data related to gRPC connections."; + + container connections { + config false; + description + "Enclosing container for list of gRPC connections."; + + list connection { + key "address port"; + description + "List of gRPC connections"; + + leaf address { + type leafref { + path "../state/address"; + } + description + "Reference to address list key."; + } + + leaf port { + type leafref { + path "../state/port"; + } + description + "Reference to port list key."; + } + + container state { + config false; + description + "Operational state data for gRPC connections."; + + uses grpc-server-connections-state; + uses grpc-counters; + } + } + } + } + augment "/oc-sys:system" { description "Add gRPC service configuration to the openconfig-system model.";