Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/addressing.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ Each address pool specification is a dictionary of address pools. Individual add
* Default IPv6 subnet allocation is /64. You can change this behavior with the **prefix6** pool parameter.
* IPv4 loopback pool starts at .1 (**start** parameter is assumed to be 1)
* The IPv6 loopback pool starts at the second subnet to make the loopback IPv6 address similar to its IPv4 counterpart.
* _netlab_ reports an error when it runs out of prefixes in an address pool. Use a shorter pool prefix (**ipv4**/**ipv6**) or a longer subnet allocation size (**prefix**/**prefix6**) to get more subnets.

### Address Pool Configuration Example

Expand Down
7 changes: 6 additions & 1 deletion docs/module/bgp.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,9 @@ When building a more complex lab with multiple autonomous systems, you might wan

```{tip}
* The elements of the **‌members** and **‌rr** lists can be wildcard- or regular expressions (see [group members](groups-members) for more details)
* You can override the **‌bgp.as_list** settings with the node attributes.
* You can override the **‌bgp.as_list** settings (for example, route reflector status) with the node attributes. However, a node listed in the **‌members** list of an autonomous system cannot have a different **bgp.as** value.
* A node can be a member of a single autonomous system.
* Route reflectors (**‌rr** list) must also be listed in the **‌members** list.
```

For example, use the following configuration to build a core network connected to two external autonomous systems:
Expand Down Expand Up @@ -179,6 +181,7 @@ Advanced global configuration parameters include:
* **bgp.advertise_loopback** -- when set to `True` (default), the loopback IP addresses of the default loopback interface and any other [loopback links](links-loopback) are advertised as a BGP prefix. Set it to `False` in the global defaults or as a node attribute to turn off loopback prefix advertisements. You can also control the advertisement of individual loopback prefixes with the **bgp.advertise** interface attribute.
* **bgp.rr_mesh** -- Set it to `False` (default: `True`) to remove the IBGP sessions between BGP route reflectors.

(bgp-node-params)=
## Node Configuration Parameters

Instead of using a global list of autonomous systems, you could specify a BGP autonomous system and route reflector role on individual nodes using these parameters:
Expand Down Expand Up @@ -483,6 +486,8 @@ bgp.confederation:
members: [ 65001, 65002, 65003 ]
```

A confederation must have at least one member AS, and a member AS can belong to a single confederation; it cannot be a confederation AS itself. Lab devices must use confederation member AS numbers, not the confederation AS number.

EBGP sessions between confederation peers are built the same way as all other EBGP sessions; the session type is set to **confed_ebgp** to allow you to control address family activation and community propagation over confederation EBGP sessions.

BGP confederations usually assume a single IGP across all confederation members; _netlab_ bypasses that requirement with the **next-hop-self** option on confederation EBGP sessions.
Expand Down
4 changes: 4 additions & 0 deletions docs/module/evpn.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,10 @@ The EVPN bundle service is enabled with **evpn.bundle** VRF parameter that can t
* **vlan_aware** -- VLAN-aware bundle service (RFC 7432 section 6.3)
* **port_aware** -- Port-based VLAN-aware service (RFC 7432 section 6.3.1)

```{warning}
The devices that support EVPN bundle services (see the *VLAN Bundle service* column in the *Platform Support* table) currently support only the **vlan_aware** bundle service.
```

### Integrated Routing and Bridging

IRB is configured whenever EVPN-enabled VLANs in a VRF contain IPv4 or IPv6 addresses:
Expand Down
3 changes: 3 additions & 0 deletions docs/plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
:backlinks: none
```

(topo-plugins-use)=
## Using Plugins

Plugins needed by a topology file are listed in the **plugin** top-level element, for example:
Expand All @@ -20,6 +21,8 @@ plugin: [ bgp.session ]
module: [ ospf, bgp ]
```

_netlab_ searches for plugins in the plugin search path (**defaults.paths.plugin**: current directory, topology directory, `~/.netlab`, and `/etc/netlab`) before trying the [plugins shipped with _netlab_](topo-plugins-builtin). See [](dev-plugins) for more details.

You can specify additional (system-wide) plugins in [system defaults](topo-defaults) (**defaults.plugin**) or as a CLI parameter in **[netlab create](netlab/create.md)** or **[netlab up](netlab/up.md)** commands.

The **plugin** and **defaults.plugin** values can also be dictionaries. The dictionary keys are plugin names; _netlab_ skips the plugins with the value set to **False** and converts the dictionary into a list of plugin names. Use dictionaries to add plugins with environment variables or CLI settings without overwriting the plugins specified elsewhere, for example:
Expand Down
2 changes: 1 addition & 1 deletion docs/prefix.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ However, there are scenarios in which you have to use the same prefix in multipl

You can use *named IP prefixes* in all three scenarios. The named prefixes are defined in the top-level **prefix** dictionary. The dictionary keys are prefix names; the values are dictionaries defining individual prefixes. The prefix values can include **ipv4**, **ipv6**, **pool** and **[allocation](addr-allocation)** attributes.

The **pool** attribute in a prefix can be used when you want a well-defined prefix but don't want to specify IPv4 and IPv6 subnets. The prefix will be allocated from the specified pool on first use.
The **pool** attribute in a prefix can be used when you want a well-defined prefix but don't want to specify IPv4 and IPv6 subnets. The prefix will be allocated from the specified pool on first use. The pool must be defined in the [**addressing**](address-pool-specs) dictionary.

You can use the names of the *named prefixes* anywhere you would use an IPv4 or IPv6 prefix, for example, as a **links.prefix** value or as a **vlans._vlan_.prefix** value. You can also use them in [custom configuration templates](custom-config-templates.md).

Expand Down
6 changes: 4 additions & 2 deletions netsim/augment/addressing.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,8 @@ def get_pool_prefix(pools: Box, p: str, n: typing.Optional[int] = None) -> Box:
f'Ran out of {af} prefixes in {p} pool' +
(' (use --debug addr CLI argument to get more details)' if not log.debug_active('addr') else ''),
log.MissingValue,
'addressing')
'addressing',
doc_url='addressing/#address-pool-specs')

if log.debug_active('addressing'):
print(f'get_pool_prefix: {p} => {prefixes}')
Expand Down Expand Up @@ -328,7 +329,8 @@ def evaluate_named_prefix(topology: Box, pname: str) -> Box:
log.error(
f'Named prefix {pname} references an unknown pool {pool_name}',
category=log.IncorrectValue,
module='addressing')
module='addressing',
doc_url='prefix/#named-prefixes')
return get_empty_box()

pool_pfx = get_pool_prefix(topology.pools,pool_name)
Expand Down
3 changes: 2 additions & 1 deletion netsim/augment/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,8 @@ def init(topology: Box) -> None:
f"Cannot find plugin {pname}",
more_data = f"Search path:\n{strings.get_yaml_string(topology.defaults.paths.plugin)}",
category=log.IncorrectValue,
module='plugin')
module='plugin',
doc_url='plugins/#topo-plugins-use')

if load_error: # Skip the rest of the code on error as it might crash
return # ... due to discrepancy between lists of plugin names and loaded plugins
Expand Down
24 changes: 16 additions & 8 deletions netsim/modules/bgp.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ def check_bgp_parameters(node: Box, topology: Box) -> None:
log.error(
f"Node {node.name} has BGP enabled but no AS number specified",
log.MissingValue,
'bgp')
'bgp',
doc_url='module/bgp/#bgp-node-params')
return

must_be_asn(parent=node,key='bgp.as',path=f'nodes.{node.name}',module='bgp')
Expand Down Expand Up @@ -727,7 +728,8 @@ def expand_element(as_data: Box, asn: str, e_name: str) -> list:
log.error(
text=f"BGP module supports at most 1 AS per node; {n} is already member of {node_data[n]['as']} and cannot also be part of {asn}",
category=log.IncorrectValue,
module='bgp')
module='bgp',
doc_url='module/bgp/#bgp-aslist')
continue
node_data[n]["as"] = asn

Expand All @@ -739,7 +741,8 @@ def expand_element(as_data: Box, asn: str, e_name: str) -> list:
log.error(
text=f"Node {n} is specified as route reflector in AS {asn} but is not in member list",
category=log.IncorrectValue,
module='bgp')
module='bgp',
doc_url='module/bgp/#bgp-aslist')
continue
node_data[n].rr = True

Expand All @@ -750,7 +753,8 @@ def expand_element(as_data: Box, asn: str, e_name: str) -> list:
log.error(
text=f'Node {node.name} has AS {node_as} but is also in member list of AS {node_data[node.name]["as"]}',
category=log.IncorrectValue,
module='bgp')
module='bgp',
doc_url='module/bgp/#bgp-aslist')
continue

node.bgp = node_data[name] + node.bgp
Expand All @@ -769,14 +773,16 @@ def check_confederation_data(topology: Box) -> None:
log.error(
f'Confederation AS {c_asn} needs at least one member ASN',
category=log.MissingValue,
module='bgp')
module='bgp',
doc_url='module/bgp/#bgp-confederations')
for cm_asn in c_data.members:
if cm_asn in rev_map:
log.error(
f'Confederation member {cm_asn} is in confederations {c_asn} and {rev_map[cm_asn]}',
more_hints="While that's a valid BGP design, netlab does not support it",
category=log.IncorrectValue,
module='bgp')
module='bgp',
doc_url='module/bgp/#bgp-confederations')
Comment thread
ipspace marked this conversation as resolved.
Resolved
rev_map[cm_asn] = c_asn
if cm_asn in bgp_confed:
log.error(
Expand All @@ -793,7 +799,8 @@ def check_confederation_data(topology: Box) -> None:
f'Node {ndata.name} is using confederation ASN {n_as}',
more_hints='BGP speakers can use only confederation member ASNs, not the confederation ASN',
category=log.IncorrectValue,
module='bgp')
module='bgp',
doc_url='module/bgp/#bgp-confederations')
if n_as not in rev_map:
continue

Expand Down Expand Up @@ -831,7 +838,8 @@ def bgp_transform_community_list(node: Box, topology: Box) -> None:
f"Invalid {s_type} BGP community propagation keyword '{kw}' for device {node.device}/node {node.name}",
category=log.IncorrectValue,
module='bgp',
more_hints=[ f"Valid values are {','.join(kw_xform.keys())}" ])
more_hints=[ f"Valid values are {','.join(kw_xform.keys())}" ],
doc_url='module/bgp/#bgp-community-propagation')

for i_kw in BGP_INHERIT_COMMUNITY: # Finally, set up the missing community propagation values
if i_kw not in clist: # for rare BGP session types
Expand Down
6 changes: 4 additions & 2 deletions netsim/modules/dhcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ def check_protocol_support(node: Box, topology: Box) -> bool:
log.error(
f'Node {node.name} ({device_info}) cannot be a DHCP server',
category=log.IncorrectValue,
module='dhcp')
module='dhcp',
doc_url='module/dhcp/#dhcp-platform')
OK = False

# Iterate over node interface, check whether the device supports configured
Expand Down Expand Up @@ -68,7 +69,8 @@ def check_protocol_support(node: Box, topology: Box) -> bool:
log.error(
f'Node {node.name} ({device_info}) cannot be a DHCP relay',
more_data = f'DHCP relay is used on interface {intf.ifname}/{intf.name})',
category=log.IncorrectValue)
category=log.IncorrectValue,
doc_url='module/dhcp/#dhcp-platform')
OK = False

if isinstance(f_relay,Box):
Expand Down
3 changes: 2 additions & 1 deletion netsim/modules/evpn.py
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,8 @@ def check_node_vrf_bundle(node: Box, topology: Box) -> None:
log.error(
f"'{b_type}'' EVPN bundle service used in VRF {vrf_name} is not supported by device {node.device} (node: {node.name})",
log.IncorrectValue,
'evpn')
'evpn',
doc_url='module/evpn/#evpn-bundle-service')

"""
Check the VLAN RT values -- some devices support only a single import/export RT
Expand Down
9 changes: 6 additions & 3 deletions netsim/modules/routing/static.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,15 +407,17 @@ def check_VRF_static_route(sr_data: Box, node: Box, sr_features: Box) -> bool:
log.error(
f'Device {node.device} (node {node.name}) does not support VRF static routes',
category=log.IncorrectValue,
module='routing')
module='routing',
doc_url='module/routing/#generic-routing-static')
return False

if 'vrf' in sr_data.nexthop:
if not sr_features.get('inter_vrf',False):
log.error(
f'Device {node.device} (node {node.name}) does not support inter-VRF static routes',
category=log.IncorrectValue,
module='routing')
module='routing',
doc_url='module/routing/#generic-routing-static')
return False

if sr_data.nexthop.vrf and sr_data.nexthop.vrf not in node.get('vrfs',{}):
Expand Down Expand Up @@ -526,7 +528,8 @@ def augment_pfx_data(sr_data: Box, af_info: dict) -> None:
log.error(
f'Device {node.device} (node {node.name}) does not support discard static routes',
category=log.IncorrectAttr,
module='routing')
module='routing',
doc_url='module/routing/#generic-routing-static')
else:
log.error(
f'A static route for {",".join(sr_data[af])} on node {node.name} has no {af} next hop',
Expand Down
6 changes: 4 additions & 2 deletions netsim/modules/vrf.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ def validate_vrf_loopback(vname: str,vdata: Box,obj: Box,topology: Box) -> None:
log.error(f'IP prefix for VRF loopbacks can only be specified in node VRF data (found in global VRF {vname})',
more_hints=[ 'Use pool attribute or specify the VRF loopback ipv4/ipv6 address in the node VRF data'],
category=log.IncorrectAttr,
module='vrf')
module='vrf',
doc_url='module/vrf/#vrf-loopback')

obj_path = f'vrfs.{vname}' if obj is topology else f'nodes.{obj.name}.vrfs.{vname}'
validate_attributes(
Expand Down Expand Up @@ -250,7 +251,8 @@ def set_vrf_ids(obj: Box, topology: Box) -> None:
if not asn:
log.error(f'Need a usable vrf.as or bgp.as to create auto-generated VRF RD for {vname} in {obj_name}',
log.MissingValue,
'vrf')
'vrf',
doc_url='module/vrf/#default-vrf-values')
return
set_vrf_auto_id(vdata,get_next_vrf_id(asn))

Expand Down
3 changes: 2 additions & 1 deletion netsim/providers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,8 @@ def add_default_config_mode(node: Box, topology: Box) -> bool:
log.error(
f'Configuration mode {cfg_mode} is not valid for device {node.device} (node {node.name})',
module='config',
category=log.IncorrectValue)
category=log.IncorrectValue,
doc_url='platforms/#platform-config-mode')
return False

# Get what's already been processed and the list of configuration snippets. That list
Expand Down
1 change: 1 addition & 0 deletions tests/errors/addr-pool-overload.log
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
MissingValue in addressing: Ran out of ipv4 prefixes in lan pool (use --debug addr CLI argument to get more details)
... See also: https://netlab.tools/addressing/#address-pool-specs
Fatal error in netlab: Cannot proceed beyond this point due to errors, exiting
1 change: 1 addition & 0 deletions tests/errors/bgp-as-list-semantics.log
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
IncorrectType in groups: Wildcard expression x* used in bgp.as_list.65003 group members does not match anything
IncorrectValue in bgp: BGP module supports at most 1 AS per node; r1 is already member of 65001 and cannot also be part of 65003
... See also: https://netlab.tools/module/bgp/#bgp-aslist
IncorrectValue in bgp: Node r1 is specified as route reflector in AS 65003 but is not in member list
IncorrectValue in bgp: Node a1 is specified as route reflector in AS 65003 but is not in member list
IncorrectValue in bgp: Node a2 is specified as route reflector in AS 65003 but is not in member list
Expand Down
1 change: 1 addition & 0 deletions tests/errors/bgp-community-kw.log
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
IncorrectValue in bgp: Invalid ibgp BGP community propagation keyword 'large' for device iosv/node r3
... Valid values are standard,extended
... See also: https://netlab.tools/module/bgp/#bgp-community-propagation
Fatal error in netlab: Cannot proceed beyond this point due to errors, exiting
1 change: 1 addition & 0 deletions tests/errors/bgp-confed.log
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
IncorrectValue in bgp: Confederation member AS 65001 (part of AS 65000) is itself also a confederation AS
IncorrectValue in bgp: Confederation member 65002 is in confederations 65001 and 65000
... While that's a valid BGP design, netlab does not support it
... See also: https://netlab.tools/module/bgp/#bgp-confederations
MissingValue in bgp: Confederation AS 65100 needs at least one member ASN
IncorrectValue in bgp: Node r1 is using confederation ASN 65000
... BGP speakers can use only confederation member ASNs, not the confederation ASN
Expand Down
1 change: 1 addition & 0 deletions tests/errors/rp-static-vrf.log
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
IncorrectValue in routing: Device none (node r1) does not support VRF static routes
... See also: https://netlab.tools/module/routing/#generic-routing-static
IncorrectValue in routing: Static route "10.0.0.0/8" in node r1 refers to VRF blue which is not defined
IncorrectValue in routing: Device none (node r1) does not support inter-VRF static routes
IncorrectValue in routing: Next hop r1 for static route "0.0.0.0/0" is connected to node r2 but not in VRF blue
Expand Down
1 change: 1 addition & 0 deletions tests/errors/vrf-invalid-lb.log
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
IncorrectAttr in vrf: IP prefix for VRF loopbacks can only be specified in node VRF data (found in global VRF green)
... Use pool attribute or specify the VRF loopback ipv4/ipv6 address in the node VRF data
... See also: https://netlab.tools/module/vrf/#vrf-loopback
IncorrectAttr in vrf: vrfs.green.loopback uses an attribute from module ospf which is not enabled in topology
IncorrectAttr in vrf: IP prefix for VRF loopbacks can only be specified in node VRF data (found in global VRF yellow)
IncorrectAttr in vrf: nodes.r1.vrfs.blue.loopback uses an attribute from module ospf which is not enabled in nodes.r1
Expand Down
1 change: 1 addition & 0 deletions tests/errors/vrf-loopback-global.log
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
IncorrectAttr in vrf: IP prefix for VRF loopbacks can only be specified in node VRF data (found in global VRF blue)
... Use pool attribute or specify the VRF loopback ipv4/ipv6 address in the node VRF data
... See also: https://netlab.tools/module/vrf/#vrf-loopback
Fatal error in netlab: Cannot proceed beyond this point due to errors, exiting