OpenC3/cosmos

View on GitHub
openc3-cosmos-init/plugins/packages/openc3-cosmos-demo/plugin.txt

Summary

Maintainability
Test Coverage
# Note: This plugin includes 4 targets in one plugin to make it easy to install
# the OpenC3 demo with one plugin.  Generally it is better to only have one
# target per plugin

VARIABLE inst_target_name INST
VARIABLE inst2_target_name INST2
VARIABLE example_target_name EXAMPLE
VARIABLE templated_target_name TEMPLATED
VARIABLE system_target_name SYSTEM
VARIABLE inst_int_name INST_INT
VARIABLE inst_router_name INST_ROUTER
VARIABLE inst2_int_name INST2_INT
VARIABLE example_int_name EXAMPLE_INT
VARIABLE templated_int_name TEMPLATED_INT
VARIABLE demo_tool_name Demo
VARIABLE example_microservice_name openc3-example
VARIABLE templated_microservice_name openc3-templated
VARIABLE example_port 9999
VARIABLE templated_port 5025
VARIABLE inst_router_port 7779
VARIABLE log_retain_time 172800
VARIABLE reduced_log_retain_time 2592000

<% include_inst = (inst_target_name.to_s.strip.length > 0) %>
<% include_inst2 = (inst2_target_name.to_s.strip.length > 0) %>
<% include_example = (example_target_name.to_s.strip.length > 0) %>
<% include_templated = (templated_target_name.to_s.strip.length > 0) %>
<% include_system = (system_target_name.to_s.strip.length > 0) %>
<% include_inst_int = (inst_int_name.to_s.strip.length > 0) %>
<% include_inst_router = (inst_router_name.to_s.strip.length > 0) %>
<% include_inst2_int = (inst2_int_name.to_s.strip.length > 0) %>
<% include_example_int = (example_int_name.to_s.strip.length > 0) %>
<% include_templated_int = (templated_int_name.to_s.strip.length > 0) %>
<% include_example_microservice = (example_microservice_name.to_s.strip.length > 0) %>
<% include_templated_microservice = (templated_microservice_name.to_s.strip.length > 0) %>

<% if include_inst %>
  TARGET INST <%= inst_target_name %>
    # If we're in the CI pipeline shorten the log file creation time
    <% if ENV["CI"] %>
      TLM_LOG_CYCLE_TIME 60
    <% else %>
      TLM_LOG_CYCLE_TIME 300
    <% end %>
    LOG_RETAIN_TIME <%= log_retain_time %>
    REDUCED_LOG_RETAIN_TIME <%= reduced_log_retain_time %>
    # Allow the reducer microservice to take 50% of the cpu (default 30%)
    REDUCER_MAX_CPU_UTILIZATION 50
<% end %>

<% if include_inst2 %>
  TARGET INST2 <%= inst2_target_name %>
    LOG_RETAIN_TIME <%= log_retain_time %>
    REDUCED_LOG_RETAIN_TIME <%= reduced_log_retain_time %>
    TLM_LOG_CYCLE_TIME 600
<% end %>

<% if include_example %>
  TARGET EXAMPLE <%= example_target_name %>
    LOG_RETAIN_TIME <%= log_retain_time %>
    # Disable data reduction (min, hour, day) on this target data
    # No 'ruby reducer_microservice.rb DEFAULT__REDUCER__EXAMPLE'
    # will appear in the the process list
    REDUCER_DISABLE
<% end %>

<% if include_templated %>
  TARGET TEMPLATED <%= templated_target_name %>
    LOG_RETAIN_TIME <%= log_retain_time %>
    # Disable data reduction (min, hour, day) on this target data
    # No 'ruby reducer_microservice.rb DEFAULT__REDUCER__TEMPLATED'
    # will appear in the the process list
    REDUCER_DISABLE
<% end %>

<% if include_system %>
  TARGET SYSTEM <%= system_target_name %>
<% end %>

<% if include_inst and include_inst_int %>
  INTERFACE <%= inst_int_name %> simulated_target_interface.rb sim_inst.rb
    MAP_TARGET <%= inst_target_name %>
<% end %>

<% if include_inst2 and include_inst2_int %>
  INTERFACE <%= inst2_int_name %> openc3/interfaces/simulated_target_interface.py sim_inst.py
    MAP_TARGET <%= inst2_target_name %>
<% end %>

<% if include_example and include_example_int %>
  # This expression builds the correct hostname for Open Source or Enterprise Edition in Kubernetes
  <% example_host = ENV['KUBERNETES_SERVICE_HOST'] ? "#{scope}-user-#{example_microservice_name.downcase.gsub('__', '-').gsub('_', '-')}-service" : "openc3-operator" %>
  INTERFACE <%= example_int_name %> example_interface.rb <%= example_host %> <%= example_port %>
    MAP_TARGET <%= example_target_name %>
    DONT_CONNECT
    # Override the default log time of 600
    LOG_STREAM 60
<% end %>

<% if include_templated and include_templated_int %>
  # This expression builds the correct hostname for Open Source or Enterprise Edition in Kubernetes
  <% templated_host = ENV['KUBERNETES_SERVICE_HOST'] ? "#{scope}-user-#{templated_microservice_name.downcase.gsub('__', '-').gsub('_', '-')}-service" : "openc3-operator" %>
  INTERFACE <%= templated_int_name %> templated_interface.rb <%= templated_host %> <%= templated_port %> <%= templated_port %> 5.0 nil TEMPLATE 0xA 0xA
    MAP_TARGET <%= templated_target_name %>
    DONT_CONNECT
<% end %>

<% if include_inst and include_inst_router %>
  ROUTER <%= inst_router_name %> tcpip_server_interface.rb <%= inst_router_port %> <%= inst_router_port %> 10.0 nil PREIDENTIFIED
    MAP_TARGET <%= inst_target_name %>
<% end %>

<% if include_example_microservice %>
  MICROSERVICE EXAMPLE <%= example_microservice_name %>
    CMD ruby example_target.rb
    TARGET_NAME <%= example_target_name %>
    PORT <%= example_port %>
<% end %>

<% if include_templated_microservice %>
  MICROSERVICE TEMPLATED <%= templated_microservice_name %>
    CMD ruby scpi_target.rb
    TARGET_NAME <%= templated_target_name %>
    PORT <%= templated_port %>
<% end %>

WIDGET BIG
WIDGET HELLOWORLD
WIDGET DATAVIEWERTIME "Current Time"
WIDGET DATAVIEWERQUATERNION