openc3-cosmos-cfdp 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE.txt +18 -0
- data/README.md +181 -0
- data/Rakefile +40 -0
- data/lib/cfdp.rb +283 -0
- data/lib/cfdp_api.rb +204 -0
- data/microservices/CFDP/Gemfile +37 -0
- data/microservices/CFDP/Rakefile +6 -0
- data/microservices/CFDP/app/controllers/application_controller.rb +46 -0
- data/microservices/CFDP/app/controllers/cfdp_controller.rb +222 -0
- data/microservices/CFDP/app/models/cfdp_checksum.rb +52 -0
- data/microservices/CFDP/app/models/cfdp_crc_checksum.rb +41 -0
- data/microservices/CFDP/app/models/cfdp_mib.rb +613 -0
- data/microservices/CFDP/app/models/cfdp_model.rb +25 -0
- data/microservices/CFDP/app/models/cfdp_null_checksum.rb +29 -0
- data/microservices/CFDP/app/models/cfdp_pdu.rb +202 -0
- data/microservices/CFDP/app/models/cfdp_receive_transaction.rb +590 -0
- data/microservices/CFDP/app/models/cfdp_source_transaction.rb +449 -0
- data/microservices/CFDP/app/models/cfdp_topic.rb +58 -0
- data/microservices/CFDP/app/models/cfdp_transaction.rb +188 -0
- data/microservices/CFDP/app/models/cfdp_user.rb +601 -0
- data/microservices/CFDP/bin/rails +4 -0
- data/microservices/CFDP/bin/rake +4 -0
- data/microservices/CFDP/bin/setup +25 -0
- data/microservices/CFDP/config/application.rb +55 -0
- data/microservices/CFDP/config/boot.rb +4 -0
- data/microservices/CFDP/config/credentials.yml.enc +1 -0
- data/microservices/CFDP/config/environment.rb +5 -0
- data/microservices/CFDP/config/environments/development.rb +53 -0
- data/microservices/CFDP/config/environments/production.rb +75 -0
- data/microservices/CFDP/config/environments/test.rb +50 -0
- data/microservices/CFDP/config/initializers/application_controller_renderer.rb +8 -0
- data/microservices/CFDP/config/initializers/backtrace_silencers.rb +7 -0
- data/microservices/CFDP/config/initializers/cfdp_initializer.rb +26 -0
- data/microservices/CFDP/config/initializers/cors.rb +16 -0
- data/microservices/CFDP/config/initializers/filter_parameter_logging.rb +8 -0
- data/microservices/CFDP/config/initializers/inflections.rb +16 -0
- data/microservices/CFDP/config/initializers/mime_types.rb +4 -0
- data/microservices/CFDP/config/initializers/wrap_parameters.rb +9 -0
- data/microservices/CFDP/config/locales/en.yml +29 -0
- data/microservices/CFDP/config/puma.rb +38 -0
- data/microservices/CFDP/config/routes.rb +16 -0
- data/microservices/CFDP/config.ru +5 -0
- data/microservices/CFDP/init.sh +9 -0
- data/microservices/CFDP/lib/cfdp_pdu/cfdp_pdu_ack.rb +82 -0
- data/microservices/CFDP/lib/cfdp_pdu/cfdp_pdu_enum.rb +237 -0
- data/microservices/CFDP/lib/cfdp_pdu/cfdp_pdu_eof.rb +87 -0
- data/microservices/CFDP/lib/cfdp_pdu/cfdp_pdu_file_data.rb +98 -0
- data/microservices/CFDP/lib/cfdp_pdu/cfdp_pdu_finished.rb +114 -0
- data/microservices/CFDP/lib/cfdp_pdu/cfdp_pdu_keep_alive.rb +65 -0
- data/microservices/CFDP/lib/cfdp_pdu/cfdp_pdu_metadata.rb +116 -0
- data/microservices/CFDP/lib/cfdp_pdu/cfdp_pdu_nak.rb +91 -0
- data/microservices/CFDP/lib/cfdp_pdu/cfdp_pdu_prompt.rb +60 -0
- data/microservices/CFDP/lib/cfdp_pdu/cfdp_pdu_tlv.rb +291 -0
- data/microservices/CFDP/lib/cfdp_pdu/cfdp_pdu_user_ops.rb +749 -0
- data/microservices/CFDP/public/robots.txt +1 -0
- data/microservices/CFDP/spec/models/cfdp_pdu_ack_spec.rb +114 -0
- data/microservices/CFDP/spec/models/cfdp_pdu_eof_spec.rb +159 -0
- data/microservices/CFDP/spec/models/cfdp_pdu_file_data_spec.rb +76 -0
- data/microservices/CFDP/spec/models/cfdp_pdu_finished_spec.rb +192 -0
- data/microservices/CFDP/spec/models/cfdp_pdu_keep_alive_spec.rb +69 -0
- data/microservices/CFDP/spec/models/cfdp_pdu_metadata_spec.rb +346 -0
- data/microservices/CFDP/spec/models/cfdp_pdu_nak_spec.rb +126 -0
- data/microservices/CFDP/spec/models/cfdp_pdu_prompt_spec.rb +94 -0
- data/microservices/CFDP/spec/models/cfdp_pdu_spec.rb +111 -0
- data/microservices/CFDP/spec/rails_helper.rb +71 -0
- data/microservices/CFDP/spec/requests/cfdp_spec.rb +1965 -0
- data/microservices/CFDP/spec/spec_helper.rb +200 -0
- data/plugin.txt +67 -0
- data/targets/CFDPTEST/cmd_tlm/cmd.txt +5 -0
- data/targets/CFDPTEST/cmd_tlm/tlm.txt +4 -0
- data/targets/CFDPTEST/procedures/cfdp_test_suite.rb +130 -0
- data/targets/CFDPTEST/target.txt +4 -0
- metadata +118 -0
@@ -0,0 +1,200 @@
|
|
1
|
+
# encoding: ascii-8bit
|
2
|
+
|
3
|
+
# Copyright 2023 OpenC3, Inc.
|
4
|
+
# All Rights Reserved.
|
5
|
+
#
|
6
|
+
# Licensed for Evaluation and Educational Use
|
7
|
+
#
|
8
|
+
# This file may only be used commercially under the terms of a commercial license
|
9
|
+
# purchased from OpenC3, Inc.
|
10
|
+
#
|
11
|
+
# This program is distributed in the hope that it will be useful,
|
12
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
14
|
+
#
|
15
|
+
# The development of this software was funded in-whole or in-part by MethaneSAT LLC.
|
16
|
+
|
17
|
+
# This file was generated by the `rails generate rspec:install` command. Conventionally, all
|
18
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
19
|
+
# The generated `.rspec` file contains `--require spec_helper` which will cause
|
20
|
+
# this file to always be loaded, without a need to explicitly require it in any
|
21
|
+
# files.
|
22
|
+
#
|
23
|
+
# Given that it is always loaded, you are encouraged to keep this file as
|
24
|
+
# light-weight as possible. Requiring heavyweight dependencies from this file
|
25
|
+
# will add to the boot time of your test suite on EVERY test run, even for an
|
26
|
+
# individual file that may not need all of that loaded. Instead, consider making
|
27
|
+
# a separate helper file that requires the additional dependencies and performs
|
28
|
+
# the additional setup, and require it from the spec files that actually need
|
29
|
+
# it.
|
30
|
+
|
31
|
+
require 'openc3'
|
32
|
+
|
33
|
+
# NOTE: You MUST require simplecov before anything else!
|
34
|
+
if !ENV['OPENC3_NO_SIMPLECOV']
|
35
|
+
require 'simplecov'
|
36
|
+
if ENV['GITHUB_WORKFLOW']
|
37
|
+
require 'simplecov-cobertura'
|
38
|
+
SimpleCov.formatter = SimpleCov::Formatter::CoberturaFormatter
|
39
|
+
else
|
40
|
+
SimpleCov.formatter = SimpleCov::Formatter::HTMLFormatter
|
41
|
+
end
|
42
|
+
SimpleCov.start do
|
43
|
+
merge_timeout 60 * 60 # merge the last hour of results
|
44
|
+
add_filter '/spec/' # no coverage on spec files
|
45
|
+
root = File.dirname(__FILE__)
|
46
|
+
root.to_s
|
47
|
+
end
|
48
|
+
SimpleCov.at_exit do
|
49
|
+
OpenC3.disable_warnings do
|
50
|
+
Encoding.default_external = Encoding::UTF_8
|
51
|
+
Encoding.default_internal = nil
|
52
|
+
end
|
53
|
+
SimpleCov.result.format!
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
# Disable Redis and Fluentd in the Logger
|
58
|
+
ENV['OPENC3_NO_STORE'] = 'true'
|
59
|
+
ENV['OPENC3_LOGS_BUCKET'] = 'logs'
|
60
|
+
ENV['OPENC3_TOOLS_BUCKET'] = 'tools'
|
61
|
+
ENV['OPENC3_CONFIG_BUCKET'] = 'config'
|
62
|
+
ENV['OPENC3_REDIS_HOSTNAME'] = '127.0.0.1'
|
63
|
+
ENV['OPENC3_REDIS_PORT'] = '6379'
|
64
|
+
ENV['OPENC3_REDIS_EPHEMERAL_HOSTNAME'] = '127.0.0.1'
|
65
|
+
ENV['OPENC3_REDIS_EPHEMERAL_PORT'] = '6380'
|
66
|
+
# Set some usernames / passwords
|
67
|
+
ENV['OPENC3_API_PASSWORD'] = 'openc3'
|
68
|
+
ENV['OPENC3_SERVICE_PASSWORD'] = 'openc3service'
|
69
|
+
ENV['OPENC3_REDIS_USERNAME'] = 'openc3'
|
70
|
+
ENV['OPENC3_REDIS_PASSWORD'] = 'openc3password'
|
71
|
+
ENV['OPENC3_BUCKET_USERNAME'] = 'openc3minio'
|
72
|
+
ENV['OPENC3_BUCKET_PASSWORD'] = 'openc3miniopassword'
|
73
|
+
ENV['OPENC3_SCOPE'] = 'DEFAULT'
|
74
|
+
ENV['OPENC3_CLOUD'] = 'local'
|
75
|
+
|
76
|
+
$openc3_scope = ENV['OPENC3_SCOPE']
|
77
|
+
$openc3_token = ENV['OPENC3_API_PASSWORD']
|
78
|
+
|
79
|
+
def mock_redis
|
80
|
+
require 'redis'
|
81
|
+
require 'mock_redis'
|
82
|
+
redis = MockRedis.new
|
83
|
+
allow(Redis).to receive(:new).and_return(redis)
|
84
|
+
OpenC3::Store.instance_variable_set(:@instance, nil)
|
85
|
+
OpenC3::EphemeralStore.instance_variable_set(:@instance, nil)
|
86
|
+
redis
|
87
|
+
end
|
88
|
+
|
89
|
+
# def setup_system(targets = %w[CFDPTEST])
|
90
|
+
# result = nil
|
91
|
+
# capture_io do |stdout|
|
92
|
+
# require 'openc3/system'
|
93
|
+
# dir = File.join(__dir__, 'targets')
|
94
|
+
# OpenC3::System.class_variable_set(:@@instance, nil)
|
95
|
+
# OpenC3::System.instance(targets, dir)
|
96
|
+
# result = stdout
|
97
|
+
# end
|
98
|
+
# result
|
99
|
+
# end
|
100
|
+
|
101
|
+
# def get_all_redis_keys
|
102
|
+
# cursor = 0
|
103
|
+
# keys = []
|
104
|
+
# loop do
|
105
|
+
# cursor, result = OpenC3::Store.scan(cursor)
|
106
|
+
# keys.concat(result)
|
107
|
+
# cursor = cursor.to_i # cursor is returned as a string
|
108
|
+
# break if cursor == 0
|
109
|
+
# end
|
110
|
+
# keys
|
111
|
+
# end
|
112
|
+
|
113
|
+
# Create a easy alias to the base of the spec directory
|
114
|
+
SPEC_DIR = File.dirname(__FILE__)
|
115
|
+
|
116
|
+
# See https://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
117
|
+
RSpec.configure do |config|
|
118
|
+
config.before(:all) do
|
119
|
+
# Most tests want to disable authorization for simplicity
|
120
|
+
$openc3_authorize = false
|
121
|
+
end
|
122
|
+
|
123
|
+
# rspec-expectations config goes here. You can use an alternate
|
124
|
+
# assertion/expectation library such as wrong or the stdlib/minitest
|
125
|
+
# assertions if you prefer.
|
126
|
+
config.expect_with :rspec do |expectations|
|
127
|
+
# This option will default to `true` in RSpec 4. It makes the `description`
|
128
|
+
# and `failure_message` of custom matchers include text for helper methods
|
129
|
+
# defined using `chain`, e.g.:
|
130
|
+
# be_bigger_than(2).and_smaller_than(4).description
|
131
|
+
# # => "be bigger than 2 and smaller than 4"
|
132
|
+
# ...rather than:
|
133
|
+
# # => "be bigger than 2"
|
134
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
135
|
+
end
|
136
|
+
|
137
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
138
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
139
|
+
config.mock_with :rspec do |mocks|
|
140
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
141
|
+
# a real object. This is generally recommended, and will default to
|
142
|
+
# `true` in RSpec 4.
|
143
|
+
mocks.verify_partial_doubles = true
|
144
|
+
end
|
145
|
+
|
146
|
+
# This option will default to `:apply_to_host_groups` in RSpec 4 (and will
|
147
|
+
# have no way to turn it off -- the option exists only for backwards
|
148
|
+
# compatibility in RSpec 3). It causes shared context metadata to be
|
149
|
+
# inherited by the metadata hash of host groups and examples, rather than
|
150
|
+
# triggering implicit auto-inclusion in groups with matching metadata.
|
151
|
+
config.shared_context_metadata_behavior = :apply_to_host_groups
|
152
|
+
|
153
|
+
# This allows you to limit a spec run to individual examples or groups
|
154
|
+
# you care about by tagging them with `:focus` metadata. When nothing
|
155
|
+
# is tagged with `:focus`, all examples get run. RSpec also provides
|
156
|
+
# aliases for `it`, `describe`, and `context` that include `:focus`
|
157
|
+
# metadata: `fit`, `fdescribe` and `fcontext`, respectively.
|
158
|
+
config.filter_run_when_matching :focus
|
159
|
+
|
160
|
+
# Allows RSpec to persist some state between runs in order to support
|
161
|
+
# the `--only-failures` and `--next-failure` CLI options. We recommend
|
162
|
+
# you configure your source control system to ignore this file.
|
163
|
+
config.example_status_persistence_file_path = "spec/examples.txt"
|
164
|
+
|
165
|
+
# Limits the available syntax to the non-monkey patched syntax that is
|
166
|
+
# recommended. For more details, see:
|
167
|
+
# https://relishapp.com/rspec/rspec-core/docs/configuration/zero-monkey-patching-mode
|
168
|
+
config.disable_monkey_patching!
|
169
|
+
|
170
|
+
# This setting enables warnings. It's recommended, but in some cases may
|
171
|
+
# be too noisy due to issues in dependencies.
|
172
|
+
# config.warnings = true
|
173
|
+
|
174
|
+
# Many RSpec users commonly either run the entire suite or an individual
|
175
|
+
# file, and it's useful to allow more verbose output when running an
|
176
|
+
# individual spec file.
|
177
|
+
if config.files_to_run.one?
|
178
|
+
# Use the documentation formatter for detailed output,
|
179
|
+
# unless a formatter has already been configured
|
180
|
+
# (e.g. via a command-line flag).
|
181
|
+
config.default_formatter = "doc"
|
182
|
+
end
|
183
|
+
|
184
|
+
# Print the 10 slowest examples and example groups at the
|
185
|
+
# end of the spec run, to help surface which specs are running
|
186
|
+
# particularly slow.
|
187
|
+
# config.profile_examples = 10
|
188
|
+
|
189
|
+
# Run specs in random order to surface order dependencies. If you find an
|
190
|
+
# order dependency and want to debug it, you can fix the order by providing
|
191
|
+
# the seed, which is printed after each run.
|
192
|
+
# --seed 1234
|
193
|
+
config.order = :random
|
194
|
+
|
195
|
+
# Seed global randomization in this process using the `--seed` CLI option.
|
196
|
+
# Setting this allows you to use `--seed` to deterministically reproduce
|
197
|
+
# test failures related to randomization by passing the same `--seed` value
|
198
|
+
# as the one that triggered the failure.
|
199
|
+
Kernel.srand config.seed
|
200
|
+
end
|
data/plugin.txt
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
VARIABLE cfdp_microservice_name CFDP
|
2
|
+
VARIABLE cfdp_route_prefix /cfdp
|
3
|
+
VARIABLE cfdp_port 2905
|
4
|
+
|
5
|
+
VARIABLE cfdp_cmd_target_name CFDP2
|
6
|
+
VARIABLE cfdp_cmd_packet_name CFDP_PDU
|
7
|
+
VARIABLE cfdp_cmd_item_name PDU
|
8
|
+
|
9
|
+
VARIABLE cfdp_tlm_target_name CFDP2
|
10
|
+
VARIABLE cfdp_tlm_packet_name CFDP_PDU
|
11
|
+
VARIABLE cfdp_tlm_item_name PDU
|
12
|
+
|
13
|
+
VARIABLE source_entity_id 1
|
14
|
+
VARIABLE destination_entity_id 2
|
15
|
+
VARIABLE root_path /DEFAULT/targets_modified/CFDP/tmp
|
16
|
+
VARIABLE bucket config
|
17
|
+
|
18
|
+
# Set to true to enable a test configuration
|
19
|
+
VARIABLE plugin_test_mode "false"
|
20
|
+
|
21
|
+
MICROSERVICE CFDP <%= cfdp_microservice_name %>
|
22
|
+
WORK_DIR .
|
23
|
+
ROUTE_PREFIX <%= cfdp_route_prefix %>
|
24
|
+
ENV OPENC3_ROUTE_PREFIX <%= cfdp_route_prefix %>
|
25
|
+
ENV SECRET_KEY_BASE 324973597349867207430793759437697498769349867349674
|
26
|
+
PORT <%= cfdp_port %>
|
27
|
+
CMD rails s -b 0.0.0.0 -p <%= cfdp_port %> -e production
|
28
|
+
# MIB Options Follow -
|
29
|
+
# You will need to modify these for your mission
|
30
|
+
OPTION source_entity_id <%= source_entity_id %>
|
31
|
+
OPTION tlm_info <%= cfdp_tlm_target_name %> <%= cfdp_tlm_packet_name %> <%= cfdp_tlm_item_name %>
|
32
|
+
OPTION destination_entity_id <%= destination_entity_id %>
|
33
|
+
OPTION cmd_info <%= cfdp_cmd_target_name %> <%= cfdp_cmd_packet_name %> <%= cfdp_cmd_item_name %>
|
34
|
+
OPTION root_path <%= root_path %>
|
35
|
+
<% if bucket.to_s.strip != '' %>
|
36
|
+
OPTION bucket <%= bucket %>
|
37
|
+
<% end %>
|
38
|
+
|
39
|
+
<% include_test = (plugin_test_mode.to_s.strip.downcase == "true") %>
|
40
|
+
<% if include_test %>
|
41
|
+
TARGET CFDPTEST CFDP
|
42
|
+
TARGET CFDPTEST CFDP2
|
43
|
+
|
44
|
+
MICROSERVICE CFDP CFDP2
|
45
|
+
WORK_DIR .
|
46
|
+
ROUTE_PREFIX /cfdp2
|
47
|
+
ENV OPENC3_ROUTE_PREFIX /cfdp2
|
48
|
+
ENV SECRET_KEY_BASE 324973597349867207430793759437697498769349867349674
|
49
|
+
PORT 2906
|
50
|
+
CMD rails s -b 0.0.0.0 -p 2906 -e production
|
51
|
+
OPTION source_entity_id <%= destination_entity_id %>
|
52
|
+
OPTION tlm_info CFDP CFDP_PDU PDU
|
53
|
+
OPTION destination_entity_id <%= source_entity_id %>
|
54
|
+
OPTION cmd_info CFDP CFDP_PDU PDU
|
55
|
+
OPTION root_path <%= root_path %>
|
56
|
+
<% if bucket.to_s.strip != '' %>
|
57
|
+
OPTION bucket <%= bucket %>
|
58
|
+
<% end %>
|
59
|
+
|
60
|
+
<% test_host = ENV['KUBERNETES_SERVICE_HOST'] ? (scope.to_s.downcase + "-interface-cfdp2-int-service") : "openc3-operator" %>
|
61
|
+
INTERFACE CFDP_INT tcpip_client_interface.rb <%= test_host %> 2907 2907 10.0 nil LENGTH 0 32 4 1 BIG_ENDIAN 0 nil nil true
|
62
|
+
MAP_TARGET CFDP
|
63
|
+
|
64
|
+
INTERFACE CFDP2_INT tcpip_server_interface.rb 2907 2907 10.0 nil LENGTH 0 32 4 1 BIG_ENDIAN 0 nil nil true
|
65
|
+
PORT 2907
|
66
|
+
MAP_TARGET CFDP2
|
67
|
+
<% end %>
|
@@ -0,0 +1,130 @@
|
|
1
|
+
require 'openc3/script/suite.rb'
|
2
|
+
require 'cfdp'
|
3
|
+
require 'tempfile'
|
4
|
+
|
5
|
+
# Group class name should indicate what the scripts are testing
|
6
|
+
class CfdpTestGroup < OpenC3::Group
|
7
|
+
def test_standard_ops
|
8
|
+
set_line_delay(0)
|
9
|
+
|
10
|
+
# Simple put and wait for complete
|
11
|
+
cfdp_put(destination_entity_id: 2, source_file_name: 'small.bin', destination_file_name: 'small2.bin', transmission_mode: "ACKNOWLEDGED")
|
12
|
+
|
13
|
+
# Start and cancel
|
14
|
+
transaction_id = cfdp_put(destination_entity_id: 2, source_file_name: 'medium.bin', destination_file_name: 'medium2.bin', transmission_mode: "ACKNOWLEDGED", timeout: nil)
|
15
|
+
wait(1)
|
16
|
+
cfdp_cancel(transaction_id: transaction_id)
|
17
|
+
|
18
|
+
# Longer put and interact while running
|
19
|
+
continuation = cfdp_subscribe()
|
20
|
+
transaction_id = cfdp_put(destination_entity_id: 2, source_file_name: 'medium.bin', destination_file_name: 'medium2.bin', transmission_mode: "ACKNOWLEDGED", timeout: nil)
|
21
|
+
wait(1)
|
22
|
+
puts cfdp_suspend(transaction_id: transaction_id)
|
23
|
+
wait(1)
|
24
|
+
puts cfdp_report(transaction_id: transaction_id)
|
25
|
+
wait(1)
|
26
|
+
puts cfdp_transactions()
|
27
|
+
wait(1)
|
28
|
+
puts cfdp_resume(transaction_id: transaction_id)
|
29
|
+
# Watch the transaction progress
|
30
|
+
set_line_delay(0.1)
|
31
|
+
done = false
|
32
|
+
while true
|
33
|
+
indications, continuation = cfdp_indications(continuation: continuation)
|
34
|
+
indications.each do |indication|
|
35
|
+
puts indication.inspect
|
36
|
+
if indication['indication_type'] == 'Transaction-Finished'
|
37
|
+
done = true
|
38
|
+
break
|
39
|
+
end
|
40
|
+
end
|
41
|
+
#puts cfdp_report(transaction_id: transaction_id)
|
42
|
+
puts cfdp_transactions().inspect
|
43
|
+
break if done
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def test_proxy_ops
|
48
|
+
set_line_delay(0)
|
49
|
+
|
50
|
+
# Simple proxy put and wait for complete
|
51
|
+
cfdp_put(remote_entity_id: 2, destination_entity_id: 1, source_file_name: 'small.bin', destination_file_name: 'small2.bin', transmission_mode: "ACKNOWLEDGED")
|
52
|
+
|
53
|
+
# Start and cancel
|
54
|
+
transaction_id = cfdp_put(remote_entity_id: 2, destination_entity_id: 1, source_file_name: 'medium.bin', destination_file_name: 'medium2.bin', transmission_mode: "ACKNOWLEDGED", timeout: nil)
|
55
|
+
wait(1)
|
56
|
+
cfdp_cancel(remote_entity_id: 2, transaction_id: transaction_id)
|
57
|
+
|
58
|
+
puts cfdp_transactions(microservice_name: 'CFDP2', prefix: '/cfdp2', port: 2906)
|
59
|
+
|
60
|
+
# Longer proxy put and interact while running
|
61
|
+
continuation = cfdp_subscribe()
|
62
|
+
source_transaction_id = cfdp_put(remote_entity_id: 2, destination_entity_id: 1, source_file_name: 'medium.bin', destination_file_name: 'medium2.bin', transmission_mode: "ACKNOWLEDGED", timeout: nil)
|
63
|
+
wait(1)
|
64
|
+
|
65
|
+
# Get the most recent transaction id from the other entity and assume that is the right one...
|
66
|
+
# The CFDP spec is lacking here
|
67
|
+
transactions = cfdp_transactions(microservice_name: 'CFDP2', prefix: '/cfdp2', port: 2906)
|
68
|
+
transaction_id = transactions[-1]['id']
|
69
|
+
puts cfdp_suspend(remote_entity_id: 2, transaction_id: transaction_id)
|
70
|
+
wait(1)
|
71
|
+
puts cfdp_report(remote_entity_id: 2, transaction_id: transaction_id, report_file_name: "myreport.txt")
|
72
|
+
wait(1)
|
73
|
+
puts cfdp_transactions(microservice_name: 'CFDP2', prefix: '/cfdp2', port: 2906)
|
74
|
+
wait(1)
|
75
|
+
puts cfdp_resume(remote_entity_id: 2, transaction_id: transaction_id)
|
76
|
+
# Watch the transaction progress
|
77
|
+
set_line_delay(0)
|
78
|
+
done = false
|
79
|
+
while true
|
80
|
+
indications, continuation = cfdp_indications(continuation: continuation)
|
81
|
+
indications.each do |indication|
|
82
|
+
puts indication.inspect unless indication['indication_type'] == 'File-Segment-Recv'
|
83
|
+
if indication['indication_type'] == 'Proxy-Put-Response' and indication['transaction_id'] == source_transaction_id
|
84
|
+
done = true
|
85
|
+
break
|
86
|
+
end
|
87
|
+
end
|
88
|
+
wait(0.1)
|
89
|
+
#puts cfdp_report(transaction_id: transaction_id)
|
90
|
+
puts cfdp_transactions(microservice_name: 'CFDP2', prefix: '/cfdp2', port: 2906)
|
91
|
+
break if done
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
def setup
|
96
|
+
set_line_delay(0)
|
97
|
+
|
98
|
+
# Create test files
|
99
|
+
data = "\x00" * 1000
|
100
|
+
|
101
|
+
# small.bin
|
102
|
+
file = Tempfile.new('cfdp')
|
103
|
+
1000.times do
|
104
|
+
file.write(data)
|
105
|
+
end
|
106
|
+
file.rewind
|
107
|
+
put_target_file("/CFDP/tmp/small.bin", file)
|
108
|
+
file.unlink
|
109
|
+
|
110
|
+
# medium.bin
|
111
|
+
file = Tempfile.new('cfdp')
|
112
|
+
10000.times do
|
113
|
+
file.write(data)
|
114
|
+
end
|
115
|
+
file.rewind
|
116
|
+
put_target_file("/CFDP/tmp/medium.bin", file)
|
117
|
+
file.unlink
|
118
|
+
end
|
119
|
+
|
120
|
+
def teardown
|
121
|
+
delete_target_file("/CFDP/tmp/small.bin")
|
122
|
+
delete_target_file("/CFDP/tmp/medium.bin")
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
class CfdpTestSuite < OpenC3::Suite
|
127
|
+
def initialize
|
128
|
+
add_group('CfdpTestGroup')
|
129
|
+
end
|
130
|
+
end
|
metadata
ADDED
@@ -0,0 +1,118 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: openc3-cosmos-cfdp
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ryan Melton
|
8
|
+
- Jason Thomas
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2023-05-15 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
14
|
+
description: " This plugin provides COSMOS Support for CFDP\n"
|
15
|
+
email:
|
16
|
+
- ryan@openc3.com
|
17
|
+
- jason@openc3.com
|
18
|
+
executables: []
|
19
|
+
extensions: []
|
20
|
+
extra_rdoc_files: []
|
21
|
+
files:
|
22
|
+
- LICENSE.txt
|
23
|
+
- README.md
|
24
|
+
- Rakefile
|
25
|
+
- lib/cfdp.rb
|
26
|
+
- lib/cfdp_api.rb
|
27
|
+
- microservices/CFDP/Gemfile
|
28
|
+
- microservices/CFDP/Rakefile
|
29
|
+
- microservices/CFDP/app/controllers/application_controller.rb
|
30
|
+
- microservices/CFDP/app/controllers/cfdp_controller.rb
|
31
|
+
- microservices/CFDP/app/models/cfdp_checksum.rb
|
32
|
+
- microservices/CFDP/app/models/cfdp_crc_checksum.rb
|
33
|
+
- microservices/CFDP/app/models/cfdp_mib.rb
|
34
|
+
- microservices/CFDP/app/models/cfdp_model.rb
|
35
|
+
- microservices/CFDP/app/models/cfdp_null_checksum.rb
|
36
|
+
- microservices/CFDP/app/models/cfdp_pdu.rb
|
37
|
+
- microservices/CFDP/app/models/cfdp_receive_transaction.rb
|
38
|
+
- microservices/CFDP/app/models/cfdp_source_transaction.rb
|
39
|
+
- microservices/CFDP/app/models/cfdp_topic.rb
|
40
|
+
- microservices/CFDP/app/models/cfdp_transaction.rb
|
41
|
+
- microservices/CFDP/app/models/cfdp_user.rb
|
42
|
+
- microservices/CFDP/bin/rails
|
43
|
+
- microservices/CFDP/bin/rake
|
44
|
+
- microservices/CFDP/bin/setup
|
45
|
+
- microservices/CFDP/config.ru
|
46
|
+
- microservices/CFDP/config/application.rb
|
47
|
+
- microservices/CFDP/config/boot.rb
|
48
|
+
- microservices/CFDP/config/credentials.yml.enc
|
49
|
+
- microservices/CFDP/config/environment.rb
|
50
|
+
- microservices/CFDP/config/environments/development.rb
|
51
|
+
- microservices/CFDP/config/environments/production.rb
|
52
|
+
- microservices/CFDP/config/environments/test.rb
|
53
|
+
- microservices/CFDP/config/initializers/application_controller_renderer.rb
|
54
|
+
- microservices/CFDP/config/initializers/backtrace_silencers.rb
|
55
|
+
- microservices/CFDP/config/initializers/cfdp_initializer.rb
|
56
|
+
- microservices/CFDP/config/initializers/cors.rb
|
57
|
+
- microservices/CFDP/config/initializers/filter_parameter_logging.rb
|
58
|
+
- microservices/CFDP/config/initializers/inflections.rb
|
59
|
+
- microservices/CFDP/config/initializers/mime_types.rb
|
60
|
+
- microservices/CFDP/config/initializers/wrap_parameters.rb
|
61
|
+
- microservices/CFDP/config/locales/en.yml
|
62
|
+
- microservices/CFDP/config/puma.rb
|
63
|
+
- microservices/CFDP/config/routes.rb
|
64
|
+
- microservices/CFDP/init.sh
|
65
|
+
- microservices/CFDP/lib/cfdp_pdu/cfdp_pdu_ack.rb
|
66
|
+
- microservices/CFDP/lib/cfdp_pdu/cfdp_pdu_enum.rb
|
67
|
+
- microservices/CFDP/lib/cfdp_pdu/cfdp_pdu_eof.rb
|
68
|
+
- microservices/CFDP/lib/cfdp_pdu/cfdp_pdu_file_data.rb
|
69
|
+
- microservices/CFDP/lib/cfdp_pdu/cfdp_pdu_finished.rb
|
70
|
+
- microservices/CFDP/lib/cfdp_pdu/cfdp_pdu_keep_alive.rb
|
71
|
+
- microservices/CFDP/lib/cfdp_pdu/cfdp_pdu_metadata.rb
|
72
|
+
- microservices/CFDP/lib/cfdp_pdu/cfdp_pdu_nak.rb
|
73
|
+
- microservices/CFDP/lib/cfdp_pdu/cfdp_pdu_prompt.rb
|
74
|
+
- microservices/CFDP/lib/cfdp_pdu/cfdp_pdu_tlv.rb
|
75
|
+
- microservices/CFDP/lib/cfdp_pdu/cfdp_pdu_user_ops.rb
|
76
|
+
- microservices/CFDP/public/robots.txt
|
77
|
+
- microservices/CFDP/spec/models/cfdp_pdu_ack_spec.rb
|
78
|
+
- microservices/CFDP/spec/models/cfdp_pdu_eof_spec.rb
|
79
|
+
- microservices/CFDP/spec/models/cfdp_pdu_file_data_spec.rb
|
80
|
+
- microservices/CFDP/spec/models/cfdp_pdu_finished_spec.rb
|
81
|
+
- microservices/CFDP/spec/models/cfdp_pdu_keep_alive_spec.rb
|
82
|
+
- microservices/CFDP/spec/models/cfdp_pdu_metadata_spec.rb
|
83
|
+
- microservices/CFDP/spec/models/cfdp_pdu_nak_spec.rb
|
84
|
+
- microservices/CFDP/spec/models/cfdp_pdu_prompt_spec.rb
|
85
|
+
- microservices/CFDP/spec/models/cfdp_pdu_spec.rb
|
86
|
+
- microservices/CFDP/spec/rails_helper.rb
|
87
|
+
- microservices/CFDP/spec/requests/cfdp_spec.rb
|
88
|
+
- microservices/CFDP/spec/spec_helper.rb
|
89
|
+
- plugin.txt
|
90
|
+
- targets/CFDPTEST/cmd_tlm/cmd.txt
|
91
|
+
- targets/CFDPTEST/cmd_tlm/tlm.txt
|
92
|
+
- targets/CFDPTEST/procedures/cfdp_test_suite.rb
|
93
|
+
- targets/CFDPTEST/target.txt
|
94
|
+
homepage: https://github.com/OpenC3/openc3
|
95
|
+
licenses:
|
96
|
+
- Nonstandard
|
97
|
+
metadata: {}
|
98
|
+
post_install_message:
|
99
|
+
rdoc_options: []
|
100
|
+
require_paths:
|
101
|
+
- lib
|
102
|
+
- microservices/CFDP/app/models
|
103
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
104
|
+
requirements:
|
105
|
+
- - ">="
|
106
|
+
- !ruby/object:Gem::Version
|
107
|
+
version: '0'
|
108
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
109
|
+
requirements:
|
110
|
+
- - ">="
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: '0'
|
113
|
+
requirements: []
|
114
|
+
rubygems_version: 3.3.26
|
115
|
+
signing_key:
|
116
|
+
specification_version: 4
|
117
|
+
summary: OpenC3 COSMOS CFDP
|
118
|
+
test_files: []
|