Routing

 View Only
last person joined: 2 days ago 

Ask questions and share experiences about ACX Series, CTP Series, MX Series, PTX Series, SSR Series, JRR Series, and all things routing, including portfolios and protocols.
  • 1.  sh int terse

     
    Posted 11-15-2022 23:20
    Hi all,

    The command  of show interface terse is handy...

    But what I am looking for is how to list only xe and ge physical interfaces without its all logical interfaces(like xe-0/0/0.10, xe-0/0/0.250 or ge-3/0/10.10- ge3/0/10.150)

    Any idea?
    thx
    A


  • 2.  RE: sh int terse

    Posted 11-16-2022 07:03

    What is the "handy" output you want, just the physical ports present and the admin/link status?

    mx01_cr1> show interfaces terse | match "^(Interface|ge|lo0)" | except \.[0-9]
    Interface Admin Link Proto Local Remote
    ge-0/0/0 up up
    ge-0/0/1 up up
    ge-0/0/2 up down
    ge-0/0/3 up down

    Or if you only cared about physical and .0 logical (but happy to only have the first line of the logical interface output?)

    @mx01_cr1> show interfaces terse | match "^(Interface|ge|lo0)" | except "ge-[0-9]/[0-9]/[0-9]\.[1-9]"
    Interface Admin Link Proto Local Remote
    ge-0/0/0 up up
    ge-0/0/0.0 up up inet 10.10.0.0/31
    ge-0/0/1 up up
    ge-0/0/1.0 up up inet 10.10.1.0/31
    ge-0/0/2 up down
    ge-0/0/3 up down

    If it's much more selective than that, I think you would be needing on/off box scripting.
    If it's 1999, you could look at the Slax op script capabilities (you could start at https://github.com/Juniper/junoscriptorium/tree/master/library/juniper/op/display/show-interface-status , and work your way to something that does what you want).

    or if you want anyone to every be able to understand it again, on/off box python.

    set system scripts op allow-url-for-python #yes yes... don't do this.
    set system scripts language python3

    mx01_cr1> file show juniper-interfaces-local.py
    from jnpr.junos import Device
    from jnpr.junos.op.ethport import EthPortTable

    with Device() as dev:
    eths = EthPortTable(dev)
    eths.get()
    print ("|{:10}|{:4} | \"{:32}\"|".format("Port", "Link", "Description"))
    for port in eths:
    port.description = port.description or ""
    print ("|{:10}|{:4} | \"{:32}\"|".format(port.name, port.oper, port.description))

    @mx01_cr1> op url /var/home/user/juniper-interfaces-local.py
    |Port |Link | "Description "|
    |ge-0/0/0 |up | "interface ge-0/0/0 "|
    |ge-0/0/1 |up | "interface ge-0/0/1 "|
    |ge-0/0/2 |down | " "|
    |ge-0/0/3 |down | " "|
    |ge-0/0/4 |down | " "|




  • 3.  RE: sh int terse

    Posted 11-16-2022 14:25

    As far as I understand, there is no such command.

    But you can use regex: for example, show the et-X/x/x and emX.xxx interfaces:

    run show interfaces terse | match ^e[tm]  - et-X/x/x and emX.xxx interfaces
    run show interfaces terse | match ^[ex]    - et-x/x/x,  emX.xxx and xe-x/x/x interfaces
    run show interfaces terse | match ^[xg]e - xe-x/x/x and ge-x/x/x interfaces



  • 4.  RE: sh int terse

    Posted 11-16-2022 16:12
    You can add the "media" option to the "show interfaces" command, which not show any of the logical interfaces / units.
    mark@p1> show interfaces terse media 
    Interface               Admin Link Proto    Local                 Remote
    ge-0/0/0                up    up
    lc-0/0/0                up    up
    pfe-0/0/0               up    up
    pfh-0/0/0               up    up
    ge-0/0/1                up    up
    ge-0/0/2                up    up
    ge-0/0/3                up    up
    ge-0/0/4                up    up
    ge-0/0/5                up    up
    ge-0/0/6                up    up
    ge-0/0/7                up    up
    ge-0/0/8                up    up
    ge-0/0/9                up    up
    cbp0                    up    up
    demux0                  up    up
    dsc                     up    up
    em1                     up    up
    esi                     up    up
    fti0                    up    up
    fti1                    up    up
    fti2                    up    up
    fti3                    up    up
    fti4                    up    up
    fti5                    up    up
    fti6                    up    up
    fti7                    up    up
    fxp0                    up    up
    gre                     up    up
    ipip                    up    up
    irb                     up    up
    jsrv                    up    up
    lo0                     up    up
    lsi                     up    up
    mif                     up    up
    mtun                    up    up
    pimd                    up    up
    pime                    up    up
    pip0                    up    up
    pp0                     up    up
    rbeb                    up    up
    tap                     up    up
    vtep                    up    up
    
    mark@p1>​

    I  like using wildcards in the show command to only display the ethernet interfaces.

    mark@p1> show interfaces terse media *e-*    
    Interface               Admin Link Proto    Local                 Remote
    ge-0/0/0                up    up
    pfe-0/0/0               up    up
    ge-0/0/1                up    up
    ge-0/0/2                up    up
    ge-0/0/3                up    up
    ge-0/0/4                up    up
    ge-0/0/5                up    up
    ge-0/0/6                up    up
    ge-0/0/7                up    up
    ge-0/0/8                up    up
    ge-0/0/9                up    up
    
    mark@p1> 

    FYI, if you use the "media" option with "detail" or "extensive", it gives you all the logical units anyway.



    ------------------------------
    Mark Sinclair
    ------------------------------



  • 5.  RE: sh int terse

    Posted 11-17-2022 12:12
    The media thing was good, didn't know that one. Another way (well, two):

    show interfaces ge* terse | except "\.0"           <--- Only all ge-interfaces, but without the ones including a dot followed by a zero
    show interfaces *e*-* terse | except "\.0"          <--- All ge, xe, et but will show pfe-1/0/0 and pfe-1/0/0.16383 that you may not want

    EusaHues regexps are nifty but a tad too complicated to be used in a CLI typing situation. Very good when scripting, though!


  • 6.  RE: sh int terse
    Best Answer

    Posted 11-17-2022 12:43
    "except "\.0"" certainly doesn't meet the OPs requirement of excluding other "high numbered" IFLs (although it's unclear exactly what the "handy" output was / would look like?).
    I'm unclear if they wanted SOME logical interfaces, but just not those in a certain range, and whether the protocols/addressing on the interfaces was the "handy" bit?
    Otherwise it's just the physical media states being shown?
    Cleanest (least over/under matching) one for that (if it, and only for ge/xe was actually OPs requirement!) is probably just...

    mx01_cr1> show interfaces media terse "[xg]e*"
    Interface Admin Link Proto Local Remote
    ge-0/0/0 up up
    ge-0/0/1 up up
    ge-0/0/2 up down
    ge-0/0/3 up down