move to types config

This commit is contained in:
2025-07-05 23:27:52 +00:00
parent 144031bdf6
commit 2b438ae17e
2 changed files with 10 additions and 18 deletions

View File

@ -10,25 +10,10 @@ types:
devices:
asw100:
user: pim
commands:
- show version
- show platform fan-tray
- show platform linecard
- show platform power-supply
- info flat from running
type: srlinux
asw120:
user: pim
commands:
- show version
- show platform fan-tray
- show platform linecard
- show platform power-supply
- info flat from running
type: srlinux
asw121:
user: pim
commands:
- show version
- show platform fan-tray
- show platform linecard
- show platform power-supply
- info flat from running
type: srlinux

View File

@ -183,6 +183,8 @@ def main():
print("No devices found in config file")
sys.exit(1)
types = config.get('types', {})
success_count = 0
total_count = len(devices)
@ -191,6 +193,11 @@ def main():
user = device_config.get('user')
commands = device_config.get('commands', [])
device_type = device_config.get('type')
# If device has a type, get commands from types section
if device_type and device_type in types:
commands = types[device_type].get('commands', [])
if not user:
print(f"No user specified for {hostname}, skipping")