{ "version": "1.0", "name": "NIOS update network EA", "comment": "Will search for other networks with same Building ID EA value and overwrite empty Country, Cluster, City, Area & Building EA values", "type": "REST_EVENT", "event_type": ["NETWORK_IPV4"], "action_type": "Update network EA", "content_type": "application/json", "vendor_identifier": "NIOS WAPI v2.7", "quoting": "XML", "steps": [ { "name": "stop if a delete", "operation": "CONDITION", "condition": { "condition_type": "AND", "statements": [ { "left": "${E:A:operation_type}", "op": "==", "right": "DELETE" } ], "stop": true } }, { "name": "stop if no Building ID EA value provided in the new created network", "operation": "CONDITION", "condition": { "condition_type": "NAND", "statements": [ { "left": "${E:A:values{extattrs}{Building_ID}{value}}", "op": "=~", "right": ".+" } ], "stop": true } }, { "name": "stop if it is not a network insert", "operation": "CONDITION", "condition": { "condition_type": "AND", "statements": [ { "left": "${E:A:operation_type}", "op": "!=", "right": "INSERT" } ], "stop": true } }, { "name": "get network with same EA value", "operation": "GET", "transport": { "path": "network?*Area~=.*&*Country~=.*&*Cluster~=.*&*City~=.*&*Building~=.*&_max_results=1&_return_fields=network,comment,extattrs&_return_type=xml&*Building_ID:=${E:A:values{extattrs}{Building_ID}{value}}" }, "parse": "XML" }, { "name": "store Country, Cluster, City, Area & Building EA values", "operation": "NOP", "body_list": [ "${XC:COPY:{L:Country}:{P:list{value}{extattrs}{Country}{value}}}", "${XC:COPY:{L:Cluster}:{P:list{value}{extattrs}{Cluster}{value}}}", "${XC:COPY:{L:City}:{P:list{value}{extattrs}{City}{value}}}", "${XC:COPY:{L:Area}:{P:list{value}{extattrs}{Area}{value}}}", "${XC:COPY:{L:Building}:{P:list{value}{extattrs}{Building}{value}}}" ] }, { "name": "check get network with same EA was successful", "operation": "CONDITION", "condition": { "condition_type": "OR", "statements": [ { "left": "${R::RC}", "op": "!=", "right": "200" } ], "stop": true } }, { "name": "update network with EA", "operation": "PUT", "transport": { "path": "${E:A:values{_ref}}" }, "body_list": [ "{", "\"extattrs+\": {", "\"Country\": { \"value\": \"${L::Country}\" },", "\"Cluster\": { \"value\": \"${L::Cluster}\" },", "\"City\": { \"value\": \"${L::City}\" },", "\"Area\": { \"value\": \"${L::Area}\" },", "\"Building\": { \"value\": \"${L::Building}\" }", "},", "\"comment\": \"Updated via Outbound API at ${UT::TIME}\"", "}" ] }, { "name": "check put EA was successful", "operation": "CONDITION", "condition": { "condition_type": "OR", "statements": [ { "left": "${R::RC}", "op": "!=", "right": "200" } ], "stop": true } } ] }