Facing communication issue in SOME/IP between FRANCA Common API C++ Server and Python client

357 views
Skip to first unread message

Shruthe R

unread,
Jul 2, 2020, 6:40:16 AM7/2/20
to Franca

Hello sir,


I am working on establishing inter-process communication between a CommonAPI Some/IP C++ server (Which uses FRANCA IDL and associated deployment files) and a Some/IP python client.


Python Some/IP client

Library used for python Some/IP client:

someip 0.1.0, Pysomeip (https://pypi.org/project/someip/ )

import someip.header

from someip.sd import SOMEIPDatagramProtocol


Franca C++ Server

The C++ server that is used was setup as per the following link:

https://at.projects.genivi.org/wiki/pages/viewpage.action?pageId=5472320


Work done till now:


(C++ vsomeip server) <-------------------------- > (python client)   Result: RPC Worked here.

Tried Some/IP IPC using a basic C++ vsomeip server (Which does not include CommonAPI and Franca) and the python client.


Server C++

Used the “Request/Response” example from the following link as the C++ server:

https://github.com/GENIVI/vsomeip/wiki/vsomeip-in-10-minutes

Snapshot 1 having log message on the Server Terminal Side.


Client Python

And the following example as the python client:

https://github.com/afflux/pysomeip/blob/master/tools/get.py

Snapshot 2 have the snapshot at the python side terminal log


I am attaching the snapshot of the IPC between the server and client:


Server

:

Fig: Snapshot 1

Client:


Fig: Snapshot 2

 

 

 Issue Details:


On using the same client code to establish communication with the C++server code (Containing franca and commonAPI as mentioned in https://at.projects.genivi.org/wiki/pages/viewpage.action?pageId=5472320) the C++ server returns back an error saying “Malformed Message” as shown in snapshot 3:



Fig: Snapshot 3

 

The server here uses a .fidl file while the client does not contain any franca file for binding.

 

Are there any code generators for python which would take .fidl files and generate python codes for the same which could then be used at the client end?


Any other suggestion as to what direction to proceed on would be very much appreciated.


Thanks in advance.

Klaus Birken

unread,
Jul 2, 2020, 6:57:40 AM7/2/20
to Franca
Hello,

unfortunately, I do not know about any Python code generator which produces CommonAPI compatible code (let alone for the SOME/IP stack). The current CommonAPI C++ tools and runtime implementation relies heavily on C++ language concepts. But as the generated server in your example will emanate correct SOME/IP messages and adheres to the protocol, it should be possible to manually implement a Python client or even build a code generator which produces Python code from *.fidl files. If you decide to progress in that direction, I would recommend to pick a Franca IDL subset in order to reduce your implementation effort.

If you encounter specific problems of vsomeip or CommonAPI related issues, this is not the correct forum. Pls choose from one of the following github-repositories and create an issue for your problem:


CommonAPI C++ is being developed by a different team, not by the Franca IDL tooling project.

Hope this helps, best regards,
Klaus

Shruthe R

unread,
Jul 2, 2020, 7:11:39 AM7/2/20
to Franca
Hello sir,

Thank you for your quick response.
Could you please give a brief on what Franca IDL subsets are? And how to choose a suitable one?
Any link or resource would be quite helpful.

Regards,
Shruthe

Klaus Birken

unread,
Jul 2, 2020, 7:39:22 AM7/2/20
to Franca
There is no formal notion of Franca IDL subsets. You could just define either a blacklist or whitelist of IDL features which your new Python code generator supports or doesn't support. A typical approach could be to exclude complex features like "manages", polymorphism or contracts. This makes it easier to implement the code generator tooling.

You could even implement an additional validator for Franca which shows warning messages for language concepts which are not supported if the *.fidl is to be used to connect with the Python world. Then the user of Eclipse would get warnings if he/she uses something from the blacklist.

Shruthe R

unread,
Jul 2, 2020, 7:49:42 AM7/2/20
to Franca
Okay sir! Thank you very much. 

Gunnar GENIVI

unread,
Jul 2, 2020, 7:54:42 AM7/2/20
to Klaus Birken, Franca
Hi All,

First, please excuse any weird text formatting.  I'm normally emailing plain-text but I had to switch over to my web/HTML based GMail, via web client, and I am copy-pasting some parts.

On Thu, Jul 2, 2020 at 12:57 PM Klaus Birken <klaus....@gmail.com> wrote:
Hello,

unfortunately, I do not know about any Python code generator which produces CommonAPI compatible code (let alone for the SOME/IP stack). The current CommonAPI C++ tools and runtime implementation relies heavily on C++ language concepts. But as the generated server in your example will emanate correct SOME/IP messages and adheres to the protocol, it should be possible to manually implement a Python client or even build a code generator which produces Python code from *.fidl files. If you decide to progress in that direction, I would recommend to pick a Franca IDL subset in order to reduce your implementation effort.

+1


If you encounter specific problems of vsomeip or CommonAPI related issues, this is not the correct forum. Pls choose from one of the following github-repositories and create an issue for your problem:



...and for vSomeIP:
https://github.com/search?q=org%3AGENIVI+vsomeip&unscoped_q=vsomeip

Agree, when it comes to actual support requests on those technologies.
(Support requests on GitHub are not always answered very quickly though, so
it is often a community effort to help out each other, among adopters of
this technology.)

 

CommonAPI C++ is being developed by a different team, not by the Franca IDL tooling project.

Always important to point this out.  I just want to add, and I think you
already agree Klaus, that I appreciate the higher level discussion here.
CommonAPI C++ usage is an important part of Franca usage, so  discussing
and sharing results on projects that combine different Franca-related tools
, including CommonAPI, could be of general interest to people following
this Franca channel.  


I hope Shruthe R continues to keep us updated.

- Gunnar


-- 
Gunnar Andersson <gande...@genivi.org>
Technical Lead
GENIVI Alliance

 
--
You received this message because you are subscribed to the Google Groups "Franca" group.
To unsubscribe from this group and stop receiving emails from it, send an email to franca-framewo...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/franca-framework/fd57536d-1db8-4b2b-8a51-079feb045eaan%40googlegroups.com.


--
Gunnar Andersson
GENIVI Alliance

Klaus Birken

unread,
Jul 2, 2020, 7:59:05 AM7/2/20
to Franca
Hi Gunnar,

yes, I agree some high-level discussion on Franca and the tools using Franca (like CommonAPI) in this forum is okay and helpful. I just wanted to avoid that CommonAPI-C++ related questions and problems are getting stuck here, because some CommonAPI-developers are not members here and would miss it.

Regards,
Klaus

Gunnar GENIVI

unread,
Jul 2, 2020, 7:59:21 AM7/2/20
to Shruthe R, Franca
On Thu, 2020-07-02 at 03:40 -0700, Shruthe R wrote:

[trimmed]

> Hello sir,
> 
> I am working on establishing inter-process communication between a
> CommonAPI Some/IP C++ server (Which uses FRANCA IDL and associated
> deployment files) and a Some/IP python client.

Are you putting your investigations on a public repository / as open source
code?  It's generally very hard for people to give useful help without
seeing the full picture.

or is this your repository?
https://github.com/afflux/pysomeip/



> Python Some/IP client
> Library used for python Some/IP client:
> someip 0.1.0, Pysomeip (https://pypi.org/project/someip/ )
> import someip.header
> from someip.sd import SOMEIPDatagramProtocol

Interesting.  I had never seen this implementation before.


> Franca C++ Server
> The C++ server that is used was setup as per the following link:
> https://at.projects.genivi.org/wiki/pages/viewpage.action?pageId=5472320

As you can see, that link already points out at the top that you should try
to follow the updated pages that are on the GitHub Wiki instead.  Generally
speaking I mean.  It can be a bit tricky to find, but the latest 10-minute
tutorial is actually here:
https://github.com/GENIVI/capicxx-core-tools/wiki

I have not checked if the "in 10 minutes" has changed significantly, but it
is clear that the page on the projects.genivi.org wiki seems not updated by
the maintainers while the GitHub/GENIVI/xxx one is.  So we should probably
remove the duplication now.  I will see to this.

OK, to my point -- I've actually very recently updated the following code
that automates all the steps of the "in 10 minutes" tutorial, now also with
the latest versions of all parts.

It is a controlled/repeatable way to compile the runtimes and to download
and use the CommonAPI code generators.  This is for doing local experiments
and development "natively" on your computer, but the project is set up so
that you can avoid doing native installs of a bunch of stuff in your main
system.
https://github.com/gunnarx/build-common-api-cpp-native

It's a little convoluted with all the scripts and Docker container usage,
but, well it's there if anyone wants to use it and I want to make you all
aware of it.

> Work done till now:

> [...trimmed]


> 
>  Issue Details:
> 
> On using the same client code to establish communication with the
> C++server code (Containing franca and commonAPI as mentioned in 
> https://at.projects.genivi.org/wiki/pages/viewpage.action?pageId=5472320)
> the C++ server returns back an error saying “Malformed Message” as shown
> in snapshot 3:

There is not much to do but to debug this in detail.  CommonAPI C++ SOME/IP
is in theory compatible to communicate with a plain SOME/IP client, but the
encoding of data types in messages is controlled by the CommonAPI layer, so
this can be a bit tricky to work out if there is a reported mismatch.

Once, about 1-1.5 years ago I've even found a bug when connecting with a
program generated on the AUTOSAR reference platform -- in other words
CommonAPI was encoding datatypes correctly (according to AUTOSAR specs) but
the AUTOSAR platform SOME/IP code was not.

Now, of course we have no way of telling if your malformed message suggests
payload/datatype encoding issues or more fundamental like the message
headers etc.


> Fig: Snapshot 3
 
> The server here uses a .fidl file while the client does not contain any
> franca file for binding.
 
> Are there any code generators for python which would take .fidl files and
> generate python codes for the same which could then be used at the client
> end?

Like Klaus I do not know of them.  I would be surprised, but feel free to
start developing if you want.  Another alternative would be of course to
develop in the Java ecosystem (like most CommonAPI implementations) but
generate python (PySomeIP compatible code).  I mean you would then take an
existing CommonAPI generator and copy and modify it.

But if you prefer to program in Python, there are some starting points:

In this experiment (which does *NOT* generate usable code -- in fact I
basically only generated C++ classes in order to run doxygen on them so I 
could get a neat documentation of a Franca IDL described API (and to
experiment on Franca code generation using python in general).  
So this never got to the point of being a really usable C++ skeleton,
please understand.

https://github.com/gunnarx/pyfrancagen

But that project uses "pyfranca".  

https://github.com/zayfod/pyfranca

So if you need a python based Franca IDL parser, then pyfranca is one
starting point.  And then in my project you could get some ideas for how to
traverse the Abstract Syntax Tree created by the pyfranca parser,
and how push out some code using Jinja templates.


> Any other suggestion as to what direction to proceed on would be very
> much appreciated.

Hope this helps

Shruthe R

unread,
Jul 2, 2020, 8:22:48 AM7/2/20
to Franca
Hi sir,

https://github.com/afflux/pysomeip/ - This is not my repository i came across this while looking for python implementations of someIP and tried my luck at using it.

Thank you very much for providing me with a few references to get started with.  

I will keep you updated.

siddhartha v

unread,
Jul 13, 2020, 3:15:08 AM7/13/20
to Gunnar GENIVI, Shruthe R, Franca
Hello Gunnar sir,

Sorry for posting this here. tried to cereat an issue in https://github.com/zayfod/pyfranca but  Github server is down and thus not able to create the issue there.Hence posting this here.
   

I am trying to connect the Common API SOME/IP C++ server to the python client using Franca IDL as the IDL.I have developed a simple C++ server which contains both method and a broadcast in the fidl and successfully achieved the communication with the C++ client. There I used Common API core tools and SOME/IP tools to generate the binding files for both client and the server side which particularly deals with only C++.

   Now I am trying to connect a python client to the same existing C++ server through SOME/IP. In franca google group( https://mail.google.com/mail/u/0/?tab=rm&ogbl#inbox/WhctKJVzWGQmWnLmmFjPFQRwcPqRxhRzLqGcfJvNKkqBCNpKkQlQGGGhvTfwnFppdFRCbPq  and) I came across this pyfranca.



My understanding on pyfranca :

Using this tool I can generate some code and later need to develop the client and should connect to the C++ server. (Am I on right path? Please suggest me if I am wrong. Kind request)(To be frank I  really didn't understand what is the concept behind parser and processor files in actual sorry.)

Later I followed below steps:

I installed pyfranca using
1. pip3 install pyfranca
and the tried to run the "fidl_dump.py Helloworld.fidl" but I got the below error and warning:

               siddhu@siddhu:~/Documents/SOMEIP_Project/Python_Client$ sudo fidl_dump.py                                   /home/siddhu/Documents/SOMEIP_Project/Python_Client/fidl/HelloWorld.fidl
               Traceback (most recent call last):
                File "/usr/local/bin/fidl_dump.py", line 4, in <module>
               __import__('pkg_resources').run_script('pyfranca==0.4.1', 'fidl_dump.py')
               File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 658, in run_script
                self.require(requires)[0].run_script(script_name, ns)
                File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 1429, in run_script
                .format(**locals()),
                 pkg_resources.ResolutionError: Script 'scripts/fidl_dump.py' not found in metadata at
                  '/home/siddhu/.local/lib/python3.6/site-
                  packages/pyfranca-0.4.1.dist-info'

2. Later I downloaded the source pyfranca-master and intalled it bu running "python3 setup.py install" and tried to run the "fidl_dump.py Helloworld.fidl" using "/home/siddhu/Documents/SOMEIP_Project/Python_Client/pyfranca-master/tools/fidl_dump.py /home/siddhu/Documents/SOMEIP_Project/Python_Client/fidl/HelloWorld.fidl" command but again  I got the below error:

                 siddhu@siddhu:~/Documents/SOMEIP_Project/Python_Client$
                  /home/siddhu/Documents/SOMEIP_Project/Python_Client/pyfranca-master/tools/fidl_dump.py
                  /home/siddhu/Documents/SOMEIP_Project/Python_Client/fidl/HelloWorld.fidl
                    Traceback (most recent call last):
                   File "/home/siddhu/Documents/SOMEIP_Project/Python_Client/pyfranca-master/tools/fidl_dump.py", line 4, in
                 <module>
                     from pyfranca import Processor, LexerException, ParserException, \
                     ImportError: No module named pyfranca


In both the ways It is failing to recognise the module pyfranca. Do I missing anything here.?please help me on this. I have installation log too.




--
Thanks and Regards.
Siddhartha V.
 


--
You received this message because you are subscribed to the Google Groups "Franca" group.
To unsubscribe from this group and stop receiving emails from it, send an email to franca-framewo...@googlegroups.com.

siddhartha v

unread,
Jul 13, 2020, 4:02:15 AM7/13/20
to Gunnar GENIVI, Shruthe R, Franca, siddhartha v
Sorry my bad,

  I was actually using the python3.8 but went with python3. Now unistalled the older one and working with the python3.8 its working well.

I did "fidl_dump.py /home/siddhu/Documents/SOMEIP_Project/Python_Client/fidl/HelloWorld.fidl" and got the below result:

Packages:
- commonapi (/home/siddhu/Documents/SOMEIP_Project/Python_Client/fidl/HelloWorld.fidl)
Interfaces:
- HelloWorld (v1.0)
Methods:
- sayHello()
Broadcasts:
- Mystatus

And then I did "fidl_validator.py /home/siddhu/Documents/SOMEIP_Project/Python_Client/fidl/HelloWorld.fidl" and got below output:

Valid Franca model.


But my question here is it is not generating any binding file or any python skeleton. Whats its purpose sir? Please suggest me how can I proceed here.

How can achieve C++ server and the python client communication?



--
Thanks and Regards.
Siddhartha V.
 

On Thu, Jul 2, 2020 at 5:29 PM Gunnar GENIVI <gunnar...@gmail.com> wrote:
--
You received this message because you are subscribed to the Google Groups "Franca" group.
To unsubscribe from this group and stop receiving emails from it, send an email to franca-framewo...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages