diff options
author | Ravi Pendurty <ravi.pendurty@highstreet-technologies.com> | 2022-01-31 11:07:35 +0530 |
---|---|---|
committer | Ravi Pendurty <ravi.pendurty@highstreet-technologies.com> | 2022-01-31 12:49:04 +0530 |
commit | a31d1f3f489fdc6f68aecfaf66bf02cf6148f173 (patch) | |
tree | 230713c3d58b6af5a0026e61cc0ec1450250c6f8 /sdnr/wt/devicemanager-core/model | |
parent | 4d62788c11ac7e3a18e5c4b3eccf5eb5896bde70 (diff) |
refactor devicemanager-core
PerformanceDataProvider and Event classes
Issue-ID: CCSDK-3574
Signed-off-by: Ravi Pendurty <ravi.pendurty@highstreet-technologies.com>
Change-Id: I0c8f800001a01cc638caa702571b32824dbddca9
Signed-off-by: Ravi Pendurty <ravi.pendurty@highstreet-technologies.com>
Diffstat (limited to 'sdnr/wt/devicemanager-core/model')
5 files changed, 87 insertions, 96 deletions
diff --git a/sdnr/wt/devicemanager-core/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/ne/service/PerformanceDataProvider.java b/sdnr/wt/devicemanager-core/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/ne/service/PerformanceDataProvider.java index 925339b32..faad89aa1 100644 --- a/sdnr/wt/devicemanager-core/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/ne/service/PerformanceDataProvider.java +++ b/sdnr/wt/devicemanager-core/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/ne/service/PerformanceDataProvider.java @@ -20,6 +20,7 @@ package org.onap.ccsdk.features.sdnr.wt.devicemanager.ne.service; import java.util.Optional; import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.PerformanceDataLtp; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.util.InconsistentPMDataException; /** * Identify the NE as provider for performance data according to microwave model. @@ -33,7 +34,7 @@ public interface PerformanceDataProvider extends NetworkElementService { public void next(); - public Optional<PerformanceDataLtp> getLtpHistoricalPerformanceData(); + public Optional<PerformanceDataLtp> getLtpHistoricalPerformanceData() throws InconsistentPMDataException; public String pmStatusToString(); diff --git a/sdnr/wt/devicemanager-core/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/types/EventlogNotificationBuilder.java b/sdnr/wt/devicemanager-core/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/types/EventlogNotificationBuilder.java deleted file mode 100644 index 105453ea6..000000000 --- a/sdnr/wt/devicemanager-core/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/types/EventlogNotificationBuilder.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * ============LICENSE_START======================================================================== - * ONAP : ccsdk feature sdnr wt - * ================================================================================================= - * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved. - * ================================================================================================= - * 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. - * ============LICENSE_END========================================================================== - */ -package org.onap.ccsdk.features.sdnr.wt.devicemanager.types; - -import org.eclipse.jdt.annotation.Nullable; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.EventlogBuilder; -import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId; - -/** - * Add specific constructor - */ -public class EventlogNotificationBuilder extends EventlogBuilder { - - public EventlogNotificationBuilder(NodeId nodeId, @Nullable Integer counter, @Nullable DateAndTime timeStamp, - @Nullable String objectId, @Nullable String attributeName, @Nullable String newValue) { - - setNodeId(nodeId.getValue()); - if (counter != null) { - setCounter(counter); - } - if (timeStamp != null) { - setTimestamp(timeStamp); - } - setObjectId(objectId); - setAttributeName(attributeName); - setNewValue(newValue); - - } - -} diff --git a/sdnr/wt/devicemanager-core/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/types/FaultNotificationBuilder2.java b/sdnr/wt/devicemanager-core/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/types/FaultNotificationBuilder2.java deleted file mode 100644 index 5ccc664b4..000000000 --- a/sdnr/wt/devicemanager-core/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/types/FaultNotificationBuilder2.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * ============LICENSE_START======================================================================== - * ONAP : ccsdk feature sdnr wt - * ================================================================================================= - * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved. - * ================================================================================================= - * 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. - * ============LICENSE_END========================================================================== - */ -package org.onap.ccsdk.features.sdnr.wt.devicemanager.types; - -import org.eclipse.jdt.annotation.Nullable; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.FaultlogBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SourceType; -import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId; - -/** - * Add specific constructor - */ -public class FaultNotificationBuilder2 extends FaultlogBuilder { - - public FaultNotificationBuilder2(NodeId nodeId, @Nullable Integer counter, @Nullable DateAndTime timeStamp, - @Nullable String objectId, @Nullable String problem, @Nullable SeverityType severity, - SourceType sourceType) { - - setNodeId(nodeId.getValue()); - if (counter != null) { - setCounter(counter); - } - if (timeStamp != null) { - setTimestamp(timeStamp); - } - setObjectId(objectId); - setProblem(problem); - setSeverity(severity); - setSourceType(sourceType); - } - -} diff --git a/sdnr/wt/devicemanager-core/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/util/InconsistentPMDataException.java b/sdnr/wt/devicemanager-core/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/util/InconsistentPMDataException.java new file mode 100644 index 000000000..1869ec673 --- /dev/null +++ b/sdnr/wt/devicemanager-core/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/util/InconsistentPMDataException.java @@ -0,0 +1,43 @@ +/* + * ============LICENSE_START======================================================= + * ONAP : ccsdk features + * ================================================================================ + * Copyright (C) 2020 highstreet technologies GmbH Intellectual Property. + * All rights reserved. + * ================================================================================ + * 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. + * ============LICENSE_END========================================================= + * + */ +package org.onap.ccsdk.features.sdnr.wt.devicemanager.util; + +public class InconsistentPMDataException extends Exception { + + private static final long serialVersionUID = 1L; + + public InconsistentPMDataException() { + super(); + } + + public InconsistentPMDataException(String message) { + super(message); + } + + public InconsistentPMDataException(String message, Throwable cause) { + super(message, cause); + } + + public InconsistentPMDataException(Throwable cause) { + super(cause); + } +} diff --git a/sdnr/wt/devicemanager-core/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/util/PmUtil.java b/sdnr/wt/devicemanager-core/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/util/PmUtil.java new file mode 100644 index 000000000..6a0f716a6 --- /dev/null +++ b/sdnr/wt/devicemanager-core/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/util/PmUtil.java @@ -0,0 +1,42 @@ +/* + * ============LICENSE_START======================================================= + * ONAP : ccsdk features + * ================================================================================ + * Copyright (C) 2020 highstreet technologies GmbH Intellectual Property. + * All rights reserved. + * ================================================================================ + * 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. + * ============LICENSE_END========================================================= + * + */ +package org.onap.ccsdk.features.sdnr.wt.devicemanager.util; + +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class PmUtil { + + private static final Logger LOG = LoggerFactory.getLogger(PmUtil.class); + + static public <T extends DataObject> @NonNull T throwIfDataObjectNull(@Nullable T dataObject, String msg) + throws InconsistentPMDataException { + if (dataObject == null) { + LOG.debug(msg); + throw new InconsistentPMDataException(msg); + } + return dataObject; + } +} |