Using edit-config /copy-config to write a xml config file into Juniper
<p>I am trying to push a configuration file in XML string format into a router using edit-config/copy-config but the Juniper does not take into effect the new configuration.
Here is a method that I wrote and in this method, config is the configuration file.</p>

<pre><code>def edit_configuration(self,config,channel):
    while True:
        data = ''
        data += channel.recv(1024)
        if data.find(']]&gt;]]&gt;') != -1:
            break

    edit_config_xml ="""
    &lt;rpc&gt;
        &lt;edit-config&gt;
            &lt;default-operation&gt;replace&lt;/default-operation&gt;
            &lt;config-text&gt;
                &lt;configuration-text&gt;
                    """+config+"""
                &lt;/configuration-text&gt;
            &lt;/config-text&gt;
        &lt;/copy-config&gt;
        &lt;commit/&gt;
    &lt;/rpc&gt;
    ]]&gt;]]&gt;"""

    channel.send(edit_config_xml)

    print " Channel.send done "

    data = ''
    while True:
        data += channel.recv(1024)
        if data.find(']]&gt;]]&gt;') != -1:
            break

    print " Sent Configuration to:", self.Router_IP
</code></pre>
