Commit 0cda8650 authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Common - Tools - Object Factory:

- Updated PolicyRule composers
parent cb9050b2
Loading
Loading
Loading
Loading
+11 −7
Original line number Diff line number Diff line
@@ -22,19 +22,23 @@ def json_policyrule_id(policyrule_uuid : str) -> Dict:
    return {'uuid': {'uuid': policyrule_uuid}}

def json_policyrule(
    policyrule_uuid : str, policy_priority : int = 1, policy_kpi_id : str = '',
    policy_state : PolicyRuleStateEnum = PolicyRuleStateEnum.POLICY_UNDEFINED, policy_state_message : str = '',
    action_list : List[Dict] = [], service_id : Optional[Dict] = None, device_id_list : List[Dict] = []
    policyrule_uuid : str,
    state : PolicyRuleStateEnum = PolicyRuleStateEnum.POLICY_UNDEFINED, state_message : str = '',
    priority : int = 1, action_list : List[Dict] = [], list_kpi_id : List[str] = list(),
    service_id : Optional[Dict] = None, device_id_list : List[Dict] = []
) -> Dict:
    basic = {
        'policyRuleId': json_policyrule_id(policyrule_uuid),
        'policyRuleState': {
            'policyRuleState': policy_state,
            'policyRuleStateMessage': policy_state_message,
            'policyRuleState': state,
            'policyRuleStateMessage': state_message,
        },
        'priority': policy_priority,
        'kpiId': {'kpi_id': {'uuid': policy_kpi_id}},
        'policyRulePriority': priority,
        'actionList': action_list,
        'policyRuleKpiList': [
            {'policyRuleKpiUuid': {'uuid': kpi_id}}
            for kpi_id in list_kpi_id
        ],
    }

    result = {}