openc3-cosmos-demo 6.4.1 → 6.4.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 99dfc9c95111d65b7cff1164b91049a4c5c04989926bac169cc4441de7048312
4
- data.tar.gz: 21c72251a85d19f7bfbf38fb29d7893e316561b61d2c03918236b9aa7b9e1d26
3
+ metadata.gz: 5da3d0d0fa2f1bbb7c8491b826a13a285c490f1d93adae335b602a3837794b9b
4
+ data.tar.gz: a0143778734362f48f6348dadc8ce89cb4187f8d23821db4b656818f87359597
5
5
  SHA512:
6
- metadata.gz: 359722f6b8bac84131bd955d7b568226a83ecaaf533806b2c67e0944281bda68f3b06c7fd45cd374a6ea1466dd9a59b3444adfe450f38720a6f9255d3500e38c
7
- data.tar.gz: 4afeb184c2fb105d969b8541c21c2712ac5f99e9d8e26dd4f92c29a8a2237ef71b413199a130a5ce8292ea017fbfb8e7e8318d9818001eacdb3ee07492b68f10
6
+ metadata.gz: 11e1a45db0075ea88e405189748a93038b53d81b862a1b35a538235359e1d285520ef923784d0db35dc1c5cf155fc48d66c657f4635d439f2b6b20fff6862ede
7
+ data.tar.gz: 243c07310933a1848ac8df4fc9528cf8bfe589a20539835e0da578cd1703a7e56b3bcb9a9bbd1c8f3e36d834ee3ab081ee00c9628ed5ec2de6b132c3d62ac042
@@ -0,0 +1,169 @@
1
+ # Get current list of groups
2
+ groups = autonomic_group_list()
3
+ puts "Current groups: #{groups.inspect}"
4
+
5
+ # Create a test group
6
+ group = "API" # Make sure this is alphabetically after DEFAULT
7
+ result = autonomic_group_create(group)
8
+ puts "Group created: #{result.inspect}"
9
+ check_expression("'#{result['name']}' == '#{group}'")
10
+ wait # Allow the playwright spec to see the group
11
+
12
+ # Show the group info
13
+ result = autonomic_group_show(group)
14
+ puts "Group info: #{result.inspect}"
15
+ check_expression("'#{result['name']}' == '#{group}'")
16
+
17
+ # Verify group was added to list
18
+ groups = autonomic_group_list()
19
+ puts "Updated groups: #{groups.inspect}"
20
+ sorted = groups.sort_by { |g| g['name'] }
21
+ check_expression("'#{sorted[0]['name']}' == '#{group}'")
22
+ check_expression("'#{sorted[1]['name']}' == 'DEFAULT'")
23
+
24
+ # TRIGGER METHODS
25
+ # Get current list of triggers
26
+ triggers = autonomic_trigger_list(group: group)
27
+ puts "Current triggers: #{triggers.inspect}"
28
+
29
+ # Create a test trigger
30
+ left = {
31
+ type: "item",
32
+ target: "INST",
33
+ packet: "HEALTH_STATUS",
34
+ item: "TEMP1",
35
+ valueType: "CONVERTED",
36
+ }
37
+ operator = ">"
38
+ right = {
39
+ type: "float",
40
+ float: 0,
41
+ }
42
+
43
+ result = autonomic_trigger_create(left: left, operator: operator, right: right, group: group)
44
+ puts "Trigger created: #{result.inspect}"
45
+ test_trigger = result['name']
46
+ check_expression("'#{result['enabled']}' == 'true'")
47
+ check_expression("'#{result['group']}' == '#{group}'")
48
+ check_expression("'#{result['left']['type']}' == 'item'")
49
+ check_expression("'#{result['left']['target']}' == 'INST'")
50
+ check_expression("'#{result['left']['packet']}' == 'HEALTH_STATUS'")
51
+ check_expression("'#{result['left']['item']}' == 'TEMP1'")
52
+ check_expression("'#{result['left']['valueType']}' == 'CONVERTED'")
53
+ check_expression("'#{result['operator']}' == '>'")
54
+ check_expression("'#{result['right']['type']}' == 'float'")
55
+ check_expression("#{result['right']['float']} == 0")
56
+ wait # Allow the playwright spec to see the trigger
57
+
58
+ # Show the trigger info
59
+ result = autonomic_trigger_show(test_trigger, group: group)
60
+ puts "Trigger info: #{result.inspect}"
61
+ check_expression("'#{result['name']}' == '#{test_trigger}'")
62
+ check_expression("'#{result['enabled']}' == 'true'")
63
+ check_expression("'#{result['group']}' == '#{group}'")
64
+ check_expression("'#{result['left']['type']}' == 'item'")
65
+ check_expression("'#{result['left']['target']}' == 'INST'")
66
+ check_expression("'#{result['left']['packet']}' == 'HEALTH_STATUS'")
67
+ check_expression("'#{result['left']['item']}' == 'TEMP1'")
68
+ check_expression("'#{result['left']['valueType']}' == 'CONVERTED'")
69
+ check_expression("'#{result['operator']}' == '>'")
70
+ check_expression("'#{result['right']['type']}' == 'float'")
71
+ check_expression("#{result['right']['float']} == 0")
72
+
73
+ # Verify trigger was added to list
74
+ triggers = autonomic_trigger_list(group: group)
75
+ puts "Updated triggers: #{triggers.inspect}"
76
+
77
+ # Disable the trigger
78
+ autonomic_trigger_disable(test_trigger, group: group)
79
+ wait # Allow the playwright spec to see the disable
80
+
81
+ # Show the trigger info after disabling
82
+ trigger_info = autonomic_trigger_show(test_trigger, group: group)
83
+ puts "Trigger info after disabling: #{trigger_info.inspect}"
84
+
85
+ # Enable the trigger
86
+ autonomic_trigger_enable(test_trigger, group: group)
87
+ wait # Allow the playwright spec to see the enable
88
+
89
+ # Show the trigger info after enabling
90
+ trigger_info = autonomic_trigger_show(test_trigger, group: group)
91
+ puts "Trigger info after enabling: #{trigger_info.inspect}"
92
+
93
+ # Update the trigger
94
+ operator = "<="
95
+ right = {
96
+ type: "float",
97
+ float: 100,
98
+ }
99
+
100
+ result = autonomic_trigger_update(test_trigger, operator: operator, right: right, group: group)
101
+ puts "Trigger updated: #{result.inspect}"
102
+ wait # Allow the playwright spec to see the update
103
+
104
+ # Show the trigger info after updating
105
+ trigger_info = autonomic_trigger_show(test_trigger, group: group)
106
+ puts "Trigger info after updating: #{trigger_info.inspect}"
107
+
108
+ # REACTION METHODS
109
+ # Get current list of reactions
110
+ reactions = autonomic_reaction_list()
111
+ puts "Current reactions: #{reactions.inspect}"
112
+
113
+ # Create a test reaction
114
+ triggers = [{
115
+ 'name' => test_trigger,
116
+ 'group' => group,
117
+ }]
118
+ actions = [{
119
+ 'type' => 'command',
120
+ 'value' => 'INST ABORT'
121
+ }]
122
+
123
+ result = autonomic_reaction_create(triggers: triggers, actions: actions, trigger_level: 'EDGE', snooze: 0)
124
+ puts "Reaction created: #{result.inspect}"
125
+ test_reaction = result['name']
126
+ wait # Allow the playwright spec to see the reaction
127
+
128
+ # Show the reaction info
129
+ reaction_info = autonomic_reaction_show(test_reaction)
130
+ puts "Reaction info: #{reaction_info.inspect}"
131
+
132
+ # Verify reaction was added to list
133
+ reactions = autonomic_reaction_list()
134
+ puts "Updated reactions: #{reactions.inspect}"
135
+
136
+ # Disable the reaction
137
+ autonomic_reaction_disable(test_reaction)
138
+ wait # Allow the playwright spec to see the disable
139
+
140
+ # Show the reaction info after disabling
141
+ reaction_info = autonomic_reaction_show(test_reaction)
142
+ puts "Reaction info after disabling: #{reaction_info.inspect}"
143
+
144
+ # Enable the reaction
145
+ autonomic_reaction_enable(test_reaction)
146
+ wait # Allow the playwright spec to see the enable
147
+
148
+ # Show the reaction info after enabling
149
+ reaction_info = autonomic_reaction_show(test_reaction)
150
+ puts "Reaction info after enabling: #{reaction_info.inspect}"
151
+
152
+ result = autonomic_reaction_update(test_reaction, trigger_level: 'LEVEL', snooze: 300)
153
+ puts "Reaction updated: #{result.inspect}"
154
+ wait # Allow the playwright spec to see the update
155
+
156
+ # Show the reaction info after updating
157
+ reaction_info = autonomic_reaction_show(test_reaction)
158
+ puts "Reaction info after updating: #{reaction_info.inspect}"
159
+
160
+ # Execute the reaction
161
+ autonomic_reaction_execute(test_reaction)
162
+ wait # Allow the playwright spec to see the execution
163
+
164
+ # CLEANUP
165
+ autonomic_reaction_destroy(test_reaction)
166
+ wait # Allow the playwright spec to see the deletion
167
+ autonomic_trigger_destroy(test_trigger, group: group)
168
+ wait # Allow the playwright spec to see the deletion
169
+ autonomic_group_destroy(group)
@@ -0,0 +1,169 @@
1
+ # Get current list of groups
2
+ groups = autonomic_group_list()
3
+ print(f"Current groups: {groups}")
4
+
5
+ # Create a test group
6
+ group = "API" # Make sure this is alphabetically after DEFAULT
7
+ result = autonomic_group_create(group)
8
+ print(f"Group created: {result}")
9
+ check_expression(f"'{result['name']}' == '{group}'")
10
+ wait() # Allow the playwright spec to see the group
11
+
12
+ # Show the group info
13
+ result = autonomic_group_show(group)
14
+ print(f"Group info: {result}")
15
+ check_expression(f"'{result['name']}' == '{group}'")
16
+
17
+ # Verify group was added to list
18
+ groups = autonomic_group_list()
19
+ print(f"Updated groups: {groups}")
20
+ sorted_groups = sorted(groups, key=lambda g: g['name'])
21
+ check_expression(f"'{sorted_groups[0]['name']}' == '{group}'")
22
+ check_expression(f"'{sorted_groups[1]['name']}' == 'DEFAULT'")
23
+
24
+ # TRIGGER METHODS
25
+ # Get current list of triggers
26
+ triggers = autonomic_trigger_list(group=group)
27
+ print(f"Current triggers: {triggers}")
28
+
29
+ # Create a test trigger
30
+ left = {
31
+ "type": "item",
32
+ "target": "INST",
33
+ "packet": "HEALTH_STATUS",
34
+ "item": "TEMP1",
35
+ "valueType": "CONVERTED",
36
+ }
37
+ operator = ">"
38
+ right = {
39
+ "type": "float",
40
+ "float": 0,
41
+ }
42
+
43
+ result = autonomic_trigger_create(left=left, operator=operator, right=right, group=group)
44
+ print(f"Trigger created: {result}")
45
+ test_trigger = result['name']
46
+ check_expression(f"'{result['enabled']}' == 'True'")
47
+ check_expression(f"'{result['group']}' == '{group}'")
48
+ check_expression(f"'{result['left']['type']}' == 'item'")
49
+ check_expression(f"'{result['left']['target']}' == 'INST'")
50
+ check_expression(f"'{result['left']['packet']}' == 'HEALTH_STATUS'")
51
+ check_expression(f"'{result['left']['item']}' == 'TEMP1'")
52
+ check_expression(f"'{result['left']['valueType']}' == 'CONVERTED'")
53
+ check_expression(f"'{result['operator']}' == '>'")
54
+ check_expression(f"'{result['right']['type']}' == 'float'")
55
+ check_expression(f"{result['right']['float']} == 0")
56
+ wait() # Allow the playwright spec to see the trigger
57
+
58
+ # Show the trigger info
59
+ result = autonomic_trigger_show(test_trigger, group=group)
60
+ print(f"Trigger info: {result}")
61
+ check_expression(f"'{result['name']}' == '{test_trigger}'")
62
+ check_expression(f"'{result['enabled']}' == 'True'")
63
+ check_expression(f"'{result['group']}' == '{group}'")
64
+ check_expression(f"'{result['left']['type']}' == 'item'")
65
+ check_expression(f"'{result['left']['target']}' == 'INST'")
66
+ check_expression(f"'{result['left']['packet']}' == 'HEALTH_STATUS'")
67
+ check_expression(f"'{result['left']['item']}' == 'TEMP1'")
68
+ check_expression(f"'{result['left']['valueType']}' == 'CONVERTED'")
69
+ check_expression(f"'{result['operator']}' == '>'")
70
+ check_expression(f"'{result['right']['type']}' == 'float'")
71
+ check_expression(f"{result['right']['float']} == 0")
72
+
73
+ # Verify trigger was added to list
74
+ triggers = autonomic_trigger_list(group=group)
75
+ print(f"Updated triggers: {triggers}")
76
+
77
+ # Disable the trigger
78
+ autonomic_trigger_disable(test_trigger, group=group)
79
+ wait() # Allow the playwright spec to see the disable
80
+
81
+ # Show the trigger info after disabling
82
+ trigger_info = autonomic_trigger_show(test_trigger, group=group)
83
+ print(f"Trigger info after disabling: {trigger_info}")
84
+
85
+ # Enable the trigger
86
+ autonomic_trigger_enable(test_trigger, group=group)
87
+ wait() # Allow the playwright spec to see the enable
88
+
89
+ # Show the trigger info after enabling
90
+ trigger_info = autonomic_trigger_show(test_trigger, group=group)
91
+ print(f"Trigger info after enabling: {trigger_info}")
92
+
93
+ # Update the trigger
94
+ operator = "<="
95
+ right = {
96
+ "type": "float",
97
+ "float": 100,
98
+ }
99
+
100
+ result = autonomic_trigger_update(test_trigger, operator=operator, right=right, group=group)
101
+ print(f"Trigger updated: {result}")
102
+ wait() # Allow the playwright spec to see the update
103
+
104
+ # Show the trigger info after updating
105
+ trigger_info = autonomic_trigger_show(test_trigger, group=group)
106
+ print(f"Trigger info after updating: {trigger_info}")
107
+
108
+ # REACTION METHODS
109
+ # Get current list of reactions
110
+ reactions = autonomic_reaction_list()
111
+ print(f"Current reactions: {reactions}")
112
+
113
+ # Create a test reaction
114
+ triggers = [{
115
+ 'name': test_trigger,
116
+ 'group': group,
117
+ }]
118
+ actions = [{
119
+ 'type': 'command',
120
+ 'value': 'INST ABORT'
121
+ }]
122
+
123
+ result = autonomic_reaction_create(triggers=triggers, actions=actions, trigger_level='EDGE', snooze=0)
124
+ print(f"Reaction created: {result}")
125
+ test_reaction = result['name']
126
+ wait() # Allow the playwright spec to see the reaction
127
+
128
+ # Show the reaction info
129
+ reaction_info = autonomic_reaction_show(test_reaction)
130
+ print(f"Reaction info: {reaction_info}")
131
+
132
+ # Verify reaction was added to list
133
+ reactions = autonomic_reaction_list()
134
+ print(f"Updated reactions: {reactions}")
135
+
136
+ # Disable the reaction
137
+ autonomic_reaction_disable(test_reaction)
138
+ wait() # Allow the playwright spec to see the disable
139
+
140
+ # Show the reaction info after disabling
141
+ reaction_info = autonomic_reaction_show(test_reaction)
142
+ print(f"Reaction info after disabling: {reaction_info}")
143
+
144
+ # Enable the reaction
145
+ autonomic_reaction_enable(test_reaction)
146
+ wait() # Allow the playwright spec to see the enable
147
+
148
+ # Show the reaction info after enabling
149
+ reaction_info = autonomic_reaction_show(test_reaction)
150
+ print(f"Reaction info after enabling: {reaction_info}")
151
+
152
+ result = autonomic_reaction_update(test_reaction, trigger_level='LEVEL', snooze=300)
153
+ print(f"Reaction updated: {result}")
154
+ wait() # Allow the playwright spec to see the update
155
+
156
+ # Show the reaction info after updating
157
+ reaction_info = autonomic_reaction_show(test_reaction)
158
+ print(f"Reaction info after updating: {reaction_info}")
159
+
160
+ # Execute the reaction
161
+ autonomic_reaction_execute(test_reaction)
162
+ wait() # Allow the playwright spec to see the execution
163
+
164
+ # CLEANUP
165
+ autonomic_reaction_destroy(test_reaction)
166
+ wait() # Allow the playwright spec to see the deletion
167
+ autonomic_trigger_destroy(test_trigger, group=group)
168
+ wait() # Allow the playwright spec to see the deletion
169
+ autonomic_group_destroy(group)