Repository navigation
SROS: Migrate gNMI collection from nokia.grpc to nokia.openconfig - #4017
andywhitaker wants to merge 1 commit into
Conversation
|
Thanks a million for your efforts, but this is a total mess (has been for quite a while), and I don't think it's a good idea to hot-patch third-party software just because they can't get it right. Unfortunately, someone wanted to "showcase the bleeding edge possibilities," and I was too naive at that time to say "NO WAY", so we are where we are. Let's check how hard it would be to switch to NETCONF. |
|
Looks like it could be possible to use existing data structures with NETCONF: #4019 Let me try to make that work; that would be much cleaner, as it relies on rock-solid libraries like ncclient. How much of a rush are we in (as in: is the ansible-galaxy installation of the gRPC collection already broken)? |
|
That sounds good. I'm going to dig into options as well. There's no rush and you're right waiting to get a cleaner solution is a better option. I mainly wanted to fix the old version pinning issue but getting it all clean is better. NETCONF could be a solid path. Otherwise, gNMI could work if we can get a properly maintained version in Ansible Galaxy AND an install / usage procedure that keeps the dependency versions aligned.... Nokia pre-compiling the protobufs and shipping to Ansible Galaxy is probably not the right path. Compiling them locally on the user's machine might work though |
Let's just say that the history of that collection doesn't make me an optimist 🤷🏻♂️ |
|
If moving away from Ansible is an option, what do you think about just using pygnmi? It should ship with all the precompiled protobufs so would solve the version pinning issues and avoid the complexity of converting to XML for NETCONF since it should be able to use the existing templates. The plus I see with gNMI is just the config structure is easier and more native. That's literally the only reason I care to suggest staying on it. If only NETCONF wasn't using XML... :) |
Totally understand! FYI, I found and tested an upstream fix for this version-pinning issue which should make this work now and in the future without those same version issues |
Yet another dependency? At least with NETCONF, we could use the same method to configure multiple devices (SR OS and Junos).
I would use the same config structure in the templates and just convert it to XML internally. Wouldn't even think about writing XML templates -- I had enough XSLT ages ago. |
|
The new collection going forward is nokia.openconfig. As you saw, I tried to work around some issues with it in my first approach which was not ideal. I've now reached out to the maintainer and the upstream is getting fixed. It's already much better but the maintainer and I are working on a few more updates. I'll keep this PR since the title is accurate and will let you know when I feel like it's dialed in. At that point hopefully you'll get what you want out of it without the extra layers of converting the models but totally understand if you end up wanting to own your own destiny instead given the previous experience you had. Either way I'll touch base this week with another update and a working and sane version :) |
c6e0b53 to
92bcd2e
Compare
Thanks a million for the update. I'll push out the 26.11 release in second half of November, if this is ready by then, we'll make the switch, otherwise it will be in the next release.
No worries. I'm all for having a documented backup plan without creating extra work for myself ;)) |
92bcd2e to
7a60ba7
Compare
- Replace archived nokia.grpc with official Ansible Galaxy nokia.openconfig (>= 2.0.0) in netsim/install/grpc.sh, install.yml, sros.py, and srsim.py, removing the legacy git+ clone, protobuf==3.20.1 pin, and ansible>=9.5.1 workaround. - Migrate SR OS / SR-SIM deploy-config, fetch-config, and readiness-check tasks to nokia.openconfig.grpc, gnmi_set, gnmi_get, and gnmi_capabilities, preserving empty-string origin and guarding empty or null gNMI YAML sections and netlab_srsim_hw. - Update SR OS and SR-SIM gNMI Jinja2 templates and developer docs from 'val' to 'value' to match nokia.openconfig.gnmi_set 2.0.
7a60ba7 to
c6059c5
Compare
Summary
Nokia has archived
nokia/ansible-networking-collections(nokia.grpc) and replaced it withnokia-steward/openconfig-ansible-integration, published on Ansible Galaxy asnokia.openconfig(>= 2.0.0, latest2.0.2).The legacy
nokia.grpccollection shipped pre-compiledprotobuf 3.xdescriptors (gnmi_pb2.py) that failed onprotobuf >= 4.21.0(TypeError: Descriptors cannot be created directly), forcingnetlab install grpcto clone from GitHub, pinprotobuf==3.20.1(breaking modern Python environments), and apply anansible>=9.5.1workaround.nokia.openconfig2.0.xships directly on Ansible Galaxy, supportsansible-core >= 2.18.0(2.0.2+), and works cleanly with modernprotobuf(3.20through7.x) andgrpcioreleases.Changes
netsim/install/grpc.sh&netsim/install/install.yml:git+install URL,protobuf==3.20.1version lock, and obsoleteansible>=9.5.1workaround.grpcio+protobufviapython3 -m pipandnokia.srlinux+nokia.openconfigdirectly from Ansible Galaxy (ansible-galaxy collection install --upgrade nokia.srlinux nokia.openconfig).netsim/devices/sros.py&netsim/devices/srsim.py:nokia.openconfig(version='2.0.0',install='netlab install grpc') incheck_config_sw.netsim/ansible/tasks/{deploy-config,fetch-config,readiness-check}/{sros,srsim}*.yml:ansible_connectiontonokia.openconfig.grpcand modules tonokia.openconfig.gnmi_set,nokia.openconfig.gnmi_get, andnokia.openconfig.gnmi_capabilities.nokia.openconfig.gnmi_capabilities(with retries) and guardresult is succeededinsrsim.ymlport readiness polling.delete/updates/replacesections, and empty/nullnetlab_srsim_hw, while preserving explicit empty-stringorigin: ""(origin: "{{ cfg.get('origin') if cfg.get('origin') is not none else omit }}").ansible_gnmi_encoding: JSONinfetch-config/sros.ymlso SR OS configuration backups read/configurein JSON format.netsim/ansible/templates/**,netsim/extra/**/sros.j2,srsim-hardware.j2,docs/dev/config/srv6.md):val:tovalue:to matchnokia.openconfig.gnmi_set2.0.docs/caveats.md&docs/netlab/install.md:netlab installdocumentation fornokia.openconfig >= 2.0.0.Testing
mypy -p netsim,ruff check netsim/,yamllint --no-warnings,pytest(305 passed), andcheck-integration-tests.sh.25.7.R1) in Containerlab with official Ansible Galaxynokia.openconfig:2.0.2(Python 3.12,ansible-core 2.18.19,grpcio 1.85.1,protobuf 7.36.2), coveringnetlab up,netlab validate, empty/null/explicit-originnetlab configedge cases,netlab collect(normal and--check), andnetlab down --cleanup, plus full 128-scenario SR-SIM integration verification.