Automation

last person joined: yesterday 

Ask questions and share experiences about Apstra, Paragon, and all things network automation.
  • 1.  JUNOScript namespace issue...

    Posted 10-07-2009 17:39

    ###########

    10.254.24.2.xml:2: namespace error : Namespace prefix junos for style on chassis is not defined
    <chassis junos:style="inventory">

    ############

     

    Otherwise, the output looks legitimate.  Is this just a libxml2 issue?  I have tried making this go away by adding xmlns:junos to junos-chassis.dtd (chassis element and attribute definitions), and also to the xsl file for the script in the <xml:template> line for chassis.. still I get this error.  I also added xmlns:junos to the top of the xsl file... still this error occurs.

     

    I'm at a loss here, anyone know why this is happening?



  • 2.  RE: JUNOScript namespace issue...

    Posted 10-07-2009 18:34

    If I slip xmlns:junos into the response from the router before I send the response to xsltproc... then the error goes away.  Still, I would think having this in the DTD or in the xslt:template would be good enough?  I guess not...

     

    Could just be an issue with the parser..

     

     



  • 3.  RE: JUNOScript namespace issue...
    Best Answer

    Posted 10-08-2009 14:29

    Solution:

     

    Open "device.pm"  this is in the JUNOS directory, which might be in /perl/site/lib/ or wherever you put it...

     

    find this chunk of code

     

    #########

    for (my $i = 0; $i < $children->getLength(); $i++) {
        $mynode = $children->item( $i );
        if ($mynode->getNodeType == XML::DOM::TEXT_NODE) {
            next;    # Really not an element, try next 
        } elsif ($mynode->getNodeType() == XML::DOM::ELEMENT_NODE){
            last;    # Found the First element, exit the loop 
        }
    }

    #########

     

    and modify as such:

     

    #########

    my $junosns = $self->{"xmlns:junos"};

    for (my $i = 0; $i < $children->getLength(); $i++) {
        $mynode = $children->item( $i );
        if ($mynode->getNodeType == XML::DOM::TEXT_NODE) {
            next;    # Really not an element, try next 
        } elsif ($mynode->getNodeType() == XML::DOM::ELEMENT_NODE){

            $mynode->setAttribute("xmlns:junos",$junosns);
            last;    # Found the First element, exit the loop 
        }
    }

    #########

     

     

    This will make the error go away.  Basically the junos namespace is declared in the <rpc-reply> tag, and this is essentially stripped off in the closeReply() method in "device.pm"  Fortunately, the creaters of the perl API create a variable (actually its a key in a hash) called "xmlns:junos" in the device object

    when it is passed to the start() method in parser.pm... 

     

    The object is not passed directly to the start method in parser.pm, it is actually passed to XML::Parser with a "style" key set to "JUNOS::DOM::Parser" which ultimately leads to the start() method in parser.pm being called...

     

     

     



  • 4.  RE: JUNOScript namespace issue...

    Posted 10-28-2009 07:19

    Hello there, 

     

    I have a problem and I would be glad if you have a solution of it.

    I have recently upgraded M160 from JUNOS 7.3 to 9.6 to use Inter-AS feature that was first introduced in JUNOS 9.5. The problem is that I can not configure VPLS instances anymore, apperantly, I found out that starting from JUNOS 8.1 VPLS is not supported on M160. so is there anyway that I can enable VPLS instances on M160

     

    Thank you very much for your support

     

    sincerely,