Testing DDS network with Python tests..

8 posts / 0 new
Last post
Offline
Last seen: 7 years 3 months ago
Joined: 02/07/2017
Posts: 14
Testing DDS network with Python tests..

I have a problem, i wonder if anyone could offer any assistance please.  We are developing our own DDS network using RTI framework but developed by an external software house.  They are developing the DDS network code in C++.  I would like to be able to write Python tests to publish and subscribe to their data Structures which are produced with .idl files.. They will be giving me a compiled .so file and .idl files.  

I have been looking at both PYDDS and rticonnextdds.connector.  I like the example which uses PYTEST to kick off multiple tests or individual tests.  I like the idea of having .xml files as input.. however the development team are giving me .idl files and compiled .so files ... I'm not sure what would be the best method to use. 

I would like to write tests which would test data variable limits, out of range, wrong values... I want to be able to publish on topics and subscribe to them. So i need to manipulate their Topics on their DDS network in order to fully test the system.

could anyone point me in the right direction please... 

I have tried using PyDDS using the examples given which work fine.. and which ouput C files as PyDDS uses C Types.. however because our DDS network is being written in C++ when i try to use their .so compiled project I am getting multiple undefined objects.. as PyDDS only supports C types.. 

 

many thanks,

Nick

 

 

 

gianpiero's picture
Offline
Last seen: 10 months 2 weeks ago
Joined: 06/02/2010
Posts: 177

 

Hello Nick,

I am Gianpiero Napoli from RTI. I have been working on the RTI Connext DDS Connector for python. We created the Connector exactly for this use case. All you need is to convert the IDL type in XML and then load that in the connector and write your test logic in python. 

To convert an IDL in XML you can use the rtiddsgen utility that comes with your RTI Connext instalation:

rtiddsgen -convertToXml file.idl

This will create a file called file.xml that contains your type definition. 

Once your are done with that I'll suggest you look at the XML file in the example. In there you will find a section between tags <types> ... </types>. Remove the example one and add the one you just generate in the file.xml.

Then there is a section between <domain_library ....> ....</domain_library>. In that one you can modify the register_type type_ref to match your type (insted of ShapeType) and adjust the topic to match your needs. 

Finally modify the section between <domain_participant_library> tags by adding your publisher and or subscriber. 

Then you can modify the simple\writer or simple\reader example to work with your XML file.

Let me know if this make sense and if you need more help.

Best,
   Gianpiero

 

Offline
Last seen: 7 years 3 months ago
Joined: 02/07/2017
Posts: 14

Hi Gianpiero, thanks very much on your detailed description of how to use the rtiddsgen to .xml convertor. I have been handcrafting them before so this saves time and is less prone to mistakes.. I have proposed to use RTI Connext DDS Connector for python to write tests in order to test our DDS application.. I have been asked the question as below, could you help with this please.. Im not sure whether the connector is suitable anymore for what I want.. 

Hi Nick,

 

Can you point me to the forum post where they say this supports the request/reply paradigm ? I can’t see it in any of the docs I scanned.

 

(see Chapter 4 of RTI User’s Manual) :-

 

“As applications become more complex, it often becomes necessary to use other communication patterns in

addition to publish-subscribe. Sometimes an application needs to get a one-time snapshot of information;

for example, to make a query into a database or retrieve configuration parameters that never change. Other

times an application needs to ask a remote application to perform an action on its behalf; for example, to

invoke a remote procedure call or a service.

To support these scenarios, Connext DDS includes support for the request-reply communication pattern. It

is available with the Connext DDS Professional, Evaluation, and Basic package types.

 

The request-reply pattern has two roles: The requester (service consumer or client) sends a request message

and waits for a reply message. The replier (service provider) receives the request message and

responds with a reply message.”

 

Regards,

Steve

 

gianpiero's picture
Offline
Last seen: 10 months 2 weeks ago
Joined: 06/02/2010
Posts: 177

Hi Nick,

Unfortunately the Connector does not support the reqest/reply API out of the box. On the other hand Request/Reply over DDS is still sending DDS messages so you could make it work. But it wouldn't be as straight forward!

Best,
  Gianpiero

Offline
Last seen: 7 years 3 months ago
Joined: 02/07/2017
Posts: 14

It may not be necessary to implement the request/reply over DDS for test purposes.. I need to wait to see if there is a need for this.. 

I wonder if you can help.. 

I am following through the Python examples for RTI Connext DDS Connector /Python/mixed/writer.py 

I see in the mixed.xml there is an enumeration of 'fillkind' but the writer doesnt show an example of how to write this and read it.. so i am trying to write any of the enums , and then read them

<enumerator name="SOLID_FILL" value="0"/>
<enumerator name="TRANSPARENT_FILL" value="1"/>
<enumerator name="HORIZONTAL_HATCH_FILL" value="2"/>
<enumerator name="VERTICAL_HATCH_FILL" value="3"/>

I think I should be doing a output.instance.setNumber("fillkind", 1); but this just gives me the number 1.. what i actually want is to give me TRANSPARENT_FILL.. 

best regards,

Nick

 

 

 

Offline
Last seen: 7 years 3 months ago
Joined: 02/07/2017
Posts: 14

I've added a dictionary lookup for the enums within my test so that I can display the text.. Is this what was intended? my test is running the way I think it should anyway now.. I was wondering what is the intended behaviour for in correct enum values being given in the test data?  this should be captured in the py.test area i guess.. anyway.. I'm just working things out for the first time here.. enjoying working with RTI Connext DDS Connector .. 

gianpiero's picture
Offline
Last seen: 10 months 2 weeks ago
Joined: 06/02/2010
Posts: 177

Hello Nick, 

Sorry for the late response: I see that you alredy figured it out:

output.instance.setNumber("fillKind", 1);

is the way to go. 

Unfortunately the Connector does not accept strings for now. Connector is based on DynamicData and we don't have the mapping STRING --> Number internally. We would have to use the type information and for now we do not do it. 

I think your approach, to use a lookup function, is the right things to do now. 

I am happy you are enjoy using the RTI Connext DDS Connector

Best,
  Gianpiero

Offline
Last seen: 6 years 8 months ago
Joined: 03/22/2018
Posts: 1

Hi Gianpiero,

is it possible to send and receive wstring from the RTI Connext DDS Connector for python ?