Automation

last person joined: 3 days ago 

Ask questions and share experiences about Apstra, Paragon, and all things network automation.
  • 1.  File copy via netconf

    Posted 02-13-2017 04:31

    Hi together,

     

    could anyone help me with a small issue.

    I would like to copy a file from my FTP server to a Junos Switch using NETCONF. This file is not a config.

     

    Have anyone any idea, how I could do that?

     

    Thanks!

     

     



  • 2.  RE: File copy via netconf
    Best Answer

    Posted 02-14-2017 04:17

    I found the solution:

     

    <rpc>
    <file-copy>
    <source>ftp://1.1.1.1/jinstall-ex-2200-14.1X53-D40.8-domestic-signed.tgz</source>
    <destination>/var/tmp</destination>
    </file-copy>
    </rpc>



  • 3.  RE: File copy via netconf

     
    Posted 02-14-2017 04:49

    In this instance, I would use the RPC file-copy to transfer the file to the switch.

     

     

    <rpc>
        <file-copy>
            <source>source</source> <!-- mandatory -->
            <destination>destination</destination> <!-- mandatory -->
            <source-address>source-address</source-address>
        </file-copy>
    </rpc>

     

     

    source: URL of source file

    destination: URL of destination file

    source-address: Local address to use in originating the connection

     

    e.g. a source URL could be:   

    ftp://fred:passwd@mary/ftpDir/scripts/autocfg.slax /var/db/scripts/autocfg.slax

     

     

    <!-- No zombies were killed during the creation of this user interface -->
    <!-- user space, class j-super-user -->
    <hello>
      <capabilities>
        <capability>urn:ietf:params:xml:ns:netconf:base:1.0</capability>
        <capability>urn:ietf:params:xml:ns:netconf:capability:candidate:1.0</capability>
        <capability>urn:ietf:params:xml:ns:netconf:capability:confirmed-commit:1.0</capability>
        <capability>urn:ietf:params:xml:ns:netconf:capability:validate:1.0</capability>
        <capability>urn:ietf:params:xml:ns:netconf:capability:url:1.0?protocol=http,ftp,file</capability>
        <capability>http://xml.juniper.net/netconf/junos/1.0</capability>
        <capability>http://xml.juniper.net/dmi/system/1.0</capability>
      </capabilities>
      <session-id>5407</session-id>
    </hello>
    ]]>]]>
    <rpc><file-copy><source>ftp://ops:mypass@192.168.0.10/scripts/foo.slax</source><destination>/var/db/scripts/op/foo.slax</destination></file-copy></rpc>
    <rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:junos="http://xml.juniper.net/junos/12.1X46/junos">
    </rpc-reply>
    ]]>]]>
    <rpc><close-session/></rpc>
    <rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:junos="http://xml.juniper.net/junos/12.1X46/junos">
    <ok/>
    </rpc-reply>
    ]]>]]>
    <!-- session end at 2017-02-14 12:20:01 UTC -->
    

    I hope that this helps.

     

    Regards,

    Andy