Commit daee23ae authored by Fotis Soldatos's avatar Fotis Soldatos
Browse files

feat(policy): update policy.proto

parent 6288249a
Loading
Loading
Loading
Loading
+29 −0
Original line number Diff line number Diff line
// Copyright 2021-2023 H2020 TeraFlow (https://www.teraflow-h2020.eu/)
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto3";
package policy;

// Action
message PolicyRuleAction {
  PolicyRuleActionEnum action = 1;
  repeated string parameters = 2;
}

enum PolicyRuleActionEnum {
  POLICYRULE_ACTION_NO_ACTION = 0;
  POLICYRULE_ACTION_SET_DEVICE_STATUS = 1;
  POLICYRULE_ACTION_ADD_SERVICE_CONFIGRULE = 2;
  POLICYRULE_ACTION_ADD_SERVICE_CONSTRAINT = 3;
}
+13 −11
Original line number Diff line number Diff line
@@ -20,22 +20,24 @@ import "monitoring.proto";
// Condition
message PolicyRuleCondition {
  monitoring.KpiId kpiId = 1;
  PolicyRuleConditionComparisonOperator polRuleConditionComparisonOperator = 2;
  NumericalOperator numericalOperator = 2;
  monitoring.KpiValue kpiValue = 3;
}

// Operator to be used when comparing Kpis with condition values
enum PolicyRuleConditionComparisonOperator {
  EQUAL = 0;              // Kpi is equal with value
  NOT_EQUAL = 1;          // Kpi is not equal with value
  LESS_THAN = 2;          // Kpi is less than value
  LESS_THAN_EQUAL = 3;    // Kpi is less than or equal with value
  GREATER_THAN = 4;       // Kpi is greater than value
  GREATER_THAN_EQUAL = 5; // Kpi is less than or equal with value
enum NumericalOperator {
  POLICYRULE_CONDITION_NUMERICAL_UNDEFINED = 0;          // Kpi numerical operator undefined
  POLICYRULE_CONDITION_NUMERICAL_EQUAL = 1;              // Kpi is equal with value
  POLICYRULE_CONDITION_NUMERICAL_NOT_EQUAL = 2;          // Kpi is not equal with value
  POLICYRULE_CONDITION_NUMERICAL_LESS_THAN = 3;          // Kpi is less than value
  POLICYRULE_CONDITION_NUMERICAL_LESS_THAN_EQUAL = 4;    // Kpi is less than or equal with value
  POLICYRULE_CONDITION_NUMERICAL_GREATER_THAN = 5;       // Kpi is greater than value
  POLICYRULE_CONDITION_NUMERICAL_GREATER_THAN_EQUAL = 6; // Kpi is less than or equal with value
}

// Operator to be used when evaluating each condition
enum PolicyRuleConditionEvaluationOperator {
  AND = 0;  // Logical AND operator
  OR = 1;   // Logical OR operator
enum BooleanOperator {
  POLICYRULE_CONDITION_BOOLEAN_UNDEFINED = 0;  // Boolean operator undefined
  POLICYRULE_CONDITION_BOOLEAN_AND = 1;        // Boolean AND operator
  POLICYRULE_CONDITION_BOOLEAN_OR = 2;         // Boolean OR operator
}
 No newline at end of file
+11 −28
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@ syntax = "proto3";
package policy;

import "context.proto";
import "policy-condition.proto";
import "policy-action.proto";

service PolicyService {
  rpc PolicyAdd (PolicyRule) returns (PolicyRuleState) {}
@@ -46,14 +48,6 @@ message PolicyRuleState {
  RuleState policyRuleState = 2;
}

message PolicyRuleVariable {
  string policyRuleVariable = 1;
}

message PolicyRuleValue {
  string policyRuleValue = 1;
}

// IETF draft: Framework for Use of ECA (Event Condition Action) in Network Self Management
//     Source: https://datatracker.ietf.org/doc/draft-bwd-netmod-eca-framework/
// Event
@@ -61,18 +55,6 @@ message PolicyRuleEvent {
  context.Event event = 1;
}

// Condition
message PolicyRuleCondition {
  PolicyRuleVariable polRuleConditionVar = 1;
  PolicyRuleValue polRuleConditionVal = 2;
}

// Action
message PolicyRuleAction {
  PolicyRuleVariable polRuleActionVar = 1;
  PolicyRuleValue polRuleActionVal = 2;
}

// Policy rule partially complies with IETF’s:
//     RFC 3060: https://datatracker.ietf.org/doc/html/rfc3060
//     RFC 3460: https://datatracker.ietf.org/doc/html/rfc3460
@@ -81,16 +63,17 @@ message PolicyRule {
  // Basic policy rule attributes
  PolicyRuleId policyRuleId = 1;
  PolicyRuleType policyRuleType = 2;
  uint32 PolicyRulePriority = 3;
  uint32 priority = 3;

  // Event-Condition-Action model
  PolicyRuleEvent event = 4;                         // A single event triggers the policy
  repeated PolicyRuleCondition polRuleConditionList = 5; // One or more conditions must be met
  repeated PolicyRuleAction polRuleActionList = 6;       // One or more actions should be applied
  repeated PolicyRuleCondition conditionList = 5;    // One or more conditions must be met
  BooleanOperator booleanOperator = 6;               // Evaluation operator to be used
  repeated PolicyRuleAction actionList = 7;          // One or more actions should be applied

  // Affected services and devices
  repeated context.ServiceId serviceList = 7;
  repeated context.DeviceId deviceList = 8;
  // Affected service and devices
  context.ServiceId serviceId = 8;
  repeated context.DeviceId deviceList = 9;
}

// A list of policy rules
+1 −0
Original line number Diff line number Diff line
../../../../../proto/policy-action.proto
 No newline at end of file
+902 −3827

File changed.

Preview size limit exceeded, changes collapsed.

Loading