Skip to content

Commit 736edb5

Browse files
authored
Fix: allow output-specific attributes in group node data (#2566)
The list of extra attributes namespaces in groups has been synchronized with the one in nodes. Instead of using hard-coded values, both instances use 'node_extra_ns' attribute value. Closes #2551
1 parent 9b9a8d1 commit 736edb5

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

netsim/augment/groups.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,6 @@ def check_group_data_structure(
119119

120120
list_of_modules = modules.list_of_modules(topology)
121121

122-
# Allow provider- and tool- specific node attributes
123-
extra = get_object_attributes(['providers','tools'],topology)
124-
125122
for grp,gdata in parent.groups.items():
126123
if grp.startswith('_'): # Skip stuff starting with underscore
127124
continue # ... could be system settings
@@ -182,7 +179,8 @@ def validate_group_data(
182179
if 'groups' not in parent:
183180
return
184181

185-
extra = get_object_attributes(['providers','tools'],topology)
182+
# Allow provider-, tool-, and output- specific node attributes
183+
extra = get_object_attributes(topology.defaults.attributes.node_extra_ns,topology)
186184

187185
for grp,gdata in parent.groups.items():
188186
if grp.startswith('_'): # Skip stuff starting with underscore

netsim/augment/nodes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ def create_node_dict(nodes: Box) -> Box:
7575
Validate node attributes
7676
"""
7777
def validate(topology: Box) -> None:
78-
# Allow provider- and tool- specific node attributes
79-
extra = get_object_attributes(['providers','tools','outputs'],topology)
78+
# Allow provider-, tool- and output- specific node attributes
79+
extra = get_object_attributes(topology.defaults.attributes.node_extra_ns,topology)
8080
for n_name,n_data in topology.nodes.items():
8181
must_be_id(
8282
parent=None,

netsim/defaults/attributes.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ interface: # Interface (node-to-link attachment) attributes
8181
ifindex: int
8282
ifname: str
8383

84+
node_extra_ns: [ providers, tools, outputs ]
85+
8486
node:
8587
name: str # Validity of node name is checked in the nodes module
8688
interfaces: list

0 commit comments

Comments
 (0)