Commit 85603f92 authored by poglitsch's avatar poglitsch
Browse files

initial version

parent fb8d517d
Loading
Loading
Loading
Loading
+53 −0
Original line number Original line Diff line number Diff line
module LibIot_Functions {
 
	import from LibIot_PICS {modulepar PX_CONFOMANCE_CHECK;}

	import from LibIot_TypesAndValues {type IOTVerdict;}

	import from LibIot_TestSystem {
		type TestCoordinator, TestMonitor, TestOracle;
	}

	function f_setConformanceVerdict(in verdicttype p_verdict, in charstring p_reason) runs on TestMonitor {
		log("Conformance verdict set to: ", p_verdict);
		log(p_reason);
		var IOTVerdict v_verdict := { conformance := p_verdict };
		vPort.send(v_verdict); 	
	}
	
	function f_setE2EVerdict(in verdicttype p_verdict, in charstring p_reason) runs on TestMonitor {
		log("E2E verdict set to: ", p_verdict);
		log(p_reason);
		var IOTVerdict v_verdict := { e2e := p_verdict };
		vPort.send(v_verdict); 		
	}
	
	function f_setVerdict(in IOTVerdict p_verdict) runs on TestOracle {
		if(ischosen(p_verdict.e2e) ) {
			setverdict(p_verdict.e2e);
		}
		else if(PX_CONFOMANCE_CHECK) {
			setverdict(p_verdict.conformance);
		}
	}
	
	altstep a_receiveIOTVerdict(in integer p_idx) runs on TestOracle {
		var IOTVerdict v_verdict;
		
		[] vPort[p_idx].receive (IOTVerdict:?) -> value v_verdict {
			f_setVerdict(v_verdict);
			repeat;
		}		
	}
	
	function f_getMonitorIdx(in charstring p_name) runs on TestCoordinator return integer {
		var integer v_size := sizeof(vc_compIds);
		for(var integer i := 0; i < v_size; i := i +1) {
			if(vc_compIds[i].name == p_name) {
				return 	vc_compIds[i].index;
			}
		}
		
		return -1;
	}
}
 No newline at end of file
+9 −0
Original line number Original line Diff line number Diff line
module LibIot_PICS {
	
 	/**
	  * @desc defines the overall verdict analysis.
	  */
	modulepar boolean PX_CONFOMANCE_CHECK := false;
 
 
}
 No newline at end of file
+49 −0
Original line number Original line Diff line number Diff line
module LibIot_TestConfiguration {
	
	import from LibIot_OracleFunctions {altstep a_receiveIOTVerdict;}

	import from LibIot_TestSystem {
		type TestCoordinator, TestMonitor, TestOracle;
	}

	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_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_monitor_up(in TestMonitor p_monitor, in integer p_idx) runs on TestCoordinator {
		// connect sync ports
		connect(p_monitor:syncPort, self:syncPort);
		// mapp TSI port
		map(p_monitor:mPort, system:mPort[p_idx]);
		// configure oracle
		f_cf_oracle_up(p_monitor, p_idx);
	}
	
	function f_cf_monitor_down(in TestMonitor p_monitor, in integer p_idx) runs on TestCoordinator {
		// connect sync ports
		disconnect(p_monitor:syncPort, self:syncPort);
		// mapp TSI port
		unmap(p_monitor:mPort, system:mPort[p_idx]);
		// configure oracle
		f_cf_oracle_down(p_monitor, p_idx);
	}
	
	function f_cf_create_monitor(in charstring p_name) runs on TestCoordinator return TestMonitor {
		var TestMonitor v_monitor := TestMonitor.create(p_name);
		var integer v_size := sizeof(vc_compIds);
		
		// set Id
		vc_compIds[v_size] := {p_name, v_size};
		
		return v_monitor; 
	}
	
	
	
}
 No newline at end of file
+24 −0
Original line number Original line Diff line number Diff line
module LibIot_TestInterface {
	
	import from LibIot_TypesAndValues {
		const all;
	}

	type component SystemInterface {
		port MonitorPort mPort[c_NUM_OF_MONITORS];
		port DeviceControllPort dcPort[c_NUM_OF_DEVICES];
		port TriggerPort tPort[c_NUM_OF_TRIGGER_POINTS];
	}
	
	type port MonitorPort message {
		in all;
	}
	
	type port DeviceControllPort procedure {
		inout all;	
	}
	
	type port TriggerPort procedure {
		inout all; 
	}
}
 No newline at end of file
+62 −0
Original line number Original line Diff line number Diff line
module LibIot_TestSystem {
	
	import from LibIot_TypesAndValues {
		const c_NUM_OF_MONITORS;
		type ComponentIdList, DefaultList;
	}

	import from LibCommon_Sync all;
	
	group abstractTestComponents {
    	/**
    	 * @desc
    	 *     used to coordinate the behavior of other components. It is in charge
    	 *     of controlling the overall execution, manangement of testing phases,
    	 *     test verdicts collection and synchronization. Used as MTC.
    	 */
    	type component TestCoordinator extends TestOracle {
    		var ComponentIdList vc_compIds;
    	}
    	
		/**
		 * @desc
		 *     collecting information to manage E2E and conformance verdicts.
		 *     Can be used as MTC.
		 */
		type component TestOracle extends ServerSyncComp {
			port VerdictPort vPort[c_NUM_OF_MONITORS];
			var DefaultList vc_monitorDefaults[c_NUM_OF_MONITORS];
		}
    	
    	/**
    	 * @desc
    	 *     providing minitoring functionality of involved interfaces. Used as
    	 *     PTC.
    	 */
    	type component TestMonitor extends SelfSyncComp {
			port VerdictPort vPort;
    	}
    	
    	/**
    	 * @desc Stimulate the SUT. Used as PTC.
    	 */
    	type component TestDriver extends SelfSyncComp {
    		
    	}
    	
    	/**
    	 * @desc Configures the SUT or interconnecting network. Used as PTC.
    	 */
    	type component DeviceControl extends SelfSyncComp {
    		
    	}
	}
	
	group portDefinitions {
		type port VerdictPort message {
			inout all; // TODO specify this more in detail	
		}	
	}
	
	
}
 No newline at end of file
Loading