11-30-2011 11:35 PM
11-30-2011 11:56 PM
12-01-2011 10:32 AM
Mattia wrote:
If you want to see the XML version of the output of operational and configuration commands, use the "| display xml" command.
Adding to Mattia's comment...you (Luca) may take a look at this Junos XML overview page
thanks,
roy
12-28-2011 08:12 AM
I am currently working on a .net application for NETCONF for us windows folks ![]()
Any particular feature your looking for?
03-02-2012 11:40 AM
The easiest way to experiment with the XML API is by using the CLI.
To find the RPC for any command use the "| display xml rpc" pipe and to see the resulting XML output, use the " | display xml" pipe:
phil@test> show ospf neighbor 10.5.10.2 detail Address Interface State ID Pri Dead 10.5.10.2 fe-0/0/1.0 Full 10.254.254.103 128 34 Area 0.0.0.0, opt 0x42, DR 10.5.10.2, BDR 10.5.10.1 Up 13w3d 03:35:32, adjacent 13w3d 03:35:13 phil@test> show ospf neighbor 10.5.10.2 detail | display xml rpc <rpc-reply xmlns:junos="http://xml.juniper.net/junos/11.4I0/junos"> <rpc> <get-ospf-neighbor-information> <detail/> <neighbor>10.5.10.2</neighbor> </get-ospf-neighbor-information> </rpc> <cli> <banner></banner> </cli> </rpc-reply> phil@test> show ospf neighbor 10.5.10.2 detail | display xml <rpc-reply xmlns:junos="http://xml.juniper.net/junos/11.4I0/junos"> <ospf-neighbor-information xmlns="http://xml.juniper.net/junos/11.4I0/junos-routing"> <ospf-neighbor> <neighbor-address>10.5.10.2</neighbor-address> <interface-name>fe-0/0/1.0</interface-name> <ospf-neighbor-state>Full</ospf-neighbor-state> <neighbor-id>10.254.254.103</neighbor-id> <neighbor-priority>128</neighbor-priority> <activity-timer>33</activity-timer> <ospf-area>0.0.0.0</ospf-area> <options>0x42</options> <dr-address>10.5.10.2</dr-address> <bdr-address>10.5.10.1</bdr-address> <neighbor-up-time junos:seconds="8134542"> 13w3d 03:35:42 </neighbor-up-time> <neighbor-adjacency-time junos:seconds="8134523"> 13w3d 03:35:23 </neighbor-adjacency-time> </ospf-neighbor> </ospf-neighbor-information> <cli> <banner></banner> </cli> </rpc-reply> phil@test>
Then you can make a script to perform the RPC as needed for testing:
version 1.0; ns jcs = "http://xml.juniper.net/junos/commit-scripts/1.0"; import "../import/junos.xsl"; match / { <op-script-results> { var $rpc = <get-ospf-neighbor-information> { <detail>; <neighbor> "10.5.10.2"; } var $res = jcs:invoke($rpc); <output> $res/ospf-neighbor/neighbor-address _ " is in state " _ $res/ospf-neighbor/ospf-neighbor-state; } }