0

I need all enabled onu inside the olt to make an audit.

If I use: show gpon onu state

I get something like this:

OLT#show gpon onu state
OnuIndex   Admin State  OMCC State  Phase State  Channel
--------------------------------------------------------------
1/2/1:1     enable       enable      working      1(GPON)
1/2/1:5     enable       enable      working      1(GPON)
1/2/1:8     enable       enable      working      1(GPON)
1/2/1:12    enable       enable      working      1(GPON)
1/2/1:13    enable       enable      working      1(GPON)
1/2/1:14    enable       enable      working      1(GPON)
1/2/1:15    enable       enable      working      1(GPON)
1/2/2:3     enable       disable     DyingGasp    1(GPON)
1/2/2:4     enable       enable      working      1(GPON)
--More--

Is there a way to show this info with the onu's SerialNumber included?

Now I am using commands show gpon onu state and show gpon onu detail-info gpon-onu_1/2/1:1 for each port, but it's too slow.

tags: gpon, olt

  • What is this running on? Does it have `bash` and `coreutils` and the like? If it does, you probably can use a script to unify the output. – rudib Sep 27 '19 at 21:44
  • It is running on CentOS. I can't use scripts because I can execute only terminal commands like above. – Yerry García Sep 28 '19 at 14:37

1 Answers1

1

Well, You can try "expect" my brother.

I will give you a functional example:

#!/usr/bin/expect -f

spawn telnet A.B.C.D
    expect "sername:"
    send "user1\r"
    expect "assword:"
    send "My5ecr3t\r"
    expect "#"
    send "show running-config \r"
    expect {
       " --More--" { send -- " "; exp_continue}
       "end\r" {send -- "exit\r"}
    }
    send "exit\r"
    puts "\r"

Make Sure to install with yum the expect program, then save this example on a file, remember the permissions and replace A.B.C.D with the ip of your device, then "user1" with your user login and "My5ecr3t" with your password.

If your running-config is being shown, then change the command to your desire and you are ready to do an script with that output.

Remember that your limit is the far away of this sky, and as far as your imagination goes.