Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Titan » Generating Java code from TTCN-3
Generating Java code from TTCN-3 [message #1731450] Thu, 05 May 2016 11:46 Go to next message
Elemer Lelik is currently offline Elemer LelikFriend
Messages: 760
Registered: January 2015
Senior Member
Greetings,


If one was paying attention to the commits to the Titan plug-ins repository, may have noticed the apparition of a new folder org.eclipse.titan.codegenerator
see
https://github.com/eclipse/titan.EclipsePlug-ins/tree/master/org.eclipse.titan.codegenerator.

Let me bring you the story behind.

You may have seen so far that Titan is a two step compiler : in the first step, C++ code is generated from TTCN-3 ; in the next step this is compiled into an executable using
C++ tools (compiler, linker, make etc.). In fact the whole workflow starts with parsing the TTCN-3 code, subjecting it to syntactical and semantic analysis, building the Abstract Syntax Tree
(AST; see https://en.wikipedia.org/wiki/Abstract_syntax_tree) from the available information, then generating the C++ code based on the AST.
AST is built during compilation and discarded when code generation ends, and the compiler terminates execution.

Why C/C++ code has been chosen as an intermediate step? At the time Titan started (somewhat more than fifteen years ago) that was the
only realistic option (well, short of a direct compiler) considering the existing development environments in the telecom industry. It involved the usage of stable and reliable tools, came with the promise of speed of execution (a promise still fulfilled today - we have a number of applications written in TTCN-3 and compiled with Titan simulating the traffic of millions of users, or the equivalent in number of telecom nodes) and so on.

The Designer plug-in works in a similar manner , with a few exceptions; main difference is that it builds and maintains the AST in memory (which involves a hefty memory consumption of course)
but the steps are the same: parsing, syntactical/semantic analysis, AST - all of which it does independently from the Titan compiler and executor. And of course, another difference
is the code generation , which is completely missing. You may notice that we are already halfway there to implement a complete, independent , Java based workflow.

Now, Java evolved a lot in the last fifteen years, and although it could not have been taken seriously as a development platform then, a significant number of our users opted for it lately.
Subsequently, about a year ago we have started a co-operation project with the Budapest University of Technology which targets generating Java code from TTCN-3, in form of a new Titan plug-in.
The project is somewhat more than a proof-of concept, somewhat less then a prototype right now, as you can see by checking the code committed.
Also, take a look into the log file snippet generated , see below.
A number of basic architectural issues have been clarified , some of them already implemented. Hope is that we can start productification next year, in 2017.

From then on the plug-in suite will play a dual role: will work as a front-end to the classical Titan, and also as a standalone TTCN-3 tool for lightweight applications ( that is applications posing
no performance requirements). The two architectures will complement each other nicely: for intensive applications , e.g. telecom ones, performance tests etc. we will recommend the classical setup;
for lightweight , portable ones (e.g. IOT) the new , Java -based workflow.

If anyone is interested in participating in the project , please let me know. There's a lot to do and surely it will take some time until the Java option will be as mature as the classical one.





Log file snipped generated by the Java environment


2016-04-22 14:16:14.306 hc EXECUTOR Received control messagestart B f_RECEIVER
2016-04-22 14:16:14.306 mc EXECUTOR Adding components to be done [mtc, A, B]
2016-04-22 14:16:14.321 hc EXECUTOR Function f_RECEIVER started on PTC org.eclipse.titan.javagen.SIPPhone_CT@7ba4f24f
2016-04-22 14:16:14.321 hc EXECUTOR Received control messagedone all component
2016-04-22 14:16:14.321 hc EXECUTOR Waiting for component A to be done
2016-04-22 14:16:14.321 mc EXECUTOR Main Controller waiting for message
2016-04-22 14:16:14.321 3 TIMEROP dummy.ttcn3:-1(function:f_SENDER) Timer Tl_1 set to 5.0.
2016-04-22 14:16:14.509 4:SIP--buffer-daemon PORTEVENT Buffer daemon received message
2016-04-22 14:16:14.509 4:SIP--buffer-daemon PORTEVENT Buffer daemon waiting
2016-04-22 14:16:14.509 4 PORTEVENT SIP_Examples.ttcn:105(function:f_RECEIVER) RECEIVE event on port SIP: type SipMessage
2016-04-22 14:16:14.509 3 PORTEVENT dummy.ttcn3:-1(function:f_SENDER) SEND event on port SIP: t_Request:={
	requestLine := {
		method := INVITE,
		requestUri := {
			sip := "sip",
			userInfo := omit,
			hostPort := {
				host := "hostname.ericsson.com",
				portField := 5060
			},
			uriParameters := [{
				id := "transport",
				valueField := "udp"
			}],
			headers := omit
		},
		sipVersion := "SIP/2.0"
	},
	messageHeader := {
		fromField := "from:BOB<sip:BOB@ericsson.com",
		toField := "to:ALICE<sip:ALICE@ericsson.com",
		via := ""
	},
	messageBody := omit
}
2016-04-22 14:16:14.509 3 TIMEROP dummy.ttcn3:-1(function:f_SENDER) Timer Tl_1 started.
2016-04-22 14:16:14.540 3:SIP--buffer-daemon PORTEVENT Buffer daemon received message
2016-04-22 14:16:14.540 3:SIP--buffer-daemon PORTEVENT Buffer daemon waiting
2016-04-22 14:16:14.540 4 PORTEVENT SIP_Examples.ttcn:106(function:f_RECEIVER) SEND event on port SIP:{
	requestLine := {
		method := INVITE,
		requestUri := {
			sip := "sip",
			userInfo := omit,
			hostPort := {
				host := "hostname.ericsson.com",
				portField := 5060
			},
			uriParameters := [{
				id := "transport",
				valueField := "udp"
			}],
			headers := omit
		},
		sipVersion := "SIP/2.0"
	},
	messageHeader := {
		fromField := "from:BOB<sip:BOB@ericsson.com",
		toField := "to:ALICE<sip:ALICE@ericsson.com",
		via := ""
	},
	messageBody := omit
}
2016-04-22 14:16:14.540 3 PORTEVENT dummy.ttcn3:-1(function:f_SENDER) RECEIVE event on port SIP:
 t_Request:={
	requestLine := {
		method := INVITE,
		requestUri := {
			sip := "sip",
			userInfo := omit,
			hostPort := {
				host := "hostname.ericsson.com",
				portField := 5060
			},
			uriParameters := [{
				id := "transport",
				valueField := "udp"
			}],
			headers := omit
		},
		sipVersion := "SIP/2.0"
	},
	messageHeader := {
		fromField := "from:BOB<sip:BOB@ericsson.com",
		toField := "to:ALICE<sip:ALICE@ericsson.com",
		via := ""
	},
	messageBody := omit
}
2016-04-22 14:16:14.540 3 VERDICTOP dummy.ttcn3:-1(function:f_SENDER) setverdict(pass): none -> pass
2016-04-22 14:16:14.540 3 PORTEVENT dummy.ttcn3:-1(function:f_SENDER) SEND event on port MSG:"STOP"
2016-04-22 14:16:14.540 4:MSG--buffer-daemon PORTEVENT Buffer daemon received message
2016-04-22 14:16:14.540 4:MSG--buffer-daemon PORTEVENT Buffer daemon waiting
2016-04-22 14:16:14.540 3 TIMEROP dummy.ttcn3:-1(function:f_SENDER) Timer Tl_1 started.
2016-04-22 14:16:14.540 4 PORTEVENT SIP_Examples.ttcn:108(function:f_RECEIVER) RECEIVE event on port MSG:"STOP"
2016-04-22 14:16:14.556 3:MSG--buffer-daemon PORTEVENT Buffer daemon received message
2016-04-22 14:16:14.556 3:MSG--buffer-daemon PORTEVENT Buffer daemon waiting
2016-04-22 14:16:14.556 4 PORTEVENT SIP_Examples.ttcn:109(function:f_RECEIVER) SEND event on port MSG:"1"
2016-04-22 14:16:14.556 4 VERDICTOP SIP_Examples.ttcn:109(function:f_RECEIVER) setverdict(pass): none -> pass
2016-04-22 14:16:14.556 4 VERDICTOP SIP_Examples.ttcn:117(function:f_RECEIVER) setverdict(pass): pass -> pass
2016-04-22 14:16:14.556 3 PORTEVENT dummy.ttcn3:-1(function:f_SENDER) RECEIVE event on port MSG:"1"
2016-04-22 14:16:14.556 3 VERDICTOP dummy.ttcn3:-1(function:f_SENDER) setverdict(pass): pass -> pass
2016-04-22 14:16:14.556 hc EXECUTOR Component A is done
2016-04-22 14:16:14.556 hc EXECUTOR HC->MC: finished A 1
2016-04-22 14:16:14.556 mc EXECUTOR Main Controller received finished A 1
2016-04-22 14:16:14.556 mc EXECUTOR Component A is done. Remaining components to be done: [mtc, B]
2016-04-22 14:16:14.556 hc EXECUTOR Waiting for component B to be done




Best regards
Elemer

Re: Generating Java code from TTCN-3 [message #1731484 is a reply to message #1731450] Fri, 06 May 2016 01:46 Go to previous message
Gustavo Gonnet is currently offline Gustavo GonnetFriend
Messages: 34
Registered: October 2015
Location: Montreal, Quebec, Canada
Member
+1!
Previous Topic:Embedding Java code in TTCN-3 as external function
Next Topic:XML encoding in TTCN-3 and Titan part 1: basics
Goto Forum:
  


Current Time: Fri Jun 22 19:23:18 GMT 2018

Powered by FUDForum. Page generated in 0.01443 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top