diff --git a/docs/Telemetry/gNMI/2 b/docs/Telemetry/gNMI/2 new file mode 100644 index 0000000..d6596a1 --- /dev/null +++ b/docs/Telemetry/gNMI/2 @@ -0,0 +1,294 @@ +# Certificate requirements for secure connections + +As per [gnmi specification](https://github.com/openconfig/reference/blob/master/rpc/gnmi/gnmi-specification.md#31-session-security-authentication-and-rpc-authorization): +!!! quote "3.1 Session Security, Authentication and RPC Authorization" + The session between the client and server MUST be encrypted using TLS - and a target or client MUST NOT fall back to unencrypted sessions. + +NX-OS only supports TLS connection on gRPC, mTLS is supported since 10.1(1). There are two certiciates used here: + +- Server certificate: Used to encrypt the gRPC connection between the client and the device (in this case, the gNMI server or target) +- Client certificate: Used to authenticate a gRPC connection + +To create any type of certificate, a certificate authority (CA) is required. If you don't have one (or you are looking for something free), follow the steps in this excelent guide by Jamie Nguyen: [OpenSSL Certificate Authority](https://jamielinux.com/docs/openssl-certificate-authority/introduction.html) + +An acurate time is important when dealing with TLS certificates. It is recommended to setup NTP in the client and servers/devices. If you see errors related to certificate not valid yet or expired it is probably that the device or the client don't have a correct time set. + +For simplicity, this tutorial uses root but other users with less priviledges can be used. + +Make sure keys and certificates are protected + +Tests for this tutorial are done using [gnmic](https://github.com/karimra/gnmic) and [pygnmi](https://pypi.org/project/pygnmi/) + +## Server certificate + +A server certificate will allow you to connect to a NX-OS device securely, without need of skipping TLS verification for TLS connections. + +!!! note "" + It is assumed that you have a valid root and intermediate CA certificates installed in your workstation. Instructions can be found at the top of this article on how to set that up + +#### Add the subjectAltName setting + +Use the intermediate/openssl.cnf file (server_cert section): + +``` +[ server_cert ] +# Extensions for server certificates (`man x509v3_config`). +basicConstraints = CA:FALSE +subjectAltName=${ENV::SAN} +nsCertType = server +nsComment = "OpenSSL Generated Server Certificate" +subjectKeyIdentifier = hash +authorityKeyIdentifier = keyid,issuer:always +keyUsage = critical, digitalSignature, keyEncipherment +extendedKeyUsage = serverAuth +``` + +The value `${ENV::SAN}` instructs openssl to look for the value of the subjectAltName in an environmental variable called _SAN_ + +#### Set the SAN variable. + +If you don't have a DNS available, you can manually add the host entry in the /etc/hosts file if you would like to use names instead of IPs. Either one works + +In this example, the device name is nx93000v-01.cisco.com and its management IP is 192.168.1.1 + +```bash +export SAN=DNS:nx9300v-01,DNS:nx9300v-01.cisco.com,IP:192.168.1.1 +``` +#### Create key and certificate + +Altough the file name is trivial, it is a best practice to use the hostname of the device or other identifier that sumarizes the purpuse of the certificate. + +!!! note + You can use the same certificate for multiple devices + Make sure to use server_cert extensions + +```bash +openssl genrsa -out intermediate/private/nx9300v-01.cisco.com.key.pem +``` +``` +openssl req -config intermediate/openssl.cnf -key intermediate/private/nx9300v-01.cisco.com.key.pem -new -sha256 -out intermediate/csr/nx9300v-01.cisco.com.csr.pem +``` + +??? example "Output" + ``` + (...) + ----- + Country Name (2 letter code) [GB]:US + State or Province Name [England]:CO + Locality Name []: + Organization Name [Alice Ltd]:Nexus + Organizational Unit Name []:Datacenter + Common Name []:nx9300v-01.cisco.com + Email Address []: + ``` + +``` +openssl ca -config intermediate/openssl.cnf -extensions server_cert -days 375 -notext -md sha256 -in intermediate/csr/nx9300v-01.cisco.com.csr.pem -out intermediate/certs/nx9300v-01.cisco.com.cert.pem +``` +#### Verify the certificate + +Check that the alternative name section is present and has the values set in the previous step + +```bash +openssl x509 -noout -text -in intermediate/certs/nx9300v-01.cisco.com.cert.pem +``` +#### Create the certificate chain + +```bash +cat intermediate/certs/nx9300v-01.cisco.com.cert.pem > intermediate/certs/nx9300v-01.cisco.com.chain.cert.pem +cat intermediate/certs/intermediate.cert.pem >> intermediate/certs/nx9300v-01.cisco.com.chain.cert.pem +cat certs/ca.cert.pem >> intermediate/certs/nx9300v-01.cisco.com.chain.cert.pem +``` +#### Export the file into the device. + +!!! note + Make sure to remember the export password + +```bash +openssl pkcs12 -export -out intermediate/certs/nx9300v-01.cisco.com.pfk -inkey intermediate/private/nx9300v-01.cisco.com.key.pem -in intermediate/certs/nx9300v-01.cisco.com.chain.cert.pem +scp intermediate/certs/nx9300v-01.cisco.com.pfk admin@192.168.1.1: +``` +#### Import the pkcs12 file + +Execute the following commands on the device. For this example, "supersecret" was used as password the step before + +```cli +nx9300v_01# configure +nx9300v_01(config)# crypto ca trustpoint server +nx9300v_01(config)# crypto ca import server pkcs12 bootflash:nx9300v-01.cisco.com.pfk supersecret +``` + +Configure grpc to use the truspoint above: +``` +nx9300v_01(config)# grpc certificate server +``` +#### Test with gnmic + +Use the certificate chain file, not the standalone certificate file. The --skip-verify option should not be needed + +``` +# gnmic -a nx9300v-01.cisco.com:50051 -u admin -p YOURPASSWORD get --path /System/name --tls-cert intermediate/certs/nx9300v-01.cisco.com.chain.cert.pem --tls-key intermediate/private/nx9300v-01.cisco.com.key.pem -e json --tls-ca intermediate/certs/ca-chain.cert.pem +``` + +??? example "Output" + + ```json + [ + { + "source": "nx9300v-01.cisco.com:50051", + "timestamp": 1657660857691587822, + "time": "2022-07-12T21:20:57.691587822Z", + "updates": [ + { + "Path": "System/name", + "values": { + "System/name": "nx9300v-01" + } + } + ] + } + ] + ``` + +#### Test with pygnmi + +!!! note + For simplicity, this example includes credentials in clear text, which is not a best practice. + +```python +# Modules +from pygnmi.client import gNMIclient +import json +# Variables +host = ('nx9300v-01.cisco.com', '50051') +paths = ['/System/name'] + +# Body +if __name__ == '__main__': + with gNMIclient(target=host, username='admin', password="YOURPASSWORD", path_cert="./ca/intermediate/certs/nx9300v-01.cisco.com.chain.cert.pem", + path_key="./ca/intermediate/private/nx9300v-01.cisco.com.key.pem", path_root="./ca/intermediate/certs/ca-chain.cert.pem") as gc: + result = gc.get(path=paths, encoding='json') + print(result) +``` + + +``` +# python get-nx.py +``` +??? example "Output" + ```json + {'notification': [{'timestamp': 1657660901108756130, 'update': [{'path': 'System/name', 'val': 'nx9300v-01'}]}]} + + ``` + +## Client certificate + +If you prefer to use a certificate and key instead of a password, you can create a client certificate that can be used to authenticate against the NX-OS device. +It is assumed that you have a valid root and intermediate CA certificates installed in your workstation. Instructions can be found at the top of this article on how to set that up + +#### Create key and certificate + +Altough the file name is trivial, it is a best practice to use the username or other identifier that sumarizes the purpuse of the certificate, csr and keys. + +!!! note + - Make sure to use usr_cert extensions + - Use the username as value for _Common Name_ and _Organizational Unit Name_ + +``` +openssl genrsa -out intermediate/private/admin.key.pem 2048 +``` + +``` +openssl req -config intermediate/openssl.cnf -key intermediate/private/admin.key.pem -new -sha256 -out intermediate/csr/admin.csr.pem +``` + +!!! example + ``` + ----- + Country Name (2 letter code) [GB]:US + State or Province Name [England]:CO + Locality Name []: + Organization Name [Alice Ltd]:Nexus + Organizational Unit Name []:admin + Common Name []:admin + Email Address []: + ``` +``` +openssl ca -config intermediate/openssl.cnf -extensions usr_cert -days 375 -notext -md sha256 -in intermediate/csr/admin.csr.pem -out intermediate/certs/admin.cert.pem +``` + +#### Create the certificate chain + +```bash +cat intermediate/certs/admin.cert.pem > intermediate/certs/admin.chain.cert.pem +cat intermediate/certs/intermediate.cert.pem >> intermediate/certs/admin.chain.cert.pem +cat certs/ca.cert.pem >> intermediate/certs/admin.chain.cert.pem +``` + +#### Import the CA certificate + +For this example, gnmi-root is used as trustpoint name but it can have any name. Use the content of the root certificate only (certs/ca.cert.pem) - no chains or intermediate certs are required + +Execute the following commands on the device: + +``` +nx9300v_01# configure +nx9300v_01(config)# crypto ca trustpoint gnmi-root +nx9300v_01(config)# crypto ca authenticate gnmi-root +input (cut & paste) CA certificate (chain) in PEM format; +end the input with a line containing only END OF INPUT : +-----BEGIN CERTIFICATE----- +(...) +-----END CERTIFICATE----- +END OF INPUT +(...) + +Do you accept this certificate? [yes/no]:yes +``` + +Configure the grpc client root certificate: +``` +nx9300v_01(config)# grpc client root certificate gnmi-root +``` + +#### Create gnmic config file + +> You might need to change the tls files path to match your environment + +> Password is not required anymore + +``` +# cat .gnmic.yaml +log-file: /tmp/gnmic.log +debug: true +tls-ca: ./intermediate/certs/ca-chain.cert.pem +targets: + 192.168.1.2:50051: + username: admin + tls-cert: ./intermediate/certs/admin.chain.cert.pem + tls-key: ./intermediate/private/admin.key.pem +``` + +#### Test with gnmic + +``` +# gnmic get --path /System/name +[ + { + "source": "192.168.1.2:50051", + "timestamp": 1663693091279809206, + "time": "2022-09-20T12:58:11.279809206-04:00", + "updates": [ + { + "Path": "System/name", + "values": { + "System/name": "nx9300v_01" + } + } + ] + } +] +# +``` + + diff --git a/docs/Telemetry/sensor-path.md b/docs/Telemetry/sensor-path.md index 7f8380d..58aa545 100644 --- a/docs/Telemetry/sensor-path.md +++ b/docs/Telemetry/sensor-path.md @@ -1,6 +1,7 @@ # Common Sensor Paths ## ARP + | Metric | Openconfig Model | Native Model | | :--- | :--- | :--- | | Admin state | | /System/arp-items/inst-items/adminSt | @@ -10,16 +11,19 @@ | Proxy ARP state | /interfaces/interface/subinterfaces/subinterface/ipv4/proxy-arp/config/mode | | ## BGP + | Metric | Openconfig Model | Native Model | | :--- | :--- | :--- | ## CAM + | Metric | Openconfig Model | Native Model | | :--- | :--- | :--- | | ACL TCAM | | /System/pltfm-items/mod-items/TcamStatsModule-list/inst-items/TcamStatsInst-list | | FIB TCAM | | /System/capacity-items/fibresutil-items | ## CDP + | Metric | Openconfig Model | Native Model | | :--- | :--- | :--- | | All CDP info | | /System/cdp-items/inst-items | @@ -41,6 +45,7 @@ | Remote device version | | /System/cdp-items/inst-items/if-items/If-list/adj-items/AdjEp-list/ver | ## CoPP + | Metric | Openconfig Model | Native Model | | :--- | :--- | :--- | | Admin state | | /System/copp-items/adminSt | @@ -50,6 +55,7 @@ | Profile | | /System/copp-items/profile-items/prof | ## gRPC + | Metric | Openconfig Model | Native Model | | :--- | :--- | :--- | | Listening port | | /System/grpc-items/port | @@ -58,26 +64,15 @@ | Minimum sample interval (seconds) | | /System/grpc-items/gnmi-items/minSampleInterval | ## Interface + +### Interface - Common + | Metric | Openconfig Model | Native Model | | :--- | :--- | :--- | -| Interface counters | /interfaces/interface/state/counters | /System/intf-items/phys-items/PhysIf-list/dbgEtherStats-items | | Admin status | /interfaces/interface/state/admin-status | /System/intf-items/phys-items/PhysIf-list/adminSt | | Operational status | /interfaces/interface/state/oper-status | | | Interface descriptions | /interfaces/interface/state/description | | | Interface names | /interfaces/interface/state/name | | -| Ingress octet rate (300 second avg) | | /System/intf-items/phys-items/PhysIf-list/dbgIfIn-items/octetRate | -| Egress octet rate (300 second avg) | | /System/intf-items/phys-items/PhysIf-list/dbgIfOut-items/octetRate | -| Ingress packets discarded | /interfaces/interface/state/counters/in-discards | | -| Egress packets discarded | /interfaces/interface/state/counters/out-discards | | -| Ingress broadcast packets | /interfaces/interface/state/counters/in-broadcast-pkts | | -| Ingress multicast packets | /interfaces/interface/state/counters/in-multicast-pkts | | -| Ingress unicast packets | /interfaces/interface/state/counters/in-unicast-pkts | | -| Egress broadcast packets | /interfaces/interface/state/counters/out-broadcast-pkts | | -| Egress multicast packets | /interfaces/interface/state/counters/out-multicast-pkts | | -| Egress unicast packets | /interfaces/interface/state/counters/out-unicast-pkts | | -| Ingress errors | /interfaces/interface/state/counters/in-errors | | -| Interface status | /interfaces/interface/state/oper-status | | -| Egress errors | /interfaces/interface/state/counters/out-errors | | | Default layer | | /System/ethpm-items/inst-items/systemDefaultLayer | | Default admin state | | /System/ethpm-items/inst-items/systemDefaultAdminSt | | System jumbo MTU size (bytes) | | /System/ethpm-items/inst-items/systemJumboMtu | @@ -93,6 +88,25 @@ | Auto negotiation status | | /System/intf-items/phys-items/PhysIf-list/autoNeg | | Beacon status | | /System/intf-items/phys-items/PhysIf-list/beacon | | Bandwidth parameter | | /System/intf-items/phys-items/PhysIf-list/bw | + +### Interface - Counters + +| Metric | Openconfig Model | Native Model | +| :--- | :--- | :--- | +| Interface counters | /interfaces/interface/state/counters | /System/intf-items/phys-items/PhysIf-list/dbgEtherStats-items | +| Ingress octet rate (300 second avg) | | /System/intf-items/phys-items/PhysIf-list/dbgIfIn-items/octetRate | +| Egress octet rate (300 second avg) | | /System/intf-items/phys-items/PhysIf-list/dbgIfOut-items/octetRate | +| Ingress packets discarded | /interfaces/interface/state/counters/in-discards | | +| Egress packets discarded | /interfaces/interface/state/counters/out-discards | | +| Ingress broadcast packets | /interfaces/interface/state/counters/in-broadcast-pkts | | +| Ingress multicast packets | /interfaces/interface/state/counters/in-multicast-pkts | | +| Ingress unicast packets | /interfaces/interface/state/counters/in-unicast-pkts | | +| Egress broadcast packets | /interfaces/interface/state/counters/out-broadcast-pkts | | +| Egress multicast packets | /interfaces/interface/state/counters/out-multicast-pkts | | +| Egress unicast packets | /interfaces/interface/state/counters/out-unicast-pkts | | +| Ingress errors | /interfaces/interface/state/counters/in-errors | | +| Interface status | /interfaces/interface/state/oper-status | | +| Egress errors | /interfaces/interface/state/counters/out-errors | | | Alignment errors | | /System/intf-items/phys-items/PhysIf-list/dbgDot3Stats-items/alignmentErrors | | Babble count | | /System/intf-items/phys-items/PhysIf-list/dbgDot3Stats-items/babble | | Carrier sense errors | | /System/intf-items/phys-items/PhysIf-list/dbgDot3Stats-items/carrierSenseErrors | @@ -102,7 +116,6 @@ | FCS errors | | /System/intf-items/phys-items/PhysIf-list/dbgDot3Stats-items/fCSErrors | | Frame too long count | | /System/intf-items/phys-items/PhysIf-list/dbgDot3Stats-items/frameTooLongs | | Input pause frames | | /System/intf-items/phys-items/PhysIf-list/dbgDot3Stats-items/inPauseFrames | -| Input dribble | | /System/intf-items/phys-items/PhysIf-list/dbgDot3Stats-items/inputdribble | | Internal MAC receive errors | | /System/intf-items/phys-items/PhysIf-list/dbgDot3Stats-items/internalMacReceiveErrors | | Internal MAC transmit errors | | /System/intf-items/phys-items/PhysIf-list/dbgDot3Stats-items/internalMacTransmitErrors | | Late collisions count | | /System/intf-items/phys-items/PhysIf-list/dbgDot3Stats-items/lateCollisions | @@ -111,7 +124,6 @@ | No carrier errors | | /System/intf-items/phys-items/PhysIf-list/dbgDot3Stats-items/noCarrierErrors | | Output pause frames | | /System/intf-items/phys-items/PhysIf-list/dbgDot3Stats-items/outPauseFrames | | Runts | | /System/intf-items/phys-items/PhysIf-list/dbgDot3Stats-items/runts | -| SQET test errors | | /System/intf-items/phys-items/PhysIf-list/dbgDot3Stats-items/sQETTestErrors | | Single collision frames | | /System/intf-items/phys-items/PhysIf-list/dbgDot3Stats-items/singleCollisionFrames | | Symbol errors | | /System/intf-items/phys-items/PhysIf-list/dbgDot3Stats-items/symbolErrors | | Total Broadcast packets | | /System/intf-items/phys-items/PhysIf-list/dbgEtherStats-items/broadcastPkts | @@ -128,6 +140,11 @@ | Total octets | | /System/intf-items/phys-items/PhysIf-list/dbgEtherStats-items/octets | | Total Overrun | | /System/intf-items/phys-items/PhysIf-list/dbgEtherStats-items/overrun | +### Interface - Optical + +| Metric | Openconfig Model | Native Model | +| :--- | :--- | :--- | +| Transceiver Sensor(list) | `N/A` | `System/intf-items/phys-items/PhysIf-list/phys-items/fcot-items/lane-items` | ## ISIS | Metric | Openconfig Model | Native Model | @@ -361,4 +378,4 @@ ## VLAN | Metric | Openconfig Model | Native Model | | :--- | :--- | :--- | -| VLAN ID | /network-instances/network-instance/vlans/vlan/state/vlan-id | | \ No newline at end of file +| VLAN ID | /network-instances/network-instance/vlans/vlan/state/vlan-id | | diff --git a/site/404.html b/site/404.html new file mode 100644 index 0000000..78059c4 --- /dev/null +++ b/site/404.html @@ -0,0 +1,530 @@ + + + +
+ + + + + + + + + + + +As per gnmi specification:
+++The session between the client and server MUST be encrypted using TLS - and a target or client MUST NOT fall back to unencrypted sessions.
+
NX-OS only supports TLS connection on gRPC, mTLS is supported since 10.1(1). There are two certiciates used here:
+To create any type of certificate, a certificate authority (CA) is required. If you don't have one (or you are looking for something free), follow the steps in this excelent guide by Jamie Nguyen: OpenSSL Certificate Authority
+An acurate time is important when dealing with TLS certificates. It is recommended to setup NTP in the client and servers/devices. If you see errors related to certificate not valid yet or expired it is probably that the device or the client don't have a correct time set.
+For simplicity, this tutorial uses root but other users with less priviledges can be used.
+Make sure keys and certificates are protected
+Tests for this tutorial are done using gnmic and pygnmi
+A server certificate will allow you to connect to a NX-OS device securely, without need of skipping TLS verification for TLS connections.
+!!! info It is assumed that you have a valid root and intermediate CA certificates installed in your workstation. Instructions can be found at the top of this article on how to set that up
+Use the intermediate/openssl.cnf file (server_cert section):
+[ server_cert ]
+# Extensions for server certificates (`man x509v3_config`).
+basicConstraints = CA:FALSE
+subjectAltName=${ENV::SAN}
+nsCertType = server
+nsComment = "OpenSSL Generated Server Certificate"
+subjectKeyIdentifier = hash
+authorityKeyIdentifier = keyid,issuer:always
+keyUsage = critical, digitalSignature, keyEncipherment
+extendedKeyUsage = serverAuth
+
+The value ${ENV::SAN} instructs openssl to look for the value of the subjectAltName in an environmental variable called SAN
+If you don't have a DNS available, you can manually add the host entry in the /etc/hosts file if you would like to use names instead of IPs. Either one works
+In this example, the device name is nx93000v-01.cisco.com and its management IP is 192.168.1.1
+export SAN=DNS:nx9300v-01,DNS:nx9300v-01.cisco.com,IP:192.168.1.1
+
+Altough the file name is trivial, it is a best practice to use the hostname of the device or other identifier that sumarizes the purpuse of the certificate.
+++You can use the same certificate for multiple devices
+Make sure to use server_cert extensions
+
openssl genrsa -out intermediate/private/nx9300v-01.cisco.com.key.pem
+
+openssl req -config intermediate/openssl.cnf -key intermediate/private/nx9300v-01.cisco.com.key.pem -new -sha256 -out intermediate/csr/nx9300v-01.cisco.com.csr.pem
+(...)
+-----
+Country Name (2 letter code) [GB]:US
+State or Province Name [England]:CO
+Locality Name []:
+Organization Name [Alice Ltd]:Nexus
+Organizational Unit Name []:Datacenter
+Common Name []:nx9300v-01.cisco.com
+Email Address []:
+
+openssl ca -config intermediate/openssl.cnf -extensions server_cert -days 375 -notext -md sha256 -in intermediate/csr/nx9300v-01.cisco.com.csr.pem -out intermediate/certs/nx9300v-01.cisco.com.cert.pem
+
+Check that the alternative name section is present and has the values set in the previous step
+openssl x509 -noout -text -in intermediate/certs/nx9300v-01.cisco.com.cert.pem
+
+cat intermediate/certs/nx9300v-01.cisco.com.cert.pem > intermediate/certs/nx9300v-01.cisco.com.chain.cert.pem
+cat intermediate/certs/intermediate.cert.pem >> intermediate/certs/nx9300v-01.cisco.com.chain.cert.pem
+cat certs/ca.cert.pem >> intermediate/certs/nx9300v-01.cisco.com.chain.cert.pem
+
+++Make sure to remember the export password
+
openssl pkcs12 -export -out intermediate/certs/nx9300v-01.cisco.com.pfk -inkey intermediate/private/nx9300v-01.cisco.com.key.pem -in intermediate/certs/nx9300v-01.cisco.com.chain.cert.pem
+scp intermediate/certs/nx9300v-01.cisco.com.pfk admin@192.168.1.1:
+
+Execute the following commands on the device. For this example, "supersecret" was used as password the step before
+nx9300v_01# configure
+nx9300v_01(config)# crypto ca trustpoint server
+nx9300v_01(config)# crypto ca import server pkcs12 bootflash:nx9300v-01.cisco.com.pfk supersecret
+
+Configure grpc to use the truspoint above:
+nx9300v_01(config)# grpc certificate server
+
+Use the certificate chain file, not the standalone certificate file. The --skip-verify option should not be needed
+# gnmic -a nx9300v-01.cisco.com:50051 -u admin -p YOURPASSWORD get --path /System/name --tls-cert intermediate/certs/nx9300v-01.cisco.com.chain.cert.pem --tls-key intermediate/private/nx9300v-01.cisco.com.key.pem -e json --tls-ca intermediate/certs/ca-chain.cert.pem
+
++ + +
[
+ {
+ "source": "nx9300v-01.cisco.com:50051",
+ "timestamp": 1657660857691587822,
+ "time": "2022-07-12T21:20:57.691587822Z",
+ "updates": [
+ {
+ "Path": "System/name",
+ "values": {
+ "System/name": "nx9300v-01"
+ }
+ }
+ ]
+ }
+]
+
+
+
+++For simplicity, this example includes credentials in clear text, which is not a best practice.
+
# Modules
+from pygnmi.client import gNMIclient
+import json
+# Variables
+host = ('nx9300v-01.cisco.com', '50051')
+paths = ['/System/name']
+
+# Body
+if __name__ == '__main__':
+ with gNMIclient(target=host, username='admin', password="YOURPASSWORD", path_cert="./ca/intermediate/certs/nx9300v-01.cisco.com.chain.cert.pem",
+ path_key="./ca/intermediate/private/nx9300v-01.cisco.com.key.pem", path_root="./ca/intermediate/certs/ca-chain.cert.pem") as gc:
+
+ result = gc.get(path=paths, encoding='json')
+ print(result)
+ print()
+
+#
+# python get-nx.py
+{'notification': [{'timestamp': 1657660901108756130, 'update': [{'path': 'System/name', 'val': 'nx9300v-01'}]}]}
+
+#
+
+If you prefer to use a certificate and key instead of a password, you can create a client certificate that can be used to authenticate against the NX-OS device.
+++It is assumed that you have a valid root and intermediate CA certificates installed in your workstation. Instructions can be found at the top of this article on how to set that up
+
Altough the file name is trivial, it is a best practice to use the username or other identifier that sumarizes the purpuse of the certificate, csr and keys.
+++You can use the same certificate to login to multiple devices with the same username
+Make sure to use usr_cert extensions
+Use the username as value for Common Name and Organizational Unit Name
+
# openssl genrsa -out intermediate/private/admin.key.pem 2048
+
+# openssl req -config intermediate/openssl.cnf -key intermediate/private/admin.key.pem -new -sha256 -out intermediate/csr/admin.csr.pem
+-----
+Country Name (2 letter code) [GB]:US
+State or Province Name [England]:CO
+Locality Name []:
+Organization Name [Alice Ltd]:Nexus
+Organizational Unit Name []:admin
+Common Name []:admin
+Email Address []:
+
+# openssl ca -config intermediate/openssl.cnf -extensions usr_cert -days 375 -notext -md sha256 -in intermediate/csr/admin.csr.pem -out intermediate/certs/admin.cert.pem
+
+cat intermediate/certs/admin.cert.pem > intermediate/certs/admin.chain.cert.pem
+cat intermediate/certs/intermediate.cert.pem >> intermediate/certs/admin.chain.cert.pem
+cat certs/ca.cert.pem >> intermediate/certs/admin.chain.cert.pem
+
+For this example, gnmi-root is used as trustpoint name but it can have any name. Use the content of the root certificate only (certs/ca.cert.pem) - no chains or intermediate certs are required
+Execute the following commands on the device:
+nx9300v_01# configure
+nx9300v_01(config)# crypto ca trustpoint gnmi-root
+nx9300v_01(config)# crypto ca authenticate gnmi-root
+input (cut & paste) CA certificate (chain) in PEM format;
+end the input with a line containing only END OF INPUT :
+-----BEGIN CERTIFICATE-----
+(...)
+-----END CERTIFICATE-----
+END OF INPUT
+(...)
+
+Do you accept this certificate? [yes/no]:yes
+
+Configure the grpc client root certificate:
+nx9300v_01(config)# grpc client root certificate gnmi-root
+
+++You might need to change the tls files path to match your environment
+Password is not required anymore
+
# cat .gnmic.yaml
+log-file: /tmp/gnmic.log
+debug: true
+tls-ca: ./intermediate/certs/ca-chain.cert.pem
+targets:
+ 192.168.1.2:50051:
+ username: admin
+ tls-cert: ./intermediate/certs/admin.chain.cert.pem
+ tls-key: ./intermediate/private/admin.key.pem
+
+# gnmic get --path /System/name
+[
+ {
+ "source": "192.168.1.2:50051",
+ "timestamp": 1663693091279809206,
+ "time": "2022-09-20T12:58:11.279809206-04:00",
+ "updates": [
+ {
+ "Path": "System/name",
+ "values": {
+ "System/name": "nx9300v_01"
+ }
+ }
+ ]
+ }
+]
+#
+
+
+
+
+
+
+
+ ++ + + + + + +Placeholder: Configuration on NXOS
+
++ + + + + + +Placeholder: exmample of using gNMIc to test gNMI with NX-OS
+
gNMI is built on top of Google Remote Procedure Call (gRPC). gRPC is an open source high performance RPC framework released in 2016. It uses HTTP/2 for transport, protocol buffers for the interface description language, and includes the following features:
+gRPC can generate cross-platform client and server bindings for many languages. It also supports TLS and token-based authentication. gRPC uses protocol buffers to encode data.
+gRPC Network Management Interface (gNMI) is a specification of RPCs for managing or collecting the state of a device. The content provided through gNMI can be modeled using YANG. gRPC carries gNMI and provides the ability to create and transmit requests.
+gNMI can be transmitted in two ways:
+NX-OS supports the following gNMI RPCs:
+As mentioned above, gNMI relies on gRPC. A combination of gRPC and gNMI settings are required to configure this functionality on NX-OS.
+switch# feature grpc
+
+switch# grpc port 50051
+Ports can be from 1024 to 65535. Default is 50051.
+
+switch# grpc certificate CertName
+CertName is the filename of your certificate file.
+
+switch# grpc gnmi max-concurrent-call 8
+This is the limit of simulteneous dial-in calls. The limit can be from 1 to 16. Default is 8.
+
+switch# grpc use-vrf default
+Allows you to select which vrf to use for gNMI traffic.
+
+gNMI subscription can be used with both dial-in or dial-out methods.
+Starting in NX-OS 9.3.1, Nexus switches support the following subscription features:
+++Placeholder: common sensor paths of OC model and Native Model
+
Metric | +Openconfig Model | +Native Model | +
---|---|---|
+ | + | + |
Metric | +Openconfig Model | +Native Model | +
---|---|---|
+ | + | + |
Metric | +Openconfig Model | +Native Model | +
---|---|---|
interface counters | +/interfaces/interface/state/counters | +/System/intf-items/phys-items/PhysIf-list/dbgEtherStats-items | +
Metric | +Openconfig Model | +Native Model | +
---|---|---|
+ | + | + |
Metric | +Openconfig Model | +Native Model | +
---|---|---|
+ | + | + |
Metric | +Openconfig Model | +Native Model | +
---|---|---|
+ | + | + |
Metric | +Openconfig Model | +Native Model | +
---|---|---|
+ | + | + |
Metric | +Openconfig Model | +Native Model | +
---|---|---|
+ | + | + |
\n {translation(\"search.result.term.missing\")}: {...missing}\n
\n }\n