Mailing List Archive

JunOScript question
Quite a simple question. How do I request the equivalent of 'show configuration policy-options'
in JUNOScript ?

I know how to get the full config, thanks to the examples, but I don't understand how to
request only a part of the config.

Thanks!
--
Jerome Fleury
JunOScript question [ In reply to ]
I would think something like this;


neil@lab> show configuration policy-options | display xml
<rpc-reply xmlns:junos="http://xml.juniper.net/junos/5.4R3/junos">
<configuration>
<policy-options>
<policy-statement>
<name junos:key="key">accept-inet6</name>
<from>
<route-filter>
<address junos:key="key">9001::1/128</address>
<exact junos:key="key"/>
</route-filter>
</from>
<then>
<accept/>
</then>
</policy-statement>
</policy-options>
</configuration>
</rpc-reply>

neil@lab>

Neil.

-----Original Message-----
From: Jerome Fleury [mailto:jeje@jeje.org]
Sent: 12 June 2003 10:50
To: juniper-nsp@puck.nether.net
Subject: [j-nsp] JunOScript question


Quite a simple question. How do I request the equivalent of 'show
configuration policy-options'
in JUNOScript ?

I know how to get the full config, thanks to the examples, but I don't
understand how to
request only a part of the config.

Thanks!
--
Jerome Fleury
_______________________________________________
juniper-nsp mailing list juniper-nsp@puck.nether.net
http://puck.nether.net/mailman/listinfo/juniper-nsp
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://puck.nether.net/pipermail/juniper-nsp/attachments/20030612/dcce6316/attachment.htm
JunOScript question [ In reply to ]
I missed one point. How do I get a portion of the configuration in XML "WITH PERL" ?


--On Thursday, June 12, 2003 06:06:39 PM +0100 Neil Stirling <neil.stirling@nortelnetworks.com>
wrote:

> I would think something like this;
>
>
> neil@lab> show configuration policy-options | display xml
> <rpc-reply xmlns:junos="http://xml.juniper.net/junos/5.4R3/junos">
> <configuration>
> <policy-options>
> <policy-statement>
> <name junos:key="key">accept-inet6</name>
> <from>
> <route-filter>
> <address junos:key="key">9001::1/128</address>
> <exact junos:key="key"/>
> </route-filter>
> </from>
> <then>
> <accept/>
> </then>
> </policy-statement>
> </policy-options>
> </configuration>
> </rpc-reply>
>
> neil@lab>
>
> Neil.
>
> -----Original Message-----
> From: Jerome Fleury [mailto:jeje@jeje.org]
> Sent: 12 June 2003 10:50
> To: juniper-nsp@puck.nether.net
> Subject: [j-nsp] JunOScript question
>
>
> Quite a simple question. How do I request the equivalent of 'show
> configuration policy-options'
> in JUNOScript ?
>
> I know how to get the full config, thanks to the examples, but I don't
> understand how to
> request only a part of the config.
>
> Thanks!
> --
> Jerome Fleury
> _______________________________________________
> juniper-nsp mailing list juniper-nsp@puck.nether.net
> http://puck.nether.net/mailman/listinfo/juniper-nsp



jeje.
JunOScript question [ In reply to ]
Try this ...

<get-configuration> <configuration> <policy-options/> </configuration>
</get-configuration>

To get "show config interfaces" do this

<get-configuration> <configuration> <interfaces/> </configuration>
</get-configuration>

---
Harshit

-----Original Message-----
From: Jeje [mailto:jeje@jeje.org]
Sent: Thursday, June 12, 2003 10:48 AM
To: Neil Stirling; 'Jerome Fleury'; juniper-nsp@puck.nether.net
Subject: RE: [j-nsp] JunOScript question


I missed one point. How do I get a portion of the configuration in XML
"WITH PERL" ?


--On Thursday, June 12, 2003 06:06:39 PM +0100 Neil Stirling
<neil.stirling@nortelnetworks.com>
wrote:

> I would think something like this;
>
>
> neil@lab> show configuration policy-options | display xml <rpc-reply
> xmlns:junos="http://xml.juniper.net/junos/5.4R3/junos">
> <configuration>
> <policy-options>
> <policy-statement>
> <name junos:key="key">accept-inet6</name>
> <from>
> <route-filter>
> <address
junos:key="key">9001::1/128</address>
> <exact junos:key="key"/>
> </route-filter>
> </from>
> <then>
> <accept/>
> </then>
> </policy-statement>
> </policy-options>
> </configuration>
> </rpc-reply>
>
> neil@lab>
>
> Neil.
>
> -----Original Message-----
> From: Jerome Fleury [mailto:jeje@jeje.org]
> Sent: 12 June 2003 10:50
> To: juniper-nsp@puck.nether.net
> Subject: [j-nsp] JunOScript question
>
>
> Quite a simple question. How do I request the equivalent of 'show
> configuration policy-options' in JUNOScript ?
>
> I know how to get the full config, thanks to the examples, but I don't

> understand how to request only a part of the config.
>
> Thanks!
> --
> Jerome Fleury
> _______________________________________________
> juniper-nsp mailing list juniper-nsp@puck.nether.net
> http://puck.nether.net/mailman/listinfo/juniper-nsp



jeje.
_______________________________________________
juniper-nsp mailing list juniper-nsp@puck.nether.net
http://puck.nether.net/mailman/listinfo/juniper-nsp
JunOScript question [ In reply to ]
Harshit Kumar writes:
>Try this ...
>
> <get-configuration> <configuration> <policy-options/> </configuration>
></get-configuration>
>
>To get "show config interfaces" do this
>
> <get-configuration> <configuration> <interfaces/> </configuration>
></get-configuration>

You'll need to add database="commited" to get same output
as "show configuration ...". It defaults to the candidate
configuration database.

<rpc>
<get-configuration database="commited">
<configuration>
<policy-options/>
</configuration>
</get-configuration>
</rpc>


>I missed one point. How do I get a portion of the configuration in XML
>"WITH PERL" ?

I'm a bit rusty on the perl stuff, but it looks like you just need:

$jnx->get_configuration(database => "commited", configuration = $dom);

where $dom is a dom tree containing "<configuration> <policy-options/> </configuration>".

(Which is a bit tacky. We should be able to make it just:

$jnx->get_configuration(database => "commited", configuration = "<policy-options/>");

I'll confirm this and PR it if need be.)

Thanks,
Phil
JunOScript question [ In reply to ]
When did it start to default to candidate configuration?


-----Original Message-----
From: juniper-nsp-bounces@puck.nether.net
[mailto:juniper-nsp-bounces@puck.nether.net] On Behalf Of Phil Shafer
Sent: Friday, June 13, 2003 8:36 AM
To: Harshit Kumar
Cc: juniper-nsp@puck.nether.net; Neil Stirling
Subject: Re: [j-nsp] JunOScript question

Harshit Kumar writes:
>Try this ...
>
> <get-configuration> <configuration> <policy-options/> </configuration>
></get-configuration>
>
>To get "show config interfaces" do this
>
> <get-configuration> <configuration> <interfaces/> </configuration>
></get-configuration>

You'll need to add database="commited" to get same output
as "show configuration ...". It defaults to the candidate
configuration database.

<rpc>
<get-configuration database="commited">
<configuration>
<policy-options/>
</configuration>
</get-configuration>
</rpc>


>I missed one point. How do I get a portion of the configuration in XML
>"WITH PERL" ?

I'm a bit rusty on the perl stuff, but it looks like you just need:

$jnx->get_configuration(database => "commited", configuration = $dom);

where $dom is a dom tree containing "<configuration> <policy-options/>
</configuration>".

(Which is a bit tacky. We should be able to make it just:

$jnx->get_configuration(database => "commited", configuration =
"<policy-options/>");

I'll confirm this and PR it if need be.)

Thanks,
Phil
_______________________________________________
juniper-nsp mailing list juniper-nsp@puck.nether.net
http://puck.nether.net/mailman/listinfo/juniper-nsp
JunOScript question [ In reply to ]
"Joe Lin" writes:
>When did it start to default to candidate configuration?

Day one: Jan 2001.

Thanks,
Phil
JunOScript question [ In reply to ]
--On Friday, June 13, 2003 11:36:08 AM -0400 Phil Shafer <phil@juniper.net> wrote:

> I'm a bit rusty on the perl stuff, but it looks like you just need:
>
> $jnx->get_configuration(database => "commited", configuration = $dom);
>
> where $dom is a dom tree containing "<configuration> <policy-options/> </configuration>".

It worked. Thanks!

> (Which is a bit tacky. We should be able to make it just:
>
> $jnx->get_configuration(database => "commited", configuration = "<policy-options/>");

That's right, I would prefer this way, much better :)

jeje.