Skip to content

Commit 738312b

Browse files
authored
Merge pull request #643 from franporcel/master
PR for Routing Service example for future blogpost
2 parents f074ff1 + ecfd8a6 commit 738312b

File tree

7 files changed

+516
-0
lines changed

7 files changed

+516
-0
lines changed
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>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
# Shared Memory / UDP Gateway
2+
3+
This example contains the necessary files to run the RTI Routing Service
4+
example from the "Breaking through Hospital IT Silos: The Top 3 Challenges
5+
to Overcome" blogpost. Routing Service (RS) will help us interfacing
6+
between the shared memory domain and the UDP domain. Applications local to a
7+
host will communicate with each other over SHMEM. RS will be the gateway for
8+
communication between local and remote applications. For this, RS will create
9+
a SHMEM DP (no UDP ports) and a UDP DP (with the 3 default UDP ports). If
10+
multicast is disabled, it will only open 2 UDP ports.
11+
12+
In this example, you will use RTI DDS Ping as a pub/sub example application.
13+
Along with, Routing Service you will be able to create a gateway between a
14+
Shared Memory domain and a UDP domain that uses only 3 ports. There is also a
15+
second configuration option using RTI Cloud Discovery Service to use Unicast.
16+
17+
## Environment variables
18+
19+
For your convenience, there are 2 scripts to set up environment variables:
20+
21+
- Linux: *variables.sh*
22+
- Windows: *variables.bat*
23+
24+
These are the variables they contain, which you should modify according to your
25+
system:
26+
27+
- **NDDSHOME**: path to the installation of RTI Connext Professional.
28+
- **NDDS_QOS_PROFILES**: path to the *qos.xml* file containing QoS profiles.
29+
- **SHMEM_DOMAIN**: the domain for the applications using SHMEM.
30+
- **UDP_DOMAIN**: the domain for the applications using UDP (mainly the
31+
DomainParticipant of RTI Routing Service).
32+
- **APPS**: total number of DomainParticipants on the localhost. By default,
33+
Connext will try to reach out to the first 5 created applications on SHMEM,
34+
therefore, we need to increase that number if there are more than 5
35+
applications.
36+
- **CDS_IP_ADDRESS**: the IP address of the host that contains RTI Cloud
37+
Discovery Service.
38+
- **CDS_PORT**: the UDP port that CDS will use.
39+
40+
On Linux, you can use the environment variables by sourcing the file:
41+
42+
```bash
43+
source variables.sh
44+
```
45+
46+
On Windows, simply run it:
47+
48+
```bash
49+
> variables.bat
50+
```
51+
52+
For convenience, the rest of the README will use the Linux variable sign ($)
53+
instead of the Windows variable signs (%%).
54+
55+
## Multicast example
56+
57+
You will need 3 terminals to run this example.
58+
59+
1. On terminal 1, source the variables script and run an RTI DDS Ping
60+
publisher on SHMEM acting as a local publisher:
61+
62+
```bash
63+
source variables.sh
64+
$NDDSHOME/bin/rtiddsping -pub -domain $SHMEM_DOMAIN -qosProfile "example_library::shmem_profile"
65+
```
66+
67+
2. On terminal 2, source the variables script and run an RTI DDS Ping
68+
subscriber on UDP acting as a remote subscriber:
69+
70+
```bash
71+
source variables.sh
72+
$NDDSHOME/bin/rtiddsping -sub -domain $UDP_DOMAIN -qosProfile "example_library::multicast"
73+
```
74+
75+
3. At this point, there should be no communication between both applications.
76+
They are on different domains and they're using different transports.
77+
On terminal 3, on the same host as the SHMEM application,
78+
source the variables script and start Routing Service:
79+
80+
```bash
81+
source variables.sh
82+
$NDDSHOME/bin/rtiroutingservice -cfgFile RS_config_multicast.xml -cfgName gateway_SHMEM_and_UDP
83+
```
84+
85+
4. The subscriber should now be receiving data. For instance:
86+
87+
```bash
88+
...
89+
Current alive publisher tally is: 1
90+
rtiddsping, issue received: 0000002
91+
rtiddsping, issue received: 0000003
92+
rtiddsping, issue received: 0000004
93+
rtiddsping, issue received: 0000005
94+
...
95+
```
96+
97+
5. (Optional) Feel free to explore the QoS and RS config files. The relevant
98+
QoS profiles for this example are *shmem_profile* and *multicast*. The RS file
99+
contains a *domain_route* with 2 DPs. 1 for UDP and another one for SHMEM
100+
(configured through the DP QoS). It also contains 2 *auto_topic_route* tags
101+
that allow the traffic to flow in the SHMEM --> UDP and SHMEM <-- UDP
102+
directions. In a real scenario, there would most likely be more topic routes,
103+
because different topics will require different DW / DR QoS policies.
104+
105+
6. (Optional) You can run Wireshark and capture data to verify that the
106+
traffic only goes to the 3 different ports that Routing Service opens:
107+
Multicast discovery, Unicast discovery and Unicast user-data. Which ports are
108+
actually in use will depend on the domain ID you use for UDP and whether you
109+
started the RTI DDS Ping application on the same machine as Routing Service or
110+
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).
111+
112+
6. You can now shutdown the 3 applications with Ctrl+C.
113+
114+
## Multicast-less example (CDS)
115+
116+
You will need 3 terminals to run this example.
117+
118+
1. On terminal 1, source the variables script and run an RTI DDS Ping
119+
publisher on SHMEM acting as a local publisher:
120+
121+
```bash
122+
source variables.sh
123+
$NDDSHOME/bin/rtiddsping -pub -domain $SHMEM_DOMAIN -qosProfile "example_library::shmem_profile"
124+
```
125+
126+
2. Install the CDS package. For instance: *rti_cloud_discovery_service-7.2.0-host-x64Linux.rtipkg*
127+
128+
3. On terminal 2, source the variables script and start CDS:
129+
130+
```bash
131+
$NDDSHOME/bin/rticlouddiscoveryservice -cfgFile CDS_config.xml -cfgName cds_all_domains_udpv4
132+
```
133+
134+
4. On terminal 3, source the variables script and run an RTI DDS Ping
135+
subscriber on UDP acting as a remote subscriber:
136+
137+
```bash
138+
source variables.sh
139+
$NDDSHOME/bin/rtiddsping -sub -domain $UDP_DOMAIN -qosProfile "example_library::no_multicast"
140+
```
141+
142+
5. At this point, there should be no communication between both applications.
143+
They are on different domains and they're using different transports. On
144+
terminal 4, on the same host as the SHMEM application, source the variables
145+
script and start Routing Service:
146+
147+
```bash
148+
source variables.sh
149+
$NDDSHOME/bin/rtiroutingservice -cfgFile RS_config_with_CDS.xml -cfgName gateway_SHMEM_and_UDP
150+
```
151+
152+
6. The subscriber should now be receiving data. For instance:
153+
154+
```bash
155+
...
156+
Current alive publisher tally is: 1
157+
rtiddsping, issue received: 0000002
158+
rtiddsping, issue received: 0000003
159+
rtiddsping, issue received: 0000004
160+
rtiddsping, issue received: 0000005
161+
...
162+
```
163+
164+
7. (Optional) Feel free to explore the QoS and RS config files. The relevant
165+
QoS profiles for this example are *shmem_profile* and *no_multicast*. The RS
166+
file contains a *domain_route* with 2 DPs. 1 for UDP and another one for SHMEM
167+
(configured through the DP QoS). It also contains 2 *auto_topic_route* tags
168+
that allow the traffic to flow in the SHMEM --> UDP and SHMEM <-- UDP
169+
directions. In a real scenario, there would most likely be more topic routes,
170+
because different topics will require different DW / DR QoS policies.
171+
172+
8. (Optional) You can run Wireshark and capture data to verify that the
173+
traffic only goes to the 2 different ports that Routing Service opens: Unicast
174+
discovery and Unicast user-data. Which ports are actually in use will depend
175+
on the domain ID you use for UDP and whether you started the RTI DDS Ping
176+
application on the same machine as Routing Service or not. Remember you can
177+
check the ports in use on this [spreadsheet](https://d2vkrkwbbxbylk.cloudfront.net/sites/default/files/knowledge_base/Port%20Assign4.2e.xls).
178+
179+
8. You can now shutdown the 4 applications with Ctrl+C.
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)