rsmp_schemer 0.3.2 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (218) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +23 -22
  3. data/lib/rsmp_schemer/version.rb +3 -3
  4. data/rsmp_schemer.gemspec +3 -3
  5. data/schemas/core_3.1.2/schema/core/alarm.json +8 -4
  6. data/schemas/core_3.1.2/spec/core/alarm_spec.rb +15 -0
  7. data/schemas/core_3.1.3/Gemfile.lock +20 -20
  8. data/schemas/core_3.1.3/schema/core/alarm.json +8 -4
  9. data/schemas/core_3.1.3/schema/core/core.json +0 -1
  10. data/schemas/core_3.1.3/schema/core/rsmp.json +0 -9
  11. data/schemas/core_3.1.3/spec/core/alarm_spec.rb +20 -7
  12. data/schemas/core_3.1.3/spec/core/command_request_spec.rb +3 -6
  13. data/schemas/core_3.1.3/spec/core/command_response_spec.rb +1 -43
  14. data/schemas/core_3.1.3/spec/core/status_request_spec.rb +4 -8
  15. data/schemas/core_3.1.3/spec/core/status_response_spec.rb +13 -8
  16. data/schemas/core_3.1.3/spec/core/status_subscribe_spec.rb +4 -8
  17. data/schemas/core_3.1.3/spec/core/status_unsubscribe_spec.rb +4 -8
  18. data/schemas/core_3.1.3/spec/core/status_update_spec.rb +4 -8
  19. data/schemas/core_3.1.3/spec/schemer_helper.rb +19 -17
  20. data/schemas/core_3.1.4/.gitignore +1 -0
  21. data/schemas/core_3.1.4/schema/core/alarm.json +8 -4
  22. data/schemas/core_3.1.4/spec/core/alarm_spec.rb +15 -0
  23. data/schemas/core_3.1.4/spec/core/version_spec.rb +3 -2
  24. data/schemas/core_3.1.5/.gitignore +1 -0
  25. data/schemas/core_3.1.5/schema/core/alarm.json +40 -41
  26. data/schemas/core_3.1.5/schema/core/alarm_issue.json +44 -0
  27. data/schemas/core_3.1.5/schema/core/alarm_suspend_resume.json +3 -0
  28. data/schemas/core_3.1.5/schema/core/alarm_suspended_resumed.json +47 -0
  29. data/schemas/core_3.1.5/schema/core/command_response.json +1 -1
  30. data/schemas/core_3.1.5/schema/core/status_response.json +1 -1
  31. data/schemas/core_3.1.5/schema/core/status_update.json +1 -1
  32. data/schemas/core_3.1.5/spec/core/alarm_issue_spec.rb +299 -0
  33. data/schemas/core_3.1.5/spec/core/alarm_resume_spec.rb +93 -0
  34. data/schemas/core_3.1.5/spec/core/alarm_resumed_spec.rb +277 -0
  35. data/schemas/core_3.1.5/spec/core/alarm_suspend_spec.rb +93 -0
  36. data/schemas/core_3.1.5/spec/core/alarm_suspended_spec.rb +277 -0
  37. data/schemas/core_3.1.5/spec/core/version_spec.rb +3 -2
  38. data/schemas/tlc_1.0.15/Gemfile.lock +17 -17
  39. data/schemas/tlc_1.0.15/README.md +7 -0
  40. data/schemas/tlc_1.0.15/schema/tlc/alarms/A0001.json +1 -1
  41. data/schemas/tlc_1.0.15/schema/tlc/alarms/A0002.json +1 -1
  42. data/schemas/tlc_1.0.15/schema/tlc/alarms/A0003.json +1 -1
  43. data/schemas/tlc_1.0.15/schema/tlc/alarms/A0004.json +1 -1
  44. data/schemas/tlc_1.0.15/schema/tlc/alarms/A0005.json +1 -1
  45. data/schemas/tlc_1.0.15/schema/tlc/alarms/A0006.json +1 -1
  46. data/schemas/tlc_1.0.15/schema/tlc/alarms/A0007.json +1 -1
  47. data/schemas/tlc_1.0.15/schema/tlc/alarms/A0008.json +1 -1
  48. data/schemas/tlc_1.0.15/schema/tlc/alarms/A0009.json +1 -1
  49. data/schemas/tlc_1.0.15/schema/tlc/alarms/A0010.json +1 -1
  50. data/schemas/tlc_1.0.15/schema/tlc/alarms/A0101.json +1 -1
  51. data/schemas/tlc_1.0.15/schema/tlc/alarms/A0201.json +1 -1
  52. data/schemas/tlc_1.0.15/schema/tlc/alarms/A0202.json +1 -1
  53. data/schemas/tlc_1.0.15/schema/tlc/alarms/A0301.json +1 -1
  54. data/schemas/tlc_1.0.15/schema/tlc/alarms/A0302.json +1 -1
  55. data/schemas/tlc_1.0.15/schema/tlc/commands/M0002.json +1 -1
  56. data/schemas/tlc_1.0.15/schema/tlc/commands/M0003.json +1 -1
  57. data/schemas/tlc_1.0.15/schema/tlc/commands/M0004.json +1 -1
  58. data/schemas/tlc_1.0.15/schema/tlc/commands/M0005.json +1 -1
  59. data/schemas/tlc_1.0.15/schema/tlc/commands/M0006.json +1 -1
  60. data/schemas/tlc_1.0.15/schema/tlc/commands/M0007.json +1 -1
  61. data/schemas/tlc_1.0.15/schema/tlc/commands/M0008.json +1 -1
  62. data/schemas/tlc_1.0.15/schema/tlc/commands/M0010.json +1 -1
  63. data/schemas/tlc_1.0.15/schema/tlc/commands/M0011.json +1 -1
  64. data/schemas/tlc_1.0.15/schema/tlc/commands/M0012.json +1 -1
  65. data/schemas/tlc_1.0.15/schema/tlc/commands/M0013.json +1 -1
  66. data/schemas/tlc_1.0.15/schema/tlc/commands/M0014.json +1 -1
  67. data/schemas/tlc_1.0.15/schema/tlc/commands/M0015.json +1 -1
  68. data/schemas/tlc_1.0.15/schema/tlc/commands/M0016.json +1 -1
  69. data/schemas/tlc_1.0.15/schema/tlc/commands/M0017.json +1 -1
  70. data/schemas/tlc_1.0.15/schema/tlc/commands/M0018.json +1 -1
  71. data/schemas/tlc_1.0.15/schema/tlc/commands/M0019.json +1 -1
  72. data/schemas/tlc_1.0.15/schema/tlc/commands/M0020.json +1 -1
  73. data/schemas/tlc_1.0.15/schema/tlc/commands/M0021.json +1 -1
  74. data/schemas/tlc_1.0.15/schema/tlc/commands/M0103.json +1 -1
  75. data/schemas/tlc_1.0.15/schema/tlc/commands/M0104.json +1 -1
  76. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0001.json +1 -1
  77. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0002.json +1 -1
  78. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0003.json +1 -1
  79. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0004.json +1 -1
  80. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0005.json +1 -1
  81. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0006.json +1 -1
  82. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0007.json +1 -1
  83. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0008.json +1 -1
  84. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0009.json +1 -1
  85. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0010.json +1 -1
  86. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0011.json +1 -1
  87. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0012.json +1 -1
  88. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0013.json +1 -1
  89. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0014.json +1 -1
  90. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0015.json +1 -1
  91. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0016.json +1 -1
  92. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0017.json +1 -1
  93. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0018.json +1 -1
  94. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0019.json +1 -1
  95. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0020.json +1 -1
  96. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0021.json +1 -1
  97. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0022.json +1 -1
  98. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0023.json +1 -1
  99. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0024.json +1 -1
  100. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0025.json +1 -1
  101. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0026.json +1 -1
  102. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0027.json +1 -1
  103. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0028.json +2 -2
  104. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0029.json +1 -1
  105. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0030.json +1 -1
  106. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0031.json +1 -1
  107. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0091.json +1 -1
  108. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0092.json +1 -1
  109. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0095.json +1 -1
  110. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0096.json +1 -1
  111. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0097.json +1 -1
  112. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0098.json +2 -2
  113. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0201.json +1 -1
  114. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0202.json +2 -2
  115. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0203.json +2 -2
  116. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0204.json +2 -2
  117. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0205.json +3 -3
  118. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0206.json +3 -3
  119. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0207.json +3 -3
  120. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0208.json +11 -11
  121. data/schemas/tlc_1.0.15/schema/tlc/sxl.yaml +1655 -0
  122. metadata +20 -105
  123. data/schemas/core_3.1.2/examples/validate.rb +0 -35
  124. data/schemas/core_3.1.3/examples/validate.rb +0 -32
  125. data/schemas/core_3.1.3/schema/core/aggregated_status_request.json +0 -9
  126. data/schemas/core_3.1.3/schema/tlc/alarms/A0001.json +0 -7
  127. data/schemas/core_3.1.3/schema/tlc/alarms/A0002.json +0 -7
  128. data/schemas/core_3.1.3/schema/tlc/alarms/A0003.json +0 -7
  129. data/schemas/core_3.1.3/schema/tlc/alarms/A0004.json +0 -7
  130. data/schemas/core_3.1.3/schema/tlc/alarms/A0005.json +0 -7
  131. data/schemas/core_3.1.3/schema/tlc/alarms/A0006.json +0 -7
  132. data/schemas/core_3.1.3/schema/tlc/alarms/A0007.json +0 -7
  133. data/schemas/core_3.1.3/schema/tlc/alarms/A0008.json +0 -19
  134. data/schemas/core_3.1.3/schema/tlc/alarms/A0009.json +0 -7
  135. data/schemas/core_3.1.3/schema/tlc/alarms/A0101.json +0 -7
  136. data/schemas/core_3.1.3/schema/tlc/alarms/A0201.json +0 -20
  137. data/schemas/core_3.1.3/schema/tlc/alarms/A0202.json +0 -20
  138. data/schemas/core_3.1.3/schema/tlc/alarms/A0301.json +0 -49
  139. data/schemas/core_3.1.3/schema/tlc/alarms/A0302.json +0 -59
  140. data/schemas/core_3.1.3/schema/tlc/alarms/alarms.json +0 -68
  141. data/schemas/core_3.1.3/schema/tlc/commands/M0001.json +0 -48
  142. data/schemas/core_3.1.3/schema/tlc/commands/M0002.json +0 -39
  143. data/schemas/core_3.1.3/schema/tlc/commands/M0003.json +0 -39
  144. data/schemas/core_3.1.3/schema/tlc/commands/M0004.json +0 -30
  145. data/schemas/core_3.1.3/schema/tlc/commands/M0005.json +0 -39
  146. data/schemas/core_3.1.3/schema/tlc/commands/M0006.json +0 -39
  147. data/schemas/core_3.1.3/schema/tlc/commands/M0007.json +0 -30
  148. data/schemas/core_3.1.3/schema/tlc/commands/M0008.json +0 -40
  149. data/schemas/core_3.1.3/schema/tlc/commands/M0010.json +0 -30
  150. data/schemas/core_3.1.3/schema/tlc/commands/M0011.json +0 -30
  151. data/schemas/core_3.1.3/schema/tlc/commands/M0012.json +0 -29
  152. data/schemas/core_3.1.3/schema/tlc/commands/M0013.json +0 -1
  153. data/schemas/core_3.1.3/schema/tlc/commands/M0014.json +0 -38
  154. data/schemas/core_3.1.3/schema/tlc/commands/M0015.json +0 -38
  155. data/schemas/core_3.1.3/schema/tlc/commands/M0016.json +0 -29
  156. data/schemas/core_3.1.3/schema/tlc/commands/M0017.json +0 -29
  157. data/schemas/core_3.1.3/schema/tlc/commands/M0018.json +0 -38
  158. data/schemas/core_3.1.3/schema/tlc/commands/M0019.json +0 -49
  159. data/schemas/core_3.1.3/schema/tlc/commands/M0020.json +0 -49
  160. data/schemas/core_3.1.3/schema/tlc/commands/M0021.json +0 -1
  161. data/schemas/core_3.1.3/schema/tlc/commands/M0103.json +0 -39
  162. data/schemas/core_3.1.3/schema/tlc/commands/M0104.json +0 -1
  163. data/schemas/core_3.1.3/schema/tlc/commands/command_requests.json +0 -7
  164. data/schemas/core_3.1.3/schema/tlc/commands/command_responses.json +0 -7
  165. data/schemas/core_3.1.3/schema/tlc/commands/commands.json +0 -97
  166. data/schemas/core_3.1.3/schema/tlc/statuses/S0001.json +0 -45
  167. data/schemas/core_3.1.3/schema/tlc/statuses/S0002.json +0 -17
  168. data/schemas/core_3.1.3/schema/tlc/statuses/S0003.json +0 -26
  169. data/schemas/core_3.1.3/schema/tlc/statuses/S0004.json +0 -26
  170. data/schemas/core_3.1.3/schema/tlc/statuses/S0005.json +0 -18
  171. data/schemas/core_3.1.3/schema/tlc/statuses/S0006.json +0 -27
  172. data/schemas/core_3.1.3/schema/tlc/statuses/S0007.json +0 -26
  173. data/schemas/core_3.1.3/schema/tlc/statuses/S0008.json +0 -26
  174. data/schemas/core_3.1.3/schema/tlc/statuses/S0009.json +0 -26
  175. data/schemas/core_3.1.3/schema/tlc/statuses/S0010.json +0 -26
  176. data/schemas/core_3.1.3/schema/tlc/statuses/S0011.json +0 -26
  177. data/schemas/core_3.1.3/schema/tlc/statuses/S0012.json +0 -26
  178. data/schemas/core_3.1.3/schema/tlc/statuses/S0013.json +0 -27
  179. data/schemas/core_3.1.3/schema/tlc/statuses/S0014.json +0 -17
  180. data/schemas/core_3.1.3/schema/tlc/statuses/S0015.json +0 -17
  181. data/schemas/core_3.1.3/schema/tlc/statuses/S0016.json +0 -17
  182. data/schemas/core_3.1.3/schema/tlc/statuses/S0017.json +0 -17
  183. data/schemas/core_3.1.3/schema/tlc/statuses/S0018.json +0 -17
  184. data/schemas/core_3.1.3/schema/tlc/statuses/S0019.json +0 -17
  185. data/schemas/core_3.1.3/schema/tlc/statuses/S0020.json +0 -27
  186. data/schemas/core_3.1.3/schema/tlc/statuses/S0021.json +0 -18
  187. data/schemas/core_3.1.3/schema/tlc/statuses/S0022.json +0 -17
  188. data/schemas/core_3.1.3/schema/tlc/statuses/S0023.json +0 -18
  189. data/schemas/core_3.1.3/schema/tlc/statuses/S0024.json +0 -18
  190. data/schemas/core_3.1.3/schema/tlc/statuses/S0025.json +0 -80
  191. data/schemas/core_3.1.3/schema/tlc/statuses/S0026.json +0 -18
  192. data/schemas/core_3.1.3/schema/tlc/statuses/S0027.json +0 -18
  193. data/schemas/core_3.1.3/schema/tlc/statuses/S0028.json +0 -18
  194. data/schemas/core_3.1.3/schema/tlc/statuses/S0029.json +0 -17
  195. data/schemas/core_3.1.3/schema/tlc/statuses/S0030.json +0 -1
  196. data/schemas/core_3.1.3/schema/tlc/statuses/S0031.json +0 -1
  197. data/schemas/core_3.1.3/schema/tlc/statuses/S0091.json +0 -27
  198. data/schemas/core_3.1.3/schema/tlc/statuses/S0092.json +0 -27
  199. data/schemas/core_3.1.3/schema/tlc/statuses/S0095.json +0 -17
  200. data/schemas/core_3.1.3/schema/tlc/statuses/S0096.json +0 -68
  201. data/schemas/core_3.1.3/schema/tlc/statuses/S0097.json +0 -26
  202. data/schemas/core_3.1.3/schema/tlc/statuses/S0201.json +0 -26
  203. data/schemas/core_3.1.3/schema/tlc/statuses/S0202.json +0 -26
  204. data/schemas/core_3.1.3/schema/tlc/statuses/S0203.json +0 -26
  205. data/schemas/core_3.1.3/schema/tlc/statuses/S0204.json +0 -98
  206. data/schemas/core_3.1.3/schema/tlc/statuses/S0205.json +0 -26
  207. data/schemas/core_3.1.3/schema/tlc/statuses/S0206.json +0 -26
  208. data/schemas/core_3.1.3/schema/tlc/statuses/S0207.json +0 -26
  209. data/schemas/core_3.1.3/schema/tlc/statuses/S0208.json +0 -98
  210. data/schemas/core_3.1.3/schema/tlc/statuses/statuses.json +0 -181
  211. data/schemas/core_3.1.3/schema/tlc/sxl.json +0 -24
  212. data/schemas/core_3.1.3/spec/tlc/M0001_spec.rb +0 -67
  213. data/schemas/core_3.1.3/spec/tlc/S0007_spec.rb +0 -233
  214. data/schemas/core_3.1.4/examples/validate.rb +0 -35
  215. data/schemas/core_3.1.4/spec/core/alarm_request_spec.rb +0 -72
  216. data/schemas/core_3.1.5/examples/validate.rb +0 -35
  217. data/schemas/core_3.1.5/spec/core/alarm_request_spec.rb +0 -72
  218. data/schemas/core_3.1.5/spec/core/alarm_spec.rb +0 -298
@@ -9,22 +9,26 @@
9
9
  "aSp" : {
10
10
  "description" : "Alarm message variant",
11
11
  "type" : "string",
12
- "enum" : [ "Issue", "Acknowledge", "Suspend", "Resume" ]
12
+ "enum" : [ "Issue", "Acknowledge", "Suspend", "Resume",
13
+ "issue", "acknowledge", "suspend", "resume" ]
13
14
  },
14
15
  "ack" : {
15
16
  "description" : "Acknowledgement",
16
17
  "type" : "string",
17
- "enum" : [ "Acknowledged", "notAcknowledged" ]
18
+ "enum" : [ "Acknowledged", "notAcknowledged",
19
+ "acknowledged", "NotAcknowledged" ]
18
20
  },
19
21
  "aS" : {
20
22
  "description" : "Status",
21
23
  "type" : "string",
22
- "enum" : [ "inActive", "Active" ]
24
+ "enum" : [ "inActive", "Active",
25
+ "InActive", "active" ]
23
26
  },
24
27
  "sS" : {
25
28
  "description" : "Suspended",
26
29
  "type" : "string",
27
- "enum" : [ "suspended", "notSuspended" ]
30
+ "enum" : [ "suspended", "notSuspended",
31
+ "Suspended", "NotSuspended" ]
28
32
  },
29
33
  "aTs" : { "$ref": "definitions.json#/timestamp" },
30
34
  "cat" : {
@@ -89,6 +89,21 @@ RSpec.describe "Traffic Light Controller RSMP SXL Schema validation" do
89
89
  ])
90
90
  end
91
91
 
92
+ it 'accept states with first letter in lowercase' do
93
+ invalid = message.dup
94
+ invalid['aSp'] = "issue"
95
+ expect( validate(invalid) ).to be_nil
96
+
97
+ invalid['aSp'] = "acknowledge"
98
+ expect( validate(invalid) ).to be_nil
99
+
100
+ invalid['aSp'] = "suspend"
101
+ expect( validate(invalid) ).to be_nil
102
+
103
+ invalid['aSp'] = "resume"
104
+ expect( validate(invalid) ).to be_nil
105
+ end
106
+
92
107
  it 'catches wrong state type' do
93
108
  invalid = message.dup
94
109
  invalid['aSp'] = 123
@@ -10,9 +10,10 @@ RSpec.describe "Traffic Light Controller RSMP SXL Schema validation" do
10
10
  { "vers" => "3.1.1" },
11
11
  { "vers" => "3.1.2" },
12
12
  { "vers" => "3.1.3" },
13
- { "vers" => "3.1.4" }
13
+ { "vers" => "3.1.4" },
14
+ { "vers" => "3.1.5" }
14
15
  ],
15
- "SXL" => "1.1"
16
+ "SXL" => "1.0.15"
16
17
  }}
17
18
 
18
19
  it 'accepts valid message' do
@@ -0,0 +1 @@
1
+ .DS_Store
@@ -7,49 +7,48 @@
7
7
  "aCId" : { "$ref": "definitions.json#/alarm_code" },
8
8
  "xACId" : { "description" : "External alarm code id", "type" : "string" },
9
9
  "aSp" : {
10
- "description" : "Alarm message variant",
10
+ "description" : "Alarm specialization",
11
11
  "type" : "string",
12
- "enum" : [ "Issue", "Acknowledge", "Suspend", "Resume", "Request" ]
13
- },
14
- "ack" : {
15
- "description" : "Acknowledgement",
16
- "type" : "string",
17
- "enum" : [ "Acknowledged", "notAcknowledged" ]
18
- },
19
- "aS" : {
20
- "description" : "Status",
21
- "type" : "string",
22
- "enum" : [ "inActive", "Active" ]
23
- },
24
- "sS" : {
25
- "description" : "Suspended",
26
- "type" : "string",
27
- "enum" : [ "suspended", "notSuspended" ]
28
- },
29
- "aTs" : { "$ref": "definitions.json#/timestamp" },
30
- "cat" : {
31
- "description" : "Category",
32
- "type" : "string",
33
- "enum" : [ "T", "D" ]
12
+ "enum" : [ "Issue", "Acknowledge", "Suspend", "Resume", "Request",
13
+ "issue", "acknowledge", "suspend", "resume", "request" ]
14
+ }
15
+ },
16
+ "required" : [ "aSp"],
17
+ "allOf" : [
18
+ {
19
+ "if": {
20
+ "required" : [ "aSp" ],
21
+ "properties" : { "aSp" : { "const" : "Issue" } }
22
+ },
23
+ "then": { "$ref": "alarm_issue.json" }
34
24
  },
35
- "pri" : {
36
- "description" : "Priority",
37
- "type" : "string",
38
- "enum" : [ "1", "2", "3" ]
25
+ {
26
+ "if": {
27
+ "allOf" : [
28
+ {
29
+ "required" : [ "aSp" ],
30
+ "properties" : {
31
+ "aSp" : { "enum" : [ "Suspend","Resume",
32
+ "suspend", "resume"] }
33
+ }
34
+ },
35
+ {
36
+ "not": { "required" : [ "sS" ] }
37
+ }
38
+ ]
39
+ },
40
+ "then": { "$ref": "alarm_suspend_resume.json" }
39
41
  },
40
- "rvs" : {
41
- "description" : "Return values",
42
- "type" : "array",
43
- "items" : {
44
- "type" : "object",
45
- "properties": {
46
- "n" : { "description" : "Unique reference of the value", "type" : "string" },
47
- "v" : { "description" : "Value", "type" : "string" }
48
- },
49
- "required" : [ "n", "v" ],
50
- "additionProperties": false
51
- }
42
+ {
43
+ "if": {
44
+ "required" : [ "aSp", "sS" ],
45
+ "properties" : {
46
+ "aSp" : { "const" : "Suspend" },
47
+ "sS" : { "enum" : [ "suspended", "notSuspended",
48
+ "Suspended", "NotSuspended" ] }
49
+ }
50
+ },
51
+ "then": { "$ref": "alarm_suspended_resumed.json" }
52
52
  }
53
- },
54
- "required" : [ "mId", "cId", "aCId", "xACId", "aSp", "ack", "aS", "aTs", "sS", "cat", "pri", "rvs" ]
53
+ ]
55
54
  }
@@ -0,0 +1,44 @@
1
+ {
2
+ "properties" : {
3
+ "ack" : {
4
+ "description" : "Acknowledgement",
5
+ "type" : "string",
6
+ "enum" : [ "Acknowledged", "notAcknowledged" ]
7
+ },
8
+ "aS" : {
9
+ "description" : "Active status",
10
+ "type" : "string",
11
+ "enum" : [ "inActive", "Active" ]
12
+ },
13
+ "sS" : {
14
+ "description" : "Suspend status",
15
+ "type" : "string",
16
+ "enum" : [ "suspended", "notSuspended" ]
17
+ },
18
+ "aTs" : { "$ref": "definitions.json#/timestamp" },
19
+ "cat" : {
20
+ "description" : "Category",
21
+ "type" : "string",
22
+ "enum" : [ "T", "D" ]
23
+ },
24
+ "pri" : {
25
+ "description" : "Priority",
26
+ "type" : "string",
27
+ "enum" : [ "1", "2", "3" ]
28
+ },
29
+ "rvs" : {
30
+ "description" : "Return values",
31
+ "type" : "array",
32
+ "items" : {
33
+ "type" : "object",
34
+ "properties": {
35
+ "n" : { "description" : "Unique reference of the value", "type" : "string" },
36
+ "v" : { "description" : "Value", "type" : "string" }
37
+ },
38
+ "required" : [ "n", "v" ],
39
+ "additionalProperties": false
40
+ }
41
+ }
42
+ },
43
+ "required" : [ "mId", "cId", "aCId", "xACId", "aSp", "ack", "aS", "aTs", "sS", "cat", "pri", "rvs" ]
44
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "required" : [ "mId", "cId", "aCId", "xACId", "aSp" ]
3
+ }
@@ -0,0 +1,47 @@
1
+ {
2
+ "properties" : {
3
+ "ack" : {
4
+ "description" : "Acknowledgement",
5
+ "type" : "string",
6
+ "enum" : [ "Acknowledged", "notAcknowledged",
7
+ "acknowledged", "NotAcknowledged" ]
8
+ },
9
+ "aS" : {
10
+ "description" : "Active status",
11
+ "type" : "string",
12
+ "enum" : [ "inActive", "Active",
13
+ "InActive", "active" ]
14
+ },
15
+ "sS" : {
16
+ "description" : "Suspend status",
17
+ "type" : "string",
18
+ "enum" : [ "suspended", "notSuspended",
19
+ "Suspended", "NotSuspended" ]
20
+ },
21
+ "aTs" : { "$ref": "definitions.json#/timestamp" },
22
+ "cat" : {
23
+ "description" : "Category",
24
+ "type" : "string",
25
+ "enum" : [ "T", "D" ]
26
+ },
27
+ "pri" : {
28
+ "description" : "Priority",
29
+ "type" : "string",
30
+ "enum" : [ "1", "2", "3" ]
31
+ },
32
+ "rvs" : {
33
+ "description" : "Return values",
34
+ "type" : "array",
35
+ "items" : {
36
+ "type" : "object",
37
+ "properties": {
38
+ "n" : { "description" : "Unique reference of the value", "type" : "string" },
39
+ "v" : { "description" : "Value", "type" : "string" }
40
+ },
41
+ "required" : [ "n", "v" ],
42
+ "additionalProperties": false
43
+ }
44
+ }
45
+ },
46
+ "required" : [ "mId", "cId", "aCId", "xACId", "aSp", "ack", "aS", "aTs", "sS", "cat", "pri", "rvs" ]
47
+ }
@@ -26,7 +26,7 @@
26
26
  }
27
27
  },
28
28
  "required" : [ "cCI", "n", "v", "age" ],
29
- "additionProperties": false
29
+ "additionalProperties": false
30
30
  }
31
31
  }
32
32
  },
@@ -22,7 +22,7 @@
22
22
  }
23
23
  },
24
24
  "required" : [ "sCI", "n", "s", "q" ],
25
- "additionProperties": false
25
+ "additionalProperties": false
26
26
  }
27
27
  }
28
28
  },
@@ -22,7 +22,7 @@
22
22
  }
23
23
  },
24
24
  "required" : [ "sCI", "n", "s", "q" ],
25
- "additionProperties": false
25
+ "additionalProperties": false
26
26
  }
27
27
  }
28
28
  },
@@ -0,0 +1,299 @@
1
+ RSpec.describe "Traffic Light Controller RSMP SXL Schema validation" do
2
+ describe 'Alarm Issue' do
3
+ let(:message) {{
4
+ "mType" => "rSMsg",
5
+ "type" => "Alarm",
6
+ "mId" => "E68A0010-C336-41ac-BD58-5C80A72C7092",
7
+ "cId" => "AB+84001=860SG001",
8
+ "aCId" => "A0001",
9
+ "xACId" => "Serious lamp error",
10
+ "aSp" => "Issue",
11
+ "ack" => "notAcknowledged",
12
+ "aS" => "Active",
13
+ "sS" => "notSuspended",
14
+ "aTs" => "2009-10-01T11:59:31.571Z",
15
+ "cat" => "D",
16
+ "pri" => "2",
17
+ "rvs" => [
18
+ {
19
+ "n" => "color",
20
+ "v" => "red"
21
+ }
22
+ ]
23
+ }}
24
+
25
+ it 'accepts valid alarm' do
26
+ expect( validate(message) ).to be_nil
27
+ end
28
+
29
+ it 'catches missing component id' do
30
+ invalid = message.dup
31
+ invalid.delete 'cId'
32
+ expect( validate(invalid) ).to eq([
33
+ ["", "required", {"missing_keys"=>["cId"]}]
34
+ ])
35
+ end
36
+
37
+ it 'catches missing alarm code id' do
38
+ invalid = message.dup
39
+ invalid.delete 'aCId'
40
+ expect( validate(invalid) ).to eq([
41
+ ["", "required", {"missing_keys"=>["aCId"]}]
42
+ ])
43
+ end
44
+
45
+ it 'catches bad alarm code id' do
46
+ invalid = message.dup
47
+ invalid['aCId'] = "001"
48
+ expect( validate(invalid) ).to eq([
49
+ ["/aCId", "pattern"]
50
+ ])
51
+ end
52
+
53
+ it 'catches wrong alarm code id type' do
54
+ invalid = message.dup
55
+ invalid['aCId'] = 123
56
+ expect( validate(invalid) ).to eq([
57
+ ["/aCId", "string"]
58
+ ])
59
+ end
60
+
61
+ it 'catches missing extended alarm code id' do
62
+ invalid = message.dup
63
+ invalid.delete 'xACId'
64
+ expect( validate(invalid) ).to eq([
65
+ ["", "required", {"missing_keys"=>["xACId"]}]
66
+ ])
67
+ end
68
+
69
+ it 'catches wrong extended alarm code id type' do
70
+ invalid = message.dup
71
+ invalid['xACId'] = 123
72
+ expect( validate(invalid) ).to eq([
73
+ ["/xACId", "string"]
74
+ ])
75
+ end
76
+
77
+ it 'catches missing specialization' do
78
+ invalid = message.dup
79
+ invalid.delete 'aSp'
80
+ expect( validate(invalid) ).to eq([
81
+ ["", "required", {"missing_keys"=>["aSp"]}]
82
+ ])
83
+ end
84
+
85
+ it 'catches bad specialization' do
86
+ invalid = message.dup
87
+ invalid['aSp'] = "Bad"
88
+ expect( validate(invalid) ).to eq([
89
+ ["/aSp", "enum"]
90
+ ])
91
+ end
92
+
93
+ it 'catches wrong specialization type' do
94
+ invalid = message.dup
95
+ invalid['aSp'] = 123
96
+ expect( validate(invalid) ).to eq([
97
+ ["/aSp", "enum"],
98
+ ["/aSp", "string"]
99
+ ])
100
+ end
101
+
102
+ it 'catches missing alarm active status' do
103
+ invalid = message.dup
104
+ invalid.delete 'aS'
105
+ expect( validate(invalid) ).to eq([
106
+ ["", "required", {"missing_keys"=>["aS"]}]
107
+ ])
108
+ end
109
+
110
+ it 'catches bad alarm active status' do
111
+ invalid = message.dup
112
+ invalid['aS'] = "Bad"
113
+ expect( validate(invalid) ).to eq([
114
+ ["/aS", "enum"]
115
+ ])
116
+ end
117
+
118
+ it 'catches wrong alarm active status' do
119
+ invalid = message.dup
120
+ invalid['aS'] = 123
121
+ expect( validate(invalid) ).to eq([
122
+ ["/aS", "enum"],
123
+ ["/aS", "string"]
124
+ ])
125
+ end
126
+
127
+ it 'catches missing alarm suspend status' do
128
+ invalid = message.dup
129
+ invalid.delete 'sS'
130
+ expect( validate(invalid) ).to eq([
131
+ ["", "required", {"missing_keys"=>["sS"]}]
132
+ ])
133
+ end
134
+
135
+ it 'catches bad alarm code id' do
136
+ invalid = message.dup
137
+ invalid['sS'] = "Bad"
138
+ expect( validate(invalid) ).to eq([
139
+ ["/sS", "enum"]
140
+ ])
141
+ end
142
+
143
+ it 'catches wrong alarm code id type' do
144
+ invalid = message.dup
145
+ invalid['sS'] = 123
146
+ expect( validate(invalid) ).to eq([
147
+ ["/sS", "enum"],
148
+ ["/sS", "string"]
149
+ ])
150
+ end
151
+
152
+ it 'catches missing alarm code id' do
153
+ invalid = message.dup
154
+ invalid.delete 'ack'
155
+ expect( validate(invalid) ).to eq([
156
+ ["", "required", {"missing_keys"=>["ack"]}]
157
+ ])
158
+ end
159
+
160
+ it 'catches bad alarm code id' do
161
+ invalid = message.dup
162
+ invalid['ack'] = "Bad"
163
+ expect( validate(invalid) ).to eq([
164
+ ["/ack", "enum"]
165
+ ])
166
+ end
167
+
168
+ it 'catches wrong alarm code id type' do
169
+ invalid = message.dup
170
+ invalid['ack'] = 123
171
+ expect( validate(invalid) ).to eq([
172
+ ["/ack", "enum"],
173
+ ["/ack", "string"]
174
+ ])
175
+ end
176
+
177
+ it 'catches missing category' do
178
+ invalid = message.dup
179
+ invalid.delete 'cat'
180
+ expect( validate(invalid) ).to eq([
181
+ ["", "required", {"missing_keys"=>["cat"]}]
182
+ ])
183
+ end
184
+
185
+ it 'catches bad category' do
186
+ invalid = message.dup
187
+ invalid['cat'] = "A"
188
+ expect( validate(invalid) ).to eq([
189
+ ["/cat", "enum"]
190
+ ])
191
+ end
192
+
193
+ it 'catches wrong category' do
194
+ invalid = message.dup
195
+ invalid['cat'] = 123
196
+ expect( validate(invalid) ).to eq([
197
+ ["/cat", "enum"],
198
+ ["/cat", "string"]
199
+ ])
200
+ end
201
+
202
+ it 'catches missing priority' do
203
+ invalid = message.dup
204
+ invalid.delete 'pri'
205
+ expect( validate(invalid) ).to eq([
206
+ ["", "required", {"missing_keys"=>["pri"]}]
207
+ ])
208
+ end
209
+
210
+ it 'catches bad priority' do
211
+ invalid = message.dup
212
+ invalid['pri'] = "4"
213
+ expect( validate(invalid) ).to eq([
214
+ ["/pri", "enum"]
215
+ ])
216
+ end
217
+
218
+ it 'catches wrong priority' do
219
+ invalid = message.dup
220
+ invalid['pri'] = 1
221
+ expect( validate(invalid) ).to eq([
222
+ ["/pri", "enum"],
223
+ ["/pri", "string"]
224
+ ])
225
+ end
226
+
227
+ it 'catches missing timestamp' do
228
+ invalid = message.dup
229
+ invalid.delete 'aTs'
230
+ expect( validate(invalid) ).to eq([
231
+ ["", "required", {"missing_keys"=>["aTs"]}]
232
+ ])
233
+ end
234
+
235
+ it 'catches bad timestamp' do
236
+ invalid = message.dup
237
+ invalid['aTs'] = "yesterday"
238
+ expect( validate(invalid) ).to eq([
239
+ ["/aTs", "pattern"]
240
+ ])
241
+ end
242
+
243
+ it 'catches wrong timestamp type' do
244
+ invalid = message.dup
245
+ invalid['aTs'] = 123
246
+ expect( validate(invalid) ).to eq([
247
+ ["/aTs", "string"]
248
+ ])
249
+ end
250
+
251
+ it 'catches missing rvs' do
252
+ invalid = message.dup
253
+ invalid.delete 'rvs'
254
+ expect( validate(invalid) ).to eq([
255
+ ["", "required", {"missing_keys"=>["rvs"]}]
256
+ ])
257
+ end
258
+
259
+ it 'catches bad rvs type' do
260
+ invalid = message.dup
261
+ invalid["rvs"] = {}
262
+ expect( validate(invalid) ).to eq([
263
+ ["/rvs", "array"]
264
+ ])
265
+ end
266
+
267
+ it 'catches missing alarm name' do
268
+ invalid = message.dup
269
+ invalid["rvs"].first.delete 'n'
270
+ expect( validate(invalid) ).to eq([
271
+ ["/rvs/0", "required", {"missing_keys"=>["n"]}]
272
+ ])
273
+ end
274
+
275
+ it 'catches bad alarm name' do
276
+ invalid = message.dup
277
+ invalid["rvs"].first['n'] = 3
278
+ expect( validate(invalid) ).to eq([
279
+ ["/rvs/0/n", "string"]
280
+ ])
281
+ end
282
+
283
+ it 'catches missing alarm value' do
284
+ invalid = message.dup
285
+ invalid["rvs"].first.delete 'v'
286
+ expect( validate(invalid) ).to eq([
287
+ ["/rvs/0", "required", {"missing_keys"=>["v"]}]
288
+ ])
289
+ end
290
+
291
+ it 'catches bad alarm value' do
292
+ invalid = message.dup
293
+ invalid["rvs"].first['v'] = 3
294
+ expect( validate(invalid) ).to eq([
295
+ ["/rvs/0/v", "string"]
296
+ ])
297
+ end
298
+ end
299
+ end
@@ -0,0 +1,93 @@
1
+ RSpec.describe "Traffic Light Controller RSMP SXL Schema validation" do
2
+ describe 'Alarm Resume' do
3
+ let(:message) {{
4
+ "mType" => "rSMsg",
5
+ "type" => "Alarm",
6
+ "mId" => "2a744145-403a-423f-ba80-f38e283a778e",
7
+ "ntsOId" => "",
8
+ "xNId" => "",
9
+ "cId" => "AB+84001=860VA001",
10
+ "aCId" => "A0004",
11
+ "xACId" => "",
12
+ "xNACId" => "",
13
+ "aSp" => "Resume"
14
+ }}
15
+
16
+ it 'accepts valid alarm resume' do
17
+ expect( validate(message) ).to be_nil
18
+ end
19
+
20
+ it 'catches missing component id' do
21
+ invalid = message.dup
22
+ invalid.delete 'cId'
23
+ expect( validate(invalid) ).to eq([
24
+ ["", "required", {"missing_keys"=>["cId"]}]
25
+ ])
26
+ end
27
+
28
+ it 'catches missing alarm code id' do
29
+ invalid = message.dup
30
+ invalid.delete 'aCId'
31
+ expect( validate(invalid) ).to eq([
32
+ ["", "required", {"missing_keys"=>["aCId"]}]
33
+ ])
34
+ end
35
+
36
+ it 'catches bad alarm code id' do
37
+ invalid = message.dup
38
+ invalid['aCId'] = "001"
39
+ expect( validate(invalid) ).to eq([
40
+ ["/aCId", "pattern"]
41
+ ])
42
+ end
43
+
44
+ it 'catches wrong alarm code id type' do
45
+ invalid = message.dup
46
+ invalid['aCId'] = 123
47
+ expect( validate(invalid) ).to eq([
48
+ ["/aCId", "string"]
49
+ ])
50
+ end
51
+
52
+ it 'catches missing extended alarm code id' do
53
+ invalid = message.dup
54
+ invalid.delete 'xACId'
55
+ expect( validate(invalid) ).to eq([
56
+ ["", "required", {"missing_keys"=>["xACId"]}]
57
+ ])
58
+ end
59
+
60
+ it 'catches wrong extended alarm code id type' do
61
+ invalid = message.dup
62
+ invalid['xACId'] = 123
63
+ expect( validate(invalid) ).to eq([
64
+ ["/xACId", "string"]
65
+ ])
66
+ end
67
+
68
+ it 'catches missing specialization' do
69
+ invalid = message.dup
70
+ invalid.delete 'aSp'
71
+ expect( validate(invalid) ).to eq([
72
+ ["", "required", {"missing_keys"=>["aSp"]}]
73
+ ])
74
+ end
75
+
76
+ it 'catches bad specialization' do
77
+ invalid = message.dup
78
+ invalid['aSp'] = "Bad"
79
+ expect( validate(invalid) ).to eq([
80
+ ["/aSp", "enum"]
81
+ ])
82
+ end
83
+
84
+ it 'catches wrong specialization type' do
85
+ invalid = message.dup
86
+ invalid['aSp'] = 123
87
+ expect( validate(invalid) ).to eq([
88
+ ["/aSp", "enum"],
89
+ ["/aSp", "string"]
90
+ ])
91
+ end
92
+ end
93
+ end