Commit 23c6c9c4 authored by poglitsch's avatar poglitsch
Browse files

verdict setting improved

parent d3093081
Loading
Loading
Loading
Loading
+38 −16
Original line number Diff line number Diff line
@@ -5,15 +5,26 @@
 */

module LibIot_Functions {
	import from LibIot_PICS {modulepar PX_CONFOMANCE_CHECK;}
	import from LibIot_PIXITS {modulepar PX_TTCN3_VERDICT;}

	import from LibIot_TypesAndValues {
		signature Trigger;
		type IOTVerdict, ParameterList, Status, StatusCode, TriggerCommand;
		type
			IOTVerdict,
			IOTVerdictType,
			ParameterList,
			Status,
			StatusCode,
			TriggerCommand;
	}

	import from LibIot_TestInterface {
		type TestCoordinator, EutTrigger, InterfaceMonitor, OracleServer, OracleClient;
		type
			TestCoordinator,
			EutTrigger,
			InterfaceMonitor,
			OracleServer,
			OracleClient;
	}
	
	
@@ -27,9 +38,8 @@ module LibIot_Functions {
    	function f_setConformanceVerdict(in verdicttype p_verdict,
    									 in charstring p_reason)
    	runs on OracleClient {
    		var IOTVerdict v_verdict := {conformance := p_verdict};
    		log("Conformance verdict set to: ", p_verdict);
    		log(p_reason);
    		var IOTVerdict v_verdict := {conformance := {p_verdict, p_reason}};
    		log("Conformance verdict set to: ", p_verdict, p_reason);
    		vPort.send(v_verdict);
    	}
    
@@ -40,9 +50,8 @@ module LibIot_Functions {
    	*/
    	function f_setE2EVerdict(in verdicttype p_verdict, in charstring p_reason)
    	runs on OracleClient {
    		var IOTVerdict v_verdict := {e2e := p_verdict};
    		log("E2E verdict set to: ", p_verdict);
    		log(p_reason);
    		var IOTVerdict v_verdict := {e2e := {p_verdict, p_reason}};
    		log("E2E verdict set to: ", p_verdict, p_reason);
    		vPort.send(v_verdict);
    	}
    
@@ -51,13 +60,26 @@ module LibIot_Functions {
    	* @param p_verdict the verdict received
    	*/
    	function f_setIOTVerdict(in IOTVerdict p_verdict) runs on OracleServer {
    		f_logIOTVerdict(p_verdict);
    		if (ischosen(p_verdict.e2e) and PX_TTCN3_VERDICT == e_e2e) {
    			setverdict(p_verdict.e2e.verdict, p_verdict.e2e.reason);
    		} else if (ischosen(p_verdict.conformance) and PX_TTCN3_VERDICT == e_conformance) {
    			setverdict(p_verdict.conformance.verdict, p_verdict.conformance.reason);
    		}
    	}
    	
    	
    	function f_logIOTVerdict(in IOTVerdict p_verdict) runs on OracleServer {
    		if (ischosen(p_verdict.e2e)) {
    			setverdict(p_verdict.e2e);
    		} else if (PX_CONFOMANCE_CHECK) {
    			setverdict(p_verdict.conformance);
    			vc_e3e_verdicts[sizeof(vc_e3e_verdicts)] := p_verdict.e2e;
    			log("E2E verdict set to: ", p_verdict.e2e.verdict, "Reason: " & p_verdict.e2e.reason);
    		} else  {
    			vc_conf_verdicts[sizeof(vc_conf_verdicts)] := p_verdict.conformance;
    			log("Conformance verdict set to: ", p_verdict.conformance.verdict, "Reason: " & p_verdict.conformance.reason);
    		}
    	}
    	
    
    	/**
    	* @desc listens continously on the port for receiving verdict 
    	* @param p_idx index of the port
@@ -74,13 +96,13 @@ module LibIot_Functions {
	group triggerFunctions {
		function f_sendTriggerCmd(in TriggerCommand p_cmd, in ParameterList p_params) runs on EutTrigger {
			var Status v_status;
			var charstring v_reason;
			var charstring v_reason := "";
			
			tPort.call(Trigger:{p_cmd, p_params}, 5.0) {
				[] tPort.getreply(Trigger:{-,-} value Status:{e_success, *}) -> value v_status {
					if(ispresent(v_status.reason)) {
						v_reason := v_status.reason;
						f_setE2EVerdict(pass, "Trigger command successful: " & v_reason);
						f_setE2EVerdict(pass, "Trigger command """ & p_cmd & """successful: " & v_reason);
					}else {
						f_setE2EVerdict(pass, "Trigger command successful");
					}
@@ -88,13 +110,13 @@ module LibIot_Functions {
				[] tPort.getreply(Trigger:{-,-} value ?) -> value  v_status {
					if(ispresent(v_status.reason)) {
						v_reason := v_status.reason;
						f_setE2EVerdict(fail, "Trigger command unsuccessful: " & v_reason);
						f_setE2EVerdict(fail, "Trigger command """ & p_cmd & """unsuccessful: " & v_reason);
					}else {
						f_setE2EVerdict(fail, "Trigger command unsuccessful: no reason given");
					}
				}
				[] tPort.catch (timeout) {
					f_setE2EVerdict(inconc, "Timer expired while waiting for Trigger command response");
					f_setE2EVerdict(inconc, "Timer expired while waiting for reponse of Trigger command """ & p_cmd & """");
				}
			}
		}
+3 −5
Original line number Diff line number Diff line
@@ -7,11 +7,7 @@

module LibIot_TestInterface {

	import from LibIot_PICS all;
	import from LibIot_TypesAndValues {
		const all;
		type ComponentIdList, DefaultList;
	}
	import from LibIot_TypesAndValues {type ComponentIdList, VerdictTypeList;}

	import from LibCommon_Sync all;
	
@@ -43,6 +39,8 @@ module LibIot_TestInterface {
		*/				
		type component OracleServer extends ServerSyncComp {
			port VerdictPort vPort;
			var VerdictTypeList vc_e3e_verdicts;
			var VerdictTypeList vc_conf_verdicts;
		}
		
		type component OracleClient extends SelfSyncComp {
+10 −3
Original line number Diff line number Diff line
@@ -38,11 +38,18 @@ module LibIot_TypesAndValues {
	
	type enumerated IOTVerdictType { e_e2e, e_conformance } // TODO think about name
	
	type record VerdictType {
		verdicttype verdict,
		charstring reason optional	
	}
	
	type union IOTVerdict {
		verdicttype e2e,
		verdicttype conformance	
		VerdictType e2e,
		VerdictType conformance	
	}
	
	type record of VerdictType VerdictTypeList;
	
	/**
     * @desc Default record
     */