diff --git a/proto/policy.proto b/proto/policy.proto index 575bc57645d5ce20b7a1b7b1a0c2ec86896706ac..51ea63b7f3754ef7e3fa48a6a50ebd21c8d496cf 100644 --- a/proto/policy.proto +++ b/proto/policy.proto @@ -18,6 +18,7 @@ package policy; import "context.proto"; import "policy_condition.proto"; import "policy_action.proto"; +import "monitoring.proto"; // to be migrated to: "kpi_manager.proto" service PolicyService { rpc PolicyAddService (PolicyRuleService) returns (PolicyRuleState) {} @@ -58,11 +59,10 @@ message PolicyRuleBasic { PolicyRuleId policyRuleId = 1; PolicyRuleState policyRuleState = 2; //policy.proto:58:12: Explicit 'optional' labels are disallowed in the Proto3 syntax. To define 'optional' fields in Proto3, simply remove the 'optional' label, as fields are 'optional' by default. uint32 priority = 3; + monitoring.KpiId kpiId = 4; // to be migrated to: "kpi_manager.KpiId" // Event-Condition-Action (ECA) model - repeated PolicyRuleCondition conditionList = 4; // When these policy conditions are met, an event is automatically thrown - BooleanOperator booleanOperator = 5; // Evaluation operator to be used - repeated PolicyRuleAction actionList = 6; // One or more actions should be applied + repeated PolicyRuleAction actionList = 5; // One or more actions should be applied } // Service-oriented policy rule diff --git a/src/automation/service/zsm_handlers/P4INTZSMPlugin.py b/src/automation/service/zsm_handlers/P4INTZSMPlugin.py index d1d5584bb90262f81e5982291d37c4aa553fb7e5..a16979530a6bc407cd32891ff1c965d432a2242c 100644 --- a/src/automation/service/zsm_handlers/P4INTZSMPlugin.py +++ b/src/automation/service/zsm_handlers/P4INTZSMPlugin.py @@ -21,6 +21,7 @@ from analytics.frontend.client.AnalyticsFrontendClient import AnalyticsFrontendC from automation.client.PolicyClient import PolicyClient from context.client.ContextClient import ContextClient from automation.service.zsm_handler_api._ZSMHandler import _ZSMHandler +from common.proto.policy_condition_pb2 import PolicyRuleCondition LOGGER = logging.getLogger(__name__) @@ -65,6 +66,15 @@ class P4INTZSMPlugin(_ZSMHandler): # Create a policy try: + LOGGER.info('policy({:s})'.format(str(request.policy))) + # PolicyRuleCondition + policyRuleCondition = PolicyRuleCondition() + # policyRuleCondition.kpiId.kpi_id.uuid = request.analyzer.output_kpi_ids[0].kpi_id.uuid + # policyRuleCondition.numericalOperator = 5 + # policyRuleCondition.kpiValue.floatVal = 300 + # request.policy.policyRuleBasic.conditionList.append(policyRuleCondition) + LOGGER.info('policy after({:s})'.format(str(request.policy))) + policy_rule_state: PolicyRuleState = policy_client.PolicyAddService(request.policy) # type: ignore LOGGER.info('policy_rule_state({:s})'.format(str(policy_rule_state))) except grpc.RpcError as ex: diff --git a/src/common/tools/object_factory/PolicyRule.py b/src/common/tools/object_factory/PolicyRule.py index dd78bf3556444e4e8cf77be6a43ffa9c649bf995..7622cedb7338a93e8a314baa2c33e645b29e72de 100644 --- a/src/common/tools/object_factory/PolicyRule.py +++ b/src/common/tools/object_factory/PolicyRule.py @@ -14,7 +14,6 @@ import logging from typing import Dict, List, Optional -from common.proto.policy_condition_pb2 import BooleanOperator from common.proto.policy_pb2 import PolicyRuleStateEnum LOGGER = logging.getLogger(__name__) @@ -23,11 +22,9 @@ def json_policyrule_id(policyrule_uuid : str) -> Dict: return {'uuid': {'uuid': policyrule_uuid}} def json_policyrule( - policyrule_uuid : str, policy_priority : int = 1, + policyrule_uuid : str, policy_priority : int = 1, policy_kpi_id : str = '', policy_state : PolicyRuleStateEnum = PolicyRuleStateEnum.POLICY_UNDEFINED, policy_state_message : str = '', - boolean_operator : BooleanOperator = BooleanOperator.POLICYRULE_CONDITION_BOOLEAN_AND, - condition_list : List[Dict] = [], action_list : List[Dict] = [], - service_id : Optional[Dict] = None, device_id_list : List[Dict] = [] + action_list : List[Dict] = [], service_id : Optional[Dict] = None, device_id_list : List[Dict] = [] ) -> Dict: basic = { 'policyRuleId': json_policyrule_id(policyrule_uuid), @@ -36,8 +33,7 @@ def json_policyrule( 'policyRuleStateMessage': policy_state_message, }, 'priority': policy_priority, - 'conditionList': condition_list, - 'booleanOperator': boolean_operator, + 'kpiId': {'kpi_id': {'uuid': policy_kpi_id}}, 'actionList': action_list, } diff --git a/src/context/service/database/PolicyRule.py b/src/context/service/database/PolicyRule.py index 197e94043ab2aa4ed288740fe653a2e8296571c2..3a02e187e98cd504dcce39bedd802068a6862505 100644 --- a/src/context/service/database/PolicyRule.py +++ b/src/context/service/database/PolicyRule.py @@ -79,8 +79,6 @@ def policyrule_set(db_engine : Engine, messagebroker : MessageBroker, request : json_policyrule_basic = grpc_message_to_json(policyrule_basic) policyrule_eca_data = json.dumps({ - 'conditionList': json_policyrule_basic.get('conditionList', []), - 'booleanOperator': json_policyrule_basic['booleanOperator'], 'actionList': json_policyrule_basic.get('actionList', []), }, sort_keys=True) @@ -92,10 +90,11 @@ def policyrule_set(db_engine : Engine, messagebroker : MessageBroker, request : 'policyrule_state' : policyrule_state, 'policyrule_state_msg': policyrule_state_msg, 'policyrule_priority' : policyrule_basic.priority, + 'policyrule_kpi_id' : policyrule_basic.kpiId.kpi_id.uuid, 'policyrule_eca_data' : policyrule_eca_data, 'created_at' : now, 'updated_at' : now, - }] + }] policyrule_service_uuid = None if policyrule_kind == PolicyRuleKindEnum.SERVICE: @@ -121,6 +120,7 @@ def policyrule_set(db_engine : Engine, messagebroker : MessageBroker, request : policyrule_state = stmt.excluded.policyrule_state, policyrule_state_msg = stmt.excluded.policyrule_state_msg, policyrule_priority = stmt.excluded.policyrule_priority, + policyrule_kpi_id = stmt.excluded.policyrule_kpi_id, policyrule_eca_data = stmt.excluded.policyrule_eca_data, updated_at = stmt.excluded.updated_at, ) diff --git a/src/context/service/database/models/PolicyRuleModel.py b/src/context/service/database/models/PolicyRuleModel.py index 616d1609296418bd29f4e230f1296065681fa459..4f6ead28037b5f293503b8f35ca84de33a77e93a 100644 --- a/src/context/service/database/models/PolicyRuleModel.py +++ b/src/context/service/database/models/PolicyRuleModel.py @@ -33,6 +33,7 @@ class PolicyRuleModel(_Base): policyrule_state = Column(Enum(ORM_PolicyRuleStateEnum), nullable=False) policyrule_state_msg = Column(String, nullable=False) policyrule_priority = Column(Integer, nullable=False) + policyrule_kpi_id = Column(String, nullable=False) policyrule_service_uuid = Column(ForeignKey('service.service_uuid', ondelete='RESTRICT'), nullable=True, index=True) policyrule_eca_data = Column(String, nullable=False) created_at = Column(DateTime, nullable=False) @@ -58,6 +59,7 @@ class PolicyRuleModel(_Base): 'policyRuleStateMessage': self.policyrule_state_msg, }, 'priority': self.policyrule_priority, + 'kpiId': {'kpi_id': {'uuid': self.policyrule_kpi_id}}, }) result = { 'policyRuleBasic': policyrule_basic, diff --git a/src/context/tests/Objects.py b/src/context/tests/Objects.py index 74fb05685e799d7d639a66d67a2c22501190548d..2e7852548501dac4b334007ad49684bccbc0c33d 100644 --- a/src/context/tests/Objects.py +++ b/src/context/tests/Objects.py @@ -186,4 +186,4 @@ CONNECTION_R1_R3_NAME, CONNECTION_R1_R3_ID, CONNECTION_R1_R3 = compose_connectio # ----- PolicyRule ------------------------------------------------------------------------------------------------------- POLICYRULE_NAME = 'my-device-policy' POLICYRULE_ID = json_policyrule_id(POLICYRULE_NAME) -POLICYRULE = json_policyrule(POLICYRULE_NAME, policy_priority=1) +POLICYRULE = json_policyrule(POLICYRULE_NAME, policy_priority=1, policy_kpi_id='my-kpi-id') diff --git a/src/context/tests/test_policy.py b/src/context/tests/test_policy.py index b14fc936a9ca100d1b615d5e7d4352d62d695faa..45592308c11bbeb47d5eb3139a04b2eec793f0c9 100644 --- a/src/context/tests/test_policy.py +++ b/src/context/tests/test_policy.py @@ -47,6 +47,7 @@ def test_policy(context_client : ContextClient): response = context_client.GetPolicyRule(PolicyRuleId(**POLICYRULE_ID)) assert response.device.policyRuleBasic.policyRuleId.uuid.uuid == policyrule_uuid assert response.device.policyRuleBasic.priority == 1 + assert response.device.policyRuleBasic.kpiId.kpi_id.uuid == 'my-kpi-id' # ----- List when the object exists -------------------------------------------------------------------------------- response = context_client.ListPolicyRuleIds(Empty()) @@ -57,11 +58,14 @@ def test_policy(context_client : ContextClient): assert len(response.policyRules) == 1 assert response.policyRules[0].device.policyRuleBasic.policyRuleId.uuid.uuid == policyrule_uuid assert response.policyRules[0].device.policyRuleBasic.priority == 1 + assert response.policyRules[0].device.policyRuleBasic.kpiId.kpi_id.uuid == 'my-kpi-id' # ----- Update the object ------------------------------------------------------------------------------------------ new_policy_priority = 100 + new_policy_kpi_id = 'new-kpi-id' POLICYRULE_UPDATED = copy.deepcopy(POLICYRULE) POLICYRULE_UPDATED['device']['policyRuleBasic']['priority'] = new_policy_priority + POLICYRULE_UPDATED['device']['policyRuleBasic']['kpiId']['kpi_id']['uuid'] = new_policy_kpi_id response = context_client.SetPolicyRule(PolicyRule(**POLICYRULE_UPDATED)) assert response.uuid.uuid == policyrule_uuid @@ -78,6 +82,7 @@ def test_policy(context_client : ContextClient): assert len(response.policyRules) == 1 assert response.policyRules[0].device.policyRuleBasic.policyRuleId.uuid.uuid == policyrule_uuid assert response.policyRules[0].device.policyRuleBasic.priority == new_policy_priority + assert response.policyRules[0].device.policyRuleBasic.kpiId.kpi_id.uuid == new_policy_kpi_id # ----- Remove the object ------------------------------------------------------------------------------------------ context_client.RemovePolicyRule(PolicyRuleId(**POLICYRULE_ID)) diff --git a/src/policy/src/main/java/org/etsi/tfs/policy/Serializer.java b/src/policy/src/main/java/org/etsi/tfs/policy/Serializer.java index bf7055e149c7d6a1af66c045c8a2d96bbe84c322..dc2b83781c4ec30603de89073fd3cd35b7c70f13 100644 --- a/src/policy/src/main/java/org/etsi/tfs/policy/Serializer.java +++ b/src/policy/src/main/java/org/etsi/tfs/policy/Serializer.java @@ -1960,23 +1960,18 @@ public class Serializer { final var policyRuleId = policyRuleBasic.getPolicyRuleId(); final var policyRuleState = policyRuleBasic.getPolicyRuleState(); final var priority = policyRuleBasic.getPriority(); - final var policyRuleConditions = policyRuleBasic.getPolicyRuleConditions(); - final var booleanOperator = policyRuleBasic.getBooleanOperator(); + final var kpiId = policyRuleBasic.getKpiId(); final var policyRuleActions = policyRuleBasic.getPolicyRuleActions(); final var serializedPolicyRuleId = serializePolicyRuleId(policyRuleId); final var serializedPolicyRuleState = serialize(policyRuleState); - final var serializedPolicyRuleConditions = - policyRuleConditions.stream().map(this::serialize).collect(Collectors.toList()); - final var serializedBooleanOperator = serialize(booleanOperator); final var serializedPolicyRuleActions = policyRuleActions.stream().map(this::serialize).collect(Collectors.toList()); builder.setPolicyRuleId(serializedPolicyRuleId); builder.setPolicyRuleState(serializedPolicyRuleState); builder.setPriority(priority); - builder.addAllConditionList(serializedPolicyRuleConditions); - builder.setBooleanOperator(serializedBooleanOperator); + builder.setKpiId(KpiId.newBuilder().setKpiId(Uuid.newBuilder().setUuid("kpiId").build())); builder.addAllActionList(serializedPolicyRuleActions); return builder.build(); @@ -1986,25 +1981,16 @@ public class Serializer { final var serializedPolicyRuleId = serializedPolicyRuleBasic.getPolicyRuleId(); final var serializedPolicyRuleState = serializedPolicyRuleBasic.getPolicyRuleState(); final var priority = serializedPolicyRuleBasic.getPriority(); - final var serializedPolicyRuleConditions = serializedPolicyRuleBasic.getConditionListList(); - final var serializedBooleanOperator = serializedPolicyRuleBasic.getBooleanOperator(); final var serializedPolicyRuleActions = serializedPolicyRuleBasic.getActionListList(); + final var serializedKpiId = serializedPolicyRuleBasic.getKpiId(); final var policyRuleId = deserialize(serializedPolicyRuleId); + final var kpiId = deserialize(serializedKpiId); final var policyRuleState = deserialize(serializedPolicyRuleState); - final var policyRuleConditions = - serializedPolicyRuleConditions.stream().map(this::deserialize).collect(Collectors.toList()); - final var booleanOperator = deserialize(serializedBooleanOperator); final var policyRuleActions = serializedPolicyRuleActions.stream().map(this::deserialize).collect(Collectors.toList()); - return new PolicyRuleBasic( - policyRuleId, - policyRuleState, - priority, - policyRuleConditions, - booleanOperator, - policyRuleActions); + return new PolicyRuleBasic(policyRuleId, kpiId, policyRuleState, priority, policyRuleActions); } public Policy.PolicyRuleService serialize(PolicyRuleService policyRuleService) { diff --git a/src/policy/src/main/java/org/etsi/tfs/policy/policy/AddPolicyDeviceImpl.java b/src/policy/src/main/java/org/etsi/tfs/policy/policy/AddPolicyDeviceImpl.java index bb1cc59c3b11d845ee90455351e8b9ef87a4afd7..29113ca0f58b263e4bf0edeb79934821c3850de9 100644 --- a/src/policy/src/main/java/org/etsi/tfs/policy/policy/AddPolicyDeviceImpl.java +++ b/src/policy/src/main/java/org/etsi/tfs/policy/policy/AddPolicyDeviceImpl.java @@ -70,17 +70,6 @@ public class AddPolicyDeviceImpl { final var policyRuleTypeDevice = new PolicyRuleTypeDevice(policyRuleDevice); final var policyRule = new PolicyRule(policyRuleTypeDevice); - final var alarmDescriptorList = commonPolicyServiceImpl.createAlarmDescriptorList(policyRule); - if (alarmDescriptorList.isEmpty()) { - var policyRuleState = - new PolicyRuleState( - PolicyRuleStateEnum.POLICY_FAILED, - String.format( - "Invalid PolicyRuleConditions in PolicyRule with ID: %s", - policyRuleBasic.getPolicyRuleId())); - return Uni.createFrom().item(policyRuleState); - } - return contextService .setPolicyRule(policyRule) .onFailure() @@ -88,8 +77,6 @@ public class AddPolicyDeviceImpl { .onItem() .transform( policyId -> { - commonAlarmService.startMonitoringBasedOnAlarmDescriptors( - policyId, policyRuleDevice, alarmDescriptorList); return VALIDATED_POLICYRULE_STATE; }); } diff --git a/src/policy/src/main/java/org/etsi/tfs/policy/policy/AddPolicyServiceImpl.java b/src/policy/src/main/java/org/etsi/tfs/policy/policy/AddPolicyServiceImpl.java index a95daa16146d468cb480a7fe2707f255f08feee9..01b0f96d6dfe728b721475b067b3944addca4e1c 100644 --- a/src/policy/src/main/java/org/etsi/tfs/policy/policy/AddPolicyServiceImpl.java +++ b/src/policy/src/main/java/org/etsi/tfs/policy/policy/AddPolicyServiceImpl.java @@ -30,6 +30,7 @@ import org.etsi.tfs.policy.policy.model.PolicyRuleService; import org.etsi.tfs.policy.policy.model.PolicyRuleState; import org.etsi.tfs.policy.policy.model.PolicyRuleStateEnum; import org.etsi.tfs.policy.policy.model.PolicyRuleTypeService; +import org.jboss.logging.Logger; @ApplicationScoped public class AddPolicyServiceImpl { @@ -37,6 +38,8 @@ public class AddPolicyServiceImpl { @Inject private CommonPolicyServiceImpl commonPolicyService; @Inject private ContextService contextService; + private static final Logger LOGGER = Logger.getLogger(AddPolicyServiceImpl.class); + public Uni constructPolicyStateBasedOnCriteria( Boolean isService, ServiceId serviceId, PolicyRuleService policyRuleService) { @@ -47,12 +50,10 @@ public class AddPolicyServiceImpl { return Uni.createFrom().item(policyRuleState); } - final var policyRuleTypeService = new PolicyRuleTypeService(policyRuleService); final var policyRule = new PolicyRule(policyRuleTypeService); - final String kpiId = - policyRuleService.getPolicyRuleBasic().getPolicyRuleConditions().get(0).getKpiId(); + final String kpiId = policyRuleService.getPolicyRuleBasic().getKpiId(); commonPolicyService.getKpiPolicyRuleServiceMap().put(kpiId, policyRuleService); return setPolicyRuleOnContextAndReturnState(policyRule); diff --git a/src/policy/src/main/java/org/etsi/tfs/policy/policy/CommonAlarmService.java b/src/policy/src/main/java/org/etsi/tfs/policy/policy/CommonAlarmService.java index 2ce0ee2fdd500a34afce39a3b12f02f198c86ff0..c46704368e2ca3e5715d921378fd1523f4ad48a8 100644 --- a/src/policy/src/main/java/org/etsi/tfs/policy/policy/CommonAlarmService.java +++ b/src/policy/src/main/java/org/etsi/tfs/policy/policy/CommonAlarmService.java @@ -16,9 +16,6 @@ package org.etsi.tfs.policy.policy; -import static org.etsi.tfs.policy.common.ApplicationProperties.PROVISIONED_POLICYRULE_STATE; -import static org.etsi.tfs.policy.common.ApplicationProperties.VALIDATED_POLICYRULE_STATE; - import io.smallrye.mutiny.Multi; import io.smallrye.mutiny.Uni; import io.smallrye.mutiny.subscription.Cancellable; @@ -41,63 +38,6 @@ public class CommonAlarmService { @Inject private CommonPolicyServiceImpl commonPolicyServiceImpl; @Inject private MonitoringService monitoringService; - public void startMonitoringBasedOnAlarmDescriptors( - String policyId, - PolicyRuleDevice policyRuleDevice, - List alarmDescriptorList) { - commonPolicyServiceImpl.setPolicyRuleDeviceToContext( - policyRuleDevice, VALIDATED_POLICYRULE_STATE); - commonPolicyServiceImpl.noAlarms = 0; - - List> alarmIds = createAlarmList(alarmDescriptorList); - - List> alarmResponseStreamList = - transformAlarmIds(alarmIds, policyRuleDevice); - - // Merge the promised alarms into one stream (Multi Object) - final var multi = Multi.createBy().merging().streams(alarmResponseStreamList); - commonPolicyServiceImpl.setPolicyRuleDeviceToContext( - policyRuleDevice, PROVISIONED_POLICYRULE_STATE); - - commonPolicyServiceImpl - .getSubscriptionList() - .put(policyId, monitorAlarmResponseForDevice(multi)); - - // TODO: Resubscribe to the stream, if it has ended - - // TODO: Redesign evaluation of action - // evaluateAction(policyRule, alarmDescriptorList, multi); - } - - public void startMonitoringBasedOnAlarmDescriptors( - String policyId, - PolicyRuleService policyRuleService, - List alarmDescriptorList) { - commonPolicyServiceImpl.setPolicyRuleServiceToContext( - policyRuleService, VALIDATED_POLICYRULE_STATE); - commonPolicyServiceImpl.noAlarms = 0; - - List> alarmIds = - createAlarmList(alarmDescriptorList); // setAllarmtomonitoring get back alarmid - - List> alarmResponseStreamList = - transformAlarmIds(alarmIds, policyRuleService); - - // Merge the promised alarms into one stream (Multi Object) - final var multi = Multi.createBy().merging().streams(alarmResponseStreamList); - commonPolicyServiceImpl.setPolicyRuleServiceToContext( - policyRuleService, PROVISIONED_POLICYRULE_STATE); - - commonPolicyServiceImpl - .getSubscriptionList() - .put(policyId, monitorAlarmResponseForService(multi)); - - // TODO: Resubscribe to the stream, if it has ended - - // TODO: Redesign evaluation of action - // evaluateAction(policyRule, alarmDescriptorList, multi); - } - /** * Transform the alarmIds into promised alarms returned from the getAlarmResponseStream * diff --git a/src/policy/src/main/java/org/etsi/tfs/policy/policy/CommonPolicyServiceImpl.java b/src/policy/src/main/java/org/etsi/tfs/policy/policy/CommonPolicyServiceImpl.java index c5afff68e2cf0dc3e698de97cb3f05d125383de6..c85cdd928f6a1be22a48022a4fc8e9fbee8a33e0 100644 --- a/src/policy/src/main/java/org/etsi/tfs/policy/policy/CommonPolicyServiceImpl.java +++ b/src/policy/src/main/java/org/etsi/tfs/policy/policy/CommonPolicyServiceImpl.java @@ -25,7 +25,6 @@ import jakarta.enterprise.context.ApplicationScoped; import jakarta.inject.Inject; import java.time.Instant; import java.util.ArrayList; -import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Random; @@ -43,12 +42,10 @@ import org.etsi.tfs.policy.device.DeviceService; import org.etsi.tfs.policy.monitoring.MonitoringService; import org.etsi.tfs.policy.monitoring.model.AlarmDescriptor; import org.etsi.tfs.policy.monitoring.model.KpiValueRange; -import org.etsi.tfs.policy.policy.model.BooleanOperator; import org.etsi.tfs.policy.policy.model.PolicyRule; import org.etsi.tfs.policy.policy.model.PolicyRuleAction; import org.etsi.tfs.policy.policy.model.PolicyRuleActionConfig; import org.etsi.tfs.policy.policy.model.PolicyRuleActionEnum; -import org.etsi.tfs.policy.policy.model.PolicyRuleBasic; import org.etsi.tfs.policy.policy.model.PolicyRuleCondition; import org.etsi.tfs.policy.policy.model.PolicyRuleDevice; import org.etsi.tfs.policy.policy.model.PolicyRuleService; @@ -139,7 +136,6 @@ public class CommonPolicyServiceImpl { callUpdateServiceRpc(policyRuleService, policyRuleAction); default: LOGGER.errorf(INVALID_MESSAGE, policyRuleAction.getPolicyRuleActionEnum()); - return; } } @@ -148,145 +144,18 @@ public class CommonPolicyServiceImpl { PolicyRuleAction policyRuleAction = policyRuleService.getPolicyRuleBasic().getPolicyRuleActions().get(0); - if (noAlarms == 0) { - noAlarms++; - setPolicyRuleServiceToContext(policyRuleService, ACTIVE_POLICYRULE_STATE); - - switch (policyRuleAction.getPolicyRuleActionEnum()) { - case POLICY_RULE_ACTION_ADD_SERVICE_CONSTRAINT: - addServiceConstraint(policyRuleService, policyRuleAction); - case POLICY_RULE_ACTION_ADD_SERVICE_CONFIGRULE: - addServiceConfigRule(policyRuleService, policyRuleAction); - case POLICY_RULE_ACTION_RECALCULATE_PATH: - callRecalculatePathRPC(policyRuleService, policyRuleAction); - default: - LOGGER.errorf(INVALID_MESSAGE, policyRuleAction.getPolicyRuleActionEnum()); - return; - } - } else if (noAlarms == 2) { - noAlarms = 0; - } else { - noAlarms++; - } - } - - public List createAlarmDescriptorList(PolicyRule policyRule) { - final var policyRuleType = policyRule.getPolicyRuleType(); - final var policyRuleTypeSpecificType = policyRuleType.getPolicyRuleType(); - - List alarmDescriptorList = new ArrayList<>(); - if (policyRuleTypeSpecificType instanceof PolicyRuleService) { - final var policyRuleService = (PolicyRuleService) policyRuleTypeSpecificType; - final var policyRuleBasic = policyRuleService.getPolicyRuleBasic(); - - alarmDescriptorList = parsePolicyRuleCondition(policyRuleBasic); - if (alarmDescriptorList.isEmpty()) { - return List.of(); - } - } else { - final var policyRuleDevice = (PolicyRuleDevice) policyRuleTypeSpecificType; - final var policyRuleBasic = policyRuleDevice.getPolicyRuleBasic(); - - alarmDescriptorList = parsePolicyRuleCondition(policyRuleBasic); - if (alarmDescriptorList.isEmpty()) { - return List.of(); - } - for (AlarmDescriptor alarmDescriptor : alarmDescriptorList) { - alarmPolicyRuleDeviceMap.put(alarmDescriptor.getAlarmId(), policyRuleDevice); - } - } - - return alarmDescriptorList; - } - - private List parsePolicyRuleCondition(PolicyRuleBasic policyRuleBasic) { - BooleanOperator booleanOperator = policyRuleBasic.getBooleanOperator(); - if (booleanOperator == BooleanOperator.POLICYRULE_CONDITION_BOOLEAN_OR) { - return parsePolicyRuleConditionOr(policyRuleBasic); - } - if (booleanOperator == BooleanOperator.POLICYRULE_CONDITION_BOOLEAN_AND) { - return Arrays.asList(parsePolicyRuleConditionAnd(policyRuleBasic)); - } - return List.of(); - } - - private List parsePolicyRuleConditionOr(PolicyRuleBasic policyRuleBasic) { - - List policyRuleConditions = policyRuleBasic.getPolicyRuleConditions(); - List alarmDescriptorList = new ArrayList<>(); - - for (PolicyRuleCondition policyRuleCondition : policyRuleConditions) { - var kpiValueRange = convertPolicyRuleConditionToKpiValueRange(policyRuleCondition); - - // TODO: Temp fix for AlarmDescriptor object - AlarmDescriptor alarmDescriptor = - new AlarmDescriptor( - "", - "alarmDescription", - "alarmName-" + gen(), - policyRuleCondition.getKpiId(), - kpiValueRange, - getTimeStamp()); - - alarmDescriptorList.add(alarmDescriptor); - } - - HashMap policyRuleActionMap = new HashMap<>(); - List policyRuleActions = policyRuleBasic.getPolicyRuleActions(); - - for (int i = 0; i < policyRuleActions.size(); i++) { - policyRuleActionMap.put(alarmDescriptorList.get(i).getAlarmId(), policyRuleActions.get(i)); - } - - return alarmDescriptorList; - } - - private AlarmDescriptor parsePolicyRuleConditionAnd(PolicyRuleBasic policyRuleBasic) { - - // TODO: KpiIds should be the same. Add check. - - List policyRuleConditionList = policyRuleBasic.getPolicyRuleConditions(); - List kpisList = new ArrayList(); - - for (PolicyRuleCondition policyRuleCondition : policyRuleConditionList) { - kpisList.add(policyRuleCondition.getKpiId()); - } - - if (policyRuleConditionList.size() > 1) { - return createAlarmDescriptorWithRange(policyRuleConditionList); - } - - return createAlarmDescriptorWithoutRange(policyRuleConditionList.get(0)); - } - - private AlarmDescriptor createAlarmDescriptorWithRange( - List policyRuleConditionList) { - - final var kpiId = policyRuleConditionList.get(0).getKpiId(); - - HashMap KpiValueRangeMap = new HashMap<>(); - for (PolicyRuleCondition policyRuleCondition : policyRuleConditionList) { - - if (!KpiValueRangeMap.containsKey(kpiId)) { - var kpiValueRange = convertPolicyRuleConditionToKpiValueRange(policyRuleCondition); - KpiValueRangeMap.put(kpiId, kpiValueRange); - continue; - } + setPolicyRuleServiceToContext(policyRuleService, ACTIVE_POLICYRULE_STATE); - var kpiValueRange = convertPolicyRuleConditionToKpiValueRange(policyRuleCondition); - // TODO: Handle combineKpiValueRanges exceptions - var combinedKpiValueRange = - combineKpiValueRanges(kpiId, KpiValueRangeMap.get(kpiId), kpiValueRange); - KpiValueRangeMap.put(kpiId, combinedKpiValueRange); + switch (policyRuleAction.getPolicyRuleActionEnum()) { + case POLICY_RULE_ACTION_ADD_SERVICE_CONSTRAINT: + addServiceConstraint(policyRuleService, policyRuleAction); + case POLICY_RULE_ACTION_ADD_SERVICE_CONFIGRULE: + addServiceConfigRule(policyRuleService, policyRuleAction); + case POLICY_RULE_ACTION_RECALCULATE_PATH: + callRecalculatePathRPC(policyRuleService, policyRuleAction); + default: + LOGGER.errorf(INVALID_MESSAGE, policyRuleAction.getPolicyRuleActionEnum()); } - - return new AlarmDescriptor( - "", - "alarmDescription", - "alarmName-" + gen(), - kpiId, - KpiValueRangeMap.get(kpiId), - getTimeStamp()); } private KpiValueRange convertPolicyRuleConditionToKpiValueRange( @@ -570,7 +439,6 @@ public class CommonPolicyServiceImpl { LOGGER.infof("Setting Policy Rule state to [%s]", policyRuleState.toString()); final var policyRuleBasic = policyRuleService.getPolicyRuleBasic(); - policyRuleBasic.setPolicyRuleState(policyRuleState); policyRuleService.setPolicyRuleBasic(policyRuleBasic); final var policyRuleTypeService = new PolicyRuleTypeService(policyRuleService); @@ -583,7 +451,6 @@ public class CommonPolicyServiceImpl { LOGGER.infof("Setting Policy Rule state to [%s]", policyRuleState.toString()); final var policyRuleBasic = policyRuleDevice.getPolicyRuleBasic(); - policyRuleBasic.setPolicyRuleState(policyRuleState); policyRuleDevice.setPolicyRuleBasic(policyRuleBasic); final var policyRuleTypeService = new PolicyRuleTypeDevice(policyRuleDevice); diff --git a/src/policy/src/main/java/org/etsi/tfs/policy/policy/model/PolicyRuleBasic.java b/src/policy/src/main/java/org/etsi/tfs/policy/policy/model/PolicyRuleBasic.java index 0a60742731f96734a570f95d03d5c0a81c4ae06e..cfc88a08ed85a1505e80c756248e4c81ce6f0c6c 100644 --- a/src/policy/src/main/java/org/etsi/tfs/policy/policy/model/PolicyRuleBasic.java +++ b/src/policy/src/main/java/org/etsi/tfs/policy/policy/model/PolicyRuleBasic.java @@ -17,6 +17,7 @@ package org.etsi.tfs.policy.policy.model; import static com.google.common.base.Preconditions.checkArgument; +import static com.google.common.base.Preconditions.checkNotNull; import java.util.ArrayList; import java.util.List; @@ -24,35 +25,30 @@ import org.etsi.tfs.policy.common.Util; public class PolicyRuleBasic { + private String kpiId; private String policyRuleId; private PolicyRuleState policyRuleState; private int priority; - private List policyRuleConditions; - private BooleanOperator booleanOperator; private List policyRuleActions; private Boolean isValid; private String exceptionMessage; public PolicyRuleBasic( String policyRuleId, + String kpiId, PolicyRuleState policyRuleState, int priority, - List policyRuleConditions, - BooleanOperator booleanOperator, List policyRuleActions) { try { checkArgument(!policyRuleId.isBlank(), "Policy rule ID must not be empty."); this.policyRuleId = policyRuleId; this.policyRuleState = policyRuleState; - checkArgument(priority >= 0, "Priority value must be greater or equal than zero."); this.priority = priority; - checkArgument(!policyRuleConditions.isEmpty(), "Policy Rule conditions cannot be empty."); - this.policyRuleConditions = policyRuleConditions; - checkArgument( - booleanOperator != BooleanOperator.POLICYRULE_CONDITION_BOOLEAN_UNDEFINED, - "Boolean operator cannot be undefined"); - this.booleanOperator = booleanOperator; + checkArgument(priority >= 0, "Priority value must be greater or equal than zero."); + checkNotNull(kpiId, "Kpi ID must not be null."); + checkArgument(!kpiId.isBlank(), "Kpi ID must not be empty."); + this.kpiId = kpiId; checkArgument(!policyRuleActions.isEmpty(), "Policy Rule actions cannot be empty."); this.policyRuleActions = policyRuleActions; this.isValid = true; @@ -60,8 +56,6 @@ public class PolicyRuleBasic { } catch (Exception e) { this.policyRuleId = ""; this.priority = 0; - this.policyRuleConditions = new ArrayList(); - this.booleanOperator = BooleanOperator.POLICYRULE_CONDITION_BOOLEAN_UNDEFINED; this.policyRuleActions = new ArrayList(); this.isValid = false; this.exceptionMessage = e.getMessage(); @@ -76,44 +70,50 @@ public class PolicyRuleBasic { return exceptionMessage; } + public List getPolicyRuleActions() { + return policyRuleActions; + } + + public String getKpiId() { + return kpiId; + } + + public void setKpiId(String kpiId) { + this.kpiId = kpiId; + } + public String getPolicyRuleId() { return policyRuleId; } + public void setPolicyRuleId(String policyRuleId) { + this.policyRuleId = policyRuleId; + } + public PolicyRuleState getPolicyRuleState() { return policyRuleState; } - public void setPolicyRuleState(PolicyRuleState state) { - this.policyRuleState = state; + public void setPolicyRuleState(PolicyRuleState policyRuleState) { + this.policyRuleState = policyRuleState; } public int getPriority() { return priority; } - public List getPolicyRuleConditions() { - return policyRuleConditions; - } - - public BooleanOperator getBooleanOperator() { - return booleanOperator; - } - - public List getPolicyRuleActions() { - return policyRuleActions; + public void setPriority(int priority) { + this.priority = priority; } @Override public String toString() { return String.format( - "%s:{policyRuleId:\"%s\", %s, priority:%d, [%s], booleanOperator:\"%s\", [%s]}", + "%s:{policyRuleId:\"%s\", %s, priority:%d, [%s]}", getClass().getSimpleName(), policyRuleId, policyRuleState, priority, - Util.toString(policyRuleConditions), - booleanOperator.toString(), Util.toString(policyRuleActions)); } } diff --git a/src/policy/src/test/java/org/etsi/tfs/policy/PolicyAddDeviceTest.java b/src/policy/src/test/java/org/etsi/tfs/policy/PolicyAddDeviceTest.java index db3bbb8bec6f0e60c5771c2d0b90e6de1c3c9979..3e08374498d13f85056de959ab14fbea84c296bf 100644 --- a/src/policy/src/test/java/org/etsi/tfs/policy/PolicyAddDeviceTest.java +++ b/src/policy/src/test/java/org/etsi/tfs/policy/PolicyAddDeviceTest.java @@ -36,7 +36,6 @@ import org.etsi.tfs.policy.monitoring.MonitoringService; import org.etsi.tfs.policy.monitoring.model.IntegerKpiValue; import org.etsi.tfs.policy.monitoring.model.KpiValue; import org.etsi.tfs.policy.policy.PolicyServiceImpl; -import org.etsi.tfs.policy.policy.model.BooleanOperator; import org.etsi.tfs.policy.policy.model.NumericalOperator; import org.etsi.tfs.policy.policy.model.PolicyRuleAction; import org.etsi.tfs.policy.policy.model.PolicyRuleActionConfig; @@ -84,10 +83,9 @@ class PolicyAddDeviceTest { policyRuleBasic = new PolicyRuleBasic( policyId, + "kpiId", new PolicyRuleState(PolicyRuleStateEnum.POLICY_INSERTED, "Failed due to some errors"), 1, - Arrays.asList(policyRuleCondition), - BooleanOperator.POLICYRULE_CONDITION_BOOLEAN_OR, Arrays.asList(policyRuleAction)); List deviceIds = Arrays.asList("device1", "device2"); @@ -124,10 +122,9 @@ class PolicyAddDeviceTest { PolicyRuleBasic policyRuleBasic = new PolicyRuleBasic( "policyId", + "kpiId", new PolicyRuleState(PolicyRuleStateEnum.POLICY_INSERTED, "Failed due to some errors"), 0, - new ArrayList<>(), - BooleanOperator.POLICYRULE_CONDITION_BOOLEAN_OR, new ArrayList<>()); PolicyRuleDevice policyRuleDevice = @@ -135,7 +132,7 @@ class PolicyAddDeviceTest { PolicyRuleState expectedResult = new PolicyRuleState( - PolicyRuleStateEnum.POLICY_FAILED, "Policy Rule conditions cannot be empty."); + PolicyRuleStateEnum.POLICY_FAILED, "Policy Rule actions cannot be empty."); policyService .addPolicyDevice(policyRuleDevice) diff --git a/src/policy/src/test/java/org/etsi/tfs/policy/PolicyAddServiceTest.java b/src/policy/src/test/java/org/etsi/tfs/policy/PolicyAddServiceTest.java index 478826c04b92ce0c7227418610c458c72efb8b37..f14b51735b3f90682c3e2eca6187c26b61b4013b 100644 --- a/src/policy/src/test/java/org/etsi/tfs/policy/PolicyAddServiceTest.java +++ b/src/policy/src/test/java/org/etsi/tfs/policy/PolicyAddServiceTest.java @@ -39,7 +39,6 @@ import org.etsi.tfs.policy.monitoring.MonitoringService; import org.etsi.tfs.policy.monitoring.model.IntegerKpiValue; import org.etsi.tfs.policy.monitoring.model.KpiValue; import org.etsi.tfs.policy.policy.PolicyServiceImpl; -import org.etsi.tfs.policy.policy.model.BooleanOperator; import org.etsi.tfs.policy.policy.model.NumericalOperator; import org.etsi.tfs.policy.policy.model.PolicyRule; import org.etsi.tfs.policy.policy.model.PolicyRuleAction; @@ -89,10 +88,9 @@ public class PolicyAddServiceTest { policyRuleBasic = new PolicyRuleBasic( policyId, + "kpiId", new PolicyRuleState(PolicyRuleStateEnum.POLICY_INSERTED, "Failed due to some errors"), 1, - Arrays.asList(policyRuleCondition), - BooleanOperator.POLICYRULE_CONDITION_BOOLEAN_OR, Arrays.asList(policyRuleAction)); ServiceId serviceId = new ServiceId("contextId", "serviceId"); @@ -163,10 +161,9 @@ public class PolicyAddServiceTest { PolicyRuleBasic policyRuleBasic = new PolicyRuleBasic( policyId, + "kpiId", new PolicyRuleState(PolicyRuleStateEnum.POLICY_INSERTED, "Failed due to some errors"), 1, - new ArrayList<>(), - null, new ArrayList<>()); ServiceId serviceId = new ServiceId("contextId", "serviceId"); diff --git a/src/policy/src/test/java/org/etsi/tfs/policy/PolicyDeleteServiceTest.java b/src/policy/src/test/java/org/etsi/tfs/policy/PolicyDeleteServiceTest.java index 4630ccbdd11fd0ffeb6295b57c1f786cafc70b33..47d1c0b815ae3d20f7c43cf32d6148acfcea1854 100644 --- a/src/policy/src/test/java/org/etsi/tfs/policy/PolicyDeleteServiceTest.java +++ b/src/policy/src/test/java/org/etsi/tfs/policy/PolicyDeleteServiceTest.java @@ -37,7 +37,6 @@ import org.etsi.tfs.policy.monitoring.MonitoringService; import org.etsi.tfs.policy.monitoring.model.IntegerKpiValue; import org.etsi.tfs.policy.monitoring.model.KpiValue; import org.etsi.tfs.policy.policy.PolicyServiceImpl; -import org.etsi.tfs.policy.policy.model.BooleanOperator; import org.etsi.tfs.policy.policy.model.NumericalOperator; import org.etsi.tfs.policy.policy.model.PolicyRule; import org.etsi.tfs.policy.policy.model.PolicyRuleAction; @@ -85,10 +84,9 @@ class PolicyDeleteServiceTest { policyRuleBasic = new PolicyRuleBasic( policyId, - new PolicyRuleState(PolicyRuleStateEnum.POLICY_INSERTED, "Failed due to some errors"), + "kpiId", + new PolicyRuleState(PolicyRuleStateEnum.POLICY_INSERTED, "Failed due to some errors1"), 1, - Arrays.asList(policyRuleCondition), - BooleanOperator.POLICYRULE_CONDITION_BOOLEAN_OR, Arrays.asList(policyRuleAction)); ServiceId serviceId = new ServiceId("contextId", "serviceId"); diff --git a/src/policy/src/test/java/org/etsi/tfs/policy/PolicyGrpcServiceTest.java b/src/policy/src/test/java/org/etsi/tfs/policy/PolicyGrpcServiceTest.java index 9726a7a4756629c94f75986f41018dcbf8fa635d..0848414995347d9aa5d98da992a3d5fe65dcd04e 100644 --- a/src/policy/src/test/java/org/etsi/tfs/policy/PolicyGrpcServiceTest.java +++ b/src/policy/src/test/java/org/etsi/tfs/policy/PolicyGrpcServiceTest.java @@ -41,7 +41,6 @@ import policy.Policy.PolicyRuleStateEnum; import policy.PolicyAction; import policy.PolicyAction.PolicyRuleActionEnum; import policy.PolicyCondition; -import policy.PolicyCondition.BooleanOperator; import policy.PolicyCondition.NumericalOperator; import policy.PolicyCondition.PolicyRuleCondition; import policy.PolicyService; @@ -141,8 +140,6 @@ class PolicyGrpcServiceTest { return PolicyRuleBasic.newBuilder() .setPolicyRuleId(expectedPolicyRuleId) .setPolicyRuleState(expectedPolicyRuleState) - .addAllConditionList(expectedPolicyRuleConditions) - .setBooleanOperator(BooleanOperator.POLICYRULE_CONDITION_BOOLEAN_OR) .addAllActionList(expectedPolicyRuleActions) .build(); } diff --git a/src/policy/src/test/java/org/etsi/tfs/policy/PolicyRuleBasicValidationTest.java b/src/policy/src/test/java/org/etsi/tfs/policy/PolicyRuleBasicValidationTest.java index 1904d74b549756458cccecc92b8dacbb4c8c12c3..b2bebd343ad7919ce08c353ce7d9bae2423ebc65 100644 --- a/src/policy/src/test/java/org/etsi/tfs/policy/PolicyRuleBasicValidationTest.java +++ b/src/policy/src/test/java/org/etsi/tfs/policy/PolicyRuleBasicValidationTest.java @@ -43,19 +43,12 @@ class PolicyRuleBasicValidationTestHelper { private PolicyRuleBasic createPolicyRuleBasic( String policyRuleId, - int priority, + String kpiId, PolicyRuleState policyRuleState, - BooleanOperator booleanOperator, - List policyRuleConditions, + int priority, List policyRuleActions) { - return new PolicyRuleBasic( - policyRuleId, - policyRuleState, - priority, - policyRuleConditions, - booleanOperator, - policyRuleActions); + return new PolicyRuleBasic(policyRuleId, kpiId, policyRuleState, priority, policyRuleActions); } private List createPolicyRuleConditions( @@ -89,15 +82,7 @@ class PolicyRuleBasicValidationTestHelper { final var policyRuleState = new PolicyRuleState(PolicyRuleStateEnum.POLICY_EFFECTIVE, "1"); assertThatExceptionOfType(NullPointerException.class) - .isThrownBy( - () -> - createPolicyRuleBasic( - null, - 3, - policyRuleState, - BooleanOperator.POLICYRULE_CONDITION_BOOLEAN_OR, - policyRuleConditions, - policyRuleActions)); + .isThrownBy(() -> createPolicyRuleBasic(null, "", policyRuleState, 3, policyRuleActions)); } @Test @@ -117,15 +102,7 @@ class PolicyRuleBasicValidationTestHelper { final var policyRuleState = new PolicyRuleState(PolicyRuleStateEnum.POLICY_ENFORCED, "1"); assertThatExceptionOfType(IllegalArgumentException.class) - .isThrownBy( - () -> - createPolicyRuleBasic( - "", - 3, - policyRuleState, - BooleanOperator.POLICYRULE_CONDITION_BOOLEAN_OR, - policyRuleConditions, - policyRuleActions)); + .isThrownBy(() -> createPolicyRuleBasic("", "", policyRuleState, 3, policyRuleActions)); } @Test @@ -145,15 +122,7 @@ class PolicyRuleBasicValidationTestHelper { final var policyRuleState = new PolicyRuleState(PolicyRuleStateEnum.POLICY_ENFORCED, "1"); assertThatExceptionOfType(IllegalArgumentException.class) - .isThrownBy( - () -> - createPolicyRuleBasic( - " ", - 3, - policyRuleState, - BooleanOperator.POLICYRULE_CONDITION_BOOLEAN_OR, - policyRuleConditions, - policyRuleActions)); + .isThrownBy(() -> createPolicyRuleBasic(" ", "", policyRuleState, 3, policyRuleActions)); } @Test @@ -176,14 +145,7 @@ class PolicyRuleBasicValidationTestHelper { assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy( - () -> - createPolicyRuleBasic( - policyRuleId, - -3, - policyRuleState, - BooleanOperator.POLICYRULE_CONDITION_BOOLEAN_OR, - policyRuleConditions, - policyRuleActions)); + () -> createPolicyRuleBasic(policyRuleId, "", policyRuleState, 3, policyRuleActions)); } @Test @@ -200,15 +162,7 @@ class PolicyRuleBasicValidationTestHelper { final var policyRuleId = UUID.randomUUID().toString(); assertThatExceptionOfType(NullPointerException.class) - .isThrownBy( - () -> - createPolicyRuleBasic( - policyRuleId, - 3, - policyRuleState, - BooleanOperator.POLICYRULE_CONDITION_BOOLEAN_OR, - null, - policyRuleActions)); + .isThrownBy(() -> createPolicyRuleBasic(null, "", policyRuleState, 3, policyRuleActions)); } @Test @@ -226,15 +180,7 @@ class PolicyRuleBasicValidationTestHelper { final var policyRuleId = UUID.randomUUID().toString(); assertThatExceptionOfType(IllegalArgumentException.class) - .isThrownBy( - () -> - createPolicyRuleBasic( - policyRuleId, - 3, - policyRuleState, - BooleanOperator.POLICYRULE_CONDITION_BOOLEAN_OR, - policyRuleConditions, - policyRuleActions)); + .isThrownBy(() -> createPolicyRuleBasic(null, "", policyRuleState, 3, policyRuleActions)); } @Test @@ -256,15 +202,7 @@ class PolicyRuleBasicValidationTestHelper { final var policyRuleId = UUID.randomUUID().toString(); assertThatExceptionOfType(IllegalArgumentException.class) - .isThrownBy( - () -> - createPolicyRuleBasic( - policyRuleId, - 3, - policyRuleState, - BooleanOperator.POLICYRULE_CONDITION_BOOLEAN_UNDEFINED, - policyRuleConditions, - policyRuleActions)); + .isThrownBy(() -> createPolicyRuleBasic(null, "", policyRuleState, 3, policyRuleActions)); } @Test @@ -280,15 +218,7 @@ class PolicyRuleBasicValidationTestHelper { final var policyRuleId = UUID.randomUUID().toString(); assertThatExceptionOfType(NullPointerException.class) - .isThrownBy( - () -> - createPolicyRuleBasic( - policyRuleId, - 3, - policyRuleState, - BooleanOperator.POLICYRULE_CONDITION_BOOLEAN_OR, - policyRuleConditions, - null)); + .isThrownBy(() -> createPolicyRuleBasic(null, "", policyRuleState, 3, null)); } @Test @@ -305,15 +235,7 @@ class PolicyRuleBasicValidationTestHelper { final var policyRuleId = UUID.randomUUID().toString(); assertThatExceptionOfType(IllegalArgumentException.class) - .isThrownBy( - () -> - createPolicyRuleBasic( - policyRuleId, - 3, - policyRuleState, - BooleanOperator.POLICYRULE_CONDITION_BOOLEAN_OR, - policyRuleConditions, - policyRuleActions)); + .isThrownBy(() -> createPolicyRuleBasic(null, "", policyRuleState, 3, policyRuleActions)); } @Test @@ -345,10 +267,9 @@ class PolicyRuleBasicValidationTestHelper { final var expectedPolicyRuleBasic = new PolicyRuleBasic( expectedPolicyRuleId, + "kpiId", expectedPolicyRuleState, expectedPriority, - expectedPolicyRuleConditions, - expectedBooleanOperator, expectedPolicyRuleActions); final var policyRuleConditions = @@ -364,13 +285,7 @@ class PolicyRuleBasicValidationTestHelper { final var policyRuleState = new PolicyRuleState(PolicyRuleStateEnum.POLICY_EFFECTIVE, "1"); final var policyRuleBasic = - createPolicyRuleBasic( - "expectedPolicyRuleId", - 3, - policyRuleState, - BooleanOperator.POLICYRULE_CONDITION_BOOLEAN_OR, - policyRuleConditions, - policyRuleActions); + createPolicyRuleBasic(null, "kpiId", policyRuleState, 3, policyRuleActions); assertThat(policyRuleBasic).usingRecursiveComparison().isEqualTo(expectedPolicyRuleBasic); } diff --git a/src/policy/src/test/java/org/etsi/tfs/policy/PolicyRuleDeviceValidationTest.java b/src/policy/src/test/java/org/etsi/tfs/policy/PolicyRuleDeviceValidationTest.java index 57dd7fe3264f5c286e4da9ac1c7ac84bd5417bdf..1a4720e3af5a898cf38c0531092cc91a46110837 100644 --- a/src/policy/src/test/java/org/etsi/tfs/policy/PolicyRuleDeviceValidationTest.java +++ b/src/policy/src/test/java/org/etsi/tfs/policy/PolicyRuleDeviceValidationTest.java @@ -23,7 +23,6 @@ import java.util.List; import java.util.UUID; import org.etsi.tfs.policy.monitoring.model.IntegerKpiValue; import org.etsi.tfs.policy.monitoring.model.KpiValue; -import org.etsi.tfs.policy.policy.model.BooleanOperator; import org.etsi.tfs.policy.policy.model.NumericalOperator; import org.etsi.tfs.policy.policy.model.PolicyRuleAction; import org.etsi.tfs.policy.policy.model.PolicyRuleActionConfig; @@ -40,19 +39,12 @@ class PolicyRuleDeviceValidationTest { private PolicyRuleBasic createPolicyRuleBasic( String policyRuleId, - int priority, + String kpiId, PolicyRuleState policyRuleState, - BooleanOperator booleanOperator, - List policyRuleConditions, + int priority, List policyRuleActions) { - return new PolicyRuleBasic( - policyRuleId, - policyRuleState, - priority, - policyRuleConditions, - booleanOperator, - policyRuleActions); + return new PolicyRuleBasic(policyRuleId, kpiId, policyRuleState, priority, policyRuleActions); } private List createPolicyRuleConditions( @@ -162,13 +154,7 @@ class PolicyRuleDeviceValidationTest { final var policyRuleState = new PolicyRuleState(PolicyRuleStateEnum.POLICY_EFFECTIVE, "1"); final var policyRuleBasic = - createPolicyRuleBasic( - "policyRuleId", - 3, - policyRuleState, - BooleanOperator.POLICYRULE_CONDITION_BOOLEAN_OR, - policyRuleConditions, - policyRuleActions); + createPolicyRuleBasic("policyRuleId", "", policyRuleState, 3, policyRuleActions); final var deviceIds = createDeviceIds(); diff --git a/src/policy/src/test/java/org/etsi/tfs/policy/PolicyRuleServiceValidationTest.java b/src/policy/src/test/java/org/etsi/tfs/policy/PolicyRuleServiceValidationTest.java index 30e7952aae3a09318b004077849d9c7a14831185..05bd3e847fdbca52914aa4aa65b3a4434c68202d 100644 --- a/src/policy/src/test/java/org/etsi/tfs/policy/PolicyRuleServiceValidationTest.java +++ b/src/policy/src/test/java/org/etsi/tfs/policy/PolicyRuleServiceValidationTest.java @@ -44,7 +44,6 @@ import org.etsi.tfs.policy.context.model.TopologyId; import org.etsi.tfs.policy.kpi_sample_types.model.KpiSampleType; import org.etsi.tfs.policy.monitoring.model.IntegerKpiValue; import org.etsi.tfs.policy.monitoring.model.KpiValue; -import org.etsi.tfs.policy.policy.model.BooleanOperator; import org.etsi.tfs.policy.policy.model.NumericalOperator; import org.etsi.tfs.policy.policy.model.PolicyRuleAction; import org.etsi.tfs.policy.policy.model.PolicyRuleActionConfig; @@ -145,19 +144,12 @@ class PolicyRuleServiceValidationTest { private PolicyRuleBasic createPolicyRuleBasic( String policyRuleId, - int priority, + String kpiId, PolicyRuleState policyRuleState, - BooleanOperator booleanOperator, - List policyRuleConditions, + int priority, List policyRuleActions) { - return new PolicyRuleBasic( - policyRuleId, - policyRuleState, - priority, - policyRuleConditions, - booleanOperator, - policyRuleActions); + return new PolicyRuleBasic(policyRuleId, kpiId, policyRuleState, priority, policyRuleActions); } private ServiceId createServiceId(String contextId, String id) { @@ -263,13 +255,7 @@ class PolicyRuleServiceValidationTest { final var policyRuleState = new PolicyRuleState(PolicyRuleStateEnum.POLICY_EFFECTIVE, "1"); final var policyRuleBasic = - createPolicyRuleBasic( - "policyRuleId", - 777, - policyRuleState, - BooleanOperator.POLICYRULE_CONDITION_BOOLEAN_AND, - policyRuleConditions, - policyRuleActions); + createPolicyRuleBasic("policyRuleId", "kpiId", policyRuleState, 0, policyRuleActions); final var expectedPolicyRuleService = new PolicyRuleService(policyRuleBasic, serviceId, deviceIds); @@ -299,13 +285,7 @@ class PolicyRuleServiceValidationTest { final var policyRuleState = new PolicyRuleState(PolicyRuleStateEnum.POLICY_EFFECTIVE, "1"); final var policyRuleBasic = - createPolicyRuleBasic( - "policyRuleId", - 3, - policyRuleState, - BooleanOperator.POLICYRULE_CONDITION_BOOLEAN_OR, - policyRuleConditions, - policyRuleActions); + createPolicyRuleBasic("policyRuleId", "kpiId", policyRuleState, 0, policyRuleActions); final var expectedPolicyRuleService = new PolicyRuleService(policyRuleBasic, serviceId, deviceIds); diff --git a/src/policy/src/test/java/org/etsi/tfs/policy/PolicyUpdateDeviceTest.java b/src/policy/src/test/java/org/etsi/tfs/policy/PolicyUpdateDeviceTest.java index 825cfebbd9c25080e9d8a3e8581cffaa287e0f73..ddc8c7b053323530933447918dc2ef74afbc73e6 100644 --- a/src/policy/src/test/java/org/etsi/tfs/policy/PolicyUpdateDeviceTest.java +++ b/src/policy/src/test/java/org/etsi/tfs/policy/PolicyUpdateDeviceTest.java @@ -35,7 +35,6 @@ import org.etsi.tfs.policy.monitoring.MonitoringService; import org.etsi.tfs.policy.monitoring.model.IntegerKpiValue; import org.etsi.tfs.policy.monitoring.model.KpiValue; import org.etsi.tfs.policy.policy.PolicyServiceImpl; -import org.etsi.tfs.policy.policy.model.BooleanOperator; import org.etsi.tfs.policy.policy.model.NumericalOperator; import org.etsi.tfs.policy.policy.model.PolicyRuleAction; import org.etsi.tfs.policy.policy.model.PolicyRuleActionConfig; @@ -82,10 +81,9 @@ class PolicyUpdateDeviceTest { policyRuleBasic = new PolicyRuleBasic( policyId, + "kpiId", new PolicyRuleState(PolicyRuleStateEnum.POLICY_INSERTED, "Failed due to some errors"), 1, - Arrays.asList(policyRuleCondition), - BooleanOperator.POLICYRULE_CONDITION_BOOLEAN_OR, Arrays.asList(policyRuleAction)); List deviceIds = Arrays.asList("device1", "device2"); @@ -122,10 +120,9 @@ class PolicyUpdateDeviceTest { PolicyRuleBasic policyRuleBasic = new PolicyRuleBasic( "policyId", + "kpiId", new PolicyRuleState(PolicyRuleStateEnum.POLICY_INSERTED, "Failed due to some errors"), 0, - new ArrayList<>(), - BooleanOperator.POLICYRULE_CONDITION_BOOLEAN_OR, new ArrayList<>()); PolicyRuleDevice policyRuleDevice = @@ -133,7 +130,7 @@ class PolicyUpdateDeviceTest { PolicyRuleState expectedResult = new PolicyRuleState( - PolicyRuleStateEnum.POLICY_FAILED, "Policy Rule conditions cannot be empty."); + PolicyRuleStateEnum.POLICY_FAILED, "Policy Rule actions cannot be empty."); policyService .updatePolicyDevice(policyRuleDevice) diff --git a/src/policy/src/test/java/org/etsi/tfs/policy/PolicyUpdateServiceTest.java b/src/policy/src/test/java/org/etsi/tfs/policy/PolicyUpdateServiceTest.java index d7173660760d1d6825df90f4168c3a90806ca3ae..8c8bcf47e3a4ce155aa4d909155387bab4b22ab8 100644 --- a/src/policy/src/test/java/org/etsi/tfs/policy/PolicyUpdateServiceTest.java +++ b/src/policy/src/test/java/org/etsi/tfs/policy/PolicyUpdateServiceTest.java @@ -39,7 +39,6 @@ import org.etsi.tfs.policy.monitoring.MonitoringService; import org.etsi.tfs.policy.monitoring.model.IntegerKpiValue; import org.etsi.tfs.policy.monitoring.model.KpiValue; import org.etsi.tfs.policy.policy.PolicyServiceImpl; -import org.etsi.tfs.policy.policy.model.BooleanOperator; import org.etsi.tfs.policy.policy.model.NumericalOperator; import org.etsi.tfs.policy.policy.model.PolicyRuleAction; import org.etsi.tfs.policy.policy.model.PolicyRuleActionConfig; @@ -88,10 +87,9 @@ class PolicyUpdateServiceTest { policyRuleBasic = new PolicyRuleBasic( policyId, + "kpiId", new PolicyRuleState(PolicyRuleStateEnum.POLICY_INSERTED, "Failed due to some errors"), 1, - Arrays.asList(policyRuleCondition), - BooleanOperator.POLICYRULE_CONDITION_BOOLEAN_OR, Arrays.asList(policyRuleAction)); ServiceId serviceId = new ServiceId("contextId", "serviceId"); diff --git a/src/policy/src/test/java/org/etsi/tfs/policy/SerializerTest.java b/src/policy/src/test/java/org/etsi/tfs/policy/SerializerTest.java index 46e656801411f06a8329018a199681786f1f9eef..19a7179a702050d65cce7d8cfb9ce82f222bbdb1 100644 --- a/src/policy/src/test/java/org/etsi/tfs/policy/SerializerTest.java +++ b/src/policy/src/test/java/org/etsi/tfs/policy/SerializerTest.java @@ -165,11 +165,6 @@ class SerializerTest { NumericalOperator.POLICY_RULE_CONDITION_NUMERICAL_EQUAL, secondKpiValue); - final var expectedPolicyRuleConditions = - List.of(firstExpectedPolicyRuleCondition, secondExpectedPolicyRuleCondition); - - final var expectedBooleanOperator = BooleanOperator.POLICYRULE_CONDITION_BOOLEAN_OR; - final var firstExpectedPolicyRuleAction = new PolicyRuleAction( PolicyRuleActionEnum.POLICY_RULE_ACTION_SET_DEVICE_STATUS, @@ -185,10 +180,9 @@ class SerializerTest { return new PolicyRuleBasic( expectedPolicyRuleId, + "kpiId", expectedPolicyRuleState, expectedPriority, - expectedPolicyRuleConditions, - expectedBooleanOperator, expectedPolicyRuleActions); } @@ -3060,18 +3054,13 @@ class SerializerTest { final var expectedPolicyRuleId = policyRuleBasic.getPolicyRuleId(); final var expectedPolicyRuleState = policyRuleBasic.getPolicyRuleState(); - final var expectedPriority = policyRuleBasic.getPriority(); - final var expectedPolicyRuleConditions = policyRuleBasic.getPolicyRuleConditions(); - final var expectedBooleanOperator = policyRuleBasic.getBooleanOperator(); final var expectedPolicyRuleActions = policyRuleBasic.getPolicyRuleActions(); + final var expectedPriority = policyRuleBasic.getPriority(); + final var expectedKpiId = policyRuleBasic.getKpiId(); final var serializedPolicyRuleId = serializer.serializePolicyRuleId(expectedPolicyRuleId); final var serializedPolicyRuleState = serializer.serialize(expectedPolicyRuleState); - final var serializedPolicyRuleConditions = - expectedPolicyRuleConditions.stream() - .map(policyRuleCondition -> serializer.serialize(policyRuleCondition)) - .collect(Collectors.toList()); - final var serializedBooleanOperator = serializer.serialize(expectedBooleanOperator); + final var serializedPolicyRuleActions = expectedPolicyRuleActions.stream() .map(policyRuleAction -> serializer.serialize(policyRuleAction)) @@ -3080,10 +3069,9 @@ class SerializerTest { final var expectedPolicyRuleBasic = Policy.PolicyRuleBasic.newBuilder() .setPolicyRuleId(serializedPolicyRuleId) - .setPolicyRuleState(serializedPolicyRuleState) .setPriority(expectedPriority) - .addAllConditionList(serializedPolicyRuleConditions) - .setBooleanOperator(serializedBooleanOperator) + .setKpiId(KpiId.newBuilder().setKpiId(Uuid.newBuilder().setUuid("kpiId").build())) + .setPolicyRuleState(serializedPolicyRuleState) .addAllActionList(serializedPolicyRuleActions) .build(); @@ -3101,17 +3089,12 @@ class SerializerTest { final var expectedPolicyRuleId = expectedPolicyRuleBasic.getPolicyRuleId(); final var expectedPolicyRuleState = expectedPolicyRuleBasic.getPolicyRuleState(); final var expectedPriority = expectedPolicyRuleBasic.getPriority(); - final var expectedPolicyRuleConditions = expectedPolicyRuleBasic.getPolicyRuleConditions(); - final var expectedBooleanOperator = expectedPolicyRuleBasic.getBooleanOperator(); + final var expectedKpiId = expectedPolicyRuleBasic.getKpiId(); final var expectedPolicyRuleActions = expectedPolicyRuleBasic.getPolicyRuleActions(); final var serializedPolicyRuleId = serializer.serializePolicyRuleId(expectedPolicyRuleId); final var serializedPolicyRuleState = serializer.serialize(expectedPolicyRuleState); - final var serializedPolicyRuleConditions = - expectedPolicyRuleConditions.stream() - .map(policyRuleCondition -> serializer.serialize(policyRuleCondition)) - .collect(Collectors.toList()); - final var serializedBooleanOperator = serializer.serialize(expectedBooleanOperator); + final var serializedPolicyRuleActions = expectedPolicyRuleActions.stream() .map(policyRuleAction -> serializer.serialize(policyRuleAction)) @@ -3121,9 +3104,8 @@ class SerializerTest { Policy.PolicyRuleBasic.newBuilder() .setPolicyRuleId(serializedPolicyRuleId) .setPolicyRuleState(serializedPolicyRuleState) + .setKpiId(KpiId.newBuilder().setKpiId(Uuid.newBuilder().setUuid("kpiId").build())) .setPriority(expectedPriority) - .addAllConditionList(serializedPolicyRuleConditions) - .setBooleanOperator(serializedBooleanOperator) .addAllActionList(serializedPolicyRuleActions) .build(); @@ -3230,7 +3212,9 @@ class SerializerTest { final var serializedPolicyRuleDevice = Policy.PolicyRuleDevice.newBuilder() .setPolicyRuleBasic(serializedPolicyRuleBasic) - .addAllDeviceList(serializedPolicyRuleDeviceIds) + .addAllDeviceList( + (Iterable) + serializedPolicyRuleDeviceIds) .build(); final var policyRuleDevice = serializer.deserialize(serializedPolicyRuleDevice); diff --git a/src/policy/target/generated-sources/grpc/policy/Policy.java b/src/policy/target/generated-sources/grpc/policy/Policy.java index 30aa624d4c5f5f8be2ac57994afff26d53644fdf..04d033e66a3566e3d8a4a3298f55f1b96847b81a 100644 --- a/src/policy/target/generated-sources/grpc/policy/Policy.java +++ b/src/policy/target/generated-sources/grpc/policy/Policy.java @@ -1510,111 +1510,75 @@ public final class Policy { /** *
-         * Event-Condition-Action (ECA) model
-         * 
- * - * repeated .policy.PolicyRuleCondition conditionList = 4; - */ - java.util.List getConditionListList(); - - /** - *
-         * Event-Condition-Action (ECA) model
+         * to be migrated to: "kpi_manager.KpiId"
          * 
* - * repeated .policy.PolicyRuleCondition conditionList = 4; + * .monitoring.KpiId kpiId = 4; + * @return Whether the kpiId field is set. */ - policy.PolicyCondition.PolicyRuleCondition getConditionList(int index); + boolean hasKpiId(); /** *
-         * Event-Condition-Action (ECA) model
+         * to be migrated to: "kpi_manager.KpiId"
          * 
* - * repeated .policy.PolicyRuleCondition conditionList = 4; + * .monitoring.KpiId kpiId = 4; + * @return The kpiId. */ - int getConditionListCount(); + monitoring.Monitoring.KpiId getKpiId(); /** *
-         * Event-Condition-Action (ECA) model
+         * to be migrated to: "kpi_manager.KpiId"
          * 
* - * repeated .policy.PolicyRuleCondition conditionList = 4; + * .monitoring.KpiId kpiId = 4; */ - java.util.List getConditionListOrBuilderList(); + monitoring.Monitoring.KpiIdOrBuilder getKpiIdOrBuilder(); /** *
          * Event-Condition-Action (ECA) model
          * 
* - * repeated .policy.PolicyRuleCondition conditionList = 4; - */ - policy.PolicyCondition.PolicyRuleConditionOrBuilder getConditionListOrBuilder(int index); - - /** - *
-         * Evaluation operator to be used
-         * 
- * - * .policy.BooleanOperator booleanOperator = 5; - * @return The enum numeric value on the wire for booleanOperator. - */ - int getBooleanOperatorValue(); - - /** - *
-         * Evaluation operator to be used
-         * 
- * - * .policy.BooleanOperator booleanOperator = 5; - * @return The booleanOperator. - */ - policy.PolicyCondition.BooleanOperator getBooleanOperator(); - - /** - *
-         * One or more actions should be applied
-         * 
- * - * repeated .policy.PolicyRuleAction actionList = 6; + * repeated .policy.PolicyRuleAction actionList = 5; */ java.util.List getActionListList(); /** *
-         * One or more actions should be applied
+         * Event-Condition-Action (ECA) model
          * 
* - * repeated .policy.PolicyRuleAction actionList = 6; + * repeated .policy.PolicyRuleAction actionList = 5; */ policy.PolicyAction.PolicyRuleAction getActionList(int index); /** *
-         * One or more actions should be applied
+         * Event-Condition-Action (ECA) model
          * 
* - * repeated .policy.PolicyRuleAction actionList = 6; + * repeated .policy.PolicyRuleAction actionList = 5; */ int getActionListCount(); /** *
-         * One or more actions should be applied
+         * Event-Condition-Action (ECA) model
          * 
* - * repeated .policy.PolicyRuleAction actionList = 6; + * repeated .policy.PolicyRuleAction actionList = 5; */ java.util.List getActionListOrBuilderList(); /** *
-         * One or more actions should be applied
+         * Event-Condition-Action (ECA) model
          * 
* - * repeated .policy.PolicyRuleAction actionList = 6; + * repeated .policy.PolicyRuleAction actionList = 5; */ policy.PolicyAction.PolicyRuleActionOrBuilder getActionListOrBuilder(int index); } @@ -1637,8 +1601,6 @@ public final class Policy { } private PolicyRuleBasic() { - conditionList_ = java.util.Collections.emptyList(); - booleanOperator_ = 0; actionList_ = java.util.Collections.emptyList(); } @@ -1742,113 +1704,59 @@ public final class Policy { return priority_; } - public static final int CONDITIONLIST_FIELD_NUMBER = 4; + public static final int KPIID_FIELD_NUMBER = 4; - @SuppressWarnings("serial") - private java.util.List conditionList_; + private monitoring.Monitoring.KpiId kpiId_; /** *
-         * Event-Condition-Action (ECA) model
+         * to be migrated to: "kpi_manager.KpiId"
          * 
* - * repeated .policy.PolicyRuleCondition conditionList = 4; + * .monitoring.KpiId kpiId = 4; + * @return Whether the kpiId field is set. */ @java.lang.Override - public java.util.List getConditionListList() { - return conditionList_; + public boolean hasKpiId() { + return kpiId_ != null; } /** *
-         * Event-Condition-Action (ECA) model
+         * to be migrated to: "kpi_manager.KpiId"
          * 
* - * repeated .policy.PolicyRuleCondition conditionList = 4; + * .monitoring.KpiId kpiId = 4; + * @return The kpiId. */ @java.lang.Override - public java.util.List getConditionListOrBuilderList() { - return conditionList_; + public monitoring.Monitoring.KpiId getKpiId() { + return kpiId_ == null ? monitoring.Monitoring.KpiId.getDefaultInstance() : kpiId_; } /** *
-         * Event-Condition-Action (ECA) model
+         * to be migrated to: "kpi_manager.KpiId"
          * 
* - * repeated .policy.PolicyRuleCondition conditionList = 4; + * .monitoring.KpiId kpiId = 4; */ @java.lang.Override - public int getConditionListCount() { - return conditionList_.size(); + public monitoring.Monitoring.KpiIdOrBuilder getKpiIdOrBuilder() { + return kpiId_ == null ? monitoring.Monitoring.KpiId.getDefaultInstance() : kpiId_; } - /** - *
-         * Event-Condition-Action (ECA) model
-         * 
- * - * repeated .policy.PolicyRuleCondition conditionList = 4; - */ - @java.lang.Override - public policy.PolicyCondition.PolicyRuleCondition getConditionList(int index) { - return conditionList_.get(index); - } - - /** - *
-         * Event-Condition-Action (ECA) model
-         * 
- * - * repeated .policy.PolicyRuleCondition conditionList = 4; - */ - @java.lang.Override - public policy.PolicyCondition.PolicyRuleConditionOrBuilder getConditionListOrBuilder(int index) { - return conditionList_.get(index); - } - - public static final int BOOLEANOPERATOR_FIELD_NUMBER = 5; - - private int booleanOperator_ = 0; - - /** - *
-         * Evaluation operator to be used
-         * 
- * - * .policy.BooleanOperator booleanOperator = 5; - * @return The enum numeric value on the wire for booleanOperator. - */ - @java.lang.Override - public int getBooleanOperatorValue() { - return booleanOperator_; - } - - /** - *
-         * Evaluation operator to be used
-         * 
- * - * .policy.BooleanOperator booleanOperator = 5; - * @return The booleanOperator. - */ - @java.lang.Override - public policy.PolicyCondition.BooleanOperator getBooleanOperator() { - policy.PolicyCondition.BooleanOperator result = policy.PolicyCondition.BooleanOperator.forNumber(booleanOperator_); - return result == null ? policy.PolicyCondition.BooleanOperator.UNRECOGNIZED : result; - } - - public static final int ACTIONLIST_FIELD_NUMBER = 6; + public static final int ACTIONLIST_FIELD_NUMBER = 5; @SuppressWarnings("serial") private java.util.List actionList_; /** *
-         * One or more actions should be applied
+         * Event-Condition-Action (ECA) model
          * 
* - * repeated .policy.PolicyRuleAction actionList = 6; + * repeated .policy.PolicyRuleAction actionList = 5; */ @java.lang.Override public java.util.List getActionListList() { @@ -1857,10 +1765,10 @@ public final class Policy { /** *
-         * One or more actions should be applied
+         * Event-Condition-Action (ECA) model
          * 
* - * repeated .policy.PolicyRuleAction actionList = 6; + * repeated .policy.PolicyRuleAction actionList = 5; */ @java.lang.Override public java.util.List getActionListOrBuilderList() { @@ -1869,10 +1777,10 @@ public final class Policy { /** *
-         * One or more actions should be applied
+         * Event-Condition-Action (ECA) model
          * 
* - * repeated .policy.PolicyRuleAction actionList = 6; + * repeated .policy.PolicyRuleAction actionList = 5; */ @java.lang.Override public int getActionListCount() { @@ -1881,10 +1789,10 @@ public final class Policy { /** *
-         * One or more actions should be applied
+         * Event-Condition-Action (ECA) model
          * 
* - * repeated .policy.PolicyRuleAction actionList = 6; + * repeated .policy.PolicyRuleAction actionList = 5; */ @java.lang.Override public policy.PolicyAction.PolicyRuleAction getActionList(int index) { @@ -1893,10 +1801,10 @@ public final class Policy { /** *
-         * One or more actions should be applied
+         * Event-Condition-Action (ECA) model
          * 
* - * repeated .policy.PolicyRuleAction actionList = 6; + * repeated .policy.PolicyRuleAction actionList = 5; */ @java.lang.Override public policy.PolicyAction.PolicyRuleActionOrBuilder getActionListOrBuilder(int index) { @@ -1927,14 +1835,11 @@ public final class Policy { if (priority_ != 0) { output.writeUInt32(3, priority_); } - for (int i = 0; i < conditionList_.size(); i++) { - output.writeMessage(4, conditionList_.get(i)); - } - if (booleanOperator_ != policy.PolicyCondition.BooleanOperator.POLICYRULE_CONDITION_BOOLEAN_UNDEFINED.getNumber()) { - output.writeEnum(5, booleanOperator_); + if (kpiId_ != null) { + output.writeMessage(4, getKpiId()); } for (int i = 0; i < actionList_.size(); i++) { - output.writeMessage(6, actionList_.get(i)); + output.writeMessage(5, actionList_.get(i)); } getUnknownFields().writeTo(output); } @@ -1954,14 +1859,11 @@ public final class Policy { if (priority_ != 0) { size += com.google.protobuf.CodedOutputStream.computeUInt32Size(3, priority_); } - for (int i = 0; i < conditionList_.size(); i++) { - size += com.google.protobuf.CodedOutputStream.computeMessageSize(4, conditionList_.get(i)); - } - if (booleanOperator_ != policy.PolicyCondition.BooleanOperator.POLICYRULE_CONDITION_BOOLEAN_UNDEFINED.getNumber()) { - size += com.google.protobuf.CodedOutputStream.computeEnumSize(5, booleanOperator_); + if (kpiId_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(4, getKpiId()); } for (int i = 0; i < actionList_.size(); i++) { - size += com.google.protobuf.CodedOutputStream.computeMessageSize(6, actionList_.get(i)); + size += com.google.protobuf.CodedOutputStream.computeMessageSize(5, actionList_.get(i)); } size += getUnknownFields().getSerializedSize(); memoizedSize = size; @@ -1991,10 +1893,12 @@ public final class Policy { } if (getPriority() != other.getPriority()) return false; - if (!getConditionListList().equals(other.getConditionListList())) - return false; - if (booleanOperator_ != other.booleanOperator_) + if (hasKpiId() != other.hasKpiId()) return false; + if (hasKpiId()) { + if (!getKpiId().equals(other.getKpiId())) + return false; + } if (!getActionListList().equals(other.getActionListList())) return false; if (!getUnknownFields().equals(other.getUnknownFields())) @@ -2019,12 +1923,10 @@ public final class Policy { } hash = (37 * hash) + PRIORITY_FIELD_NUMBER; hash = (53 * hash) + getPriority(); - if (getConditionListCount() > 0) { - hash = (37 * hash) + CONDITIONLIST_FIELD_NUMBER; - hash = (53 * hash) + getConditionListList().hashCode(); + if (hasKpiId()) { + hash = (37 * hash) + KPIID_FIELD_NUMBER; + hash = (53 * hash) + getKpiId().hashCode(); } - hash = (37 * hash) + BOOLEANOPERATOR_FIELD_NUMBER; - hash = (53 * hash) + booleanOperator_; if (getActionListCount() > 0) { hash = (37 * hash) + ACTIONLIST_FIELD_NUMBER; hash = (53 * hash) + getActionListList().hashCode(); @@ -2148,21 +2050,18 @@ public final class Policy { policyRuleStateBuilder_ = null; } priority_ = 0; - if (conditionListBuilder_ == null) { - conditionList_ = java.util.Collections.emptyList(); - } else { - conditionList_ = null; - conditionListBuilder_.clear(); + kpiId_ = null; + if (kpiIdBuilder_ != null) { + kpiIdBuilder_.dispose(); + kpiIdBuilder_ = null; } - bitField0_ = (bitField0_ & ~0x00000008); - booleanOperator_ = 0; if (actionListBuilder_ == null) { actionList_ = java.util.Collections.emptyList(); } else { actionList_ = null; actionListBuilder_.clear(); } - bitField0_ = (bitField0_ & ~0x00000020); + bitField0_ = (bitField0_ & ~0x00000010); return this; } @@ -2197,19 +2096,10 @@ public final class Policy { } private void buildPartialRepeatedFields(policy.Policy.PolicyRuleBasic result) { - if (conditionListBuilder_ == null) { - if (((bitField0_ & 0x00000008) != 0)) { - conditionList_ = java.util.Collections.unmodifiableList(conditionList_); - bitField0_ = (bitField0_ & ~0x00000008); - } - result.conditionList_ = conditionList_; - } else { - result.conditionList_ = conditionListBuilder_.build(); - } if (actionListBuilder_ == null) { - if (((bitField0_ & 0x00000020) != 0)) { + if (((bitField0_ & 0x00000010) != 0)) { actionList_ = java.util.Collections.unmodifiableList(actionList_); - bitField0_ = (bitField0_ & ~0x00000020); + bitField0_ = (bitField0_ & ~0x00000010); } result.actionList_ = actionList_; } else { @@ -2228,8 +2118,8 @@ public final class Policy { if (((from_bitField0_ & 0x00000004) != 0)) { result.priority_ = priority_; } - if (((from_bitField0_ & 0x00000010) != 0)) { - result.booleanOperator_ = booleanOperator_; + if (((from_bitField0_ & 0x00000008) != 0)) { + result.kpiId_ = kpiIdBuilder_ == null ? kpiId_ : kpiIdBuilder_.build(); } } @@ -2255,38 +2145,14 @@ public final class Policy { if (other.getPriority() != 0) { setPriority(other.getPriority()); } - if (conditionListBuilder_ == null) { - if (!other.conditionList_.isEmpty()) { - if (conditionList_.isEmpty()) { - conditionList_ = other.conditionList_; - bitField0_ = (bitField0_ & ~0x00000008); - } else { - ensureConditionListIsMutable(); - conditionList_.addAll(other.conditionList_); - } - onChanged(); - } - } else { - if (!other.conditionList_.isEmpty()) { - if (conditionListBuilder_.isEmpty()) { - conditionListBuilder_.dispose(); - conditionListBuilder_ = null; - conditionList_ = other.conditionList_; - bitField0_ = (bitField0_ & ~0x00000008); - conditionListBuilder_ = com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? getConditionListFieldBuilder() : null; - } else { - conditionListBuilder_.addAllMessages(other.conditionList_); - } - } - } - if (other.booleanOperator_ != 0) { - setBooleanOperatorValue(other.getBooleanOperatorValue()); + if (other.hasKpiId()) { + mergeKpiId(other.getKpiId()); } if (actionListBuilder_ == null) { if (!other.actionList_.isEmpty()) { if (actionList_.isEmpty()) { actionList_ = other.actionList_; - bitField0_ = (bitField0_ & ~0x00000020); + bitField0_ = (bitField0_ & ~0x00000010); } else { ensureActionListIsMutable(); actionList_.addAll(other.actionList_); @@ -2299,7 +2165,7 @@ public final class Policy { actionListBuilder_.dispose(); actionListBuilder_ = null; actionList_ = other.actionList_; - bitField0_ = (bitField0_ & ~0x00000020); + bitField0_ = (bitField0_ & ~0x00000010); actionListBuilder_ = com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? getActionListFieldBuilder() : null; } else { actionListBuilder_.addAllMessages(other.actionList_); @@ -2352,24 +2218,12 @@ public final class Policy { // case 24 case 34: { - policy.PolicyCondition.PolicyRuleCondition m = input.readMessage(policy.PolicyCondition.PolicyRuleCondition.parser(), extensionRegistry); - if (conditionListBuilder_ == null) { - ensureConditionListIsMutable(); - conditionList_.add(m); - } else { - conditionListBuilder_.addMessage(m); - } + input.readMessage(getKpiIdFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000008; break; } // case 34 - case 40: - { - booleanOperator_ = input.readEnum(); - bitField0_ |= 0x00000010; - break; - } - // case 40 - case 50: + case 42: { policy.PolicyAction.PolicyRuleAction m = input.readMessage(policy.PolicyAction.PolicyRuleAction.parser(), extensionRegistry); if (actionListBuilder_ == null) { @@ -2380,7 +2234,7 @@ public final class Policy { } break; } - // case 50 + // case 42 default: { if (!super.parseUnknownField(input, extensionRegistry, tag)) { @@ -2710,400 +2564,166 @@ public final class Policy { return this; } - private java.util.List conditionList_ = java.util.Collections.emptyList(); + private monitoring.Monitoring.KpiId kpiId_; - private void ensureConditionListIsMutable() { - if (!((bitField0_ & 0x00000008) != 0)) { - conditionList_ = new java.util.ArrayList(conditionList_); - bitField0_ |= 0x00000008; - } - } - - private com.google.protobuf.RepeatedFieldBuilderV3 conditionListBuilder_; + private com.google.protobuf.SingleFieldBuilderV3 kpiIdBuilder_; /** *
-             * Event-Condition-Action (ECA) model
+             * to be migrated to: "kpi_manager.KpiId"
              * 
* - * repeated .policy.PolicyRuleCondition conditionList = 4; + * .monitoring.KpiId kpiId = 4; + * @return Whether the kpiId field is set. */ - public java.util.List getConditionListList() { - if (conditionListBuilder_ == null) { - return java.util.Collections.unmodifiableList(conditionList_); - } else { - return conditionListBuilder_.getMessageList(); - } + public boolean hasKpiId() { + return ((bitField0_ & 0x00000008) != 0); } /** *
-             * Event-Condition-Action (ECA) model
+             * to be migrated to: "kpi_manager.KpiId"
              * 
* - * repeated .policy.PolicyRuleCondition conditionList = 4; + * .monitoring.KpiId kpiId = 4; + * @return The kpiId. */ - public int getConditionListCount() { - if (conditionListBuilder_ == null) { - return conditionList_.size(); + public monitoring.Monitoring.KpiId getKpiId() { + if (kpiIdBuilder_ == null) { + return kpiId_ == null ? monitoring.Monitoring.KpiId.getDefaultInstance() : kpiId_; } else { - return conditionListBuilder_.getCount(); + return kpiIdBuilder_.getMessage(); } } /** *
-             * Event-Condition-Action (ECA) model
+             * to be migrated to: "kpi_manager.KpiId"
              * 
* - * repeated .policy.PolicyRuleCondition conditionList = 4; + * .monitoring.KpiId kpiId = 4; */ - public policy.PolicyCondition.PolicyRuleCondition getConditionList(int index) { - if (conditionListBuilder_ == null) { - return conditionList_.get(index); - } else { - return conditionListBuilder_.getMessage(index); - } - } - - /** - *
-             * Event-Condition-Action (ECA) model
-             * 
- * - * repeated .policy.PolicyRuleCondition conditionList = 4; - */ - public Builder setConditionList(int index, policy.PolicyCondition.PolicyRuleCondition value) { - if (conditionListBuilder_ == null) { + public Builder setKpiId(monitoring.Monitoring.KpiId value) { + if (kpiIdBuilder_ == null) { if (value == null) { throw new NullPointerException(); } - ensureConditionListIsMutable(); - conditionList_.set(index, value); - onChanged(); + kpiId_ = value; } else { - conditionListBuilder_.setMessage(index, value); - } - return this; - } - - /** - *
-             * Event-Condition-Action (ECA) model
-             * 
- * - * repeated .policy.PolicyRuleCondition conditionList = 4; - */ - public Builder setConditionList(int index, policy.PolicyCondition.PolicyRuleCondition.Builder builderForValue) { - if (conditionListBuilder_ == null) { - ensureConditionListIsMutable(); - conditionList_.set(index, builderForValue.build()); - onChanged(); - } else { - conditionListBuilder_.setMessage(index, builderForValue.build()); + kpiIdBuilder_.setMessage(value); } + bitField0_ |= 0x00000008; + onChanged(); return this; } /** *
-             * Event-Condition-Action (ECA) model
+             * to be migrated to: "kpi_manager.KpiId"
              * 
* - * repeated .policy.PolicyRuleCondition conditionList = 4; + * .monitoring.KpiId kpiId = 4; */ - public Builder addConditionList(policy.PolicyCondition.PolicyRuleCondition value) { - if (conditionListBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureConditionListIsMutable(); - conditionList_.add(value); - onChanged(); + public Builder setKpiId(monitoring.Monitoring.KpiId.Builder builderForValue) { + if (kpiIdBuilder_ == null) { + kpiId_ = builderForValue.build(); } else { - conditionListBuilder_.addMessage(value); + kpiIdBuilder_.setMessage(builderForValue.build()); } + bitField0_ |= 0x00000008; + onChanged(); return this; } /** *
-             * Event-Condition-Action (ECA) model
+             * to be migrated to: "kpi_manager.KpiId"
              * 
* - * repeated .policy.PolicyRuleCondition conditionList = 4; + * .monitoring.KpiId kpiId = 4; */ - public Builder addConditionList(int index, policy.PolicyCondition.PolicyRuleCondition value) { - if (conditionListBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); + public Builder mergeKpiId(monitoring.Monitoring.KpiId value) { + if (kpiIdBuilder_ == null) { + if (((bitField0_ & 0x00000008) != 0) && kpiId_ != null && kpiId_ != monitoring.Monitoring.KpiId.getDefaultInstance()) { + getKpiIdBuilder().mergeFrom(value); + } else { + kpiId_ = value; } - ensureConditionListIsMutable(); - conditionList_.add(index, value); - onChanged(); - } else { - conditionListBuilder_.addMessage(index, value); - } - return this; - } - - /** - *
-             * Event-Condition-Action (ECA) model
-             * 
- * - * repeated .policy.PolicyRuleCondition conditionList = 4; - */ - public Builder addConditionList(policy.PolicyCondition.PolicyRuleCondition.Builder builderForValue) { - if (conditionListBuilder_ == null) { - ensureConditionListIsMutable(); - conditionList_.add(builderForValue.build()); - onChanged(); - } else { - conditionListBuilder_.addMessage(builderForValue.build()); - } - return this; - } - - /** - *
-             * Event-Condition-Action (ECA) model
-             * 
- * - * repeated .policy.PolicyRuleCondition conditionList = 4; - */ - public Builder addConditionList(int index, policy.PolicyCondition.PolicyRuleCondition.Builder builderForValue) { - if (conditionListBuilder_ == null) { - ensureConditionListIsMutable(); - conditionList_.add(index, builderForValue.build()); - onChanged(); } else { - conditionListBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - - /** - *
-             * Event-Condition-Action (ECA) model
-             * 
- * - * repeated .policy.PolicyRuleCondition conditionList = 4; - */ - public Builder addAllConditionList(java.lang.Iterable values) { - if (conditionListBuilder_ == null) { - ensureConditionListIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll(values, conditionList_); - onChanged(); - } else { - conditionListBuilder_.addAllMessages(values); - } - return this; - } - - /** - *
-             * Event-Condition-Action (ECA) model
-             * 
- * - * repeated .policy.PolicyRuleCondition conditionList = 4; - */ - public Builder clearConditionList() { - if (conditionListBuilder_ == null) { - conditionList_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000008); - onChanged(); - } else { - conditionListBuilder_.clear(); + kpiIdBuilder_.mergeFrom(value); } + bitField0_ |= 0x00000008; + onChanged(); return this; } /** *
-             * Event-Condition-Action (ECA) model
+             * to be migrated to: "kpi_manager.KpiId"
              * 
* - * repeated .policy.PolicyRuleCondition conditionList = 4; + * .monitoring.KpiId kpiId = 4; */ - public Builder removeConditionList(int index) { - if (conditionListBuilder_ == null) { - ensureConditionListIsMutable(); - conditionList_.remove(index); - onChanged(); - } else { - conditionListBuilder_.remove(index); + public Builder clearKpiId() { + bitField0_ = (bitField0_ & ~0x00000008); + kpiId_ = null; + if (kpiIdBuilder_ != null) { + kpiIdBuilder_.dispose(); + kpiIdBuilder_ = null; } + onChanged(); return this; } /** *
-             * Event-Condition-Action (ECA) model
+             * to be migrated to: "kpi_manager.KpiId"
              * 
* - * repeated .policy.PolicyRuleCondition conditionList = 4; + * .monitoring.KpiId kpiId = 4; */ - public policy.PolicyCondition.PolicyRuleCondition.Builder getConditionListBuilder(int index) { - return getConditionListFieldBuilder().getBuilder(index); - } - - /** - *
-             * Event-Condition-Action (ECA) model
-             * 
- * - * repeated .policy.PolicyRuleCondition conditionList = 4; - */ - public policy.PolicyCondition.PolicyRuleConditionOrBuilder getConditionListOrBuilder(int index) { - if (conditionListBuilder_ == null) { - return conditionList_.get(index); - } else { - return conditionListBuilder_.getMessageOrBuilder(index); - } + public monitoring.Monitoring.KpiId.Builder getKpiIdBuilder() { + bitField0_ |= 0x00000008; + onChanged(); + return getKpiIdFieldBuilder().getBuilder(); } /** *
-             * Event-Condition-Action (ECA) model
+             * to be migrated to: "kpi_manager.KpiId"
              * 
* - * repeated .policy.PolicyRuleCondition conditionList = 4; + * .monitoring.KpiId kpiId = 4; */ - public java.util.List getConditionListOrBuilderList() { - if (conditionListBuilder_ != null) { - return conditionListBuilder_.getMessageOrBuilderList(); + public monitoring.Monitoring.KpiIdOrBuilder getKpiIdOrBuilder() { + if (kpiIdBuilder_ != null) { + return kpiIdBuilder_.getMessageOrBuilder(); } else { - return java.util.Collections.unmodifiableList(conditionList_); - } - } - - /** - *
-             * Event-Condition-Action (ECA) model
-             * 
- * - * repeated .policy.PolicyRuleCondition conditionList = 4; - */ - public policy.PolicyCondition.PolicyRuleCondition.Builder addConditionListBuilder() { - return getConditionListFieldBuilder().addBuilder(policy.PolicyCondition.PolicyRuleCondition.getDefaultInstance()); - } - - /** - *
-             * Event-Condition-Action (ECA) model
-             * 
- * - * repeated .policy.PolicyRuleCondition conditionList = 4; - */ - public policy.PolicyCondition.PolicyRuleCondition.Builder addConditionListBuilder(int index) { - return getConditionListFieldBuilder().addBuilder(index, policy.PolicyCondition.PolicyRuleCondition.getDefaultInstance()); - } - - /** - *
-             * Event-Condition-Action (ECA) model
-             * 
- * - * repeated .policy.PolicyRuleCondition conditionList = 4; - */ - public java.util.List getConditionListBuilderList() { - return getConditionListFieldBuilder().getBuilderList(); - } - - private com.google.protobuf.RepeatedFieldBuilderV3 getConditionListFieldBuilder() { - if (conditionListBuilder_ == null) { - conditionListBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3(conditionList_, ((bitField0_ & 0x00000008) != 0), getParentForChildren(), isClean()); - conditionList_ = null; + return kpiId_ == null ? monitoring.Monitoring.KpiId.getDefaultInstance() : kpiId_; } - return conditionListBuilder_; - } - - private int booleanOperator_ = 0; - - /** - *
-             * Evaluation operator to be used
-             * 
- * - * .policy.BooleanOperator booleanOperator = 5; - * @return The enum numeric value on the wire for booleanOperator. - */ - @java.lang.Override - public int getBooleanOperatorValue() { - return booleanOperator_; } /** *
-             * Evaluation operator to be used
+             * to be migrated to: "kpi_manager.KpiId"
              * 
* - * .policy.BooleanOperator booleanOperator = 5; - * @param value The enum numeric value on the wire for booleanOperator to set. - * @return This builder for chaining. + * .monitoring.KpiId kpiId = 4; */ - public Builder setBooleanOperatorValue(int value) { - booleanOperator_ = value; - bitField0_ |= 0x00000010; - onChanged(); - return this; - } - - /** - *
-             * Evaluation operator to be used
-             * 
- * - * .policy.BooleanOperator booleanOperator = 5; - * @return The booleanOperator. - */ - @java.lang.Override - public policy.PolicyCondition.BooleanOperator getBooleanOperator() { - policy.PolicyCondition.BooleanOperator result = policy.PolicyCondition.BooleanOperator.forNumber(booleanOperator_); - return result == null ? policy.PolicyCondition.BooleanOperator.UNRECOGNIZED : result; - } - - /** - *
-             * Evaluation operator to be used
-             * 
- * - * .policy.BooleanOperator booleanOperator = 5; - * @param value The booleanOperator to set. - * @return This builder for chaining. - */ - public Builder setBooleanOperator(policy.PolicyCondition.BooleanOperator value) { - if (value == null) { - throw new NullPointerException(); + private com.google.protobuf.SingleFieldBuilderV3 getKpiIdFieldBuilder() { + if (kpiIdBuilder_ == null) { + kpiIdBuilder_ = new com.google.protobuf.SingleFieldBuilderV3(getKpiId(), getParentForChildren(), isClean()); + kpiId_ = null; } - bitField0_ |= 0x00000010; - booleanOperator_ = value.getNumber(); - onChanged(); - return this; - } - - /** - *
-             * Evaluation operator to be used
-             * 
- * - * .policy.BooleanOperator booleanOperator = 5; - * @return This builder for chaining. - */ - public Builder clearBooleanOperator() { - bitField0_ = (bitField0_ & ~0x00000010); - booleanOperator_ = 0; - onChanged(); - return this; + return kpiIdBuilder_; } private java.util.List actionList_ = java.util.Collections.emptyList(); private void ensureActionListIsMutable() { - if (!((bitField0_ & 0x00000020) != 0)) { + if (!((bitField0_ & 0x00000010) != 0)) { actionList_ = new java.util.ArrayList(actionList_); - bitField0_ |= 0x00000020; + bitField0_ |= 0x00000010; } } @@ -3111,10 +2731,10 @@ public final class Policy { /** *
-             * One or more actions should be applied
+             * Event-Condition-Action (ECA) model
              * 
* - * repeated .policy.PolicyRuleAction actionList = 6; + * repeated .policy.PolicyRuleAction actionList = 5; */ public java.util.List getActionListList() { if (actionListBuilder_ == null) { @@ -3126,10 +2746,10 @@ public final class Policy { /** *
-             * One or more actions should be applied
+             * Event-Condition-Action (ECA) model
              * 
* - * repeated .policy.PolicyRuleAction actionList = 6; + * repeated .policy.PolicyRuleAction actionList = 5; */ public int getActionListCount() { if (actionListBuilder_ == null) { @@ -3141,10 +2761,10 @@ public final class Policy { /** *
-             * One or more actions should be applied
+             * Event-Condition-Action (ECA) model
              * 
* - * repeated .policy.PolicyRuleAction actionList = 6; + * repeated .policy.PolicyRuleAction actionList = 5; */ public policy.PolicyAction.PolicyRuleAction getActionList(int index) { if (actionListBuilder_ == null) { @@ -3156,10 +2776,10 @@ public final class Policy { /** *
-             * One or more actions should be applied
+             * Event-Condition-Action (ECA) model
              * 
* - * repeated .policy.PolicyRuleAction actionList = 6; + * repeated .policy.PolicyRuleAction actionList = 5; */ public Builder setActionList(int index, policy.PolicyAction.PolicyRuleAction value) { if (actionListBuilder_ == null) { @@ -3177,10 +2797,10 @@ public final class Policy { /** *
-             * One or more actions should be applied
+             * Event-Condition-Action (ECA) model
              * 
* - * repeated .policy.PolicyRuleAction actionList = 6; + * repeated .policy.PolicyRuleAction actionList = 5; */ public Builder setActionList(int index, policy.PolicyAction.PolicyRuleAction.Builder builderForValue) { if (actionListBuilder_ == null) { @@ -3195,10 +2815,10 @@ public final class Policy { /** *
-             * One or more actions should be applied
+             * Event-Condition-Action (ECA) model
              * 
* - * repeated .policy.PolicyRuleAction actionList = 6; + * repeated .policy.PolicyRuleAction actionList = 5; */ public Builder addActionList(policy.PolicyAction.PolicyRuleAction value) { if (actionListBuilder_ == null) { @@ -3216,10 +2836,10 @@ public final class Policy { /** *
-             * One or more actions should be applied
+             * Event-Condition-Action (ECA) model
              * 
* - * repeated .policy.PolicyRuleAction actionList = 6; + * repeated .policy.PolicyRuleAction actionList = 5; */ public Builder addActionList(int index, policy.PolicyAction.PolicyRuleAction value) { if (actionListBuilder_ == null) { @@ -3237,10 +2857,10 @@ public final class Policy { /** *
-             * One or more actions should be applied
+             * Event-Condition-Action (ECA) model
              * 
* - * repeated .policy.PolicyRuleAction actionList = 6; + * repeated .policy.PolicyRuleAction actionList = 5; */ public Builder addActionList(policy.PolicyAction.PolicyRuleAction.Builder builderForValue) { if (actionListBuilder_ == null) { @@ -3255,10 +2875,10 @@ public final class Policy { /** *
-             * One or more actions should be applied
+             * Event-Condition-Action (ECA) model
              * 
* - * repeated .policy.PolicyRuleAction actionList = 6; + * repeated .policy.PolicyRuleAction actionList = 5; */ public Builder addActionList(int index, policy.PolicyAction.PolicyRuleAction.Builder builderForValue) { if (actionListBuilder_ == null) { @@ -3273,10 +2893,10 @@ public final class Policy { /** *
-             * One or more actions should be applied
+             * Event-Condition-Action (ECA) model
              * 
* - * repeated .policy.PolicyRuleAction actionList = 6; + * repeated .policy.PolicyRuleAction actionList = 5; */ public Builder addAllActionList(java.lang.Iterable values) { if (actionListBuilder_ == null) { @@ -3291,15 +2911,15 @@ public final class Policy { /** *
-             * One or more actions should be applied
+             * Event-Condition-Action (ECA) model
              * 
* - * repeated .policy.PolicyRuleAction actionList = 6; + * repeated .policy.PolicyRuleAction actionList = 5; */ public Builder clearActionList() { if (actionListBuilder_ == null) { actionList_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000020); + bitField0_ = (bitField0_ & ~0x00000010); onChanged(); } else { actionListBuilder_.clear(); @@ -3309,10 +2929,10 @@ public final class Policy { /** *
-             * One or more actions should be applied
+             * Event-Condition-Action (ECA) model
              * 
* - * repeated .policy.PolicyRuleAction actionList = 6; + * repeated .policy.PolicyRuleAction actionList = 5; */ public Builder removeActionList(int index) { if (actionListBuilder_ == null) { @@ -3327,10 +2947,10 @@ public final class Policy { /** *
-             * One or more actions should be applied
+             * Event-Condition-Action (ECA) model
              * 
* - * repeated .policy.PolicyRuleAction actionList = 6; + * repeated .policy.PolicyRuleAction actionList = 5; */ public policy.PolicyAction.PolicyRuleAction.Builder getActionListBuilder(int index) { return getActionListFieldBuilder().getBuilder(index); @@ -3338,10 +2958,10 @@ public final class Policy { /** *
-             * One or more actions should be applied
+             * Event-Condition-Action (ECA) model
              * 
* - * repeated .policy.PolicyRuleAction actionList = 6; + * repeated .policy.PolicyRuleAction actionList = 5; */ public policy.PolicyAction.PolicyRuleActionOrBuilder getActionListOrBuilder(int index) { if (actionListBuilder_ == null) { @@ -3353,10 +2973,10 @@ public final class Policy { /** *
-             * One or more actions should be applied
+             * Event-Condition-Action (ECA) model
              * 
* - * repeated .policy.PolicyRuleAction actionList = 6; + * repeated .policy.PolicyRuleAction actionList = 5; */ public java.util.List getActionListOrBuilderList() { if (actionListBuilder_ != null) { @@ -3368,10 +2988,10 @@ public final class Policy { /** *
-             * One or more actions should be applied
+             * Event-Condition-Action (ECA) model
              * 
* - * repeated .policy.PolicyRuleAction actionList = 6; + * repeated .policy.PolicyRuleAction actionList = 5; */ public policy.PolicyAction.PolicyRuleAction.Builder addActionListBuilder() { return getActionListFieldBuilder().addBuilder(policy.PolicyAction.PolicyRuleAction.getDefaultInstance()); @@ -3379,10 +2999,10 @@ public final class Policy { /** *
-             * One or more actions should be applied
+             * Event-Condition-Action (ECA) model
              * 
* - * repeated .policy.PolicyRuleAction actionList = 6; + * repeated .policy.PolicyRuleAction actionList = 5; */ public policy.PolicyAction.PolicyRuleAction.Builder addActionListBuilder(int index) { return getActionListFieldBuilder().addBuilder(index, policy.PolicyAction.PolicyRuleAction.getDefaultInstance()); @@ -3390,10 +3010,10 @@ public final class Policy { /** *
-             * One or more actions should be applied
+             * Event-Condition-Action (ECA) model
              * 
* - * repeated .policy.PolicyRuleAction actionList = 6; + * repeated .policy.PolicyRuleAction actionList = 5; */ public java.util.List getActionListBuilderList() { return getActionListFieldBuilder().getBuilderList(); @@ -3401,7 +3021,7 @@ public final class Policy { private com.google.protobuf.RepeatedFieldBuilderV3 getActionListFieldBuilder() { if (actionListBuilder_ == null) { - actionListBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3(actionList_, ((bitField0_ & 0x00000020) != 0), getParentForChildren(), isClean()); + actionListBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3(actionList_, ((bitField0_ & 0x00000010) != 0), getParentForChildren(), isClean()); actionList_ = null; } return actionListBuilder_; @@ -9739,14 +9359,14 @@ public final class Policy { private static com.google.protobuf.Descriptors.FileDescriptor descriptor; static { - java.lang.String[] descriptorData = { "\n\014policy.proto\022\006policy\032\rcontext.proto\032\026p" + "olicy_condition.proto\032\023policy_action.pro" + "to\"+\n\014PolicyRuleId\022\033\n\004uuid\030\001 \001(\0132\r.conte" + "xt.Uuid\"g\n\017PolicyRuleState\0224\n\017policyRule" + "State\030\001 \001(\0162\033.policy.PolicyRuleStateEnum" + "\022\036\n\026policyRuleStateMessage\030\002 \001(\t\"\225\002\n\017Pol" + "icyRuleBasic\022*\n\014policyRuleId\030\001 \001(\0132\024.pol" + "icy.PolicyRuleId\0220\n\017policyRuleState\030\002 \001(" + "\0132\027.policy.PolicyRuleState\022\020\n\010priority\030\003" + " \001(\r\0222\n\rconditionList\030\004 \003(\0132\033.policy.Pol" + "icyRuleCondition\0220\n\017booleanOperator\030\005 \001(" + "\0162\027.policy.BooleanOperator\022,\n\nactionList" + "\030\006 \003(\0132\030.policy.PolicyRuleAction\"\223\001\n\021Pol" + "icyRuleService\0220\n\017policyRuleBasic\030\001 \001(\0132" + "\027.policy.PolicyRuleBasic\022%\n\tserviceId\030\002 " + "\001(\0132\022.context.ServiceId\022%\n\ndeviceList\030\003 " + "\003(\0132\021.context.DeviceId\"k\n\020PolicyRuleDevi" + "ce\0220\n\017policyRuleBasic\030\001 \001(\0132\027.policy.Pol" + "icyRuleBasic\022%\n\ndeviceList\030\002 \003(\0132\021.conte" + "xt.DeviceId\"u\n\nPolicyRule\022,\n\007service\030\001 \001" + "(\0132\031.policy.PolicyRuleServiceH\000\022*\n\006devic" + "e\030\002 \001(\0132\030.policy.PolicyRuleDeviceH\000B\r\n\013p" + "olicy_rule\"B\n\020PolicyRuleIdList\022.\n\020policy" + "RuleIdList\030\001 \003(\0132\024.policy.PolicyRuleId\"Q" + "\n\025PolicyRuleServiceList\0228\n\025policyRuleSer" + "viceList\030\001 \003(\0132\031.policy.PolicyRuleServic" + "e\"N\n\024PolicyRuleDeviceList\0226\n\024policyRuleD" + "eviceList\030\001 \003(\0132\030.policy.PolicyRuleDevic" + "e\"9\n\016PolicyRuleList\022\'\n\013policyRules\030\001 \003(\013" + "2\022.policy.PolicyRule*\377\001\n\023PolicyRuleState" + "Enum\022\024\n\020POLICY_UNDEFINED\020\000\022\021\n\rPOLICY_FAI" + "LED\020\001\022\023\n\017POLICY_INSERTED\020\002\022\024\n\020POLICY_VAL" + "IDATED\020\003\022\026\n\022POLICY_PROVISIONED\020\004\022\021\n\rPOLI" + "CY_ACTIVE\020\005\022\023\n\017POLICY_ENFORCED\020\006\022\026\n\022POLI" + "CY_INEFFECTIVE\020\007\022\024\n\020POLICY_EFFECTIVE\020\010\022\022" + "\n\016POLICY_UPDATED\020\t\022\022\n\016POLICY_REMOVED\020\n2\323" + "\004\n\rPolicyService\022H\n\020PolicyAddService\022\031.p" + "olicy.PolicyRuleService\032\027.policy.PolicyR" + "uleState\"\000\022F\n\017PolicyAddDevice\022\030.policy.P" + "olicyRuleDevice\032\027.policy.PolicyRuleState" + "\"\000\022K\n\023PolicyUpdateService\022\031.policy.Polic" + "yRuleService\032\027.policy.PolicyRuleState\"\000\022" + "I\n\022PolicyUpdateDevice\022\030.policy.PolicyRul" + "eDevice\032\027.policy.PolicyRuleState\"\000\022?\n\014Po" + "licyDelete\022\024.policy.PolicyRuleId\032\027.polic" + "y.PolicyRuleState\"\000\022E\n\020GetPolicyService\022" + "\024.policy.PolicyRuleId\032\031.policy.PolicyRul" + "eService\"\000\022C\n\017GetPolicyDevice\022\024.policy.P" + "olicyRuleId\032\030.policy.PolicyRuleDevice\"\000\022" + "K\n\024GetPolicyByServiceId\022\022.context.Servic" + "eId\032\035.policy.PolicyRuleServiceList\"\000b\006pr" + "oto3" }; - descriptor = com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom(descriptorData, new com.google.protobuf.Descriptors.FileDescriptor[] { context.ContextOuterClass.getDescriptor(), policy.PolicyCondition.getDescriptor(), policy.PolicyAction.getDescriptor() }); + java.lang.String[] descriptorData = { "\n\014policy.proto\022\006policy\032\rcontext.proto\032\026p" + "olicy_condition.proto\032\023policy_action.pro" + "to\032\020monitoring.proto\"+\n\014PolicyRuleId\022\033\n\004" + "uuid\030\001 \001(\0132\r.context.Uuid\"g\n\017PolicyRuleS" + "tate\0224\n\017policyRuleState\030\001 \001(\0162\033.policy.P" + "olicyRuleStateEnum\022\036\n\026policyRuleStateMes" + "sage\030\002 \001(\t\"\321\001\n\017PolicyRuleBasic\022*\n\014policy" + "RuleId\030\001 \001(\0132\024.policy.PolicyRuleId\0220\n\017po" + "licyRuleState\030\002 \001(\0132\027.policy.PolicyRuleS" + "tate\022\020\n\010priority\030\003 \001(\r\022 \n\005kpiId\030\004 \001(\0132\021." + "monitoring.KpiId\022,\n\nactionList\030\005 \003(\0132\030.p" + "olicy.PolicyRuleAction\"\223\001\n\021PolicyRuleSer" + "vice\0220\n\017policyRuleBasic\030\001 \001(\0132\027.policy.P" + "olicyRuleBasic\022%\n\tserviceId\030\002 \001(\0132\022.cont" + "ext.ServiceId\022%\n\ndeviceList\030\003 \003(\0132\021.cont" + "ext.DeviceId\"k\n\020PolicyRuleDevice\0220\n\017poli" + "cyRuleBasic\030\001 \001(\0132\027.policy.PolicyRuleBas" + "ic\022%\n\ndeviceList\030\002 \003(\0132\021.context.DeviceI" + "d\"u\n\nPolicyRule\022,\n\007service\030\001 \001(\0132\031.polic" + "y.PolicyRuleServiceH\000\022*\n\006device\030\002 \001(\0132\030." + "policy.PolicyRuleDeviceH\000B\r\n\013policy_rule" + "\"B\n\020PolicyRuleIdList\022.\n\020policyRuleIdList" + "\030\001 \003(\0132\024.policy.PolicyRuleId\"Q\n\025PolicyRu" + "leServiceList\0228\n\025policyRuleServiceList\030\001" + " \003(\0132\031.policy.PolicyRuleService\"N\n\024Polic" + "yRuleDeviceList\0226\n\024policyRuleDeviceList\030" + "\001 \003(\0132\030.policy.PolicyRuleDevice\"9\n\016Polic" + "yRuleList\022\'\n\013policyRules\030\001 \003(\0132\022.policy." + "PolicyRule*\377\001\n\023PolicyRuleStateEnum\022\024\n\020PO" + "LICY_UNDEFINED\020\000\022\021\n\rPOLICY_FAILED\020\001\022\023\n\017P" + "OLICY_INSERTED\020\002\022\024\n\020POLICY_VALIDATED\020\003\022\026" + "\n\022POLICY_PROVISIONED\020\004\022\021\n\rPOLICY_ACTIVE\020" + "\005\022\023\n\017POLICY_ENFORCED\020\006\022\026\n\022POLICY_INEFFEC" + "TIVE\020\007\022\024\n\020POLICY_EFFECTIVE\020\010\022\022\n\016POLICY_U" + "PDATED\020\t\022\022\n\016POLICY_REMOVED\020\n2\323\004\n\rPolicyS" + "ervice\022H\n\020PolicyAddService\022\031.policy.Poli" + "cyRuleService\032\027.policy.PolicyRuleState\"\000" + "\022F\n\017PolicyAddDevice\022\030.policy.PolicyRuleD" + "evice\032\027.policy.PolicyRuleState\"\000\022K\n\023Poli" + "cyUpdateService\022\031.policy.PolicyRuleServi" + "ce\032\027.policy.PolicyRuleState\"\000\022I\n\022PolicyU" + "pdateDevice\022\030.policy.PolicyRuleDevice\032\027." + "policy.PolicyRuleState\"\000\022?\n\014PolicyDelete" + "\022\024.policy.PolicyRuleId\032\027.policy.PolicyRu" + "leState\"\000\022E\n\020GetPolicyService\022\024.policy.P" + "olicyRuleId\032\031.policy.PolicyRuleService\"\000" + "\022C\n\017GetPolicyDevice\022\024.policy.PolicyRuleI" + "d\032\030.policy.PolicyRuleDevice\"\000\022K\n\024GetPoli" + "cyByServiceId\022\022.context.ServiceId\032\035.poli" + "cy.PolicyRuleServiceList\"\000b\006proto3" }; + descriptor = com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom(descriptorData, new com.google.protobuf.Descriptors.FileDescriptor[] { context.ContextOuterClass.getDescriptor(), policy.PolicyCondition.getDescriptor(), policy.PolicyAction.getDescriptor(), monitoring.Monitoring.getDescriptor() }); internal_static_policy_PolicyRuleId_descriptor = getDescriptor().getMessageTypes().get(0); internal_static_policy_PolicyRuleId_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(internal_static_policy_PolicyRuleId_descriptor, new java.lang.String[] { "Uuid" }); internal_static_policy_PolicyRuleState_descriptor = getDescriptor().getMessageTypes().get(1); internal_static_policy_PolicyRuleState_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(internal_static_policy_PolicyRuleState_descriptor, new java.lang.String[] { "PolicyRuleState", "PolicyRuleStateMessage" }); internal_static_policy_PolicyRuleBasic_descriptor = getDescriptor().getMessageTypes().get(2); - internal_static_policy_PolicyRuleBasic_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(internal_static_policy_PolicyRuleBasic_descriptor, new java.lang.String[] { "PolicyRuleId", "PolicyRuleState", "Priority", "ConditionList", "BooleanOperator", "ActionList" }); + internal_static_policy_PolicyRuleBasic_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(internal_static_policy_PolicyRuleBasic_descriptor, new java.lang.String[] { "PolicyRuleId", "PolicyRuleState", "Priority", "KpiId", "ActionList" }); internal_static_policy_PolicyRuleService_descriptor = getDescriptor().getMessageTypes().get(3); internal_static_policy_PolicyRuleService_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(internal_static_policy_PolicyRuleService_descriptor, new java.lang.String[] { "PolicyRuleBasic", "ServiceId", "DeviceList" }); internal_static_policy_PolicyRuleDevice_descriptor = getDescriptor().getMessageTypes().get(4); @@ -9764,6 +9384,7 @@ public final class Policy { context.ContextOuterClass.getDescriptor(); policy.PolicyCondition.getDescriptor(); policy.PolicyAction.getDescriptor(); + monitoring.Monitoring.getDescriptor(); } // @@protoc_insertion_point(outer_class_scope) } diff --git a/src/policy/target/kubernetes/kubernetes.yml b/src/policy/target/kubernetes/kubernetes.yml index 60ccc933463983729127fdb64a6c482528bd4959..fec5f6bcaa99245d09e592fedb37f03aa05bb805 100644 --- a/src/policy/target/kubernetes/kubernetes.yml +++ b/src/policy/target/kubernetes/kubernetes.yml @@ -3,8 +3,8 @@ apiVersion: v1 kind: Service metadata: annotations: - app.quarkus.io/commit-id: d457bfea86f78d429aee2793d274bb3ab375a94b - app.quarkus.io/build-timestamp: 2025-10-20 - 10:17:44 +0000 + app.quarkus.io/commit-id: 439f55c932d52a211fc66ad150b6705e6d90c16c + app.quarkus.io/build-timestamp: 2025-10-20 - 11:25:00 +0000 prometheus.io/scrape: "true" prometheus.io/path: /q/metrics prometheus.io/port: "8080" @@ -17,18 +17,18 @@ metadata: name: policyservice spec: ports: - - name: https - port: 443 + - name: grpc + port: 6060 protocol: TCP - targetPort: 8443 + targetPort: 6060 - name: http port: 9192 protocol: TCP targetPort: 8080 - - name: grpc - port: 6060 + - name: https + port: 443 protocol: TCP - targetPort: 6060 + targetPort: 8443 selector: app.kubernetes.io/name: policyservice type: ClusterIP @@ -37,8 +37,8 @@ apiVersion: apps/v1 kind: Deployment metadata: annotations: - app.quarkus.io/commit-id: d457bfea86f78d429aee2793d274bb3ab375a94b - app.quarkus.io/build-timestamp: 2025-10-20 - 10:17:44 +0000 + app.quarkus.io/commit-id: 439f55c932d52a211fc66ad150b6705e6d90c16c + app.quarkus.io/build-timestamp: 2025-10-20 - 11:25:00 +0000 prometheus.io/scrape: "true" prometheus.io/path: /q/metrics prometheus.io/port: "8080" @@ -57,8 +57,8 @@ spec: template: metadata: annotations: - app.quarkus.io/commit-id: d457bfea86f78d429aee2793d274bb3ab375a94b - app.quarkus.io/build-timestamp: 2025-10-20 - 10:17:44 +0000 + app.quarkus.io/commit-id: 439f55c932d52a211fc66ad150b6705e6d90c16c + app.quarkus.io/build-timestamp: 2025-10-20 - 11:25:00 +0000 prometheus.io/scrape: "true" prometheus.io/path: /q/metrics prometheus.io/port: "8080" @@ -75,14 +75,14 @@ spec: valueFrom: fieldRef: fieldPath: metadata.namespace - - name: SERVICE_SERVICE_HOST - value: serviceservice + - name: MONITORING_SERVICE_HOST + value: monitoringservice - name: CONTEXT_SERVICE_HOST value: contextservice + - name: SERVICE_SERVICE_HOST + value: serviceservice - name: KAFKA_BROKER_HOST value: kafka-service.kafka.svc.cluster.local - - name: MONITORING_SERVICE_HOST - value: monitoringservice image: labs.etsi.org:5050/tfs/controller/policy:0.1.0 imagePullPolicy: Always livenessProbe: @@ -97,14 +97,14 @@ spec: timeoutSeconds: 10 name: policyservice ports: - - containerPort: 8443 - name: https + - containerPort: 6060 + name: grpc protocol: TCP - containerPort: 8080 name: http protocol: TCP - - containerPort: 6060 - name: grpc + - containerPort: 8443 + name: https protocol: TCP readinessProbe: failureThreshold: 3 diff --git a/src/ztp/target/kubernetes/kubernetes.yml b/src/ztp/target/kubernetes/kubernetes.yml index 1da70c278729a1c58923b319e8586953489956b7..ece3ac7c8756a8d2a534065a3114eb8df452c81a 100644 --- a/src/ztp/target/kubernetes/kubernetes.yml +++ b/src/ztp/target/kubernetes/kubernetes.yml @@ -3,8 +3,8 @@ apiVersion: v1 kind: Service metadata: annotations: - app.quarkus.io/commit-id: d457bfea86f78d429aee2793d274bb3ab375a94b - app.quarkus.io/build-timestamp: 2025-10-20 - 10:16:15 +0000 + app.quarkus.io/commit-id: 439f55c932d52a211fc66ad150b6705e6d90c16c + app.quarkus.io/build-timestamp: 2025-10-20 - 11:23:35 +0000 prometheus.io/scrape: "true" prometheus.io/path: /q/metrics prometheus.io/port: "8080" @@ -17,10 +17,6 @@ metadata: name: ztpservice spec: ports: - - name: grpc - port: 5050 - protocol: TCP - targetPort: 5050 - name: http port: 9192 protocol: TCP @@ -29,6 +25,10 @@ spec: port: 443 protocol: TCP targetPort: 8443 + - name: grpc + port: 5050 + protocol: TCP + targetPort: 5050 selector: app.kubernetes.io/name: ztpservice type: ClusterIP @@ -37,8 +37,8 @@ apiVersion: apps/v1 kind: Deployment metadata: annotations: - app.quarkus.io/commit-id: d457bfea86f78d429aee2793d274bb3ab375a94b - app.quarkus.io/build-timestamp: 2025-10-20 - 10:16:15 +0000 + app.quarkus.io/commit-id: 439f55c932d52a211fc66ad150b6705e6d90c16c + app.quarkus.io/build-timestamp: 2025-10-20 - 11:23:35 +0000 prometheus.io/scrape: "true" prometheus.io/path: /q/metrics prometheus.io/port: "8080" @@ -57,8 +57,8 @@ spec: template: metadata: annotations: - app.quarkus.io/commit-id: d457bfea86f78d429aee2793d274bb3ab375a94b - app.quarkus.io/build-timestamp: 2025-10-20 - 10:16:15 +0000 + app.quarkus.io/commit-id: 439f55c932d52a211fc66ad150b6705e6d90c16c + app.quarkus.io/build-timestamp: 2025-10-20 - 11:23:35 +0000 prometheus.io/scrape: "true" prometheus.io/path: /q/metrics prometheus.io/port: "8080" @@ -75,10 +75,10 @@ spec: valueFrom: fieldRef: fieldPath: metadata.namespace - - name: CONTEXT_SERVICE_HOST - value: contextservice - name: DEVICE_SERVICE_HOST value: deviceservice + - name: CONTEXT_SERVICE_HOST + value: contextservice image: labs.etsi.org:5050/tfs/controller/ztp:0.2.0 imagePullPolicy: Always livenessProbe: @@ -93,15 +93,15 @@ spec: timeoutSeconds: 10 name: ztpservice ports: - - containerPort: 5050 - name: grpc - protocol: TCP - containerPort: 8080 name: http protocol: TCP - containerPort: 8443 name: https protocol: TCP + - containerPort: 5050 + name: grpc + protocol: TCP readinessProbe: failureThreshold: 3 httpGet: