You are on page 1of 12

#!/usr/bin/expect source source source source source ../lib/terayon.lib ../lib/framework.lib ../lib/DiLib.lib ../lib/analyzer.lib ../lib/IPsniffer.

lib

test_comment { ################################################################################ ############################################ # Script comments : GIGE1_feature # Author : santhoshkumar S, santhoshkumar_s07@infosys.com # # # This script tests the GIGE feature. # # script does the following: #1. Test631 : Verify that the default number of MPEG packets per output UDP dat agram is 7(Florence) #2. Test632 : Verify the GigE INTERFACE can receive anywhere from 1 to 7 MPEG p ackets per input UDP datagram. #3. Test633 : Verify that the length of a UDP datagram does not exceed 1324 byt es #4. Test634 : Verify that the Input/Output UDP Destination Port values support either a SPTS or MPTS MPEG transport stream #5. Test635 : Verify that the output UDP Source Port is set to 60000 + physical port number #6. Test760 : Verify that an ARP message is sent after creating a GigE Unicast output multiplex #7. Test1007:Verify that the IP version is IPv4 #8. Test1008:Verify that the IP Type of Service is 0x00 #9. Test1009:Verify that the IP Identification is 0x0000 #10. Test1010:Verify that the IP Flags is 0x04 (Don't Fragment) #11. Test1011:Verify that the IP Fragment Offset is 0 #12. Test1012:Verify that the IP Time-to-Live is 128 #13. Test1013:Verify that the IP Protocol is UDP (0x11) #14. Test1014:Verify that the IP Source Address is displayed correctly #15. Test1015:Verify that the IP Destination Address is displayed correctly #16. Test1131:Verify that SNMP and TFTP are supported on the UDP layer for UDP t raffic #17. Test1132:Verify that the IP Header Length is between 20 and 60 bytes #18. Test1134:Verify that the IP Header Checksum is correct #19. Test1135:Verify that the IP Options header field is not included #20. Test1147:Verify that ARP is used to map an IP Address to the MAC address #21. Test1148:Verify that ICMP is supported on the IP layer for non-MPEG traffic #22. Test1149:Verify that TCP is supported on the IP layer for non-MPEG traffic #23. Test1027:Verify that ARP messages are sent to a destination host periodical ly to update the ARP cache #24. Test1185:Verify that the output UDP Destination port is displayed correctly #25. Test1186:Verify that the output UDP Header Checksum is correct #26. Tets1134:Verify that the IP Total Length is between 20 and 65535 bytes ################################################################################ ########################################### } set name set ip set login [ lindex $argv 0 ] [ lindex $argv 1 ] [ lindex $argv 2 ]

set l_pswd [ lindex $argv 3 ] set GigE_Port [ lindex $argv 4 ] set input_port [ lindex $argv 5 ] set Program_No [ lindex $argv 6 ] set output_port [ lindex $argv 7 ] set cap_interface [ lindex $argv 8 ] set testdetails [ lindex $argv 9 ] proc Usage { } { test_comment "Wrong number of arguments" test_comment "Usage:./GIGE1_feature DM_name DM_ip login_id login_passwor d output_port input_port Program_No output_port cap_interface $detailfile" test_comment "Example:./GIGE_feature cap11 172.168.1.122 root terayon 1/ 3 3/1 1 1/3 eth2 $detailfile" exit } if { $argc < 10} { Usage } source $testdetails test_args $argv $argc set DM [t_console $name $ip $login $l_pswd] sleep 10 t_Change_Buffer $DM 400000 set ConfigDisplay [t_exec $DM "ConfigDisplay"] if {[regexp -nocase "(command not found|exception|usage)" $ConfigDisplay]} { test_comment "Test Abort: ConfigDisplay command not found" test_result -1 t_close $DM test_end } # configuring ethernet port set output [t_exec $DM "ConfigDisplay"] #Now im removing the databse and its details #t_DefaultDatabase $DM $output sleep 3 set GigE_Mux_Ip [Multicast_IP_Generator] set GigE_Mux_Udp 6754 set interface_details [GetGigEOutputProperties $output $GigE_Port] test_comment "interface_details:$interface_details" regexp -nocase "IP address: *(.*), Netmask" $interface_details dummy GigE_Ip regexp -nocase "Netmask: *(.*), Gateway" $interface_details dummy GigE_Netmask regexp -nocase "Gateway: *(.*), ConnectorType" $interface_details dummy GigE_Gat eway test_comment "GigE_Ip:$GigE_Ip" test_comment "GigE_Netmask:$GigE_Netmask" test_comment "GigE_Gateway:$GigE_Gateway" regexp -nocase "CherryPicker: (.*), Version:" $output dummy NAME_CONTROLLER test_comment "NAME_CONTROLLER:$NAME_CONTROLLER" #Now im going to check the default UDP number ################################################################################

############################## test_name "test:No:631:Verify that the default number of MPEG packets per output UDP datagram is 7(Florence)" "631" "DI"

set Config [t_exec $DM "ConfigGigE -o $GigE_Port $GigE_Ip $GigE_Netmask $GigE_Ga teway 2 true"] if {[regexp -nocase "(Usage|usage|command not found|exception|Exception)" $Confi g]} { test_comment "Command ConfigGigE -o threw up error. Test failed" test_result 0 } else { test_comment "ConfigGigE -o command succesful" test_result 1 } #Checking the default UDP packet number set ConfigDisplay [t_exec $DM "ConfigDisplay"] set GigE_INTERFACE_details [GetGigEOutputProperties $ConfigDisplay $GigE_Port] test_comment "The value of GigE output mux properties: $GigE_INTERFACE_details" if {[regexp -nocase "NumMPEGinUDP: (.*), IsActive:" $GigE_INTERFACE_details dumm y UDP_Number]} { if {$UDP_Number == 7} { test_comment "The default UDP number is: 7" test_result 1 } else { test_comment "The default UDP number is not 7" test_failed 0 } } else { test_comment "The UDP Number has not found.Check the ConfigDiplay manual ly..Test Failed!!!" test_result 0 } ################################################################################ ####################################### test_name "test:No:632:Verify that the GigE INTERFACE can receive anywhere from 1 to 7 MPEG packets per input UDP datagram" "632" "DI" #Now im going to check the UPD 0 and 8 test_comment "Now i am trying to set the UDP to 0" set ConfigGigE1 [t_exec $DM "ConfigGigE -o $GigE_Port $GigE_Ip $GigE_Netmask $Gi gE_Gateway 2 true -a true AUTO -s 0"] if {[regexp -nocase "(Usage|usage|command not found|exception|Exception)" $Confi gGigE1]} { test_comment "The UDP can not be lesser than 1" test_comment "Command ConfigGigE -o threw up error. Test passed" test_result 1 } else { test_comment "The ConfigGigE -o command got executed. Test Failed!!!!" test_result 0 } test_comment "Now i am trying to set the UDP to 8" set ConfigGigE2 [t_exec $DM "ConfigGigE -o $GigE_Port $GigE_Ip $GigE_Netmask $Gi

gE_Gateway 2 true -a true AUTO -s 8"] if {[regexp -nocase "(Usage|usage|command not found|exception|Exception)" $Confi gGigE2]} { test_comment "The UDP can not be Greater than 7" test_comment "Command ConfigGigE -o threw up error. Test passed" test_result 1 } else { test_comment "The ConfigGigE -o command got executed. Test Failed!!!!" test_result 0 } #Now im Going to Configure the GigE output port with UDP 1-7 set flag 0 for {set UDP 1} {$UDP <=7} {incr UDP} { set ConfigGigE [t_exec $DM "ConfigGigE -o $GigE_Port $GigE_Ip $GigE_Netm ask $GigE_Gateway 2 true -a true AUTO -s $UDP"] if {[regexp -nocase "(Usage|usage|command not found|exception|Exception) " $ConfigGigE]} { test_comment "Command ConfigGigE -o threw up error. Test failed" test_comment "Threw up error for the UDP value $UDP" set flag 1 } else { test_comment "ConfigGigE -o command succesful.UDP can be $UDP" } } if {$flag == 1} { test_comment "ConfigGigE threw up error for UDP 1 to 7. Check it manuall y" test_result 0 test_name "R#1722:ConfigGigE -s option is not working" "R1722" "DI" test_result 0 } else { test_comment "The GigE INTERFACE can receive anywhere from 1 to 7 MPEG p ackets per input UDP datagram" test_result 1 test_name "R#1722:ConfigGigE -s option is not working" "R1722" "DI" test_result 1 } ################################################################################ ################################### test_name "test:No:627:Verify that the 4 bi-directional physical ports on the IO Adaptor Board can be enabled" "627" "DI" #Now im going to configure the GigE ports set configure [t_exec $DM "ConfigGigE -o $GigE_Port $GigE_Ip $GigE_Netmask $GigE _Gateway 2 true"] if {![regexp -nocase "Usage|error|exception" $configure]} { set output [t_exec $DM "ConfigDisplay"] if {[regexp -nocase "IP address: $GigE_Ip, Netmask: $GigE_Netmask, Gatew ay: $GigE_Gateway, ConnectorType: ELECTRICAL, MAC-Address:" $output]} { test_comment "The ip,netmask,gateway has been modified succesful ly.Test passed" test_result 1 } else { test_comment "The expected string has not been found.Test failed "

test_result 0 } } else { test_comment "ip,netmask,gateway can not be modified.Test failed" test_result 0 } #I am reconfiguring the GigE ports # configuring ethernet port set output [t_exec $DM "ConfigDisplay"] t_DefaultDatabase $DM $output ################################################################################ ################################################################################ ####### test_comment {Executing the following test case test:No:633:Verify that the length of a UDP datagram does not exceed 132 4 bytes test:No:635: Verify that the output UDP Source Port is set to 60000 + ph ysical port number test:No:1012:Verify that the IP Time-to-Live is 128 test:No:1014: Verify that the IP Source Address is displayed correctly test:No:1015:Verify that the IP Destination Address is displayed correct ly test:No:1185:Verify that the output UDP Destination port is displayed co rrectly } #Now i am going o create a GigE output mux # creating an output mux on port 1/4 set output [t_exec $DM "CreateGigEMux -o $output_port $GigE_Mux_Ip:$GigE_Mux_Udp 0 5000000 false MPEG2_ConfigFile.txt"] if {[regexp -nocase "(Usage|usage|command not found|exception|Exception)" $outpu t]} { test_comment "Command CreateGigEMux -o threw up error. Test failed" test_result 0 } else { test_comment "mux created" test_result 1 } set output [t_exec $DM "ConfigDisplay"] #im getting the out gige mux id set INTERFACE_mux_details [GetGigEOutputMuxProperties $output $output_port] test_comment "GigEoutputMux properties :$INTERFACE_mux_details" regexp -nocase "Multiplex: (.*)/.*, *Transport Stream" $INTERFACE_mux_details du mmy output_mux_id test_comment "The MUX ID of GigE outputport $output_port is $output_mux_id" #Now im getting the input DVBASI input mux id set INTERFACE_mux_details [GetDVBASIInputMuxProperties $output $input_port] regexp -nocase "Multiplex: (.*)/.*, *Transport Stream" $INTERFACE_mux_details du mmy input_mux_id

test_comment "The MUX ID of DVBASI inputport $input_port is $input_mux_id" #Now am grooming a program set output [t_exec $DM "ConfigFile -s $output_port $output_mux_id GROOM $input_p ort $input_mux_id 7 1 5 0 20000000 0"] if {[regexp -nocase "(Usage|usage|command not found|exception|Exception)" $outpu t]} { test_comment "Command ConfigFile -s threw up error. Test failed" test_result 0 } else { #Now exporting the new configuration into Automation_Config.xml t_exec $DM "ConfigFile -e $output_port $output_mux_id Automation_Config. xml" #Now Catting the exported Config File set output [t_exec $DM "cat /usr/cp/Config/Automation_Config.xml"] #Now Checking if {![regexp -nocase "output-program id=\"1\" name=\"$output_port\_1\" . *prog-groom description=\"$input_port\_7\" priority=\"5\" min-video-bit-rate=\"0 \" max-video-bit-rate=\"2000000\"" $output]} { test_comment "GROOM has not been executed" test_result 0 } else { test_comment "GROOM has been executed and reflects in config fil e" test_result 1 } } sleep 10 #Now im going to ping to the ipsniffer machine test_name "test:No:1148:Verify that ICMP is supported on the IP layer for non-MP EG traffic" "1148" "DI" set output [t_exec $DM "ping -c 5 $SNIFFER_IP"] test_comment "The Ping value is: $output" if {![regexp {5 packets transmitted, 5 received, 0% packet loss} $output]} { test_comment "Cannot ping to the Windows Machine. Please set the route and connectivity" test_result 0 t_close $DM test_end } else { test_comment "Ping command got executed.Test passed!!!" test_result 1 } #Now im going to connect to the Ip sniffer machine test_name "test:No:1149:Verify that TCP is supported on the IP layer for non-MPE G traffic" "1149" "DI" set IP_sniffer [t_connect $SNIFFER_IP $SNIFFER_USER $SNIFFER_PASS] if {[regexp -nocase "error|failed|excepton" $IP_sniffer]} { test_comment "Not able to connect to the IPsniffer machine.Test failed!! !" test_result 0 } else { test_comment "Telnet has been executed.Test passed" test_result 1 } sleep 1 test_comment "t_connect details: $IP_sniffer"

set file "file_633" test_name "test:No:633:Verify that the length of a UDP datagram does not exceed 1324 bytes" "633" "DI" #now im going toexecute the tcpdump command set pid [t_starttcpdump_cpr $IP_sniffer $PATH $INTERFACE $GigE_Ip $GigE_Mux_Ip $ file] sleep 50 #set output [t_exec_linux $IP_sniffer "tcpdump -i $INTERFACE -vvv src $GigE_Ip a nd dst $GigE_Mux_Ip -c 2"] set output [t_exec_linux $IP_sniffer "cat $PATH$file"] set split [ split $output '\n'] test_comment "Print the the splitted value is: $split" set length [ llength $split ] test_comment "The splitted length is: $length" set found 0 for {set i 0 } {$i < $length} { incr i 1} { set line [lindex $split $i] test_comment "The line is: $line" if {[regexp -nocase ".*$GigE_Ip.(.*) > $GigE_Mux_Ip.*udp (.*) \\(DF\\) \ \(ttl (.*), id.*len (.*)\\)" $line dummy udp_source_port datagram TTL length_udp ]} { if {$udp_source_port < 60000} { test_comment "udp source port is lesser than 60000" set found 0 } else { set found 1 } if {!$TTL == 128} { set found 0 } else { incr found } if {$datagram > 1324} { set found 0 } else { incr found break } } else { set found 0 } } t_stoptcpdump $IP_sniffer $pid test_comment "found:$found" sleep 2 if {$found > 0} { test_result 1

test_name "test:No:635:Verify that the output UDP Source Port is set to 60000 + physical port number" "635" "DI" test_result 1 test_name "test:No:1012:Verify that the IP Time-to-Live is 128" "1012" " DI" test_result 1 test_name "test:No:1014:Verify that the IP Source Address is displayed c orrectly" "1014" "DI" test_result 1 test_name "test:No:1015:Verify that the IP Destination Address is displa yed correctly" "1015" "DI" test_result 1 test_name "test:No:1185:Verify that the output UDP Destination port is d isplayed correctly" "1185" "DI" test_result 1 test_name "test:No:1010:Verify that the IP Flags is 0x04 (Don't Fragment )" "1010" "DI" test_result 1 test_name "test:No:1013:Verify that the IP Protocol is UDP (0x11)" "1013 " "DI" test_result 1 test_name "test:No:1008:Verify that the IP Type of Service is 0x00" "100 8" "DI" test_result 1 } else { test_result 0 test_name "test:No:635:Verify that the output UDP Source Port is set to 60000 + physical port number" "635" "DI" test_result 0 test_name "test:No:1012:Verify that the IP Time-to-Live is 128" "1012" " DI" test_result 0 test_name "test:No:1014:Verify that the IP Source Address is displayed c orrectly" "1014" "DI" test_result 0 test_name "test:No:1015:Verify that the IP Destination Address is displa yed correctly" "1015" "DI" test_result 0 test_name "test:No:1185:Verify that the output UDP Destination port is d isplayed correctly" "1185" "DI" test_result 0 test_name "test:No:1010:Verify that the IP Flags is 0x04 (Don't Fragment )" "1010" "DI" test_result 0 test_name "test:No:1013:Verify that the IP Protocol is UDP (0x11)" "1013 " "DI" test_result 0 test_name "test:No:1008:Verify that the IP Type of Service is 0x00" "100 8" "DI" test_result 0 } t_exec_linux $IP_sniffer "rm -r $PATH$file" unset found set found 0 test_name "test:No:1186: Verify that the output UDP Header Checksum is correct" "1186" "DI"

set remove [t_exec $DM "rm file1"] set open [t_exec $DM "tcpdump -i $cap_interface -vvv -c 100 -s 200 > file1"] sleep 120 set output1 [t_exec $DM "cat file1"] test_comment "*************************Print*****************************" test_comment "The value of output1 is: $output1" if {[regexp -nocase "bash | No such device" $output1]} { test_comment "The cat command threw up error.Test Failed" set found 0 } else { test_comment "Sleep for 10 sec..." sleep 10 set split1 [split $output1 '\n'] test_comment "The splitted details are: $split1" test_comment "Print the splitted value is: $split1" set length1 [ llength $split1 ] test_comment "The splitted length is: $length1" test_comment "Print something...." sleep 2 for {set j 0} {$j < $length1} {incr j 1} { set line1 [lindex $split1 $j] test_comment "The line is: $line1" if {[regexp -nocase "IP \\(tos 0x0, ttl.*, id .*, offset 0, flag s .* proto: UDP.*, length: .*" $line1]} { test_comment "IP fragement offset is 0.test 1011 passed! !!" test_comment "The Ip version is IPV4 test passed!!!!" test_comment "The Ip type of service is 0x00.test 1008 p assed!!!" test_comment "UDP header checksum is correct.Test 1186,1 134 are passed" set found 1 } else { test_comment "String not found.Continuing" continue } } } if {$found == 1} { test_result 1 test_name "test:No:1134: rrect" "1134" "DI" test_result 1 test_name "test:No:1011: "DI" test_result 1 } else { test_result 0 test_name "test:No:1134: rrect" "1134" "DI" test_result 0 test_name "test:No:1011: "DI" test_result 0 }

Verify that the output IP Header Checksum is co Verify that the IP Fragment Offset is 0" "1011"

Verify that the output IP Header Checksum is co Verify that the IP Fragment Offset is 0" "1011"

test_name "test1027:Verify that ARP messages are sent to a destination host peri odically to update the ARP cache" "1027" "DI" set open [t_exec $DM "tcpdump -i $cap_interface -vvv -c 20 > file3 &"] sleep 2 set unicast [t_exec $DM "CreateGigEMux -o $GigE_Port 1.2.3.4:9876 0 500000 false MPEG2_ConfigFile.txt"] sleep 50 #Now i am going to create a unicast mux if {[regexp -nocase "usage | error |exception" $unicast]} { test_comment "Not able to create unicast mux on $GigE_Port.Test failed" test_result 0 } else { set tcpdump_value [t_exec $DM "cat file3"] } if {[regexp -nocase "tell $NAME_CONTROLLER" $tcpdump_value]} { test_comment "The arp messages are sent to arp cach for updating" test_comment "The arp messages is used to convert MAC address to IP" test_comment "test1027 is passed" test_result 1 test_name "test 760:Verify that ARP messages are sent to a destination h ost periodically to update the ARP cache" "760" "DI" test_result 1 } else { test_comment "The string arp who-has can not be found." test_comment "test1027 is failed" test_result 0 test_name "test 760:Verify that ARP messages are sent to a destination h ost periodically to update the ARP cache" "760" "DI" test_result 0 } t_exec $DM "rm file1" t_exec $DM "rm file3" ## CHECK test_name "test:No:1007:Verify that the IP version is IPv4" "1007" "DI" set remove2 [t_exec $DM "rm file2"] set open2 [t_exec $DM "tcpdump -i $cap_interface -nnvvXSs 1514 -c 20 > file2"] sleep 60 set output2 [t_exec $DM "cat file2"] test_comment "The value of output1 is: $output2" if {[regexp -nocase "bash | No such device" $output2]} { test_comment "The cat command threw up error.Test Failed" test_result 0 } else { test_comment "Sleep for 10 sec..." sleep 10 set split2 [split $output2 '\n'] test_comment "The splitted details are: $split2" set length2 [ llength $split2 ] test_comment "The splitted length is: $length2" sleep 2 for {set j 0} {$j < $length2} {incr j 1} {

set line2 [lindex $split2 $j] test_comment "The line is: $line2" if {[regexp -nocase "0x0000: 4500 (.*) 8011" $line2 dummy packe ts]} { test_comment "The UDP packets are: $packets" test_comment "The tag is 0x0000.Test 1009 Passed!!!" test_comment "The first byte is 4. Ip Version is IPv4.Te st 1007 passed!!!" test_comment "The second Byte is 5.The Ip header option is not included.Test 1135 passed!!!" test_comment "The third byte is 0.The type of service is 0x00.Test 1008 passed!!!" test_comment "The IP header length is between 20 and 60. Test 1132 passed!!!" test_comment "The 4th and 5th byte,in 3rd chunk of data is 11.Ip protocol is UDP.test 1013 Passed!!!" set fragment [lindex $line2 3] if {$fragment == 00000} { test_comment "The fragment offset is 0.Test 1011 Passed!!!" test_result 1 } set Ip_Total_Length [lindex $line2 1] set Ip_Total_Length1 [string toupper $Ip_Total_Length] set Ip_Total_Length2 [hexadecimal_to_decimal $Ip_Total_L ength1] if {!$Ip_Total_Length2 < 20} { test_comment "The total ip header length is grea ter than 20.Test 1133 passed!!!" test_result 1 test_name " test:No:1008:Verify that the IP Type of Service is 0x00" "1008" "DI" test_result 1 test_name " test:No:1011:Verify that the IP Frag ment Offset is 0" "1011" "DI" test_result 1 test_name " test:No:1132:Verify that the IP Head er Length is between 20 and 60 bytes" "1132" "DI" test_result 1 test_name " test:No:1135:Verify that the IP Opti ons header field is not included" "1135" "DI" test_result 1 } else { test_comment "The total ip header length is grea ter than 20.Test 1133 passed!!!" test_result 0 test_name " test:No:1008:Verify that the IP Type of Service is 0x00" "1008" "DI" test_result 0 test_name " test:No:1011:Verify that the IP Frag ment Offset is 0" "1011" "DI" test_result 0 test_name " test:No:1132:Verify that the IP Head er Length is between 20 and 60 bytes" "1132" "DI" test_result 0 test_name " test:No:1135:Verify that the IP Opti ons header field is not included" "1135" "DI" test_result 0 }

break } } } t_exec $DM "rm file2" sleep 10 test_name "test:No:634:Verify that the Input/Output UDP Destination Port values support either a SPTS or MPTS MPEG transport stream" "634" "DI" incr GigE_Mux_Udp #Now im going to create a output mux on the output port set output [t_exec $DM "CreateGigEMux -o $output_port $GigE_Mux_Ip:$GigE_Mux_Udp 0 500000 false SPTS_MPEG2_ConfigFile.txt"] sleep 2 if {[regexp -nocase "(Usage|usage|command not found|exception|Exception)" $outpu t]} { test_comment "Command CreateGigEMux -o threw up error. Test failed" test_result 0 } else { test_comment "mux created" test_comment "The command got executed. and it has created only one prog ram at output.Test passed!!!" test_result 1 } set output [t_exec $DM "ConfigDisplay"] t_DefaultDatabase $DM $output t_close $DM #disconnecting the sniffer machine t_disconnect $IP_sniffer test_end

You might also like