5

I am trying to change switch configurations from different vendors using python. So far i tested using Netmiko. While these gets the work done but requires device specific commands, which is troublesome. Currently, using ncclient(Netconf) in python eases the process a bit but still device specific parametes has to be explicitly mentioned. As an example, xml to change the hostname of an FS switch:

<config xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
    <system xmlns="urn:fs:params:xml:ns:yang:system">
        <hostname>device-hostname</hostname>
    </system>
</config>

At this moment i don't have access to any other devices that supports Netconf but by looking at different examples on Cisco IOS:

<config>
    <native xmlns="http://cisco.com/ns/yang/Cisco-IOS-XE-native">
        <hostname>device-hostname</hostname>
    </native>
</config>

and JunOS:

<configuration xmlns="http://xml.juniper.net/xnm/1.1/xnm">
    <system>
        <host-name>device-hostname</host-name>
    </system>
</configuration>

i see that settings for specific vendor(or OS) is different.

Is there a universal solution for this or do i have to modify the source code every time i integrate a new device? Basically what i am trying to achieve is changing some basic device and switch interface level configurations through use of a single format(template) for any vendor.

I am quite new to networking and automation stuff, so any kind of hints or suggestions will be helpful. TIA.

2
  • 1
    No, there's no universal solution - sadly. You should create vendor-specific modules that can be used depending on device vendor and possibly series. However, programming is explicitly off-topic here. – Zac67 Apr 6 at 5:43
  • thank you @Zac67. – codeCat Apr 7 at 1:00
4

Is there a universal solution for this or do i have to modify the source code every time i integrate a new device? Basically what i am trying to achieve is changing some basic device and switch interface level configurations through use of a single format(template) for any vendor.

No, there is no such thing. Network device management solutions, such as HPNA, Ansible, etc. all have device specific modules. You will find that even with the same vendor, different devices, and sometimes different OS versions of the same device, use different commands.

2
  • 1
    It's also worth adding concepts like OpenConfig and YANG. These can effectively serve as a "translator" between an automation system that only speaks one language and each independent vendor OS. Your vendor does have to support the proper YANG module for what you are wanting to change, many YANG modules are also standardized by the IETF, but some vendors also allow customized YANG modules. – Jordan Head Apr 6 at 17:18
  • I will have a look at OpenConfig, thank you for the suggestion @JordanHead. – codeCat Apr 7 at 1:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.