{"type":"api","title":"Update the given subservice class","meta":{"id":"/apps/pubhub/media/crosswork-network-controller-7-1/f445c17e25a1120e8fbde4bd413083d0fd88b2b3/42552ab7-d679-37b0-afe0-7313ad2e8c01","info":{"title":"Service Health Heuristic Packages APIs","description":"APIs for requesting rule and metric data stored by the Crosswork Service Health application.","termsOfService":"terms-of-service","contact":{"name":"Crosswork Team, Cisco","email":"support@cisco.com"},"license":{"name":"Cisco Software License Agreement","url":"http://www.cisco.com/public/sw-license-agreement.html"},"version":"7.1.0"},"security":[{"bearerAuth":[]}],"x-parser-conf":{"overview":{"markdownPath":"reference/ServiceHealth/sh_heuristic_packages_overview.md"}},"openapi":"3.0.1","servers":[{"url":"/crosswork/aa/hpmgr"}],"securitySchemes":{"bearerAuth":{"type":"apiKey","description":"Security token for authorizing requests for these APIs.","name":"Authorization","in":"header"}}},"spec":{"tags":["AaHeuristicPackage"],"summary":"Update the given subservice class.","operationId":"AaHeuristicPackage_UpdateSubserviceClass","requestBody":{"description":"The SubserviceClass request parameter.","content":{"application/json":{"schema":{"type":"object","description":"Subservice class","properties":{"id":{"description":"The subservice class to be monitored (such as LinkHealth, IP-Reachability, etc.)","type":"string"},"name":{"type":"string","description":"The name of the subservice class"},"namespace":{"description":"The namespace to which the subservice class belongs","type":"string"},"description":{"description":"Description of the SubserviceClass.","type":"string"},"params":{"type":"array","description":"Contains the list of parameter keys that this subservice class uses. These need to be passed as arguments when instantiating the respective subservices.","items":{"type":"object","description":"The Heuristic Package Element parameter.","properties":{"name":{"type":"string","description":"Name of this parameter. Examples: DEVICE, IFNAME, IFENTRY, VPN."},"description":{"type":"string","description":"The description of the Heuristic Package Element parameter."},"type":{"type":"string","description":"ParamType allows Heuristic Package Manager to interpret the nature of the argument values passed while instantiating Heuristic Package Elements like Rule, Subservice etc.","default":"PARAM_TYPE_NON_LIST","enum":["PARAM_TYPE_NON_LIST","PARAM_TYPE_LIST"],"$$ref":"#/components/schemas/HPElemParamType"}},"$$ref":"#/components/schemas/HPElemParam"}},"live_metrics":{"type":"object","description":"Live metrics","additionalProperties":{"type":"object","description":"Use this object when a Subservice needs to report live (not necessarily real-time) metrics in addition to its overall health status. For example: A Subservice monitoring the health of SR Policies needs to report latency, jitter and packet loss. It also needs to report its consolidated health status, computed by comparing these metrics against threshold values. SubserviceClassLiveMetric allows a set of metrics to be identified as live metrics. The feed for these metrics will be reported periodically by Expression Tracker. These metrics will be persisted by Subservice instances to aid subsequent queries. If these metrics need to be aggregated at the service level, then you can do this by setting the service_level_aggregation_method. Aggregation is supported for metrics of the same type. In other words, if Latency is specified as a SubserviceClassLiveMetric and aggregation_method is set to, say, Average, then the average of Latency metrics is taken across all instances of this Subservice Class that belong to a given service instance.\n!! Caution: Please use Live Metrics sparingly as they can put significant stress on the system's CPU and memory resources. !!","properties":{"metric_label":{"description":"Metric label","type":"string"},"description":{"description":"Description","type":"string"},"threshold":{"type":"string","description":"Threshold"},"aggr_logic":{"type":"string","description":"Used to provide a benchmark reference to the user looking at the metric value. For example: threshold = 'LATENCY_MAX_THRESHOLD'. Similar to the constants specified in the eval_expression strings, this constant too should be resolvable by the respective nConfig Profile associated with the service. This field is optional and can be left empty.","default":"NONE","enum":["NONE","AVERAGE","MEDIAN","MODE"],"$$ref":"#/components/schemas/LiveMetricServiceLevelAggrLogic"}},"$$ref":"#/components/schemas/SubserviceClassLiveMetric"}},"root_expressions":{"type":"array","description":"Root expressions","items":{"type":"object","properties":{"eval_expression":{"type":"string","description":"Eval Expression"},"activate_condition":{"type":"string","description":"Activate Condition"}},"description":"Each SubserviceClass can contain a list of root expressions. The 'activate_condition' defined for each element will determine whether the computation, represented by 'eval_expression', will be made part of the overall compute expression tree of that Subservice instance. The 'activate_condition' should either be left empty or, if non-empty, should evaluate to 'true' to be part of the compute expression tree. When an element is part of the compute expression tree, then all corresponding metrics will be scheduled for collection. This conditional logic is handy when a network feature has multiple parts to be monitored and each of these parts can be selectively enabled or disabled by the Operator using service configuration. For example: Y.1731 monitoring for Latency, Jittter and Loss. Each of these can be selectively enabled or disabled via Y.1731 configuration. If only Latency probes are configured, then Y.1731-Subservice should only be scheduling jobs for latency and none for jitter or loss.","$$ref":"#/components/schemas/SubserviceClassRootExpression"}},"dynamic_config":{"type":"object","properties":{"rule_id":{"type":"string","description":"Dynamic dependency for a subservice. The subservice uses the rule ID to compute the dynamic subservices."},"rule_params":{"type":"object","additionalProperties":{"type":"string","description":"Additional properties"},"description":"The map of parameters needed to build the dynamic subservice. The key corresponds to ruleClass parameters and the value corresponds to SSClass parameters."},"rule_trigger_conditions":{"type":"object","description":"Dynamic Config Rule Trigger Conditions.","properties":{"description":{"type":"string","description":"Description"},"activate":{"type":"string","description":"Determines when to trigger the Rule and spawn child subservices."},"deactivate":{"type":"string","description":"Determines when to delete all the child subservices."},"update":{"type":"string","description":"Determines whether the current sub-graph needs to be evaluated with the new feed received."}},"$$ref":"#/components/schemas/DynamicConfigRuleTriggerConditions"}},"description":"Sample payload for dynamic_dependencies: \n\"dynamicConfig\": {\n\"ruleID\": \"rule.dynamic.l2vpn.sr.policy.subgraph system\",\n\"ruleParams\": [\n{\n\"serviceId\": \"vpn-id\"\n},\n{\n\"srpolicies\": \"srpolicy_list\"\n}\n],\n\"ruleTriggerConditions\": {\n\"description\": \"Activate when at least one dynamic SR Policy gets instantiated. Deactivate (sample for now) when a certain condition is met (3 policies). Update as long as the number of discovered policies is less than 20.\",\n\"activate\": \"Len(srpolicy_list) \u003e 0\",\n\"deactivate\": \"Len(srpolicy_list) \u003e 2\",\n\"update\": \"Delta(srpolicy_list) and Len(srpolicy_list) \u003c= 20\"\n}\n},","$$ref":"#/components/schemas/DynamicConfig"},"symptom":{"type":"object","properties":{"format_string":{"type":"string","description":"Format-string"},"level":{"type":"string","description":"Symptom level","default":"BROKEN","enum":["BROKEN","DEGRADED","WARNING","CRITICAL","INFO"],"$$ref":"#/components/schemas/SymptomLevel"},"priority":{"description":"The lower the value, higher the priority. The lowest valid value is 1, so the highest priority is represented by '1'. When this value is not explicitly defined in the SubserviceClass, the value defaults to '255' in the backend. This is the behavior even in cases where the priority in the SubserviceClass is explicitly defined as '0'.","type":"integer","format":"int64"},"preempt_priority":{"type":"integer","description":"Preempt priority is used to determine whether a symptom should preempt another symptom that belongs\nto the same preemption group. Example: When Interface Operational state is down due to Admin state\nbeing down, then User would need to see only Admin down symptom and not Operational down symptom.\nTo make this happen, we group Admin down and Operational down symptoms under one preemption group --\nany arbitrary string that identifies the group nature of these 2 symptoms. Then we assign higher\npremption priority, say 1, to Admin associated symptom and lower premption priority, say 2,\nto Oper associated symptom.\nBy default, no preemption is enabled i.e., all symptoms defined within a Subservice Class will\nbelong to the same group and have same default preempt_priority value 0.","format":"int64"},"preempt_group":{"type":"string","description":"preempt_group"},"raise_when":{"type":"boolean","description":"Determines whether to raise a symptom when its associated expression evaluates to true or false.\nDefault(false), raises symptom when the respective eval_expression evaluates to false.\nIf set to true, then symptom is raised when the respective eval_expression evaluates to true."}},"description":"The symptom text and the failed subexpressions.","$$ref":"#/components/schemas/SubserviceClassSymptom"},"dependencies":{"type":"array","description":"Dependencies","items":{"type":"object","description":"Subservice Class Dependency","properties":{"type":{"type":"string","description":"Dependency Type:\n - DEP_TYPE_EXPRESSION: DEP_TYPE_SUBSERVICE = 1. Not supported for MVP-1","default":"DEP_TYPE_UNSPECIFIED","enum":["DEP_TYPE_UNSPECIFIED","DEP_TYPE_EXPRESSION","DEP_TYPE_METRIC"],"$$ref":"#/components/schemas/SubserviceClassDependencyType"},"label":{"type":"string","description":"Label used to refer to this Dependency elsewhere, within this SubserviceType definition. The label acts as the key."},"eval_expression":{"description":"The compute-expression to be evaluated by this dependency. Note that this property is currently overloaded in order to provide ClassNames for Subservice or Metric types of dependencies. It may be better to have separate fields for this purpose. ","type":"string"},"namespace":{"type":"string","description":"In case of Metric and Rule Dependency types, specify the namespace. If not specified, it defaults to the current Subservice Class namespace."},"symptom":{"type":"object","properties":{"format_string":{"type":"string","description":"Format-string"},"level":{"type":"string","description":"Symptom level","default":"BROKEN","enum":["BROKEN","DEGRADED","WARNING","CRITICAL","INFO"],"$$ref":"#/components/schemas/SymptomLevel"},"priority":{"description":"The lower the value, higher the priority. The lowest valid value is 1, so the highest priority is represented by '1'. When this value is not explicitly defined in the SubserviceClass, the value defaults to '255' in the backend. This is the behavior even in cases where the priority in the SubserviceClass is explicitly defined as '0'.","type":"integer","format":"int64"},"preempt_priority":{"type":"integer","description":"Preempt priority is used to determine whether a symptom should preempt another symptom that belongs\nto the same preemption group. Example: When Interface Operational state is down due to Admin state\nbeing down, then User would need to see only Admin down symptom and not Operational down symptom.\nTo make this happen, we group Admin down and Operational down symptoms under one preemption group --\nany arbitrary string that identifies the group nature of these 2 symptoms. Then we assign higher\npremption priority, say 1, to Admin associated symptom and lower premption priority, say 2,\nto Oper associated symptom.\nBy default, no preemption is enabled i.e., all symptoms defined within a Subservice Class will\nbelong to the same group and have same default preempt_priority value 0.","format":"int64"},"preempt_group":{"type":"string","description":"preempt_group"},"raise_when":{"type":"boolean","description":"Determines whether to raise a symptom when its associated expression evaluates to true or false.\nDefault(false), raises symptom when the respective eval_expression evaluates to false.\nIf set to true, then symptom is raised when the respective eval_expression evaluates to true."}},"description":"The symptom text and the failed subexpressions.","$$ref":"#/components/schemas/SubserviceClassSymptom"},"param_map":{"description":"Map of dependency Subservice/Metric parameters to current Subservice Class parameters","type":"object","additionalProperties":{"type":"string"}},"id":{"description":"Unique ID allocated by Service Health","type":"string"}},"$$ref":"#/components/schemas/SubserviceClassDependency"}},"expr_cid":{"description":"ID allocated by HP for subservice expression","type":"string"},"create_timestamp":{"description":"The time when this SubserviceClass definition was created or last updated","type":"string","format":"int64"},"update_timestamp":{"type":"string","description":"Update Timestamp","format":"int64"},"tags":{"description":"The tags associate to the list of badges displayed in the UI. For example: To display the 'degraded' badge against the device icon when either the device or its service-related VPN-interface degrades, you can assign tags to those classes. The UI will leverage these tags to determine which of the subservices must be displayed with badges against the device.","type":"array","items":{"type":"string"}},"version":{"description":"The current version of the subServiceClass","type":"string"}},"$$ref":"#/components/schemas/SubserviceClass"},"example":{"name":"subservice.bgp.nbr.health","namespace":"custom","description":"BGP Neighbor health.","params":[{"name":"device","type":"PARAM_TYPE_NON_LIST"}],"rootExpressions":["ListElemsAnd([ bgp_session_active for bgp_nbr_ipaddr in bgp_nbr_list])"],"dependencies":[{"type":"DEP_TYPE_EXPRESSION","label":"bgp_session_active","eval_expression":"bgp_session_state == 'up'","symptom":{"format_string":"BGP Session to neighbor {bgp_nbr_ipaddr} is not up.","level":"DEGRADED"}},{"type":"DEP_TYPE_METRIC","label":"bgp_session_state","eval_expression":"metric.bgp.session.state","paramMap":{"device":"device","neighbor-ip":"bgp_nbr_ipaddr"}},{"type":"DEP_TYPE_METRIC","label":"bgp_nbr_list","eval_expression":"metric.bgp.neighbors.ipaddr.list","paramMap":{"device":"device"}}]}}},"required":true},"responses":{"200":{"description":"OK. The request was successful. The result is contained in the response body.","content":{"application/json":{"schema":{"type":"object","description":"Response for the Heuristic Package Element CRUD.","properties":{"status":{"type":"string","description":"Response status for the Heuristic Package Element CRUD.","default":"RESP_STATUS_UNKNOWN","enum":["RESP_STATUS_UNKNOWN","RESP_STATUS_SUCCESS","RESP_STATUS_ERROR"],"$$ref":"#/components/schemas/HpCrudResponseStatus"},"error_description":{"description":"The reason for the error.","type":"string"},"name":{"description":"The name of the Heuristic Package Element.","type":"string"},"namespace":{"description":"The namespace of the Heuristic Package Element.","type":"string"}},"$$ref":"#/components/schemas/HpCrudResponse"},"example":{"data":[{"status":"RESP_STATUS_SUCCESS","name":"subserviceClass.sample","namespace":"custom"}]}}}},"default":{"description":"An empty response.","content":{"application/json":{"schema":{"type":"object","description":"Runtime error","properties":{"error":{"type":"string","description":"Error of Runtime error"},"code":{"type":"integer","description":"Code of Runtime error","format":"int32"},"message":{"type":"string","description":"Message of Runtime error"},"details":{"type":"array","description":"Details of Runtime error","items":{"type":"object","description":"ProtobufAny","properties":{"type_url":{"type":"string","description":"Type-url of ProtobufAny"},"value":{"pattern":"^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$","type":"string","description":"Value of ProtobufAny","format":"byte"}},"$$ref":"#/components/schemas/protobufAny"}}},"$$ref":"#/components/schemas/runtimeError"},"example":{"data":[{"status":"RESP_STATUS_SUCCESS"}]}}}}},"x-codegen-request-body-name":"body","__originalOperationId":"AaHeuristicPackage_UpdateSubserviceClass","security":[{"bearerAuth":[]}],"method":"put","path":"/updateSubserviceClass"}}