Repository navigation
Add IP Infusion OcNOS device (containerlab/vrnetlab) - #3960
Conversation
|
Hi Victor, Thanks for your contribution! Have you considered using Netmiko to configure OcNOS, instead of Ansible? See #3937 - the project is trying to move away from its Ansible dependency, and it would be very helpful if new devices would use the new leaner method (it's basically SCP followed by applying the config) |
|
@jbemmel, let me use Netmiko, thank you. |
OcNOS support in Netmiko seems pretty thin (there's just the SSH/Telnet driver), so I'm not sure whether the approach we're currently using to configure devices with Netmiko would work. Anyhow, I'd love to reduce the Ansible usage, so if you can't get OcNOS to work with Netmiko, please let me know, and we'll figure something out. Also, I (finally) added Netmiko developer documentation in #3961 so you won't have to reverse-engineer what device features have to be set. |
2f38e37 to
0a9ce81
Compare
|
Thanks @ipspace and @jbemmel. Netmiko works with OcNOS, so I switched the default to it. The OcNOS driver is thin, but it has a The initial, OSPFv2, OSPFv3, IS-IS and BGP integration tests give the same results as with Ansible, |
There was a problem hiding this comment.
🟡 Changes recommended
The OSPFv3 template silently ignores the accepted reference-bandwidth setting, potentially producing unintended routing costs.
1 open issue
What changed in this PR
Adds minimal IP Infusion OcNOS support to netlab through containerlab/vrnetlab, with Netmiko as the default configuration method and Ansible as an alternative.
Changes:
- Defines the OcNOS device, container image, capabilities, and deployment methods.
- Adds initial, OSPFv2/v3, IS-IS, and BGP configuration templates.
- Documents platform support and image setup, and adds a manual Netmiko error-detection test topology.
| File | Description |
|---|---|
tests/config/ocnos-netmiko.yml |
Exercises command and commit error detection. |
netsim/devices/ocnos.yml |
Defines device capabilities and containerlab settings. |
netsim/ansible/templates/ospf/ocnos.j2 |
Configures OSPFv2 and OSPFv3. |
netsim/ansible/templates/isis/ocnos.j2 |
Configures IS-IS processes and interfaces. |
netsim/ansible/templates/initial/ocnos.j2 |
Configures hostname, interfaces, and addressing. |
netsim/ansible/templates/bgp/ocnos.macro.j2 |
Defines BGP neighbor configuration macros. |
netsim/ansible/templates/bgp/ocnos.j2 |
Configures BGP sessions and prefix advertisements. |
netsim/ansible/tasks/fetch-config/ocnos.yml |
Retrieves running configuration through Ansible. |
netsim/ansible/tasks/deploy-config/ocnos.yml |
Deploys and saves configuration through Ansible. |
docs/platforms.md |
Lists OcNOS support and capabilities. |
docs/labs/clab.md |
Adds the OcNOS container image. |
docs/dev/config/netmiko.md |
Documents the driver and error-detection settings. |
docs/caveats.md |
Documents image preparation and platform behavior. |
Review effort: Balanced
ipspace
left a comment
There was a problem hiding this comment.
Great job. Just a few minor details to fix (or not, your call) and then I'll merge it
| level: minimal | ||
| group_vars: | ||
| netlab_device_type: ocnos | ||
| ansible_network_os: ipinfusion.ocnos.ocnos |
There was a problem hiding this comment.
You might want to add a device quirk that checks whether the Ansible collection is installed. See check_config_sw in srlinux.py in the same directory for details.
There was a problem hiding this comment.
Is 'ansible_network_os' still needed/used at all? Would be great if we can make this an Ansibleless device
There was a problem hiding this comment.
Configuration fetching and reloading, plus someone might decide to force Ansible-based configuration. As Victor has already implemented/tested the Ansible task lists, it makes no sense not to enable them.
There was a problem hiding this comment.
Added check_config_sw in netsim/devices/ocnos.py. It asks for ipinfusion.ocnos only when the node uses Ansible to deploy the configuration, so the default Netmiko setup works without the collection. I checked all three cases: Netmiko without the collection, Ansible without it (netlab stops with the install hint), and Ansible with it.
| #} | ||
| {% set lvl = { 'level-1': 'level-1', 'level-2': 'level-2-only', 'level-1-2': 'level-1-2' } %} | ||
| {% set mt_lvl = { 'level-1': 'level-1', 'level-2': 'level-2', 'level-1-2': 'level-1-2' } %} | ||
| {% set wide = isis.wide_metrics|default(True) %} |
There was a problem hiding this comment.
wide_metrics is not a valid isis attribute, and (according to documentation ;) netlab IS-IS module supports only wide metrics anyway.
There was a problem hiding this comment.
Removed. The template now always uses wide metrics.
| @@ -0,0 +1,41 @@ | |||
| {# | |||
| OcNOS uses "level-2-only" where netlab uses "level-2", and "isis metric" takes narrow | |||
There was a problem hiding this comment.
That's perfectly OK. Configuration keywords are device-specific in many cases.
| isis circuit-type {{ lvl[l.isis.type]|default(l.isis.type) }} | ||
| {% endif %} | ||
| {% if l.isis.metric is defined %} | ||
| isis {{ 'wide-metric' if wide else 'metric' }} {{ l.isis.metric }} |
There was a problem hiding this comment.
No need to deal with both (unless you want to have extra flexibility)
There was a problem hiding this comment.
Same change. It now uses only isis wide-metric.
Device settings, config deployment/fetch task lists, initial, OSPFv2/OSPFv3, IS-IS and BGP templates, and documentation (caveats, image table, platform tables).
Netmiko ipinfusion_ocnos driver (netlab calls commit() after each snippet), error_regexp skips OcNOS '% Warning' lines, tests/config/ocnos-netmiko.yml for error detection, OcNOS added to the Netmiko developer documentation. The Ansible task lists remain as an alternative method.
OcNOS OSPFv3 accepts the same auto-cost reference-bandwidth command as OSPFv2. Checked on two OcNOS nodes: with a 1 Gbps link and reference bandwidth 40000, OSPFv2 and OSPFv3 both compute cost 40.
check_config_sw requires the ipinfusion.ocnos collection only when the node uses Ansible to deploy the configuration (Netmiko, the default, does not need it). The IS-IS template always uses wide metrics (netlab IS-IS supports only wide metrics).
0a9ce81 to
3700cd5
Compare
|
Thanks for the review! The fixes are pushed. After the IS-IS change I re-ran the IS-IS tests (all pass), plus a few tests on the updated Thanks @roc-ops for #3679, it covers a lot more ground. I'd be happy to help port the remaining features in a follow-up PR once this one is merged, if that works for you. |
ipspace
left a comment
There was a problem hiding this comment.
Thanks a million for the fixes. Great job, and welcome to the contributors club ;)
| pass | ||
|
|
||
| def check_config_sw(self, node: Box, topology: Box) -> None: | ||
| if devices.get_node_group_var(node,'netlab_config_mode',topology.defaults) == 'netmiko': |
There was a problem hiding this comment.
Beautiful. We have to backport this to other devices (if relevant)

This PR adds support for IP Infusion OcNOS as a device type (
ocnos). OcNOS runs as a vrnetlab container (containerlab kindipinfusion_ocnos), and netlab configures it with Netmiko (ipinfusion_ocnosdriver). Theipinfusion.ocnosAnsible collection is available as an alternative configuration method.What's included
netsim/devices/ocnos.yml), support level minimal, Netmiko as the default configuration methodnetsim/devices/ocnos.py): checks for theipinfusion.ocnosAnsible collection when a node uses Ansible to deploy its configurationtests/config/ocnos-netmiko.ymlto check Netmiko error detectionTest environment
OcNOS-SP-PLUS-x86-7.0.0-262-GA.qcow2(free download after registration), built intovrnetlab/ipinfusion_ocnos:7.0.0-262using the srl-labs vrnetlab forkdev(7cd5b14; the only later commit is Netmiko developer documentation #3961, documentation), containerlab 0.81.1, netmiko 4.8.0Integration test results (Netmiko)
bgp.originateskipped)The Ansible method (ansible-core 2.17.14,
ipinfusion.ocnos1.2.5) gave the same results, except thatinitial/01c-netmikodoes not apply to it.After the review fixes I re-ran the IS-IS tests (6 passed), and after rebasing on
dev2551c9a one test per area (initial01-interfaces and 01c-netmiko, OSPFv2 03, OSPFv3 03, IS-IS 11, BGP 05 and 12): all passed.netlab createrejected tests that need features this PR does not implement; those tests are not counted. I could not runinitial/04-mtu(it needs an Arista cEOS probe); I checked MTU separately on a link between two OcNOS nodes (mtu 1400is configured and active on the interface).With
tests/config/ocnos-netmiko.yml,netlab config invalidandnetlab config commit(a change OcNOS rejects only at commit time) both fail the deployment.pytest -k 'xform_ or error_cases'gives the same results with and without this PR. In my environment, thedevbranch has 32 failures, none related to this PR.OcNOS behavior handled by the templates
networkstatements in the OSPF process (there is no interface-level OSPFv2 area command). OSPFv3 usesipv6 router ospf area <area> tag <process>on the interfaces.lokeeps 127.0.0.1/8 as its primary address, so the netlab loopback address is configured as a secondary address. Additional loopbacks areloopback<n>.managementVRF, so the vrnetlab management subnet does not conflict with netlab loopback addresses.level-2-only, and wide metrics are set withisis wide-metric.bgp.community.networkprefix is advertised only when it is in the routing table, sobgp.originateprefixes get a discard static route.Not implemented
VRFs, route import (redistribution), default route origination, BFD, graceful restart, unnumbered interfaces, VLANs, IPv6
bgp.originate, and LLA-only IPv6 interfaces.Disclosure: I work at IP Infusion.