Loading proto/policy.proto +57 −40 Original line number Diff line number Diff line Loading @@ -20,23 +20,28 @@ import "policy-condition.proto"; import "policy-action.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) {} rpc PolicyAddService (PolicyRuleService) returns (PolicyRuleState) {} rpc PolicyAddDevice (PolicyRuleDevice) returns (PolicyRuleState) {} rpc PolicyUpdateService (PolicyRuleService) returns (PolicyRuleState) {} rpc PolicyUpdateDevice (PolicyRuleDevice) returns (PolicyRuleState) {} rpc PolicyDelete (PolicyRuleId) returns (PolicyRuleState) {} rpc GetPolicyService (PolicyRuleId) returns (PolicyRuleService) {} rpc GetPolicyDevice (PolicyRuleId) returns (PolicyRuleDevice) {} rpc GetPolicyByServiceId (context.ServiceId) returns (PolicyRuleServiceList) {} } 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 POLICY_UNDEFINED = 0; // Undefined rule state POLICY_FAILED = 1; // Rule failed POLICY_INSERTED = 2; // Rule is just inserted POLICY_VALIDATED = 3; // Rule content is correct POLICY_PROVISIONED = 4; // Rule subscribed to Monitoring POLICY_ACTIVE = 5; // Rule is currently active (alarm is just thrown by Monitoring) POLICY_ENFORCED = 6; // Rule action is successfully enforced POLICY_INEFFECTIVE = 7; // The applied rule action did not work as expected POLICY_EFFECTIVE = 8; // The applied rule action did work as expected POLICY_UPDATED = 9; // Operator requires a policy to change POLICY_REMOVED = 10; // Operator requires to remove a policy } message PolicyRuleId { Loading @@ -44,41 +49,53 @@ message PolicyRuleId { } message PolicyRuleState { context.Uuid policyRuleId = 1; RuleState policyRuleState = 2; } // 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; RuleState policyRuleState = 1; } // 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 message PolicyRuleBasic { PolicyRuleId policyRuleId = 1; PolicyRuleType policyRuleType = 2; optional PolicyRuleState policyRuleState = 2; uint32 priority = 3; // Event-Condition-Action model PolicyRuleEvent event = 4; // A single event triggers the policy 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 // 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 } // Service-oriented policy rule message PolicyRuleService { // Basic policy rule attributes PolicyRuleBasic policyRuleBasic = 1; // Affected service and (some of) its device(s) context.ServiceId serviceId = 2; repeated context.DeviceId deviceList = 3; // List of devices this service is traversing (not exhaustive) } // Device-oriented policy rule message PolicyRuleDevice { // Basic policy rule attributes PolicyRuleBasic policyRuleBasic = 1; // Affected device(s) repeated context.DeviceId deviceList = 2; } // A list of policy rule IDs message PolicyRuleIdList { repeated PolicyRuleId policyRuleIdList = 1; } // Affected service and devices context.ServiceId serviceId = 8; repeated context.DeviceId deviceList = 9; // A list of service-oriented policy rules message PolicyRuleServiceList { repeated PolicyRuleService policyRuleServiceList = 1; } // A list of policy rules message PolicyRuleList { repeated PolicyRule policyRuleList = 1; // A list of device-oriented policy rules message PolicyRuleDeviceList { repeated PolicyRuleDevice policyRuleDeviceList = 1; } // A list of policy rule Ids Loading src/automation/src/main/docker/Dockerfile.multistage.jvm +1 −1 Original line number Diff line number Diff line Loading @@ -60,7 +60,7 @@ COPY --from=builder --chown=1001 /app/target/quarkus-app/app/ /deployments/app/ COPY --from=builder --chown=1001 /app/target/quarkus-app/quarkus/ /deployments/quarkus/ EXPOSE 8080 EXPOSE 9999 EXPOSE 5050 USER 1001 ENTRYPOINT [ "/deployments/run-java.sh" ] Loading src/automation/src/main/resources/application.yml +4 −4 Original line number Diff line number Diff line Loading @@ -19,7 +19,7 @@ quarkus: path: teraflow-automation-banner.txt grpc: server: port: 9999 port: 5050 enable-reflection-service: true clients: context: Loading Loading @@ -53,9 +53,9 @@ quarkus: http: host-port: 8080 container-port: 8080 grpc-server: host-port: 9999 container-port: 9999 grpc: host-port: 5050 container-port: 5050 env: vars: context-service-host: "contextservice" Loading src/automation/target/kubernetes/kubernetes.yml +14 −14 Original line number Diff line number Diff line Loading @@ -3,20 +3,20 @@ apiVersion: v1 kind: Service metadata: annotations: app.quarkus.io/commit-id: fee580ca578000e6006c77704c0d6240e261de0f app.quarkus.io/build-timestamp: 2022-05-27 - 08:02:36 +0000 app.quarkus.io/commit-id: cfe69c57feb1d488c2dda620021e3c62d67fc3d3 app.quarkus.io/build-timestamp: 2022-07-14 - 07:57:09 +0000 labels: app.kubernetes.io/name: automationservice app: automationservice name: automationservice spec: ports: - name: grpc-server port: 9999 targetPort: 9999 - name: http port: 8080 targetPort: 8080 - name: grpc port: 5050 targetPort: 5050 selector: app.kubernetes.io/name: automationservice type: ClusterIP Loading @@ -25,8 +25,8 @@ apiVersion: apps/v1 kind: Deployment metadata: annotations: app.quarkus.io/commit-id: fee580ca578000e6006c77704c0d6240e261de0f app.quarkus.io/build-timestamp: 2022-05-27 - 08:02:36 +0000 app.quarkus.io/commit-id: cfe69c57feb1d488c2dda620021e3c62d67fc3d3 app.quarkus.io/build-timestamp: 2022-07-14 - 07:57:09 +0000 labels: app: automationservice app.kubernetes.io/name: automationservice Loading @@ -39,8 +39,8 @@ spec: template: metadata: annotations: app.quarkus.io/commit-id: fee580ca578000e6006c77704c0d6240e261de0f app.quarkus.io/build-timestamp: 2022-05-27 - 08:02:36 +0000 app.quarkus.io/commit-id: cfe69c57feb1d488c2dda620021e3c62d67fc3d3 app.quarkus.io/build-timestamp: 2022-07-14 - 07:57:09 +0000 labels: app: automationservice app.kubernetes.io/name: automationservice Loading @@ -51,10 +51,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: registry.gitlab.com/teraflow-h2020/controller/automation:0.2.0 imagePullPolicy: Always livenessProbe: Loading @@ -69,12 +69,12 @@ spec: timeoutSeconds: 10 name: automationservice ports: - containerPort: 9999 name: grpc-server protocol: TCP - containerPort: 8080 name: http protocol: TCP - containerPort: 5050 name: grpc protocol: TCP readinessProbe: failureThreshold: 3 httpGet: Loading src/policy/pom.xml +6 −0 Original line number Diff line number Diff line Loading @@ -140,6 +140,12 @@ <artifactId>quarkus-arc</artifactId> </dependency> <dependency> <groupId>com.google.guava</groupId> <artifactId>guava</artifactId> <version>31.1-jre</version> </dependency> <dependency> <groupId>io.quarkus</groupId> <artifactId>quarkus-config-yaml</artifactId> Loading Loading
proto/policy.proto +57 −40 Original line number Diff line number Diff line Loading @@ -20,23 +20,28 @@ import "policy-condition.proto"; import "policy-action.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) {} rpc PolicyAddService (PolicyRuleService) returns (PolicyRuleState) {} rpc PolicyAddDevice (PolicyRuleDevice) returns (PolicyRuleState) {} rpc PolicyUpdateService (PolicyRuleService) returns (PolicyRuleState) {} rpc PolicyUpdateDevice (PolicyRuleDevice) returns (PolicyRuleState) {} rpc PolicyDelete (PolicyRuleId) returns (PolicyRuleState) {} rpc GetPolicyService (PolicyRuleId) returns (PolicyRuleService) {} rpc GetPolicyDevice (PolicyRuleId) returns (PolicyRuleDevice) {} rpc GetPolicyByServiceId (context.ServiceId) returns (PolicyRuleServiceList) {} } 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 POLICY_UNDEFINED = 0; // Undefined rule state POLICY_FAILED = 1; // Rule failed POLICY_INSERTED = 2; // Rule is just inserted POLICY_VALIDATED = 3; // Rule content is correct POLICY_PROVISIONED = 4; // Rule subscribed to Monitoring POLICY_ACTIVE = 5; // Rule is currently active (alarm is just thrown by Monitoring) POLICY_ENFORCED = 6; // Rule action is successfully enforced POLICY_INEFFECTIVE = 7; // The applied rule action did not work as expected POLICY_EFFECTIVE = 8; // The applied rule action did work as expected POLICY_UPDATED = 9; // Operator requires a policy to change POLICY_REMOVED = 10; // Operator requires to remove a policy } message PolicyRuleId { Loading @@ -44,41 +49,53 @@ message PolicyRuleId { } message PolicyRuleState { context.Uuid policyRuleId = 1; RuleState policyRuleState = 2; } // 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; RuleState policyRuleState = 1; } // 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 message PolicyRuleBasic { PolicyRuleId policyRuleId = 1; PolicyRuleType policyRuleType = 2; optional PolicyRuleState policyRuleState = 2; uint32 priority = 3; // Event-Condition-Action model PolicyRuleEvent event = 4; // A single event triggers the policy 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 // 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 } // Service-oriented policy rule message PolicyRuleService { // Basic policy rule attributes PolicyRuleBasic policyRuleBasic = 1; // Affected service and (some of) its device(s) context.ServiceId serviceId = 2; repeated context.DeviceId deviceList = 3; // List of devices this service is traversing (not exhaustive) } // Device-oriented policy rule message PolicyRuleDevice { // Basic policy rule attributes PolicyRuleBasic policyRuleBasic = 1; // Affected device(s) repeated context.DeviceId deviceList = 2; } // A list of policy rule IDs message PolicyRuleIdList { repeated PolicyRuleId policyRuleIdList = 1; } // Affected service and devices context.ServiceId serviceId = 8; repeated context.DeviceId deviceList = 9; // A list of service-oriented policy rules message PolicyRuleServiceList { repeated PolicyRuleService policyRuleServiceList = 1; } // A list of policy rules message PolicyRuleList { repeated PolicyRule policyRuleList = 1; // A list of device-oriented policy rules message PolicyRuleDeviceList { repeated PolicyRuleDevice policyRuleDeviceList = 1; } // A list of policy rule Ids Loading
src/automation/src/main/docker/Dockerfile.multistage.jvm +1 −1 Original line number Diff line number Diff line Loading @@ -60,7 +60,7 @@ COPY --from=builder --chown=1001 /app/target/quarkus-app/app/ /deployments/app/ COPY --from=builder --chown=1001 /app/target/quarkus-app/quarkus/ /deployments/quarkus/ EXPOSE 8080 EXPOSE 9999 EXPOSE 5050 USER 1001 ENTRYPOINT [ "/deployments/run-java.sh" ] Loading
src/automation/src/main/resources/application.yml +4 −4 Original line number Diff line number Diff line Loading @@ -19,7 +19,7 @@ quarkus: path: teraflow-automation-banner.txt grpc: server: port: 9999 port: 5050 enable-reflection-service: true clients: context: Loading Loading @@ -53,9 +53,9 @@ quarkus: http: host-port: 8080 container-port: 8080 grpc-server: host-port: 9999 container-port: 9999 grpc: host-port: 5050 container-port: 5050 env: vars: context-service-host: "contextservice" Loading
src/automation/target/kubernetes/kubernetes.yml +14 −14 Original line number Diff line number Diff line Loading @@ -3,20 +3,20 @@ apiVersion: v1 kind: Service metadata: annotations: app.quarkus.io/commit-id: fee580ca578000e6006c77704c0d6240e261de0f app.quarkus.io/build-timestamp: 2022-05-27 - 08:02:36 +0000 app.quarkus.io/commit-id: cfe69c57feb1d488c2dda620021e3c62d67fc3d3 app.quarkus.io/build-timestamp: 2022-07-14 - 07:57:09 +0000 labels: app.kubernetes.io/name: automationservice app: automationservice name: automationservice spec: ports: - name: grpc-server port: 9999 targetPort: 9999 - name: http port: 8080 targetPort: 8080 - name: grpc port: 5050 targetPort: 5050 selector: app.kubernetes.io/name: automationservice type: ClusterIP Loading @@ -25,8 +25,8 @@ apiVersion: apps/v1 kind: Deployment metadata: annotations: app.quarkus.io/commit-id: fee580ca578000e6006c77704c0d6240e261de0f app.quarkus.io/build-timestamp: 2022-05-27 - 08:02:36 +0000 app.quarkus.io/commit-id: cfe69c57feb1d488c2dda620021e3c62d67fc3d3 app.quarkus.io/build-timestamp: 2022-07-14 - 07:57:09 +0000 labels: app: automationservice app.kubernetes.io/name: automationservice Loading @@ -39,8 +39,8 @@ spec: template: metadata: annotations: app.quarkus.io/commit-id: fee580ca578000e6006c77704c0d6240e261de0f app.quarkus.io/build-timestamp: 2022-05-27 - 08:02:36 +0000 app.quarkus.io/commit-id: cfe69c57feb1d488c2dda620021e3c62d67fc3d3 app.quarkus.io/build-timestamp: 2022-07-14 - 07:57:09 +0000 labels: app: automationservice app.kubernetes.io/name: automationservice Loading @@ -51,10 +51,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: registry.gitlab.com/teraflow-h2020/controller/automation:0.2.0 imagePullPolicy: Always livenessProbe: Loading @@ -69,12 +69,12 @@ spec: timeoutSeconds: 10 name: automationservice ports: - containerPort: 9999 name: grpc-server protocol: TCP - containerPort: 8080 name: http protocol: TCP - containerPort: 5050 name: grpc protocol: TCP readinessProbe: failureThreshold: 3 httpGet: Loading
src/policy/pom.xml +6 −0 Original line number Diff line number Diff line Loading @@ -140,6 +140,12 @@ <artifactId>quarkus-arc</artifactId> </dependency> <dependency> <groupId>com.google.guava</groupId> <artifactId>guava</artifactId> <version>31.1-jre</version> </dependency> <dependency> <groupId>io.quarkus</groupId> <artifactId>quarkus-config-yaml</artifactId> Loading