Friday, March 11, 2022

howto send rpc cmd via junos and netconf and ssh

 Within junos you can send cmds from a list via netconf . 1st thing you need to looking at  the display xmk rpc  out for the command and then use that in your file


Here's a "show system interface"  in rpc syntax


supports-MacBook-Pro:~ ken$ cat sys

<rpc>

        <get-system-information>

        </get-system-information>

</rpc>



Here's a "show arp"  in rpc syntax


supports-MacBook-Pro:~ ken$ cat arp 

<rpc>

   <get-arp-table-information/>

</rpc>

 

You could easily just pipe the above redirect into via ssh and netconf the juniper device;

supports-MacBook-Pro:~ ken$ 

supports-MacBook-Pro:~ ken$ cat sys arp  | ssh -6  root@2001:1258:727:12::1 -s netconf



The output will be dump back in xml format;


e.g 

<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:junos="http://xml.juniper.net/junos/19.4R3/junos">

<system-information>

<hardware-model>mx104</hardware-model>

<os-name>junos</os-name>

<os-version>19.4R3-S11</os-version>

<serial-number>T623</serial-number>

<host-name>core1.usme</host-name>

</system-information>

</rpc-reply>

]]>]]>

<rpc-reply xmlns="urn

( output snipped ) 









NSE ( network security expert) and Route/Switching Engineer
kfelix  -----a----t---- socpuppets ---dot---com
     ^      ^
=(  @  @ )=

         o
      /      \ 

No comments:

Post a Comment