{"type":"api","title":"Evaluate json-query expressions","meta":{"id":"/apps/pubhub/media/crosswork-network-controller-7-2/76fd4bb9d069fd2530d7a02f0b3a4ca00eccfd35/773d8c2d-0de2-3906-8d3f-8a19d6895750","info":{"title":"Crosswork Workflow Manager Solutions - Automations","description":"The automation service acts as an orchestrator, handling the scheduling, execution,\nbatch processing, and monitoring of MOPs and their activities. The API provides endpoints for managing these operations.","contact":{"name":"Crosswork Team, Cisco","email":"support@cisco.com"},"license":{"name":"Cisco Software License Agreement","url":"https://www.cisco.com/public/sw-license-agreement.html"},"version":"7.2.0"},"x-parser-conf":{"overview":{"markdownPath":"reference/CWM-SOLUTIONS/automations-api.overview.md"}},"openapi":"3.0.1","servers":[{"url":"https://crosswork-ip:30603/crosswork/cwms/automations/v1"}]},"spec":{"tags":["Workflow Utilities"],"summary":"Evaluate json-query expressions","description":"Once the device command is converted into a JSON structure, this API allows you\nto verify specific conditions against the current device state. Each condition\nis defined as a tuple consisting of a \"condition,\" which represents the actual\nJSON query; a \"status,\" an enumeration of success, warning, and failure indicating\nthe condition's status; and a \"message,\" which provides an explanation of the device's condition.","operationId":"evaluateJsonQueryExpressions","requestBody":{"description":"Expressions to evaluate","content":{"application/json":{"schema":{"type":"object","description":"Evaluate request object","properties":{"expressions":{"type":"array","description":"List of expressions to evaluate","items":{"type":"object","additionalProperties":true}},"input":{"type":"string","description":"Input JSON data"}},"$$ref":"#/components/schemas/EvalRequest"},"examples":{"installProgressCheck":{"summary":"Check if device is ready for install","value":{"expressions":[{"condition":".[] | .ACTIVITY | contains(\"No install operation in progress\") | not","message":"device is not ready for install request","status":"error"}],"input":"[]"}},"versionPresenceCheck":{"summary":"Verify version field is present and not empty","value":{"expressions":[{"condition":".[] | (.Version != null and .Version != \"\")","message":"Version check passed","status":"success"}],"input":"[{\"Version\":\"7.8.1\"}]"}},"versionEmptyCheck":{"summary":"Fail if version is empty","value":{"expressions":[{"condition":".[] | .Version != \"\"","message":"Version check failed","status":"error"}],"input":"[{\"Version\":\"7.8.1\"}]"}},"successRateCheck":{"summary":"Validate 100% success rate","value":{"expressions":[{"condition":".[] | .successRate | tonumber == 100","message":"Success rate is 100 percent.","status":"success"}],"input":"[{\"pingErrMsg\":\"\",\"successRate\":\"100\"}]"}},"junosStorageCheck":{"summary":"Verify sufficient storage for Junos update","value":{"expressions":[{"condition":".\"system-storage-information\".filesystem[]| select(.\"filesystem-name\" == \"/dev/gpt/junos\") | .\"available-blocks\" * 512 \u003e 5500000000","message":"Insufficient storage for update.","status":"success"}],"input":"{\n \"system-storage-information\": {\n \"filesystem\": [\n {\n \"available-blocks\": 14481984,\n \"filesystem-name\": \"/dev/gpt/junos\",\n \"mounted-on\": \"/.mount\",\n \"total-blocks\": 44306520,\n \"used-blocks\": 26280016,\n \"used-percent\": 64\n },\n {\n \"available-blocks\": 43437544,\n \"filesystem-name\": \"tmpfs\",\n \"mounted-on\": \"/.mount/tmp\",\n \"total-blocks\": 43437560,\n \"used-blocks\": 16,\n \"used-percent\": 0\n },\n {\n \"available-blocks\": 5569472,\n \"filesystem-name\": \"tmpfs\",\n \"mounted-on\": \"/.mount/mfs\",\n \"total-blocks\": 5572736,\n \"used-blocks\": 3264,\n \"used-percent\": 0\n }\n ]\n }\n}"}}}}},"required":true},"responses":{"200":{"description":"Evaluated expressions","content":{"application/json":{"schema":{"type":"string"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"type":"object","description":"A structure to hold the error details","properties":{"code":{"type":"integer","description":"HTTP status code"},"message":{"type":"string","description":"Error message"},"status":{"type":"string","description":"Status"},"statusInt":{"type":"integer","description":"Status integer"}},"$$ref":"#/components/schemas/AutomationsError"}}}},"406":{"description":"API requests are not acceptable at this time","content":{"application/json":{"schema":{"type":"object","description":"A structure to hold the standard response","properties":{"code":{"type":"integer","description":"HTTP status code"},"key":{"type":"string","description":"Key to retrieve the job details"},"message":{"type":"string","description":"Message"},"status":{"type":"string","description":"Status"},"statusInt":{"type":"integer","description":"Status integer"}},"$$ref":"#/components/schemas/StandardResponse"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","description":"A structure to hold the error details","properties":{"code":{"type":"integer","description":"HTTP status code"},"message":{"type":"string","description":"Error message"},"status":{"type":"string","description":"Status"},"statusInt":{"type":"integer","description":"Status integer"}},"$$ref":"#/components/schemas/AutomationsError"}}}}},"x-codegen-request-body-name":"body","__originalOperationId":"evaluateJsonQueryExpressions","method":"post","path":"/cwms-utils/evaluate"}}