Commit 6805e484 authored by tepelmann's avatar tepelmann
Browse files

Re-engineered upper tester functions for GN.

parent ae123951
Loading
Loading
Loading
Loading
+36 −42
Original line number Diff line number Diff line
@@ -929,52 +929,46 @@ module LibItsGeoNetworking_Functions {
    
    group upperTester {
        
        function f_utGenerateGeoUnicastMessage(in GN_Address p_destinationGnAddr) runs on ItsNt {
            //TODO
        }

        // p_lifetime in seconds
        function f_utGenerateGeoUnicastMessageWithLifetime(in GN_Address p_destinationGnAddr, UInt6 p_lifetime) runs on ItsNt {
            //TODO   
        }

        function f_utGenerateGeoUnicastMessageWithPayload(in GN_Address p_destinationGnAddr, in octetstring p_payload) runs on ItsNt {
            //TODO
        }
        /**
         * @desc    Triggers event from the application layer
         * @param   p_event The event to trigger.
         * @return 
         */
        function f_utTriggerEvent(template (value) UtGNEvent p_event) runs on ItsNt return FncRetCode {
            var FncRetCode v_ret := e_success;
            var template (value) UtGNTrigger v_utMsg := { p_event };
            
        function f_utGenerateGeoBroadcastMessage(in charstring p_area) runs on ItsNt {
            //TODO
        }
            utPort.send(v_utMsg);
            
        function f_utGenerateGeoBroadcastMessageWithPayload(in charstring p_area) runs on ItsNt {
            //TODO
            return v_ret;
        }
        
        function f_utGenerateGeoAnycastMessage(in charstring p_area) runs on ItsNt {
            //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) GeoNetworkingPacket p_event) runs on ItsNt return FncRetCode {
            var FncRetCode v_ret := e_success;
            var template (value) UtGNCheck v_utMsg := { p_event };
            
        function f_utGenerateGeoAnycastMessageWithPayload(in charstring p_area) runs on ItsNt {
            //TODO
            utPort.send(v_utMsg);
            tc_ac.start;
            alt {
                [] utPort.receive(UtGNResult:true) {
                    setverdict (pass, "Event correctly indicated at application layer");
                    v_ret := e_success;
                }
        
        function f_utGenerateSHBMessage() runs on ItsNt {
            //TODO
                [] utPort.receive {
                    setverdict (fail, "Event not correctly indicated at application layer");
                    v_ret := e_error;
                }
        
        function f_utGenerateSHBMessageWithPayload() runs on ItsNt {
            //TODO
                [] tc_ac.timeout {
                    setverdict (inconc, "Timeout while waiting for event check result");
                    v_ret := e_timeout;
                }
        
        function f_utGenerateTSBMessage() runs on ItsNt {
            //TODO
            }
            
        function f_utCheckEvent(/*FIXME*/) runs on ItsNt return FncRetCode {
            var FncRetCode v_ret := e_error;
            
            //TODO
            
            return v_ret;
        }
        
+86 −1
Original line number Diff line number Diff line
@@ -29,6 +29,91 @@ module LibItsGeoNetworking_Templates {
            msgIn := p_geoNwMsg
        }
        
        group utPrimitives {
            
            template UtGNEvent m_generateGeoUnicastMessage(GN_Address p_destinationGnAddr) := {
                geoUnicast := {
                    gnAddress := p_destinationGnAddr,
                    lifetime := omit,
                    payload := omit
                }
            }
            
            template UtGNEvent m_generateGeoUnicastMessageWithLifetime(
                GN_Address p_destinationGnAddr,
                integer p_lifetime
            ) modifies m_generateGeoUnicastMessage := {
                geoUnicast := {
                    lifetime := p_lifetime
                }
            }
            
            template UtGNEvent m_generateGeoUnicastMessageWithPayload(
                GN_Address p_destinationGnAddr,
                Payload p_payload
            ) modifies m_generateGeoUnicastMessage := {
                geoUnicast := {
                    payload := p_payload
                }
            }
            
            template UtGNEvent m_generateGeoBroadcastMessage(
                charstring p_area
            ) := {
                geoBroadcast := {
                    area := p_area,
                    payload := omit
                }
            }
            
            template UtGNEvent m_generateGeoBroadcastMessageWithPayload(
                charstring p_area,
                Payload p_payload
            ) modifies m_generateGeoBroadcastMessage := {
                geoBroadcast := {
                    payload := p_payload
                }
            }
                    
            template UtGNEvent m_generateGeoAnycastMessage(
                charstring p_area
            ) := {
                geoAnycast := {
                    area := p_area,
                    payload := omit
                }
            }
            
            template UtGNEvent m_generateGeoAnycastMessageWithPayload(
                charstring p_area,
                Payload p_payload
            ) modifies m_generateGeoAnycastMessage := {
                geoAnycast := {
                    payload := p_payload
                }
            }
            
            template UtGNEvent m_generateSHBMessage := {
                shb := {
                    payload := omit
                }
            }
            
            template UtGNEvent m_generateSHBMessageWithPayload(
                Payload p_payload
            ) modifies m_generateSHBMessage := {
                shb := {
                    payload := p_payload
                }
            }
            template UtGNEvent m_generateTSBMessage := {
                tsb := {
                    payload := omit
                }
            }
            
        } // end utPrimitives
        
        group taPrimitives {
            
            /**
+43 −2
Original line number Diff line number Diff line
@@ -852,7 +852,48 @@ module LibItsGeoNetworking_TypesAndValues {
        
    } // end geoNwPicsTypes

    group taPrimitives {
    group utPrimitives {
        
        type record UtGNTrigger {
            UtGNEvent utEvent
        }
        
        type record UtGNCheck {
            GeoNetworkingPacket utEvent
        }
        
        type boolean UtGNResult;
        
        type union UtGNEvent {
            GenerateGeoUnicastMessage geoUnicast,
            GenerateGeoBroadcastMessage geoBroadcast,
            GenerateGeoAnycastMessage geoAnycast,
            GenerateSHBMessage shb,
            GenerateTSBMessage tsb
        }
        
        type record GenerateGeoUnicastMessage {
            GN_Address gnAddress,
            integer lifetime optional, // TODO shall we use the LifeTime type???
            Payload payload optional
        }
        
        type record GenerateGeoBroadcastMessage {
            charstring area,
            Payload payload optional
        }
        
        type GenerateGeoBroadcastMessage GenerateGeoAnycastMessage;
        
        type record GenerateSHBMessage {
            Payload payload optional
        }
        
        type GenerateSHBMessage GenerateTSBMessage;
        
    } // end utPrimitives

    group acPrimitives {
        
        type union AcGNEvent {
            TaStartBeaconing startBeaconing,
@@ -875,7 +916,7 @@ module LibItsGeoNetworking_TypesAndValues {
        type record TaStopPassBeaconing {
        }
        
    }
    } // end acPrimitives
    
}
with {
+3 −3
Original line number Diff line number Diff line
@@ -39,10 +39,10 @@ module LibIts_Interface {
        	 */
        	type port UpperTesterPort message {
        	    out 
        	       UtCamTrigger, UtDenmTrigger, UtBtpTrigger, 
        	       UtCamCheck, UtDenmCheck, UtBtpCheck;
        	       UtCamTrigger, UtDenmTrigger, UtBtpTrigger, UtGNTrigger,
        	       UtCamCheck, UtDenmCheck, UtBtpCheck, UtGNCheck;
        	    in 
        	       UtCamResult, UtDenmResult, UtBtpResult
        	       UtCamResult, UtDenmResult, UtBtpResult, UtGNResult
        	} // end UpperTesterPort
        	
        } // end portDefinitions