GPON_1_QINQ 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. set timeout 20
  2. set IP [lindex $argv 0]
  3. set LOGIN [lindex $argv 1]
  4. set PASSWORD [lindex $argv 2]
  5. set METHOD [lindex $argv 3]
  6. set PON_INT [lindex $argv 4]
  7. set PORT [lindex $argv 5]
  8. set ONU_NUM [lindex $argv 6]
  9. set VLAN [lindex $argv 7]
  10. set SVLAN [lindex $argv 8]
  11. set SN [lindex $argv 9]
  12. set NATIVE_VLAN [lindex $argv 10]
  13. set SERVICE_PORT [lindex $argv 11]
  14. if {[string match "TELNET" $METHOD]} {
  15. spawn telnet $IP
  16. expect ">>User name:*"
  17. send "$LOGIN\r"
  18. } elseif {[string match "SSH" $METHOD]} {
  19. spawn ssh $LOGIN@$IP
  20. expect {
  21. "(yes/no)?*" {
  22. send "yes\r"
  23. }
  24. }
  25. }
  26. expect ">>User password:*"
  27. send "$PASSWORD\r"
  28. expect {
  29. "*>" {
  30. send "enable\r"
  31. }
  32. "#" {
  33. send "\r"
  34. }
  35. }
  36. expect "*#"
  37. send "config\r"
  38. expect "*(config)#"
  39. send "interface gpon $PON_INT\r"
  40. expect "*(config-if-gpon-$PON_INT)#"
  41. send "ont add $PORT $ONU_NUM sn-auth $SN omci ont-lineprofile-id 100 ont-srvprofile-id 100 desc ONT_NO_DESCRIPTION\r"
  42. expect "*(config-if-gpon-$PON_INT)#"
  43. send "ont port native-vlan $PORT $ONU_NUM eth 1 vlan $NATIVE_VLAN priority 0\r"
  44. expect "*(config-if-gpon-$PON_INT)#"
  45. send "quit\r"
  46. expect "*(config)#"
  47. send "service-port $SERVICE_PORT vlan $SVLAN gpon $PON_INT/$PORT ont $ONU_NUM gemport 1 multi-service user-vlan $NATIVE_VLAN tag-transform translate-and-add inner-vlan $VLAN inner-priority 0\r"
  48. expect "{ <cr>|bundle<K>|inbound<K>|rx-cttr<K> }:"
  49. send "\r"
  50. expect "*(config)#"
  51. send "quit\r"
  52. expect "*#"
  53. send "quit\r"
  54. expect "(y/n)*"
  55. send "y\r"