4

this is a part of the configuration of Juniper Router, it stands the vlans:

     family inet {
                address 3.189.239.238/29;
                address 3.189.239.254/28;
            }
        }
        unit 472 {
            vlan-id 472;
            family inet;
        }
        unit 473 {
            vlan-id 473;
            family inet;
        }
        unit 474 {
            vlan-id 474;
            family inet {
                address 3.57.110.6/29;
            }
---(more 54%)---

        }
        unit 475 {
            vlan-id 475;
            family inet {
                address 3.57.110.14/29;
            }
        }
        unit 476 {
            vlan-id 476;
            family inet {
                address 3.57.110.22/29;
            }
        }
        unit 480 {
            vlan-id 480;
            family inet {
                address 1.246.212.14/28;
            }

how can it provide like a API out? then I can get all the vlan information from a website.

is there any way like SNMP protocol to provide the vlan information?

1 Answer 1

6

There are a number of ways to do this.

You can do a 'show configuration | display xml' to get an XML output from the router.

Another, probably better option would be to use netconf, which uses the XML representation mentioned before.

If you want to use an API, I suggest you check out PyEZ, a python library which allows you to communicate with a Juniper device using netconf. It offers some nice abstractions which makes scripting easier.

Another possibility, if you're mostly looking for configuration management tooling, could be Ansible. Juniper has some nice Ansible modules available.

Personally, I wouldn't invest in doing things with SNMP unless I really had to these days (and even then I'd probably refuse ;-)). There are many better options available.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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