Description

The lu-utilization-op.py script which is used to check LU resources works fine with Python 2.7. But starting from Junos OS Release 21.1R1, devices no longer support Python 2.7. Required script that works fine on Junos starting from 21.1R1 which supports Python 3.

Symptoms

user@router-re0# show system scripts
op {
file lu-utilization-op.py {
arguments {
p {
description pfe;
}
s {
description slot;
}
}
}
}
language python3;

user@router-re0> op lu-utilization-op.py s 0 p 0
Script Version # 1.0
Traceback (most recent call last):
File "/var/db/scripts/op/lu-utilization-op.py", line 718, in <module>
exit_code, result = shell_command(cmd)
File "/var/db/scripts/op/lu-utilization-op.py", line 49, in shell_command
result = lines.split("
")
TypeError
:
a bytes-like object is required, not 'str'
error: op script failed: /var/db/scripts/op/lu-utilization-op.py

Solution

The lu-utilization script is no more needed and the script is enhanced to asic-utilization script.

To run this script, you must follow below steps:

1) copy asic_utilization_op.tgz to /var/db/scripts/op/ and extract it.

Make sure all the files (in bold) are extracted as below:

user@router-re0> start shell 
% cd /var/db/scripts/op/
% tar zxvf asic_utilization_op.tgz
x README.md
x asic_utilization_op.py
x commands.py
x ea.py
x lu.py
x ._xl.py
x xl.py

x zt.py

2) Apply the following configuration: 

     set system scripts op file asic_utilization_op.py arguments s description slot 
     set system scripts op file asic_utilization_op.py arguments p description pfe 
     set system scripts language python 
     or set system scripts language python3 
     
user@router-re0> file list /var/db/scripts/op/

/var/db/scripts/op/:
._README.md
._ea.py
._lu.py
._xl.py
._zt.py
README.md
asic_utilization_op.py
asic_utilization_op.tgz
ea.py
lu.py
xl.py
zt.py

3) From cli, enter: 
    
user@router-re0>op asic_utilization-op.py s * p *

slot = FPC number or '*' 
pfe  = PFE number or '*'

Please find the lab output below:


user@router-re0> op asic_utilization_op.py s * p *   
Jun 22 23:55:31
--------------------------------fpc0 information-------------------------
NOTICE :: fpc0 is not installed
--------------------------------fpc1 information-------------------------
FPC 1            REV 46   750-056519   CAMB7XXX          MPC7E 3D MRATE-12xQSFPP-XGE-XLGE-CGE
--------------------------------fpc1 pfe 0-------------------------------

EA clock Freq: 562500000

Zone Utilization
================

  10 iterations, 16 of 24920 opportunities, 0.06% utilization

Instruction Utilization (562.5M/s per PPE)
==========================================
  PPE     Normal/s   % (  U /  G )   Unusable/s   % (  C / UN /  P )       Idle/s   %
  --- ------------ --------------- ------------ -------------------- ------------ ----
    0       263329   1%( 0.0/ 0.0)      8085642   2%( 0.0/ 1.4/ 0.0)    554151029  99%
    1         7988   1%( 0.0/ 0.0)        33876   1%( 0.0/ 0.0/ 0.0)    562458136 100%
    2            0   0%( 0.0/ 0.0)            0   0%( 0.0/ 0.0/ 0.0)    562500000 100%
    3            0   0%( 0.0/ 0.0)            0   0%( 0.0/ 0.0/ 0.0)    562500000 100%
    4            0   0%( 0.0/ 0.0)            0   0%( 0.0/ 0.0/ 0.0)    562500000 100%
    5            0   0%( 0.0/ 0.0)            0   0%( 0.0/ 0.0/ 0.0)    562500000 100%
    6            0   0%( 0.0/ 0.0)            0   0%( 0.0/ 0.0/ 0.0)    562500000 100%
    7            0   0%( 0.0/ 0.0)            0   0%( 0.0/ 0.0/ 0.0)    562500000 100%
    8            0   0%( 0.0/ 0.0)            0   0%( 0.0/ 0.0/ 0.0)    562500000 100%
    9            0   0%( 0.0/ 0.0)            0   0%( 0.0/ 0.0/ 0.0)    562500000 100%
   10            0   0%( 0.0/ 0.0)            0   0%( 0.0/ 0.0/ 0.0)    562500000 100%

user@router-re0> op asic_utilization_op.py s 1 p 1    
--------------------------------fpc1 information-------------------------
FPC 1            REV 46   750-056519   CAMB7XXX          MPC7E 3D MRATE-12xQSFPP-XGE-XLGE-CGE
--------------------------------fpc1 pfe 1-------------------------------

EA clock Freq: 562500000

Zone Utilization
================

  10 iterations, 15 of 25304 opportunities, 0.06% utilization

Instruction Utilization (562.5M/s per PPE)
==========================================
  PPE     Normal/s   % (  U /  G )   Unusable/s   % (  C / UN /  P )       Idle/s   %
  --- ------------ --------------- ------------ -------------------- ------------ ----
    0       261471   1%( 0.0/ 0.0)      8044435   2%( 0.0/ 1.4/ 0.0)    554194094  99%
    1         8258   1%( 0.0/ 0.0)        34947   1%( 0.0/ 0.0/ 0.0)    562456795 100%
    2            0   0%( 0.0/ 0.0)            0   0%( 0.0/ 0.0/ 0.0)    562500000 100%
    3            0   0%( 0.0/ 0.0)            0   0%( 0.0/ 0.0/ 0.0)    562500000 100%
    4            0   0%( 0.0/ 0.0)            0   0%( 0.0/ 0.0/ 0.0)    562500000 100%
    5            0   0%( 0.0/ 0.0)            0   0%( 0.0/ 0.0/ 0.0)    562500000 100%
    6            0   0%( 0.0/ 0.0)            0   0%( 0.0/ 0.0/ 0.0)    562500000 100%
    7            0   0%( 0.0/ 0.0)            0   0%( 0.0/ 0.0/ 0.0)    562500000 100%
    8            0   0%( 0.0/ 0.0)            0   0%( 0.0/ 0.0/ 0.0)    562500000 100%
    9            0   0%( 0.0/ 0.0)            0   0%( 0.0/ 0.0/ 0.0)    562500000 100%
   10            0   0%( 0.0/ 0.0)            0   0%( 0.0/ 0.0/ 0.0)    562500000 100%
   11            0   0%( 0.0/ 0.0)            0   0%( 0.0/ 0.0/ 0.0)    562500000 100%
   12            0   0%( 0.0/ 0.0)            0   0%( 0.0/ 0.0/ 0.0)    562500000 100%
   13            0   0%( 0.0/ 0.0)            0   0%( 0.0/ 0.0/ 0.0)    562500000 100%
   14            0   0%( 0.0/ 0.0)            0   0%( 0.0/ 0.0/ 0.0)    562500000 100%
   15            0   0%( 0.0/ 0.0)            0   0%( 0.0/ 0.0/ 0.0)    562500000 100%
   16            0   0%( 0.0/ 0.0)            0   0%( 0.0/ 0.0/ 0.0)    562500000 100%
   17            0   0%( 0.0/ 0.0)            0   0%( 0.0/ 0.0/ 0.0)    562500000 100%
   18            0   0%( 0.0/ 0.0)            0   0%( 0.0/ 0.0/ 0.0)    562500000 100%
   19            0   0%( 0.0/ 0.0)            0   0%( 0.0/ 0.0/ 0.0)    562500000 100%
   20            0   0%( 0.0/ 0.0)            0   0%( 0.0/ 0.0/ 0.0)    562500000 100%
   21            0   0%( 0.0/ 0.0)            0   0%( 0.0/ 0.0/ 0.0)    562500000 100%
   22            0   0%( 0.0/ 0.0)            0   0%( 0.0/ 0.0/ 0.0)    562500000 100%
   23            0   0%( 0.0/ 0.0)            0   0%( 0.0/ 0.0/ 0.0)    562500000 100%
   24        63934   1%( 0.0/ 0.0)      1212262   1%( 0.0/ 0.2/ 0.0)    561223804 100%
   25        32570   1%( 0.0/ 0.0)       704991   1%( 0.0/ 0.1/ 0.0)    561762439 100%

Modification History

The asic-utilization script is enhancement of lu-utilization script

5/28/2026 Prabin - Updated the Script in the attachment 
5/28/2026 Prabin  - Corrected the PII information

Related Information

It works on both MPC 3E and MPC 7E.