How can I retrieve a configuration programmatically on a JunOS device?
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
add a comment |
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
add a comment |
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
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
router juniper juniper-junos
edited 4 hours ago
Teun Vink♦
11.3k52952
11.3k52952
asked 5 hours ago
244boy244boy
3288
3288
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
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.
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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.
add a comment |
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.
add a comment |
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.
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.
answered 4 hours ago
Teun Vink♦Teun Vink
11.3k52952
11.3k52952
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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