Commit fda488e4 authored by validator's avatar validator
Browse files

No commit message

No commit message
parent 077eeeb2
Loading
Loading
Loading
Loading
+39 −0
Original line number Diff line number Diff line
@@ -140,6 +140,44 @@ module LibIpv6_Rfc2461NeighborDiscovery_Functions {
				return v_ret ;
		}


		/*
		 * @desc  	This functions sends a router advertisement with the specified
		 *			prefix, so that NUT adds the test component as its RT to its
		 *          default router list
		 * @param 	p_llaAddrTn Local link address of testing node which calls this function
		 * @param 	p_dstAddr Local link address of node under test
		 * @param 	p_prefixLength Router advertisement option prefix length value
		 * @param 	p_glaAddrTn Global address of testing node which calls this function
		*/
		function f_sendRtAdvWithPrefix_time( in template Ipv6Address 	p_llaAddrTn,
										in template Ipv6Address 	p_dstAddr,
										in template PrefixLength p_prefixLength,
										in template Ipv6Address 	p_glaAddrTn,
										in UInt32 p_validLifetime,
										in UInt32 p_preferredLifetime)
		runs on LibIpv6Node
		return FncRetCode {

				var FncRetCode v_ret;

				v_ret := f_sendRtAdv( m_rtAdv_noExtHdr( p_llaAddrTn,
														p_dstAddr,
														c_mFlag0,
														c_oFlag0,
														c_infiniteLifetime,
														c_unspecifiedReachTime,
														c_unspecifiedRetransTime,
														m_rtAdvOpt_prefixOpt (	p_prefixLength,
																				c_lFlag1,
																				c_aFlag1,
																				p_validLifetime,
																				p_preferredLifetime,
																				f_createPrefix ( p_glaAddrTn, p_prefixLength ) ) ) ) ;
				return v_ret ;
		}


		/*
		 * @desc  	This functions sends a router advertisement with the specified
		 *			prefix, so that NUT adds the test component as its RT to its
@@ -169,6 +207,7 @@ module LibIpv6_Rfc2461NeighborDiscovery_Functions {
														m_mipRtAdvOpt_prefixOpt (	p_prefixLength,
																					c_lFlag1,
																					c_aFlag1,
																					c_rtAddrFlag1,
																					c_validLifetime30s,
																					c_preferredLifetime10s,
																					p_glaAddrTn,
+32 −1
Original line number Diff line number Diff line
@@ -1023,6 +1023,35 @@
			prefix:= p_prefix
		}
		
		/*
		 *	@param  p_prefixLength The length of the prefix
		 *	@param  p_lFlag Value for link flag.
		 *	@param  p_aFlag Value for autoconfiguration flag.
		  *	@param  p_rtAddrFlag Value for rtAddr flag.
		 *	@param  p_validLifetime Value for valid life time duration.
		 *	@param  p_preferredLifetime Value for preffered life time duration.
		 *	@param  p_prefix Address prefix to be used
		*/
		template PrefixInfo m_mipPrefixInfo (	template UInt8 p_prefixLength,
											UInt1 p_lFlag,
											UInt1 p_aFlag,
											UInt1 p_rtAddrFlag,
											UInt32 p_validLifetime,
											UInt32 p_preferredLifetime,
											template Ipv6Address p_prefix):= {
			icmpType:= c_prefixInfo,
			optionLength:= c_prefixInfoLen,
			prefixLength:= p_prefixLength,
			linkFlag:=p_lFlag,
			autoConfigFlag:=p_aFlag,
			rtAddrFlag := p_rtAddrFlag,
			reserved1:=0,
			validLifetime:=p_validLifetime,
			preferredLifetime:=p_preferredLifetime,
			reserved2:=0,
			prefix:= p_prefix
		}

		/*
		 *	@param  p_prefixLength The length of the prefix
		 *	@param  p_lFlag Value for link flag.
@@ -1193,6 +1222,7 @@
		template RtAdvOptions m_mipRtAdvOpt_prefixOpt (		template UInt8 p_prefixLength,
														UInt1 p_lFlag,
														UInt1 p_aFlag,
														UInt1 p_rtAddrFlag,
														UInt32 p_validLifetime,
														UInt32 p_preferredLifetime,
														template Ipv6Address p_prefix,
@@ -1200,9 +1230,10 @@
														template HomeAgentInfo p_homeAgentInfo):={
			srcLinkLayerAddr := omit,
			mtuOption:= omit,
			prefixInfoList := {  m_prefixInfo(	p_prefixLength,
			prefixInfoList := {  m_mipPrefixInfo(	p_prefixLength,
												p_lFlag,
												p_aFlag,
												p_rtAddrFlag,
												p_validLifetime,
												p_preferredLifetime,
												p_prefix) },
+3 −2
Original line number Diff line number Diff line
@@ -42,8 +42,9 @@
		const UInt8 c_maxPrefixLength := 128;
		
		const UInt1 c_haFlag0 := 0;
		const UInt1 c_haFlag1 := 0;
		const UInt1 c_haFlag1 := 1;
		const UInt1 c_rtAddrFlag0 := 0;
		const UInt1 c_rtAddrFlag1 := 1;		
		const UInt32 c_validLifetime0s := 0;
		const UInt32 c_validLifetime30s := 30;
		const UInt32 c_validLifetime60s := 60;
+11 −0
Original line number Diff line number Diff line
@@ -130,6 +130,17 @@
			data:= *
		}
		
		template EchoReply mw_echoReply_any := {
			ipv6Hdr := mw_ipHdr_nextHdr(c_icmpHdr),
			extHdrList := *,
			icmpType:= c_echoReply,
			icmpCode:= c_icmpCode0,
			checksum:= ?,
			identifier:= ?,
			sequenceNumber:= ?,
			data:= *
		}

		/*
		 *	@param  p_src Binary IPv6 address associated with the
		 *          test component.
+221 −46
Original line number Diff line number Diff line
@@ -133,7 +133,125 @@ module LibIpv6_Rfc3775Mipv6_Functions {
		 * @param p_mnHoaTn Mobile Node Home Address of test node
		 * @param p_haGlaNut Home Agent Address of node under test
		*/
		function f_receiveBindingUpdateAndReply(in template Ipv6Address p_haGlaTn)
		altstep a_receiveBindingUpdateAndReply(in template Ipv6Address p_haGlaTn)
		runs on Ipv6Node {
			//Variables
			var GeneralIpv6 v_generalIpv6 ;
			var UInt16 v_seqNr := 0;
			var Ipv6Address v_mnCareOfAddr1 := c_16ZeroBytes;
			var Ipv6Address v_mnCareOfAddr2 := c_16ZeroBytes;
			var Ipv6Address v_mnHomeAddr := c_16ZeroBytes;
			var FncRetCode v_ret := e_error;
			
			//tc_wait.start;
			//alt {
				//1st alternative : m_optPad2 + Coa
				[]	ipPort.receive(mw_generalIpv6_dst(	c_dstHdr,
															//p_mnCoaTn,
															p_haGlaTn,
															m_extHdrList_2Elem(
																m_extHdr_dstOptHeader(	c_mipHdr,
																						c_optLen2,
																						m_dstOptList_2Elem(
																							m_dstOpt_padN(m_optPad4),
																							mw_dstOpt_homeAddr)),
																mw_extHdr_mipHeader (c_noNextHdr,
																					c_bindingUpdate,
																					mw_bindingUpdate(c_aFlag1,
																									c_hFlag1,
																									c_lFlag0,
																									c_kFlag0,
																									m_mipOptList_2Elem(
																										m_mipOpt_padN(m_optPad2),
																										m_mipOpt_altCoa(mw_mipOptAltCoA))))))) -> value v_generalIpv6 {
						//Get SeqNr
						v_seqNr := v_generalIpv6.extHdrList[1].mipHeader.mipMessage.bindingUpdate.sequenceNumber;
						//Get CareOfAddress
						v_mnCareOfAddr1 := v_generalIpv6.ipv6Hdr.sourceAddress;
						//TODO read v_mnCareOfAddr2 from MipOptions
						//GetHomeAddress
						v_mnHomeAddr := v_generalIpv6.extHdrList[0].destinationOptionHeader.destOptionList[1].homeAddressOption.homeAddress;
						//tc_wait.stop;	
						v_ret := e_success ;
						v_ret := f_sendGeneralIpv6(m_generalIpv6_srcDst(	c_routeHdr,
																													p_haGlaTn,
																													v_mnCareOfAddr1,
																													m_extHdrList_2Elem(
																														m_extHdr_routingHeader(
																															c_mipHdr,
																															c_routeHdrLen2,
																															c_routeHdrType2,
																															c_routeHdrSegmentsLeft1,
																															m_routingHeaderData_homeAddress(v_mnHomeAddr)),
																														m_extHdr_mipHeader (
																															c_noNextHdr,
																															c_bindingAck,
																															m_bindingAck(
																																v_seqNr,
																																m_mipOptList_1Elem(
																																m_mipOpt_padN(m_optPad4)))))));
					}
				//2nd alternative : m_optPad4
				[]	ipPort.receive(mw_generalIpv6_dst(	c_dstHdr,
															//p_mnCoaTn,
															p_haGlaTn,
															m_extHdrList_2Elem(
																m_extHdr_dstOptHeader(	c_mipHdr,
																						c_optLen2,
																						m_dstOptList_2Elem(
																							m_dstOpt_padN(m_optPad4),
																							mw_dstOpt_homeAddr)),
																mw_extHdr_mipHeader (c_noNextHdr,
																					c_bindingUpdate,
																					mw_bindingUpdate(c_aFlag1,
																									c_hFlag1,
																									c_lFlag0,
																									c_kFlag0,
																									m_mipOptList_1Elem(
																										m_mipOpt_padN(m_optPad4))))))) -> value v_generalIpv6 {
						//Get SeqNr
						v_seqNr := v_generalIpv6.extHdrList[1].mipHeader.mipMessage.bindingUpdate.sequenceNumber;
						//Get CareOfAddress
						v_mnCareOfAddr1 := v_generalIpv6.ipv6Hdr.sourceAddress;
						//GetHomeAddress
						v_mnHomeAddr := v_generalIpv6.extHdrList[0].destinationOptionHeader.destOptionList[1].homeAddressOption.homeAddress;
						//tc_wait.stop;	
						v_ret := e_success ;
						v_ret := f_sendGeneralIpv6(m_generalIpv6_srcDst(	c_routeHdr,
																							p_haGlaTn,
																							v_mnCareOfAddr1,
																							m_extHdrList_2Elem(
																								m_extHdr_routingHeader(
																									c_mipHdr,
																									c_routeHdrLen2,
																									c_routeHdrType2,
																									c_routeHdrSegmentsLeft1,
																									m_routingHeaderData_homeAddress(v_mnHomeAddr)),
																								m_extHdr_mipHeader (
																									c_noNextHdr,
																									c_bindingAck,
																									m_bindingAck(
																										v_seqNr,
																										m_mipOptList_1Elem(
																										m_mipOpt_padN(m_optPad4)))))));
					}
				[]	tc_wait.timeout{
						v_ret :=  e_timeout;
						log("**** f_receiveBindingUpdateAndReply: ERROR: tc_ac.timeout **** ");
					}		
			//} // end alt

			//return v_ret;

		}//end f_receiveBindingUpdateAndReply
		
		/*
		 * @desc  primaryCareOfAddressRegistration
		 * @param p_mnCoaTn Mobile Node Care Of Address of test node
		 * @param p_mnHoaTn Mobile Node Home Address of test node
		 * @param p_haGlaNut Home Agent Address of node under test
		*/
		function f_receiveBindingUpdateAndReply_lifeTime(in template Ipv6Address p_haGlaTn, in UInt16 p_lifeTime)
		runs on Ipv6Node
		return FncRetCode {
			//Variables
@@ -158,10 +276,11 @@ module LibIpv6_Rfc3775Mipv6_Functions {
																						mw_dstOpt_homeAddr)),
															mw_extHdr_mipHeader (c_noNextHdr,
																				c_bindingUpdate,
																					mw_bindingUpdate(c_aFlag1,
																				mw_bindingUpdate_lifeTime(c_aFlag1,
																								c_hFlag1,
																								c_lFlag0,
																								c_kFlag0,
																								p_lifeTime,
																								m_mipOptList_2Elem(
																									m_mipOpt_padN(m_optPad2),
																									m_mipOpt_altCoa(mw_mipOptAltCoA))))))) -> value v_generalIpv6 {
@@ -226,12 +345,68 @@ module LibIpv6_Rfc3775Mipv6_Functions {
																				v_seqNr,
																				m_mipOptList_1Elem(
																					m_mipOpt_padN(m_optPad4)))))));
			}//end if
	
	

			}

			return v_ret;

		}//end f_receiveBindingUpdateAndReply

		/*
		 * @desc  primaryCareOfAddressRegistration
	 	 * @param p_mnCoaTn Mobile Node Care Of Address of test node
		 * @param p_mnHoaTn Mobile Node Home Address of test node
		 * @param p_haGlaNut Home Agent Address of node under test
		*/
		function f_sendBindUpAndWaitForBindAckAtHome(	in template Ipv6Address p_mnCoaTn,
														in template Ipv6Address p_mnHoaTn,
														in template Ipv6Address p_haGlaNut,
														in UInt16 p_seqNr,
														in UInt16 p_timeUnits)
		runs on Ipv6Node
		return FncRetCode {
			var FncRetCode v_ret;
				
			v_ret := f_sendGeneralIpv6(m_generalIpv6_srcDst(c_mipHdr,
															p_mnCoaTn,
															p_haGlaNut,
															m_extHdrList_1Elem(
																m_extHdr_mipHeader (c_noNextHdr,
																					c_bindingUpdate,
																					m_bindingUpdate(p_seqNr,
																									c_aFlag1,
																									c_hFlag1,
																									c_lFlag0,
																									c_kFlag0,
																									p_timeUnits,
																									m_mipOptList_2Elem(
																										m_mipOpt_padN(m_optPad2),
																										m_mipOpt_altCoa(m_mipOptAltCoA(p_mnCoaTn))))))));
			if ( v_ret != e_success ) {return v_ret;}
			tc_ac.start;
			alt {
				[]	ipPort.receive(mw_generalIpv6_srcDst(	c_mipHdr,
														p_haGlaNut,
														p_mnCoaTn,
														m_extHdrList_1Elem(
														mw_extHdr_mipHeader (	c_noNextHdr,
																				c_bindingAck,
																				mw_bindingAck(p_seqNr))))) {
						tc_ac.stop;	
						v_ret := e_success ;
					}
				[]	tc_ac.timeout{
						v_ret :=  e_timeout;
						log("**** f_registerMnToHa: ERROR: tc_ac.timeout **** ");
					}		
			} // end alt

			return v_ret;

		}//end f_sendBindUpAndWaitForBindAckAtHome
		
		/*
		 * @desc  primaryCareOfAddressRegistration
		 * @param p_mnCoaTn Mobile Node Care Of Address of test node
Loading