Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Communications Backbone System
backbone-message-format
Commits
b34399af
Commit
b34399af
authored
1 year ago
by
Trishna Saeharaseelan
Browse files
Options
Download
Plain Diff
Merge branch '28-add-binary-message-format' into 'dev'
feat: support binary payload Closes
#28
See merge request
!19
parents
fc7b4cf3
2c6c0920
Pipeline
#113991
passed with stages
in 1 minute and 11 seconds
Changes
30
Pipelines
2
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
881 additions
and
698 deletions
+881
-698
formats/mission_plan_encoded.py
formats/mission_plan_encoded.py
+10
-0
formats/observation_encoded.py
formats/observation_encoded.py
+10
-0
formats/planning_configuration.py
formats/planning_configuration.py
+2
-1
formats/platform_status_encoded.py
formats/platform_status_encoded.py
+10
-0
generate_schema_config.py
generate_schema_config.py
+15
-0
project/soar/swagger.json
project/soar/swagger.json
+825
-691
tests-js/docker/docker-compose.yml
tests-js/docker/docker-compose.yml
+2
-1
tests-js/soar-examples.test.js
tests-js/soar-examples.test.js
+5
-3
tests/fixtures/schemas.py
tests/fixtures/schemas.py
+1
-1
tests/fixtures/swagger.json
tests/fixtures/swagger.json
+1
-1
No files found.
formats/mission_plan_encoded.py
0 → 100644
View file @
b34399af
from
formats.encoded
import
encoded_schema
mission_plan_encoded_schema
=
encoded_schema
mission_plan_encoded_schema
[
"properties"
][
"message_type"
][
"enum"
]
=
[
"mission_plan_encoded"
]
mission_plan_encoded_schema
[
"properties"
][
"message_type"
][
"example"
]
=
"mission_plan_encoded"
This diff is collapsed.
Click to expand it.
formats/observation_encoded.py
0 → 100644
View file @
b34399af
from
formats.encoded
import
encoded_schema
observation_encoded_schema
=
encoded_schema
observation_encoded_schema
[
"properties"
][
"message_type"
][
"enum"
]
=
[
"observation_encoded"
]
observation_encoded_schema
[
"properties"
][
"message_type"
][
"example"
]
=
"observation_encoded"
This diff is collapsed.
Click to expand it.
formats/planning_configuration.py
View file @
b34399af
...
...
@@ -33,6 +33,7 @@ emergency_schema = {
"example"
:
10.0
,
},
"additional_data"
:
{
"type"
:
"object"
,
"description"
:
"Any addition fields/data to be added here"
,
"example"
:
{},
},
...
...
@@ -76,7 +77,7 @@ platform_schema = {
"description"
:
"Maximum altitude set for squad."
,
"example"
:
0.9
,
},
"additional_
specs
"
:
{
"additional_
data
"
:
{
"description"
:
"Any addition fields/data to be added here"
,
"example"
:
{
"swath_width"
:
10.0
,
"scan_type"
:
"DVL"
},
"type"
:
"object"
,
...
...
This diff is collapsed.
Click to expand it.
formats/platform_status_encoded.py
0 → 100644
View file @
b34399af
from
formats.encoded
import
encoded_schema
platform_status_encoded_schema
=
encoded_schema
platform_status_encoded_schema
[
"properties"
][
"message_type"
][
"enum"
]
=
[
"platform_status_encoded"
]
platform_status_encoded_schema
[
"properties"
][
"message_type"
][
"example"
]
=
"platform_status_encoded"
This diff is collapsed.
Click to expand it.
generate_schema_config.py
View file @
b34399af
from
formats
import
message_header
from
formats.mission_plan
import
mission_plan_schema
from
formats.mission_plan_encoded
import
mission_plan_encoded_schema
from
formats.observation
import
observation_schema
from
formats.observation_encoded
import
observation_encoded_schema
from
formats.planning_configuration
import
planning_configuration_schema
from
formats.platform_status
import
platform_status_schema
from
formats.platform_status_encoded
import
platform_status_encoded_schema
from
formats.acknowledgement
import
acknowledgement_schema
from
flasgger
import
Swagger
...
...
@@ -51,26 +54,38 @@ swagger_config = {
"propertyName"
:
"message_type"
,
"mapping"
:
{
"mission_plan"
:
"#/components/schemas/mission_plan"
,
"mission_plan_encoded"
:
"#/components/schemas/"
+
"mission_plan_encoded"
,
"observation"
:
"#/components/schemas/observation"
,
"observation_encoded"
:
"#/components/schemas/"
+
"observation_encoded"
,
"planning_configuration"
:
"#/components/schemas/"
+
"planning_configuration"
,
"platform_status"
:
"#/components/schemas/platform_status"
,
"platform_status_encoded"
:
"#/components/schemas/"
+
"platform_status_encoded"
,
"acknowledgement"
:
"#/components/schemas/acknowledgement"
,
},
},
"oneOf"
:
[
{
"$ref"
:
"#/components/schemas/acknowledgement"
},
{
"$ref"
:
"#/components/schemas/mission_plan"
},
{
"$ref"
:
"#/components/schemas/mission_plan_encoded"
},
{
"$ref"
:
"#/components/schemas/observation"
},
{
"$ref"
:
"#/components/schemas/observation_encoded"
},
{
"$ref"
:
"#/components/schemas/planning_configuration"
},
{
"$ref"
:
"#/components/schemas/platform_status"
},
{
"$ref"
:
"#/components/schemas/platform_status_encoded"
},
],
},
"header"
:
message_header
,
"mission_plan"
:
mission_plan_schema
,
"mission_plan_encoded"
:
mission_plan_encoded_schema
,
"observation"
:
observation_schema
,
"observation_encoded"
:
observation_encoded_schema
,
"planning_configuration"
:
planning_configuration_schema
,
"platform_status"
:
platform_status_schema
,
"platform_status_encoded"
:
platform_status_encoded_schema
,
"acknowledgement"
:
acknowledgement_schema
,
}
},
...
...
This diff is collapsed.
Click to expand it.
project/soar/swagger.json
View file @
b34399af
...
...
@@ -30,9 +30,11 @@
},
"message_type"
:{
"description"
:
"Type of message"
,
"enum"
:[
"acknowledgement"
],
"example"
:
"acknowledgement"
,
"type"
:
"string"
,
"enum"
:
[
"acknowledgement"
]
"type"
:
"string"
},
"platform_ID"
:{
"description"
:
"Unique identifier for this platform"
,
...
...
@@ -107,9 +109,11 @@
},
"message_type"
:{
"description"
:
"Type of message"
,
"enum"
:[
"mission_plan"
],
"example"
:
"mission_plan"
,
"type"
:
"string"
,
"enum"
:
[
"mission_plan"
]
"type"
:
"string"
},
"plan"
:{
"items"
:{
...
...
@@ -124,12 +128,6 @@
"example"
:
true
,
"type"
:
"boolean"
},
"timeout"
:
{
"description"
:
"Timeout set to perform action"
,
"example"
:
1800.0
,
"format"
:
"float"
,
"type"
:
"number"
},
"altitude"
:{
"description"
:
"Altitude of next action"
,
"example"
:
15.0
,
...
...
@@ -165,6 +163,12 @@
"example"
:
50.37072283932642
,
"format"
:
"float"
,
"type"
:
"number"
},
"timeout"
:{
"description"
:
"Timeout set to perform action"
,
"example"
:
1800.0
,
"format"
:
"float"
,
"type"
:
"number"
}
},
"required"
:[
...
...
@@ -189,6 +193,43 @@
],
"type"
:
"object"
},
"mission_plan_encoded"
:{
"properties"
:{
"data"
:{
"description"
:
"encoded string. E.g. Base64 encoded"
,
"example"
:
"SDQke4uwyP/YQQAgAhA2AND/nu8nvQAAAAAAAAAACtejPa5HHUGkcBAAAAIAAAAQAAAAAAAAAA9P2cP166ab+9cg=="
,
"type"
:
"string"
},
"file_name"
:{
"description"
:
"Name of file"
,
"example"
:
"ah1-0238126349247372.bin"
,
"type"
:
"string"
},
"is_binary"
:{
"description"
:
"True if the data field contains binary format data encoded as base64. False if the data field contains ascii content such as NMEA."
,
"example"
:
true
,
"type"
:
"boolean"
},
"message_type"
:{
"description"
:
"Type of message"
,
"enum"
:[
"mission_plan_encoded"
],
"example"
:
"mission_plan_encoded"
,
"type"
:
"string"
},
"mime_type"
:{
"description"
:
"MIME type"
,
"example"
:
"application/gzip"
,
"type"
:
"string"
}
},
"required"
:[
"data"
,
"is_binary"
],
"type"
:
"object"
},
"observation"
:{
"properties"
:{
"additional_data"
:{
...
...
@@ -199,9 +240,11 @@
},
"message_type"
:{
"description"
:
"Type of message"
,
"enum"
:[
"observation"
],
"example"
:
"observation"
,
"type"
:
"string"
,
"enum"
:
[
"observation"
]
"type"
:
"string"
},
"platform_ID"
:{
"description"
:
"Unique identifier for this platform"
,
...
...
@@ -251,14 +294,54 @@
],
"type"
:
"object"
},
"observation_encoded"
:{
"properties"
:{
"data"
:{
"description"
:
"encoded string. E.g. Base64 encoded"
,
"example"
:
"SDQke4uwyP/YQQAgAhA2AND/nu8nvQAAAAAAAAAACtejPa5HHUGkcBAAAAIAAAAQAAAAAAAAAA9P2cP166ab+9cg=="
,
"type"
:
"string"
},
"file_name"
:{
"description"
:
"Name of file"
,
"example"
:
"ah1-0238126349247372.bin"
,
"type"
:
"string"
},
"is_binary"
:{
"description"
:
"True if the data field contains binary format data encoded as base64. False if the data field contains ascii content such as NMEA."
,
"example"
:
true
,
"type"
:
"boolean"
},
"message_type"
:{
"description"
:
"Type of message"
,
"enum"
:[
"observation_encoded"
],
"example"
:
"observation_encoded"
,
"type"
:
"string"
},
"mime_type"
:{
"description"
:
"MIME type"
,
"example"
:
"application/gzip"
,
"type"
:
"string"
}
},
"required"
:[
"data"
,
"is_binary"
],
"type"
:
"object"
},
"payload"
:{
"discriminator"
:{
"mapping"
:{
"acknowledgement"
:
"#/components/schemas/acknowledgement"
,
"mission_plan"
:
"#/components/schemas/mission_plan"
,
"mission_plan_encoded"
:
"#/components/schemas/mission_plan_encoded"
,
"observation"
:
"#/components/schemas/observation"
,
"observation_encoded"
:
"#/components/schemas/observation_encoded"
,
"planning_configuration"
:
"#/components/schemas/planning_configuration"
,
"platform_status"
:
"#/components/schemas/platform_status"
"platform_status"
:
"#/components/schemas/platform_status"
,
"platform_status_encoded"
:
"#/components/schemas/platform_status_encoded"
},
"propertyName"
:
"message_type"
},
...
...
@@ -269,14 +352,23 @@
{
"$ref"
:
"#/components/schemas/mission_plan"
},
{
"$ref"
:
"#/components/schemas/mission_plan_encoded"
},
{
"$ref"
:
"#/components/schemas/observation"
},
{
"$ref"
:
"#/components/schemas/observation_encoded"
},
{
"$ref"
:
"#/components/schemas/planning_configuration"
},
{
"$ref"
:
"#/components/schemas/platform_status"
},
{
"$ref"
:
"#/components/schemas/platform_status_encoded"
}
]
},
...
...
@@ -317,9 +409,11 @@
},
"message_type"
:{
"description"
:
"Type of message"
,
"enum"
:[
"planning_configuration"
],
"example"
:
"planning_configuration"
,
"type"
:
"string"
,
"enum"
:
[
"planning_configuration"
]
"type"
:
"string"
},
"planning_config_ID"
:{
"description"
:
"Unique identifier tagged to version of this configuration plan"
,
...
...
@@ -338,21 +432,22 @@
"description"
:
"Squad consists of these platforms"
,
"items"
:{
"properties"
:{
"additional_
specs
"
:{
"additional_
data
"
:{
"description"
:
"Any addition fields/data to be added here"
,
"example"
:{
"scan_type"
:
"DVL"
,
"swath_width"
:
10.0
}
},
"type"
:
"object"
},
"emergency"
:{
"properties"
:{
"additional_data"
:{
"type"
:
"object"
,
"description"
:
"Any addition fields/data to be added here"
,
"example"
:{
},
"type"
:
"object"
}
},
"safe_command"
:{
"description"
:
"Command/Action that is native to respective partner's platform/C2"
,
...
...
@@ -563,9 +658,11 @@
},
"message_type"
:{
"description"
:
"Type of message"
,
"enum"
:[
"platform_status"
],
"example"
:
"platform_status"
,
"type"
:
"string"
,
"enum"
:
[
"platform_status"
]
"type"
:
"string"
},
"mission_plan_ID"
:{
"description"
:
"Mission plan ID according to platform-C2 system"
,
...
...
@@ -678,6 +775,43 @@
"longitude"
],
"type"
:
"object"
},
"platform_status_encoded"
:{
"properties"
:{
"data"
:{
"description"
:
"encoded string. E.g. Base64 encoded"
,
"example"
:
"SDQke4uwyP/YQQAgAhA2AND/nu8nvQAAAAAAAAAACtejPa5HHUGkcBAAAAIAAAAQAAAAAAAAAA9P2cP166ab+9cg=="
,
"type"
:
"string"
},
"file_name"
:{
"description"
:
"Name of file"
,
"example"
:
"ah1-0238126349247372.bin"
,
"type"
:
"string"
},
"is_binary"
:{
"description"
:
"True if the data field contains binary format data encoded as base64. False if the data field contains ascii content such as NMEA."
,
"example"
:
true
,
"type"
:
"boolean"
},
"message_type"
:{
"description"
:
"Type of message"
,
"enum"
:[
"platform_status_encoded"
],
"example"
:
"platform_status_encoded"
,
"type"
:
"string"
},
"mime_type"
:{
"description"
:
"MIME type"
,
"example"
:
"application/gzip"
,
"type"
:
"string"
}
},
"required"
:[
"data"
,
"is_binary"
],
"type"
:
"object"
}
}
},
...
...
This diff is collapsed.
Click to expand it.
tests-js/docker/docker-compose.yml
View file @
b34399af
...
...
@@ -6,5 +6,6 @@ services:
dockerfile
:
tests-js/docker/Dockerfile
container_name
:
soar_js_test
volumes
:
-
../../:/app
-
../../examples:/app/examples
-
../../project:/app/project
command
:
"
yarn
test"
This diff is collapsed.
Click to expand it.
tests-js/soar-examples.test.js
View file @
b34399af
...
...
@@ -3,7 +3,7 @@ const Validator = require('swagger-model-validator');
const
OpenAPISchemaValidator
=
require
(
'
openapi-schema-validator
'
).
default
;
const
getSchema
=
()
=>
{
const
schema
=
require
(
`
${
__dirname
}
/../project
s
/soar/swagger.json`
);
const
schema
=
require
(
`
${
__dirname
}
/../project/soar/swagger.json`
);
return
schema
;
};
...
...
@@ -46,9 +46,11 @@ describe('examples validate', () => {
validation
=
validateMessage
(
message
,
schema
);
valid
=
validation
.
valid
;
if
(
!
valid
)
{
console
.
log
(
`validation:
${
messageFile
}
`
,
validation
);
console
.
log
(
`validation:
${
messageFile
}
`
,
validation
.
GetErrorMessages
()
);
payloadValidation
=
validateMessage
(
message
.
payload
,
schema
,
message
.
payload
.
message_type
)
console
.
log
(
`payload
${
message
.
payload
.
message_type
}
`
,
payloadValidation
);
if
(
!
payloadValidation
.
valid
)
{
console
.
log
(
`payload
${
message
.
payload
.
message_type
}
`
,
payloadValidation
.
GetErrorMessages
());
}
}
expect
(
valid
).
toBe
(
true
);
});
...
...
This diff is collapsed.
Click to expand it.
tests/fixtures/schemas.py
View file @
b34399af
...
...
@@ -311,7 +311,7 @@ platform_schema = {
"description"
:
"Maximum altitude set for squad."
,
"example"
:
0.9
,
},
"additional_
specs
"
:
{
"additional_
data
"
:
{
"description"
:
"Any addition fields/data to be added here"
,
"example"
:
{
"swath_width"
:
10.0
,
"scan_type"
:
"DVL"
},
},
...
...
This diff is collapsed.
Click to expand it.
tests/fixtures/swagger.json
View file @
b34399af
...
...
@@ -322,7 +322,7 @@
"description"
:
"Squad consists of these platforms"
,
"items"
:
{
"properties"
:
{
"additional_
specs
"
:
{
"additional_
data
"
:
{
"description"
:
"Any addition fields/data to be added here"
,
"example"
:
{
"scan_type"
:
"DVL"
,
...
...
This diff is collapsed.
Click to expand it.
Prev
1
2
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment