Skip to content

Commit

Permalink
Change node.runtime to node.clab.runtime, add documentation (#587)
Browse files Browse the repository at this point in the history
* Move 'runtime' under clab, add default runtime for clab provider (docker)
* Update test results

Co-authored-by: Jeroen van Bemmel <jeroen.van_bemmel@nokia.com>
  • Loading branch information
2 people authored and ipspace committed Oct 18, 2022
1 parent 15831dc commit 1306f37
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 13 deletions.
2 changes: 1 addition & 1 deletion docs/caveats.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

## Cumulus Linux in ContainerLab

* *containerlab* could run Cumulus Linux as a container or as a micro-VM with *firecracker* (default, requires KVM). To run Cumulus VX as a pure container, add **runtime: docker** parameter to node data.
* *containerlab* could run Cumulus Linux as a [container or as a micro-VM with *firecracker*](https://containerlab.dev/manual/kinds/cvx/). The default used by *netlab* is to run Cumulus Linux as a container. To change that, add **clab.runtime** parameter to node data.
* Cumulus Linux ran as a container might report errors related to DHCP client during initial configuration, in which case you might have to disable **apparmor** for DHCP client to get it to run. The hammer-of-Thor command to fix this problem is `sudo systemctl disable apparmor` followed by a reboot, your sysadmin friends probably have a better suggestion.
* *netlab* uses Cumulus VX containers created by Michael Kashin and downloaded from his Docker Hub account. Once Nvidia releases an official container image, change the container name with **defaults.devices.cumulus.clab.image** parameter (or by editing the `topology-defaults.yml` file included with *netlab*).
* The Cumulus VX 4.4.0 Vagrant box for VirtualBox is broken. *netlab* is using Cumulus VX 4.3.0 with *virtualbox* virtualization provider.
Expand Down
14 changes: 13 additions & 1 deletion docs/labs/clab.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ You can also use [vrnetlab](https://github.com/vrnetlab/vrnetlab) to build VM-in

## LAN bridges

For multi-access network topologies, **[netlab up](../netlab/up.md)** command automatically creates additional standard Linux bridges.
For multi-access network topologies, **[netlab up](../netlab/up.md)** command automatically creates additional standard Linux bridges.

You might want to use Open vSwitch bridges instead of standard Linux bridges (OVS interferes less with layer-2 protocols). After installing OVS, set **defaults.providers.clab.bridge_type** to **ovs-bridge**, for example:

Expand All @@ -52,3 +52,15 @@ links: [ s1-s2, s2-s3 ]
ceos.md
..
```

## Container runtime support
Containerlab supports [multiple container runtimes](https://containerlab.dev/cmd/deploy/#runtime) besides the default **docker**.
The runtime to use can be configured globally or per node, for example:

```
provider: clab
defaults.providers.clab.runtime: podman
nodes:
s1:
clab.runtime: ignite
```
2 changes: 1 addition & 1 deletion docs/nodes.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ After the initial cleanup, *netlab* topology transformation code augments node d
* Unless the node is a *host*[^HOST], or has a **loopback** attribute, it's loopback addresses are fetched from *loopback* [address pool](addressing.md). IPv4 loopback addresses are commonly using node **id** as the last octet. IPv6 loopback addresses are commonly using node **id** as the last byte in the IPv6 prefix.
* **device** type is copied from **defaults.device** if not already set.
* Vagrant **box** (or Docker container name) is set from device data if not specified in the **box** or **image** node attributes
* Device settings **role**, **mtu** and **runtime** are copied into the node data unless you set the corresponding node attribute in the topology file.
* Device settings **role** and **mtu** are copied into the node data unless you set the corresponding node attribute in the topology file.
* Management interface parameters are saved in **mgmt** element. Management interface name (**ifname**) is computed from device data. **mac** address and **ipv4** and **ipv6** addresses are computed from corresponding parameters in *mgmt* pool. You can overwrite any of these parameters (at your own risk) by specifying them in **mgmt** dictionary within node data.
* Device interfaces created as needed during the link transformation phase and collected in **interfaces** list.
* [](modules.md) document describes further processing done on configuration module parameters.
Expand Down
4 changes: 1 addition & 3 deletions netsim/templates/provider/clab/clab.j2
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ topology:
type: {{ clab.type }}
{% endif %}
image: {{ clab.image|default(n.box) }}
runtime: {{ clab.runtime|default(defaults.providers.clab.runtime) }}
{% if groups is defined %}
group: {% for g in groups if n.name in groups[g].members %}{{'' if loop.first else ','}}{{g}}{% endfor %}

Expand All @@ -41,9 +42,6 @@ topology:
- {{ f }}:{{ m }}
{% endfor %}
{% endif %}
{% if 'runtime' in n %}
runtime: {{ n.runtime }}
{% endif %}
{% if 'startup-config' in clab %}
startup-config: {{ clab['startup-config'] }}
{% endif %}
Expand Down
12 changes: 9 additions & 3 deletions netsim/topology-defaults.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,12 @@ attributes:
link: [ bandwidth,bridge,name,prefix,role,pool,type,unnumbered,interfaces,mtu,gateway,vlan_name ]
link_internal: [ linkindex,parentindex ]
link_no_propagate: [ prefix,interfaces,gateway ]
node: [ role,mtu,runtime,provider,id,loopback,cpu,memory ] # not enforced yet
node: [
name,interfaces,module,device,box,id,loopback,
config,group,role,mtu,provider,cpu,memory,unmanaged ]
prefix: [ ipv4, ipv6, allocation ]
vlan: [ id, vni, mode ]
vrf: [ rd, import, export, id, loopback ]

# Built-in module defaults
#
Expand Down Expand Up @@ -227,6 +232,7 @@ providers:
probe: [ "containerlab version" ]
cleanup: [ clab.yml,clab_files ]
bridge_type: bridge # Use 'ovs-bridge' to create Openvswitch bridges
runtime: docker # Default runtime, see Containerlab documentation

external:
config: external.txt
Expand Down Expand Up @@ -669,9 +675,9 @@ devices:
irb: True
clab:
mtu: 1500
runtime: docker
node:
kind: cvx
runtime: docker
image: networkop/cx:4.4.0
group_vars:
ansible_connection: docker
Expand Down Expand Up @@ -707,9 +713,9 @@ devices:
unnumbered: True
clab:
mtu: 1500
runtime: docker
node:
kind: cvx
runtime: docker
image: networkop/cx:5.0.1
group_vars:
ansible_connection: docker
Expand Down
1 change: 0 additions & 1 deletion tests/topology/expected/device-node-defaults.yml
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ nodes:
ipv4: true
area: 0.0.0.0
router_id: 10.0.0.1
runtime: docker
ospf:
area: 0.0.0.0
provider: clab
10 changes: 7 additions & 3 deletions tests/topology/input/bgp-unnumbered.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ addressing:
loopback:
ipv6: 2001:db8:cafe::/48

defaults:
device: cumulus
defaults.device: cumulus
provider: clab

bgp:
as_list:
Expand All @@ -23,7 +23,11 @@ bgp:
65200:
members: [r3]

nodes: [r1, r2, r3]
nodes:
r1:
r2:
r3:
clab.runtime: ignite

links:
- r1-r2
Expand Down

0 comments on commit 1306f37

Please sign in to comment.