Commit 2efbda3a authored by Fotis Soldatos's avatar Fotis Soldatos
Browse files

feat(policy): add monitoring related domain models

parent a734c5ee
Loading
Loading
Loading
Loading
+65 −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.
*/

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);
    }
}
+49 −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.
*/

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);
    }
}
+4 −4
Original line number Diff line number Diff line
@@ -20,9 +20,9 @@ public class Kpi {

    private final String kpiId;
    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.timestamp = timestamp;
        this.kpiValue = kpiValue;
@@ -36,14 +36,14 @@ public class Kpi {
        return timestamp;
    }

    public String getKpiValue() {
    public KpiValue getKpiValue() {
        return kpiValue;
    }

    @Override
    public String toString() {
        return String.format(
                "%s:{kpiId:\"%s\", timeStamp:\"%s\", kpiValue:\"%s\"}",
                "%s:{kpiId:\"%s\", timeStamp:\"%s\", %s}",
                getClass().getSimpleName(), kpiId, timestamp, kpiValue);
    }
}
+12 −3
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package eu.teraflow.policy.monitoring.model;

import eu.teraflow.policy.context.model.EndPointId;
import eu.teraflow.policy.context.model.ServiceId;
import eu.teraflow.policy.context.model.SliceId;
import eu.teraflow.policy.kpi_sample_types.model.KpiSampleType;

public class KpiDescriptor {
@@ -27,18 +28,21 @@ public class KpiDescriptor {
    private final String deviceId;
    private final EndPointId endPointId;
    private final ServiceId serviceId;
    private final SliceId sliceId;

    public KpiDescriptor(
            String kpiDescription,
            KpiSampleType kpiSampleType,
            String deviceId,
            EndPointId endPointId,
            ServiceId serviceId) {
            ServiceId serviceId,
            SliceId sliceId) {
        this.kpiDescription = kpiDescription;
        this.kpiSampleType = kpiSampleType;
        this.deviceId = deviceId;
        this.endPointId = endPointId;
        this.serviceId = serviceId;
        this.sliceId = sliceId;
    }

    public String getKpiDescription() {
@@ -61,15 +65,20 @@ public class KpiDescriptor {
        return serviceId;
    }

    public SliceId getSliceId() {
        return sliceId;
    }

    @Override
    public String toString() {
        return String.format(
                "%s:{kpiDescription:\"%s\", kpiSampleType:\"%s\", deviceId:\"%s\", %s, %s}",
                "%s:{kpiDescription:\"%s\", kpiSampleType:\"%s\", deviceId:\"%s\", %s, %s, %s}",
                getClass().getSimpleName(),
                kpiDescription,
                kpiSampleType.toString(),
                deviceId,
                endPointId,
                serviceId);
                serviceId,
                sliceId);
    }
}
+41 −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.
*/

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);
    }
}
Loading