Skip to content

Commit

Permalink
set attr from interfaces.yml (#96)
Browse files Browse the repository at this point in the history
* set attr from interfaces.yml

* add examples in yml

* fixing manufacturer name

* fixes

---------

Co-authored-by: obedouet <[email protected]>
  • Loading branch information
obedouet and obedouet authored Mar 29, 2024
1 parent eb5ef1a commit 5d3bc30
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/netbox_initializers/initializers/interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ def load_data(self):

if created:
print(f"🧷 Created interface {interface} on {interface.device}")
else:
for name in defaults:
setattr(interface, name, defaults[name])
interface.save()

self.set_custom_fields_values(interface, custom_field_data)
self.set_tags(interface, tags)
Expand Down
8 changes: 8 additions & 0 deletions src/netbox_initializers/initializers/yaml/device_types.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@
# u_height: 0
# custom_field_data:
# text_field: Description
# - model: TOR-8P
# manufacturer: No Name
# part_number: vlab-eos
# slug: tor-8p
# interfaces:
# - name: Ethernet1
# type: 1000base-t
# description: UPLINK
# - model: Other
# manufacturer: No Name
# slug: other
Expand Down
6 changes: 6 additions & 0 deletions src/netbox_initializers/initializers/yaml/devices.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,9 @@
# custom_field_data:
# text_field: Description
#
## Templated device
# - name: gns3-tor
# device_role: switch
# device_type: TOR-8P
# site: SING 1
# rack: rack-03
5 changes: 5 additions & 0 deletions src/netbox_initializers/initializers/yaml/interfaces.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,8 @@
# enabled: true
# type: virtual
# name: loopback

## Example to add attributes on a templated interface
# - name: Ethernet1
# mtu: 9100
# device: gns3-tor

0 comments on commit 5d3bc30

Please sign in to comment.