How do I get the laser rx power value ?

659 views
Skip to first unread message

Maxat Abdugapparov

unread,
Jul 31, 2014, 7:59:16 AM7/31/14
to junos-p...@googlegroups.com
How do I get the laser rx power value from MX480 using pyez-junos ? (cli:  show interfaces diagnostics optics  ge-5/0/0)

Rick Sherman

unread,
Jul 31, 2014, 1:01:31 PM7/31/14
to junos-p...@googlegroups.com
Hi Maxat,

To find the RPC of a command in JUNOS you can use <command> | xml rpc

Example:
show interfaces diagnostics optics xe-2/2/0 | display xml rpc
    <rpc>
        <get-interface-optics-diagnostics-information>
                <interface-name>xe-2/2/0</interface-name>
        </get-interface-optics-diagnostics-information>
    </rpc>
    <cli>
        <banner></banner>
    </cli>
</rpc-reply>


You can also view the ouput of a command as XML

show interfaces diagnostics optics xe-2/2/0 | display xml
    <interface-information xmlns="http://xml.juniper.net/junos/14.1R2/junos-interface" junos:style="normal">
        <physical-interface>
            <name>xe-2/2/0</name>
            <optics-diagnostics>
                <laser-bias-current>5.808</laser-bias-current>
                <laser-output-power>0.5290</laser-output-power>
                <laser-output-power-dbm>-2.77</laser-output-power-dbm>
                <module-temperature junos:celsius="24.9">25 degrees C / 77 degrees F</module-temperature>
                <laser-rx-optical-power>0.4208</laser-rx-optical-power>
....

So with this you can use the RPC On Demand function


rsp = dev.rpc.get_interface_optics_diagnostics_information(interface_name='xe-2/2/0')

print rsp.findtext('.//laser-output-power')

0.5280


You may also find it helpful to build a table/view



(If I find some time, I'll try and build you an example table).

Thanks,
-Rick

Maxat Abdugapparov

unread,
Aug 1, 2014, 7:02:24 AM8/1/14
to junos-p...@googlegroups.com
Hi Rick,

Thank you!

четверг, 31 июля 2014 г., 17:59:16 UTC+6 пользователь Maxat Abdugapparov написал:

Maxi

unread,
Aug 12, 2014, 5:26:03 AM8/12/14
to junos-p...@googlegroups.com

Hi Rick,

Can you show me example table view for me ?
My TableView not working properly

InterfDiagOpticsTable:
  rpc: get-interface-optics-diagnostics-information
  args:
    interface_name: '[afgx]e*'

  args_key: interface_name
  item: physical-interface
  view: InterfDiagOpticsView

InterfDiagOpticsView:
  groups:
    optics: optics-diagnostics
  fields:
    laserBiasCurr: laser-bias-current
    laserOutputPower: laser-output-power
    rxOptAvgPower: rx-signal-avg-optical-power
    rxOptAvgPowerDbm: rx-signal-avg-optical-power-dbm

I see only interface names, not selected fields


четверг, 31 июля 2014 г., 17:59:16 UTC+6 пользователь Maxi написал:

Jeremy Schulman

unread,
Aug 12, 2014, 7:35:19 AM8/12/14
to junos-p...@googlegroups.com
Hi Maxi,

You need to make a small change to your view.  Change the word "fields" to "fields_optics".  The designation of "fields" + "_" + <groupname> tells pyez how to map the XPaths together.  For more details please see this URL:
Jeremy
@Schprokits
Reply all
Reply to author
Forward
0 new messages