Skip to content

Add IP Infusion OcNOS device (containerlab/vrnetlab) - #3960

Merged
ipspace merged 4 commits into
ipspace:devfrom
victorkhgith:ocnos-device
Oct 24, 2026
Merged

ipspace merged 4 commits into
ipspace:devfrom
victorkhgith:ocnos-device

Conversation

@victorkhgith

@victorkhgith victorkhgith commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

This PR adds support for IP Infusion OcNOS as a device type (ocnos). OcNOS runs as a vrnetlab container (containerlab kind ipinfusion_ocnos), and netlab configures it with Netmiko (ipinfusion_ocnos driver). The ipinfusion.ocnos Ansible collection is available as an alternative configuration method.

What's included

  • Device settings (netsim/devices/ocnos.yml), support level minimal, Netmiko as the default configuration method
  • Device quirks (netsim/devices/ocnos.py): checks for the ipinfusion.ocnos Ansible collection when a node uses Ansible to deploy its configuration
  • Ansible configuration deployment and fetch task lists
  • Configuration templates: initial configuration, OSPFv2, OSPFv3 (including the reference bandwidth), IS-IS (wide metrics), BGP
  • tests/config/ocnos-netmiko.yml to check Netmiko error detection
  • Documentation: OcNOS caveats (including the image build steps), the containerlab image table, the supported platforms tables, and the Netmiko developer documentation

Test environment

  • OcNOS image OcNOS-SP-PLUS-x86-7.0.0-262-GA.qcow2 (free download after registration), built into vrnetlab/ipinfusion_ocnos:7.0.0-262 using the srl-labs vrnetlab fork
  • netlab dev (7cd5b14; the only later commit is Netmiko developer documentation #3961, documentation), containerlab 0.81.1, netmiko 4.8.0
  • FRR 10.7.1 probes, Ubuntu 22.04 on WSL2

Integration test results (Netmiko)

Tests Passed Passed with a warning Failed
initial 4 0 0
ospf/ospfv2 4 3 (VRF part skipped) 0
ospf/ospfv3 5 2 (VRF part skipped) 0
isis 6 0 0
bgp 9 1 (IPv6 bgp.originate skipped) 0

The Ansible method (ansible-core 2.17.14, ipinfusion.ocnos 1.2.5) gave the same results, except that initial/01c-netmiko does not apply to it.

After the review fixes I re-ran the IS-IS tests (6 passed), and after rebasing on dev 2551c9a one test per area (initial 01-interfaces and 01c-netmiko, OSPFv2 03, OSPFv3 03, IS-IS 11, BGP 05 and 12): all passed.

netlab create rejected tests that need features this PR does not implement; those tests are not counted. I could not run initial/04-mtu (it needs an Arista cEOS probe); I checked MTU separately on a link between two OcNOS nodes (mtu 1400 is configured and active on the interface).

With tests/config/ocnos-netmiko.yml, netlab config invalid and netlab 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, the dev branch has 32 failures, none related to this PR.

OcNOS behavior handled by the templates

  • OSPFv2 areas are configured with network statements in the OSPF process (there is no interface-level OSPFv2 area command). OSPFv3 uses ipv6 router ospf area <area> tag <process> on the interfaces.
  • The loopback interface lo keeps 127.0.0.1/8 as its primary address, so the netlab loopback address is configured as a secondary address. Additional loopbacks are loopback<n>.
  • The management interface is in the management VRF, so the vrnetlab management subnet does not conflict with netlab loopback addresses.
  • IS-IS uses level-2-only, and wide metrics are set with isis wide-metric.
  • BGP sends standard and extended communities by default. The template turns off the types not listed in bgp.community.
  • A network prefix is advertised only when it is in the routing table, so bgp.originate prefixes 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.

@jbemmel

jbemmel commented Oct 22, 2026

Copy link
Copy Markdown
Collaborator

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)

@victorkhgith

Copy link
Copy Markdown
Collaborator Author

@jbemmel, let me use Netmiko, thank you.

@ipspace

ipspace commented Oct 22, 2026

Copy link
Copy Markdown
Owner

@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.

@victorkhgith

victorkhgith commented Oct 23, 2026 •

Copy link
Copy Markdown
Collaborator Author

Thanks @ipspace and @jbemmel. Netmiko works with OcNOS, so I switched the default to it.

The OcNOS driver is thin, but it has a commit() that raises an error when OcNOS rejects a commit, and netlab already calls it after each configuration snippet. error_regexp is ^%(?! Warning).* because OcNOS prints a harmless % Warning when a command runs from a parent configuration mode.

The initial, OSPFv2, OSPFv3, IS-IS and BGP integration tests give the same results as with Ansible, initial/01c-netmiko now runs and passes, and tests/config/ocnos-netmiko.yml checks that an invalid command and a rejected commit both fail. I also added OcNOS to the new Netmiko developer documentation (thanks for writing it, it made this much easier). The Ansible task lists are still there as an alternative. Details are in the updated description.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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

Comment thread netsim/ansible/templates/ospf/ocnos.j2

@ipspace ipspace left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job. Just a few minor details to fix (or not, your call) and then I'll merge it

Comment thread netsim/devices/ocnos.yml
level: minimal
group_vars:
netlab_device_type: ocnos
ansible_network_os: ipinfusion.ocnos.ocnos

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is 'ansible_network_os' still needed/used at all? Would be great if we can make this an Ansibleless device

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread netsim/ansible/templates/isis/ocnos.j2 Outdated
#}
{% 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) %}

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wide_metrics is not a valid isis attribute, and (according to documentation ;) netlab IS-IS module supports only wide metrics anyway.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed. The template now always uses wide metrics.

Comment thread netsim/ansible/templates/isis/ocnos.j2 Outdated
@@ -0,0 +1,41 @@
{#
OcNOS uses "level-2-only" where netlab uses "level-2", and "isis metric" takes narrow

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's perfectly OK. Configuration keywords are device-specific in many cases.

Comment thread netsim/ansible/templates/isis/ocnos.j2 Outdated
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 }}

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to deal with both (unless you want to have extra flexibility)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same change. It now uses only isis wide-metric.

@jbemmel

jbemmel commented Oct 23, 2026

Copy link
Copy Markdown
Collaborator

I'm assuming this PR would replace #3679 ? @roc-ops any input/suggestions?

@ipspace

ipspace commented Oct 23, 2026 •

Copy link
Copy Markdown
Owner

I'm assuming this PR would replace #3679 ? @roc-ops any input/suggestions?

I would start with this one (it's much smaller), and then ask one of our AI friends to port all the remaining stuff from #3679 into a new PR.

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).
@victorkhgith

Copy link
Copy Markdown
Collaborator Author

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 dev branch.

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 ipspace left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a million for the fixes. Great job, and welcome to the contributors club ;)

Comment thread netsim/devices/ocnos.py
pass

def check_config_sw(self, node: Box, topology: Box) -> None:
if devices.get_node_group_var(node,'netlab_config_mode',topology.defaults) == 'netmiko':

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Beautiful. We have to backport this to other devices (if relevant)

@ipspace
ipspace merged commit 18189f3 into ipspace:dev Oct 24, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants