Skip to content

cisco-ie/nx-os-grpc-python

Repository files navigation

nx-os-grpc-python

License Code style: black

NX-OS gRPC Python connectivity library. Proto files sourced from documentation.

Development

Requires Python and recommends pipenv. Manual usage of pip/virtualenv is not covered. Uses black for code formatting and pylint for code linting.

Get Source

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

Clean Code

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.

Recompile Protobufs

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

TLS Usage

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?

Issues

Open an issue :)

  1. A potential issue that might arise is that this library uses the latest grpcio and protobuf 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.

Contribution

Big thanks to Kyoung Yun for a reference client implementation.

About

NX-OS gRPC Python connectivity library.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published