def validate(action, definitions_index): if TemplateFields.ACTION_TARGET not in action: LOG.error('%s status code: %s' % (status_msgs[124], 124)) return get_content_fault_result(124) action_target = action[TemplateFields.ACTION_TARGET] for key in [TemplateFields.TARGET, TemplateFields.SOURCE]: if key not in action_target: LOG.error('%s status code: %s' % (status_msgs[130], 130)) return get_content_fault_result(130) template_id = action_target[key] result = validate_template_id(definitions_index, template_id) if not result.is_valid_config: return result entity = definitions_index[template_id] result = AddCausalRelationshipValidator._validate_entity_category( entity, EntityCategory.ALARM) if not result.is_valid_config: return result return get_content_correct_result()
def validate(action, definitions_index): if TemplateFields.ACTION_TARGET not in action: LOG.error('%s status code: %s' % (status_msgs[124], 124)) return get_content_fault_result(124) action_target = action[TemplateFields.ACTION_TARGET] if TemplateFields.TARGET not in action_target: LOG.error('%s status code: %s' % (status_msgs[131], 131)) return get_content_fault_result(131) target = action_target[TemplateFields.TARGET] return validate_template_id(definitions_index, target)