Commit e8a7f90c authored by poglitsch's avatar poglitsch
Browse files

improved version

parent 2d1cd476
Loading
Loading
Loading
Loading
+104 −66
Original line number Diff line number Diff line
@@ -7,12 +7,18 @@
module LibIot_Functions {
	import from LibIot_PICS {modulepar PX_CONFOMANCE_CHECK;}

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

	import from LibIot_TestInterface {
		type TestCoordinator, TestMonitor, TestOracle;
		type TestCoordinator, TestDriver, TestMonitor, TestOracle, OracleClient;
	}
	
	
	group oracleFunctions {
    
    	/**
    	 * @desc sets the conformance verdict and send it to the test oracle
    	 * @param p_verdict conformance verdict set by the monitor
@@ -20,7 +26,7 @@ module LibIot_Functions {
    	 */
    	function f_setConformanceVerdict(in verdicttype p_verdict,
    									 in charstring p_reason)
	runs on TestMonitor {
    	runs on OracleClient {
    		var IOTVerdict v_verdict := {conformance := p_verdict};
    		log("Conformance verdict set to: ", p_verdict);
    		log(p_reason);
@@ -33,7 +39,7 @@ module LibIot_Functions {
    	* @param p_reason reason why the verdict has been set
    	*/
    	function f_setE2EVerdict(in verdicttype p_verdict, in charstring p_reason)
	runs on TestMonitor {
    	runs on OracleClient {
    		var IOTVerdict v_verdict := {e2e := p_verdict};
    		log("E2E verdict set to: ", p_verdict);
    		log(p_reason);
@@ -44,7 +50,7 @@ module LibIot_Functions {
    	* @desc evaluate the test verdict and sets it correspondingly
    	* @param p_verdict the verdict received
    	*/
	function f_setVerdict(in IOTVerdict p_verdict) runs on TestOracle {
    	function f_setIOTVerdict(in IOTVerdict p_verdict) runs on TestOracle {
    		if (ischosen(p_verdict.e2e)) {
    			setverdict(p_verdict.e2e);
    		} else if (PX_CONFOMANCE_CHECK) {
@@ -56,14 +62,45 @@ module LibIot_Functions {
    	* @desc listens continously on the port for receiving verdict 
    	* @param p_idx index of the port
    	*/
	altstep a_receiveIOTVerdict(in integer p_idx) runs on TestOracle {
    	altstep a_receiveIOTVerdict() runs on TestOracle {
    		var IOTVerdict v_verdict;
		[] vPort[p_idx].receive(IOTVerdict:?) -> value v_verdict {
			f_setVerdict(v_verdict);
    		[] vPort.receive(IOTVerdict:?) -> value v_verdict {
    			f_setIOTVerdict(v_verdict);
    			repeat;
    		}
    	}
	}
	
	group triggerFunctions {
		function f_sendTriggerCmd(in TriggerCommand p_cmd, in ParameterList p_params) runs on TestDriver {
			var Status v_status;
			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);
					}else {
						f_setE2EVerdict(pass, "Trigger command successful");
					}
				}
				[] tPort.getreply(Trigger:{-,-} value ?) -> value  v_status {
					if(ispresent(v_status.reason)) {
						v_reason := v_status.reason;
						f_setE2EVerdict(pass, "Trigger command successful: " & v_reason);
					}else {
						f_setE2EVerdict(pass, "Trigger command unsuccessful: no reason given");
					}
				}
				[] tPort.catch (timeout) {
					f_setE2EVerdict(inconc, "Timer expired while waiting for Trigger command response");
				}
			}
		}
	}
	
	group miscFunctions {
    	/**
    	* @desc 	searches the array for a given name and returns 
    	* 			the corresponding index
@@ -81,3 +118,4 @@ module LibIot_Functions {
    		return - 1;
    	}
	}
}
 No newline at end of file
+40 −23
Original line number Diff line number Diff line
@@ -9,62 +9,82 @@

module LibIot_TestConfiguration {
	
	import from LibIot_Functions {altstep a_receiveIOTVerdict;}

	import from LibIot_TestInterface {
		type TestCoordinator, TestMonitor, TestOracle;
		type OracleClient, TestCoordinator, TestDriver, TestMonitor, TestOracle;
	}
	
	/**
	* @desc 	connects the port of the monitor component to the 
	* 			port of the test oracle and activates the default
	* @param 	p_monitor	monitor component 	
	* @param 	p_idx		index of the monitor component
	*/
	function f_cf_oracle_up(in TestMonitor p_monitor, in integer p_idx) runs on TestOracle {
		connect(self:vPort[p_idx], p_monitor:vPort);
		vc_monitorDefaults[p_idx] := activate(a_receiveIOTVerdict(p_idx));	
	function f_cf_oracle_up(in OracleClient p_client) runs on TestOracle {
		connect(self:vPort, p_client:vPort);
	}
	
	/**
	* @desc 	deactivates the default and disconnects the port of the monitor
	* 			component
	* @param 	p_monitor	monitor component 	
	* @param 	p_idx		index of the monitor component
	*/	
	function f_cf_oracle_down(in TestMonitor p_monitor, in integer p_idx) runs on TestOracle {
		deactivate(vc_monitorDefaults[p_idx]);
		disconnect(self:vPort[p_idx], p_monitor:vPort);
	function f_cf_oracle_down(in OracleClient p_client) runs on TestOracle {
		disconnect(self:vPort, p_client:vPort);
	}
	
	/**
	 * 
	 * @desc initialize trigger component ports
	 * @param p_driver trigger component
	 */
	function f_cf_trigger_up(in TestDriver p_driver) runs on TestCoordinator {
		// connect sync ports
		connect(p_driver:syncPort, self:syncPort);
		// connect TSI ports 
		connect(p_driver:tPort, system:tPort);
		// configure oracle
		f_cf_oracle_up(p_driver);
	}
	
	/**
	 * 
	 * @desc uninitialize trigger component ports
	 * @param p_driver trigger component
	 */
	function f_cf_trigger_down(in TestDriver p_driver) runs on TestCoordinator {
		// disconnect sync ports
		disconnect(p_driver:syncPort, self:syncPort);
		// disconnect TSI ports 
		disconnect(p_driver:tPort, system:tPort);
		// release oracle ports
		f_cf_oracle_down(p_driver);
	}
	
	/**
	* @desc 	configures monitor component: connects to the synchronnization
	* 			port, maps to the TSI port and connects to the oracle 
	* @param 	p_monitor	monitor component 
	* @param 	p_idx		index of the monitor component
	*/	
	function f_cf_monitor_up(in TestMonitor p_monitor, in integer p_idx) runs on TestCoordinator {
	function f_cf_monitor_up(in TestMonitor p_monitor) runs on TestCoordinator {
		// connect sync ports
		connect(p_monitor:syncPort, self:syncPort);
		// mapp TSI port
		map(p_monitor:mPort, system:mPort[p_idx]);
		map(p_monitor:mPort, system:mPort);
		// configure oracle
		f_cf_oracle_up(p_monitor, p_idx);
		f_cf_oracle_up(p_monitor);
	}

	/**
	* @desc 	frees monitor component: disconnects the synchronnization
	* 			port, unmaps from the TSI port and disconnects from the oracle 
	* @param 	p_monitor	monitor component 
	* @param 	p_idx		index of the monitor component
	*/		
	function f_cf_monitor_down(in TestMonitor p_monitor, in integer p_idx) runs on TestCoordinator {
	function f_cf_monitor_down(in TestMonitor p_monitor) runs on TestCoordinator {
		// connect sync ports
		disconnect(p_monitor:syncPort, self:syncPort);
		// mapp TSI port
		unmap(p_monitor:mPort, system:mPort[p_idx]);
		unmap(p_monitor:mPort, system:mPort);
		// configure oracle
		f_cf_oracle_down(p_monitor, p_idx);
		f_cf_oracle_down(p_monitor);
	}
	
	/**
@@ -82,7 +102,4 @@ module LibIot_TestConfiguration {
		
		return v_monitor; 
	}
	
	
	
}
 No newline at end of file
+14 −16
Original line number Diff line number Diff line
@@ -12,9 +12,6 @@ module LibIot_TestInterface {
		const all;
		type ComponentIdList, DefaultList;
	}
	import from LibIot_TestInterface {
		type MonitorPort, DeviceControllPort, TriggerPort;	
	}

	import from LibCommon_Sync all;
	
@@ -23,9 +20,9 @@ module LibIot_TestInterface {
	* @desc 	interfaces to the SUT 
	*/	
	type component SystemInterface {
		port MonitorPort mPort[PX_NUM_OF_MONITORS];
		port DeviceControllPort dcPort[PX_NUM_OF_DEVICES];
		port TriggerPort tPort[PX_NUM_OF_TRIGGER_POINTS];
		port MonitorPort mPort;
		port DeviceControlPort dcPort;
		port TriggerPort tPort;
	}
	
	group abstractTestComponents {
@@ -45,8 +42,11 @@ module LibIot_TestInterface {
		*     Can be used as MTC.
		*/				
		type component TestOracle extends ServerSyncComp {
			port VerdictPort vPort[PX_NUM_OF_MONITORS];
			var DefaultList vc_monitorDefaults[PX_NUM_OF_MONITORS];
			port VerdictPort vPort;
		}
		
		type component OracleClient extends SelfSyncComp {
			port VerdictPort vPort;
		}
    	
		/**
@@ -54,22 +54,23 @@ module LibIot_TestInterface {
		*     providing minitoring functionality of involved interfaces. Used as
		*     PTC.
		*/
		type component TestMonitor extends SelfSyncComp {
        	port VerdictPort vPort;
		type component TestMonitor extends OracleClient {
			port MonitorPort mPort;
		}
    	
		/**
		* @desc Stimulate the SUT. Used as PTC.
		*/
		type component TestDriver extends SelfSyncComp {
		type component TestDriver extends OracleClient {
			port TriggerPort tPort;

		}
    	
		/**
		* @desc Configures the SUT or interconnecting network. Used as PTC.
		*/
		type component DeviceControl extends SelfSyncComp {
		type component DeviceControl extends OracleClient {
			port DeviceControlPort dcPort;

		}
	}// end group abstractTestComponents
@@ -83,7 +84,7 @@ module LibIot_TestInterface {
			in all;
		}

		type port DeviceControllPort procedure {
		type port DeviceControlPort procedure {
			inout all;	
		}

@@ -91,7 +92,4 @@ module LibIot_TestInterface {
			inout all; 
		}	
	}// end group portDefinitions
	
	
	
}
 No newline at end of file
+21 −1
Original line number Diff line number Diff line
@@ -11,6 +11,26 @@ module LibIot_TypesAndValues {

	}
	
	group triggerTypes {
		
		type record Status {
			StatusCode code,
			charstring reason optional
		}
		
		type enumerated StatusCode {
			e_success,
			e_unsuccess,
			e_error	
		}
		
		type record of charstring ParameterList;
		
		type integer TriggerCommand;
		
		signature Trigger(TriggerCommand p_cmd, ParameterList p_params) return Status;
	}
	
	type union IOTVerdict {
		verdicttype e2e,
		verdicttype conformance	
@@ -23,7 +43,7 @@ module LibIot_TypesAndValues {
   
   type record ComponentId {
   		charstring name,
   		integer index
   		integer index // explain more
   }
   
   type set of ComponentId ComponentIdList;