How can I retrieve a configuration programmatically on a JunOS device?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP












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?










share
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?










share
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
improve this question
















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?







router juniper juniper-junos






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 26 at 15:26









Teun Vink

11.6k53053




11.6k53053










asked Jan 26 at 14:37









244boy244boy

3358




3358




















      1 Answer
      1






      active

      oldest

      votes


















      5














      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.






      share|improve this answer






















        Your Answer








        StackExchange.ready(function()
        var channelOptions =
        tags: "".split(" "),
        id: "496"
        ;
        initTagRenderer("".split(" "), "".split(" "), channelOptions);

        StackExchange.using("externalEditor", function()
        // Have to fire editor after snippets, if snippets enabled
        if (StackExchange.settings.snippets.snippetsEnabled)
        StackExchange.using("snippets", function()
        createEditor();
        );

        else
        createEditor();

        );

        function createEditor()
        StackExchange.prepareEditor(
        heartbeatType: 'answer',
        autoActivateHeartbeat: false,
        convertImagesToLinks: false,
        noModals: true,
        showLowRepImageUploadWarning: true,
        reputationToPostImages: null,
        bindNavPrevention: true,
        postfix: "",
        imageUploader:
        brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
        contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
        allowUrls: true
        ,
        noCode: true, onDemand: true,
        discardSelector: ".discard-answer"
        ,immediatelyShowMarkdownHelp:true
        );



        );













        draft saved

        draft discarded


















        StackExchange.ready(
        function ()
        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fnetworkengineering.stackexchange.com%2fquestions%2f56405%2fhow-can-i-retrieve-a-configuration-programmatically-on-a-junos-device%23new-answer', 'question_page');

        );

        Post as a guest















        Required, but never shown

























        1 Answer
        1






        active

        oldest

        votes








        1 Answer
        1






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes









        5














        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.






        share|improve this answer



























          5














          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.






          share|improve this answer

























            5












            5








            5







            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.






            share|improve this answer













            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.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Jan 26 at 15:20









            Teun VinkTeun Vink

            11.6k53053




            11.6k53053



























                draft saved

                draft discarded
















































                Thanks for contributing an answer to Network Engineering Stack Exchange!


                • Please be sure to answer the question. Provide details and share your research!

                But avoid


                • Asking for help, clarification, or responding to other answers.

                • Making statements based on opinion; back them up with references or personal experience.

                To learn more, see our tips on writing great answers.




                draft saved


                draft discarded














                StackExchange.ready(
                function ()
                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fnetworkengineering.stackexchange.com%2fquestions%2f56405%2fhow-can-i-retrieve-a-configuration-programmatically-on-a-junos-device%23new-answer', 'question_page');

                );

                Post as a guest















                Required, but never shown





















































                Required, but never shown














                Required, but never shown












                Required, but never shown







                Required, but never shown

































                Required, but never shown














                Required, but never shown












                Required, but never shown







                Required, but never shown






                Popular posts from this blog

                How to check contact read email or not when send email to Individual?

                Bahrain

                Postfix configuration issue with fips on centos 7; mailgun relay