NX-OS gRPC Python connectivity library. Proto files sourced from documentation.
Requires Python and recommends pipenv
. Manual usage of pip
/virtualenv
is not covered. Uses black
for code formatting and pylint
for code linting.
git clone https://github.com/cisco-grpc-connection-libs/nx-os-grpc-python.git
cd nx-os-grpc-python
# If pipenv not installed, install!
pip install --user pipenv
# Now use pipenv, source from lockfile
pipenv --three install --dev --ignore-pipfile
# Or use latest libraries
./update_deps.sh
# Enter virtual environment
pipenv shell
# Do your thing.
exit
We use black
for code formatting and pylint
for code linting. clean_code.sh
will run black
against all of the code under nxos_grpc/
except for protoc
compiled protobufs, and run pylint
against Python files directly under nxos_grpc/
. They don't totally agree, and we aren't using perfect naming conventions in some cases, so we're not looking for perfection here.
./clean_code.sh
TODO: Add pre-commit hook to automatically run black if any Python files are being committed.
If a new nxos_grpc.proto
definition is released, use update_protos.sh
to recompile. If breaking changes are introduced the wrapper library must be updated.
./update_protos.sh
In order to use a secure channel you must acquire the necessary gRPC PEM files, grpc.pem
. This PEM file is found with your downloaded gRPC Agent RPM. You must then specify the file path or the content of this PEM file when initializing the Client class.
TODO: Where to acquire gRPC Agent RPM?
Open an issue :)
- A potential issue that might arise is that this library uses the latest
grpcio
andprotobuf
packages whereas the NX-OS gRPC server was built against 0.11.1 which is ~2016 and lacks compatibility documentation. If an issue is encountered we will go down the rabbit hole, ignoring until then. Tracking in #2.
Big thanks to Kyoung Yun for a reference client implementation.