.. _assignmid: ================== AssignResources ================== 1. Subarray Node provides API for **AssignResources workflow**. 2. **Input JSON** is as per schema detailed at : https://developer.skao.int/projects/ska-schemas/en/latest/schemas/tmc/ska-tmc-assignresources.html 3. Assign Resources prepares a mid subarray for later configuration by assigning resources in CSP (pulsar search and timing beams), and optionally SDP (receptors, execution block context). It transitions the observation state from **EMPTY** to **RESOURCING** and on success to **IDLE**. 4. The Sub-array node **accepts the command** if :- A. **Admin mode** reported by each of the system - CSP,SDP subarray are in **ONLINE/ENGINEERING/RESERVED** B. Operational **state** of the Sub-array node is **ON/OFF/INIT/STANDBY/ALARM** 5. The Sub-array Node **rejects the command** if :- A. **Admin mode** reported by each of the system - CSP,SDP Sub-array are in **OFFLINE or NOT FITTED**. B. Operational **state** of the sub-array node is **FAULT/UNKNOWN/DISABLE** . 6. The following **state requirements** are applied for the **command execution** :- A. TMC Subarray is in `'observation state'` **EMPTY** or **IDLE** . B. :term:`isSubarrayAvailable` is checked to ensure the subsystems (CSP and SDP) are :term:`available` 7. The **command execution** involves below **key operations** :- A. The **Input JSON** is validated and if malformed , and Command is `'Failed'` with **exception message** :- B. **Array layout** JSON from TelModel is downloaded . C. **Input jsons are prepared** for each of the subsystems as follows :- **Dish**- Creates dish leaf node and dish device FQDNs using input receptor ids. Command is not sent to Dishes as such **SDP**- No changes inside the "sdp" block of json itself , it is forwarded as it is to SDP subarry Leaf Node. **CSP**- Sets interface field specified by the CspAssignResourcesInterfaceURL property specified in helm chart of the TMC Subarray node D. When command is invoked on the relevant CSP, SDP, leaf Nodes. + If leaf node **rejects** assign resources command , command failure is reported as **'RESULT_CODE - FAILED'** on Long Running Command Result attribute of the TMC Subarray node.Command will not be sent to remaining subsystems in this case if multiple subsystems are involved . + If **all** leaf node **accept** command , the TMC Subarray node will wait for command completion. 8. The Sub-array node **monitors the progress** of command via the Sub-array node **ObsState transitions** and the **long running command results**. A. Command is **successful** when the TMC Subarray Node transitions to **IDLE** ObsState. This is reported as **'RESULT_CODE - OK'** on Long Running Command Result attribute of the Subarray node. B. Command **failure** is reported in any of the below cases as **'RESULT_CODE - FAILED**' on Long Running Command Result attribute of the Subarray node. + The CSP Leaf node/SDP Leaf node reports **'RESULT_CODE - FAILED'** on its Long Running Command Result attribute + The command **times out** if TMC SubarrayNode does not transition to **IDLE** within the timeout period specified by `CommandTimeOutDefault` property specified in helm chart of the TMC Subarray node . 9. On **success** the system is **ready for Configure**; on **failure** it may revert to **EMPTY** or **FAULT** depending on severity. 10. Once command is completed **receiveAddresses** attribute gets populated from SDP Subarray node .Once it is received `pointing_cal` information is used to update **sdpQueueConnectorFqdn** attribute of the Dish