------------------------------------------------------------------------------
Date    : 18-02-97
Author  : Chetan Francis Pinto
Module  : Scripting
Project : Router
------------------------------------------------------------------------------
Testing spans two environments
1.PC
2.Router

PC:
	The foll. modules have to be tested
	1.Script Compiler
	2.Script Editor
	3.Script Help
	4.Roucon

SCRIPT COMPILER :
	The compiler should support only the following
	in-built functions
	(Refer to the Multi Express Manual for syntax, etc, etc)
		RGETC
		RGETS
		GETDCD
		HANGUP
		BAUDRATE
		STOPBITS
		PARITY
		DEC
		INC
		EXIT
		ATOI
		ITOA
		STRLEN
		STRCAT
		STRCMP
		STRCPY
		STRFMT
		TOUPPER
		TOLOWER
		TRANSMIT
		WAITFOR
		WAIT
		BREAK
		RXFLUSH
		TXFLUSH
		THISLAYERUP
		SETRTS
		GETCTS
		SETDTR
		Check the Compiler actions against the Help syntax


SCRIPT EDITOR :
	Check whether OverWrite option works properly
	Check whether Backup is created or not after quitting the editor

SCRIPT HELP :
	Check for typographical errors
	Are the help and the Script actions correlated ?

ROUCON :
	1.The source script is named PORTn.SCR
	  The compiled script is named PORTn.COD
	   	where n = 1,2,3 i.e for Wan1, Wan2 and Wan3
	2.Unnecessary compilation of the script is to be checked
	3.The size of SCR and COD cannot exceed 8 KB
	4.Unnecessary download of script to the router is to be checked
	  Check download via both COM Port and Ethernet connection
	  Try using Modems on the COM Port


ROUTER :
	Use all the script commands in the test script
	Script is used for ASYNC, MODEM Connected ports
	As of now only Modems can be used as the DCEs
	As we have Dial Back up, AG, Terminal Server and Script
	using the ports Testing has to be done with all of them


/*-----------------------------------------------------------*/
/* TEST SCRIPT : (For a Dialling Router) */
proc comm_parameters ;   
    baudrate (19200) ;	 /* set the Baud rate to 19200 baud */
    parity ("NONE") ;    /* No Parity */
    stopbits (1) ;		 /* 1 Stop bit */
endproc 

proc dialinit_proc ;
    transmit ("A") ;		 /* send 'a' to modem */
    waitfor ("A", 1) ; 	 /* wait for 'a' to be echoed */
    transmit ("T") ;		 /* send 't' to modem */
    waitfor ("T", 1) ; 	 /* wait for 't' to be echoed */
    transmit ("^M") ;	 /* send CR to modem */
    waitfor ("OK", 10) ; /* wait for OK from modem */
endproc 

proc main ;
	integer attempts ;
	integer max_attempts ;
	
	attempts = 0 ;
	max_attempts = 10 ;

	comm_parameters ;  /* Initialize communictaion parameters */
	dialinit_proc ;    /* Look for OK response from modem */

Redial:
	transmit ("ATDT444^M") ;   /* Dial modem on line 444 */
	if (waitfor ("CONNECT", 40)) then	 /* Look for CONNECT response */
		if (getdcd) then		 /* Check whether Carrier is detected */
			wait (5) ;	   /* wait for 5 seconds befor proceeding */
			thislayerup ;	/* Inform PPP that Connection has been established */
		else
			goto Retry ;   /* Retry no of attempts */
		endif
	else
Retry:
		inc (attempts) ;      /* Check max. number of attempts */
		if (attempts <= max_attempts) then
			goto Redial ;
		else
		endif
	endif
	
	exit ;	/* Exit the script */
		 
endproc










	



