12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- set timeout 20
- set IP [lindex $argv 0]
- set LOGIN [lindex $argv 1]
- set PASSWORD [lindex $argv 2]
- set METHOD [lindex $argv 3]
- set PON_INT [lindex $argv 4]
- set PORT [lindex $argv 5]
- set ONU_NUM [lindex $argv 6]
- set VLAN [lindex $argv 7]
- set SN [lindex $argv 8]
- set NATIVE_VLAN [lindex $argv 9]
- set SERVICE_PORT [lindex $argv 10]
- if {[string match "TELNET" $METHOD]} {
- spawn telnet $IP
- expect ">>User name:*"
- send "$LOGIN\r"
- } elseif {[string match "SSH" $METHOD]} {
- spawn ssh $LOGIN@$IP
- expect {
- "(yes/no)?*" {
- send "yes\r"
- }
- }
- }
- expect ">>User password:*"
- send "$PASSWORD\r"
- expect {
- "*>" {
- send "enable\r"
- }
- "#" {
- send "\r"
- }
- }
- expect "*#"
- send "config\r"
- expect "*(config)#"
- send "interface gpon $PON_INT\r"
- expect "*(config-if-gpon-$PON_INT)#"
- send "ont add $PORT $ONU_NUM sn-auth $SN omci ont-lineprofile-id 100 ont-srvprofile-id 100 desc ONT_NO_DESCRIPTION\r"
- expect "*(config-if-gpon-$PON_INT)#"
- send "ont port native-vlan $PORT $ONU_NUM eth 1 vlan $NATIVE_VLAN priority 0\r"
- expect "*(config-if-gpon-$PON_INT)#"
- send "quit\r"
- expect "*(config)#"
- send "service-port $SERVICE_PORT vlan $VLAN gpon $PON_INT/$PORT ont $ONU_NUM gemport 1 multi-service user-vlan $NATIVE_VLAN tag-transform translate\r"
- expect "{ <cr>|bundle<K>|inbound<K>|rx-cttr<K> }:"
- send "\r"
- expect "*(config)#"
- send "quit\r"
- expect "*#"
- send "quit\r"
- expect "(y/n)*"
- send "y\r"
|