[j-nsp] EX-series automation, NETCONF woes
Alexandre Snarskii
snar at snar.spb.ru
Fri Mar 5 06:26:59 EST 2010
On Wed, Jan 28, 2009 at 03:40:10PM -0500, Ross Vandegrift wrote:
> On Wed, Jan 28, 2009 at 11:17:11AM -0800, Derick Winkworth wrote:
> > xpath notation can help you find "junos-interface:interfaces" no
> > matter where its located.
>
> Can you do that without providing a map that maps the abbreviated
> namespace back to the fully-qualified namespace? If so, I'd love to
> know how.
Just run into the same problem myself, and workaround is here:
you can use local-name() function to do namespace-agnostic
searches, and you can use partial checks on namespaces to be
sure that you getting what you want.
Example: iterate over physical interfaces:
<xsl:for-each select="//*[local-name()='physical-interface' and
starts-with(namespace-uri(), 'http://xml.juniper.net/junos/')]">
Select operational state:
<xsl:variable name="oper"
select="normalize-space(*[local-name()='oper-status'])"/>
Select dropped packets for first queue:
select="normalize-space(*[local-name()='queue-counters']/*[local-name()='queue' and *[local-name()='queue-number']=0]/*[local-name()='queue-counters-red-packets'])"/>
Syntax is ugly, but it works...
> In my understanding, the XPath query ".//junos-interface:interfaces" [1]
> only matches
> "<http://xml.juniper.net/junos/9.3R2/junos-interface:interfaces>" if I
> can somewhere say that
> "junos-interface = http://xml.juniper.net/junos/9.3R2/junos-interface".
>
> That just moves the problem to one of making a namespace map.
>
>
> Ross
>
> [1] - that's the XPath to find the element named "interfaces" from the
> namespace that's been abbreviated "junos-interface" in any subtree.
>
> --
> Ross Vandegrift
> ross at kallisti.us
>
> "If the fight gets hot, the songs get hotter. If the going gets tough,
> the songs get tougher."
> --Woody Guthrie
> _______________________________________________
> juniper-nsp mailing list juniper-nsp at puck.nether.net
> https://puck.nether.net/mailman/listinfo/juniper-nsp
More information about the juniper-nsp
mailing list