Skip to content

Commit f49cf5e

Browse files
committed
Added example for blogpost
1 parent c94803b commit f49cf5e

File tree

7 files changed

+504
-0
lines changed

7 files changed

+504
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?xml version="1.0"?>
2+
3+
<!-- (c) Copyright, Real-Time Innovations, 2024. All rights reserved.
4+
RTI grants Licensee a license to use, modify, compile, and create derivative
5+
works of the software solely for use with RTI Connext DDS. Licensee may
6+
redistribute copies of the software provided that all such copies are subject
7+
to this license. The software is provided "as is", with no warranty of any
8+
type, including any warranty for fitness for any purpose. RTI is under no
9+
obligation to maintain or support the software. RTI shall not be liable for
10+
any incidental or consequential damages arising out of the use or inability
11+
to use the software. -->
12+
13+
<dds xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://community.rti.com/schema/7.2.0/rti_cloud_discovery_service.xsd">
14+
15+
<cloud_discovery_service name="cds_all_domains_udpv4">
16+
<annotation>
17+
<documentation><![CDATA[
18+
Forwards all domains using built-in UDPv4 transport.
19+
]]>
20+
</documentation>
21+
</annotation>
22+
23+
<transport>
24+
<element>
25+
<alias>udpv4</alias>
26+
<receive_port>$(CDS_PORT)</receive_port>
27+
</element>
28+
</transport>
29+
30+
</cloud_discovery_service>
31+
</dds>
Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
# SHMEM <--> UDP Gateway
2+
3+
This repository contains the necessary files to run the RTI Routing Service
4+
example from the "How does Connext help you meet the constraints of the
5+
hospital's IT department?" blogpost. Using RTI DDS Ping as a pub/sub
6+
application and Routing Service you will be able to create a gateway between
7+
a Shared Memory domain and a UDP domain that uses only 3 ports. There is also
8+
a second configuration option using RTI Cloud Discovery Service to use Unicast.
9+
10+
## Environment variables
11+
12+
For your convenience, there are 2 scripts to set up environment variables:
13+
14+
- Linux: _variables.sh_
15+
- Windows: _variables.bat_
16+
17+
These are the variables they contain, which you should modify according to your
18+
system:
19+
20+
- **NDDSHOME**: path to the installation of RTI Connext Professional.
21+
- **NDDS_QOS_PROFILES**: path to the _qos.xml_ file containing QoS profiles.
22+
- **SHMEM_DOMAIN**: the domain for the applications using SHMEM.
23+
- **UDP_DOMAIN**: the domain for the applications using UDP (mainly the DomainParticipant of RTI Routing Service).
24+
- **APPS**: total number of DomainParticipants on the localhost. By default, Connext will try to reach out to the first 5 created applications on SHMEM, therefore, we need to increase that number if there are more than 5 applications.
25+
- **CDS_IP_ADDRESS**: the IP address of the host that contains RTI Cloud Discovery Service.
26+
- **CDS_PORT**: the UDP port that CDS will use.
27+
28+
On Linux, you can use the environment variables by sourcing the file:
29+
30+
```bash
31+
source variables.sh
32+
```
33+
34+
On Windows, simply run it:
35+
36+
```bash
37+
> variables.bat
38+
```
39+
40+
For convenience, the rest of the README will use the Linux variable sign ($)
41+
instead of the Windows variable signs (%%).
42+
43+
## Multicast example
44+
45+
You will need 3 terminals to run this example.
46+
47+
1. On terminal 1, source the variables script and run an RTI DDS Ping publisher
48+
on SHMEM acting as a local publisher:
49+
50+
```bash
51+
source variables.sh
52+
$NDDSHOME/bin/rtiddsping -pub -domain $SHMEM_DOMAIN -qosProfile "example_library::shmem_profile"
53+
```
54+
55+
2. On terminal 2, source the variables script and run an RTI DDS Ping
56+
subscriber on UDP acting as a remote subscriber:
57+
58+
```bash
59+
source variables.sh
60+
$NDDSHOME/bin/rtiddsping -sub -domain $UDP_DOMAIN -qosProfile "example_library::multicast"
61+
```
62+
63+
3. At this point, there should be no communication between both applications.
64+
They are on different domains and they're using different transports.
65+
On terminal 3, on the same host as the SHMEM application,
66+
source the variables script and start Routing Service:
67+
68+
```bash
69+
source variables.sh
70+
$NDDSHOME/bin/rtiroutingservice -cfgFile RS_config_multicast.xml -cfgName gateway_SHMEM_and_UDP
71+
```
72+
4. The subscriber should now be receiving data. For instance:
73+
74+
```bash
75+
...
76+
Current alive publisher tally is: 1
77+
rtiddsping, issue received: 0000002
78+
rtiddsping, issue received: 0000003
79+
rtiddsping, issue received: 0000004
80+
rtiddsping, issue received: 0000005
81+
...
82+
```
83+
84+
5. (Optional) Feel free to explore the QoS and RS config files. The relevant
85+
QoS profiles for this example are _shmem_profile_ and _multicast_. The RS file
86+
contains a _domain_route_ with 2 DPs. 1 for UDP and another one for SHMEM
87+
(configured through the DP QoS). It also contains 2 _auto_topic_route_ tags
88+
that allow the traffic to flow in the SHMEM --> UDP and SHMEM <-- UDP
89+
directions. In a real scenario, there would most likely be more topic routes,
90+
because different topics will require different DW / DR QoS policies.
91+
92+
6. (Optional) You can run Wireshark and capture data to verify that the
93+
traffic only goes to the 3 different ports that Routing Service opens:
94+
Multicast discovery, Unicast discovery and Unicast user-data. Which ports are
95+
actually in use will depend on the domain ID you use for UDP and whether you
96+
started the RTI DDS Ping application on the same machine as Routing Service or
97+
not. Remember you can check the ports in use on this [spreadsheet](https://d2vkrkwbbxbylk.cloudfront.net/sites/default/files/knowledge_base/Port%20Assign4.2e.xls).
98+
99+
6. You can now shutdown the 3 applications with Ctrl+C.
100+
101+
## Multicast-less example (CDS)
102+
103+
You will need 3 terminals to run this example.
104+
105+
1. On terminal 1, source the variables script and run an RTI DDS Ping publisher
106+
on SHMEM acting as a local publisher:
107+
108+
```bash
109+
source variables.sh
110+
$NDDSHOME/bin/rtiddsping -pub -domain $SHMEM_DOMAIN -qosProfile "example_library::shmem_profile"
111+
```
112+
113+
2. Install the CDS package. For instance: _rti_cloud_discovery_service-7.2.0-host-x64Linux.rtipkg_
114+
115+
3. On terminal 2, source the variables script and start CDS:
116+
117+
```bash
118+
$NDDSHOME/bin/rticlouddiscoveryservice -cfgFile CDS_config.xml -cfgName cds_all_domains_udpv4
119+
```
120+
121+
4. On terminal 3, source the variables script and run an RTI DDS Ping
122+
subscriber on UDP acting as a remote subscriber:
123+
124+
```bash
125+
source variables.sh
126+
$NDDSHOME/bin/rtiddsping -sub -domain $UDP_DOMAIN -qosProfile "example_library::no_multicast"
127+
```
128+
129+
5. At this point, there should be no communication between both applications.
130+
They are on different domains and they're using different transports. On
131+
terminal 4, on the same host as the SHMEM application, source the variables
132+
script and start Routing Service:
133+
134+
```bash
135+
source variables.sh
136+
$NDDSHOME/bin/rtiroutingservice -cfgFile RS_config_with_CDS.xml -cfgName gateway_SHMEM_and_UDP
137+
```
138+
139+
6. The subscriber should now be receiving data. For instance:
140+
141+
```bash
142+
...
143+
Current alive publisher tally is: 1
144+
rtiddsping, issue received: 0000002
145+
rtiddsping, issue received: 0000003
146+
rtiddsping, issue received: 0000004
147+
rtiddsping, issue received: 0000005
148+
...
149+
```
150+
151+
152+
7. (Optional) Feel free to explore the QoS and RS config files. The relevant
153+
QoS profiles for this example are _shmem_profile_ and _no_multicast_. The RS
154+
file contains a _domain_route_ with 2 DPs. 1 for UDP and another one for SHMEM
155+
(configured through the DP QoS). It also contains 2 _auto_topic_route_ tags
156+
that allow the traffic to flow in the SHMEM --> UDP and SHMEM <-- UDP
157+
directions. In a real scenario, there would most likely be more topic routes,
158+
because different topics will require different DW / DR QoS policies.
159+
160+
8. (Optional) You can run Wireshark and capture data to verify that the
161+
traffic only goes to the 2 different ports that Routing Service opens: Unicast
162+
discovery and Unicast user-data. Which ports are actually in use will depend
163+
on the domain ID you use for UDP and whether you started the RTI DDS Ping
164+
application on the same machine as Routing Service or not. Remember you can
165+
check the ports in use on this [spreadsheet](https://d2vkrkwbbxbylk.cloudfront.net/sites/default/files/knowledge_base/Port%20Assign4.2e.xls).
166+
167+
8. You can now shutdown the 4 applications with Ctrl+C.
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
<?xml version="1.0"?>
2+
3+
<!-- (c) Copyright, Real-Time Innovations, 2024. All rights reserved.
4+
RTI grants Licensee a license to use, modify, compile, and create derivative
5+
works of the software solely for use with RTI Connext DDS. Licensee may
6+
redistribute copies of the software provided that all such copies are subject
7+
to this license. The software is provided "as is", with no warranty of any
8+
type, including any warranty for fitness for any purpose. RTI is under no
9+
obligation to maintain or support the software. RTI shall not be liable for
10+
any incidental or consequential damages arising out of the use or inability
11+
to use the software. -->
12+
13+
<dds xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
14+
xsi:noNamespaceSchemaLocation="http://community.rti.com/schema/7.2.0/rti_routing_service.xsd">
15+
16+
<routing_service name="gateway_SHMEM_and_UDP">
17+
<annotation>
18+
<documentation>
19+
Routes all topics between domain 0 (SHMEM) and domain 1 (UDPv4)
20+
</documentation>
21+
</annotation>
22+
23+
<!-- The administration tag enables remote administration, and is
24+
required when using Admin Console. -->
25+
<administration>
26+
<domain_id>99</domain_id>
27+
<distributed_logger>
28+
<enabled>true</enabled>
29+
<filter_level>WARNING</filter_level>
30+
</distributed_logger>
31+
</administration>
32+
33+
<!-- This is the Monitoring configuration for all the entities in
34+
this routing service, and is required when using Admin Console. -->
35+
<monitoring>
36+
<!-- The domain id where to publish the monitoring information -->
37+
<domain_id>99</domain_id>
38+
<!-- How often to publish it -->
39+
<status_publication_period>
40+
<sec>5</sec>
41+
<nanosec>0</nanosec>
42+
</status_publication_period>
43+
<!-- How often to compute statistics -->
44+
<statistics_sampling_period>
45+
<sec>1</sec>
46+
<nanosec>0</nanosec>
47+
</statistics_sampling_period>
48+
</monitoring>
49+
50+
<domain_route name="TwoWayDomainRoute">
51+
52+
<participant name="SHMEM_DP">
53+
<domain_id>$(SHMEM_DOMAIN)</domain_id>
54+
<!-- You should use your own QoS profiles here -->
55+
<domain_participant_qos base_name="example_library::shmem_profile"/>
56+
</participant>
57+
58+
<participant name="UDP_DP">
59+
<domain_id>$(UDP_DOMAIN)</domain_id>
60+
<!-- You should use your own QoS profiles here -->
61+
<domain_participant_qos base_name="example_library::multicast"/>
62+
</participant>
63+
64+
<session name="SHMEM_to_UDP_session">
65+
<auto_topic_route name="SHMEM_to_UDP_route">
66+
<publish_with_original_info>true</publish_with_original_info>
67+
<input participant="SHMEM_DP">
68+
<allow_topic_name_filter>*</allow_topic_name_filter>
69+
<allow_registered_type_name_filter>*</allow_registered_type_name_filter>
70+
<deny_topic_name_filter>rti/*</deny_topic_name_filter>
71+
<creation_mode>ON_DOMAIN_OR_ROUTE_MATCH</creation_mode>
72+
<!-- You should use your own QoS profiles here -->
73+
<datareader_qos base_name="BuiltinQosLib::Generic.Common"/>
74+
</input>
75+
<output participant="UDP_DP">
76+
<allow_topic_name_filter>*</allow_topic_name_filter>
77+
<allow_registered_type_name_filter>*</allow_registered_type_name_filter>
78+
<deny_topic_name_filter>rti/*</deny_topic_name_filter>
79+
<creation_mode>ON_DOMAIN_OR_ROUTE_MATCH</creation_mode>
80+
<!-- You should use your own QoS profiles here -->
81+
<datawriter_qos base_name="BuiltinQosLib::Generic.Common"/>
82+
</output>
83+
</auto_topic_route>
84+
</session>
85+
86+
<session name="UDP_to_SHMEM_session">
87+
<auto_topic_route name="UDP_to_SHMEM_route">
88+
<publish_with_original_info>true</publish_with_original_info>
89+
<input participant="UDP_DP">
90+
<allow_topic_name_filter>*</allow_topic_name_filter>
91+
<allow_registered_type_name_filter>*</allow_registered_type_name_filter>
92+
<deny_topic_name_filter>rti/*</deny_topic_name_filter>
93+
<creation_mode>ON_DOMAIN_OR_ROUTE_MATCH</creation_mode>
94+
<!-- You should use your own QoS profiles here -->
95+
<datareader_qos base_name="BuiltinQosLib::Generic.Common"/>
96+
</input>
97+
<output participant="SHMEM_DP">
98+
<allow_topic_name_filter>*</allow_topic_name_filter>
99+
<allow_registered_type_name_filter>*</allow_registered_type_name_filter>
100+
<deny_topic_name_filter>rti/*</deny_topic_name_filter>
101+
<creation_mode>ON_DOMAIN_OR_ROUTE_MATCH</creation_mode>
102+
<!-- You should use your own QoS profiles here -->
103+
<datawriter_qos base_name="BuiltinQosLib::Generic.Common"/>
104+
</output>
105+
</auto_topic_route>
106+
</session>
107+
</domain_route>
108+
</routing_service>
109+
</dds>

0 commit comments

Comments
 (0)