Following the doc from https://wikitech.wikimedia.org/wiki/Spicerack#Adding_new_module_or_change_in_core_behaviour
A problem statement
We're going to use gNMI more and more to communicate with Network devices (see. Blog Post: Multi-platform network configuration).
As we use (and are going to use more) cookbooks to interact with network devices (get data and push config), we need an easy to use and standardized abstraction layer to use gNMI.
Example of such functions are in the PoC https://gerrit.wikimedia.org/r/c/operations/cookbooks/+/924896 and marked with # Move to spicerack module as using cookbooks/sre/network/__init__.py doesn't scale and doesn't benefit from the scrutiny of a Spicerack module.
They're of course not set in stone and would need to be adapted to work as a Spicerack module.
Current proxy support for local dev implemented in https://github.com/akarneliuk/pygnmi/pull/133/
Third party dependencies
- T340045: Package pyGNMI and dictdiffer to be used by cookbooks
- https://packages.debian.org/stable/python/python3-rich
Additional configuration
The current example uses this config file:
--- username: ayounsi password: Wikimedia
With the current pending patches, local testing can be done (after the usual spicerack/cookbook dev setup) with:
Setup the proxy:
ssh cumin1002.eqiad.wmnet -D 8888
Port 8080 Listen 127.0.0.1 Timeout 600 Allow 127.0.0.1 Upstream socks5 localhost:8888
tinyproxy -d -c tiniproxy.conf
grpc_proxy=http://localhost:8080 cookbook sre.network.example-gnmi-cookbook sretest1004