Commit 6c80a2c3 authored by peter's avatar peter
Browse files

No commit message

No commit message
parent db3e0ba0
Loading
Loading
Loading
Loading
+217 −90
Original line number Diff line number Diff line
@@ -15,16 +15,19 @@ module LibIpv6_Rfc2461NeighborDiscovery_Functions {
	import from LibCommon_BasicTypesAndValues all;
	import from LibCommon_DataStrings all;
	import from LibCommon_VerdictControl { type FncRetCode };
	import from LibCommon_Time all;
	//LibIpv6
	import from LibIpv6_ExternalFunctions all;
	import from LibIpv6_Interface all ;
	import from LibIpv6_Rfc2460Root_TypesAndValues { type all };
	import from LibIpv6_ModuleParameters all ;
	import from LibIpv6_MultiRfcs_Templates all;
	import from LibIpv6_MultiRfcs_TypesAndValues all;
	import from LibIpv6_Rfc2461NeighborDiscovery_Templates all;
	import from LibIpv6_Rfc2461NeighborDiscovery_TypesAndValues all;
	import from LibIpv6_Rfc2463Icmpv6_Functions all;
	import from LibIpv6_MultiRfcs_TypesAndValues all;
	import from LibIpv6_MultiRfcs_Templates all;

	group routerDiscovery {

		/*
		** @desc  	This sends an ICMPv6 router advertisement from a router node
@@ -86,6 +89,8 @@ module LibIpv6_Rfc2461NeighborDiscovery_Functions {
				return v_ret ;
		}

	} // end group routerDiscovery

	group neighborDiscovery {

		/*
@@ -114,8 +119,128 @@ module LibIpv6_Rfc2461NeighborDiscovery_Functions {

		}// end f_sendNbrAdv

        /*
        ** @desc  	This sends an ICMPv6 router advertisement from a router node
        **			to any NUT and waits 1 sec (give IUT time tp process the packet).
        **          Prior it modifies IPv6 packet payload length and ICMPv6 checksum
        **          to their correct values.
        ** @remark  The template passed in must NOT contain any matching expressions!
        ** @param 	p_rtAdv Ipv6 packet template with router advertisement to be sent
        ** @returns	execution status
        */
        function f_sendRtAdvAndWait (in template RouterAdvertisement p_rtAdv) 
        runs on LibIpv6Node
        return FncRetCode {
            var Ipv6Packet v_ipPkt;

	        v_ipPkt.routerAdvert := valueof(p_rtAdv);
	        //calc payloadLen
	        v_ipPkt.routerAdvert.ipv6Hdr.payloadLength := fx_payloadLength (v_ipPkt);
	        //set checksum to zero
	        v_ipPkt.routerAdvert.checksum := c_2ZeroBytes;
	        //calc checksum
	        v_ipPkt.routerAdvert.checksum := fx_icmpv6Checksum(v_ipPkt);
	        //send
	        ipPort.send(v_ipPkt.routerAdvert);

            f_sleep ( PX_T_BUILD_GLA );

	        return e_success;

        } // end f_sendRtAdv

		/*
		** @desc  	This sends an ICMPv6 Neighbor Solicitation from any
		**			Ipv6 node to the NUT. Prior it modifies IPv6 packet payload 
		**			length and ICMPv6 checksum to their correct values.
		** @remark  The template passed in must NOT contain any matching expressions!
		** @param 	Ipv6 packet template with Neighbor Solicitation to be sent
		** @returns	execution status
		*/
		function f_sendNbrSol(in template NeighborSolicitation p_nbrSol) 
		runs on LibIpv6Node 
		return FncRetCode {
			var Ipv6Packet v_ipPkt;
			v_ipPkt.nbrSolicitation := valueof(p_nbrSol);
			//calc payloadLen
			v_ipPkt.nbrSolicitation.ipv6Hdr.payloadLength := fx_payloadLength (v_ipPkt);
			//set checksum to zero
			v_ipPkt.nbrSolicitation.checksum := c_2ZeroBytes;
			//calc checksum
			v_ipPkt.nbrSolicitation.checksum := fx_icmpv6Checksum(v_ipPkt);
			//send
			ipPort.send(v_ipPkt.nbrSolicitation);
			
			return e_success;
			
		}// end f_sendNbrSol

		/*
		** @desc  	This sends an ICMPv6 Router Solicitation from any
		**			Ipv6 node to the NUT. Prior it modifies IPv6 packet payload 
		**			length and ICMPv6 checksum to their correct values
		** @remark  The template passed in must NOT contain any matching expressions!
		** @param 	Ipv6 packet template with Router Solicitation to be sent
		** @returns	execution status
		*/
		function f_sendRtSol(in template RouterSolicitation p_rtrSol) 
		runs on LibIpv6Node 
		return FncRetCode {
			var Ipv6Packet v_ipPkt;
			v_ipPkt.routerSolicitation := valueof(p_rtrSol);
			//calc payloadLen
			v_ipPkt.routerSolicitation.ipv6Hdr.payloadLength := fx_payloadLength (v_ipPkt);
			//set checksum to zero
			v_ipPkt.routerSolicitation.checksum := c_2ZeroBytes;
			//calc checksum
			v_ipPkt.routerSolicitation.checksum := fx_icmpv6Checksum(v_ipPkt);
			//send
			ipPort.send(v_ipPkt.routerSolicitation);
			
			return e_success;
			
		}// end f_sendRtSol

	/*
	** @desc 	This function initiates Neighbor detection.
	**			Sent and received packets must be given as templates.
	** @remark  Time limit is defined by module parameter PX_TAC (see comp type)
	** @param 	p_echoRequest Echo Request to be sent
	** @param 	p_nbrSol Neighbor Solicitation to be sent
	** @param 	p_nbrAdv template of an NA that is sent by NUT
	** @return 	execution status
	*/
	function f_performNeighborDetection (
		in template NeighborSolicitation p_nbrSol,
		in template NeighborAdvertisement p_nbrAdv )
	runs on LibIpv6Node
	return FncRetCode {

		var FncRetCode v_ret;

		// Send a Neighbor Solicitation
		v_ret := f_sendNbrSol ( p_nbrSol );
		if ( v_ret != e_success ) { return v_ret; }

		tc_ac.start;
		alt {
			[]	ipPort.receive ( p_nbrAdv ) {
					tc_ac.stop;
					v_ret := e_success;
				}
			[]	tc_ac.timeout{
					v_ret := e_timeout;
				}
		} // end alt

		return v_ret;

	} // end f_performNeighborDetection

	}//end group neighborDiscovery

	group redirect {

		/*
		** @desc  	This sends an ICMPv6 redirect for a test component
		**          acting as any IPv6 node to the NUT.
@@ -143,4 +268,6 @@ module LibIpv6_Rfc2461NeighborDiscovery_Functions {

		}// end f_sendRedirect

	} // end group redirect

} // end module LibIpv6_Rfc2461NeighborDiscovery_Functions
+0 −117
Original line number Diff line number Diff line
/*
 *	@author 	STF 276
 *  @version 	$Id$
 *	@desc		This module specifies common neighborhood and router
 *              discovery messages interchanges (= operations)
 *              for an Ipv6 test component.
 *              Functions do not set a test component verdict but instead
 *              use the function return value instead to notify the function
 *              caller about the success of the operation.
 *  
 */
module LibIpv6_Rfc2461NeighborDiscovery_Functions_PK {

	//LibCommon
	import from LibCommon_BasicTypesAndValues all;
	import from LibCommon_DataStrings all;
	import from LibCommon_VerdictControl { type FncRetCode };
	import from LibCommon_Time all;
	//LibIpv6
	import from LibIpv6_ExternalFunctions all;
	import from LibIpv6_Interface all ;
	import from LibIpv6_Rfc2460Root_TypesAndValues { type all };
	import from LibIpv6_ModuleParameters all ;
	import from LibIpv6_MultiRfcs_Templates all;
	import from LibIpv6_MultiRfcs_TypesAndValues all;
	import from LibIpv6_Rfc2461NeighborDiscovery_Templates all;
	import from LibIpv6_Rfc2461NeighborDiscovery_TypesAndValues all;
	//AtsIpv6
	import from AtsIpv6_ModuleParameters all;

	group neighborDiscovery {

        /*
        ** @desc  	This sends an ICMPv6 router advertisement from a router node
        **			to any NUT and waits 1 sec (give IUT time tp process the packet).
        **          Prior it modifies IPv6 packet payload length and ICMPv6 checksum
        **          to their correct values.
        ** @remark  The template passed in must NOT contain any matching expressions!
        ** @param 	p_rtAdv Ipv6 packet template with router advertisement to be sent
        ** @returns	execution status
        */
        function f_sendRtAdvAndWait (in template RouterAdvertisement p_rtAdv) 
        runs on LibIpv6Node
        return FncRetCode {
            var Ipv6Packet v_ipPkt;

	        v_ipPkt.routerAdvert := valueof(p_rtAdv);
	        //calc payloadLen
	        v_ipPkt.routerAdvert.ipv6Hdr.payloadLength := fx_payloadLength (v_ipPkt);
	        //set checksum to zero
	        v_ipPkt.routerAdvert.checksum := c_2ZeroBytes;
	        //calc checksum
	        v_ipPkt.routerAdvert.checksum := fx_icmpv6Checksum(v_ipPkt);
	        //send
	        ipPort.send(v_ipPkt.routerAdvert);

            f_sleep ( PX_T_BUILD_GLA );

	        return e_success;

        } // end f_sendRtAdv

		/*
		** @desc  	This sends an ICMPv6 Neighbor Solicitation from any
		**			Ipv6 node to the NUT. Prior it modifies IPv6 packet payload 
		**			length and ICMPv6 checksum to their correct values.
		** @remark  The template passed in must NOT contain any matching expressions!
		** @param 	Ipv6 packet template with Neighbor Solicitation to be sent
		** @returns	execution status
		*/
		function f_sendNbrSol(in template NeighborSolicitation p_nbrSol) 
		runs on LibIpv6Node 
		return FncRetCode {
			var Ipv6Packet v_ipPkt;
			v_ipPkt.nbrSolicitation := valueof(p_nbrSol);
			//calc payloadLen
			v_ipPkt.nbrSolicitation.ipv6Hdr.payloadLength := fx_payloadLength (v_ipPkt);
			//set checksum to zero
			v_ipPkt.nbrSolicitation.checksum := c_2ZeroBytes;
			//calc checksum
			v_ipPkt.nbrSolicitation.checksum := fx_icmpv6Checksum(v_ipPkt);
			//send
			ipPort.send(v_ipPkt.nbrSolicitation);
			
			return e_success;
			
		}// end f_sendNbrSol

		/*
		** @desc  	This sends an ICMPv6 Router Solicitation from any
		**			Ipv6 node to the NUT. Prior it modifies IPv6 packet payload 
		**			length and ICMPv6 checksum to their correct values
		** @remark  The template passed in must NOT contain any matching expressions!
		** @param 	Ipv6 packet template with Router Solicitation to be sent
		** @returns	execution status
		*/
		function f_sendRtSol(in template RouterSolicitation p_rtrSol) 
		runs on LibIpv6Node 
		return FncRetCode {
			var Ipv6Packet v_ipPkt;
			v_ipPkt.routerSolicitation := valueof(p_rtrSol);
			//calc payloadLen
			v_ipPkt.routerSolicitation.ipv6Hdr.payloadLength := fx_payloadLength (v_ipPkt);
			//set checksum to zero
			v_ipPkt.routerSolicitation.checksum := c_2ZeroBytes;
			//calc checksum
			v_ipPkt.routerSolicitation.checksum := fx_icmpv6Checksum(v_ipPkt);
			//send
			ipPort.send(v_ipPkt.routerSolicitation);
			
			return e_success;
			
		}// end f_sendRtSol

	}//end group neighborDiscovery

} // end module LibIpv6_Rfc2461NeighborDiscovery_Functions
+906 −1

File changed.

Preview size limit exceeded, changes collapsed.

+0 −55
Original line number Diff line number Diff line
/*
 *	@author 	STF 276
 *  @version 	$Id$
 *	@desc		This module specifies common template definitions
 *              to specify IPv6 packets for neighborhood and router 
 *              discovery  
 *  
 */
 module LibIpv6_Rfc2461NeighborDiscovery_Templates_AF {

	//LibCommon
	import from LibCommon_BasicTypesAndValues all;
	import from LibCommon_DataStrings all;
	//LibIpv6
	import from LibIpv6_ExternalFunctions all;
	import from LibIpv6_ModuleParameters all ;
	import from LibIpv6_MultiRfcs_Templates all;
	import from LibIpv6_Rfc2460Root_Templates all;
	import from LibIpv6_MultiRfcs_TypesAndValues all;
	import from LibIpv6_Rfc2460Root_TypesAndValues all;
	import from LibIpv6_Rfc2463Icmpv6_TypesAndValues all;
	import from LibIpv6_Rfc2461NeighborDiscovery_TypesAndValues all ;
	
	
	group routerDiscovery {


		/*
		 *	@param  p_src Binary IPv6 address associated with the
		 *          test component.
		 *	@param  p_dst Binary IPv6 address associated with NUT.
		 */
		 template RouterAdvertisement m_rtAdv_curHL0_noOpt (Ipv6Address p_src, Ipv6Address p_dst) := {
			ipv6Hdr := m_ipHdr(c_icmpHdr, p_src, p_dst),
			extHdrList := omit,														
			icmpType:= c_rtAdv,
			icmpCode:= c_icmpCode0,
			checksum:= c_2ZeroBytes,
			curHopLimit:= c_hopLimit0,
			managedConfigFlag:= c_mFlag0,
			otherConfigFlag:= c_oFlag0,
			reserved:=0,
			routerLifetime:=c_infiniteLifetime,
			reachableTime:=c_unspecifiedReachTime,
			retransTimer:=c_unspecifiedRetransTime,
			rtAdvOptions:=omit
		}

	

	}// end	group routerDiscovery

	

} // end module LibIpv6_Rfc2461NeighborDiscovery_Templates_AF
+0 −927

File deleted.

Preview size limit exceeded, changes collapsed.

Loading