Commit 6dab452f authored by mullers's avatar mullers
Browse files

1.batch of Esp TCs

parent e888c995
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
@@ -1328,6 +1328,27 @@ module LibIpv6_Interface_Templates {
				icv := omit }
		}

		template ExtensionHeader m_extHdr_espHeader_icv(
			in UInt32 p_spi,
			in UInt32 p_seqNr,
			in template EspIpDatagram p_espIpDatagram,
			in UInt8 p_nextHdr,
			octetstring p_icv) := {
			espHeader := {
				// Header
				spi := p_spi, seqNbr := p_seqNr,
				// Payload
				espPayload := {
					iv := omit,
					espIpDatagram := p_espIpDatagram,
					tfcPadding := omit },
				// Trailer
				padding := omit,
				padLength := 0,
				nextHdr := p_nextHdr,
				icv := p_icv }
		}

		template ExtensionHeader mw_extHdr_espHeader(
			in UInt32 p_spi,
			in UInt32 p_seqNr,
+2 −0
Original line number Diff line number Diff line
@@ -1094,6 +1094,8 @@ module LibIpv6_Interface_TypesAndValues {
				Ipv6Payload			ipv6Payload optional
			}

			const octetstring c_wrongIcv := '8A8B8C'O; 
		
	}//end group rfc4303Esp_ExtHdrTypesAndValues

	} // end extensionHeaders
+132 −0
Original line number Diff line number Diff line
@@ -15,7 +15,10 @@
	import from LibCommon_DataStrings all;
	import from LibCommon_VerdictControl { type FncRetCode };
	//LibIpv6
	import from AtsIpv6_TestSystem all;
	import from LibIpv6_Interface_TypesAndValues all ;
	import from LibIpv6_Interface_Templates all;
	import from AtsIpv6_TestConfiguration_TypesAndValues all;
	import from LibIpv6_CommonRfcs_TypesAndValues all;
	import from LibIpv6_CommonRfcs_Functions all;
	import from LibIpv6_ModuleParameters all ;
@@ -312,5 +315,134 @@

	}//end group group echoProcedureFnsMixedWithOtherRfcs

group IcmpAndEspFns {
		
	/*
	 * @desc  	EchoProcedure With Esp Hdr
	 * @param	p_paramsTn Address Information of the TN
	 * @param	p_paramsIut Address Information of the IUT
	 * @param	p_paramsTunnelStart Address Information of the Tunnel Start
	 * @param	p_paramsTunnelEnd Address Information of the Tunnel End
	 */
	function f_echoProcWithEsp (
		template Ipv6NodeParams p_paramsTn,
		template Ipv6NodeParams p_paramsIut,
		template Ipv6NodeParams p_paramsTunnelStart,
		template Ipv6NodeParams p_paramsTunnelEnd)
	runs on Ipv6Node
	return FncRetCode {
		var FncRetCode v_ret := e_error;

		if (vc_sad[0].ipSecProtocolMode == e_transportMode) {
			
			v_ret := f_sendEchoRequestWithEsp (
				m_echoRequest_esp (
					c_espHdr,
					p_paramsTn.gla,
					p_paramsIut.gla,
					m_extHdrList_1Elem (
						m_extHdr_espHeader(
							vc_sad[0].spi,
							vc_sad[0].seqNr,
							m_espIpDatagram(
								omit,
								m_ipv6Payload_echoRequestMsg(
									m_echoRequestMsg(
										c_defId,
										c_defSeqNo))),
							c_icmpHdr))
				 ) );
			if (v_ret != e_success) {return v_ret;}
			
			tc_ac.start;
			alt {
				[]	ipPort.receive ( 	
						m_echoRequest_esp (
							c_espHdr,
							p_paramsIut.gla,
							p_paramsTn.gla,
							m_extHdrList_1Elem (
								mw_extHdr_espHeader(
									vc_sad[0].spi,
									vc_sad[0].seqNr + 1,
									m_espIpDatagram(
										omit,
										m_ipv6Payload_echoRequestMsg(
											mw_echoRequestMsg(
												c_defId,
												c_defSeqNo))),
									c_icmpHdr))
							)) {
						tc_ac.stop;	
						v_ret := e_success;
				}
				[]	tc_ac.timeout{
					v_ret := e_timeout;
				}		
			} // end alt
		}
		else{
		
			v_ret := f_sendEchoRequestWithEsp (
				m_echoRequest_esp (
					c_espHdr,
					p_paramsTunnelStart.gla,
					p_paramsTunnelEnd.gla,
					m_extHdrList_1Elem (
						m_extHdr_espHeader(
							vc_sad[0].spi,
							vc_sad[0].seqNr,
							m_espIpDatagram(
								m_extHdrList_1Elem(
									m_extHdr_tunneledHeader (
										c_icmpHdr,
										p_paramsTn.gla,
										p_paramsIut.gla )),
								m_ipv6Payload_echoRequestMsg(
									m_echoRequestMsg(
										c_defId,
										c_defSeqNo))),
							c_tunneledIpHdr))
				 ) );
			if (v_ret != e_success) {return v_ret;}
			
			tc_ac.start;
			alt {
				[]	ipPort.receive ( 	
						m_echoRequest_esp (
							c_espHdr,
							p_paramsTunnelEnd.gla,
							p_paramsTunnelStart.gla,
							mw_extHdrList_1Elem_superSet (
								mw_extHdr_espHeader(
									vc_sad[0].spi,
									vc_sad[0].seqNr + 1,
									m_espIpDatagram(
										m_extHdrList_1Elem(
											mw_extHdr_tunneledHeader (
												c_icmpHdr,
												p_paramsIut.gla,
												p_paramsTn.gla )),
										m_ipv6Payload_echoRequestMsg(
											mw_echoRequestMsg(
												c_defId,
												c_defSeqNo))),
									c_tunneledIpHdr))
							)) {
						tc_ac.stop;	
						v_ret := e_success;
				}
				[]	tc_ac.timeout{
					v_ret := e_timeout;
				}		
			} // end alt
		}

		return v_ret;

	} // end f_echoProcWithEsp	
		
}//end IcmpAndEspFns


} // end module LibIpv6_MultiRfcs_Functions