|
| 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. |
0 commit comments