Commit f3ac6701 authored by tepelmann's avatar tepelmann
Browse files

Re-engineered upper tester functions for BTP.

parent cb492431
Loading
Loading
Loading
Loading
+55 −12
Original line number Diff line number Diff line
@@ -31,21 +31,64 @@

    group upperTester {
        
        function f_utGenerateBtpAPacket(in BtpPortId p_DestPort, in BtpPortId p_SrcPort) runs on ItsNt {
            //TODO
        };
        /**
         * @desc    Triggers event from the application layer
         * @param   p_event The event to trigger.
         * @return 
         */
        function f_utTriggerEvent(template (value) UtBtpEvent p_event) runs on ItsFa return FncRetCode {
            var FncRetCode v_ret := e_success;
            var template (value) UtBtpTrigger v_utMsg := { p_event };
            
        function f_utGenerateBtpBPacket(in BtpPortId p_DestPort, in BtpPortInfo p_DestPortInfo) runs on ItsNt {
            //TODO
        };
            utPort.send(v_utMsg);
            
        function f_utCheckPayload(in BtpPayload p_payload) runs on ItsNt return FncRetCode {
            var FncRetCode v_ret := e_error;
            return v_ret;
        }
        
            //TODO
        /**
         * @desc Checks that the event was indicated at the application layer
         * @param p_event The event to check.
         * @return 
         */
        function f_utCheckEvent(template (value) UtBtpEvent p_event) runs on ItsFa return FncRetCode {
            var FncRetCode v_ret := e_success;
            var template (value) UtBtpCheck v_utMsg := { p_event };
            
            utPort.send(v_utMsg);
            tc_ac.start;
            alt {
                [] utPort.receive(UtBtpResult:true) {
                    setverdict (pass, "Event correctly indicated at application layer");
                    v_ret := e_success;
                }
                [] utPort.receive {
                    setverdict (fail, "Event not correctly indicated at application layer");
                    v_ret := e_error;
                }
                [] tc_ac.timeout {
                    setverdict (inconc, "Timeout while waiting for event check result");
                    v_ret := e_timeout;
                }
            }
            
            return v_ret;
        };
        }
        
//        function f_utGenerateBtpAPacket(in BtpPortId p_DestPort, in BtpPortId p_SrcPort) runs on ItsNt {
//            //TODO
//        };
//
//        function f_utGenerateBtpBPacket(in BtpPortId p_DestPort, in BtpPortInfo p_DestPortInfo) runs on ItsNt {
//            //TODO
//        };
//
//        function f_utCheckPayload(in BtpPayload p_payload) runs on ItsNt return FncRetCode {
//            var FncRetCode v_ret := e_error;
//            
//            //TODO
//            
//            return v_ret;
//        };
        
    } // end of group upper tester    
    
+37 −0
Original line number Diff line number Diff line
@@ -26,6 +26,43 @@ module LibItsBtp_Templates {
            msgIn := p_btpPkt
        }
    
        group utPrimitives {
            
            /**
             * @desc Generate a BTP A packet
             * @param p_destPort  The destination port
             * @param p_srcPort   The source port
             */
            template (value) UtBtpEvent m_generateBtpAPacket(in BtpPortId p_destPort, in BtpPortId p_srcPort) := {
                btpA := {
                    destinationPort := p_destPort,
                    sourcePort := p_srcPort
                }
            }
            
            /**
             * @desc Generate a BTP B packet
             * @param p_destPort      The destination port
             * @param p_destPortInfo  The destination port information
             */
            template (value) UtBtpEvent m_generateBtpBPacket(in BtpPortId p_destPort, in BtpPortInfo p_destPortInfo) := {
                btpB := {
                    destinationPort := p_destPort,
                    destinationPortInfo := p_destPortInfo
                }
            }
            
            /**
             * @desc Generate a BTP B packet
             * @param p_destPort      The destination port
             * @param p_destPortInfo  The destination port information
             */
            template (value) UtBtpEvent m_checkPayload(in BtpPayload p_payload) := {
                payload := p_payload
            }
            
        } // end utPrimitives
        
    } // btpPrimitivesTemplates
    
    group btpPduTemplates {
+20 −0
Original line number Diff line number Diff line
@@ -82,6 +82,26 @@ module LibItsBtp_TypesAndValues {
        
    } //end btpPayload

    group utPrimitives {
        
        type record UtBtpTrigger {
            UtBtpEvent utEvent
        }
        
        type record UtBtpCheck {
            UtBtpEvent utEvent
        }
        
        type boolean UtBtpResult;
        
        type union UtBtpEvent {
            BtpAHeader  btpA,
            BtpBHeader  btpB,
            BtpPayload  payload
        }
        
    } // end utPrimitives
    
}
with {
    encode "LibItsBtp_TypesAndValues"
+3 −3
Original line number Diff line number Diff line
@@ -38,10 +38,10 @@ module LibIts_Interface {
        	 */
        	type port UpperTesterPort message {
        	    out 
        	       UtCamTrigger, UtDenmTrigger, 
        	       UtCamCheck, UtDenmCheck;
        	       UtCamTrigger, UtDenmTrigger, UtBtpTrigger, 
        	       UtCamCheck, UtDenmCheck, UtBtpCheck;
        	    in 
        	       UtCamResult, UtDenmResult
        	       UtCamResult, UtDenmResult, UtBtpResult
        	} // end UpperTesterPort
        	
        } // end portDefinitions