Skip to content

Commit

Permalink
Merge branch 'ipspace:dev' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
sdargoeuves authored Oct 24, 2024
2 parents 4540cb6 + 133e5ea commit 6e6803b
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 6 deletions.
3 changes: 2 additions & 1 deletion docs/caveats.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,9 @@ Host 192.168.121.*
* Cisco IOL and IOL L2 images work only as containers created with Roman Dodin's fork of [vrnetlab](https://github.com/hellt/vrnetlab/).
* You need Containerlab 0.58.0 or greater to run these images.
* You cannot use VLANs 1002 through 1005 with Cisco IOL layer-2 image
* Bridging (bridge groups) does not work in Cisco IOL (router) image.
* Bridging (bridge groups) does not work in the Cisco IOL (router) image.
* Containerlab 0.58.0 sets the same base MAC address for all IOL nodes, resulting in duplicate spanning tree system IDs. Lab topologies with more than one IOL node might not work correctly.
* STP does not work correctly with the current packaging of the IOL L2 container, making multi-node VLAN topologies impossible to build.

See also [common Cisco IOS](caveats-iosv) caveats.

Expand Down
4 changes: 4 additions & 0 deletions docs/module/vlan.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ The VLAN configuration module implements VLANs and VLAN-related interfaces inclu
* Bridging-only and IRB VLANs
* Routed subinterfaces

```{warning}
The VLAN module implements data-plane functionality but does not configure the Spanning Tree Protocol (STP), leaving the vendor defaults unchanged. Trying to connect devices with incompatible defaults might result in connectivity problems. In that case, you'll have to fix the STP mismatches with additional device configuration.
```

```eval_rst
.. contents:: Table of Contents
:depth: 2
Expand Down
2 changes: 1 addition & 1 deletion netsim/ansible/templates/initial/frr.j2
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ else
curl -s https://deb.frrouting.org/frr/keys.asc | apt-key add -
FRRVER="frr-stable"
echo deb https://deb.frrouting.org/frr $(lsb_release -s -c) $FRRVER > /etc/apt/sources.list.d/frr.list
apt-get update -qq && apt-get install -qq frr frr-pythontools
apt-get update -qq && apt-get install -qq frr frr-pythontools bridge-utils
fi
{% else %}
{% if netlab_mgmt_vrf|default(False) %}
Expand Down
24 changes: 23 additions & 1 deletion netsim/modules/vlan.py
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,7 @@ def create_svi_interfaces(node: Box, topology: Box) -> dict:
# Overwrite interface settings with VLAN settings
vlan_ifdata = vlan_ifdata + {
k:v for k,v in vlan_data.items()
if k not in svi_skipattr and
if k not in svi_skipattr and k not in copy_attr and
(v is not True or k not in vlan_ifdata) }
fix_vlan_mode_attribute(vlan_ifdata)
node.interfaces.append(vlan_ifdata) # ... and add SVI interface to list of node interfaces
Expand Down Expand Up @@ -1280,6 +1280,28 @@ def link_pre_transform(self, link: Box, topology: Box) -> None:
def module_pre_link_transform(self, topology: Box) -> None:
create_loopback_vlan_links(topology)

# We need to copy a few attributes from node VLAN data into access link interface data, for example
# the node IPv4/IPv6 address (to support static addressing) and "gateway" attribute to enable
# selective VLAN gateway module activation
#
# This operation needs to be done when the link data structures have already been transformed into
# the canonical "interfaces" list format, so we cannot do it any sooner than this point.
#
def link_pre_link_transform(self, link: Box, topology: Box) -> None:
if 'vlan' not in link:
return

for intf in link.interfaces:
vname = intf.get('vlan.access',None)
if not vname:
continue
if vname not in topology.nodes[intf.node].get('vlans',{}):
continue
vdata = topology.nodes[intf.node].vlans[vname]
for attr in topology.defaults.vlan.attributes.copy_vlan_to_intf:
if attr in vdata:
intf[attr] = vdata[attr]

def module_post_link_transform(self, topology: Box) -> None:
for n in topology.nodes.values():
if 'vlan' in n.get('module',[]):
Expand Down
7 changes: 7 additions & 0 deletions netsim/modules/vlan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ attributes:
mode:
prefix:
evpn:

# Copy these attributes from node VLAN data into interface-on-link data
copy_vlan_to_intf:
ipv4:
ipv6:
gateway:

#
# Do not copy these VLAN attributes into SVI interfaces
#vlan_svi_no_propagate:
Expand Down
19 changes: 16 additions & 3 deletions tests/topology/expected/vlan-vrrp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,11 @@ links:
interfaces:
- _vlan_mode: irb
gateway:
id: 1
ipv4: 172.16.0.1/24
protocol: vrrp
vrrp:
priority: 100
ifindex: 2
ifname: Ethernet2
ipv4: 172.16.0.2/24
Expand Down Expand Up @@ -90,7 +94,11 @@ links:
interfaces:
- _vlan_mode: irb
gateway:
id: 1
ipv4: 172.16.0.1/24
protocol: vrrp
vrrp:
priority: 200
ifindex: 2
ifname: Ethernet2
ipv4: 172.16.0.3/24
Expand Down Expand Up @@ -149,6 +157,7 @@ nodes:
protocol: vrrp
vrrp:
group: 1
priority: 200
ifname: Vlan1000
ipv4: 172.16.0.3/24
node: s2
Expand Down Expand Up @@ -200,6 +209,7 @@ nodes:
protocol: vrrp
vrrp:
group: 1
priority: 200
ifname: Vlan1000
ipv4: 172.16.0.3/24
node: s2
Expand Down Expand Up @@ -268,6 +278,7 @@ nodes:
protocol: vrrp
vrrp:
group: 1
priority: 200
ifname: Vlan1000
ipv4: 172.16.0.3/24
node: s2
Expand All @@ -288,7 +299,7 @@ nodes:
group: 1
ifindex: 6
ifname: Vlan1001
ipv4: 172.16.1.2/24
ipv4: 172.16.1.24/24
name: VLAN blue (1001) -> [s2]
neighbors:
- gateway:
Expand Down Expand Up @@ -331,6 +342,7 @@ nodes:
gateway:
protocol: vrrp
id: 1001
ipv4: 24
mode: irb
prefix:
allocation: id_based
Expand Down Expand Up @@ -423,7 +435,7 @@ nodes:
name: VLAN blue (1001) -> [s1]
neighbors:
- ifname: Vlan1001
ipv4: 172.16.1.2/24
ipv4: 172.16.1.24/24
node: s1
type: svi
virtual_interface: true
Expand Down Expand Up @@ -491,7 +503,7 @@ vlans:
ipv4: 172.16.1.3/24
node: s2
- ifname: Vlan1001
ipv4: 172.16.1.2/24
ipv4: 172.16.1.24/24
node: s1
prefix:
allocation: id_based
Expand Down Expand Up @@ -519,6 +531,7 @@ vlans:
protocol: vrrp
vrrp:
group: 1
priority: 200
ifname: Vlan1000
ipv4: 172.16.0.3/24
node: s2
Expand Down
4 changes: 4 additions & 0 deletions tests/topology/input/vlan-vrrp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
# VLAN-VRRP test case (regression test for #1344, #1349)
# Blue VLAN + node-level VRRP priority is the regression test for #1370
#
# ipv4: 24 on blue VLAN: regression test for #1411
#

groups:
switches:
Expand All @@ -24,6 +26,8 @@ nodes:
s1:
vlans.red:
gateway.vrrp.priority: 100
vlans.blue:
ipv4: 24
s2:
gateway.vrrp.priority: 180
vlans.red:
Expand Down

0 comments on commit 6e6803b

Please sign in to comment.