Automation

Expand all | Collapse all

Pipe in op-scripts not working

Jump to Best Answer
  • 1.  Pipe in op-scripts not working

    Posted 04-26-2017 04:01

    Hi guys,

     

    trying to run an op-Script on the SRX340:

     

     

    version 1.0;
    ns junos = "http://xml.juniper.net/junos/*/junos";
    ns xnm = "http://xml.juniper.net/xnm/1.1/xnm";
    ns jcs = "http://xml.juniper.net/junos/commit-scripts/1.0";
    import "../import/junos.xsl";
    
    match / {
        <op-script-results> {
    
            var $variable1 = <rpc> {
                <command format="text"> "show dhcp server binding | match reth0.68 | except 192.168.1";
            }
            var $variable2 = jcs:invoke($variable1);
    		
    				
    		
    	<output> "reth0.68 - Bad-Bindings:";	
        <output> $variable2;
    	
    
    	
        }
    }

    The Reason is to find IP's that don't belong to the range due to a bug in the Software.

    However the SRX keeps getting me the complete binding for reth0.68 - not the "filtered" - if I run the command directly on the cli it works fine.

     

    Is there any way to make the pipe work in op-Scripts?

     

    Regards

    Chris



  • 2.  RE: Pipe in op-scripts not working
    Best Answer

    Posted 04-26-2017 07:52

    Short answer:  "|" is a CLI feature, not supported in SLAX.   You'll get unpredictable results.

     

    That's all I have time right now, but at least you can stop banging your head.   If you're still interested, I'll try to circle back later with an example.

     

    /doug

     

     



  • 3.  RE: Pipe in op-scripts not working

    Posted 04-27-2017 00:38

    Hi Doug,

    thanks - that "solves" it for me and I can finally stop banging my head against the Wall 😄

     

    I will try to get around the pipe - thank you very much.