Skip to content

Commit fe65482

Browse files
authored
Add 'debug at startup' capability for IOS and FRR (#2550)
Adds device-specific attributes (ios.debug, frr.debug) that enable debugging at the beginning of initial device configuration. The debugging attribute (global or per-node) can be a list of debugging options or a multi-line string.
1 parent 4d4e0c0 commit fe65482

File tree

8 files changed

+66
-0
lines changed

8 files changed

+66
-0
lines changed

docs/caveats.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ These caveats are common to all Cisco IOS/IOS-XE platforms:
123123
* Cisco IOS does not support passive interfaces in RIPng.
124124
* Cisco IOS requires a *default metric* when redistributing routes into RIPv2. The RIPv2 configuration template sets the default metric to the value of the **netlab_ripv2_default_metric** node parameter (default: 5)
125125
* Cisco IOS behaves like an awful IP host from the 1980s with the **no ip routing** configuration; it does not use static routes and relies only on the **ip default-gateway**. IPv4 routing is thus enabled even when a Cisco IOS device has **role** set to *host*.
126+
* You can use the **ios.debug** global- or node attribute to [enable debugging](node-debug-attribute) during the initial device configuration.
126127

127128
These caveats apply only to Cisco IOSv and IOSvL2
128129

@@ -314,6 +315,7 @@ diag debug application httpsd -1
314315
* IPv6 L3VPN over SRv6 does not work in parallel with the IPv6 AF. You have to disable the IPv6 AF on IPv6 IBGP sessions with **bgp.activate.ipv6: []**.
315316
* An OSPFv3 ABR running FRR release 10.3 does not originate summary external routes from NSSA areas
316317
* FRR has no default logging destinations. The initial device configuration adds file logging to `/tmp/logging`.
318+
* You can use the **frr.debug** global- or node attribute to [enable debugging](node-debug-attribute) during the initial device configuration.
317319

318320
(caveats-junos)=
319321
## Common Junos caveats

docs/node/debug.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,27 @@ You can enable debugging *before* configuring network devices with this simple t
3636
```{warning}
3737
Some devices (for example, Arista EOS) accept debugging commands only after the corresponding control-plane protocol has been configured, making the above approach a non-starter.
3838
```
39+
40+
(node-debug-attribute)=
41+
## Device-Specific Debugging Attributes
42+
43+
Finally, you might be worried that the symptoms you're experiencing depend on the time after the device boots, so you want to enable debugging as soon as possible. In that case, you can use the device-specific **debug** attribute (on [devices for which we implemented it](platform-initial-extra)), which is a list of debugging parameters that will be executed at the very beginning of the initial device configuration.
44+
45+
**Caveats:**
46+
47+
* The contents of the **_device_.debug** attribute are device-specific. *netlab* currently does not have multi-vendor **debug** capabilites.
48+
* The values of the **_device_.debug** attribute are not checked. They must be relevant to the underlying network device, or you'll get configuration errors during the initial configuration
49+
* The initial device configuration template supplies the mandatory prefix (for example, **do debug**). You only have to list the debugging conditions, for example:
50+
51+
```
52+
nodes:
53+
dut:
54+
module: [ bgp, ospf, routing ]
55+
bgp.as: 65000
56+
device: iol
57+
ios.debug:
58+
- ip routing
59+
- bgp ipv4 unicast updates
60+
frr.debug:
61+
- bgp updates
62+
```

docs/platforms.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,16 @@ The following interface addresses are supported on various platforms:
283283
* See [Initial Configuration Integration Tests Results](https://release.netlab.tools/_html/coverage.initial) for up-to-date details.
284284
```
285285

286+
(platform-initial-extra)=
287+
Some platforms can enable additional functionality during the initial device configuration:
288+
289+
| Operating system | [Debugging<br>attribute](node-debug-attribute)[^GNDA] |
290+
|------------------|:-:|
291+
| Cisco IOS/IOS XE[^18v]| **ios.debug** |
292+
| FRRouting | **frr.debug** |
293+
294+
[^GNDA]: The debugging attribute can be specified for a single node or globally, in which case the debugging is activated on all nodes using the specified device.
295+
286296
## Supported Configuration Modules
287297

288298
(platform-routing-support)=
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{% macro enable_debugging(debug,prefix) %}
2+
{% for dbg in debug|default([]) if dbg %}
3+
{% if loop.first %}
4+
!
5+
! Enable debugging
6+
{% endif %}
7+
{{ prefix }} {{ dbg }}
8+
{% endfor %}
9+
{% endmacro %}

netsim/ansible/templates/initial/frr.j2

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,8 @@ cat >/tmp/config <<CONFIG
130130
hostname {{ inventory_hostname }}
131131
!
132132
log file /tmp/logging
133+
{% from '_debug_commands.j2' import enable_debugging %}
134+
{{ enable_debugging(frr.debug,prefix='debug') }}
133135
!
134136
{#
135137
These commands set the corresponding net.ipv4 / net.ipv6 variables.

netsim/ansible/templates/initial/ios.j2

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
hostname {{ inventory_hostname }}
22
!
33
no ip domain lookup
4+
logging buffered 256000
5+
{% from '_debug_commands.j2' import enable_debugging %}
6+
{{ enable_debugging(ios.debug,prefix='do debug') }}
47
!
58
lldp run
69
!

netsim/devices/frr.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,3 +152,11 @@ features:
152152
vtep6: true
153153

154154
graphite.icon: router
155+
156+
attributes:
157+
global:
158+
frr:
159+
debug: { type: list, split_lines: True }
160+
node:
161+
frr:
162+
debug: { type: list, split_lines: True }

netsim/devices/ios.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22
description: Generic Cisco IOS device (meta device, used only as parent)
33
_meta_device: True
44
template: True
5+
attributes:
6+
global:
7+
ios:
8+
debug: { type: list, split_lines: True }
9+
node:
10+
ios:
11+
debug: { type: list, split_lines: True }
12+
513
loopback_interface_name: Loopback{ifindex}
614
tunnel_interface_name: Tunnel{ifindex}
715
group_vars:

0 commit comments

Comments
 (0)