Skip to content

Commit 1529285

Browse files
authored
Add support level information to 'netlab show devices' (#2540)
1 parent 9c72515 commit 1529285

File tree

16 files changed

+98
-18
lines changed

16 files changed

+98
-18
lines changed

docs/platforms.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ The support level of a platform is defined as:
6161

6262
[^WTLTB]: Particularly on platforms that take way too long to boot, like Cisco IOS XR. We're all forced to deal with a limited lifespan.
6363

64+
```{tip}
65+
Use **netlab show devices** to display the up-to-date device list and device support levels.
66+
```
67+
6468
(platform-host)=
6569
Most devices behave as routers (or layer-3 switches); the following devices can take multiple roles or behave as [IP hosts](node-router-host):
6670

netsim/cli/show_commands/devices.py

Lines changed: 51 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,50 @@ def parse() -> argparse.ArgumentParser:
1414
parser_add_device(parser)
1515
return parser
1616

17-
def show(settings: Box, args: argparse.Namespace) -> None:
18-
heading = ['device','description']
17+
def print_result_table(result: Box, settings: Box) -> None:
18+
19+
device_rows = []
20+
daemon_rows = []
21+
caveat_rows = []
22+
support_level = data.get_empty_box()
23+
24+
heading = ['device','description','support level']
25+
for d_name in sorted(list(result)):
26+
d_data = result[d_name]
27+
support_text = d_data.get('support.level','✅') + (' ❗' if d_data.get('support.caveats') else '')
28+
row = [ d_name, d_data.description, support_text.center(len(heading[2])) ]
29+
d_support = d_data.get('support.level',None)
30+
if d_support:
31+
support_level[d_support] = True
32+
d_caveat = d_data.get('support.caveats',[])
33+
if d_caveat:
34+
caveat_rows.extend(d_caveat if isinstance(d_caveat,list) else [ d_caveat ])
35+
36+
if d_data.get('daemon',False):
37+
daemon_rows.append(row)
38+
else:
39+
device_rows.append(row)
40+
41+
if device_rows:
42+
strings.print_colored_text('Virtual network devices supported by netlab\n\n',color='bold')
43+
strings.print_table(heading,device_rows,inter_row_line=False)
1944

20-
rows = []
45+
if daemon_rows:
46+
strings.print_colored_text('\nNetworking daemons supported by netlab\n\n',color='bold')
47+
heading[1] = 'daemon'
48+
strings.print_table(heading,daemon_rows,inter_row_line=False)
49+
50+
if support_level:
51+
strings.print_colored_text('\nLegend: support levels\n\n',color='bold')
52+
for sl in sorted(list(support_level)):
53+
print(strings.wrap_error_message(f'* {sl}: {settings.hints.support[sl]}',indent=2))
54+
55+
if caveat_rows:
56+
strings.print_colored_text('\nCaveats:\n\n',color='bold')
57+
for cv in caveat_rows:
58+
print(strings.wrap_error_message(f'* {cv}',indent=2))
59+
60+
def show(settings: Box, args: argparse.Namespace) -> None:
2161
result = data.get_empty_box()
2262
for device in sorted(settings.devices.keys()):
2363
dev_data = settings.devices[device]
@@ -27,24 +67,17 @@ def show(settings: Box, args: argparse.Namespace) -> None:
2767
if device != args.device and args.device != '*':
2868
continue
2969

30-
row = [ device,dev_data.description ]
70+
dev_summary = data.get_box({ 'description': dev_data.description })
71+
if 'support' in dev_data:
72+
dev_summary.support = dev_data.support
3173
if dev_data.daemon:
32-
row[1] = {
33-
'daemon': True,
34-
'description': dev_data.description,
35-
'parent': dev_data.daemon_parent
36-
}
37-
rows.append(row)
38-
result[device] = row[1]
74+
dev_summary.daemon = True
75+
dev_summary.parent = dev_data.daemon_parent
76+
77+
result[device] = dev_summary
3978

4079
if args.format == 'table':
41-
print('Virtual network devices supported by netlab')
42-
print("")
43-
strings.print_table(heading,[ r for r in rows if isinstance(r[1],str) ],inter_row_line=False)
44-
daemons = [ [ r[0],r[1]['description']] for r in rows if isinstance(r[1],dict) and r[1]['daemon'] ]
45-
if daemons:
46-
print('\nNetworking daemons supported by netlab\n')
47-
strings.print_table(['daemon','description'],daemons,inter_row_line=False)
80+
print_result_table(result,settings)
4881

4982
elif args.format in ['text','yaml']:
5083
print(strings.get_yaml_string(result))

netsim/defaults/hints.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,3 +77,11 @@ nodes:
7777
Netlab uses the node device type for unmanaged nodes to figure out what
7878
features the node supports. If you're using a device that is not supported
7979
by netlab, set the device type to 'none'.
80+
81+
support:
82+
best-effort:
83+
While a core contributor might still work on the platform, we don't run integration tests
84+
minimal:
85+
Don't expect too much (particularly new functionality)
86+
obsolete:
87+
These platforms are still part of the netlab package because the storage prices keep falling

netsim/devices/asav.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
---
22
description: Cisco ASAv
3+
support:
4+
level: minimal
35
interface_name: GigabitEthernet0/{ifindex}
46
ifindex_offset: 0
57
mgmt_if: Management0/0

netsim/devices/cumulus.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
---
22
description: Cumulus VX 4.x or 5.x configured without NVUE
3+
support:
4+
level: obsolete
5+
caveats:
6+
- The last Cumulus 4.x image was released in September 2022
37
interface_name: swp{ifindex}
48
loopback_interface_name: lo{ifindex if ifindex else ""}
59
tunnel_interface_name: "tun{ifindex}"

netsim/devices/cumulus_nvue.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
description: Cumulus VX 5.x configured with NVUE
2+
support:
3+
level: minimal
4+
caveats:
5+
- The new Cumulus 5.x releases run only on NVIDIA air. The last public release was 5.10.0 from September 2024
26
interface_name: swp{ifindex}
37
lag_interface_name: "bond{lag.ifindex}"
48
#

netsim/devices/fortios.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
description: Fortinet FortiOS firewall
2+
support:
3+
level: minimal
4+
caveats:
5+
- We don't test Fortinet configurations due to their ridiculous temporary licensing policy
26
interface_name: port{ifindex}
37
loopback_interface_name: loopback{ifindex}
48
loopback: false

netsim/devices/iosxr.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
---
22
description: Cisco IOS XRv
3+
support:
4+
level: minimal
35
mgmt_if: MgmtEth0/RP0/CPU0/0
46
interface_name: GigabitEthernet0/0/0/{ifindex}
57
loopback_interface_name: Loopback{ifindex}

netsim/devices/nxos.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
---
22
description: Cisco Nexus 9300v
3+
support:
4+
level: best-effort
35
interface_name: Ethernet1/{ifindex}
46
mgmt_if: mgmt0
57
loopback_interface_name: loopback{ifindex}

netsim/devices/openbsd.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
description: OpenBSD
2+
support:
3+
level: best-effort
24
interface_name: vio{ifindex}
35
loopback_interface_name: lo{ifindex}
46
ifindex_offset: 1

0 commit comments

Comments
 (0)