diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b54ef27d35c53739a6d507cc23aa0a7a6061fe2..6c815e476de217f3dee30a60438f99e298c83ead 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### Changed +- Refactor instruction_set into platform_instruction_set - Refactor mission_plan schema autonomy_engine_plan_ID oneOf - Update all example messages with valid UUIDs - Refactor action schema to accept geojson.Points diff --git a/examples/mas-dt/instruction_set.json b/examples/mas-dt/instruction_set.json deleted file mode 100644 index d98094685fe9664a42226a565cc7b9872b98a2d6..0000000000000000000000000000000000000000 --- a/examples/mas-dt/instruction_set.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "header": { - "message_ID": "b427003c-0000-11aa-a1eb-b1cdf2342fdd", - "timestamp": "2024-09-03T00:00:00Z", - "version": 1, - "source": "ori", - "destination": "internal.noc.slocum.unit_111.to_platform.instruction_set", - "delivery_type": "publish", - "encoded": false - }, - "payload": { - "message_type": "instruction_set", - "categories": { - "speed": "slow", - "data_transmission": "normal" - }, - "files": [ - { - "name": "yo95.ma", - "content": "YmVoYXZpb3JfbmFtZT15bw0KIyB5bzM1Lm1hDQojIFN0YW5kYXJkIFlPIEZpbGUgZmlsZSBnMiBvciBnMyBOT0MgZ2xpZGVycw0KIyAgMSBZTw0KIyAgMzBtIGRlcHRoDQojICBBbHRpbWV0ZXIgT24gYXQgbWF4aW11biBzcGVlZA0KIyAgQXV0b2JhbGxhc3Qgb24gLSBGdWxsIEJ1b3lhbmN5DQojICBCYXR0ZXJ5IE1vZGUgU2Vydm8gMjYgZGVlZ3JlZXMNCiMgU2VlIC9kb2NvL2h3LWl0LXdvcmtzL2F1dG9iYWxsYXN0LnR4dCBhbmQgbWFzdGVyZGF0YSBmb3IgZnVsbCBsaXN0IG9mIGJfYXJncy4NCiMgMjIgLSBBdWd1c3QgMjAxNiBhbHZhcm8ubG9yZW56b0Bub2MuYWMudWsNCiMgMDIgLSBEZWMgMjAyMSBiZW4uYWxsc3VwQG5vYyBjbGVhbiB1cCBmb3IgZzMgYW5kIHRocnVzdGVyIHVzYWdlDQoNCjxzdGFydDpiX2FyZz4JDQojICAgIGJfYXJnOiBudW1faGFsZl9jeWNsZXNfdG9fZG8obm9kaW0pIDIgCQkJIyBOdW1iZXIgb2YgZGl2ZS9jbGltYnMgdG8gcGVyZm9ybQ0KCQkJCQkJCQkJCQkJCQ0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgDQojIGFyZ3VtZW50cyBmb3IgZGl2ZV90bw0KICAgIGJfYXJnOiBkX2JwdW1wX3ZhbHVlKFgpIAkgICAgICAJMzAwLjAgCQkjIHRvdGFsIGRyaXZlIHZvbHVtZSBmb3IgYXV0b2JhbGxhc3QNCiAgICBiX2FyZzogZF9waXRjaF92YWx1ZShYKSAgIAkgICAgICAJLTAuMzQ5ICAJIyAtMjAgZGVnDQogICANCiMgYXJndW1lbnRzIGZvciBjbGltYl90bw0KICAgIGJfYXJnOiBjX3BpdGNoX3ZhbHVlKFgpICAgICAJCTAuMzQ5ICAgICAgICMgKzIwIGRlZw0KDQo8ZW5kOmJfYXJnPg0K", - "static": { - "no_half_cycles_to_do": 2, - "d_bpump_value": 300.0, - "d_pitch_value": -0.349, - "c_pitch_value": 0.349 - } - }, - { - "name": "tbdlist.dat", - "content": "IyMjIG1hbmRhdG9yeSB0aW1lIGluZm9ybWF0aW9uIGF0IGZ1bGwgcmVzb2x1dGlvbg0KU0NJX01fUFJFU0VOVF9USU1FDQpTQ0lfTV9QUkVTRU5UX1NFQ1NfSU5UT19NSVNTSU9ODQoNCiMjIyMjIyMjIyBzdGFuZGFyZCBDVEQgaW5mb3JtYXRpb24gIyMjIyMjIyMjIyMjIyMjIyMNCiMjIyByZWNvbW1lbmRlZCBzYW1wbGUgcmF0ZSA6IDwgMTAgc2Vjb25kcw0KU0NJX1dBVEVSX0NPTkQgICAgICAgICAxMCAjIHRvIHNhbXBsZSBldmVyeSBvdGhlciB5byBvbiBkb3duY2FzdCBvbmx5LCB1c2UgMTAgMSAtMSAyDQpTQ0lfV0FURVJfVEVNUCAgICAgICAgIDEwDQpTQ0lfV0FURVJfUFJFU1NVUkUgICAgIDEwDQojU0NJX0NURDQxQ1BfVElNRVNUQU1QICAxMA==", - "static": { - "SCI_WATER_COND": 10, - "SCI_WATER_TEMP": 10, - "SCI_WATER_PRESSURE": 10 - } - }, - { - "name": "sample99.ma", - "content": "YmVoYXZpb3JfbmFtZT1zYW1wbGUNCjxzdGFydDpiX2FyZz4NCiAgICBiX2FyZzogbnRoX3lvX3RvX3NhbXBsZShub2RpbSkgICAgICAgICAgICAJMiAgCSAjIENoZWNrIG1hc3RlcmRhdGENCiAgICBiX2FyZzogbWF4X2RlcHRoKG0pICAgICAgICAgICAgICAgICAgIAkgMjAwMCAgICAjIENoZWNrIG1hc3RlcmRhdGENCjxlbmQ6Yl9hcmc+DQo=", - "static": { - "nth_yo_to_sample": 2, - "max_depth": 2000 - } - } - ] - } -} \ No newline at end of file diff --git a/examples/mas-dt/planning_configuration.json b/examples/mas-dt/planning_configuration.json index 58991aa03dc521b7a98d1a8614ae39d820d07ac8..fc34ee7e5b9726acd6722252550da1258c2553c5 100644 --- a/examples/mas-dt/planning_configuration.json +++ b/examples/mas-dt/planning_configuration.json @@ -89,7 +89,6 @@ ], "instructions": [ { - "message_type": "instruction_set", "categories": { "speed": "slow", "data_transmission": "normal" diff --git a/examples/mas-dt/platform_instruction_set.json b/examples/mas-dt/platform_instruction_set.json new file mode 100644 index 0000000000000000000000000000000000000000..4f42e1997d1068b4eb1bb4a7f1cc8ae3aeeb6e7e --- /dev/null +++ b/examples/mas-dt/platform_instruction_set.json @@ -0,0 +1,50 @@ +{ + "header": { + "message_ID": "b427003c-0000-11aa-a1eb-b1cdf2342fdd", + "timestamp": "2024-09-03T00:00:00Z", + "version": 1, + "source": "ori", + "destination": "internal.noc.slocum.unit_111.to_platform.instruction_set", + "delivery_type": "publish", + "encoded": false + }, + "payload": { + "message_type": "platform_instruction_set", + "platform_ID": "unit_111", + "instruction_set": { + "categories": { + "speed": "slow", + "data_transmission": "normal" + }, + "files": [ + { + "name": "yo95.ma", + "content": "YmVoYXZpb3JfbmFtZT15bw0KIyB5bzM1Lm1hDQojIFN0YW5kYXJkIFlPIEZpbGUgZmlsZSBnMiBvciBnMyBOT0MgZ2xpZGVycw0KIyAgMSBZTw0KIyAgMzBtIGRlcHRoDQojICBBbHRpbWV0ZXIgT24gYXQgbWF4aW11biBzcGVlZA0KIyAgQXV0b2JhbGxhc3Qgb24gLSBGdWxsIEJ1b3lhbmN5DQojICBCYXR0ZXJ5IE1vZGUgU2Vydm8gMjYgZGVlZ3JlZXMNCiMgU2VlIC9kb2NvL2h3LWl0LXdvcmtzL2F1dG9iYWxsYXN0LnR4dCBhbmQgbWFzdGVyZGF0YSBmb3IgZnVsbCBsaXN0IG9mIGJfYXJncy4NCiMgMjIgLSBBdWd1c3QgMjAxNiBhbHZhcm8ubG9yZW56b0Bub2MuYWMudWsNCiMgMDIgLSBEZWMgMjAyMSBiZW4uYWxsc3VwQG5vYyBjbGVhbiB1cCBmb3IgZzMgYW5kIHRocnVzdGVyIHVzYWdlDQoNCjxzdGFydDpiX2FyZz4JDQojICAgIGJfYXJnOiBudW1faGFsZl9jeWNsZXNfdG9fZG8obm9kaW0pIDIgCQkJIyBOdW1iZXIgb2YgZGl2ZS9jbGltYnMgdG8gcGVyZm9ybQ0KCQkJCQkJCQkJCQkJCQ0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgDQojIGFyZ3VtZW50cyBmb3IgZGl2ZV90bw0KICAgIGJfYXJnOiBkX2JwdW1wX3ZhbHVlKFgpIAkgICAgICAJMzAwLjAgCQkjIHRvdGFsIGRyaXZlIHZvbHVtZSBmb3IgYXV0b2JhbGxhc3QNCiAgICBiX2FyZzogZF9waXRjaF92YWx1ZShYKSAgIAkgICAgICAJLTAuMzQ5ICAJIyAtMjAgZGVnDQogICANCiMgYXJndW1lbnRzIGZvciBjbGltYl90bw0KICAgIGJfYXJnOiBjX3BpdGNoX3ZhbHVlKFgpICAgICAJCTAuMzQ5ICAgICAgICMgKzIwIGRlZw0KDQo8ZW5kOmJfYXJnPg0K", + "static": { + "no_half_cycles_to_do": 2, + "d_bpump_value": 300.0, + "d_pitch_value": -0.349, + "c_pitch_value": 0.349 + } + }, + { + "name": "tbdlist.dat", + "content": "IyMjIG1hbmRhdG9yeSB0aW1lIGluZm9ybWF0aW9uIGF0IGZ1bGwgcmVzb2x1dGlvbg0KU0NJX01fUFJFU0VOVF9USU1FDQpTQ0lfTV9QUkVTRU5UX1NFQ1NfSU5UT19NSVNTSU9ODQoNCiMjIyMjIyMjIyBzdGFuZGFyZCBDVEQgaW5mb3JtYXRpb24gIyMjIyMjIyMjIyMjIyMjIyMNCiMjIyByZWNvbW1lbmRlZCBzYW1wbGUgcmF0ZSA6IDwgMTAgc2Vjb25kcw0KU0NJX1dBVEVSX0NPTkQgICAgICAgICAxMCAjIHRvIHNhbXBsZSBldmVyeSBvdGhlciB5byBvbiBkb3duY2FzdCBvbmx5LCB1c2UgMTAgMSAtMSAyDQpTQ0lfV0FURVJfVEVNUCAgICAgICAgIDEwDQpTQ0lfV0FURVJfUFJFU1NVUkUgICAgIDEwDQojU0NJX0NURDQxQ1BfVElNRVNUQU1QICAxMA==", + "static": { + "SCI_WATER_COND": 10, + "SCI_WATER_TEMP": 10, + "SCI_WATER_PRESSURE": 10 + } + }, + { + "name": "sample99.ma", + "content": "YmVoYXZpb3JfbmFtZT1zYW1wbGUNCjxzdGFydDpiX2FyZz4NCiAgICBiX2FyZzogbnRoX3lvX3RvX3NhbXBsZShub2RpbSkgICAgICAgICAgICAJMiAgCSAjIENoZWNrIG1hc3RlcmRhdGENCiAgICBiX2FyZzogbWF4X2RlcHRoKG0pICAgICAgICAgICAgICAgICAgIAkgMjAwMCAgICAjIENoZWNrIG1hc3RlcmRhdGENCjxlbmQ6Yl9hcmc+DQo=", + "static": { + "nth_yo_to_sample": 2, + "max_depth": 2000 + } + } + ] + } + } +} \ No newline at end of file diff --git a/formats/payload.py b/formats/payload.py index ac8f87ca913a48f2212b9968c6d84f899c4ae651..70098885cec6e61102d2e86ce4e1e9fd11b5c0eb 100644 --- a/formats/payload.py +++ b/formats/payload.py @@ -3,13 +3,13 @@ payload_schema = { "propertyName": "message_type", "mapping": { "alert": "#/components/schemas/alert", - "instruction_set": "#/components/schemas/instruction_set", "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_instruction_set": "#/components/schemas/platform_instruction_set", "platform_status": "#/components/schemas/platform_status", "platform_status_encoded": "#/components/schemas/" + "platform_status_encoded", @@ -22,12 +22,12 @@ payload_schema = { "oneOf": [ {"$ref": "#/components/schemas/alert"}, {"$ref": "#/components/schemas/acknowledgement"}, - {"$ref": "#/components/schemas/instruction_set"}, {"$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_instruction_set"}, {"$ref": "#/components/schemas/platform_status"}, {"$ref": "#/components/schemas/platform_status_encoded"}, {"$ref": "#/components/schemas/survey"}, diff --git a/formats/planning_configuration.py b/formats/planning_configuration.py index 485c2ac066d36c9e44c46d4405109f26e4f65a00..7b5bc1721982c85d5ed220665254af3c68c20e50 100644 --- a/formats/planning_configuration.py +++ b/formats/planning_configuration.py @@ -2,7 +2,7 @@ schemas: configuration sent to Autonomy Engine (i.e. during an emergency, if a platform needs to be removed from the mission planning) """ -from .instruction_set import instruction_set_schema +from .platform_instruction_set import instruction_set_schema emergency_schema = { "type": "object", diff --git a/formats/instruction_set.py b/formats/platform_instruction_set.py similarity index 72% rename from formats/instruction_set.py rename to formats/platform_instruction_set.py index 2fadbb64f9e844d37c7c7a2ca4de61047476afbf..4264dc9c12be1406184fd17554281afd52b8d66b 100644 --- a/formats/instruction_set.py +++ b/formats/platform_instruction_set.py @@ -33,12 +33,6 @@ config_file_schema = { instruction_set_schema = { "type": "object", "properties": { - "message_type": { - "type": "string", - "description": "Type of message", - "example": "instruction_set", - "enum": ["instruction_set"], - }, "categories": { "type": "object", }, @@ -48,7 +42,26 @@ instruction_set_schema = { }, }, "required": [ - "message_type", "files", ], } + + +platform_instruction_set_schema = { + "type": "object", + "properties": { + "message_type": { + "type": "string", + "description": "Type of message", + "example": "platform_instruction_set", + "enum": ["platform_instruction_set"], + }, + "platform_ID": { + "type": "string", + "description": "Unique identifier for this platform", + "example": "reav-x-1", + }, + "instruction_set": instruction_set_schema, + }, + "required": ["message_type", "platform_ID", "instruction_set"], +} diff --git a/generate_schema_config.py b/generate_schema_config.py index 2ff507a6ff03061c4c5541f66ee34a078e8d65b8..9875549b14a185003e1ddea6e66a4bdc914fa4d3 100644 --- a/generate_schema_config.py +++ b/generate_schema_config.py @@ -13,7 +13,11 @@ from formats.survey import survey_schema from formats.survey_encoded import survey_encoded_schema from formats.acknowledgement import acknowledgement_schema from formats.alert import alert_schema -from formats.instruction_set import config_file_schema, instruction_set_schema +from formats.platform_instruction_set import ( + config_file_schema, + instruction_set_schema, + platform_instruction_set_schema, +) from flasgger import Swagger from flask import Flask @@ -67,6 +71,7 @@ def get_swagger_config(reload=False): "observation": observation_schema, "observation_encoded": observation_encoded_schema, "planning_configuration": planning_configuration_schema, + "platform_instruction_set": platform_instruction_set_schema, "platform_status": platform_status_schema, "platform_status_encoded": platform_status_encoded_schema, "survey": survey_schema, diff --git a/project/soar/swagger.json b/project/soar/swagger.json index aa0b4449261bfb3e6dfc95c2cbc234251797b582..4ba43f11da9e0090c180be61c418b67b7d964515 100644 --- a/project/soar/swagger.json +++ b/project/soar/swagger.json @@ -1511,18 +1511,9 @@ "type": "object" }, "type": "array" - }, - "message_type": { - "description": "Type of message", - "enum": [ - "instruction_set" - ], - "example": "instruction_set", - "type": "string" } }, "required": [ - "message_type", "files" ], "type": "object" @@ -1818,12 +1809,12 @@ "mapping": { "acknowledgement": "#/components/schemas/acknowledgement", "alert": "#/components/schemas/alert", - "instruction_set": "#/components/schemas/instruction_set", "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_instruction_set": "#/components/schemas/platform_instruction_set", "platform_status": "#/components/schemas/platform_status", "platform_status_encoded": "#/components/schemas/platform_status_encoded", "survey": "#/components/schemas/survey", @@ -1839,9 +1830,6 @@ { "$ref": "#/components/schemas/acknowledgement" }, - { - "$ref": "#/components/schemas/instruction_set" - }, { "$ref": "#/components/schemas/mission_plan" }, @@ -1857,6 +1845,9 @@ { "$ref": "#/components/schemas/planning_configuration" }, + { + "$ref": "#/components/schemas/platform_instruction_set" + }, { "$ref": "#/components/schemas/platform_status" }, @@ -1912,18 +1903,9 @@ "type": "object" }, "type": "array" - }, - "message_type": { - "description": "Type of message", - "enum": [ - "instruction_set" - ], - "example": "instruction_set", - "type": "string" } }, "required": [ - "message_type", "files" ], "type": "object" @@ -2217,6 +2199,71 @@ ], "type": "object" }, + "platform_instruction_set": { + "properties": { + "instruction_set": { + "properties": { + "categories": { + "type": "object" + }, + "files": { + "items": { + "properties": { + "content": { + "description": "Base64 encoded file content", + "example": "SDQke4uwyP/YQQAgAhA2AND/nu8nvQAAAAAAAAAACtejPa5HHUGkcBAAAAIAAAAQAAAAAAAAAA9P2cP166ab+9cg==", + "type": "string" + }, + "mime_type": { + "description": "MIME type", + "example": "text/plain", + "type": "string" + }, + "name": { + "description": "Name of file", + "example": "yo95.ma", + "type": "string" + }, + "static": { + "description": "list of the fixed values set by the config file", + "type": "object" + } + }, + "required": [ + "name", + "content" + ], + "type": "object" + }, + "type": "array" + } + }, + "required": [ + "files" + ], + "type": "object" + }, + "message_type": { + "description": "Type of message", + "enum": [ + "platform_instruction_set" + ], + "example": "platform_instruction_set", + "type": "string" + }, + "platform_ID": { + "description": "Unique identifier for this platform", + "example": "reav-x-1", + "type": "string" + } + }, + "required": [ + "message_type", + "platform_ID", + "instruction_set" + ], + "type": "object" + }, "platform_status": { "oneOf": [ {