Final month I described how one can simplify your VLAN- or VRF lab topologies with VRF- and VLAN hyperlinks, mechanically setting vlan.entry or vrf attribute on a set of hyperlinks. Hyperlink teams will let you do the identical for any set of hyperlink attributes.
Pattern Topology
Think about you’ve gotten a small community with three PE-routers linked to a central P-router:
So long as you’re OK with the default parameters (default OSPF price, default IPv4 deal with pool), you possibly can describe that lab with a quite simple topology file:
defaults.gadget: eos
module: [ ospf ]
nodes: [ pe1, pe2, pe3, p ]
hyperlinks: [ pe1-p, pe2-p, pe3-p ]
Now let’s assume that you simply’d like to make use of unnumbered core hyperlinks, set OSPF price on these hyperlinks, and set hyperlink function to core. You possibly can not use the easy checklist of hyperlinks however should outline hyperlink attributes on each single hyperlink. Not solely is the topology file more durable to learn, it additionally incorporates duplicate attributes.
defaults.gadget: eos
module: [ ospf ]
nodes: [ pe1, pe2, pe3, p ]
hyperlinks:
- pe1:
p:
unnumbered: true
ospf.price: 100
function: core
- pe2:
p:
unnumbered: true
ospf.price: 100
function: core
- pe3:
p:
unnumbered: true
ospf.price: 100
function: core
Hyperlink Teams to the Rescue
netlab launch 1.5.1 launched hyperlink teams – a easy method to set the identical set of attributes on quite a few hyperlinks.
Hyperlink teams are outlined inside the hyperlinks checklist; all you must do is to set the group attribute to inform netlab it’s coping with a bunch of hyperlinks, and outline member hyperlinks within the members attribute.
Utilizing a core group, we will get our lab topology again into an easy-to-read almost-non-redundant format:
defaults.gadget: eos
module: [ ospf ]
nodes: [ pe1, pe2, pe3, p ]
hyperlinks:
- group: core
unnumbered: true
ospf.price: 100
function: core
members: [ pe1-p, pe2-p, pe3-p ]
Behind the Scenes
Earlier than beginning the topology knowledge transformation course of, netlab expands hyperlink teams into particular person hyperlinks:
- A brand new hyperlink knowledge construction is created for each member hyperlink, increasing numerous simplified hyperlink definition codecs into dictionaries.
- Group attributes are added to the hyperlink attribute. Hyperlink attributes (if specified) take priority over group attributes.
Utilizing this course of, netlab created the next set of hyperlinks from the above topology file:
Core hyperlinks created from the core hyperlink group
$ netlab create -o yaml:hyperlinks
- interfaces:
- ifindex: 1
ifname: Ethernet1
ipv4: true
node: pe1
- ifindex: 1
ifname: Ethernet1
ipv4: true
node: p
linkindex: 1
node_count: 2
ospf:
price: 100
function: core
sort: p2p
unnumbered: true
- interfaces:
- ifindex: 1
ifname: Ethernet1
ipv4: true
node: pe2
- ifindex: 2
ifname: Ethernet2
ipv4: true
node: p
linkindex: 2
node_count: 2
ospf:
price: 100
function: core
sort: p2p
unnumbered: true
- interfaces:
- ifindex: 1
ifname: Ethernet1
ipv4: true
node: pe3
- ifindex: 3
ifname: Ethernet3
ipv4: true
node: p
linkindex: 3
node_count: 2
ospf:
price: 100
function: core
sort: p2p
unnumbered: true
Get Began
Hyperlink teams had been launched in netlab launch 1.5.1. To improve, execute pip3 set up --upgrade networklab
.
New to netlab? Begin with the Getting Began doc and the set up information.