cosmos 5.0.2 → 5.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. checksums.yaml +4 -4
  2. data/bin/cosmos +183 -42
  3. data/data/config/microservice.yaml +47 -35
  4. data/data/config/plugins.yaml +10 -147
  5. data/data/config/target.yaml +70 -0
  6. data/data/config/tool.yaml +37 -31
  7. data/ext/cosmos/ext/cosmos_io/cosmos_io.c +14 -14
  8. data/ext/cosmos/ext/packet/packet.c +3 -3
  9. data/ext/cosmos/ext/structure/structure.c +31 -31
  10. data/lib/cosmos/api/api.rb +1 -25
  11. data/lib/cosmos/api/cmd_api.rb +17 -6
  12. data/lib/cosmos/api/config_api.rb +10 -4
  13. data/lib/cosmos/api/limits_api.rb +1 -1
  14. data/lib/cosmos/api/settings_api.rb +19 -7
  15. data/lib/cosmos/api/target_api.rb +2 -2
  16. data/lib/cosmos/api/tlm_api.rb +65 -41
  17. data/lib/cosmos/config/config_parser.rb +19 -22
  18. data/lib/cosmos/config/meta_config_parser.rb +1 -1
  19. data/lib/cosmos/conversions/generic_conversion.rb +2 -2
  20. data/lib/cosmos/conversions/polynomial_conversion.rb +5 -8
  21. data/lib/cosmos/conversions/segmented_polynomial_conversion.rb +26 -9
  22. data/lib/cosmos/io/json_drb.rb +5 -1
  23. data/lib/cosmos/logs/log_writer.rb +78 -29
  24. data/lib/cosmos/microservices/cleanup_microservice.rb +28 -29
  25. data/lib/cosmos/microservices/decom_microservice.rb +1 -1
  26. data/lib/cosmos/microservices/interface_microservice.rb +0 -16
  27. data/lib/cosmos/microservices/microservice.rb +3 -3
  28. data/lib/cosmos/microservices/reducer_microservice.rb +12 -10
  29. data/lib/cosmos/models/cvt_model.rb +6 -6
  30. data/lib/cosmos/models/gem_model.rb +9 -3
  31. data/lib/cosmos/models/info_model.rb +1 -1
  32. data/lib/cosmos/models/interface_model.rb +16 -7
  33. data/lib/cosmos/models/interface_status_model.rb +1 -1
  34. data/lib/cosmos/models/metadata_model.rb +69 -219
  35. data/lib/cosmos/models/metric_model.rb +2 -2
  36. data/lib/cosmos/models/microservice_model.rb +7 -4
  37. data/lib/cosmos/models/microservice_status_model.rb +1 -1
  38. data/lib/cosmos/models/model.rb +23 -16
  39. data/lib/cosmos/models/note_model.rb +122 -0
  40. data/lib/cosmos/models/ping_model.rb +2 -1
  41. data/lib/cosmos/models/plugin_model.rb +108 -48
  42. data/lib/cosmos/models/process_status_model.rb +1 -1
  43. data/lib/cosmos/models/scope_model.rb +10 -25
  44. data/lib/cosmos/models/settings_model.rb +55 -0
  45. data/lib/cosmos/models/sorted_model.rb +167 -0
  46. data/lib/cosmos/models/target_model.rb +143 -27
  47. data/lib/cosmos/models/tool_config_model.rb +38 -0
  48. data/lib/cosmos/models/tool_model.rb +9 -9
  49. data/lib/cosmos/models/widget_model.rb +11 -11
  50. data/lib/cosmos/operators/microservice_operator.rb +2 -1
  51. data/lib/cosmos/packets/packet.rb +24 -1
  52. data/lib/cosmos/packets/packet_config.rb +2 -2
  53. data/lib/cosmos/packets/packet_item.rb +57 -0
  54. data/lib/cosmos/packets/packet_item_limits.rb +14 -2
  55. data/lib/cosmos/packets/parsers/packet_item_parser.rb +1 -1
  56. data/lib/cosmos/packets/parsers/packet_parser.rb +1 -1
  57. data/lib/cosmos/packets/parsers/xtce_parser.rb +1 -1
  58. data/lib/cosmos/packets/structure.rb +30 -33
  59. data/lib/cosmos/packets/structure_item.rb +10 -1
  60. data/lib/cosmos/script/api_shared.rb +30 -25
  61. data/lib/cosmos/script/calendar.rb +37 -15
  62. data/lib/cosmos/script/commands.rb +5 -7
  63. data/lib/cosmos/script/script.rb +19 -39
  64. data/lib/cosmos/script/storage.rb +92 -105
  65. data/lib/cosmos/system/system.rb +2 -1
  66. data/lib/cosmos/tools/table_manager/table_config.rb +16 -1
  67. data/lib/cosmos/tools/table_manager/table_item.rb +1 -1
  68. data/lib/cosmos/tools/table_manager/table_manager_core.rb +213 -309
  69. data/lib/cosmos/top_level.rb +5 -1
  70. data/lib/cosmos/topics/autonomic_topic.rb +2 -2
  71. data/lib/cosmos/topics/calendar_topic.rb +1 -1
  72. data/lib/cosmos/topics/command_decom_topic.rb +35 -1
  73. data/lib/cosmos/topics/command_topic.rb +6 -4
  74. data/lib/cosmos/topics/config_topic.rb +68 -0
  75. data/lib/cosmos/topics/interface_topic.rb +8 -8
  76. data/lib/cosmos/topics/limits_event_topic.rb +5 -3
  77. data/lib/cosmos/topics/notifications_topic.rb +1 -1
  78. data/lib/cosmos/topics/router_topic.rb +9 -9
  79. data/lib/cosmos/topics/telemetry_decom_topic.rb +5 -1
  80. data/lib/cosmos/topics/telemetry_topic.rb +1 -1
  81. data/lib/cosmos/topics/timeline_topic.rb +1 -1
  82. data/lib/cosmos/topics/topic.rb +23 -8
  83. data/lib/cosmos/utilities/logger.rb +4 -3
  84. data/lib/cosmos/utilities/metric.rb +32 -26
  85. data/lib/cosmos/utilities/s3.rb +61 -0
  86. data/lib/cosmos/utilities/s3_file_cache.rb +12 -6
  87. data/lib/cosmos/utilities/store.rb +1 -0
  88. data/lib/cosmos/utilities/store_autoload.rb +25 -134
  89. data/lib/cosmos/version.rb +5 -4
  90. data/templates/plugin-template/plugin.gemspec +0 -2
  91. metadata +12 -10
  92. data/bin/xtce_converter +0 -92
  93. data/lib/cosmos/models/narrative_model.rb +0 -280
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f94954d88cfda8c83f25e5f9a073360d2cf2f7ca9ec359212d3aa6c1bce5a909
4
- data.tar.gz: ab1f28afba922389b69d3c5527944d9e53d8ceca45ebe25746ef1517a44b54b8
3
+ metadata.gz: 520339a0daade42a51611f9e17fe6e5a2c1343d9bab3ad6b36dbb03f11f55f28
4
+ data.tar.gz: 59a4d41cc6ef453ea1f375c5e9671aa0b14b390da42d8413bd080ab7bdb18ff4
5
5
  SHA512:
6
- metadata.gz: 3b5ed0b4186b705cd0360caabbed8f04daac8eaedf9872b8e22fb147c43a0a748fe98afc1b88a8fc99d15d6bd4b3bb9208c1497bb7732f4ef031b856735c6ea7
7
- data.tar.gz: 9353b73975d3d6c0f84560b388e2d175a70c2cd4d6c03dbe2f92a650368007c6c0b44cb8b114292180284bb1b8cd465e8e680fd4d6da85c125fc6fe853bf7156
6
+ metadata.gz: 700274a130767236a08e76ce223a09fa0229e659153c8a5f50896447796d3ca0e4487423704ece2d655511a642c6dfed0a8fc9482f8ee7ef9681f1726c23a2ce
7
+ data.tar.gz: 20773c2fd54d95674f66252edbd51faee8107cca83c05bace69a4607fd5563dc543d10f670513b4fb2df25d6ca6c18d0e58923f517e66f7f186fe7bc0e1eecbb
data/bin/cosmos CHANGED
@@ -24,6 +24,7 @@ require 'cosmos'
24
24
  require 'cosmos/utilities/s3'
25
25
  require 'cosmos/models/scope_model'
26
26
  require 'cosmos/models/plugin_model'
27
+ require 'cosmos/packets/packet_config'
27
28
  require 'cosmos/bridge/bridge'
28
29
  require 'ostruct'
29
30
  require 'optparse'
@@ -32,6 +33,7 @@ require 'fileutils'
32
33
  require 'find'
33
34
  require 'json'
34
35
  require 'redis'
36
+ require 'psych'
35
37
  require 'erb'
36
38
 
37
39
  $redis_url = "redis://#{ENV['COSMOS_REDIS_HOSTNAME']}:#{ENV['COSMOS_REDIS_PORT']}"
@@ -40,25 +42,27 @@ $redis_url = "redis://#{ENV['COSMOS_REDIS_HOSTNAME']}:#{ENV['COSMOS_REDIS_PORT']
40
42
  MIGRATE_OPTIONS = OpenStruct.new
41
43
  MIGRATE_OPTIONS.all = false
42
44
  MIGRATE_PARSER = OptionParser.new do |op|
43
- op.banner = "cosmos migrate PLUGIN [TGT1...] # Create a COSMOS 5 plugin from existing COSMOS 4 targets"
44
- op.on("-a", "--all", "Move all COSMOS 4 targets into a single COSMOS 5 plugin") do
45
+ op.banner = "cosmos migrate PLUGIN [TGT1...] # Create a COSMOS 5 plugin from existing COSMOS 4 targets"
46
+ op.on("-a", "--all", " Move all COSMOS 4 targets into a single COSMOS 5 plugin") do
45
47
  MIGRATE_OPTIONS.all = true
46
48
  end
47
49
  end
50
+ ERROR_CODE = 67 # ASCII 'C' for COSMOS
48
51
 
49
52
  # Prints the usage text for the cosmos executable
50
53
  def print_usage
51
54
  puts "Usage:"
52
55
  puts " cosmos help # Displays this information"
53
56
  puts " cosmos rake # Runs rake in the local directory"
54
- puts " cosmos load /PATH/FILENAME.gem # Loads a COSMOS plugin gem file"
57
+ puts " cosmos validate /PATH/FILENAME.gem SCOPE variables.txt # Validate a COSMOS plugin gem file"
58
+ puts " cosmos load /PATH/FILENAME.gem SCOPE variables.txt # Loads a COSMOS plugin gem file"
55
59
  puts " cosmos generate plugin PLUGIN_NAME # Generate a COSMOS plugin"
56
60
  puts " #{MIGRATE_PARSER}"
57
61
  puts " cosmos bridge CONFIG_FILENAME # Run COSMOS host bridge"
58
62
  puts " cosmos bridgesetup CONFIG_FILENAME # Create a default config file"
59
63
  puts " cosmos geminstall GEMFILENAME # Install loaded gem to /gems"
60
64
  puts " cosmos rubysloc # Counts Ruby SLOC recursively. Run with --help for more info."
61
- # puts " cosmos xtce_converter # Convert to and from the XTCE format. Run with --help for more info."
65
+ puts " cosmos xtce_converter # Convert to and from the XTCE format. Run with --help for more info."
62
66
  puts " cosmos cstol_converter # Converts CSTOL files (.prc) to COSMOS. Run with --help for more info."
63
67
  puts ""
64
68
  end
@@ -99,7 +103,7 @@ def generate(args)
99
103
  end
100
104
  base_name.sub!("target.rb", target_lib_filename)
101
105
  base_name.sub!("plugin.gemspec", "#{plugin_name}.gemspec")
102
- output = ERB.new(File.read(file)).result(b)
106
+ output = ERB.new(File.read(file), trim_mode: "-").result(b)
103
107
  File.open(base_name, 'w') do |file|
104
108
  file.write output
105
109
  end
@@ -185,6 +189,76 @@ def migrate(args)
185
189
  puts "Plugin complete: #{File.expand_path('.')}" # Remember we're inside the plugin dir
186
190
  end
187
191
 
192
+ def xtce_converter(args)
193
+ options = {}
194
+ option_parser = OptionParser.new do |option_parser|
195
+ option_parser.banner = "Usage: xtce_converter [options] --import input_xtce_filename --output output_dir\n"+
196
+ " xtce_converter [options] --plugin /PATH/FILENAME.gem --output output_dir --variables variables.txt"
197
+ option_parser.separator("")
198
+ option_parser.on("-h", "--help", "Show this message") do
199
+ puts option_parser
200
+ exit
201
+ end
202
+ option_parser.on("-i VALUE", "--import VALUE", "Import the specified .xtce file") do |arg|
203
+ options[:import] = arg
204
+ end
205
+ option_parser.on("-o", "--output DIRECTORY", "Create files in the directory") do |arg|
206
+ options[:output] = arg
207
+ end
208
+ option_parser.on("-p", "--plugin PLUGIN", "Export .xtce file(s) from the plugin") do |arg|
209
+ options[:plugin] = arg
210
+ end
211
+ option_parser.on("-v", "--variables", "Optional variables file to pass to the plugin") do |arg|
212
+ options[:variables] = arg
213
+ end
214
+ end
215
+
216
+ begin
217
+ option_parser.parse!(args)
218
+ rescue => err
219
+ abort(option_parser.to_s)
220
+ end
221
+
222
+ if options[:import] && options[:plugin]
223
+ puts "xtce_converter options --import and --plugin are mutually exclusive"
224
+ abort(option_parser.to_s)
225
+ end
226
+
227
+ ENV['COSMOS_NO_STORE'] = '1' # it can be anything
228
+ Cosmos::Logger.stdout = false
229
+ Cosmos::Logger.level = Cosmos::Logger::DEBUG
230
+
231
+ if options[:import] && options[:output]
232
+ packet_config = Cosmos::PacketConfig.new
233
+ puts "Processing #{options[:import]}..."
234
+ packet_config.process_file(options[:import], nil)
235
+ puts "Writing COSMOS config files to #{options[:output]}/"
236
+ packet_config.to_config(options[:output])
237
+ exit(0)
238
+ elsif options[:plugin] && options[:output]
239
+ begin
240
+ variables = nil
241
+ variables = JSON.parse(File.read(options[:variables])) if options[:variables]
242
+ puts "Installing #{File.basename(options[:plugin])}"
243
+ plugin_hash = Cosmos::PluginModel.install_phase1(options[:plugin], variables, scope: 'DEFAULT', validate_only: true)
244
+ plugin_hash['variables']['xtce_output'] = options[:output]
245
+ Cosmos::PluginModel.install_phase2(plugin_hash['name'], plugin_hash['variables'], scope: 'DEFAULT', validate_only: true,
246
+ gem_file_path: options[:plugin])
247
+ result = 0 # bash and Windows consider 0 success
248
+ rescue => e
249
+ puts "Error: #{e.message}"
250
+ result = ERROR_CODE
251
+ ensure
252
+ name = Psych.safe_load(`gem spec #{options[:plugin]} name`).to_s
253
+ version = Psych.safe_load(`gem spec #{options[:plugin]} version`, permitted_classes: [Gem::Version]).to_s
254
+ Gem::Uninstaller.new(name, {:version => version, :force => true}).uninstall
255
+ exit(result)
256
+ end
257
+ else
258
+ abort(option_parser.to_s)
259
+ end
260
+ end
261
+
188
262
  # A helper method to make the zip writing recursion work
189
263
  def write_zip_entries(base_dir, entries, zip_path, io)
190
264
  io.add(zip_path, base_dir) # Add the directory whether it has entries or not
@@ -212,7 +286,66 @@ def put_into_archive(disk_file_path, io, zip_file_path)
212
286
  end
213
287
  end
214
288
 
215
- def load_plugin(plugin_file_path, scope:, variables_file: nil)
289
+ def validate_plugin(plugin_file_path, scope:, variables_file: nil)
290
+ ENV['COSMOS_NO_STORE'] = '1' # it can be anything
291
+ Cosmos::Logger.stdout = false
292
+ Cosmos::Logger.level = Cosmos::Logger::DEBUG
293
+ scope ||= 'DEFAULT'
294
+ variables = nil
295
+ variables = JSON.parse(File.read(variables_file)) if variables_file
296
+ puts "Installing #{File.basename(plugin_file_path)}"
297
+ plugin_hash = Cosmos::PluginModel.install_phase1(plugin_file_path, variables, scope: scope, validate_only: true)
298
+ Cosmos::PluginModel.install_phase2(plugin_hash['name'], plugin_hash['variables'], scope: scope, validate_only: true,
299
+ gem_file_path: plugin_file_path)
300
+ puts "Successfully validated #{File.basename(plugin_file_path)}"
301
+ result = 0 # bash and Windows consider 0 success
302
+ rescue => e
303
+ puts "Error: #{e.message}"
304
+ result = ERROR_CODE
305
+ ensure
306
+ name = Psych.safe_load(`gem spec #{plugin_file_path} name`).to_s
307
+ version = Psych.safe_load(`gem spec #{plugin_file_path} version`, permitted_classes: [Gem::Version]).to_s
308
+ Gem::Uninstaller.new(name, {:version => version, :force => true}).uninstall
309
+ exit(result)
310
+ end
311
+
312
+ def update_plugin(plugin_file_path, plugin_name, variables: nil, plugin_txt_lines: nil, scope:)
313
+ new_gem = File.basename(plugin_file_path)
314
+ old_gem = plugin_name.split("__")[0]
315
+ puts "Updating existing plugin: #{plugin_name} with #{File.basename(plugin_file_path)}"
316
+ plugin_model = Cosmos::PluginModel.get_model(name: plugin_name, scope: scope)
317
+ begin
318
+ # Only update if something has changed
319
+ if (new_gem != old_gem) or (variables != plugin_model.variables) or (plugin_txt_lines != plugin_model.plugin_txt_lines)
320
+ variables = plugin_model.variables unless variables
321
+ plugin_model.destroy
322
+ plugin_hash = Cosmos::PluginModel.install_phase1(plugin_file_path, existing_variables: variables, existing_plugin_txt_lines: plugin_txt_lines, process_existing: true, scope: scope)
323
+ Cosmos::PluginModel.install_phase2(plugin_hash, scope: scope)
324
+ else
325
+ puts "No changes detected - Exiting without change"
326
+ end
327
+ rescue => error
328
+ puts error.formatted
329
+ plugin_model.restore if plugin_model.destroyed?
330
+ raise error
331
+ end
332
+ end
333
+
334
+ # Loads a plugin into the COSMOS system
335
+ # This code is used from the command line and is the same code that gets called if you
336
+ # edit/upgrade or install a new plugin from the Admin interface
337
+ #
338
+ # Usage: cosmos load gemfile_path [scope] [plugin_hash_file_path]
339
+ #
340
+ # With just gemfile_path and/or scope: Will do nothing if any plugin
341
+ # with the same gem file already exists
342
+ #
343
+ # Otherwise will do what the plugin_hash_file says to do
344
+ # Plugin hash file must have the exact name of an existing plugin for upgrades and edits
345
+ # Otherwise, it will be assumed that the plugin is intentionally being installed for a second
346
+ # time
347
+ #
348
+ def load_plugin(plugin_file_path, scope:, plugin_hash_file: nil)
216
349
  scope ||= 'DEFAULT'
217
350
  # Only create the scope if it doesn't already exist
218
351
  unless Cosmos::ScopeModel.names.include?(scope)
@@ -226,41 +359,47 @@ def load_plugin(plugin_file_path, scope:, variables_file: nil)
226
359
  end
227
360
 
228
361
  begin
229
- # Try to find an existing plugin with this file to upgrade
230
- gem_filename = File.basename(plugin_file_path, ".gem")
231
- gem_filename = gem_filename.split('-')[0..-2].join('-')
232
- plugin_names = Cosmos::PluginModel.names(scope: scope)
233
- found = false
234
- plugin_names.each do |plugin_name|
235
- gem_name = plugin_name.split("__")[0]
236
- gem_name = File.basename(plugin_name, ".gem")
237
- gem_name = gem_name.split('-')[0..-2].join('-')
238
- if gem_filename == gem_name
239
- puts "Upgrading existing plugin: #{plugin_name} with #{plugin_file_path}"
240
- plugin_model = Cosmos::PluginModel.get_model(name: plugin_name, scope: scope)
241
- variables = plugin_model.variables
242
- plugin_model.destroy
243
- if variables_file
244
- # Assume phase1 is already done
245
- variables = JSON.parse(File.read(variables_file))
246
- plugin_hash = Cosmos::PluginModel.new(name: File.basename(plugin_file_path), variables: variables, scope: scope).as_json
247
- else
248
- plugin_hash = Cosmos::PluginModel.install_phase1(plugin_file_path, variables, scope: scope)
362
+ if plugin_hash_file
363
+ # Admin Create / Edit / or Upgrade Plugin
364
+ Cosmos::PluginModel.install_phase1(plugin_file_path, scope: scope)
365
+ plugin_hash = JSON.parse(File.read(plugin_hash_file))
366
+ else
367
+ # Init or Command Line cosmos load with no plugin_hash_file
368
+ file_full_name = File.basename(plugin_file_path, ".gem")
369
+ file_gem_name = file_full_name.split('-')[0..-2].join('-')
370
+ found = false
371
+ plugin_names = Cosmos::PluginModel.names(scope: scope)
372
+ plugin_names.each do |plugin_name|
373
+ gem_name = plugin_name.split("__")[0]
374
+ full_name = File.basename(gem_name, ".gem")
375
+ gem_name = full_name.split('-')[0..-2].join('-')
376
+ if file_gem_name == gem_name
377
+ found = true
378
+ # Upgrade if version changed else do nothing
379
+ if file_full_name != full_name
380
+ update_plugin(plugin_file_path, plugin_name, scope: scope)
381
+ end
249
382
  end
250
- Cosmos::PluginModel.install_phase2(plugin_hash['name'], plugin_hash['variables'], scope: scope)
251
- found = true
252
383
  end
384
+ return if found
385
+
386
+ plugin_hash = Cosmos::PluginModel.install_phase1(plugin_file_path, scope: scope)
253
387
  end
254
- unless found
255
- puts "Loading new plugin: #{plugin_file_path}"
256
- if variables_file
257
- # Assume phase1 is already done
258
- variables = JSON.parse(File.read(variables_file))
259
- plugin_hash = Cosmos::PluginModel.new(name: File.basename(plugin_file_path), variables: variables, scope: scope).as_json
260
- else
261
- plugin_hash = Cosmos::PluginModel.install_phase1(plugin_file_path, scope: scope)
262
- end
263
- Cosmos::PluginModel.install_phase2(plugin_hash['name'], plugin_hash['variables'], scope: scope)
388
+
389
+ # Determine if plugin named in plugin_hash exists
390
+ existing_plugin_hash = Cosmos::PluginModel.get(name: plugin_hash['name'], scope: scope)
391
+
392
+ # Existing plugin hash will be present if plugin is being edited or upgraded
393
+ # If editing, gem name will match existing hash name
394
+ # If upgrading, gem name will not match the existing hash name
395
+
396
+ if existing_plugin_hash
397
+ # Upgrade or Edit
398
+ update_plugin(plugin_file_path, plugin_hash['name'], variables: plugin_hash['variables'], plugin_txt_lines: plugin_hash['plugin_txt_lines'], scope: scope)
399
+ else
400
+ # New Install
401
+ puts "Loading new plugin: #{plugin_file_path}\n#{plugin_hash}"
402
+ Cosmos::PluginModel.install_phase2(plugin_hash, scope: scope)
264
403
  end
265
404
  rescue => err
266
405
  abort("Error installing plugin: #{scope}: #{plugin_file_path}: #{err.formatted}")
@@ -305,8 +444,11 @@ if not ARGV[0].nil? # argument(s) given
305
444
  when 'rake'
306
445
  puts `rake #{ARGV[1..-1].join(' ')}`
307
446
 
447
+ when 'validate'
448
+ validate_plugin(ARGV[1], scope: ARGV[2], variables_file: ARGV[3])
449
+
308
450
  when 'load'
309
- load_plugin(ARGV[1], scope: ARGV[2], variables_file: ARGV[3])
451
+ load_plugin(ARGV[1], scope: ARGV[2], plugin_hash_file: ARGV[3])
310
452
 
311
453
  when 'geminstall'
312
454
  gem_install(ARGV[1])
@@ -333,9 +475,8 @@ if not ARGV[0].nil? # argument(s) given
333
475
  when 'cstol_converter'
334
476
  puts `ruby /cosmos/bin/cstol_converter #{ARGV[1..-1].join(' ')}`
335
477
 
336
- # TODO: This still needs work in COSMOS 5
337
- # when 'xtce_converter'
338
- # puts `ruby /cosmos/bin/xtce_converter #{ARGV[1..-1].join(' ')}`
478
+ when 'xtce_converter'
479
+ xtce_converter(ARGV[1..-1])
339
480
 
340
481
  when 'bridge'
341
482
  ENV['COSMOS_NO_STORE'] = '1'
@@ -2,65 +2,77 @@
2
2
  MICROSERVICE:
3
3
  summary: Defines a new microservice
4
4
  example: MICROSERVICE EXAMPLE example-microservice
5
+ description: Defines a microservice that the plugin adds to the COSMOS system. Microservices are background software processes that perform persistent processing.
5
6
  parameters:
6
- - name: Folder Name
7
+ - name: Microservice Folder Name
8
+ description: The exact name of the microservice folder in the plugin. ie. microservices/<Microservice Folder Name>
7
9
  required: true
8
- description: The target folder where the microservice is located
9
- values: .*
10
- - name: Name
10
+ values: .+
11
+ - name: Microservice Name
12
+ description: The specific name of this instance of the microservice in the COSMOS system
11
13
  required: true
12
- description: The microservice name
13
- values: .*
14
+ values: .+
14
15
  modifiers:
15
16
  ENV:
16
- summary: Environment variable
17
+ summary: Sets an environment variable in the microservice.
17
18
  parameters:
18
- - name: Name
19
+ - name: Key
19
20
  required: true
20
21
  description: Environment variable name
21
- values: .*
22
+ values: .+
22
23
  - name: Value
23
24
  required: true
24
25
  description: Environment variable value
25
- values: .*
26
+ values: .+
26
27
  WORK_DIR:
27
- summary: Directory to start the microservice in (CWD)
28
+ summary: Set the working directory
29
+ description: Working directory to run the microservice CMD in. Can be a path relative to the microservice folder in the plugin, or an absolute path in the container the microservice runs in.
28
30
  parameters:
29
- - name: Path
31
+ - name: Directory
30
32
  required: true
31
- description: Relative path from the target directory
32
- values: .*
33
+ description: Working directory to run the microservice CMD in. Can be a path relative to the microservice folder in the plugin, or an absolute path in the container the microservice runs in.
34
+ values: .+
33
35
  TOPIC:
34
- summary: Topic the microservice should process data from
36
+ summary: Associate a Redis topic
37
+ description: Redis topic to associate with this microservice. Standard COSMOS microservices such as decom_microservice use this information to know what packet streams to subscribe to. The TOPIC keyword can be used as many times as necessary to associate all needed topics.
35
38
  parameters:
36
- - name: Name
39
+ - name: Topic Name
37
40
  required: true
38
- description: Topic name
39
- values: .*
41
+ description: Redis Topic to associate with the microservice
42
+ values: .+
40
43
  TARGET_NAME:
41
- summary: Target which this microservice processes
44
+ summary: Associate a COSMOS target
45
+ description: COSMOS target to associate with the microservice. For standard COSMOS microservices such as decom_microservice this causes the target configuration to get loaded into the container for the microservice.
42
46
  parameters:
43
- - name: Name
47
+ - name: Target Name
44
48
  required: true
45
- description: Target name
46
- values: .*
49
+ description: COSMOS target to associate with the microservice
50
+ values: .+
47
51
  CMD:
48
- summary: Command to run which starts the microservice
52
+ summary: Command line to execute to run the microservice.
53
+ description: Command line to execute to run the microservice.
49
54
  parameters:
50
- - name: Executable
55
+ - name: Args
51
56
  required: true
52
- description: Executable to call
53
- values: .*
54
- - name: Command parameters
55
- required: false
56
- description: Additional parameters used by the command
57
+ description: One or more arguments to exec to run the microservice.
58
+ values: .+
57
59
  OPTION:
58
- summary: Options to pass to the underlying microservice (used by InterfaceMicroservice, etc.)
60
+ summary: Pass an option to the microservice
61
+ description: Generic key/value(s) options to pass to the microservice. These take the form of KEYWORD/PARAMS like a line in a COSMOS configuration file. Multiple OPTION keywords can be used to pass multiple options to the microservice.
59
62
  parameters:
60
- - name: Name
63
+ - name: Option Name
64
+ required: true
65
+ description: Name of the option
66
+ values: .+
67
+ - name: Option Value(s)
61
68
  required: true
62
- description: Option name
63
- values: .*
64
- - name: Values
69
+ description: One or more values to associate with the option
70
+ values: .+
71
+ CONTAINER:
72
+ summary: Docker Container.
73
+ description: Container to execute and run the microservice in.
74
+ parameters:
75
+ - name: Args
65
76
  required: false
66
- description: Option values
77
+ description: Name of the container
78
+ values: .+
@@ -65,153 +65,16 @@ ROUTER:
65
65
  <%= MetaConfigParser.load('_interfaces.yaml').to_meta_config_yaml(8) %>
66
66
  documentation: Additional parameters are required. Please see the [Interfaces](/docs/v5/interfaces)
67
67
  documentation for more details.
68
- TARGET:
69
- summary: Define a target
70
- description: Defines a target that the plugin adds to the COSMOS system. Targets are entities that COSMOS can send commands to and receive telemetry from.
68
+ <%= MetaConfigParser.load('target.yaml').to_meta_config_yaml() %>
69
+ <%= MetaConfigParser.load('microservice.yaml').to_meta_config_yaml() %>
70
+ <%= MetaConfigParser.load('tool.yaml').to_meta_config_yaml() %>
71
+ WIDGET:
72
+ summary: Define a custom widget
73
+ example: WIDGET HELLOWORLD
74
+ description: Defines a custom widget that can be used in Telemetry Viewer screens.
71
75
  parameters:
72
- - name: Target Folder Name
73
- description: The exact name of the target folder in the plugin. ie. targets/<Target Folder Name>
76
+ - name: Widget Name
77
+ description: The name of the widget wil be used to build a path to the widget implementation. For example, `WIDGET HELLOWORLD` will find the as-built file tools/widgets/HelloworldWidget/HelloworldWidget.umd.min.js. See the [Custom Widgets](/docs/v5/custom-widgets)
78
+ guide for more details.
74
79
  required: true
75
80
  values: .+
76
- - name: Target Name
77
- description: The specific name of this instance of the target in the COSMOS system
78
- required: true
79
- values: .+
80
- MICROSERVICE:
81
- summary: Define a microservice
82
- description: Defines a microservice that the plugin adds to the COSMOS system. Microservices are background software processes that perform persistent processing.
83
- parameters:
84
- - name: Microservice Folder Name
85
- description: The exact name of the microservice folder in the plugin. ie. microservices/<Microservice Folder Name>
86
- required: true
87
- values: .+
88
- - name: Microservice Name
89
- description: The specific name of this instance of the microservice in the COSMOS system
90
- required: true
91
- values: .+
92
- modifiers:
93
- ENV:
94
- summary: Sets an environment variable in the microservice.
95
- description: Sets an environment variable in the microservice.
96
- parameters:
97
- - name: Key
98
- required: true
99
- description: Name of the environment variable
100
- values: .+
101
- - name: Value
102
- required: true
103
- description: Value of the environment variable
104
- values: .+
105
- WORK_DIR:
106
- summary: Set the working directory
107
- description: Working directory to run the microservice CMD in. Can be a path relative to the microservice folder in the plugin, or an absolute path in the container the microservice runs in.
108
- parameters:
109
- - name: Directory
110
- required: true
111
- description: Working directory to run the microservice CMD in. Can be a path relative to the microservice folder in the plugin, or an absolute path in the container the microservice runs in.
112
- values: .+
113
- TOPIC:
114
- summary: Associate a Redis topic
115
- description: Redis topic to associate with this microservice. Standard COSMOS microservices such as decom_microservice use this information to know what packet streams to subscribe to. The TOPIC keyword can be used as many times as necessary to associate all needed topics.
116
- parameters:
117
- - name: Topic Name
118
- required: true
119
- description: Redis Topic to associate with the microservice
120
- values: .+
121
- TARGET_NAME:
122
- summary: Associate a COSMOS target
123
- description: COSMOS target to associate with the microservice. For standard COSMOS microservices such as decom_microservice this causes the target configuration to get loaded into the container for the microservice.
124
- parameters:
125
- - name: Target Name
126
- required: true
127
- description: COSMOS target to associate with the microservice
128
- values: .+
129
- CMD:
130
- summary: Command line to execute to run the microservice.
131
- description: Command line to execute to run the microservice.
132
- parameters:
133
- - name: Args
134
- required: true
135
- description: One or more arguments to exec to run the microservice.
136
- values: .+
137
- CONTAINER:
138
- summary: Docker Container.
139
- description: Container to execute and run the microservice in.
140
- parameters:
141
- - name: Args
142
- required: false
143
- description: Name of the container
144
- values: .+
145
- OPTION:
146
- summary: Pass an option to the microservice
147
- description: Generic key/value(s) options to pass to the microservice. These take the form of KEYWORD/PARAMS like a line in a COSMOS configuration file. Multiple OPTION keywords can be used to pass multiple options to the microservice.
148
- parameters:
149
- - name: Option Name
150
- required: true
151
- description: Name of the option
152
- values: .+
153
- - name: Option Value(s)
154
- required: true
155
- description: One or more values to associate with the option
156
- values: .+
157
- TOOL:
158
- summary: Define a tool
159
- description: Defines a tool that the plugin adds to the COSMOS system. Tools are web based applications that make use of the Single-SPA javascript library that allows them to by dynamically added to the running system as independent frontend microservices.
160
- parameters:
161
- - name: Tool Folder Name
162
- description: The exact name of the tool folder in the plugin. ie. tools/<Tool Folder Name>
163
- required: true
164
- values: .+
165
- - name: Tool Name
166
- description: Name of the tool that is displayed in the COSMOS Navigation menu
167
- required: true
168
- values: .+
169
- modifiers:
170
- URL:
171
- summary: Url used to access the tool
172
- description: The relative url used to access the tool. Defaults to "/tools/<Tool Folder Name>".
173
- parameters:
174
- - name: Url
175
- required: true
176
- description: The url. If not given defaults to tools/<Tool Folder Name>. Generally should not be given unless linking to external tools.
177
- values: .+
178
- INLINE_URL:
179
- summary: Internal url to load a tool
180
- description: The url of the javascript file used to load the tool into single-SPA. Defaults to "js/app.js".
181
- parameters:
182
- - name: Url
183
- required: true
184
- description: The inline url. If not given defaults to js/app.js. Generally should not be given unless using a non-standard filename.
185
- values: .+
186
- WINDOW:
187
- summary: How to display the tool when navigated to
188
- description: The window mode used to display the tool. Currently supported modes are INLINE which opens the tool internally without refreshing the page using the Single-SPA framework, and NEW which opens the tool in a new TAB. A future release will support IFRAME to open external tools in an Iframe within COSMOS.
189
- parameters:
190
- - name: Window Mode
191
- required: true
192
- description: INLINE, NEW, or IFRAME
193
- values: .+
194
- ICON:
195
- summary: Set tool icon
196
- description: Icon shown next to the tool name in the COSMOS navigation menu.
197
- parameters:
198
- - name: Icon Name
199
- required: true
200
- description: Icon to display next to the tool name. Icons come from Font Awesome, Material Design, and Astro. See https://vuetifyjs.com/en/components/icons/
201
- values: .+
202
- CATEGORY:
203
- summary: Category for the tool
204
- description: Associates the tool with a category. In a future release this will be able to organize tools into submenus in the Navigation menu.
205
- parameters:
206
- - name: Category Name
207
- required: true
208
- description: Category to associate the tool with
209
- values: .+
210
- SHOWN:
211
- summary: Show the tool or not
212
- description: Whether or not the tool is shown in the Navigation menu. Should generally be true, except for the cosmos base tool.
213
- parameters:
214
- - name: Shown
215
- required: true
216
- description: Whether or not the tool is shown. TRUE or FALSE
217
- values: .+