Skip to content
Snippets Groups Projects
Commit 4bc4b6e2 authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Merge branch 'develop' of https://gitlab.com/teraflow-h2020/controller into feat/proto-extension

parents 2f2f368d ac06da65
No related branches found
No related tags found
1 merge request!54Release 2.0.0
Showing
with 309 additions and 152 deletions
......@@ -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 {
......@@ -44,41 +49,53 @@ message PolicyRuleId {
}
message PolicyRuleState {
context.Uuid policyRuleId = 1;
RuleState policyRuleState = 2;
RuleState policyRuleState = 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;
// Basic policy rule attributes
message PolicyRuleBasic {
PolicyRuleId policyRuleId = 1;
optional PolicyRuleState policyRuleState = 2;
uint32 priority = 3;
// 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
}
// 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 {
// Service-oriented policy rule
message PolicyRuleService {
// Basic policy rule attributes
PolicyRuleId policyRuleId = 1;
PolicyRuleType policyRuleType = 2;
uint32 priority = 3;
PolicyRuleBasic policyRuleBasic = 1;
// 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
// 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
......
......@@ -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" ]
......
......@@ -19,7 +19,7 @@ quarkus:
path: teraflow-automation-banner.txt
grpc:
server:
port: 9999
port: 5050
enable-reflection-service: true
clients:
context:
......@@ -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"
......
......@@ -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
......@@ -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
......@@ -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
......@@ -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:
......@@ -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:
......
......@@ -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>
......
......@@ -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 6060
USER 1001
ENTRYPOINT [ "/deployments/run-java.sh" ]
......@@ -16,11 +16,18 @@
package eu.teraflow.policy;
import context.ContextOuterClass;
import context.ContextOuterClass.ServiceId;
import io.quarkus.grpc.GrpcService;
import io.smallrye.mutiny.Uni;
import javax.inject.Inject;
import policy.Policy;
import policy.Policy.PolicyRuleBasic;
import policy.Policy.PolicyRuleDevice;
import policy.Policy.PolicyRuleId;
import policy.Policy.PolicyRuleService;
import policy.Policy.PolicyRuleServiceList;
import policy.Policy.PolicyRuleState;
import policy.Policy.RuleState;
@GrpcService
public class PolicyGatewayImpl implements PolicyGateway {
......@@ -33,50 +40,77 @@ public class PolicyGatewayImpl implements PolicyGateway {
}
@Override
public Uni<Policy.PolicyRuleState> policyAdd(Policy.PolicyRule request) {
public Uni<PolicyRuleState> policyAddService(PolicyRuleService request) {
return Uni.createFrom()
.item(
() ->
Policy.PolicyRuleState.newBuilder()
.setPolicyRuleId(request.getPolicyRuleId().getUuid())
.setPolicyRuleState(
request.getPolicyRuleBasic().getPolicyRuleState().getPolicyRuleState())
.build());
}
@Override
public Uni<Policy.PolicyRuleState> policyUpdate(Policy.PolicyRule request) {
public Uni<PolicyRuleState> policyAddDevice(PolicyRuleDevice request) {
return Uni.createFrom()
.item(
() ->
Policy.PolicyRuleState.newBuilder()
.setPolicyRuleId(request.getPolicyRuleId().getUuid())
.setPolicyRuleState(
request.getPolicyRuleBasic().getPolicyRuleState().getPolicyRuleState())
.build());
}
@Override
public Uni<Policy.PolicyRuleState> policyDelete(Policy.PolicyRule request) {
public Uni<PolicyRuleState> policyUpdateService(PolicyRuleService request) {
return Uni.createFrom()
.item(
() ->
Policy.PolicyRuleState.newBuilder()
.setPolicyRuleId(request.getPolicyRuleId().getUuid())
.setPolicyRuleState(
request.getPolicyRuleBasic().getPolicyRuleState().getPolicyRuleState())
.build());
}
@Override
public Uni<Policy.PolicyRule> getPolicy(Policy.PolicyRuleId request) {
public Uni<PolicyRuleState> policyUpdateDevice(PolicyRuleDevice request) {
return Uni.createFrom()
.item(() -> Policy.PolicyRule.newBuilder().setPolicyRuleId(request).build());
.item(
() ->
Policy.PolicyRuleState.newBuilder()
.setPolicyRuleState(
request.getPolicyRuleBasic().getPolicyRuleState().getPolicyRuleState())
.build());
}
@Override
public Uni<Policy.PolicyRuleList> getPolicyByDeviceId(ContextOuterClass.DeviceId request) {
public Uni<PolicyRuleState> policyDelete(PolicyRuleId request) {
return Uni.createFrom()
.item(
() ->
Policy.PolicyRuleState.newBuilder()
.setPolicyRuleState(RuleState.POLICY_REMOVED)
.build());
}
@Override
public Uni<PolicyRuleService> getPolicyService(PolicyRuleId request) {
final var policyRuleBasic = PolicyRuleBasic.newBuilder().setPolicyRuleId(request).build();
return Uni.createFrom().item(() -> Policy.PolicyRuleList.newBuilder().build());
return Uni.createFrom()
.item(() -> PolicyRuleService.newBuilder().setPolicyRuleBasic(policyRuleBasic).build());
}
@Override
public Uni<Policy.PolicyRuleList> getPolicyByServiceId(ContextOuterClass.ServiceId request) {
public Uni<PolicyRuleDevice> getPolicyDevice(PolicyRuleId request) {
final var policyRuleBasic = PolicyRuleBasic.newBuilder().setPolicyRuleId(request).build();
return Uni.createFrom().item(() -> Policy.PolicyRuleList.newBuilder().build());
return Uni.createFrom()
.item(() -> PolicyRuleDevice.newBuilder().setPolicyRuleBasic(policyRuleBasic).build());
}
@Override
public Uni<PolicyRuleServiceList> getPolicyByServiceId(ServiceId request) {
return Uni.createFrom().item(() -> Policy.PolicyRuleServiceList.newBuilder().build());
}
}
......@@ -16,11 +16,14 @@
package eu.teraflow.policy;
import eu.teraflow.policy.model.PolicyRule;
import eu.teraflow.policy.model.PolicyRuleState;
import io.smallrye.mutiny.Uni;
import policy.Policy.PolicyRuleDevice;
import policy.Policy.PolicyRuleService;
public interface PolicyService {
Uni<PolicyRuleState> addPolicy(PolicyRule policyRule);
Uni<PolicyRuleState> addPolicyService(PolicyRuleService policyRuleService);
Uni<PolicyRuleState> addPolicyDevice(PolicyRuleDevice policyRuleDevice);
}
......@@ -16,19 +16,25 @@
package eu.teraflow.policy;
import eu.teraflow.policy.model.PolicyRule;
import eu.teraflow.policy.model.PolicyRuleState;
import io.smallrye.mutiny.Uni;
import javax.enterprise.context.ApplicationScoped;
import org.jboss.logging.Logger;
import policy.Policy.PolicyRuleDevice;
import policy.Policy.PolicyRuleService;
@ApplicationScoped
public class PolicyServiceImpl implements PolicyService {
private static final Logger LOGGER = Logger.getLogger(PolicyServiceImpl.class);
public Uni<PolicyRuleState> addPolicy(PolicyRule policyRule) {
@Override
public Uni<PolicyRuleState> addPolicyService(PolicyRuleService policyRuleService) {
return null;
}
@Override
public Uni<PolicyRuleState> addPolicyDevice(PolicyRuleDevice policyRuleDevice) {
return null;
}
}
package eu.teraflow.policy.common;
import java.util.List;
import java.util.stream.Collectors;
public class Util {
private Util() {}
public static <T> String toString(List<T> list) {
return list.stream().map(T::toString).collect(Collectors.joining(", "));
}
}
......@@ -16,8 +16,8 @@
package eu.teraflow.policy.context.model;
import eu.teraflow.policy.common.Util;
import java.util.List;
import java.util.stream.Collectors;
public class Service {
......@@ -74,13 +74,9 @@ public class Service {
getClass().getSimpleName(),
serviceId,
serviceType.toString(),
toString(serviceEndPointIds),
toString(serviceConstraints),
Util.toString(serviceEndPointIds),
Util.toString(serviceConstraints),
serviceStatus,
serviceConfig);
}
private <T> String toString(List<T> list) {
return list.stream().map(T::toString).collect(Collectors.joining(", "));
}
}
......@@ -16,8 +16,8 @@
package eu.teraflow.policy.context.model;
import eu.teraflow.policy.common.Util;
import java.util.List;
import java.util.stream.Collectors;
public class ServiceConfig {
......@@ -33,11 +33,6 @@ public class ServiceConfig {
@Override
public String toString() {
return String.format(
"%s:{configRules:[%s]}", getClass().getSimpleName(), toString(configRules));
}
private <T> String toString(List<T> list) {
return list.stream().map(T::toString).collect(Collectors.joining(", "));
return String.format("%s:{[%s]}", getClass().getSimpleName(), Util.toString(configRules));
}
}
......@@ -30,6 +30,7 @@ public class ServiceStatus {
@Override
public String toString() {
return String.format("%s:{serviceStatus:\"%s\"}", getClass().getSimpleName(), status);
return String.format(
"%s:{serviceStatus:\"%s\"}", getClass().getSimpleName(), status.toString());
}
}
/*
* 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.
*/
package eu.teraflow.policy.model;
public enum BooleanOperator {
......
/*
* 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.
*/
package eu.teraflow.policy.model;
public enum NumericalOperator {
......
/*
* 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.
*/
package eu.teraflow.policy.model;
public enum PolicyRuleActionEnum {
......
......@@ -16,59 +16,58 @@
package eu.teraflow.policy.model;
import eu.teraflow.policy.context.model.ServiceId;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import eu.teraflow.policy.common.Util;
import java.util.List;
import java.util.stream.Collectors;
public class PolicyRule {
public class PolicyRuleBasic {
private final String policyRuleId;
private final PolicyRuleType policyRuleType;
private final PolicyRuleState policyRuleState;
private final int priority;
private final PolicyRuleEvent event;
private final List<PolicyRuleCondition> policyRuleConditions;
private final BooleanOperator booleanOperator;
private final List<PolicyRuleAction> policyRuleActions;
private final ServiceId serviceId;
private final List<String> deviceIds;
public PolicyRule(
public PolicyRuleBasic(
String policyRuleId,
PolicyRuleType policyRuleType,
PolicyRuleState policyRuleState,
int priority,
PolicyRuleEvent event,
List<PolicyRuleCondition> policyRuleConditions,
BooleanOperator booleanOperator,
List<PolicyRuleAction> policyRuleActions,
ServiceId serviceId,
List<String> deviceIds) {
List<PolicyRuleAction> policyRuleActions) {
checkNotNull(policyRuleId, "Policy rule ID must not be null.");
checkArgument(!policyRuleId.isBlank(), "Policy rule ID must not be empty.");
this.policyRuleId = policyRuleId;
this.policyRuleType = policyRuleType;
this.policyRuleState = policyRuleState;
checkArgument(priority >= 0, "Priority value must be greater or equal than zero.");
this.priority = priority;
this.event = event;
checkNotNull(policyRuleConditions, "Policy Rule conditions cannot be null.");
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;
checkNotNull(policyRuleActions, "Policy Rule actions cannot be null.");
checkArgument(!policyRuleActions.isEmpty(), "Policy Rule actions cannot be empty.");
this.policyRuleActions = policyRuleActions;
this.serviceId = serviceId;
this.deviceIds = deviceIds;
}
public String getPolicyRuleId() {
return policyRuleId;
}
public PolicyRuleType getPolicyRuleType() {
return policyRuleType;
public PolicyRuleState getPolicyRuleState() {
return policyRuleState;
}
public int getPriority() {
return priority;
}
public PolicyRuleEvent getEvent() {
return event;
}
public List<PolicyRuleCondition> getPolicyRuleConditions() {
return policyRuleConditions;
}
......@@ -81,31 +80,16 @@ public class PolicyRule {
return policyRuleActions;
}
public ServiceId getServiceId() {
return serviceId;
}
public List<String> getDeviceIds() {
return deviceIds;
}
@Override
public String toString() {
return String.format(
"%s:{policyRuleId:\"%s\", policyRuleType:\"%s\", priority:%d, %s, [%s], booleanOperator:\"%s\", [%s], %s, [%s]}",
"%s:{policyRuleId:\"%s\", %s, priority:%d, [%s], booleanOperator:\"%s\", [%s]}",
getClass().getSimpleName(),
policyRuleId,
policyRuleType.toString(),
policyRuleState,
priority,
event,
toString(policyRuleConditions),
Util.toString(policyRuleConditions),
booleanOperator.toString(),
toString(policyRuleActions),
serviceId,
toString(deviceIds));
}
private <T> String toString(List<T> list) {
return list.stream().map(T::toString).collect(Collectors.joining(", "));
Util.toString(policyRuleActions));
}
}
......@@ -16,22 +16,30 @@
package eu.teraflow.policy.model;
import eu.teraflow.policy.context.model.Event;
import eu.teraflow.policy.common.Util;
import java.util.List;
public class PolicyRuleEvent {
public class PolicyRuleDevice {
private final Event event;
private final PolicyRuleBasic policyRuleBasic;
private final List<String> deviceIds;
public PolicyRuleEvent(Event event) {
this.event = event;
public PolicyRuleDevice(PolicyRuleBasic policyRuleBasic, List<String> deviceIds) {
this.policyRuleBasic = policyRuleBasic;
this.deviceIds = deviceIds;
}
public Event getEvent() {
return event;
public PolicyRuleBasic getPolicyRuleBasic() {
return policyRuleBasic;
}
public List<String> getDeviceIds() {
return deviceIds;
}
@Override
public String toString() {
return String.format("%s:{%s}", getClass().getSimpleName(), event);
return String.format(
"%s:{%s, [%s]}", getClass().getSimpleName(), policyRuleBasic, Util.toString(deviceIds));
}
}
......@@ -16,7 +16,39 @@
package eu.teraflow.policy.model;
public enum PolicyRuleType {
POLICYTYPE_DEVICE,
POLICYTYPE_NETWORK
import eu.teraflow.policy.common.Util;
import eu.teraflow.policy.context.model.ServiceId;
import java.util.List;
public class PolicyRuleService {
private final PolicyRuleBasic policyRuleBasic;
private final ServiceId serviceId;
private final List<String> deviceIds;
public PolicyRuleService(
PolicyRuleBasic policyRuleBasic, ServiceId serviceId, List<String> deviceIds) {
this.policyRuleBasic = policyRuleBasic;
this.serviceId = serviceId;
this.deviceIds = deviceIds;
}
public PolicyRuleBasic getPolicyRuleBasic() {
return policyRuleBasic;
}
public ServiceId getServiceId() {
return serviceId;
}
public List<String> getDeviceIds() {
return deviceIds;
}
@Override
public String toString() {
return String.format(
"%s:{%s, %s, [%s]}",
getClass().getSimpleName(), policyRuleBasic, serviceId, Util.toString(deviceIds));
}
}
......@@ -18,26 +18,18 @@ package eu.teraflow.policy.model;
public class PolicyRuleState {
private final String policeRuleId;
private final RuleState ruleState;
public PolicyRuleState(String policeRuleId, RuleState ruleState) {
this.policeRuleId = policeRuleId;
public PolicyRuleState(RuleState ruleState) {
this.ruleState = ruleState;
}
public String getPolicyRuleId() {
return policeRuleId;
}
public RuleState getRuleState() {
return ruleState;
}
@Override
public String toString() {
return String.format(
"%s:{policeRuleId:\"%s\", ruleState:\"%s\"}",
getClass().getSimpleName(), policeRuleId, ruleState);
return String.format("%s:{ruleState:\"%s\"}", getClass().getSimpleName(), ruleState.toString());
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment