Skip to content

Commit e5c0726

Browse files
committed
Fix: Skip all meta-devices when displaying device/module support
1 parent f3e1f1d commit e5c0726

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

netsim/cli/show.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from ..utils import log
1313
from ..utils import read as _read
1414
from .help import print_usage
15+
from .show_commands import DEVICES_TO_SKIP, show_common_parser
1516
from .show_commands import attributes as _attributes
1617
from .show_commands import defaults as _defaults
1718
from .show_commands import devices as _devices
@@ -21,7 +22,6 @@
2122
from .show_commands import outputs as _outputs
2223
from .show_commands import providers as _providers
2324
from .show_commands import reports as _reports
24-
from .show_commands import show_common_parser
2525

2626
show_dispatch: dict = {
2727
'images': {
@@ -99,13 +99,16 @@ def run(cli_args: typing.List[str]) -> None:
9999
user_defaults: typing.Optional[list] = [] if 'system' in args and args.system else None
100100
topology = _read.load(empty_file,user_defaults=user_defaults)
101101

102+
# Skip meta devices when displaying device/module support
103+
DEVICES_TO_SKIP.extend(
104+
[dname for dname in topology.defaults.devices if '_meta_device' in topology.defaults.devices[dname]])
105+
102106
if topology is None:
103107
log.fatal("Cannot read system settings")
104108
return
105109

106110
log.init_log_system(False)
107111
topology.name = 'empty'
108-
# topology.nodes = data.get_empty_box()
109112
topology.nodes.dummy.device = 'none' # Add a dummy node
110113
topology.nodes.dummy.module = [] # ... and disable all modules on that node
111114
if 'plugin' in args and args.plugin:
@@ -117,4 +120,5 @@ def run(cli_args: typing.List[str]) -> None:
117120

118121
main.transform_setup(topology)
119122
settings = topology.defaults
123+
120124
show_dispatch[args.action]['exec'](settings,args)

netsim/cli/show_commands/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@
33
#
44

55
import argparse
6+
import typing
67

78
from box import Box
89

910
from ...utils import log
1011

11-
DEVICES_TO_SKIP = ['none','unknown']
12+
DEVICES_TO_SKIP: typing.List[str] = []
1213

1314
def parser_add_device(parser: argparse.ArgumentParser) -> None:
1415
parser.add_argument(

0 commit comments

Comments
 (0)