[j-nsp] JUNOS XML Parser

Richard A Steenbergen ras at e-gerbil.net
Tue May 6 16:36:38 EDT 2008


On Tue, May 06, 2008 at 10:38:05AM -0500, Wade Sheridan wrote:
> I'm looking for some help with a XML parser that will convert JUNOScript XML
> into plain text which is able to be loaded using a load merge terminal

Use SimpleXML, for simple transactions like this where you know the XML 
structure beforehand it is infinitely easier than dealing with DOM or SAX.

> command.  I noticed there is a JUNOS::DOM::Parser written by Juniper for the
> perl programming language and wondered if there might be such a module
> written for PHP.

SimpleXML is built into PHP, and it's pretty simple (hence the name) to 
use. Funny you should mention it though, I actually just started playing 
with writing a PHP implementation of a netconf client the other day. Note 
this is literally only a few days old and very far from being finished let 
alone well tested (still not doing proper capability negotiation, error 
handling is crappy, etc), but if you wanted to play with what I have so 
far:

http://www.e-gerbil.net/ras/php-netconf-0.01.tgz

The only dependency from a standard PHP installation is PECL ssh2, which 
requires libssh2 (a step up from the 98731982 perl modules required by 
Juniper's netconf implementation :P). This is still a Juniper-specific 
hack too, PECL ssh2 doesn't have the ability to connect to arbitrary 
subsystems, so this uses exec + a Juniper netconf shell spawning command. 

-- 
Richard A Steenbergen <ras at e-gerbil.net>       http://www.e-gerbil.net/ras
GPG Key ID: 0xF8B12CBC (7535 7F59 8204 ED1F CC1C 53AF 4C41 5ECA F8B1 2CBC)


More information about the juniper-nsp mailing list