'Juniper to Aruba Commands using Python

I have a set of commands, each from Juniper & Aruba switches, that I would like to automatically convert. Is there a way to use a string of Juniper commands and have them output a string of Aruba commands? If so, how would I approach this using Python? Would I use "if else", python dictionary commands, or some other syntax?

For example:

I have just come up with this script:

def Juniper(sets): print ('host-name', set1) print ('console idle-timeout 600\n' 'console idle-timeout serial-usb 600\n' 'aruba-central disable\n 'igmp lookup-mode ip\n' 'console idle-timeout serial-usb 600\n') print ("logging (system1) oobm") #I AM TRYING TO ADD THE INPUT OF system1 IN BETWEEN LIKE THIS ^ AS SHOWN ABOVE

set1= input('Enter hostname with quotations:\n') system1 = input('Enter system log IP address:') Juniper(set1)

Please let me know how to add an input in between two strings or words



Solution 1:[1]

I would approach simply using show command with display json on juniper side and than use a jinja2 template to build your Aruba config using which dynamic data you want from juniper output and yes you can do all in python from extracting data from device till the convertion. Extracting data from device you can use scrapli nornir and than use the result as data for render with jinja template.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 as path prepend