Commit c15b5e00 authored by Philip Makedonski's avatar Philip Makedonski
Browse files

+ updated standalone with libraries and yang support

parent 74667d70
Loading
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -23,5 +23,6 @@ Require-Bundle: org.eclipse.core.runtime,
 org.etsi.mts.tdl.json2tdl,
 org.eclipse.emf.common,
 org.etsi.mts.tdl.ttcn3,
 de.ugoe.cs.swe.TTCN3
 de.ugoe.cs.swe.TTCN3,
 org.etsi.mts.tdl.yang2tdl
Bundle-ClassPath: .
+95 −0
Original line number Diff line number Diff line
Note: "Based on TR 103 119 v1.4.1"
@Version: "1.0.0"
Package ASN1 {
	Import all from TDL

    //Constraints
        //Specific typed constraints for each type
        //Constraint AsnBitString
        //Constraint AsnOctetString
        //Constraint AsnUtcString
    //or
        //Generic constraint with corresponding detail in
        //the constraint quantifier/qualifier: 
        //e.g. "[01]+'B" or more generically "AsnBitString"?   
        Constraint ASN1String
        Constraint ASN1DateTime
        Constraint ASN1Real
        Constraint ASN1ObjectIdentifier
    
    //Types
        //BITSTRING
            Type BITSTRING {ASN1String:"[01]+'B"}
            //or 
            //Type BITSTRING {ASN1String:"AsnBitString"}
            //or
            //Type BITSTRING {AsnBitString}
    
        //OCTETSTRING
            Type OCTETSTRING {ASN1String:"[A-F0-9]+'H"}
            //or
            //Type OCTETSTRING {AsnOctetString}
            //or 
            //Type OCTETSTRING {ASN1String:"AsnOctetString"}
   
	    //BMPString
	    	Type BMPString {ASN1String}
	    //IA5String
	    	Type IA5String {ASN1String}
	    //GeneralString
	    	Type GeneralString {ASN1String}
	    //GraphicString
	    	Type GraphicString {ASN1String}
	    //NumericString
	    	Type NumericString {ASN1String: "[0-9\\s]+"}
	    //PrintableString
	    	Type PrintableString {ASN1String}
	    //TeletexString
	    	Type TeletexString {ASN1String}
	    //T61String
	    	Type T61String {ASN1String}
	    //UniversalString
	    	Type UniversalString {ASN1String}
	    //UTF8String
	    	Type UTF8String {ASN1String}
	    //VideotexString
	    	Type VideotexString {ASN1String}
	    //VisibleString
	    	Type VisibleString {ASN1String}

        //UTCTime
            Type UTCTime {ASN1DateTime:"YYMMDDhhmm[ss]Z"}
            //Type UTCTime {ASN1String:"YYMMDDhhmm[ss]Z"}
            //or 
            //Type UTCTime {ASN1String:"AsnOctetString"}    
            //or
            //Type UTCTime {ASN1DateTime:"AsnOctetString"}    
            //or 
            //Type UTCTime {AsnUtcString}
    
	    //GeneralizedTime
	    	Type GeneralizedTime {ASN1DateTime:"YYYYMMDDHH[MM[SS[.fff]]]Z"}
	    //DATE
	    	Type DATE {ASN1DateTime:"YYYY-MM-DD"}
	    //TIME-OF-DAY
	    	Type TimeOfDay {ASN1DateTime:"hh:mm:ss"}
	    //DATE-TIME
	    	Type DateTime {ASN1DateTime:"YYYY-MM-DDThh:mm:ss"}
	    //INTEGER
	    	//already defined in TDL -> use that
	    	//Type Integer
	    //REAL
	    	//originally mapped to string with constraint, would override standard
	    	Type Real {ASN1Real}
	    //BOOLEAN
	    	//already defined in TDL -> use that
	    	//Type Integer
	    //NULL
	    	Type Null
	    //OBJECTIDENTIFIER 
	    	Type ObjectIdentifier {ASN1ObjectIdentifier}

	    //RELATIVE OBJECT OBJECTIDENTIFIER 
	    	//use ObjectIdentifier above
	
}
 No newline at end of file
+172 −0
Original line number Diff line number Diff line
@Version: "1.0.0"
Package HTTP {
	
	Package MessageBasedConfiguration {
		Import all from MessageBased
		Message Gate HTTPGate accepts Request,Response
		Message Gate HTTPSGate accepts Request,Response
		Component API {
			// Add variables and timers here or define new component types and configurations 
			gate HTTPGate http
			gate HTTPSGate https
		}
		Configuration BasicClientServer {
			API client as Tester,
			API poller as Tester,
			API server as SUT,
			connect client::http to server::http
		}
	}
	
	Note : "Message based types and instances"
	Package MessageBased {
		Import all from TDL
		
		// HTTP methods
		Enumerated Method {
			Method GET,
			Method POST,
			Method PUT,
			Method PATCH,
			Method DELETE
		}
		
		// Generic Request type    
		Structure Request (
			String uri,
			optional Method method,
			optional Headers headers,
			optional Parameters parameters,
			optional QueryParameters queryParameters,
			optional PathParameters pathParameters,
			optional Body body
		)
		
		// Generic Response type    
		Structure Response (
			optional Integer status,
			optional String statusMessage,
			optional Headers headers,
			optional Body body
		)
		
		// Supporting types
		Collection Parameters of Parameter
		Structure Parameter (
			Location location,
			String ^name,
			String ^value
		)
		Enumerated Location {
			Location path,
			Location query,
			// TODO may need a structure, not necessarily relevant in standardized testing
			Location cookie
		}
		
		Structure PathParameters ()
		Structure QueryParameters ()
		
		Collection Headers of Header
		Structure Header (
			String ^name,
			String ^value
		)
		
		// Base body for extension
		Structure Body ()
		
		// Basic string body
		Structure StringBody extends Body (
			String text
		)
		
		// Basic wrapper for collection responses
		Structure CollectionBody extends Body (
			Bodies items
		)
		
		// Any body can be included
		// If consistent type is needed, a custom subtype shall be defined and used 
		Collection Bodies of Body
		// Custom collection data instances can be defined
		// - inline in the responses 
		// - predefined as a separate data element
		
		// Custom collection data instances can be defined 
		// to enforce type consistency specific for API 
		
		// Basic form body    
		Structure FormBody extends Body (
			String field,
			String content
		)
	} 
    
    Package Templates {
		Import all from MessageBased
		
		// Generic Request instances
		Request rGET (
			method = GET
		)
		Request rPOST (
			method = POST
		)
		Request rPUT (
			method = PUT
		)
		Request rPATCH (
			method = PATCH
		)
		Request rDELETE (
			method = DELETE
		)
		
		// Generic Response instances, name = status code        
		Response r200 (
			statusMessage = "OK"
		)
		Response r201 (
			statusMessage = "Created"
		)
		Response r204 (
			statusMessage = "No Content"
		)
		Response r400 (
			statusMessage = "Bad Request"
		)
		Response r401 (
			statusMessage = "Unauthorized"
		)
		Response r403 (
			statusMessage = "Forbidden"
		)
		Response r404 (
			statusMessage = "Not Found"
		)
		
		// Generic Response instances, name = status message        
		Response OK (
			status = 200
		)
		Response Created (
			status = 201
		)
		Response NoContent (
			status = 204
		)
		Response BadRequest (
			status = 400
		)
		Response NotFound (
			status = 404
		)
		Response NotAuthorized (
			status = 401
		)
		Response Forbidden (
			status = 403
		)
	}
}
 No newline at end of file
+58 −0
Original line number Diff line number Diff line
Package HttpJavaMappings {
	Import all from Tdl
	Import all from Java
	Import all from HTTP.MessageBased
	
	@JavaPackage
    @MappingName : "Java"
	Use "org.etsi.mts.tdl.execution.java.adapters.http" as HttpAdapter
	
    @JavaClass
	Map Request to "HttpRequestData" in HttpAdapter as Request_Mapping {
		uri -> "uri",
		method -> "method",
		headers -> "headers",
		parameters -> "parameters",
		body -> "body"
    }
    @JavaClass
	Map Response to "HttpResponseData" in HttpAdapter as Response_Mapping {
		status -> "status",
		statusMessage -> "statusMessage",
		headers -> "headers",
		body -> "body"
    }
    @JavaClass
	Map Header to "HttpHeader" in HttpAdapter as Header_Mapping {
		^name -> "name",
		^value -> "value"
    }
    @JavaClass
	Map Parameter to "HttpRequestParameter" in HttpAdapter as Parameter_Mapping {
		location -> "location",
		^name -> "name",
		^value -> "value"
    }
    @JavaClass
	Map Location to "HttpParameterLocation" in HttpAdapter as Location_Mapping
	
    @JavaClass
    @MappingName : "Java"
	Use "org.etsi.mts.tdl.execution.java.adapters.http.HttpParameterLocation" as HttpParameterLocation
	Map path to "path" in HttpParameterLocation as path_mapping
	Map query to "query" in HttpParameterLocation as query_mapping
	Map cookie to "cookie" in HttpParameterLocation as cookie_mapping
	
	
    @JavaClass
	Map Method to "HttpMethod" in HttpAdapter as Method_Mapping
	
    @JavaClass
    @MappingName : "Java"
	Use "org.etsi.mts.tdl.execution.java.adapters.http.HttpMethod" as HttpMethod
	Map GET to "GET" in HttpMethod as GET_mapping
	Map POST to "POST" in HttpMethod as POST_mapping
	Map PUT to "PUT" in HttpMethod as PUT_mapping
	Map PATCH to "PATCH" in HttpMethod as PATCH_mapping
	Map DELETE to "DELETE" in HttpMethod as DELETE_mapping
}
+56 −0
Original line number Diff line number Diff line
Package Java {
	Import all from Tdl
	
	/* Applied to a DataResourceMapping to specify a package  */
	Annotation JavaPackage
	/* Applied to a DataElementMapping to specify an instance method  */
	Annotation JavaMethod
	/* Applied to a DataElementMapping to specify an class method  */
	Annotation JavaStaticMethod
	/* Applied to a DataResourceMapping or DataElementMapping to specify a class  */
	Annotation JavaClass
	/* Applied to a DataElementMapping to specify a field (of a class)  */
	Annotation JavaField
	/* Applied to a DataElementMapping to specify a static field (of a class)  */
	Annotation JavaStaticField
	/* Applied to a ParameterMapping to specify an instance method that returns the value of a field  */
	Annotation JavaGetter
	/* Applied to a ParameterMapping to specify an instance method that sets the field value  */
	Annotation JavaSetter
	
	
    @JavaPackage
    @MappingName : "Java"
    Use "java.lang" as JavaLang
	Map Boolean to "Boolean" in JavaLang as Boolean_mapping
	Map Integer to "Integer" in JavaLang as Integer_mapping
	Map String to "String" in JavaLang as String_mapping
	
	
	
    @JavaPackage
    @MappingName : "Java"
    Use "org.etsi.mts.tdl.execution.java.tri" as Tri
    
    @JavaClass
	Map Verdict to "Verdict" in Tri as Verdict_Mapping
	
    @JavaClass
    @MappingName : "Java"
	Use "org.etsi.mts.tdl.execution.java.tri.Verdict" as VerdictClass
	Map pass to "pass" in VerdictClass as pass_mapping
	Map fail to "fail" in VerdictClass as fail_mapping
	Map inconclusive to "inconclusive" in VerdictClass as inconclusive_mapping
	
	
    @JavaPackage
    @MappingName : "Java"
    Use "org.etsi.mts.tdl.execution.java.rt.core" as RuntimeCore
    
    @JavaClass
    @MappingName : "Java"
	Use "org.etsi.mts.tdl.execution.java.rt.core.TimeUnit" as TimeUnitClass
	Map second to "Second" in TimeUnitClass as second_mapping
	
	
}
 No newline at end of file
Loading