98DX3236初始化脚本程序

1. 程序应用背景

(1)程序类型:Visual Basic脚本语言

(2)配套软件:SecureCRT 5.2.2

(3)交换机CPU型号:98DX3236


2. 程序功能

(1)初始化系统

配置命令:

Console# cpssinitsystem 19,2,0

作用:初始化交换机系统,使网络口Port 0-Port 23工作在QSGMII模式下,网速为10/100/1000自适应。


(2)初始化光口

配置命令:

Console# configure

Console(config)# interface range ethernet 0/24-27

Console(config-if)# speed 10000 mode SR_LR

Console(config-if)# end

作用:使光口Port 24-Port 27工作在SR_LR模式,光口速率为10000M。


(3)25号和27号光口接收与发送端极性对调

配置命令:

Console# cpss-api call cpssDxChPortSerdesPolaritySet devNum 0 portNum 25 laneBmp 1 invertTx true invertRx false
Console# cpss-api call cpssDxChPortSerdesPolaritySet devNum 0 portNum 27 laneBmp 1 invertTx true invertRx true

作用:在交换机的PCB上,考虑到布线的方便,25号光口的Tx_P与Tx_N反接,Rx_P与Rx_N反接,27号光口的Tx_P与Tx_N反接,为了使25号和27号光口正常工作,需要通过软件设置将25号和27号的Tx口正负极对调,再将27号口的Rx的正负极对调。


(4)显示交换机配置后所有端口的状态

命令:

Console# show interfaces status all

作用:查看端口的状态信息


3. 98DX3236_init_v_1_0.vbs程序代码

#$language = "VBScript"
#$interface = "1.0"

'-------------------------------------------------
'name: 98DX3236_init_v1.0.vbs
'date: 20170928
'Email: [email protected]
'-------------------------------------------------

crt.Screen.Synchronous = True

' This automatically generated script may need to be
' edited in order to work correctly.

Sub Main

'----------------------------------------------
'init port0-23:
'Console# cpssinitsystem 19,2,0
'----------------------------------------------
	crt.Screen.Send "cpssinitsystem 19,2,0" & chr(13)
	crt.Screen.WaitForString "Console#"
'1s delay
	crt.Sleep(1000)

'----------------------------------------------
'init port24-27:
'Console# configure
'Console(config)# interface range ethernet 0/24-27
'Console(config-if)# speed 10000 mode SR_LR
'Console(config-if)# end
'----------------------------------------------

	crt.Screen.Send "configure" & chr(13)
	crt.Screen.WaitForString "Console(config)# "
	crt.Screen.Send "interface range ethernet 0/24-27" & chr(13)
	crt.Screen.WaitForString "Console(config-if)# "
	crt.Screen.Send "speed 10000 mode SR_LR" & chr(13)
	crt.Screen.WaitForString "Console(config-if)# "
	crt.Screen.Send "end" & chr(13)
	crt.Screen.WaitForString "Console#"
'1s delay
	crt.Sleep(1000)

'----------------------------------------------
'reverse port25 and port27:
'Console# cpss-api call cpssDxChPortSerdesPolaritySet devNum 0 portNum 25 laneBmp 

1 invertTx true invertRx false
'Console# cpss-api call cpssDxChPortSerdesPolaritySet devNum 0 portNum 27 laneBmp 

1 invertTx true invertRx true
'----------------------------------------------
	crt.Screen.Send "cpss-api call cpssDxChPortSerdesPolaritySet devNum 0 

portNum 25 laneBmp 1 invertTx true invertRx false" & chr(13)
	crt.Screen.WaitForString "Console#"
	crt.Screen.Send "cpss-api call cpssDxChPortSerdesPolaritySet devNum 0 

portNum 27 laneBmp 1 invertTx true invertRx true" & chr(13)
	crt.Screen.WaitForString "Console# "

'----------------------------------------------
'show interfaces status:
'Console# show interfaces status all
'----------------------------------------------
	crt.Screen.Send "show interfaces status all" & chr(13)
'1s delay
	crt.Sleep(1000)
	crt.Screen.Send chr(13)
	crt.Screen.WaitForString "Console#"

End Sub

4. 脚本运行结果

cpssinitsystem 19,2,0
cpssInitSystem :bspPciGetIntVec (single) int vector 0x21, internal Int 0x0
 start print membspPciGetIntVec (single) int vector 0x21, internal Int 0x0
ory leaks 
cpssInitSystem : end print memory leaks 
cpssInitSystem : state to STOP recording allocations and free management to find memory leaks 
cpssInitSystem : state to START recording allocations and free management to find memory leaks 
cpssDxChHwPpPhase1Init returned: 0x1B at file ./gtAppDemoDxSysConfig.c, line = 925
sysCfgFuncs->cpssHwPpPhase1Init returned: 0x1B at file ./appDemoBoardConfig.c, line = 3418
appDemoBoardPhase1Init returned: 0x1B at file ./appDemoBoardConfig.c, line = 2089
Init system returned:27
devices, ports to be used by LUA tests , and configuration files ==> {
  {
    dev=0,
    port={ 0, 8, 18, 24, 20, 2 },
    portCPU=63
  }
}
Default PCL CFG Table Access mode configured on dev: 0
Console# configure
Console(config)# interface range ethernet 0/24-27
Console(config-if)# speed 10000 mode SR_LR
Console(config-if)# end
Console# cpss-api call cpssDxChPortSerdesPolaritySet devNum 0 portNum 25 laneBmp 1 invertTx true invertRx false
result=GT_OK = Operation succeeded
values={ }
Console# cpss-api call cpssDxChPortSerdesPolaritySet devNum 0 portNum 27 laneBmp 1 invertTx true invertRx true
result=GT_OK = Operation succeeded
values={ }
Console# show interfaces status all

Dev/Port         Mode        Link   Speed  Duplex  Loopback Mode
---------  ----------------  -----  -----  ------  -------------

0/0             QSGMII       Down    10     Half    None          
0/1             QSGMII       Down    10     Half    N/A           
0/2             QSGMII       Down    10     Half    N/A           
0/3             QSGMII       Down    10     Half    N/A           
0/4             QSGMII       Down    10     Half    None          
0/5             QSGMII        Up     1G     Full    N/A           
0/6             QSGMII       Down    1G     Half    N/A           
0/7             QSGMII       Down    1G     Half    N/A           
0/8             QSGMII       Down    1G     Half    None          
0/9             QSGMII       Down    1G     Half    N/A           
0/10            QSGMII       Down    1G     Half    N/A           
0/11            QSGMII       Down    1G     Half    N/A           
0/12            QSGMII       Down    10     Half    None          
0/13            QSGMII       Down    10     Half    N/A           
0/14            QSGMII       Down    10     Half    N/A           
0/15            QSGMII       Down    10     Half    N/A           
0/16            QSGMII       Down    1G     Half    None          
0/17            QSGMII       Down    1G     Half    N/A           
0/18            QSGMII       Down    1G     Half    N/A           
Type  to continue, Q to stop:
0/19            QSGMII       Down    1G     Half    N/A           
0/20            QSGMII       Down    1G     Half    None          
0/21            QSGMII       Down    1G     Half    N/A           
0/22            QSGMII       Down    1G     Half    N/A           
0/23            QSGMII       Down    1G     Half    N/A           
0/24            SR_LR        Down    10G    Full    None          
0/25            SR_LR        Down    10G    Full    None          
0/26            SR_LR        Down    10G    Full    None          
0/27            SR_LR         Up     10G    Full    None          


Console#


5. 脚本程序补充说明

(1)crt.Screen.Synchronous = True :开启同步模式,在终端上显示调用过的命令;

(2)crt.Screen.Send "cpssinitsystem 19,2,0" & chr(13) :向终端输入命令“cpssinitsystem 19,2,0”并回车;

(3)crt.Screen.WaitForString "Console#" :等待终端出现字符串“Console#”;

(4)crt.Sleep(1000) :脚本程序延时1s;

(5)crt.Screen.Send chr(13) :向终端内输入回车键。


你可能感兴趣的:(Marvell)