Skip to content
Snippets Groups Projects
Commit 2efbda3a authored by Fotis Soldatos's avatar Fotis Soldatos
Browse files

feat(policy): add monitoring related domain models

parent a734c5ee
No related branches found
No related tags found
1 merge request!54Release 2.0.0
/*
* 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.monitoring.model;
public class AlarmDescriptor {
private final String alarmDescription;
private final String name;
private final String kpiId;
private final KpiValueRange kpiValueRange;
private final String timestamp;
public AlarmDescriptor(
String alarmDescription,
String name,
String kpiId,
KpiValueRange kpiValueRange,
String timestamp) {
this.alarmDescription = alarmDescription;
this.name = name;
this.kpiId = kpiId;
this.kpiValueRange = kpiValueRange;
this.timestamp = timestamp;
}
public String getAlarmDescription() {
return alarmDescription;
}
public String getName() {
return name;
}
public String getKpiId() {
return kpiId;
}
public KpiValueRange getKpiValueRange() {
return kpiValueRange;
}
public String getTimestamp() {
return timestamp;
}
@Override
public String toString() {
return String.format(
"%s:{alarmDescription:\"%s\", name:\"%s\", kpiId:\"%s\", %s, timestamp:\"%s\"}",
getClass().getSimpleName(), alarmDescription, name, kpiId, kpiValueRange, timestamp);
}
}
/*
* 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.monitoring.model;
public class AlarmResponse {
private final String alarmId;
private final String text;
private final KpiValue<?> kpiValue;
public AlarmResponse(String alarmId, String text, KpiValue<?> kpiValue) {
this.alarmId = alarmId;
this.text = text;
this.kpiValue = kpiValue;
}
public String getAlarmId() {
return alarmId;
}
public String getText() {
return text;
}
public KpiValue getKpiValue() {
return kpiValue;
}
@Override
public String toString() {
return String.format(
"%s:{alarmId:\"%s\", text:\"%s\", %s}",
getClass().getSimpleName(), alarmId, text, kpiValue);
}
}
...@@ -20,9 +20,9 @@ public class Kpi { ...@@ -20,9 +20,9 @@ public class Kpi {
private final String kpiId; private final String kpiId;
private final String timestamp; private final String timestamp;
private final String kpiValue; private final KpiValue<?> kpiValue;
public Kpi(String kpiId, String timestamp, String kpiValue) { public Kpi(String kpiId, String timestamp, KpiValue<?> kpiValue) {
this.kpiId = kpiId; this.kpiId = kpiId;
this.timestamp = timestamp; this.timestamp = timestamp;
this.kpiValue = kpiValue; this.kpiValue = kpiValue;
...@@ -36,14 +36,14 @@ public class Kpi { ...@@ -36,14 +36,14 @@ public class Kpi {
return timestamp; return timestamp;
} }
public String getKpiValue() { public KpiValue getKpiValue() {
return kpiValue; return kpiValue;
} }
@Override @Override
public String toString() { public String toString() {
return String.format( return String.format(
"%s:{kpiId:\"%s\", timeStamp:\"%s\", kpiValue:\"%s\"}", "%s:{kpiId:\"%s\", timeStamp:\"%s\", %s}",
getClass().getSimpleName(), kpiId, timestamp, kpiValue); getClass().getSimpleName(), kpiId, timestamp, kpiValue);
} }
} }
...@@ -18,6 +18,7 @@ package eu.teraflow.policy.monitoring.model; ...@@ -18,6 +18,7 @@ package eu.teraflow.policy.monitoring.model;
import eu.teraflow.policy.context.model.EndPointId; import eu.teraflow.policy.context.model.EndPointId;
import eu.teraflow.policy.context.model.ServiceId; import eu.teraflow.policy.context.model.ServiceId;
import eu.teraflow.policy.context.model.SliceId;
import eu.teraflow.policy.kpi_sample_types.model.KpiSampleType; import eu.teraflow.policy.kpi_sample_types.model.KpiSampleType;
public class KpiDescriptor { public class KpiDescriptor {
...@@ -27,18 +28,21 @@ public class KpiDescriptor { ...@@ -27,18 +28,21 @@ public class KpiDescriptor {
private final String deviceId; private final String deviceId;
private final EndPointId endPointId; private final EndPointId endPointId;
private final ServiceId serviceId; private final ServiceId serviceId;
private final SliceId sliceId;
public KpiDescriptor( public KpiDescriptor(
String kpiDescription, String kpiDescription,
KpiSampleType kpiSampleType, KpiSampleType kpiSampleType,
String deviceId, String deviceId,
EndPointId endPointId, EndPointId endPointId,
ServiceId serviceId) { ServiceId serviceId,
SliceId sliceId) {
this.kpiDescription = kpiDescription; this.kpiDescription = kpiDescription;
this.kpiSampleType = kpiSampleType; this.kpiSampleType = kpiSampleType;
this.deviceId = deviceId; this.deviceId = deviceId;
this.endPointId = endPointId; this.endPointId = endPointId;
this.serviceId = serviceId; this.serviceId = serviceId;
this.sliceId = sliceId;
} }
public String getKpiDescription() { public String getKpiDescription() {
...@@ -61,15 +65,20 @@ public class KpiDescriptor { ...@@ -61,15 +65,20 @@ public class KpiDescriptor {
return serviceId; return serviceId;
} }
public SliceId getSliceId() {
return sliceId;
}
@Override @Override
public String toString() { public String toString() {
return String.format( return String.format(
"%s:{kpiDescription:\"%s\", kpiSampleType:\"%s\", deviceId:\"%s\", %s, %s}", "%s:{kpiDescription:\"%s\", kpiSampleType:\"%s\", deviceId:\"%s\", %s, %s, %s}",
getClass().getSimpleName(), getClass().getSimpleName(),
kpiDescription, kpiDescription,
kpiSampleType.toString(), kpiSampleType.toString(),
deviceId, deviceId,
endPointId, endPointId,
serviceId); serviceId,
sliceId);
} }
} }
/*
* 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.monitoring.model;
public class KpiValueRange {
private final KpiValue<?> kpiMinValue;
private final KpiValue<?> kpiMaxValue;
public KpiValueRange(KpiValue<?> kpiMinValue, KpiValue<?> kpiMaxValue) {
this.kpiMinValue = kpiMinValue;
this.kpiMaxValue = kpiMaxValue;
}
public KpiValue getKpiMinValue() {
return kpiMinValue;
}
public KpiValue getKpiMaxValue() {
return kpiMaxValue;
}
@Override
public String toString() {
return String.format("%s:{%s, %s}", getClass().getSimpleName(), kpiMinValue, kpiMaxValue);
}
}
/*
* 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.monitoring.model;
public class SubsDescriptor {
private final String kpiId;
private final float samplingDurationS;
private final float samplingIntervalS;
private final String startDate;
private final String endDate;
public SubsDescriptor(
String kpiId,
float samplingDurationS,
float samplingIntervalS,
String startDate,
String endDate) {
this.kpiId = kpiId;
this.samplingDurationS = samplingDurationS;
this.samplingIntervalS = samplingIntervalS;
this.startDate = startDate;
this.endDate = endDate;
}
public String getKpiId() {
return kpiId;
}
public float getSamplingDurationS() {
return samplingDurationS;
}
public float getSamplingIntervalS() {
return samplingIntervalS;
}
public String getStartDate() {
return startDate;
}
public String getEndDate() {
return endDate;
}
@Override
public String toString() {
return String.format(
"%s:{kpiId:\"%s\", samplingDurationS:\"%f\", samplingIntervalS:\"%f\", startDate:\"%s\", endDate:\"%s\"}",
getClass().getSimpleName(),
kpiId,
samplingDurationS,
samplingIntervalS,
startDate,
endDate);
}
}
...@@ -3,8 +3,8 @@ apiVersion: v1 ...@@ -3,8 +3,8 @@ apiVersion: v1
kind: Service kind: Service
metadata: metadata:
annotations: annotations:
app.quarkus.io/commit-id: cfe69c57feb1d488c2dda620021e3c62d67fc3d3 app.quarkus.io/commit-id: 4244298f2625d05dce3c62d8431b03f799506e78
app.quarkus.io/build-timestamp: 2022-07-14 - 07:52:22 +0000 app.quarkus.io/build-timestamp: 2022-07-21 - 11:54:42 +0000
labels: labels:
app.kubernetes.io/name: policyservice app.kubernetes.io/name: policyservice
app: policyservice app: policyservice
...@@ -25,8 +25,8 @@ apiVersion: apps/v1 ...@@ -25,8 +25,8 @@ apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata: metadata:
annotations: annotations:
app.quarkus.io/commit-id: cfe69c57feb1d488c2dda620021e3c62d67fc3d3 app.quarkus.io/commit-id: 4244298f2625d05dce3c62d8431b03f799506e78
app.quarkus.io/build-timestamp: 2022-07-14 - 07:52:22 +0000 app.quarkus.io/build-timestamp: 2022-07-21 - 11:54:42 +0000
labels: labels:
app: policyservice app: policyservice
app.kubernetes.io/name: policyservice app.kubernetes.io/name: policyservice
...@@ -39,8 +39,8 @@ spec: ...@@ -39,8 +39,8 @@ spec:
template: template:
metadata: metadata:
annotations: annotations:
app.quarkus.io/commit-id: cfe69c57feb1d488c2dda620021e3c62d67fc3d3 app.quarkus.io/commit-id: 4244298f2625d05dce3c62d8431b03f799506e78
app.quarkus.io/build-timestamp: 2022-07-14 - 07:52:22 +0000 app.quarkus.io/build-timestamp: 2022-07-21 - 11:54:42 +0000
labels: labels:
app: policyservice app: policyservice
app.kubernetes.io/name: policyservice app.kubernetes.io/name: policyservice
...@@ -53,10 +53,10 @@ spec: ...@@ -53,10 +53,10 @@ spec:
fieldPath: metadata.namespace fieldPath: metadata.namespace
- name: MONITORING_SERVICE_HOST - name: MONITORING_SERVICE_HOST
value: monitoringservice value: monitoringservice
- name: SERVICE_SERVICE_HOST
value: serviceservice
- name: CONTEXT_SERVICE_HOST - name: CONTEXT_SERVICE_HOST
value: contextservice value: contextservice
- name: SERVICE_SERVICE_HOST
value: serviceservice
image: registry.gitlab.com/teraflow-h2020/controller/policy:0.1.0 image: registry.gitlab.com/teraflow-h2020/controller/policy:0.1.0
imagePullPolicy: Always imagePullPolicy: Always
livenessProbe: livenessProbe:
......
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