Automation

last person joined: 2 days ago 

Ask questions and share experiences about Apstra, Paragon, and all things network automation.
  • 1.  show interface fe-0/0/0 brief - slax

    Posted 03-05-2013 20:08

    So I ran this through slaxproc and got back:

     

    <get-interface-information> {
        <brief>;
        <interface-name> "fe-0/0/0";
    }

     

    But when I use that in slax, first the quotes have to be removed from the interface name, and then I get back

     

    <xnm:error xmlns="http://xml.juniper.net/xnm/1.1/xnm" xmlns:xnm="http://xml.juniper.net/xnm/1.1/xnm">
    <token>get-interface-information{</token>
    <message>syntax error</message>
    </xnm:error>

     

    I know I can find the interface in a full interface set, but it takes a long time to pull all the interfaces (think 10 member ex4200 48p switches)

     

    Any thoughts on what I am missing?



  • 2.  RE: show interface fe-0/0/0 brief - slax
    Best Answer

    Posted 03-06-2013 07:15

    You didn't say what Junos version.

    This just worked for me (on an MX running 12.1X43.2)

     

    Be sure to change "ge-0/0/0" to "fe-0/0/0" for youir example and remembed to pipe thru | display xml" 

    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";
    ns util extension = "http://xml.juniper.net/proserv/util";
     
    import "../import/junos.xsl";
    match / {
        <op-script-results> {
    		var $rpc = <get-interface-information> {
    			<brief>;
    			<interface-name> "ge-0/0/0";
    		}
    		var $res1 = jcs:invoke($rpc);
    		
    		copy-of $res1;
    	}
    }

     
    Here's what I get when I run it::

     

    regress@router> op url /var/home/regress/foo3.slax | display xml
    <rpc-reply xmlns:junos="http://xml.juniper.net/junos/12.1X43/junos">
        <interface-information xmlns="http://xml.juniper.net/junos/12.1X43/junos-interface" junos:style="brief">
            <physical-interface>
                <name>
                    ge-0/0/0
                </name>
                <admin-status junos:format="Enabled">
                    up
                </admin-status>
                <oper-status>
                    up
                </oper-status>
                <link-level-type>
                    Ethernet
                </link-level-type>
                <mtu>
                    1514
                </mtu>
                <source-filtering>
                    disabled
                </source-filtering>
                <speed>
                    1000mbps
                </speed>
                <bpdu-error>
                    none
                </bpdu-error>
                <l2pt-error>
                    none
                </l2pt-error>
                <loopback>
                    disabled
                </loopback>
                <if-flow-control>
                    enabled
                </if-flow-control>
                <if-auto-negotiation>
                    enabled
                </if-auto-negotiation>
                <if-remote-fault>
                    online
                </if-remote-fault>
                <if-device-flags>
                    <ifdf-present/>
                    <ifdf-running/>
                </if-device-flags>
                <if-config-flags>
                    <iff-snmp-traps/>
                    <internal-flags>
                        0x4000
                    </internal-flags>
                </if-config-flags>
                <if-media-flags>
                    <ifmf-none/>
                </if-media-flags>
            </physical-interface>
        </interface-information>
        <cli>
            <banner></banner>
        </cli>
    </rpc-reply>
    
    regress@router>
    

     

    Hope that helps.

    /doug