syntax = "proto3"; package policy; import "context.proto"; service PolicyService { rpc PolicyAdd (PolicyRule) returns (PolicyRuleState) {} rpc PolicyUpdate (PolicyRule) returns (PolicyRuleState) {} rpc PolicyDelete (PolicyRule) returns (PolicyRuleState) {} rpc GetPolicy (PolicyRuleId) returns (PolicyRule) {} rpc GetPolicyByDeviceId (context.DeviceId) returns (PolicyRuleList) {} rpc GetPolicyByServiceId (context.ServiceId) returns (PolicyRuleList) {} } enum RuleState { POLICY_INACTIVE = 0; // Rule is currently inactive POLICY_PLANNED = 1; // Rule installation planned POLICY_ACTIVE = 2; // Rule is currently active } enum PolicyRuleType { POLICYTYPE_DEVICE = 0; // Device-level POLICYTYPE_NETWORK = 1; // Network-wide } message PolicyRuleId { context.Uuid uuid = 1; } message PolicyRuleState { context.Uuid policyRuleId = 1; 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 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 // Enhanced with a policy rule event according to the ECA model message PolicyRule { // Basic policy rule attributes PolicyRuleId policyRuleId = 1; PolicyRuleType policyRuleType = 2; uint32 PolicyRulePriority = 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 // Affected services and devices repeated context.ServiceId serviceList = 7; repeated context.DeviceId deviceList = 8; } // A list of policy rules message PolicyRuleList { repeated PolicyRule policyRuleList = 1; }