diff --git a/CHANGELOG.md b/CHANGELOG.md index 5a520d84ee4d256664277dab38d00704517ad341..62c1bb77bed7e749615ecd1d23f64de0d2181354 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,15 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +### Changed + +- Updated README to run tests against JS dependencies + +### Added + +- Emergency flag in mission plan schemas + + ## [v0.1.0] - 2023-03-24 ### Added diff --git a/README.md b/README.md index 12bf69ce85099a0219fa27269fe6c7fda188e86e..e2e22cc0b46bb73f95e69f51bee61f651b2b7bd4 100644 --- a/README.md +++ b/README.md @@ -74,10 +74,15 @@ Run the command below and go to `http://127.0.0.1:5000` python3 generate_schema_config.py ``` ## Run Tests -Run the command below +Run both tests below: +1. Test 1 ``` python3 -m unittest tests/test_schemas.py ``` +2. Test 2 +``` +cd tests-js/docker; docker compose up --build +``` ## Quick Links 1. [Generated Swagger Docs (recommended to look at this)](https://git.noc.ac.uk/communications-backbone-system/backbone-message-format/-/blob/dev/project/soar/swagger.json) diff --git a/examples/autonomy_engine_adapter/emergency_mission_command.json b/examples/autonomy_engine_adapter/emergency_mission_command.json new file mode 100644 index 0000000000000000000000000000000000000000..3937af2463aa9a7192c18ff6bb476ecb4b4e00f0 --- /dev/null +++ b/examples/autonomy_engine_adapter/emergency_mission_command.json @@ -0,0 +1,24 @@ +{ + "header": { + "message_ID": "b427003c-0000-11aa-a1eb-bvcdfghjgfdd", + "timestamp": "2022-11-16T00:00:00Z", + "version": 2, + "source": "gui", + "destination": "soar.noc.autosub.alr-52.to_platform.mission_plan", + "delivery_type": "publish", + "encoded": false + }, + "payload":{ + "message_type": "mission_plan", + "platform_ID": "5-ah1", + "autonomy_engine_plan_ID": 1, + "emergency": true, + "plan": [ + { + "action": "safety_abort", + "target_waypoint_latitude": -3.237143188645706, + "target_waypoint_longitude": 52.37072283932642 + } + ] + } + } \ No newline at end of file diff --git a/examples/autonomy_engine_adapter/emergency_mission_plan.json b/examples/autonomy_engine_adapter/emergency_mission_plan.json new file mode 100644 index 0000000000000000000000000000000000000000..8ab9cd517ca78e09a57f7c696b787b2669a9ba28 --- /dev/null +++ b/examples/autonomy_engine_adapter/emergency_mission_plan.json @@ -0,0 +1,30 @@ +{ + "header": { + "message_ID": "b427003c-0000-11aa-a1eb-bvcdfghjgfdd", + "timestamp": "2022-11-16T00:00:00Z", + "version": 2, + "source": "gui", + "destination": "soar.noc.autosub.alr-52.to_platform.mission_plan", + "delivery_type": "publish", + "encoded": false + }, + "payload":{ + "message_type": "mission_plan", + "platform_ID": "5-ah1", + "autonomy_engine_plan_ID": 1, + "emergency": true, + "plan": [ + { + "action": "move", + "target_waypoint_latitude": -3.237143188645706, + "target_waypoint_longitude": 52.37072283932642, + "depth": 5.0 + }, + { + "action": "safety_abort", + "target_waypoint_latitude": -3.237143188645706, + "target_waypoint_longitude": 52.37072283932642 + } + ] + } + } \ No newline at end of file diff --git a/examples/gui_adapter/emergency_mission_command.json b/examples/gui_adapter/emergency_mission_command.json new file mode 100644 index 0000000000000000000000000000000000000000..3937af2463aa9a7192c18ff6bb476ecb4b4e00f0 --- /dev/null +++ b/examples/gui_adapter/emergency_mission_command.json @@ -0,0 +1,24 @@ +{ + "header": { + "message_ID": "b427003c-0000-11aa-a1eb-bvcdfghjgfdd", + "timestamp": "2022-11-16T00:00:00Z", + "version": 2, + "source": "gui", + "destination": "soar.noc.autosub.alr-52.to_platform.mission_plan", + "delivery_type": "publish", + "encoded": false + }, + "payload":{ + "message_type": "mission_plan", + "platform_ID": "5-ah1", + "autonomy_engine_plan_ID": 1, + "emergency": true, + "plan": [ + { + "action": "safety_abort", + "target_waypoint_latitude": -3.237143188645706, + "target_waypoint_longitude": 52.37072283932642 + } + ] + } + } \ No newline at end of file diff --git a/examples/gui_adapter/emergency_mission_plan.json b/examples/gui_adapter/emergency_mission_plan.json new file mode 100644 index 0000000000000000000000000000000000000000..8ab9cd517ca78e09a57f7c696b787b2669a9ba28 --- /dev/null +++ b/examples/gui_adapter/emergency_mission_plan.json @@ -0,0 +1,30 @@ +{ + "header": { + "message_ID": "b427003c-0000-11aa-a1eb-bvcdfghjgfdd", + "timestamp": "2022-11-16T00:00:00Z", + "version": 2, + "source": "gui", + "destination": "soar.noc.autosub.alr-52.to_platform.mission_plan", + "delivery_type": "publish", + "encoded": false + }, + "payload":{ + "message_type": "mission_plan", + "platform_ID": "5-ah1", + "autonomy_engine_plan_ID": 1, + "emergency": true, + "plan": [ + { + "action": "move", + "target_waypoint_latitude": -3.237143188645706, + "target_waypoint_longitude": 52.37072283932642, + "depth": 5.0 + }, + { + "action": "safety_abort", + "target_waypoint_latitude": -3.237143188645706, + "target_waypoint_longitude": 52.37072283932642 + } + ] + } + } \ No newline at end of file diff --git a/formats/__init__.py b/formats/__init__.py index e7e9b0006c0178a09b011dff9ec343b9b1e6a637..96c6be008d8b1895aed1f89f92272359f4a0dcd1 100644 --- a/formats/__init__.py +++ b/formats/__init__.py @@ -44,7 +44,7 @@ message_header = { "encoded": { "type": "boolean", "description": "Indicate that message raw (encoded) or decoded. " - + "Options: encoded=True, decoded=False", + + "Options: encoded=true, decoded=false", "example": False, }, "delivery_type": { diff --git a/formats/encoded.py b/formats/encoded.py index 8d6d700686a0db7797b070a28a73f46cd04a91c7..e6bb57418526233593878c6788ff7b8982baf70d 100644 --- a/formats/encoded.py +++ b/formats/encoded.py @@ -32,8 +32,8 @@ encoded_schema = { "is_binary": { "type": "boolean", "description": ( - "True if the data field contains binary format data encoded as base64." - + " False if the data field contains ascii content such as NMEA." + "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, }, diff --git a/formats/mission_plan.py b/formats/mission_plan.py index 4a97375a42b304a73a026bc9de8a4add7b5e0fcd..6aa69d95a362e16816982ed96a49c0cb41ec95eb 100644 --- a/formats/mission_plan.py +++ b/formats/mission_plan.py @@ -88,6 +88,13 @@ mission_plan_schema = { "description": "Unique identifier for this platform", "example": "reav-x-1", }, + "emergency": { + "type": "boolean", + "description": "To indicate if this is an emergency. " + + "true = emergency and false = no emergency", + "default": False, + "example": False, + }, "plan": { "type": "array", "items": action_schema, diff --git a/formats/platform_status.py b/formats/platform_status.py index f0e0cb6a0ca1558bb4e16a9bdf5c72f6e7ad7189..ff31eac345ad92694a9c3480bd9f6ca1f9a36022 100644 --- a/formats/platform_status.py +++ b/formats/platform_status.py @@ -14,7 +14,7 @@ sensor_schema = { }, "sensor_on": { "type": "boolean", - "description": "Sensor switched on (True) or off (False)", + "description": "Sensor switched on (true) or off (false)", "example": True, }, "additional_data": { diff --git a/project/soar/swagger.json b/project/soar/swagger.json index 21820ba31d36ee6e833382f917c4013da6f2c018..bdbda617a744ee60a429f6dbe11e65dc37a5df1f 100644 --- a/project/soar/swagger.json +++ b/project/soar/swagger.json @@ -71,7 +71,7 @@ "type":"string" }, "encoded":{ - "description":"Indicate that message raw (encoded) or decoded. Options: encoded=True, decoded=False", + "description":"Indicate that message raw (encoded) or decoded. Options: encoded=true, decoded=false", "example":false, "type":"boolean" }, @@ -115,6 +115,12 @@ "example":"mission_plan", "type":"string" }, + "emergency": { + "default": false, + "description": "To indicate if this is an emergency. true = emergency and false = no emergency", + "example": false, + "type": "boolean" + }, "plan":{ "items":{ "properties":{ @@ -206,7 +212,7 @@ "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.", + "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" }, @@ -307,7 +313,7 @@ "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.", + "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" }, @@ -710,7 +716,7 @@ "type":"object" }, "sensor_on":{ - "description":"Sensor switched on (True) or off (False)", + "description":"Sensor switched on (true) or off (false)", "example":true, "type":"boolean" }, @@ -789,7 +795,7 @@ "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.", + "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" }, diff --git a/tests/fixtures/schemas.py b/tests/fixtures/schemas.py index dcc6ac34602bbfcfbb73ac284e7202bae6fb3b9c..9cbc2151a6aaa8b263ecf883e14de1210918fa62 100644 --- a/tests/fixtures/schemas.py +++ b/tests/fixtures/schemas.py @@ -35,7 +35,7 @@ message_header = { "encoded": { "type": "boolean", "description": "Indicate that message raw (encoded) or decoded. " - + "Options: encoded=True, decoded=False", + + "Options: encoded=true, decoded=false", "example": False, }, "delivery_type": { @@ -165,6 +165,13 @@ mission_plan_schema = { "description": "Unique identifier for this platform", "example": "reav-x-1", }, + "emergency": { + "default": False, + "description": "To indicate if this is an emergency. " + + "true = emergency and false = no emergency", + "example": False, + "type": "boolean", + }, "plan": { "type": "array", "items": action_schema, @@ -430,7 +437,7 @@ sensor_schema = { }, "sensor_on": { "type": "boolean", - "description": "Sensor switched on (True) or off (False)", + "description": "Sensor switched on (true) or off (false)", "example": True, }, "additional_data": { diff --git a/tests/fixtures/swagger.json b/tests/fixtures/swagger.json index a1db4bff435b9686156a7372002b2bb7823302bb..eca6c9bfd728535d7a6509c597f4e532efcc6460 100644 --- a/tests/fixtures/swagger.json +++ b/tests/fixtures/swagger.json @@ -69,7 +69,7 @@ "type": "string" }, "encoded": { - "description": "Indicate that message raw (encoded) or decoded. Options: encoded=True, decoded=False", + "description": "Indicate that message raw (encoded) or decoded. Options: encoded=true, decoded=false", "example": false, "type": "boolean" }, @@ -110,6 +110,12 @@ "example": "mission_plan", "type": "string" }, + "emergency": { + "default": false, + "description": "To indicate if this is an emergency. true = emergency and false = no emergency", + "example": false, + "type": "boolean" + }, "plan": { "items": { "properties": { @@ -586,7 +592,7 @@ } }, "sensor_on": { - "description": "Sensor switched on (True) or off (False)", + "description": "Sensor switched on (true) or off (false)", "example": true, "type": "boolean" },