rsmp 0.47.0 → 0.48.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (426) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/copilot-setup-steps.yml +1 -1
  3. data/.github/workflows/rubocop.yaml +1 -1
  4. data/.github/workflows/sus.yaml +1 -1
  5. data/CHANGELOG.md +10 -0
  6. data/Gemfile.lock +5 -5
  7. data/README.md +3 -1
  8. data/documentation/cli.md +225 -0
  9. data/documentation/configuration.md +57 -0
  10. data/lib/rsmp/cli/configuration.rb +30 -0
  11. data/lib/rsmp/cli.rb +18 -45
  12. data/lib/rsmp/collect/command_matcher.rb +13 -4
  13. data/lib/rsmp/collect/status_matcher.rb +14 -4
  14. data/lib/rsmp/command_list.rb +1 -1
  15. data/lib/rsmp/convert/export/json_schema/index.rb +64 -0
  16. data/lib/rsmp/convert/export/json_schema/items.rb +9 -1
  17. data/lib/rsmp/convert/export/json_schema/outputs.rb +65 -25
  18. data/lib/rsmp/convert/export/json_schema/values.rb +40 -11
  19. data/lib/rsmp/convert/export/json_schema.rb +3 -1
  20. data/lib/rsmp/message/sxl_codec.rb +194 -0
  21. data/lib/rsmp/message.rb +2 -0
  22. data/lib/rsmp/node/site/connections.rb +80 -0
  23. data/lib/rsmp/node/site/site.rb +21 -35
  24. data/lib/rsmp/node/supervisor/supervisor.rb +42 -0
  25. data/lib/rsmp/options/schemas/site.json +3 -0
  26. data/lib/rsmp/options/schemas/supervisor.json +1 -0
  27. data/lib/rsmp/options/site_options.rb +30 -21
  28. data/lib/rsmp/options/supervisor_options.rb +1 -0
  29. data/lib/rsmp/proxy/modules/receive.rb +3 -1
  30. data/lib/rsmp/proxy/modules/send.rb +26 -14
  31. data/lib/rsmp/proxy/proxy.rb +17 -0
  32. data/lib/rsmp/proxy/site/connection.rb +79 -0
  33. data/lib/rsmp/proxy/site/modules/commands.rb +24 -1
  34. data/lib/rsmp/proxy/site/site_proxy.rb +6 -15
  35. data/lib/rsmp/proxy/supervisor/modules/commands.rb +55 -0
  36. data/lib/rsmp/proxy/supervisor/modules/status.rb +13 -104
  37. data/lib/rsmp/proxy/supervisor/modules/status_updates.rb +148 -0
  38. data/lib/rsmp/proxy/supervisor/supervisor_proxy.rb +19 -0
  39. data/lib/rsmp/schema.rb +38 -1
  40. data/lib/rsmp/tlc/detector_logic.rb +2 -2
  41. data/lib/rsmp/tlc/modules/helpers.rb +0 -22
  42. data/lib/rsmp/tlc/modules/inputs.rb +4 -3
  43. data/lib/rsmp/tlc/modules/modes.rb +2 -2
  44. data/lib/rsmp/tlc/modules/plans.rb +7 -3
  45. data/lib/rsmp/tlc/modules/system.rb +1 -1
  46. data/lib/rsmp/tlc/proxy/control.rb +19 -19
  47. data/lib/rsmp/tlc/proxy/detectors.rb +3 -3
  48. data/lib/rsmp/tlc/proxy/io.rb +15 -12
  49. data/lib/rsmp/tlc/proxy/plans.rb +14 -14
  50. data/lib/rsmp/tlc/proxy/status.rb +9 -5
  51. data/lib/rsmp/tlc/proxy/system.rb +12 -6
  52. data/lib/rsmp/tlc/signal_group.rb +2 -2
  53. data/lib/rsmp/tlc/supervisor_interface.rb +42 -0
  54. data/lib/rsmp/tlc/traffic_controller_site.rb +1 -18
  55. data/lib/rsmp/version.rb +1 -1
  56. data/lib/rsmp.rb +4 -0
  57. data/schemas/core/3.1.4/command_response.json +11 -0
  58. data/schemas/core/3.1.5/command_response.json +11 -0
  59. data/schemas/core/3.2.0/command_response.json +11 -0
  60. data/schemas/core/3.2.1/command_response.json +11 -0
  61. data/schemas/core/3.2.2/command_response.json +11 -0
  62. data/schemas/core/3.3.0/command_response.json +11 -0
  63. data/schemas/tlc/1.0.10/alarms/A0008.json +21 -15
  64. data/schemas/tlc/1.0.10/alarms/A0201.json +26 -20
  65. data/schemas/tlc/1.0.10/alarms/A0202.json +26 -20
  66. data/schemas/tlc/1.0.10/alarms/A0301.json +69 -63
  67. data/schemas/tlc/1.0.10/alarms/A0302.json +87 -81
  68. data/schemas/tlc/1.0.10/commands/M0001.json +66 -60
  69. data/schemas/tlc/1.0.10/commands/M0002.json +48 -42
  70. data/schemas/tlc/1.0.10/commands/M0003.json +48 -42
  71. data/schemas/tlc/1.0.10/commands/M0004.json +35 -29
  72. data/schemas/tlc/1.0.10/commands/M0005.json +48 -42
  73. data/schemas/tlc/1.0.10/commands/M0006.json +48 -42
  74. data/schemas/tlc/1.0.10/commands/M0007.json +35 -29
  75. data/schemas/tlc/1.0.10/commands/M0008.json +48 -42
  76. data/schemas/tlc/1.0.10/commands/M0010.json +35 -29
  77. data/schemas/tlc/1.0.10/commands/M0011.json +35 -29
  78. data/schemas/tlc/1.0.10/commands/M0012.json +35 -29
  79. data/schemas/tlc/1.0.10/commands/M0013.json +35 -29
  80. data/schemas/tlc/1.0.10/commands/M0019.json +61 -55
  81. data/schemas/tlc/1.0.10/commands/M0103.json +51 -45
  82. data/schemas/tlc/1.0.10/commands/M0104.json +100 -94
  83. data/schemas/tlc/1.0.10/commands/command_requests.json +995 -1
  84. data/schemas/tlc/1.0.10/defs/guards.json +19 -0
  85. data/schemas/tlc/1.0.10/sxl.yaml +56 -56
  86. data/schemas/tlc/1.0.10/sxl_index.json +226 -244
  87. data/schemas/tlc/1.0.13/alarms/A0008.json +21 -15
  88. data/schemas/tlc/1.0.13/alarms/A0201.json +26 -20
  89. data/schemas/tlc/1.0.13/alarms/A0202.json +26 -20
  90. data/schemas/tlc/1.0.13/alarms/A0301.json +69 -63
  91. data/schemas/tlc/1.0.13/alarms/A0302.json +87 -81
  92. data/schemas/tlc/1.0.13/commands/M0001.json +66 -60
  93. data/schemas/tlc/1.0.13/commands/M0002.json +48 -42
  94. data/schemas/tlc/1.0.13/commands/M0003.json +48 -42
  95. data/schemas/tlc/1.0.13/commands/M0004.json +35 -29
  96. data/schemas/tlc/1.0.13/commands/M0005.json +48 -42
  97. data/schemas/tlc/1.0.13/commands/M0006.json +48 -42
  98. data/schemas/tlc/1.0.13/commands/M0007.json +35 -29
  99. data/schemas/tlc/1.0.13/commands/M0008.json +48 -42
  100. data/schemas/tlc/1.0.13/commands/M0010.json +35 -29
  101. data/schemas/tlc/1.0.13/commands/M0011.json +35 -29
  102. data/schemas/tlc/1.0.13/commands/M0012.json +35 -29
  103. data/schemas/tlc/1.0.13/commands/M0013.json +35 -29
  104. data/schemas/tlc/1.0.13/commands/M0014.json +48 -42
  105. data/schemas/tlc/1.0.13/commands/M0015.json +48 -42
  106. data/schemas/tlc/1.0.13/commands/M0016.json +35 -29
  107. data/schemas/tlc/1.0.13/commands/M0017.json +35 -29
  108. data/schemas/tlc/1.0.13/commands/M0018.json +48 -42
  109. data/schemas/tlc/1.0.13/commands/M0019.json +61 -55
  110. data/schemas/tlc/1.0.13/commands/M0103.json +51 -45
  111. data/schemas/tlc/1.0.13/commands/M0104.json +100 -94
  112. data/schemas/tlc/1.0.13/commands/command_requests.json +1293 -1
  113. data/schemas/tlc/1.0.13/defs/guards.json +19 -0
  114. data/schemas/tlc/1.0.13/sxl.yaml +63 -63
  115. data/schemas/tlc/1.0.13/sxl_index.json +280 -298
  116. data/schemas/tlc/1.0.14/alarms/A0008.json +21 -15
  117. data/schemas/tlc/1.0.14/alarms/A0201.json +26 -20
  118. data/schemas/tlc/1.0.14/alarms/A0202.json +26 -20
  119. data/schemas/tlc/1.0.14/alarms/A0301.json +69 -63
  120. data/schemas/tlc/1.0.14/alarms/A0302.json +87 -81
  121. data/schemas/tlc/1.0.14/commands/M0001.json +66 -60
  122. data/schemas/tlc/1.0.14/commands/M0002.json +48 -42
  123. data/schemas/tlc/1.0.14/commands/M0003.json +48 -42
  124. data/schemas/tlc/1.0.14/commands/M0004.json +35 -29
  125. data/schemas/tlc/1.0.14/commands/M0005.json +48 -42
  126. data/schemas/tlc/1.0.14/commands/M0006.json +48 -42
  127. data/schemas/tlc/1.0.14/commands/M0007.json +35 -29
  128. data/schemas/tlc/1.0.14/commands/M0008.json +48 -42
  129. data/schemas/tlc/1.0.14/commands/M0010.json +35 -29
  130. data/schemas/tlc/1.0.14/commands/M0011.json +35 -29
  131. data/schemas/tlc/1.0.14/commands/M0012.json +35 -29
  132. data/schemas/tlc/1.0.14/commands/M0013.json +35 -29
  133. data/schemas/tlc/1.0.14/commands/M0014.json +48 -42
  134. data/schemas/tlc/1.0.14/commands/M0015.json +48 -42
  135. data/schemas/tlc/1.0.14/commands/M0016.json +35 -29
  136. data/schemas/tlc/1.0.14/commands/M0017.json +35 -29
  137. data/schemas/tlc/1.0.14/commands/M0018.json +48 -42
  138. data/schemas/tlc/1.0.14/commands/M0019.json +61 -55
  139. data/schemas/tlc/1.0.14/commands/M0103.json +51 -45
  140. data/schemas/tlc/1.0.14/commands/M0104.json +100 -94
  141. data/schemas/tlc/1.0.14/commands/command_requests.json +1293 -1
  142. data/schemas/tlc/1.0.14/defs/guards.json +19 -0
  143. data/schemas/tlc/1.0.14/sxl.yaml +63 -63
  144. data/schemas/tlc/1.0.14/sxl_index.json +304 -322
  145. data/schemas/tlc/1.0.15/alarms/A0008.json +21 -15
  146. data/schemas/tlc/1.0.15/alarms/A0201.json +26 -20
  147. data/schemas/tlc/1.0.15/alarms/A0202.json +26 -20
  148. data/schemas/tlc/1.0.15/alarms/A0301.json +69 -63
  149. data/schemas/tlc/1.0.15/alarms/A0302.json +87 -81
  150. data/schemas/tlc/1.0.15/commands/M0001.json +66 -60
  151. data/schemas/tlc/1.0.15/commands/M0002.json +48 -42
  152. data/schemas/tlc/1.0.15/commands/M0003.json +48 -42
  153. data/schemas/tlc/1.0.15/commands/M0004.json +35 -29
  154. data/schemas/tlc/1.0.15/commands/M0005.json +48 -42
  155. data/schemas/tlc/1.0.15/commands/M0006.json +48 -42
  156. data/schemas/tlc/1.0.15/commands/M0007.json +35 -29
  157. data/schemas/tlc/1.0.15/commands/M0008.json +48 -42
  158. data/schemas/tlc/1.0.15/commands/M0010.json +35 -29
  159. data/schemas/tlc/1.0.15/commands/M0011.json +35 -29
  160. data/schemas/tlc/1.0.15/commands/M0012.json +35 -29
  161. data/schemas/tlc/1.0.15/commands/M0013.json +35 -29
  162. data/schemas/tlc/1.0.15/commands/M0014.json +48 -42
  163. data/schemas/tlc/1.0.15/commands/M0015.json +48 -42
  164. data/schemas/tlc/1.0.15/commands/M0016.json +35 -29
  165. data/schemas/tlc/1.0.15/commands/M0017.json +35 -29
  166. data/schemas/tlc/1.0.15/commands/M0018.json +48 -42
  167. data/schemas/tlc/1.0.15/commands/M0019.json +61 -55
  168. data/schemas/tlc/1.0.15/commands/M0020.json +61 -55
  169. data/schemas/tlc/1.0.15/commands/M0021.json +35 -29
  170. data/schemas/tlc/1.0.15/commands/M0103.json +51 -45
  171. data/schemas/tlc/1.0.15/commands/M0104.json +100 -94
  172. data/schemas/tlc/1.0.15/commands/command_requests.json +1425 -1
  173. data/schemas/tlc/1.0.15/defs/guards.json +19 -0
  174. data/schemas/tlc/1.0.15/sxl.yaml +66 -66
  175. data/schemas/tlc/1.0.15/sxl_index.json +330 -350
  176. data/schemas/tlc/1.0.7/alarms/A0008.json +21 -15
  177. data/schemas/tlc/1.0.7/alarms/A0201.json +26 -20
  178. data/schemas/tlc/1.0.7/alarms/A0202.json +26 -20
  179. data/schemas/tlc/1.0.7/alarms/A0301.json +69 -63
  180. data/schemas/tlc/1.0.7/alarms/A0302.json +87 -81
  181. data/schemas/tlc/1.0.7/commands/M0001.json +66 -60
  182. data/schemas/tlc/1.0.7/commands/M0002.json +48 -42
  183. data/schemas/tlc/1.0.7/commands/M0003.json +48 -42
  184. data/schemas/tlc/1.0.7/commands/M0004.json +35 -29
  185. data/schemas/tlc/1.0.7/commands/M0005.json +48 -42
  186. data/schemas/tlc/1.0.7/commands/M0006.json +48 -42
  187. data/schemas/tlc/1.0.7/commands/M0007.json +35 -29
  188. data/schemas/tlc/1.0.7/commands/M0008.json +48 -42
  189. data/schemas/tlc/1.0.7/commands/M0010.json +35 -29
  190. data/schemas/tlc/1.0.7/commands/M0011.json +35 -29
  191. data/schemas/tlc/1.0.7/commands/M0019.json +61 -55
  192. data/schemas/tlc/1.0.7/commands/M0103.json +51 -45
  193. data/schemas/tlc/1.0.7/commands/M0104.json +100 -94
  194. data/schemas/tlc/1.0.7/commands/command_requests.json +895 -1
  195. data/schemas/tlc/1.0.7/defs/guards.json +19 -0
  196. data/schemas/tlc/1.0.7/sxl.yaml +58 -58
  197. data/schemas/tlc/1.0.7/sxl_index.json +228 -246
  198. data/schemas/tlc/1.0.8/alarms/A0008.json +21 -15
  199. data/schemas/tlc/1.0.8/alarms/A0201.json +26 -20
  200. data/schemas/tlc/1.0.8/alarms/A0202.json +26 -20
  201. data/schemas/tlc/1.0.8/alarms/A0301.json +69 -63
  202. data/schemas/tlc/1.0.8/alarms/A0302.json +87 -81
  203. data/schemas/tlc/1.0.8/commands/M0001.json +66 -60
  204. data/schemas/tlc/1.0.8/commands/M0002.json +48 -42
  205. data/schemas/tlc/1.0.8/commands/M0003.json +48 -42
  206. data/schemas/tlc/1.0.8/commands/M0004.json +35 -29
  207. data/schemas/tlc/1.0.8/commands/M0005.json +48 -42
  208. data/schemas/tlc/1.0.8/commands/M0006.json +48 -42
  209. data/schemas/tlc/1.0.8/commands/M0007.json +35 -29
  210. data/schemas/tlc/1.0.8/commands/M0008.json +48 -42
  211. data/schemas/tlc/1.0.8/commands/M0010.json +35 -29
  212. data/schemas/tlc/1.0.8/commands/M0011.json +35 -29
  213. data/schemas/tlc/1.0.8/commands/M0012.json +35 -29
  214. data/schemas/tlc/1.0.8/commands/M0013.json +35 -29
  215. data/schemas/tlc/1.0.8/commands/M0019.json +61 -55
  216. data/schemas/tlc/1.0.8/commands/M0103.json +51 -45
  217. data/schemas/tlc/1.0.8/commands/M0104.json +100 -94
  218. data/schemas/tlc/1.0.8/commands/command_requests.json +995 -1
  219. data/schemas/tlc/1.0.8/defs/guards.json +19 -0
  220. data/schemas/tlc/1.0.8/sxl.yaml +56 -56
  221. data/schemas/tlc/1.0.8/sxl_index.json +226 -244
  222. data/schemas/tlc/1.0.9/alarms/A0008.json +21 -15
  223. data/schemas/tlc/1.0.9/alarms/A0201.json +26 -20
  224. data/schemas/tlc/1.0.9/alarms/A0202.json +26 -20
  225. data/schemas/tlc/1.0.9/alarms/A0301.json +69 -63
  226. data/schemas/tlc/1.0.9/alarms/A0302.json +87 -81
  227. data/schemas/tlc/1.0.9/commands/M0001.json +66 -60
  228. data/schemas/tlc/1.0.9/commands/M0002.json +48 -42
  229. data/schemas/tlc/1.0.9/commands/M0003.json +48 -42
  230. data/schemas/tlc/1.0.9/commands/M0004.json +35 -29
  231. data/schemas/tlc/1.0.9/commands/M0005.json +48 -42
  232. data/schemas/tlc/1.0.9/commands/M0006.json +48 -42
  233. data/schemas/tlc/1.0.9/commands/M0007.json +35 -29
  234. data/schemas/tlc/1.0.9/commands/M0008.json +48 -42
  235. data/schemas/tlc/1.0.9/commands/M0010.json +35 -29
  236. data/schemas/tlc/1.0.9/commands/M0011.json +35 -29
  237. data/schemas/tlc/1.0.9/commands/M0012.json +35 -29
  238. data/schemas/tlc/1.0.9/commands/M0013.json +35 -29
  239. data/schemas/tlc/1.0.9/commands/M0019.json +61 -55
  240. data/schemas/tlc/1.0.9/commands/M0103.json +51 -45
  241. data/schemas/tlc/1.0.9/commands/M0104.json +100 -94
  242. data/schemas/tlc/1.0.9/commands/command_requests.json +995 -1
  243. data/schemas/tlc/1.0.9/defs/guards.json +19 -0
  244. data/schemas/tlc/1.0.9/sxl.yaml +56 -56
  245. data/schemas/tlc/1.0.9/sxl_index.json +226 -244
  246. data/schemas/tlc/1.1.0/alarms/A0007.json +25 -19
  247. data/schemas/tlc/1.1.0/alarms/A0008.json +21 -15
  248. data/schemas/tlc/1.1.0/alarms/A0201.json +26 -20
  249. data/schemas/tlc/1.1.0/alarms/A0202.json +26 -20
  250. data/schemas/tlc/1.1.0/alarms/A0301.json +69 -63
  251. data/schemas/tlc/1.1.0/alarms/A0302.json +87 -81
  252. data/schemas/tlc/1.1.0/alarms/A0303.json +69 -63
  253. data/schemas/tlc/1.1.0/alarms/A0304.json +87 -81
  254. data/schemas/tlc/1.1.0/commands/M0001.json +66 -60
  255. data/schemas/tlc/1.1.0/commands/M0002.json +48 -42
  256. data/schemas/tlc/1.1.0/commands/M0003.json +48 -42
  257. data/schemas/tlc/1.1.0/commands/M0004.json +35 -29
  258. data/schemas/tlc/1.1.0/commands/M0005.json +48 -42
  259. data/schemas/tlc/1.1.0/commands/M0006.json +48 -42
  260. data/schemas/tlc/1.1.0/commands/M0007.json +35 -29
  261. data/schemas/tlc/1.1.0/commands/M0008.json +48 -42
  262. data/schemas/tlc/1.1.0/commands/M0010.json +35 -29
  263. data/schemas/tlc/1.1.0/commands/M0011.json +35 -29
  264. data/schemas/tlc/1.1.0/commands/M0012.json +35 -29
  265. data/schemas/tlc/1.1.0/commands/M0013.json +35 -29
  266. data/schemas/tlc/1.1.0/commands/M0014.json +48 -42
  267. data/schemas/tlc/1.1.0/commands/M0015.json +48 -42
  268. data/schemas/tlc/1.1.0/commands/M0016.json +35 -29
  269. data/schemas/tlc/1.1.0/commands/M0017.json +35 -29
  270. data/schemas/tlc/1.1.0/commands/M0018.json +48 -42
  271. data/schemas/tlc/1.1.0/commands/M0019.json +61 -55
  272. data/schemas/tlc/1.1.0/commands/M0020.json +61 -55
  273. data/schemas/tlc/1.1.0/commands/M0021.json +35 -29
  274. data/schemas/tlc/1.1.0/commands/M0022.json +194 -188
  275. data/schemas/tlc/1.1.0/commands/M0023.json +35 -29
  276. data/schemas/tlc/1.1.0/commands/M0103.json +51 -45
  277. data/schemas/tlc/1.1.0/commands/M0104.json +100 -94
  278. data/schemas/tlc/1.1.0/commands/command_requests.json +1525 -1
  279. data/schemas/tlc/1.1.0/defs/guards.json +19 -0
  280. data/schemas/tlc/1.1.0/statuses/S0033.json +2 -2
  281. data/schemas/tlc/1.1.0/sxl.yaml +75 -74
  282. data/schemas/tlc/1.1.0/sxl_index.json +391 -398
  283. data/schemas/tlc/1.2.0/alarms/A0007.json +25 -19
  284. data/schemas/tlc/1.2.0/alarms/A0008.json +21 -15
  285. data/schemas/tlc/1.2.0/alarms/A0201.json +26 -20
  286. data/schemas/tlc/1.2.0/alarms/A0202.json +26 -20
  287. data/schemas/tlc/1.2.0/alarms/A0301.json +69 -63
  288. data/schemas/tlc/1.2.0/alarms/A0302.json +87 -81
  289. data/schemas/tlc/1.2.0/alarms/A0303.json +69 -63
  290. data/schemas/tlc/1.2.0/alarms/A0304.json +87 -81
  291. data/schemas/tlc/1.2.0/commands/M0001.json +66 -60
  292. data/schemas/tlc/1.2.0/commands/M0002.json +48 -42
  293. data/schemas/tlc/1.2.0/commands/M0003.json +48 -42
  294. data/schemas/tlc/1.2.0/commands/M0004.json +35 -29
  295. data/schemas/tlc/1.2.0/commands/M0005.json +48 -42
  296. data/schemas/tlc/1.2.0/commands/M0006.json +48 -42
  297. data/schemas/tlc/1.2.0/commands/M0007.json +35 -29
  298. data/schemas/tlc/1.2.0/commands/M0008.json +48 -42
  299. data/schemas/tlc/1.2.0/commands/M0010.json +35 -29
  300. data/schemas/tlc/1.2.0/commands/M0011.json +35 -29
  301. data/schemas/tlc/1.2.0/commands/M0012.json +35 -29
  302. data/schemas/tlc/1.2.0/commands/M0013.json +35 -29
  303. data/schemas/tlc/1.2.0/commands/M0014.json +48 -42
  304. data/schemas/tlc/1.2.0/commands/M0015.json +48 -42
  305. data/schemas/tlc/1.2.0/commands/M0016.json +35 -29
  306. data/schemas/tlc/1.2.0/commands/M0017.json +35 -29
  307. data/schemas/tlc/1.2.0/commands/M0018.json +48 -42
  308. data/schemas/tlc/1.2.0/commands/M0019.json +61 -55
  309. data/schemas/tlc/1.2.0/commands/M0020.json +61 -55
  310. data/schemas/tlc/1.2.0/commands/M0021.json +35 -29
  311. data/schemas/tlc/1.2.0/commands/M0022.json +194 -188
  312. data/schemas/tlc/1.2.0/commands/M0023.json +35 -29
  313. data/schemas/tlc/1.2.0/commands/M0103.json +51 -45
  314. data/schemas/tlc/1.2.0/commands/M0104.json +100 -94
  315. data/schemas/tlc/1.2.0/commands/command_requests.json +1525 -1
  316. data/schemas/tlc/1.2.0/defs/guards.json +19 -0
  317. data/schemas/tlc/1.2.0/statuses/S0033.json +2 -2
  318. data/schemas/tlc/1.2.0/sxl.yaml +77 -76
  319. data/schemas/tlc/1.2.0/sxl_index.json +401 -397
  320. data/schemas/tlc/1.2.1/alarms/A0007.json +25 -19
  321. data/schemas/tlc/1.2.1/alarms/A0008.json +21 -15
  322. data/schemas/tlc/1.2.1/alarms/A0201.json +26 -20
  323. data/schemas/tlc/1.2.1/alarms/A0202.json +26 -20
  324. data/schemas/tlc/1.2.1/alarms/A0301.json +69 -63
  325. data/schemas/tlc/1.2.1/alarms/A0302.json +87 -81
  326. data/schemas/tlc/1.2.1/alarms/A0303.json +69 -63
  327. data/schemas/tlc/1.2.1/alarms/A0304.json +87 -81
  328. data/schemas/tlc/1.2.1/commands/M0001.json +66 -60
  329. data/schemas/tlc/1.2.1/commands/M0002.json +48 -42
  330. data/schemas/tlc/1.2.1/commands/M0003.json +48 -42
  331. data/schemas/tlc/1.2.1/commands/M0004.json +35 -29
  332. data/schemas/tlc/1.2.1/commands/M0005.json +48 -42
  333. data/schemas/tlc/1.2.1/commands/M0006.json +48 -42
  334. data/schemas/tlc/1.2.1/commands/M0007.json +35 -29
  335. data/schemas/tlc/1.2.1/commands/M0008.json +48 -42
  336. data/schemas/tlc/1.2.1/commands/M0010.json +35 -29
  337. data/schemas/tlc/1.2.1/commands/M0011.json +35 -29
  338. data/schemas/tlc/1.2.1/commands/M0012.json +35 -29
  339. data/schemas/tlc/1.2.1/commands/M0013.json +35 -29
  340. data/schemas/tlc/1.2.1/commands/M0014.json +48 -42
  341. data/schemas/tlc/1.2.1/commands/M0015.json +48 -42
  342. data/schemas/tlc/1.2.1/commands/M0016.json +35 -29
  343. data/schemas/tlc/1.2.1/commands/M0017.json +35 -29
  344. data/schemas/tlc/1.2.1/commands/M0018.json +48 -42
  345. data/schemas/tlc/1.2.1/commands/M0019.json +61 -55
  346. data/schemas/tlc/1.2.1/commands/M0020.json +61 -55
  347. data/schemas/tlc/1.2.1/commands/M0021.json +35 -29
  348. data/schemas/tlc/1.2.1/commands/M0022.json +194 -188
  349. data/schemas/tlc/1.2.1/commands/M0023.json +35 -29
  350. data/schemas/tlc/1.2.1/commands/M0103.json +51 -45
  351. data/schemas/tlc/1.2.1/commands/M0104.json +100 -94
  352. data/schemas/tlc/1.2.1/commands/command_requests.json +1525 -1
  353. data/schemas/tlc/1.2.1/defs/guards.json +19 -0
  354. data/schemas/tlc/1.2.1/statuses/S0033.json +2 -2
  355. data/schemas/tlc/1.2.1/sxl.yaml +77 -76
  356. data/schemas/tlc/1.2.1/sxl_index.json +401 -397
  357. data/schemas/tlc/1.3.0/alarms/A0007.json +25 -19
  358. data/schemas/tlc/1.3.0/alarms/A0008.json +21 -15
  359. data/schemas/tlc/1.3.0/alarms/A0201.json +26 -20
  360. data/schemas/tlc/1.3.0/alarms/A0202.json +26 -20
  361. data/schemas/tlc/1.3.0/alarms/A0301.json +69 -63
  362. data/schemas/tlc/1.3.0/alarms/A0302.json +87 -81
  363. data/schemas/tlc/1.3.0/alarms/A0303.json +70 -64
  364. data/schemas/tlc/1.3.0/alarms/A0304.json +88 -82
  365. data/schemas/tlc/1.3.0/commands/M0001.json +66 -60
  366. data/schemas/tlc/1.3.0/commands/M0002.json +48 -42
  367. data/schemas/tlc/1.3.0/commands/M0003.json +48 -42
  368. data/schemas/tlc/1.3.0/commands/M0004.json +35 -29
  369. data/schemas/tlc/1.3.0/commands/M0005.json +48 -42
  370. data/schemas/tlc/1.3.0/commands/M0006.json +48 -42
  371. data/schemas/tlc/1.3.0/commands/M0007.json +35 -29
  372. data/schemas/tlc/1.3.0/commands/M0008.json +61 -55
  373. data/schemas/tlc/1.3.0/commands/M0010.json +35 -29
  374. data/schemas/tlc/1.3.0/commands/M0011.json +35 -29
  375. data/schemas/tlc/1.3.0/commands/M0012.json +35 -29
  376. data/schemas/tlc/1.3.0/commands/M0013.json +36 -30
  377. data/schemas/tlc/1.3.0/commands/M0014.json +48 -42
  378. data/schemas/tlc/1.3.0/commands/M0015.json +48 -42
  379. data/schemas/tlc/1.3.0/commands/M0016.json +35 -29
  380. data/schemas/tlc/1.3.0/commands/M0017.json +35 -29
  381. data/schemas/tlc/1.3.0/commands/M0018.json +48 -42
  382. data/schemas/tlc/1.3.0/commands/M0019.json +61 -55
  383. data/schemas/tlc/1.3.0/commands/M0020.json +61 -55
  384. data/schemas/tlc/1.3.0/commands/M0021.json +35 -29
  385. data/schemas/tlc/1.3.0/commands/M0022.json +195 -189
  386. data/schemas/tlc/1.3.0/commands/M0023.json +35 -29
  387. data/schemas/tlc/1.3.0/commands/M0024.json +21 -15
  388. data/schemas/tlc/1.3.0/commands/M0103.json +51 -45
  389. data/schemas/tlc/1.3.0/commands/M0104.json +100 -94
  390. data/schemas/tlc/1.3.0/commands/command_requests.json +1559 -1
  391. data/schemas/tlc/1.3.0/defs/guards.json +19 -0
  392. data/schemas/tlc/1.3.0/statuses/S0001.json +4 -4
  393. data/schemas/tlc/1.3.0/statuses/S0005.json +3 -3
  394. data/schemas/tlc/1.3.0/statuses/S0006.json +2 -2
  395. data/schemas/tlc/1.3.0/statuses/S0007.json +1 -1
  396. data/schemas/tlc/1.3.0/statuses/S0008.json +1 -1
  397. data/schemas/tlc/1.3.0/statuses/S0009.json +1 -1
  398. data/schemas/tlc/1.3.0/statuses/S0010.json +1 -1
  399. data/schemas/tlc/1.3.0/statuses/S0011.json +1 -1
  400. data/schemas/tlc/1.3.0/statuses/S0012.json +1 -1
  401. data/schemas/tlc/1.3.0/statuses/S0013.json +1 -1
  402. data/schemas/tlc/1.3.0/statuses/S0014.json +1 -1
  403. data/schemas/tlc/1.3.0/statuses/S0015.json +1 -1
  404. data/schemas/tlc/1.3.0/statuses/S0016.json +1 -1
  405. data/schemas/tlc/1.3.0/statuses/S0017.json +1 -1
  406. data/schemas/tlc/1.3.0/statuses/S0019.json +1 -1
  407. data/schemas/tlc/1.3.0/statuses/S0020.json +1 -1
  408. data/schemas/tlc/1.3.0/statuses/S0025.json +2 -2
  409. data/schemas/tlc/1.3.0/statuses/S0027.json +1 -1
  410. data/schemas/tlc/1.3.0/statuses/S0032.json +2 -2
  411. data/schemas/tlc/1.3.0/statuses/S0033.json +5 -5
  412. data/schemas/tlc/1.3.0/statuses/S0034.json +1 -1
  413. data/schemas/tlc/1.3.0/statuses/S0035.json +1 -1
  414. data/schemas/tlc/1.3.0/statuses/S0091.json +1 -1
  415. data/schemas/tlc/1.3.0/statuses/S0092.json +1 -1
  416. data/schemas/tlc/1.3.0/statuses/S0096.json +6 -6
  417. data/schemas/tlc/1.3.0/statuses/S0201.json +1 -1
  418. data/schemas/tlc/1.3.0/statuses/S0202.json +1 -1
  419. data/schemas/tlc/1.3.0/statuses/S0203.json +1 -1
  420. data/schemas/tlc/1.3.0/statuses/S0204.json +9 -9
  421. data/schemas/tlc/1.3.0/statuses/S0205.json +1 -1
  422. data/schemas/tlc/1.3.0/statuses/S0206.json +1 -1
  423. data/schemas/tlc/1.3.0/statuses/S0207.json +1 -1
  424. data/schemas/tlc/1.3.0/statuses/S0208.json +9 -9
  425. data/schemas/tlc/1.3.0/sxl_index.json +408 -402
  426. metadata +8 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c206e0c53de4f523b03832b8821b698ea0f0440c11cdb51f5685382f4bdaebf5
4
- data.tar.gz: 2b35690dbe819d58cf76fe82faf1baec3392e6ecf54fbcd71b0e15c4fd7b7887
3
+ metadata.gz: 24b3e3fbb36a769054061eeb10f070096ec576468f20196932d43d1e4c3915c7
4
+ data.tar.gz: 3b6830d24f1225b721e21680b35c71c8dc508eb5bd6d684c595c71256c207ea0
5
5
  SHA512:
6
- metadata.gz: 4e7c84bc1a7c35f5f58108db5803cc8f0a9abe58ab9edc83a09d778d62479bcc1e0310eb2af9c0e9fe1cad75bf187303ba0d8759ff8b793dd15ae1abe118bcfe
7
- data.tar.gz: 562f88737283e91ab232c68c70344c9f668e5d08b0aa488b24ac21af57d07c30936b297c647aa00bedc7dae585faf8ed6be3593849c3f63721b1974b809b1696
6
+ metadata.gz: 1208ed7baf84741848f268c28a66d5410afdd172f8fd1f1010280816d8f16cc184870b3f979fcaa6e566f5746fd164608504a9bc00c9447f36bdfac77b457f34
7
+ data.tar.gz: b5c71f21c3369585b7740d85669a9fd4b3ebb030697984faeceb43f280fe9f6d86f6f78b3a005f0c133ceee50daef748868f6206c380726beb883fdfdbb1f295
@@ -26,7 +26,7 @@ jobs:
26
26
  # If you do not check out your code, Copilot will do this for you.
27
27
  steps:
28
28
  - name: Checkout code
29
- uses: actions/checkout@v4
29
+ uses: actions/checkout@v6
30
30
 
31
31
  - uses: ruby/setup-ruby@v1
32
32
  with:
@@ -9,7 +9,7 @@ jobs:
9
9
  fail-fast: false
10
10
  runs-on: ubuntu-latest
11
11
  steps:
12
- - uses: actions/checkout@v4
12
+ - uses: actions/checkout@v6
13
13
  - uses: ruby/setup-ruby@v1
14
14
  with:
15
15
  bundler-cache: true
@@ -11,7 +11,7 @@ jobs:
11
11
  os: [ubuntu-latest, macos-latest, windows-latest]
12
12
  runs-on: ${{ matrix.os }}
13
13
  steps:
14
- - uses: actions/checkout@v4
14
+ - uses: actions/checkout@v6
15
15
  - uses: ruby/setup-ruby@v1
16
16
  with:
17
17
  ruby-version: 4.0
data/CHANGELOG.md CHANGED
@@ -689,3 +689,13 @@ Initial release.
689
689
  ## 0.47.0
690
690
  - add cli command for checking configs
691
691
  - tighten config schemas
692
+
693
+ ## 0.48.0
694
+ - implement RSMP Core 3.3.0 connection roles, allowing a site to listen and a supervisor to connect
695
+ - enforce 3.3.0 command message rules, including one command code per CommandRequest/CommandResponse
696
+ - update TLC schemas with JSON-native values and required/optional command arguments
697
+ - add argument types to SXL indexes
698
+ - encode/decode message values based on SXL type defintions
699
+ - return `unknown` for unimplemented commands and statuses instead of rejecting the whole request
700
+ - omit legacy NTS message attributes from outgoing Core 3.3.0 messages
701
+ - `CORE_VERSION` or `SXLS` environment variables with command line options `--core` and `--sxls`
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rsmp (0.47.0)
4
+ rsmp (0.48.0)
5
5
  async (~> 2.39)
6
6
  colorize (~> 1.1)
7
7
  io-endpoint (~> 0.17)
@@ -15,7 +15,7 @@ GEM
15
15
  remote: https://rubygems.org/
16
16
  specs:
17
17
  ast (2.4.3)
18
- async (2.39.0)
18
+ async (2.40.0)
19
19
  console (~> 1.29)
20
20
  fiber-annotation
21
21
  io-event (~> 1.11)
@@ -33,9 +33,9 @@ GEM
33
33
  fiber-storage (1.0.1)
34
34
  hana (1.3.7)
35
35
  io-endpoint (0.17.2)
36
- io-event (1.16.1)
37
- io-stream (0.13.0)
38
- json (2.19.9)
36
+ io-event (1.16.4)
37
+ io-stream (0.13.1)
38
+ json (2.20.0)
39
39
  json_schemer (2.5.0)
40
40
  bigdecimal
41
41
  hana (~> 1.3)
data/README.md CHANGED
@@ -28,7 +28,7 @@ require 'rsmp'
28
28
  RSMP::Supervisor.new.start # run supervisor until Ctlr-C is pressed
29
29
  ```
30
30
 
31
- Be default, a site will try to connect to a single supervisor on localhost 127.0.0.1, port 12111. By default, a supervisor will listen for sites on port 12111 and accept any site.
31
+ By default, a site will try to connect to a single supervisor on localhost 127.0.0.1, port 12111. By default, a supervisor will listen for sites on port 12111 and accept any site.
32
32
 
33
33
  You can pass options to control ip adresseses, ports, logging and other behaviour:
34
34
 
@@ -144,6 +144,8 @@ sxls:
144
144
  tlc: '1.3.0'
145
145
  ```
146
146
 
147
+ See [configuration](documentation/configuration.md) for connection-role examples and other YAML settings.
148
+
147
149
  ## Command-line tool
148
150
  Tools for easily running RSMP supervisors and sites. The binary is called ```rsmp```.
149
151
 
@@ -0,0 +1,225 @@
1
+ # RSMP CLI
2
+
3
+ The `rsmp` command can run a site, run a supervisor, validate config files, generate JSON Schemas from an SXL, and print the gem version.
4
+
5
+ Use help at any level:
6
+
7
+ ```console
8
+ $ rsmp help
9
+ $ rsmp help site
10
+ $ rsmp help supervisor
11
+ $ rsmp help config check
12
+ $ rsmp help schema generate
13
+ ```
14
+
15
+ ## Quick Examples
16
+
17
+ Run a TLC site that connects to the default supervisor endpoint, `127.0.0.1:12111`:
18
+
19
+ ```console
20
+ $ rsmp site
21
+ ```
22
+
23
+ Run a supervisor that listens on the default port, `12111`:
24
+
25
+ ```console
26
+ $ rsmp supervisor
27
+ ```
28
+
29
+ Run both with explicit config files:
30
+
31
+ ```console
32
+ $ rsmp supervisor --config config/supervisor.yaml
33
+ $ rsmp site --config config/tlc.yaml
34
+ ```
35
+
36
+ Run a site against a specific supervisor endpoint:
37
+
38
+ ```console
39
+ $ rsmp site --supervisors 192.0.2.10:12111
40
+ ```
41
+
42
+ Show raw JSON messages in the log:
43
+
44
+ ```console
45
+ $ rsmp site --json
46
+ $ rsmp supervisor --json
47
+ ```
48
+
49
+ Write logs to a file:
50
+
51
+ ```console
52
+ $ rsmp supervisor --log log/supervisor.log
53
+ $ rsmp site --log log/site.log
54
+ ```
55
+
56
+ Validate config files before starting anything:
57
+
58
+ ```console
59
+ $ rsmp config check config/tlc.yaml --type tlc
60
+ $ rsmp config check config/supervisor.yaml --type supervisor
61
+ ```
62
+
63
+ Generate JSON Schema files from an SXL YAML file:
64
+
65
+ ```console
66
+ $ rsmp schema generate --in schemas/tlc/1.3.0/sxl.yaml --out /tmp/tlc-schema
67
+ ```
68
+
69
+ ## Configuration Files
70
+
71
+ Most real runs should use YAML config files. The CLI accepts `--config`, `-c`, and `--options` as aliases:
72
+
73
+ ```console
74
+ $ rsmp site -c config/tlc.yaml
75
+ $ rsmp supervisor --options config/supervisor.yaml
76
+ ```
77
+
78
+ CLI options override or add to settings loaded from the config file. For example, this loads `config/tlc.yaml` but changes the site id and supervisor endpoint for this run:
79
+
80
+ ```console
81
+ $ rsmp site -c config/tlc.yaml --id RN+SI0420 --supervisors 127.0.0.1:13111
82
+ ```
83
+
84
+ Core and SXL version overrides are command-line options.
85
+
86
+ See `documentation/configuration.md` for the YAML format.
87
+
88
+ ## Commands
89
+
90
+ ### `rsmp site`
91
+
92
+ Runs an RSMP site. The default site type is `tlc`, so this starts a TLC traffic controller site implementation.
93
+
94
+ ```console
95
+ $ rsmp site
96
+ ```
97
+
98
+ Common options:
99
+
100
+ - `--config PATH`, `-c PATH`, `--options PATH`: load site settings from a YAML file.
101
+ - `--id ID`, `-i ID`: set the site id.
102
+ - `--supervisors LIST`, `-s LIST`: set one or more supervisor endpoints.
103
+ - `--core VERSION`: set the RSMP Core version.
104
+ - `--sxls LIST`: set the SXLs announced by the site as a comma-separated `name:version` list.
105
+ - `--type tlc`, `-t tlc`: choose the site type. Currently `tlc` is the supported CLI type.
106
+ - `--log PATH`, `-l PATH`: write log output to a file.
107
+ - `--json`, `-j`: include raw JSON messages in the log.
108
+
109
+ The `--supervisors` option accepts a comma-separated list:
110
+
111
+ ```console
112
+ $ rsmp site --supervisors 127.0.0.1:12111,192.0.2.10:12111
113
+ ```
114
+
115
+ If the IP address is omitted, `127.0.0.1` is used:
116
+
117
+ ```console
118
+ $ rsmp site --supervisors :13111
119
+ ```
120
+
121
+ If the port is omitted, the configured site default is used:
122
+
123
+ ```console
124
+ $ rsmp site --supervisors 127.0.0.1
125
+ ```
126
+
127
+ Use `--sxls` to specify several SXLs for a site:
128
+
129
+ ```console
130
+ $ rsmp site --sxls tlc:1.3.0,vms:1.0.0
131
+ ```
132
+
133
+ Example with explicit core and SXL versions:
134
+
135
+ ```console
136
+ $ rsmp site -c config/tlc.yaml --core 3.3.0 --sxls tlc:1.3.0
137
+ ```
138
+
139
+ ### `rsmp supervisor`
140
+
141
+ Runs an RSMP supervisor. By default it listens for site connections on port `12111`.
142
+
143
+ ```console
144
+ $ rsmp supervisor
145
+ ```
146
+
147
+ Common options:
148
+
149
+ - `--config PATH`, `-c PATH`, `--options PATH`: load supervisor settings from a YAML file.
150
+ - `--id ID`, `-i ID`: set the supervisor site id.
151
+ - `--ip ADDRESS`: set the listen address.
152
+ - `--port PORT`, `-p PORT`: set the listen port.
153
+ - `--core VERSION`: override the accepted RSMP Core version.
154
+ - `--sxls LIST`: override SXL versions as a comma-separated `name:version` list.
155
+ - `--log PATH`, `-l PATH`: write log output to a file.
156
+ - `--json`, `-j`: include raw JSON messages in the log.
157
+
158
+ Example:
159
+
160
+ ```console
161
+ $ rsmp supervisor --ip 0.0.0.0 --port 13111 --core 3.3.0 --sxls tlc:1.3.0 --json
162
+ ```
163
+
164
+ When `--core` or `--sxls` is used with the supervisor command, it overrides `default` and any configured `sites` entries for that run.
165
+
166
+ ### `rsmp config check`
167
+
168
+ Validates one or more YAML config files without starting a site or supervisor.
169
+
170
+ ```console
171
+ $ rsmp config check config/tlc.yaml
172
+ $ rsmp config check config/tlc.yaml config/supervisor.yaml
173
+ ```
174
+
175
+ Options:
176
+
177
+ - `--type TYPE`, `-t TYPE`: choose the config type. Supported values are `auto`, `site`, `tlc`, and `supervisor`.
178
+
179
+ The default type is `auto`. Auto-detection works when the config shape is clear. If the CLI cannot infer the type, pass `--type` explicitly:
180
+
181
+ ```console
182
+ $ rsmp config check config/tlc.yaml --type tlc
183
+ $ rsmp config check config/supervisor.yaml --type supervisor
184
+ ```
185
+
186
+ Successful validation prints `OK` for each valid file. Invalid files print an error and the command exits with status `1`.
187
+
188
+ Common validation errors include:
189
+
190
+ - The file does not exist.
191
+ - The path is a directory.
192
+ - The file is not YAML.
193
+ - A setting has the wrong type.
194
+ - A config key is not allowed by the schema.
195
+
196
+ ### `rsmp schema generate`
197
+
198
+ Generates JSON Schema files from an `sxl.yaml` file.
199
+
200
+ ```console
201
+ $ rsmp schema generate --in schemas/tlc/1.3.0/sxl.yaml --out /tmp/tlc-schema
202
+ ```
203
+
204
+ Options:
205
+
206
+ - `--in PATH`, `-i PATH`: path to the input `sxl.yaml`. Defaults to `sxl.yaml`.
207
+ - `--out PATH`, `-o PATH`: output directory. Defaults to the current directory.
208
+
209
+ The command writes the generated status, command, alarm, root schema, definitions, and `sxl_index.json` files to the output directory.
210
+
211
+ If the input file is missing, the command prints an error and exits with status `1`.
212
+
213
+ ### `rsmp version`
214
+
215
+ Prints the installed `rsmp` gem version:
216
+
217
+ ```console
218
+ $ rsmp version
219
+ ```
220
+
221
+ ## Exit Status
222
+
223
+ Commands return status `0` on success. Validation and argument errors return a non-zero status.
224
+
225
+ Long-running commands such as `rsmp site` and `rsmp supervisor` run until interrupted or until startup fails.
@@ -38,6 +38,7 @@ Both `--config` and `--options` are accepted as aliases.
38
38
 
39
39
  ```yaml
40
40
  site_id: RN+SI0001
41
+ connection_role: client
41
42
  supervisors:
42
43
  - ip: 127.0.0.1
43
44
  port: 12111
@@ -53,6 +54,25 @@ log:
53
54
  json: true
54
55
  ```
55
56
 
57
+ `connection_role` controls which side opens the TCP connection:
58
+
59
+ - `client` means the node connects to configured remote endpoints.
60
+ - `server` means the node listens for incoming connections.
61
+
62
+ Configurable connection roles are available from Core 3.3.0.
63
+
64
+ For sites, `client` is the default and uses the `supervisors` endpoint list. A site in `server` role listens on `ip` and `port` instead.
65
+
66
+ ```yaml
67
+ site_id: RN+SI0001
68
+ connection_role: server
69
+ ip: 0.0.0.0
70
+ port: 12111
71
+ core_version: "3.3.0"
72
+ sxls:
73
+ tlc: "1.3.0"
74
+ ```
75
+
56
76
  ## Message Buffer
57
77
 
58
78
  Sites buffer outgoing alarm and aggregated status messages while a supervisor connection is down. Status updates are buffered according to `message_buffer.statuses`, which defaults to `true`.
@@ -80,6 +100,7 @@ The current implementation uses an in-memory buffer per supervisor connection. B
80
100
 
81
101
  ```yaml
82
102
  port: 12111
103
+ connection_role: server
83
104
  default:
84
105
  sxls:
85
106
  tlc: "1.3.0"
@@ -105,6 +126,22 @@ sites:
105
126
 
106
127
  Per-site configuration follows the supervisor-side site schema (`lib/rsmp/options/schemas/supervisor_site.json`). Each site entry can define an `sxls` map, or inherit it from `default`. The SXL name `core` is reserved for the RSMP core schema and cannot be used as an SXL key.
107
128
 
129
+ For supervisors, `server` is the default and listens on `ip`/`port`. A supervisor in `client` role connects out to the endpoints listed under each configured site. The outbound endpoint list uses the existing `supervisors` key in the per-site settings:
130
+
131
+ ```yaml
132
+ connection_role: client
133
+ sites:
134
+ RN+SI0001:
135
+ core_version: "3.3.0"
136
+ sxls:
137
+ tlc: "1.3.0"
138
+ supervisors:
139
+ - ip: 127.0.0.1
140
+ port: 12111
141
+ ```
142
+
143
+ This reversed setup is used when the site listens and the supervision system initiates the connection.
144
+
108
145
  ## Supervisor settings
109
146
 
110
147
  The following lists the top-level supervisor settings and the keys available for per-site configuration under `sites`.
@@ -113,6 +150,7 @@ Top-level supervisor settings
113
150
 
114
151
  - `port`: integer|string - TCP port the supervisor listens on (default: `12111`).
115
152
  - `ip`: string - address to bind to.
153
+ - `connection_role`: string - `server` to listen for sites, or `client` to connect to configured site endpoints (default: `server`).
116
154
  - `ips`: string or array - `'all'` or a list of allowed IP addresses.
117
155
  - `site_id`: string - optional site identifier for the supervisor itself.
118
156
  - `max_sites`: integer - limit concurrent connected sites.
@@ -145,6 +183,25 @@ Common per-site keys
145
183
  - `skip_validation` (array[string]): list of message types to skip JSON schema validation for this site.
146
184
  - `security_codes` (object): map of security code levels to secrets.
147
185
 
186
+ ## Site settings
187
+
188
+ The following lists the top-level site settings.
189
+
190
+ - `site_id` (string): site identifier sent in the Version message.
191
+ - `type` (string): optional site type.
192
+ - `connection_role` (string): `client` to connect to supervisors, or `server` to listen for supervisor connections (default: `client`).
193
+ - `ip` (string): bind address when `connection_role` is `server` (default: `0.0.0.0`).
194
+ - `port` (integer|string): listen port when `connection_role` is `server`. If omitted, it defaults to the first configured supervisor port.
195
+ - `supervisors` (array): supervisor endpoints used when `connection_role` is `client`.
196
+ - `sxls` (object): SXL versions used by the site, keyed by SXL name.
197
+ - `core_version` (string): RSMP Core version to use.
198
+ - `intervals` (object): timer settings - `timer`, `watchdog`, `reconnect`.
199
+ - `timeouts` (object): timeout settings - `watchdog`, `acknowledgement`.
200
+ - `send_after_connect` (boolean): whether to send messages after connect without waiting for additional events.
201
+ - `message_buffer` (object): outgoing message buffer settings.
202
+ - `components` (object): component definitions.
203
+ - `security_codes` (object): map of security code levels to secrets.
204
+
148
205
  ### TLC-specific settings
149
206
 
150
207
  TLC-specific settings are used when a site uses the `tlc` SXL and include:
@@ -0,0 +1,30 @@
1
+ module RSMP
2
+ class CLI < Thor
3
+ # Private helpers for loading CLI configuration files.
4
+ module Configuration
5
+ private
6
+
7
+ def load_site_configuration
8
+ load_configuration(site_options_class)
9
+ end
10
+
11
+ def load_supervisor_configuration
12
+ load_configuration(RSMP::Supervisor::Options)
13
+ end
14
+
15
+ def load_configuration(options_class)
16
+ settings = {}
17
+ log_settings = { 'active' => true }
18
+ return [settings, log_settings] unless options[:config]
19
+
20
+ options_object = options_class.load_file(options[:config])
21
+ settings = options_object.to_h
22
+ log_settings = log_settings.deep_merge(options_object.log_settings)
23
+ [settings, log_settings]
24
+ rescue RSMP::ConfigurationError => e
25
+ puts "Error: #{e}"
26
+ exit
27
+ end
28
+ end
29
+ end
30
+ end
data/lib/rsmp/cli.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require 'thor'
2
2
  require_relative '../rsmp'
3
+ require_relative 'cli/configuration'
3
4
 
4
5
  module RSMP
5
6
  # CLI subcommands for SXL schema operations.
@@ -48,6 +49,8 @@ module RSMP
48
49
 
49
50
  # CLI commands for running RSMP site and supervisor.
50
51
  class CLI < Thor
52
+ include Configuration
53
+
51
54
  desc 'version', 'Show version'
52
55
  def version
53
56
  puts RSMP::VERSION
@@ -59,6 +62,7 @@ module RSMP
59
62
  method_option :supervisors, type: :string, aliases: '-s',
60
63
  banner: 'ip:port,... list of supervisor to connect to'
61
64
  method_option :core, type: :string, banner: "Core version: [#{RSMP::Schema.core_versions.join(' ')}]", enum: RSMP::Schema.core_versions
65
+ method_option :sxls, type: :string, banner: 'SXL versions as name:version,...'
62
66
  method_option :type, type: :string, aliases: '-t', banner: 'Type of site: [tlc]', enum: ['tlc'],
63
67
  default: 'tlc'
64
68
  method_option :log, type: :string, aliases: '-l', banner: 'Path to log file'
@@ -84,6 +88,7 @@ module RSMP
84
88
  method_option :ip, type: :string, banner: 'IP address to listen on'
85
89
  method_option :port, type: :string, aliases: '-p', banner: 'Port to listen on'
86
90
  method_option :core, type: :string, banner: "Core version: [#{RSMP::Schema.core_versions.join(' ')}]", enum: RSMP::Schema.core_versions
91
+ method_option :sxls, type: :string, banner: 'Default SXL versions as name:version,...'
87
92
  method_option :log, type: :string, aliases: '-l', banner: 'Path to log file'
88
93
  method_option :json, type: :boolean, aliases: '-j', banner: 'Show JSON messages in log'
89
94
  def supervisor
@@ -97,26 +102,6 @@ module RSMP
97
102
  register SchemaCLI, 'schema', 'schema COMMAND', 'SXL schema commands'
98
103
  register ConfigCLI, 'config', 'config COMMAND', 'Configuration commands'
99
104
 
100
- no_commands do
101
- def load_site_configuration
102
- settings = {}
103
- log_settings = { 'active' => true }
104
-
105
- return [settings, log_settings] unless options[:config]
106
-
107
- begin
108
- options_object = site_options_class.load_file(options[:config])
109
- settings = options_object.to_h
110
- log_settings = log_settings.deep_merge(options_object.log_settings)
111
- rescue RSMP::ConfigurationError => e
112
- puts "Error: #{e}"
113
- exit
114
- end
115
-
116
- [settings, log_settings]
117
- end
118
- end
119
-
120
105
  private
121
106
 
122
107
  def site_options_class
@@ -136,8 +121,8 @@ module RSMP
136
121
 
137
122
  def apply_basic_site_options(settings)
138
123
  settings['site_id'] = options[:id] if options[:id]
139
- settings['core_version'] = options[:core] || ENV['CORE_VERSION'] if options[:core] || ENV['CORE_VERSION']
140
- settings['sxls'] = parse_sxls(ENV['SXLS']) if ENV['SXLS']
124
+ settings['core_version'] = options[:core] if options[:core]
125
+ settings['sxls'] = parse_sxls(options[:sxls]) if options[:sxls]
141
126
  end
142
127
 
143
128
  def parse_sxls(value)
@@ -223,27 +208,9 @@ module RSMP
223
208
  end
224
209
  end
225
210
 
226
- def load_supervisor_configuration
227
- settings = {}
228
- log_settings = { 'active' => true }
229
-
230
- return [settings, log_settings] unless options[:config]
231
-
232
- begin
233
- options_object = RSMP::Supervisor::Options.load_file(options[:config])
234
- settings = options_object.to_h
235
- log_settings = log_settings.deep_merge(options_object.log_settings)
236
- rescue RSMP::ConfigurationError => e
237
- puts "Error: #{e}"
238
- exit
239
- end
240
-
241
- [settings, log_settings]
242
- end
243
-
244
211
  def apply_supervisor_options(settings, log_settings)
245
212
  apply_basic_supervisor_options(settings)
246
- apply_core_version_option(settings)
213
+ apply_version_options(settings)
247
214
  apply_log_options(log_settings)
248
215
  end
249
216
 
@@ -253,11 +220,17 @@ module RSMP
253
220
  settings['port'] = options[:port] if options[:port]
254
221
  end
255
222
 
256
- def apply_core_version_option(settings)
257
- return unless options[:core]
223
+ def apply_version_options(settings)
224
+ return unless options[:core] || options[:sxls]
225
+
226
+ sxls = parse_sxls(options[:sxls]) if options[:sxls]
227
+ apply_version_overrides(settings['default'] ||= {}, sxls)
228
+ (settings['sites'] || {}).each_value { |site_settings| apply_version_overrides(site_settings, sxls) }
229
+ end
258
230
 
259
- settings['default'] ||= {}
260
- settings['default']['core_version'] = options[:core]
231
+ def apply_version_overrides(settings, sxls)
232
+ settings['core_version'] = options[:core] if options[:core]
233
+ settings['sxls'] = sxls if sxls
261
234
  end
262
235
 
263
236
  def apply_log_options(log_settings)
@@ -9,16 +9,25 @@ module RSMP
9
9
  end
10
10
 
11
11
  def match_value?(item)
12
- return true unless @want['v']
12
+ return true unless @want.key?('v')
13
13
 
14
- if @want['v'].is_a? Regexp
15
- return false if item['v'] !~ @want['v']
16
- elsif item['v'] != @want['v']
14
+ want = @want['v']
15
+ got = item['v']
16
+ if want.is_a? Regexp
17
+ return false unless regex_match?(got, want)
18
+ elsif got != want
17
19
  return false
18
20
  end
19
21
  true
20
22
  end
21
23
 
24
+ def regex_match?(got, want)
25
+ return got =~ want if got.is_a?(String)
26
+ return got.any? { |item| item.is_a?(String) && item =~ want } if got.is_a?(Array)
27
+
28
+ false
29
+ end
30
+
22
31
  def match(item)
23
32
  code_match = match_code(item)
24
33
  return code_match if code_match.nil?
@@ -11,15 +11,25 @@ module RSMP
11
11
 
12
12
  def match_value?(item)
13
13
  return false if @want['q'] && @want['q'] != item['q']
14
+ return true unless @want.key?('s')
14
15
 
15
- if @want['s'].is_a? Regexp
16
- return false if item['s'] !~ @want['s']
17
- elsif @want['s']
18
- return false if item['s'] != @want['s']
16
+ want = @want['s']
17
+ got = item['s']
18
+ if want.is_a? Regexp
19
+ return false unless regex_match?(got, want)
20
+ elsif got != want
21
+ return false
19
22
  end
20
23
  true
21
24
  end
22
25
 
26
+ def regex_match?(got, want)
27
+ return got =~ want if got.is_a?(String)
28
+ return got.any? { |item| item.is_a?(String) && item =~ want } if got.is_a?(Array)
29
+
30
+ false
31
+ end
32
+
23
33
  def match(item)
24
34
  return nil unless match_code(item)
25
35
 
@@ -18,7 +18,7 @@ module RSMP
18
18
  'cCI' => command_code_id.to_s,
19
19
  'cO' => command_name.to_s,
20
20
  'n' => n.to_s,
21
- 'v' => v.to_s
21
+ 'v' => v
22
22
  }
23
23
  end
24
24
  end