diff options
Diffstat (limited to 'sdnr/wt/devicemanager-onap')
32 files changed, 1701 insertions, 455 deletions
diff --git a/sdnr/wt/devicemanager-onap/adapter-manager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/adaptermanager/impl/AdapterManagerNetworkElementFactory.java b/sdnr/wt/devicemanager-onap/adapter-manager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/adaptermanager/impl/AdapterManagerNetworkElementFactory.java index c9930eaf5..02314c978 100644 --- a/sdnr/wt/devicemanager-onap/adapter-manager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/adaptermanager/impl/AdapterManagerNetworkElementFactory.java +++ b/sdnr/wt/devicemanager-onap/adapter-manager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/adaptermanager/impl/AdapterManagerNetworkElementFactory.java @@ -1,5 +1,5 @@ /* - * ============LICENSE_START======================================================================== +* ============LICENSE_START======================================================================== * ONAP : ccsdk feature sdnr wt * ================================================================================================= * Copyright (C) 2020 highstreet technologies GmbH Intellectual Property. All rights reserved. @@ -22,22 +22,42 @@ import java.util.Optional; import org.onap.ccsdk.features.sdnr.wt.devicemanager.ne.factory.NetworkElementFactory; import org.onap.ccsdk.features.sdnr.wt.devicemanager.ne.service.NetworkElement; import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServiceProvider; +import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.Capabilities; import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfAccessor; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.network.topology.simulator.rev191025.SimulatorStatus; -import org.opendaylight.yang.gen.v1.urn.o.ran.sc.params.xml.ns.yang.nts.manager.rev210326.simulation.NetworkFunctions; +import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfBindingAccessor; +import org.opendaylight.yang.gen.v1.urn.o.ran.sc.params.xml.ns.yang.nts.manager.rev210608.simulation.NetworkFunctions; +import org.opendaylight.yangtools.yang.common.QName; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +/** + * YANG Specs: + * urn:o-ran-sc:params:xml:ns:yang:nts:manager?revision=2021-06-08)nts-manager + * + */ public class AdapterManagerNetworkElementFactory implements NetworkElementFactory { private static final Logger log = LoggerFactory.getLogger(AdapterManagerNetworkElementFactory.class); + private static QName ROOTKEY=NetworkFunctions.QNAME; + @Override public Optional<NetworkElement> create(NetconfAccessor acessor, DeviceManagerServiceProvider serviceProvider) { - if (acessor.getCapabilites().isSupportingNamespace(SimulatorStatus.QNAME) || acessor.getCapabilites().isSupportingNamespace(NetworkFunctions.QNAME)) { - log.info("Create device {} ", NtsNetworkElement.class.getName()); - return Optional.of(new NtsNetworkElement(acessor, serviceProvider.getDataProvider())); + showLogInfo(); + Capabilities capabilities = acessor.getCapabilites(); + if (capabilities.isSupportingNamespaceAndRevision(ROOTKEY)) { + Optional<NetconfBindingAccessor> bindingAccessor = acessor.getNetconfBindingAccessor(); + if (bindingAccessor.isPresent()) { + log.info("Create device {} ", NtsNetworkElement.class.getName()); + return Optional.of(new NtsNetworkElement(bindingAccessor.get(), serviceProvider)); + } } + log.debug("No accessor for mountpoint {} {}", acessor.getNodeId(), capabilities); return Optional.empty(); } + + private void showLogInfo() { + log.debug("{} searching for {}", AdapterManagerNetworkElementFactory.class.getSimpleName(), + Capabilities.getNamespaceAndRevisionAsString(ROOTKEY)); + } } diff --git a/sdnr/wt/devicemanager-onap/adapter-manager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/adaptermanager/impl/NotificationListenerImpl.java b/sdnr/wt/devicemanager-onap/adapter-manager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/adaptermanager/impl/NotificationListenerImpl.java new file mode 100644 index 000000000..6be6a6508 --- /dev/null +++ b/sdnr/wt/devicemanager-onap/adapter-manager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/adaptermanager/impl/NotificationListenerImpl.java @@ -0,0 +1,57 @@ +/* + * ============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.adaptermanager.impl; + +import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServiceProvider; +import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfBindingAccessor; +import org.opendaylight.yang.gen.v1.urn.o.ran.sc.params.xml.ns.yang.nts.manager.rev210608.InstanceChanged; +import org.opendaylight.yang.gen.v1.urn.o.ran.sc.params.xml.ns.yang.nts.manager.rev210608.NtsManagerListener; +import org.opendaylight.yang.gen.v1.urn.o.ran.sc.params.xml.ns.yang.nts.manager.rev210608.OperationStatusChanged; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class NotificationListenerImpl implements NtsManagerListener { + + private static final Logger log = LoggerFactory.getLogger(NotificationListenerImpl.class); + private final NetconfBindingAccessor netconfAccessor; + private final DeviceManagerServiceProvider serviceProvider; + + public NotificationListenerImpl(NetconfBindingAccessor netconfAccess, DeviceManagerServiceProvider serviceProvider) { + this.netconfAccessor = netconfAccess; + this.serviceProvider = serviceProvider; + } + + @Override + public void onInstanceChanged(InstanceChanged notification) { + log.debug("Got event of type :: InstanceChanged"); + this.serviceProvider.getWebsocketService().sendNotification(notification, netconfAccessor.getNodeId(), + InstanceChanged.QNAME); + } + + @Override + public void onOperationStatusChanged(OperationStatusChanged notification) { + log.debug("Got event of type :: OperationStatusChanged"); + this.serviceProvider.getWebsocketService().sendNotification(notification, netconfAccessor.getNodeId(), + OperationStatusChanged.QNAME); + } + +} diff --git a/sdnr/wt/devicemanager-onap/adapter-manager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/adaptermanager/impl/NtsNetworkElement.java b/sdnr/wt/devicemanager-onap/adapter-manager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/adaptermanager/impl/NtsNetworkElement.java index d73d82412..74eb8d010 100644 --- a/sdnr/wt/devicemanager-onap/adapter-manager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/adaptermanager/impl/NtsNetworkElement.java +++ b/sdnr/wt/devicemanager-onap/adapter-manager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/adaptermanager/impl/NtsNetworkElement.java @@ -18,12 +18,17 @@ package org.onap.ccsdk.features.sdnr.wt.devicemanager.adaptermanager.impl; import java.util.Optional; +import org.eclipse.jdt.annotation.NonNull; import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DataProvider; import org.onap.ccsdk.features.sdnr.wt.devicemanager.ne.service.NetworkElement; import org.onap.ccsdk.features.sdnr.wt.devicemanager.ne.service.NetworkElementService; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServiceProvider; import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfAccessor; +import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfBindingAccessor; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.NetworkElementDeviceType; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId; +import org.opendaylight.yangtools.concepts.ListenerRegistration; +import org.opendaylight.yangtools.yang.binding.NotificationListener; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -35,19 +40,28 @@ public class NtsNetworkElement implements NetworkElement { private static final Logger LOG = LoggerFactory.getLogger(NtsNetworkElement.class); - private final NetconfAccessor netconfAccessor; + private final NetconfBindingAccessor netconfAccessor; @SuppressWarnings("unused") private final DataProvider databaseService; + private final NotificationListenerImpl notificationListener; - NtsNetworkElement(NetconfAccessor netconfAccess, DataProvider databaseService) { + private @NonNull ListenerRegistration<NotificationListener> listenerRegistrationresult; + + NtsNetworkElement(NetconfBindingAccessor netconfAccess, DeviceManagerServiceProvider serviceProvider) { LOG.info("Create {}", NtsNetworkElement.class.getSimpleName()); this.netconfAccessor = netconfAccess; - this.databaseService = databaseService; + this.databaseService = serviceProvider.getDataProvider(); + this.notificationListener = new NotificationListenerImpl(netconfAccess,serviceProvider); + this.listenerRegistrationresult = null; } @Override - public void deregister() {} + public void deregister() { + if(this.listenerRegistrationresult!=null) { + this.listenerRegistrationresult.close(); + } + } @Override public NodeId getNodeId() { @@ -60,10 +74,20 @@ public class NtsNetworkElement implements NetworkElement { } @Override - public void warmstart() {} + public void warmstart() { + } @Override - public void register() {} + public void register() { + if (netconfAccessor.isNotificationsRFC5277Supported()) { + listenerRegistrationresult = netconfAccessor.doRegisterNotificationListener(this.notificationListener); + // Register default (NETCONF) stream + netconfAccessor.registerNotificationsStream(); + LOG.debug("registered for notifications"); + } else { + LOG.warn("unable to register for notifications. RFC5277 not supported"); + } + } @Override public NetworkElementDeviceType getDeviceType() { diff --git a/sdnr/wt/devicemanager-onap/adapter-manager/provider/src/main/yang/nts-common.yang b/sdnr/wt/devicemanager-onap/adapter-manager/provider/src/main/yang/nts-common@2021-06-08.yang index 86d7b3e8a..24b3a1725 100644 --- a/sdnr/wt/devicemanager-onap/adapter-manager/provider/src/main/yang/nts-common.yang +++ b/sdnr/wt/devicemanager-onap/adapter-manager/provider/src/main/yang/nts-common@2021-06-08.yang @@ -18,6 +18,12 @@ module nts-common { description "This module contains common yang definitions YANG definitions for the Network Topology Simulator."; + revision 2021-06-08 { + description + "Moved NTS_PROTOCOL_TYPE_BASE identities from nts-manager."; + reference + "O-RAN-SC SIM project"; + } revision 2021-03-26 { description "Added controller-protocol."; @@ -60,6 +66,47 @@ module nts-common { "This means that the server supports reporting back the number of faults that were generated"; } + identity NTS_PROTOCOL_TYPE_BASE { + description + "Base identity for protocol."; + } + + identity NTS_PROTOCOL_TYPE_NETCONF_SSH { + base NTS_PROTOCOL_TYPE_BASE; + description + "Identity for NETCONF SSH protocol."; + } + + identity NTS_PROTOCOL_TYPE_NETCONF_TLS { + base NTS_PROTOCOL_TYPE_BASE; + description + "Identity for NETCONF TLS protocol."; + } + + identity NTS_PROTOCOL_TYPE_FTP { + base NTS_PROTOCOL_TYPE_BASE; + description + "Identity for FTP protocol."; + } + + identity NTS_PROTOCOL_TYPE_SFTP { + base NTS_PROTOCOL_TYPE_BASE; + description + "Identity for SFTP protocol."; + } + + identity NTS_PROTOCOL_TYPE_HTTP { + base NTS_PROTOCOL_TYPE_BASE; + description + "Identity for HTTP protocol."; + } + + identity NTS_PROTOCOL_TYPE_HTTPS { + base NTS_PROTOCOL_TYPE_BASE; + description + "Identity for HTTPS protocol."; + } + identity NTS_FUNCTION_TYPE_BASE { description "The reference of each identity represents the name of the associated docker image."; @@ -67,19 +114,19 @@ module nts-common { typedef authentication-method-type { type enumeration { - enum no-auth { + enum "no-auth" { description "no security (http)"; } - enum cert-only { + enum "cert-only" { description "auth by certificate (https)"; } - enum basic-auth { + enum "basic-auth" { description "auth by basic auth username and password (https)"; } - enum cert-basic-auth { + enum "cert-basic-auth" { description "auth by certificate and basic auth username / password (https)"; } @@ -130,11 +177,11 @@ module nts-common { "Groups details about mount point"; leaf mount-point-addressing-method { type enumeration { - enum host-mapping { + enum "host-mapping" { description "Uses IP and port mapped to the host machine to address the nework function."; } - enum docker-mapping { + enum "docker-mapping" { description "Uses Docker IP and port to address the nework function."; } @@ -158,6 +205,7 @@ module nts-common { description "The index of the list."; } + leaf delay-period { type uint16; units "s"; @@ -180,21 +228,25 @@ module nts-common { description "Number of normal (non-alarmed) events."; } + leaf warning { type uint32; description "Number of warning events."; } + leaf minor { type uint32; description "Number of minor events."; } + leaf major { type uint32; description "Number of major events."; } + leaf critical { type uint32; description @@ -211,6 +263,7 @@ module nts-common { description "Groups the fault generation configuration and status."; uses fault-delay-period-g; + uses fault-count-g; } } @@ -233,6 +286,7 @@ module nts-common { description "Container for describing the NETCONF details."; uses faults-enabled-g; + leaf call-home { type boolean; description @@ -249,11 +303,13 @@ module nts-common { description "Container for describing the VES details."; uses faults-enabled-g; + leaf pnf-registration { type boolean; description "For enabling the PNF Registration messages. If set to 'true', each simulated device, when booting up, will send a PNF Registration message to the VES Collector."; } + leaf heartbeat-period { type uint16; description @@ -267,11 +323,11 @@ module nts-common { "Groups information about the SDN Controller."; leaf controller-protocol { type enumeration { - enum http { + enum "http" { description "HTTP protocol will be used to connect to the VES Collector."; } - enum https { + enum "https" { description "HTTPS protocol will be used to connect to the VES Collector."; } @@ -280,26 +336,31 @@ module nts-common { description "The protocol used for communication with the SDN Controller."; } + leaf controller-ip { - type inet:ip-address; + type inet:host; description "The IP address of the SDN Controller."; } + leaf controller-port { type inet:port-number; description "The port exposed by the SDN Controller."; } + leaf controller-netconf-call-home-port { type inet:port-number; description "The port exposed by the SDN Controller for NETCONF Call Home."; } + leaf controller-username { type string; description "The username for accessing the SDN Controller."; } + leaf controller-password { type string; description @@ -312,11 +373,11 @@ module nts-common { "Groups information about the VES Collector."; leaf ves-endpoint-protocol { type enumeration { - enum http { + enum "http" { description "HTTP protocol will be used to connect to the VES Collector."; } - enum https { + enum "https" { description "HTTPS protocol will be used to connect to the VES Collector."; } @@ -325,32 +386,38 @@ module nts-common { description "The protocol (HTTP / HTTPS) to be used to address the VES Collector."; } + leaf ves-endpoint-ip { - type inet:ip-address; + type inet:host; description "The IP address of the VES Collector."; } + leaf ves-endpoint-port { type inet:port-number; description "The port exposed by the VES Collector."; } + leaf ves-endpoint-auth-method { type authentication-method-type; default "no-auth"; description "The type of the authentication to be used with the VES Collector."; } + leaf ves-endpoint-username { type string; description "The username for accessing the VES Collector."; } + leaf ves-endpoint-password { type string; description "The password for accessing the VES Collector."; } + leaf ves-endpoint-certificate { type string; description @@ -363,11 +430,11 @@ module nts-common { "RPC output grouping."; leaf status { type enumeration { - enum SUCCESS { + enum "SUCCESS" { description "The RPC was successfully invoked."; } - enum ERROR { + enum "ERROR" { description "An error was encountered when invoking the RPC."; } @@ -377,4 +444,4 @@ module nts-common { "The status of the RPC."; } } -} +}
\ No newline at end of file diff --git a/sdnr/wt/devicemanager-onap/adapter-manager/provider/src/main/yang/nts-commscope-pac@2020-11-30.yang b/sdnr/wt/devicemanager-onap/adapter-manager/provider/src/main/yang/nts-commscope-pac@2020-11-30.yang new file mode 100644 index 000000000..0e01d4bbe --- /dev/null +++ b/sdnr/wt/devicemanager-onap/adapter-manager/provider/src/main/yang/nts-commscope-pac@2020-11-30.yang @@ -0,0 +1,57 @@ +module nts-commscope-pac { + yang-version 1.1; + namespace "urn:o-ran-sc:params:xml:ns:yang:nts:commscope"; + prefix nts-cscp; + + import nts-common { + prefix ntsc; + } + + organization + "O-RAN-SC"; + contact + " Web: <https://wiki.o-ran-sc.org/display/SIM/SIM> + Editors: + Alex Stancu <mailto:alexandru.stancu@highstreet-technologies.com> + Adrian Lita <mailto:adrian.lita@highstreet-technologies.com> + Martin Skorupski <mailto:martin.skorupski@highstreet-technologies.com>"; + description + "This module contains YANG definitions for the Network Topology Simulator - CommScope extensions."; + + revision 2020-11-30 { + description + "Cleared revision for nts-common import."; + reference + "CommScope OneCell implementaion."; + } + revision 2020-09-07 { + description + "Initial revision for the Network Topology Simulator - Next Generation"; + reference + "CommScope OneCell implementaion."; + } + + identity NTS_FUNCTION_TYPE_ONECELL_4_3 { + base ntsc:NTS_FUNCTION_TYPE_BASE; + description + "The simulated network function implements a CommScope OneCell version 4.3 YANG model."; + reference + "nts-ng-onecell-4-3"; + } + + identity NTS_FUNCTION_TYPE_ONECELL_4_5 { + base ntsc:NTS_FUNCTION_TYPE_BASE; + description + "The simulated network function implements a CommScope OneCell version 4.5 YANG model."; + reference + "nts-ng-onecell-4-5"; + } + + identity NTS_FUNCTION_TYPE_ONECELL_AUGMENT { + base ntsc:NTS_FUNCTION_TYPE_BASE; + description + "The simulated network function implements a CommScope OneCell Auugment YANG model."; + reference + "nts-ng-onecell-augment"; + } +}
\ No newline at end of file diff --git a/sdnr/wt/devicemanager-onap/adapter-manager/provider/src/main/yang/nts-development-pac@2021-05-05.yang b/sdnr/wt/devicemanager-onap/adapter-manager/provider/src/main/yang/nts-development-pac@2021-05-05.yang new file mode 100644 index 000000000..baa5f7749 --- /dev/null +++ b/sdnr/wt/devicemanager-onap/adapter-manager/provider/src/main/yang/nts-development-pac@2021-05-05.yang @@ -0,0 +1,55 @@ +module nts-development-pac { + yang-version 1.1; + namespace "urn:o-ran-sc:params:xml:ns:yang:nts:development"; + prefix nts-dev; + + import nts-common { + prefix ntsc; + } + + organization + "O-RAN-SC"; + contact + " Web: <https://wiki.o-ran-sc.org/display/SIM/SIM> + Editors: + Alex Stancu <mailto:alexandru.stancu@highstreet-technologies.com> + Adrian Lita <mailto:adrian.lita@highstreet-technologies.com> + Martin Skorupski <mailto:martin.skorupski@highstreet-technologies.com>"; + description + "This module contains YANG definitions for the Network Topology Simulator - Development extensions."; + + revision 2021-05-05 { + description + "Added sepparate NTS_FUNCTION_TYPE_DEV/SANDBOX types."; + reference + "Development implementation"; + } + revision 2020-11-30 { + description + "Cleared revision for nts-common import."; + reference + "Development implementation"; + } + revision 2020-10-26 { + description + "Initial revision for the Network Topology Simulator - Next Generation"; + reference + "Development implementation"; + } + + identity NTS_FUNCTION_TYPE_DEV { + base ntsc:NTS_FUNCTION_TYPE_BASE; + description + "The simulated network function implements a dev YANG model."; + reference + "nts-ng-dev"; + } + + identity NTS_FUNCTION_TYPE_SANDBOX { + base ntsc:NTS_FUNCTION_TYPE_BASE; + description + "The simulated network function implements a dev sandbox YANG model."; + reference + "nts-ng-sandbox"; + } +}
\ No newline at end of file diff --git a/sdnr/wt/devicemanager-onap/adapter-manager/provider/src/main/yang/nts-kumu-pac@2020-11-30.yang b/sdnr/wt/devicemanager-onap/adapter-manager/provider/src/main/yang/nts-kumu-pac@2020-11-30.yang new file mode 100644 index 000000000..a1a73af86 --- /dev/null +++ b/sdnr/wt/devicemanager-onap/adapter-manager/provider/src/main/yang/nts-kumu-pac@2020-11-30.yang @@ -0,0 +1,41 @@ +module nts-kumu-pac { + yang-version 1.1; + namespace "urn:o-ran-sc:params:xml:ns:yang:nts:kumu"; + prefix nts-kumu; + + import nts-common { + prefix ntsc; + } + + organization + "O-RAN-SC"; + contact + " Web: <https://wiki.o-ran-sc.org/display/SIM/SIM> + Editors: + Alex Stancu <mailto:alexandru.stancu@highstreet-technologies.com> + Adrian Lita <mailto:adrian.lita@highstreet-technologies.com> + Martin Skorupski <mailto:martin.skorupski@highstreet-technologies.com>"; + description + "This module contains YANG definitions for the Network Topology Simulator - KUMU Networks extensions."; + + revision 2020-11-30 { + description + "Cleared revision for nts-common import."; + reference + "KUMU Networks implementation"; + } + revision 2020-09-28 { + description + "Initial revision for the Network Topology Simulator - Next Generation"; + reference + "KUMU Networks implementation"; + } + + identity NTS_FUNCTION_TYPE_KUMU_RELAY { + base ntsc:NTS_FUNCTION_TYPE_BASE; + description + "The simulated network function implements a Kumu Networks YANG model."; + reference + "nts-ng-kumu"; + } +}
\ No newline at end of file diff --git a/sdnr/wt/devicemanager-onap/adapter-manager/provider/src/main/yang/nts-manager.yang b/sdnr/wt/devicemanager-onap/adapter-manager/provider/src/main/yang/nts-manager@2021-06-08.yang index 5f7bc14cd..69a92d8e1 100644 --- a/sdnr/wt/devicemanager-onap/adapter-manager/provider/src/main/yang/nts-manager.yang +++ b/sdnr/wt/devicemanager-onap/adapter-manager/provider/src/main/yang/nts-manager@2021-06-08.yang @@ -6,6 +6,7 @@ module nts-manager { import ietf-inet-types { prefix inet; } + import nts-common { prefix ntsc; } @@ -21,6 +22,12 @@ module nts-manager { description "This module contains YANG definitions for the Network Topology Simulator - Manager."; + revision 2021-06-08 { + description + "Moved NTS_PROTOCOL_TYPE_BASE identities to nts-common."; + reference + "O-RAN-SC SIM project"; + } revision 2021-03-26 { description "Added NTS_PROTOCOL_TYPE_BASE identities and changed instance/networking container; also added multi-base port support."; @@ -52,47 +59,6 @@ module nts-manager { "O-RAN-SC SIM project"; } - identity NTS_PROTOCOL_TYPE_BASE { - description - "Base identity for protocol."; - } - - identity NTS_PROTOCOL_TYPE_NETCONF_SSH { - base NTS_PROTOCOL_TYPE_BASE; - description - "Identity for NETCONF SSH protocol."; - } - - identity NTS_PROTOCOL_TYPE_NETCONF_TLS { - base NTS_PROTOCOL_TYPE_BASE; - description - "Identity for NETCONF TLS protocol."; - } - - identity NTS_PROTOCOL_TYPE_FTP { - base NTS_PROTOCOL_TYPE_BASE; - description - "Identity for FTP protocol."; - } - - identity NTS_PROTOCOL_TYPE_SFTP { - base NTS_PROTOCOL_TYPE_BASE; - description - "Identity for SFTP protocol."; - } - - identity NTS_PROTOCOL_TYPE_HTTP { - base NTS_PROTOCOL_TYPE_BASE; - description - "Identity for HTTP protocol."; - } - - identity NTS_PROTOCOL_TYPE_HTTPS { - base NTS_PROTOCOL_TYPE_BASE; - description - "Identity for HTTPS protocol."; - } - typedef percent { type decimal64 { fraction-digits 2; @@ -110,11 +76,13 @@ module nts-manager { description "The name of the running instance. It is the same as the docker container name which exposes this network function."; } + leaf is-mounted { type boolean; description "Whether the instance is mounted or not to a controller."; } + container networking { description "Groups the details about networking information."; @@ -123,6 +91,7 @@ module nts-manager { description "The IP address of the docker container implementing the network function instance."; } + list docker-ports { key "port"; description @@ -132,19 +101,22 @@ module nts-manager { description "Port number."; } + leaf protocol { type identityref { - base NTS_PROTOCOL_TYPE_BASE; + base ntsc:NTS_PROTOCOL_TYPE_BASE; } description "Protocol attached to current port."; } } + leaf host-ip { type inet:ip-address; description "The Host machine IP address pointing to the docker container implementing the network function instance."; } + list host-ports { key "port"; description @@ -154,9 +126,10 @@ module nts-manager { description "Port number."; } + leaf protocol { type identityref { - base NTS_PROTOCOL_TYPE_BASE; + base ntsc:NTS_PROTOCOL_TYPE_BASE; } description "Protocol attached to current port."; @@ -175,43 +148,54 @@ module nts-manager { description "Type of network function to be simulated."; } + leaf started-instances { type uint16; mandatory true; description "How many instances of this type are started."; } + leaf mounted-instances { type uint16; - must '. <= ../started-instances' { - error-message "The number of mounted instances cannot be greater that the number of started instances."; + must ". <= ../started-instances" { + error-message + "The number of mounted instances cannot be greater that the number of started instances."; } mandatory true; description "How many instances of this type are mounted in the SDN Controller."; } + uses ntsc:mount-point-details-g; + leaf docker-instance-name { type string; mandatory true; description "The prefix of each docker container being started."; } + leaf docker-version-tag { type string; mandatory true; description "The version tag of the docker image to be started."; } + leaf docker-repository { type string; mandatory true; description "The prefix containing the docker repository information, if needed."; } + uses ntsc:faults-g; + uses ntsc:netconf-config-g; + uses ntsc:ves-config-g; + container instances { config false; description @@ -221,6 +205,7 @@ module nts-manager { description "Describes a running instance."; uses ntsc:mount-point-details-g; + uses instance-g; } } @@ -238,46 +223,54 @@ module nts-manager { description "The base Host machine port from where the simulation can allocate ports incrementally for NETCONF SSH protocol."; } + leaf netconf-tls-port { type inet:port-number; description "The base Host machine port from where the simulation can allocate ports incrementally for NETCONF TLS protocol."; } + leaf transport-ftp-port { type inet:port-number; description "The base Host machine port from where the simulation can allocate ports incrementally for FTP protocol."; } + leaf transport-sftp-port { type inet:port-number; description "The base Host machine port from where the simulation can allocate ports incrementally for SFTP protocol."; } } + leaf ssh-connections { type uint8; config false; description "The number of SSH Endpoints each network function instance exposes."; } + leaf tls-connections { type uint8; config false; description "The number of TLS Endpoints each network function instance exposes."; } + leaf cpu-usage { type percent; config false; description "Specifies the CPU load generated by the simulation."; } + leaf mem-usage { type uint32; config false; description "Specifies the RAM in MB used by the simulation."; } + leaf last-operation-status { type string; config false; @@ -297,6 +290,7 @@ module nts-manager { description "Type of network function to be simulated."; } + leaf docker-image-name { type string; config false; @@ -304,6 +298,7 @@ module nts-manager { description "The prefix of each docker container being started."; } + leaf docker-version-tag { type string; config false; @@ -311,6 +306,7 @@ module nts-manager { description "The version tag of the docker image to be started."; } + leaf docker-repository { type string; config false; @@ -320,46 +316,6 @@ module nts-manager { } } - notification instance-changed { - description - "Sent by the Manager every time something occurs in any of the simulated NF instances."; - leaf change-status { - type string; - mandatory true; - description - "The status of the change which was executed to the NF instance."; - } - leaf function-type { - type identityref { - base ntsc:NTS_FUNCTION_TYPE_BASE; - } - mandatory true; - description - "Type of the NF instance."; - } - uses instance-g { - refine "name" { - mandatory true; - } - } - } - - notification operation-status-changed { - description - "Sent by the Manager every time a user operation is finished."; - leaf operation-status { - type string; - mandatory true; - description - "The status of the operation which was executed by the Manager."; - } - leaf error-message { - type string; - description - "Detailed error message from the Manager."; - } - } - container simulation { presence "Enables simulation configuration."; description @@ -374,6 +330,7 @@ module nts-manager { uses network-function-image-g; } } + container network-functions { presence "Enables NF configuration."; description @@ -386,18 +343,64 @@ module nts-manager { uses network-function-g; } } + container sdn-controller { presence "Enables SDN Controller detail configuration."; description "Groups details about the SDN Controller."; uses ntsc:controller-g; } + container ves-endpoint { presence "Enables VES endpoint detail configuration."; description "Groups details about the VES Collector endpoint."; uses ntsc:ves-endpoint-g; } + uses simulation-information-g; } -} + + notification instance-changed { + description + "Sent by the Manager every time something occurs in any of the simulated NF instances."; + leaf change-status { + type string; + mandatory true; + description + "The status of the change which was executed to the NF instance."; + } + + leaf function-type { + type identityref { + base ntsc:NTS_FUNCTION_TYPE_BASE; + } + mandatory true; + description + "Type of the NF instance."; + } + + uses instance-g { + refine "name" { + mandatory true; + } + } + } + + notification operation-status-changed { + description + "Sent by the Manager every time a user operation is finished."; + leaf operation-status { + type string; + mandatory true; + description + "The status of the operation which was executed by the Manager."; + } + + leaf error-message { + type string; + description + "Detailed error message from the Manager."; + } + } +}
\ No newline at end of file diff --git a/sdnr/wt/devicemanager-onap/adapter-manager/provider/src/main/yang/nts-mavenir-pac@2020-11-30.yang b/sdnr/wt/devicemanager-onap/adapter-manager/provider/src/main/yang/nts-mavenir-pac@2020-11-30.yang new file mode 100644 index 000000000..6feccf66a --- /dev/null +++ b/sdnr/wt/devicemanager-onap/adapter-manager/provider/src/main/yang/nts-mavenir-pac@2020-11-30.yang @@ -0,0 +1,49 @@ +module nts-mavenir-pac { + yang-version 1.1; + namespace "urn:o-ran-sc:params:xml:ns:yang:nts:mavenir"; + prefix nts-mvn; + + import nts-common { + prefix ntsc; + } + + organization + "O-RAN-SC"; + contact + " Web: <https://wiki.o-ran-sc.org/display/SIM/SIM> + Editors: + Alex Stancu <mailto:alexandru.stancu@highstreet-technologies.com> + Adrian Lita <mailto:adrian.lita@highstreet-technologies.com> + Martin Skorupski <mailto:martin.skorupski@highstreet-technologies.com>"; + description + "This module contains YANG definitions for the Network Topology Simulator - Mavenir extensions."; + + revision 2020-11-30 { + description + "Cleared revision for nts-common import."; + reference + "Mavenir implemenation."; + } + revision 2020-09-07 { + description + "Initial revision for the Network Topology Simulator - Next Generation"; + reference + "Mavenir implemenation."; + } + + identity NTS_FUNCTION_TYPE_MAVENIR_ENBCU { + base ntsc:NTS_FUNCTION_TYPE_BASE; + description + "The simulated network function implements a Mavenir eNodeB-CU YANG model."; + reference + "nts-ng-mavenir-enbcu"; + } + + identity NTS_FUNCTION_TYPE_MAVENIR_ENBDU { + base ntsc:NTS_FUNCTION_TYPE_BASE; + description + "The simulated network function implements a Mavenir eNodeB-DU YANG model."; + reference + "nts-ng-mavenir-enbdu"; + } +}
\ No newline at end of file diff --git a/sdnr/wt/devicemanager-onap/adapter-manager/provider/src/main/yang/nts-network-function@2021-06-18.yang b/sdnr/wt/devicemanager-onap/adapter-manager/provider/src/main/yang/nts-network-function@2021-06-18.yang new file mode 100644 index 000000000..f8e39ef2d --- /dev/null +++ b/sdnr/wt/devicemanager-onap/adapter-manager/provider/src/main/yang/nts-network-function@2021-06-18.yang @@ -0,0 +1,497 @@ +module nts-network-function { + yang-version 1.1; + namespace "urn:o-ran-sc:params:xml:ns:yang:nts:network:function"; + prefix ntsnf; + + import ietf-inet-types { + prefix inet; + } + + import nts-common { + prefix ntsc; + } + + import ietf-yang-types { + prefix yang; + } + + organization + "O-RAN-SC"; + contact + " Web: <https://wiki.o-ran-sc.org/display/SIM/SIM> + Editors: + Alex Stancu <mailto:alexandru.stancu@highstreet-technologies.com> + Adrian Lita <mailto:adrian.lita@highstreet-technologies.com> + Martin Skorupski <mailto:martin.skorupski@highstreet-technologies.com>"; + description + "This module contains YANG definitions for the Network Topology Simulator - Network Functions"; + + revision 2021-06-18 { + description + "Added test-list for NETCONF hardware delay emulation."; + reference + "O-RAN-SC SIM project"; + } + revision 2021-06-14 { + description + "Added total loss network emulation RPC and NETCONF write-delay emulation."; + reference + "O-RAN-SC SIM project"; + } + revision 2021-06-08 { + description + "Added more info and NETCONF latency emulation."; + reference + "O-RAN-SC SIM project"; + } + revision 2021-05-17 { + description + "Added support for network emulation."; + reference + "O-RAN-SC SIM project"; + } + revision 2021-03-26 { + description + "Added info container, and expanted feature control mechanism and status."; + reference + "O-RAN-SC SIM project"; + } + revision 2021-03-17 { + description + "Renamed datastore-random-populate RPC to datastore-populate"; + reference + "O-RAN-SC SIM project"; + } + revision 2020-12-11 { + description + "Added function-type to simulated function."; + reference + "O-RAN-SC SIM project"; + } + revision 2020-11-30 { + description + "Cleared revision for nts-common import."; + reference + "O-RAN-SC SIM project"; + } + revision 2020-10-28 { + description + "Add RPC for clearing the fault counters."; + reference + "O-RAN-SC SIM project"; + } + revision 2020-10-13 { + description + "Add RPC for datastore populating and feature control."; + reference + "O-RAN-SC SIM project"; + } + revision 2020-09-07 { + description + "Initial revision for the Network Topology Simulator - Next Generation"; + reference + "O-RAN-SC SIM project"; + } + + container info { + config false; + description + "Information about NTS application and modules."; + leaf build-time { + type yang:date-and-time; + description + "Build time of NTS application."; + } + + leaf version { + type string; + description + "NTS version of current network-function."; + } + + leaf started-features { + type ntsc:feature-type; + description + "A bit-wise list with currently started features."; + } + + leaf ssh-connections { + type uint8; + config false; + description + "The number of SSH Endpoints the network function instance exposes."; + } + + leaf tls-connections { + type uint8; + config false; + description + "The number of TLS Endpoints the network function instance exposes."; + } + + leaf hostname { + type string; + description + "Current network function hostname."; + } + + list docker-ports { + key "port"; + description + "The ports which are exposed inside the docker container implementing this network function instance."; + leaf port { + type inet:port-number; + description + "Port number."; + } + + leaf protocol { + type identityref { + base ntsc:NTS_PROTOCOL_TYPE_BASE; + } + description + "Protocol attached to current port."; + } + } + } + + container simulation { + description + "Root level container which controls the Network Function."; + container network-function { + description + "Container which encompasses the details of the network function."; + leaf function-type { + type string; + description + "Type of network function that is simulated."; + } + + uses ntsc:mount-point-details-g; + + uses ntsc:faults-g; + + uses ntsc:netconf-config-g; + + uses ntsc:ves-config-g; + } + + container network-emulation { + description + "Container which encompasses the details of the network emulation."; + leaf limit { + type uint16 { + range "16 .. max"; + } + units "packets"; + default "1000"; + description + "Maximum number of packets the qdisc may hold queued at a time."; + } + + container delay { + description + "Adds the chosen delay to the packets outgoing to chosen network interface."; + leaf time { + type uint16; + units "miliseconds (ms)"; + description + "Delay time between packets."; + } + + leaf jitter { + type uint16; + units "miliseconds (ms)"; + description + "Delay jitter."; + } + + leaf correlation { + type uint8 { + range "0 .. 100"; + } + units "percentage"; + description + "Delay correlation."; + } + + leaf distribution { + type enumeration { + enum "uniform" { + description + "Uniform delay distribution."; + } + enum "normal" { + description + "Normal delay distribution."; + } + enum "pareto" { + description + "Pareto delay distribution."; + } + enum "paretonormal" { + description + "Paretonormal delay distribution."; + } + } + description + "Delay distribution."; + } + } + + leaf loss { + type uint8 { + range "0 .. 100"; + } + units "percentage"; + description + "Adds an independent loss probability to the packets outgoing from the chosen network interface."; + } + + container corruption { + description + "Allows the emulation of random noise introducing an error in a random position for a chosen percent of packets."; + leaf percentage { + type uint8 { + range "0 .. 100"; + } + units "percentage"; + description + "Corruption percentage."; + } + + leaf correlation { + type uint8 { + range "0 .. 100"; + } + units "percentage"; + description + "Corruption correlation."; + } + } + + container duplication { + description + "Using this option the chosen percent of packets is duplicated before queuing them."; + leaf percentage { + type uint8 { + range "0 .. 100"; + } + units "percentage"; + description + "Duplication percentage."; + } + + leaf correlation { + type uint8 { + range "0 .. 100"; + } + units "percentage"; + description + "Duplication correlation."; + } + } + + container reordering { + description + "Used together with delay; a percentage of packets are sent immediately (with defined correlation) while the others are delayed (by specified delay)."; + leaf percentage { + type uint8 { + range "0 .. 100"; + } + units "percentage"; + description + "Reordering percentage."; + } + + leaf correlation { + type uint8 { + range "0 .. 100"; + } + units "percentage"; + description + "Reordering correlation."; + } + } + + leaf rate { + type uint16; + units "kbits"; + description + "Delay packets based on packet size."; + } + } + + container hardware-emulation { + description + "Container which encompasses the details of hardware emulation."; + container netconf-delay { + description + "Emulates delay on an operational leaf."; + leaf delay { + type uint32; + units "miliseconds (ms)"; + default "0"; + description + "Delay time to be set for get operation on test leaf."; + } + + leaf get-test { + type uint32; + units "miliseconds (ms)"; + config false; + description + "Read to test. Value represents emulated delay."; + } + + leaf edit-test { + type uint32; + units "miliseconds (ms)"; + description + "Writing non-null value will emulate a write-delay."; + } + + list get-test-list { + config false; + description + "Read to test. Returned values are saved from edit-test-list."; + leaf value { + type string; + description + "Values from edit-test-list."; + } + } + + list edit-test-list { + key "value"; + description + "Write to test."; + leaf value { + type string; + description + "Unique values for testing."; + } + } + } + } + + container sdn-controller { + description + "Groups details about the SDN Controller."; + uses ntsc:controller-g; + } + + container ves-endpoint { + description + "Groups details about the VES Collector endpoint."; + uses ntsc:ves-endpoint-g; + } + } + + rpc datastore-populate { + description + "Operation to populate the datastore with data for all the containing YANG models, based on settings in config.json"; + + output { + uses ntsc:rpc-status-g; + } + } + + rpc feature-control { + description + "Operation to control the features in a Network Function."; + input { + leaf start-features { + type ntsc:feature-type; + description + "A bit-wise list with features to be activated."; + } + + leaf stop-features { + type ntsc:feature-type; + description + "A bit-wise list with features to be deactivated."; + } + } + + output { + uses ntsc:rpc-status-g; + } + } + + rpc invoke-notification { + description + "Operation to control the features in a Network Function."; + input { + leaf notification-format { + type enumeration { + enum "xml" { + description + "The notification string is formatted as XML."; + } + enum "json" { + description + "The notification string is formatted as JSON."; + } + } + mandatory true; + description + "The format of the notification string."; + } + + leaf notification-object { + type string; + mandatory true; + description + "A JSON string containing the notification object to be sent by the device."; + } + } + + output { + uses ntsc:rpc-status-g; + } + } + + rpc invoke-ves-pm-file-ready { + description + "Operation to generate a VES notification from a Network Function."; + input { + leaf file-location { + type string; + mandatory true; + description + "A string containing the location of the file on the server."; + } + } + + output { + uses ntsc:rpc-status-g; + } + } + + rpc clear-fault-counters { + description + "Operation to clear the fault counters."; + + output { + uses ntsc:rpc-status-g; + } + } + + rpc emulate-total-loss { + description + "Operation to emulate 100% loss in network packets. Operation will resume after specified timeout."; + input { + leaf timeout { + type uint32; + units "miliseconds (ms)"; + description + "Period after which loss will stop being 100%."; + } + } + + output { + uses ntsc:rpc-status-g; + } + } +}
\ No newline at end of file diff --git a/sdnr/wt/devicemanager-onap/adapter-manager/provider/src/main/yang/nts-o-ran-fh-pac@2021-05-05.yang b/sdnr/wt/devicemanager-onap/adapter-manager/provider/src/main/yang/nts-o-ran-fh-pac@2021-05-05.yang new file mode 100644 index 000000000..84eee2f87 --- /dev/null +++ b/sdnr/wt/devicemanager-onap/adapter-manager/provider/src/main/yang/nts-o-ran-fh-pac@2021-05-05.yang @@ -0,0 +1,47 @@ +module nts-o-ran-fh-pac { + yang-version 1.1; + namespace "urn:o-ran-sc:params:xml:ns:yang:nts:o-ran-fh"; + prefix nts-o-ran-fh; + + import nts-common { + prefix ntsc; + } + + organization + "O-RAN-SC"; + contact + " Web: <https://wiki.o-ran-sc.org/display/SIM/SIM> + Editors: + Alex Stancu <mailto:alexandru.stancu@highstreet-technologies.com> + Adrian Lita <mailto:adrian.lita@highstreet-technologies.com> + Martin Skorupski <mailto:martin.skorupski@highstreet-technologies.com>"; + description + "This module contains YANG definitions for the Network Topology Simulator - O-RAN extensions."; + + revision 2021-05-05 { + description + "Changed name to o-ran-fh."; + reference + "O-RAN-FH implementation"; + } + revision 2020-11-30 { + description + "Cleared revision for nts-common import."; + reference + "O-RAN implementation"; + } + revision 2020-10-26 { + description + "Initial revision for the Network Topology Simulator - Next Generation"; + reference + "O-RAN implementation"; + } + + identity NTS_FUNCTION_TYPE_O_RAN_FH { + base ntsc:NTS_FUNCTION_TYPE_BASE; + description + "The simulated network function implements O-RAN FrontHaul (O1) YANG models."; + reference + "nts-ng-o-ran-fh"; + } +}
\ No newline at end of file diff --git a/sdnr/wt/devicemanager-onap/adapter-manager/provider/src/main/yang/nts-o-ran-o1-pac@2021-05-05.yang b/sdnr/wt/devicemanager-onap/adapter-manager/provider/src/main/yang/nts-o-ran-o1-pac@2021-05-05.yang new file mode 100644 index 000000000..85acd90e1 --- /dev/null +++ b/sdnr/wt/devicemanager-onap/adapter-manager/provider/src/main/yang/nts-o-ran-o1-pac@2021-05-05.yang @@ -0,0 +1,35 @@ +module nts-o-ran-o1-pac { + yang-version 1.1; + namespace "urn:o-ran-sc:params:xml:ns:yang:nts:o-ran-o1"; + prefix nts-o-ran-o1; + + import nts-common { + prefix ntsc; + } + + organization + "O-RAN-SC"; + contact + " Web: <https://wiki.o-ran-sc.org/display/SIM/SIM> + Editors: + Alex Stancu <mailto:alexandru.stancu@highstreet-technologies.com> + Adrian Lita <mailto:adrian.lita@highstreet-technologies.com> + Martin Skorupski <mailto:martin.skorupski@highstreet-technologies.com>"; + description + "This module contains YANG definitions for the Network Topology Simulator - O-RAN O1 interface."; + + revision 2021-05-05 { + description + "Initial revision for the Network Topology Simulator - Next Generation"; + reference + "O-RAN-O1 implementation"; + } + + identity NTS_FUNCTION_TYPE_O_RAN_O1 { + base ntsc:NTS_FUNCTION_TYPE_BASE; + description + "The simulated network function implements a O-RAN O1 interface YANG model."; + reference + "nts-ng-o-ran-o1"; + } +}
\ No newline at end of file diff --git a/sdnr/wt/devicemanager-onap/adapter-manager/provider/src/main/yang/nts-onf-pac@2020-11-30.yang b/sdnr/wt/devicemanager-onap/adapter-manager/provider/src/main/yang/nts-onf-pac@2020-11-30.yang new file mode 100644 index 000000000..96c103191 --- /dev/null +++ b/sdnr/wt/devicemanager-onap/adapter-manager/provider/src/main/yang/nts-onf-pac@2020-11-30.yang @@ -0,0 +1,49 @@ +module nts-onf-pac { + yang-version 1.1; + namespace "urn:o-ran-sc:params:xml:ns:yang:nts:onf"; + prefix nts-onf; + + import nts-common { + prefix ntsc; + } + + organization + "O-RAN-SC"; + contact + " Web: <https://wiki.o-ran-sc.org/display/SIM/SIM> + Editors: + Alex Stancu <mailto:alexandru.stancu@highstreet-technologies.com> + Adrian Lita <mailto:adrian.lita@highstreet-technologies.com> + Martin Skorupski <mailto:martin.skorupski@highstreet-technologies.com>"; + description + "This module contains YANG definitions for the Network Topology Simulator - ONF extensions."; + + revision 2020-11-30 { + description + "Cleared revision for nts-common import."; + reference + "ONF implementation"; + } + revision 2020-10-26 { + description + "Initial revision for the Network Topology Simulator - Next Generation"; + reference + "ONF implementation"; + } + + identity NTS_FUNCTION_TYPE_ONF_CORE_MODEL_1_2 { + base ntsc:NTS_FUNCTION_TYPE_BASE; + description + "The simulated network function implements ONF Core Model version 1.2 YANG models."; + reference + "nts-ng-onf-core-1-2"; + } + + identity NTS_FUNCTION_TYPE_ONF_CORE_MODEL_1_4 { + base ntsc:NTS_FUNCTION_TYPE_BASE; + description + "The simulated device implements ONF Core Model version 1.4 YANG models."; + reference + "nts-ng-onf-core-1-4"; + } +}
\ No newline at end of file diff --git a/sdnr/wt/devicemanager-onap/adapter-manager/provider/src/main/yang/nts-openroadm-pac@2020-11-30.yang b/sdnr/wt/devicemanager-onap/adapter-manager/provider/src/main/yang/nts-openroadm-pac@2020-11-30.yang new file mode 100644 index 000000000..185b1de72 --- /dev/null +++ b/sdnr/wt/devicemanager-onap/adapter-manager/provider/src/main/yang/nts-openroadm-pac@2020-11-30.yang @@ -0,0 +1,49 @@ +module nts-openroadm-pac { + yang-version 1.1; + namespace "urn:o-ran-sc:params:xml:ns:yang:nts:openroadm"; + prefix nts-openroadm; + + import nts-common { + prefix ntsc; + } + + organization + "O-RAN-SC"; + contact + " Web: <https://wiki.o-ran-sc.org/display/SIM/SIM> + Editors: + Alex Stancu <mailto:alexandru.stancu@highstreet-technologies.com> + Adrian Lita <mailto:adrian.lita@highstreet-technologies.com> + Martin Skorupski <mailto:martin.skorupski@highstreet-technologies.com>"; + description + "This module contains YANG definitions for the Network Topology Simulator - OpenROADM extensions."; + + revision 2020-11-30 { + description + "Cleared revision for nts-common import."; + reference + "OpenROADM implementation"; + } + revision 2020-10-26 { + description + "Initial revision for the Network Topology Simulator - Next Generation"; + reference + "OpenROADM implementation"; + } + + identity NTS_FUNCTION_TYPE_OPENROADM_2_2_1 { + base ntsc:NTS_FUNCTION_TYPE_BASE; + description + "The simulated device implements OpenROADM version 2.2.1 YANG models."; + reference + "nts-ng-openroadm-2.2.1"; + } + + identity NTS_FUNCTION_TYPE_OPENROADM_6_1_0 { + base ntsc:NTS_FUNCTION_TYPE_BASE; + description + "The simulated device implements OpenROADM version 6.1.0 YANG models."; + reference + "nts-ng-openroadm-6.1.0"; + } +}
\ No newline at end of file diff --git a/sdnr/wt/devicemanager-onap/adapter-manager/provider/src/main/yang/nts-x-ran-pac@2020-11-30.yang b/sdnr/wt/devicemanager-onap/adapter-manager/provider/src/main/yang/nts-x-ran-pac@2020-11-30.yang new file mode 100644 index 000000000..531d51fbe --- /dev/null +++ b/sdnr/wt/devicemanager-onap/adapter-manager/provider/src/main/yang/nts-x-ran-pac@2020-11-30.yang @@ -0,0 +1,41 @@ +module nts-x-ran-pac { + yang-version 1.1; + namespace "urn:o-ran-sc:params:xml:ns:yang:nts:x-ran"; + prefix nts-x-ran; + + import nts-common { + prefix ntsc; + } + + organization + "O-RAN-SC"; + contact + " Web: <https://wiki.o-ran-sc.org/display/SIM/SIM> + Editors: + Alex Stancu <mailto:alexandru.stancu@highstreet-technologies.com> + Adrian Lita <mailto:adrian.lita@highstreet-technologies.com> + Martin Skorupski <mailto:martin.skorupski@highstreet-technologies.com>"; + description + "This module contains YANG definitions for the Network Topology Simulator - X-RAN extensions."; + + revision 2020-11-30 { + description + "Cleared revision for nts-common import."; + reference + "X-RAN implementation"; + } + revision 2020-10-26 { + description + "Initial revision for the Network Topology Simulator - Next Generation"; + reference + "X-RAN implementation"; + } + + identity NTS_FUNCTION_TYPE_X_RAN { + base ntsc:NTS_FUNCTION_TYPE_BASE; + description + "The simulated device implements X-RAN YANG models."; + reference + "nts-ng-x-ran"; + } +}
\ No newline at end of file diff --git a/sdnr/wt/devicemanager-onap/adapter-manager/provider/src/main/yang/nts-yes-pac@2020-11-30.yang b/sdnr/wt/devicemanager-onap/adapter-manager/provider/src/main/yang/nts-yes-pac@2020-11-30.yang new file mode 100644 index 000000000..58b21e6fc --- /dev/null +++ b/sdnr/wt/devicemanager-onap/adapter-manager/provider/src/main/yang/nts-yes-pac@2020-11-30.yang @@ -0,0 +1,41 @@ +module nts-yes-pac { + yang-version 1.1; + namespace "urn:o-ran-sc:params:xml:ns:yang:nts:yes"; + prefix nts-yes; + + import nts-common { + prefix ntsc; + } + + organization + "O-RAN-SC"; + contact + " Web: <https://wiki.o-ran-sc.org/display/SIM/SIM> + Editors: + Alex Stancu <mailto:alexandru.stancu@highstreet-technologies.com> + Adrian Lita <mailto:adrian.lita@highstreet-technologies.com> + Martin Skorupski <mailto:martin.skorupski@highstreet-technologies.com>"; + description + "This module contains YANG definitions for the Network Topology Simulator - YES extensions."; + + revision 2020-11-30 { + description + "Cleared revision for nts-common import."; + reference + "YES implementation"; + } + revision 2020-10-26 { + description + "Initial revision for the Network Topology Simulator - Next Generation"; + reference + "YES implementation"; + } + + identity NTS_FUNCTION_TYPE_YES { + base ntsc:NTS_FUNCTION_TYPE_BASE; + description + "The simulated device implements YES YANG models."; + reference + "nts-ng-yes"; + } +}
\ No newline at end of file diff --git a/sdnr/wt/devicemanager-onap/adapter-manager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/adaptermanager/test/TestAdapterManagerNetworkElement.java b/sdnr/wt/devicemanager-onap/adapter-manager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/adaptermanager/test/TestAdapterManagerNetworkElement.java index d067d538f..5b4306093 100644 --- a/sdnr/wt/devicemanager-onap/adapter-manager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/adaptermanager/test/TestAdapterManagerNetworkElement.java +++ b/sdnr/wt/devicemanager-onap/adapter-manager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/adaptermanager/test/TestAdapterManagerNetworkElement.java @@ -33,7 +33,7 @@ import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServic import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.Capabilities; import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfBindingAccessor; import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.TransactionUtils; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.network.topology.simulator.rev191025.SimulatorStatus; +import org.opendaylight.yang.gen.v1.urn.o.ran.sc.params.xml.ns.yang.nts.manager.rev210608.simulation.NetworkFunctions; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId; import org.opendaylight.yangtools.yang.common.QName; @@ -55,6 +55,7 @@ public class TestAdapterManagerNetworkElement { when(accessor.getCapabilites()).thenReturn(capabilities); when(accessor.getNodeId()).thenReturn(nNodeId); when(accessor.getTransactionUtils()).thenReturn(mock(TransactionUtils.class)); + when(accessor.getNetconfBindingAccessor()).thenReturn(Optional.of(accessor)); DataProvider dataProvider = mock(DataProvider.class); when(serviceProvider.getDataProvider()).thenReturn(dataProvider); @@ -63,10 +64,10 @@ public class TestAdapterManagerNetworkElement { @Test public void test() { Optional<NetworkElement> adapterManagerNe; - when(accessor.getCapabilites().isSupportingNamespace(SimulatorStatus.QNAME)).thenReturn(true); + when(accessor.getCapabilites().isSupportingNamespaceAndRevision(NetworkFunctions.QNAME)).thenReturn(true); AdapterManagerNetworkElementFactory factory = new AdapterManagerNetworkElementFactory(); adapterManagerNe = factory.create(accessor, serviceProvider); - assertTrue(factory.create(accessor, serviceProvider).isPresent()); + assertTrue(adapterManagerNe.isPresent()); adapterManagerNe.get().register(); adapterManagerNe.get().deregister(); adapterManagerNe.get().getAcessor(); diff --git a/sdnr/wt/devicemanager-onap/adapter-manager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/adaptermanager/test/TestAdapterManagerNetworkElementFactory.java b/sdnr/wt/devicemanager-onap/adapter-manager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/adaptermanager/test/TestAdapterManagerNetworkElementFactory.java index fce5f6b88..9f67e188e 100644 --- a/sdnr/wt/devicemanager-onap/adapter-manager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/adaptermanager/test/TestAdapterManagerNetworkElementFactory.java +++ b/sdnr/wt/devicemanager-onap/adapter-manager/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/adaptermanager/test/TestAdapterManagerNetworkElementFactory.java @@ -17,10 +17,12 @@ */ package org.onap.ccsdk.features.sdnr.wt.devicemanager.adaptermanager.test; +import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; import java.io.IOException; +import java.util.Optional; import org.junit.After; import org.junit.BeforeClass; import org.junit.Test; @@ -28,7 +30,7 @@ import org.onap.ccsdk.features.sdnr.wt.devicemanager.adaptermanager.impl.Adapter import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServiceProvider; import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.Capabilities; import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfBindingAccessor; -import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.network.topology.simulator.rev191025.SimulatorStatus; +import org.opendaylight.yang.gen.v1.urn.o.ran.sc.params.xml.ns.yang.nts.manager.rev210608.simulation.NetworkFunctions; import org.opendaylight.yangtools.yang.common.QName; public class TestAdapterManagerNetworkElementFactory { @@ -45,23 +47,22 @@ public class TestAdapterManagerNetworkElementFactory { serviceProvider = mock(DeviceManagerServiceProvider.class); when(accessor.getCapabilites()).thenReturn(capabilities); + when(accessor.getNetconfBindingAccessor()).thenReturn(Optional.of(accessor)); when(serviceProvider.getDataProvider()).thenReturn(null); - - } @Test public void testCreateSimulator() throws Exception { - when(accessor.getCapabilites().isSupportingNamespace(SimulatorStatus.QNAME)).thenReturn(true); + when(accessor.getCapabilites().isSupportingNamespaceAndRevision(NetworkFunctions.QNAME)).thenReturn(true); AdapterManagerNetworkElementFactory factory = new AdapterManagerNetworkElementFactory(); assertTrue(factory.create(accessor, serviceProvider).isPresent()); } @Test public void testCreateNone() throws Exception { - when(accessor.getCapabilites().isSupportingNamespace(SimulatorStatus.QNAME)).thenReturn(false); + when(accessor.getCapabilites().isSupportingNamespaceAndRevision(NetworkFunctions.QNAME)).thenReturn(false); AdapterManagerNetworkElementFactory factory = new AdapterManagerNetworkElementFactory(); - assertTrue(!(factory.create(accessor, serviceProvider).isPresent())); + assertFalse(factory.create(accessor, serviceProvider).isPresent()); } @After diff --git a/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/Helper.java b/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/Helper.java index 98b55b3ae..6e5c1d5a1 100644 --- a/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/Helper.java +++ b/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/Helper.java @@ -19,9 +19,13 @@ package org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.ifpac.microwave; import org.eclipse.jdt.annotation.NonNull; import org.eclipse.jdt.annotation.Nullable; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.util.InconsistentPMDataException; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.util.PmUtil; import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.LayerProtocolName; import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.UniversalId; import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.g._874._1.model.rev170320.GranularityPeriodType; +import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.air._interface.historical.performance.type.g.PerformanceData; +import org.opendaylight.yangtools.yang.binding.DataObject; /** * @author herbert @@ -29,25 +33,33 @@ import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.g._874._1.model.r */ public class Helper { - private static final @NonNull UniversalId DEFAULT_UniversalId = new UniversalId("Default"); - private static final @NonNull LayerProtocolName DEFAULT_LayerProtocolName = new LayerProtocolName("default"); - private static final @NonNull GranularityPeriodType DEFAULT_GranularityPeriodType = GranularityPeriodType.Unknown; - private static final @NonNull String DEFAULT_String = ""; + private static final @NonNull UniversalId DEFAULT_UniversalId = new UniversalId("Default"); + private static final @NonNull LayerProtocolName DEFAULT_LayerProtocolName = new LayerProtocolName("default"); + private static final @NonNull GranularityPeriodType DEFAULT_GranularityPeriodType = GranularityPeriodType.Unknown; + private static final @NonNull String DEFAULT_String = ""; - public static @NonNull UniversalId nnGetUniversalId(@Nullable UniversalId x) { - return x == null ? DEFAULT_UniversalId : x; - } + public static @NonNull UniversalId nnGetUniversalId(@Nullable UniversalId x) { + return x == null ? DEFAULT_UniversalId : x; + } - public static @NonNull LayerProtocolName nnGetLayerProtocolName(@Nullable LayerProtocolName x) { - return x == null ? DEFAULT_LayerProtocolName : x; - } + public static @NonNull LayerProtocolName nnGetLayerProtocolName(@Nullable LayerProtocolName x) { + return x == null ? DEFAULT_LayerProtocolName : x; + } - public static @NonNull GranularityPeriodType nnGetGranularityPeriodType(@Nullable GranularityPeriodType x) { - return x == null ? DEFAULT_GranularityPeriodType : x; - } + public static @NonNull GranularityPeriodType nnGetGranularityPeriodType(@Nullable GranularityPeriodType x) { + return x == null ? DEFAULT_GranularityPeriodType : x; + } - public static @NonNull String nnGetString(@Nullable String x) { - return x == null ? DEFAULT_String : x; - } + public static @NonNull String nnGetString(@Nullable String x) { + return x == null ? DEFAULT_String : x; + } + + public static @NonNull <T extends DataObject> T throwIfPerformanceDataNull(T pmRecord, String uuidInterface, + String lpName) throws InconsistentPMDataException { + + String msg = new StringBuffer().append("Ignore record without PerformanceData. Node/Lp: ").append(uuidInterface).append("/") + .append(lpName).toString(); + return PmUtil.throwIfDataObjectNull(pmRecord, msg); + } } diff --git a/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/OnfMicrowaveModel.java b/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/OnfMicrowaveModel.java index 369dfd1d7..29eee1955 100644 --- a/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/OnfMicrowaveModel.java +++ b/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/OnfMicrowaveModel.java @@ -22,6 +22,7 @@ import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.notifications.Notificat import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.util.ONFLayerProtocolName; import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.FaultData; import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.PerformanceDataLtp; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.util.InconsistentPMDataException; import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.UniversalId; import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.logical.termination.point.g.Lp; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.EventlogEntity; @@ -47,7 +48,8 @@ public interface OnfMicrowaveModel { * @return the pm data object */ @NonNull - PerformanceDataLtp getLtpHistoricalPerformanceData(@NonNull ONFLayerProtocolName lpName, @NonNull Lp lp); + PerformanceDataLtp getLtpHistoricalPerformanceData(@NonNull ONFLayerProtocolName lpName, @NonNull Lp lp) + throws InconsistentPMDataException; /** Set notificationqueue worker for specific notification that needs to be forwarded **/ void setNotificationQueue(NotificationWorker<EventlogEntity> notificationQueue); diff --git a/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/WrapperMicrowaveModelRev170324.java b/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/WrapperMicrowaveModelRev170324.java index 9ed027658..553c0103b 100644 --- a/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/WrapperMicrowaveModelRev170324.java +++ b/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/WrapperMicrowaveModelRev170324.java @@ -33,6 +33,7 @@ import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.FaultService; import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.NotificationService; import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.FaultData; import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.PerformanceDataLtp; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.util.InconsistentPMDataException; import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfBindingAccessor; import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.TransactionUtils; import org.onap.ccsdk.features.sdnr.wt.websocketmanager.model.WebsocketManagerService; @@ -174,7 +175,7 @@ public class WrapperMicrowaveModelRev170324 implements OnfMicrowaveModel, Microw @Override public @NonNull PerformanceDataLtp getLtpHistoricalPerformanceData(@NonNull ONFLayerProtocolName lpName, - @NonNull Lp lp) { + @NonNull Lp lp) throws InconsistentPMDataException { PerformanceDataLtp res = new PerformanceDataLtp(); readAirInterfacePerformanceData(lp, res); readEthernetContainerPerformanceData(lp, res); @@ -491,8 +492,9 @@ public class WrapperMicrowaveModelRev170324 implements OnfMicrowaveModel, Microw * @param lp to read from * @param result Object to be filled with data * @return result + * @throws InconsistentPMDataException */ - private @NonNull PerformanceDataLtp readAirInterfacePerformanceData(Lp lp, PerformanceDataLtp result) { + private @NonNull PerformanceDataLtp readAirInterfacePerformanceData(Lp lp, PerformanceDataLtp result) throws InconsistentPMDataException { LOG.debug("DBRead Get {} MWAirInterfacePac: {}", acessor.getNodeId(), lp.getUuid()); // ---- @@ -537,7 +539,7 @@ public class WrapperMicrowaveModelRev170324 implements OnfMicrowaveModel, Microw } - private @NonNull PerformanceDataLtp readEthernetContainerPerformanceData(Lp lp, PerformanceDataLtp result) { + private @NonNull PerformanceDataLtp readEthernetContainerPerformanceData(Lp lp, PerformanceDataLtp result) throws InconsistentPMDataException { final String myName = "MWEthernetContainerPac"; String mountpointId = acessor.getNodeId().getValue(); diff --git a/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/WrapperMicrowaveModelRev180907.java b/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/WrapperMicrowaveModelRev180907.java index e564881c4..5ce91ed65 100644 --- a/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/WrapperMicrowaveModelRev180907.java +++ b/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/WrapperMicrowaveModelRev180907.java @@ -33,6 +33,7 @@ import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.FaultService; import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.NotificationService; import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.FaultData; import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.PerformanceDataLtp; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.util.InconsistentPMDataException; import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfBindingAccessor; import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.TransactionUtils; import org.onap.ccsdk.features.sdnr.wt.websocketmanager.model.WebsocketManagerService; @@ -180,7 +181,7 @@ public class WrapperMicrowaveModelRev180907 implements OnfMicrowaveModel, Microw @Override public @NonNull PerformanceDataLtp getLtpHistoricalPerformanceData(@NonNull ONFLayerProtocolName lpName, - @NonNull Lp lp) { + @NonNull Lp lp) throws InconsistentPMDataException { PerformanceDataLtp res = new PerformanceDataLtp(); switch (lpName) { case MWAIRINTERFACE: @@ -488,8 +489,9 @@ public class WrapperMicrowaveModelRev180907 implements OnfMicrowaveModel, Microw * @param lp to read from * @param result Object to be filled with data * @return result + * @throws InconsistentPMDataException */ - private @NonNull PerformanceDataLtp readAirInterfacePerformanceData(Lp lp, PerformanceDataLtp result) { + private @NonNull PerformanceDataLtp readAirInterfacePerformanceData(Lp lp, PerformanceDataLtp result) throws InconsistentPMDataException { LOG.debug("DBRead Get {} MWAirInterfacePac: {}", acessor.getNodeId(), lp.getUuid()); // ---- @@ -533,7 +535,7 @@ public class WrapperMicrowaveModelRev180907 implements OnfMicrowaveModel, Microw return result; } - private @NonNull PerformanceDataLtp readEthernetContainerPerformanceData(Lp lp, PerformanceDataLtp result) { + private @NonNull PerformanceDataLtp readEthernetContainerPerformanceData(Lp lp, PerformanceDataLtp result) throws InconsistentPMDataException { final String myName = "MWEthernetContainerPac"; LOG.debug("DBRead Get {} : {}", myName, lp.getUuid()); diff --git a/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/WrapperMicrowaveModelRev181010.java b/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/WrapperMicrowaveModelRev181010.java index 33349ef72..747ff96a9 100644 --- a/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/WrapperMicrowaveModelRev181010.java +++ b/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/WrapperMicrowaveModelRev181010.java @@ -33,6 +33,7 @@ import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.FaultService; import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.NotificationService; import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.FaultData; import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.PerformanceDataLtp; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.util.InconsistentPMDataException; import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfBindingAccessor; import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.TransactionUtils; import org.onap.ccsdk.features.sdnr.wt.websocketmanager.model.WebsocketManagerService; @@ -178,7 +179,7 @@ public class WrapperMicrowaveModelRev181010 implements OnfMicrowaveModel, Microw @Override public @NonNull PerformanceDataLtp getLtpHistoricalPerformanceData(@NonNull ONFLayerProtocolName lpName, - @NonNull Lp lp) { + @NonNull Lp lp) throws InconsistentPMDataException { PerformanceDataLtp res = new PerformanceDataLtp(); switch (lpName) { case MWAIRINTERFACE: @@ -256,10 +257,8 @@ public class WrapperMicrowaveModelRev181010 implements OnfMicrowaveModel, Microw LOG.debug("Got event of type :: {}", ProblemNotification.class.getSimpleName()); FaultlogEntity faultAlarm = new FaultlogBuilder().setObjectId(notification.getObjectIdRef().getValue()) .setProblem(notification.getProblem()).setSourceType(SourceType.Netconf) - .setTimestamp(notification.getTimeStamp()) - .setNodeId(this.acessor.getNodeId().getValue()) - .setSeverity(mapSeverity(notification.getSeverity())).setCounter(notification.getCounter()) - .build(); + .setTimestamp(notification.getTimeStamp()).setNodeId(this.acessor.getNodeId().getValue()) + .setSeverity(mapSeverity(notification.getSeverity())).setCounter(notification.getCounter()).build(); // Send devicemanager specific notification for database and ODLUX faultService.faultNotification(faultAlarm); // Send model specific notification to WebSocketManager @@ -503,8 +502,10 @@ public class WrapperMicrowaveModelRev181010 implements OnfMicrowaveModel, Microw * @param lp to read from * @param result Object to be filled with data * @return result + * @throws InconsistentPMDataException */ - private @NonNull PerformanceDataLtp readAirInterfacePerformanceData(Lp lp, PerformanceDataLtp result) { + private @NonNull PerformanceDataLtp readAirInterfacePerformanceData(Lp lp, PerformanceDataLtp result) + throws InconsistentPMDataException { LOG.debug("DBRead Get {} MWAirInterfacePac: {}", acessor.getNodeId(), lp.getUuid()); // ---- @@ -548,7 +549,8 @@ public class WrapperMicrowaveModelRev181010 implements OnfMicrowaveModel, Microw return result; } - private @NonNull PerformanceDataLtp readEthernetContainerPerformanceData(Lp lp, PerformanceDataLtp result) { + private @NonNull PerformanceDataLtp readEthernetContainerPerformanceData(Lp lp, PerformanceDataLtp result) + throws InconsistentPMDataException { final String myName = "MWEthernetContainerPac"; LOG.debug("DBRead Get {} : {}", mountpointId, myName, lp.getUuid()); diff --git a/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/pm/PerformanceDataAirInterface170324Builder.java b/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/pm/PerformanceDataAirInterface170324Builder.java index 27ec32c81..d5ca9c388 100644 --- a/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/pm/PerformanceDataAirInterface170324Builder.java +++ b/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/pm/PerformanceDataAirInterface170324Builder.java @@ -18,7 +18,11 @@ package org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.ifpac.microwave.pm; import java.util.Optional; + +import org.eclipse.jdt.annotation.NonNull; import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.ifpac.microwave.Helper; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.util.InconsistentPMDataException; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.util.PmUtil; import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.logical.termination.point.g.Lp; import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.g._874._1.model.rev170320.OtnHistoryDataG; import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.AirInterfaceHistoricalPerformanceTypeG; @@ -32,100 +36,103 @@ import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology. public class PerformanceDataAirInterface170324Builder extends PmdataEntityBuilder { - private PerformanceDataAirInterface170324Builder(NodeId nodeId, Lp lp, OtnHistoryDataG pmRecord) { - super(); - Optional<GranularityPeriodType> gp = GranularityPeriodType - .forName(Helper.nnGetGranularityPeriodType(pmRecord.getGranularityPeriod()).getName()); - this.setGranularityPeriod(gp.orElse(GranularityPeriodType.Unknown)); - this.setUuidInterface(Helper.nnGetUniversalId(lp.getUuid()).getValue()); - this.setLayerProtocolName(Helper.nnGetLayerProtocolName(lp.getLayerProtocolName()).getValue()); - this.setNodeName(nodeId.getValue()); - this.setScannerId(pmRecord.getHistoryDataId()); - this.setTimeStamp(pmRecord.getPeriodEndTime()); - this.setSuspectIntervalFlag(pmRecord.isSuspectIntervalFlag()); - } + private PerformanceDataAirInterface170324Builder(NodeId nodeId, Lp lp, OtnHistoryDataG pmRecord) { + super(); + Optional<GranularityPeriodType> gp = GranularityPeriodType + .forName(Helper.nnGetGranularityPeriodType(pmRecord.getGranularityPeriod()).getName()); + this.setGranularityPeriod(gp.orElse(GranularityPeriodType.Unknown)); + this.setUuidInterface(Helper.nnGetUniversalId(lp.getUuid()).getValue()); + this.setLayerProtocolName(Helper.nnGetLayerProtocolName(lp.getLayerProtocolName()).getValue()); + this.setNodeName(nodeId.getValue()); + this.setScannerId(pmRecord.getHistoryDataId()); + this.setTimeStamp(pmRecord.getPeriodEndTime()); + this.setSuspectIntervalFlag(pmRecord.isSuspectIntervalFlag()); + } + + /** + * Move data to generic type + * + * @param nodeId of node + * @param lp to get data from + * @param pmRecord data itself + * @param airConfiguration configuration for additional parameter + * @throws InconsistentPMDataException + */ + public PerformanceDataAirInterface170324Builder(NodeId nodeId, Lp lp, + AirInterfaceHistoricalPerformanceTypeG pmRecord, AirInterfaceConfiguration airConfiguration) + throws InconsistentPMDataException { + this(nodeId, lp, pmRecord); + + this.setRadioSignalId(airConfiguration.getRadioSignalId()); + @NonNull + PerformanceData pmr = Helper.throwIfPerformanceDataNull(pmRecord.getPerformanceData(), + getUuidInterface(), getLayerProtocolName()); - /** - * Move data to generic type - * - * @param nodeId of node - * @param lp to get data from - * @param pmRecord data itself - * @param airConfiguration configuration for additional parameter - */ - public PerformanceDataAirInterface170324Builder(NodeId nodeId, Lp lp, - AirInterfaceHistoricalPerformanceTypeG pmRecord, AirInterfaceConfiguration airConfiguration) { - this(nodeId, lp, pmRecord); + PerformanceDataBuilder bPerformanceData = new PerformanceDataBuilder(); + bPerformanceData.setTimePeriod(pmr.getTimePeriod()); + bPerformanceData.setEs(pmr.getEs()); + bPerformanceData.setSes(pmr.getSes()); + bPerformanceData.setCses(pmr.getCses()); + bPerformanceData.setUnavailability(pmr.getUnavailability()); + bPerformanceData.setTxLevelMin(pmr.getTxLevelMin()); + bPerformanceData.setTxLevelMax(pmr.getTxLevelMax()); + bPerformanceData.setTxLevelAvg(pmr.getTxLevelAvg()); + bPerformanceData.setRxLevelMin(pmr.getRxLevelMin()); + bPerformanceData.setRxLevelMax(pmr.getRxLevelMax()); + bPerformanceData.setRxLevelAvg(pmr.getRxLevelAvg()); + bPerformanceData.setTime2States(pmr.getTime2States()); + bPerformanceData.setTime4StatesS(pmr.getTime4StatesS()); + bPerformanceData.setTime4States(pmr.getTime4States()); + bPerformanceData.setTime8States(pmr.getTime8States()); + bPerformanceData.setTime16StatesS(pmr.getTime16StatesS()); + bPerformanceData.setTime16States(pmr.getTime16States()); + bPerformanceData.setTime32States(pmr.getTime32States()); + bPerformanceData.setTime64States(pmr.getTime64States()); + bPerformanceData.setTime128States(pmr.getTime128States()); + bPerformanceData.setTime256States(pmr.getTime256States()); + bPerformanceData.setTime512States(pmr.getTime512States()); + bPerformanceData.setTime512StatesL(pmr.getTime512StatesL()); + bPerformanceData.setTime1024States(pmr.getTime1024States()); + bPerformanceData.setTime1024StatesL(pmr.getTime1024StatesL()); + bPerformanceData.setTime2048States(pmr.getTime2048States()); + bPerformanceData.setTime2048StatesL(pmr.getTime2048StatesL()); + bPerformanceData.setTime4096States(pmr.getTime4096States()); + bPerformanceData.setTime4096StatesL(pmr.getTime4096StatesL()); + bPerformanceData.setTime8192States(pmr.getTime8192States()); + bPerformanceData.setTime8192StatesL(pmr.getTime8192StatesL()); + bPerformanceData.setSnirMin(pmr.getSnirMin()); + bPerformanceData.setSnirMax(pmr.getSnirMax()); + bPerformanceData.setSnirAvg(pmr.getSnirAvg()); + bPerformanceData.setXpdMin(pmr.getXpdMin()); + bPerformanceData.setXpdMax(pmr.getXpdMax()); + bPerformanceData.setXpdAvg(pmr.getXpdAvg()); + bPerformanceData.setRfTempMin(pmr.getRfTempMin()); + bPerformanceData.setRfTempMax(pmr.getRfTempMax()); + bPerformanceData.setRfTempAvg(pmr.getRfTempAvg()); + bPerformanceData.setDefectBlocksSum(pmr.getDefectBlocksSum()); + this.setPerformanceData(bPerformanceData.build()); + } - this.setRadioSignalId(airConfiguration.getRadioSignalId()); - PerformanceData pmr = pmRecord.getPerformanceData(); - if (pmr != null) { - PerformanceDataBuilder bPerformanceData = new PerformanceDataBuilder(); - bPerformanceData.setTimePeriod(pmr.getTimePeriod()); - bPerformanceData.setEs(pmr.getEs()); - bPerformanceData.setSes(pmr.getSes()); - bPerformanceData.setCses(pmr.getCses()); - bPerformanceData.setUnavailability(pmr.getUnavailability()); - bPerformanceData.setTxLevelMin(pmr.getTxLevelMin()); - bPerformanceData.setTxLevelMax(pmr.getTxLevelMax()); - bPerformanceData.setTxLevelAvg(pmr.getTxLevelAvg()); - bPerformanceData.setRxLevelMin(pmr.getRxLevelMin()); - bPerformanceData.setRxLevelMax(pmr.getRxLevelMax()); - bPerformanceData.setRxLevelAvg(pmr.getRxLevelAvg()); - bPerformanceData.setTime2States(pmr.getTime2States()); - bPerformanceData.setTime4StatesS(pmr.getTime4StatesS()); - bPerformanceData.setTime4States(pmr.getTime4States()); - bPerformanceData.setTime8States(pmr.getTime8States()); - bPerformanceData.setTime16StatesS(pmr.getTime16StatesS()); - bPerformanceData.setTime16States(pmr.getTime16States()); - bPerformanceData.setTime32States(pmr.getTime32States()); - bPerformanceData.setTime64States(pmr.getTime64States()); - bPerformanceData.setTime128States(pmr.getTime128States()); - bPerformanceData.setTime256States(pmr.getTime256States()); - bPerformanceData.setTime512States(pmr.getTime512States()); - bPerformanceData.setTime512StatesL(pmr.getTime512StatesL()); - bPerformanceData.setTime1024States(pmr.getTime1024States()); - bPerformanceData.setTime1024StatesL(pmr.getTime1024StatesL()); - bPerformanceData.setTime2048States(pmr.getTime2048States()); - bPerformanceData.setTime2048StatesL(pmr.getTime2048StatesL()); - bPerformanceData.setTime4096States(pmr.getTime4096States()); - bPerformanceData.setTime4096StatesL(pmr.getTime4096StatesL()); - bPerformanceData.setTime8192States(pmr.getTime8192States()); - bPerformanceData.setTime8192StatesL(pmr.getTime8192StatesL()); - bPerformanceData.setSnirMin(pmr.getSnirMin()); - bPerformanceData.setSnirMax(pmr.getSnirMax()); - bPerformanceData.setSnirAvg(pmr.getSnirAvg()); - bPerformanceData.setXpdMin(pmr.getXpdMin()); - bPerformanceData.setXpdMax(pmr.getXpdMax()); - bPerformanceData.setXpdAvg(pmr.getXpdAvg()); - bPerformanceData.setRfTempMin(pmr.getRfTempMin()); - bPerformanceData.setRfTempMax(pmr.getRfTempMax()); - bPerformanceData.setRfTempAvg(pmr.getRfTempAvg()); - bPerformanceData.setDefectBlocksSum(pmr.getDefectBlocksSum()); - this.setPerformanceData(bPerformanceData.build()); - } - } + /** + * Move data to generic type + * + * @param nodeId of node + * @param lp to get data from + * @param pmRecord data itself + * @throws InconsistentPMDataException + */ + public PerformanceDataAirInterface170324Builder(NodeId nodeId, Lp lp, ContainerHistoricalPerformanceTypeG pmRecord) + throws InconsistentPMDataException { + this(nodeId, lp, (OtnHistoryDataG) pmRecord); + org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.container.historical.performance.type.g.@NonNull PerformanceData pmr = Helper + .throwIfPerformanceDataNull(pmRecord.getPerformanceData(), getUuidInterface(), getLayerProtocolName()); - /** - * Move data to generic type - * - * @param nodeId of node - * @param lp to get data from - * @param pmRecord data itself - */ - public PerformanceDataAirInterface170324Builder(NodeId nodeId, Lp lp, - ContainerHistoricalPerformanceTypeG pmRecord) { - this(nodeId, lp, (OtnHistoryDataG) pmRecord); - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.container.historical.performance.type.g.PerformanceData pmr = - pmRecord.getPerformanceData(); - if (pmr != null) { - PerformanceDataBuilder bPerformanceData = new PerformanceDataBuilder(); - bPerformanceData.setTimePeriod(pmr.getTimePeriod()); - bPerformanceData.setTxEthernetBytesMaxM(pmr.getTxEthernetBytesMaxM()); - bPerformanceData.setTxEthernetBytesMaxS(pmr.getTxEthernetBytesMaxS()); - bPerformanceData.setTxEthernetBytesSum(pmr.getTxEthernetBytesSum()); - this.setPerformanceData(bPerformanceData.build()); - } - } + PerformanceDataBuilder bPerformanceData = new PerformanceDataBuilder(); + bPerformanceData.setTimePeriod(pmr.getTimePeriod()); + bPerformanceData.setTxEthernetBytesMaxM(pmr.getTxEthernetBytesMaxM()); + bPerformanceData.setTxEthernetBytesMaxS(pmr.getTxEthernetBytesMaxS()); + bPerformanceData.setTxEthernetBytesSum(pmr.getTxEthernetBytesSum()); + this.setPerformanceData(bPerformanceData.build()); + } } diff --git a/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/pm/PerformanceDataAirInterface180907Builder.java b/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/pm/PerformanceDataAirInterface180907Builder.java index f4023f932..275252f4d 100644 --- a/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/pm/PerformanceDataAirInterface180907Builder.java +++ b/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/pm/PerformanceDataAirInterface180907Builder.java @@ -18,7 +18,11 @@ package org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.ifpac.microwave.pm; import java.util.Optional; + +import org.eclipse.jdt.annotation.NonNull; import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.ifpac.microwave.Helper; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.util.InconsistentPMDataException; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.util.PmUtil; import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.logical.termination.point.g.Lp; import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.g._874._1.model.rev170320.OtnHistoryDataG; import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.AirInterfaceHistoricalPerformanceTypeG; @@ -32,100 +36,104 @@ import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology. public class PerformanceDataAirInterface180907Builder extends PmdataEntityBuilder { - private PerformanceDataAirInterface180907Builder(NodeId nodeId, Lp lp, OtnHistoryDataG pmRecord) { - super(); - Optional<GranularityPeriodType> gp = GranularityPeriodType - .forName(Helper.nnGetGranularityPeriodType(pmRecord.getGranularityPeriod()).getName()); - this.setGranularityPeriod(gp.orElse(GranularityPeriodType.Unknown)); - this.setUuidInterface(Helper.nnGetUniversalId(lp.getUuid()).getValue()); - this.setLayerProtocolName(Helper.nnGetLayerProtocolName(lp.getLayerProtocolName()).getValue()); - this.setNodeName(nodeId.getValue()); - this.setScannerId(pmRecord.getHistoryDataId()); - this.setTimeStamp(pmRecord.getPeriodEndTime()); - this.setSuspectIntervalFlag(pmRecord.isSuspectIntervalFlag()); - } + private PerformanceDataAirInterface180907Builder(NodeId nodeId, Lp lp, OtnHistoryDataG pmRecord) { + super(); + Optional<GranularityPeriodType> gp = GranularityPeriodType + .forName(Helper.nnGetGranularityPeriodType(pmRecord.getGranularityPeriod()).getName()); + this.setGranularityPeriod(gp.orElse(GranularityPeriodType.Unknown)); + this.setUuidInterface(Helper.nnGetUniversalId(lp.getUuid()).getValue()); + this.setLayerProtocolName(Helper.nnGetLayerProtocolName(lp.getLayerProtocolName()).getValue()); + this.setNodeName(nodeId.getValue()); + this.setScannerId(pmRecord.getHistoryDataId()); + this.setTimeStamp(pmRecord.getPeriodEndTime()); + this.setSuspectIntervalFlag(pmRecord.isSuspectIntervalFlag()); + } + + /** + * Move data to generic type + * + * @param nodeId of node + * @param lp to get data from + * @param pmRecord data itself + * @param airConfiguration configuration for additional parameter + * @throws InconsistentPMDataException + */ + public PerformanceDataAirInterface180907Builder(NodeId nodeId, Lp lp, + AirInterfaceHistoricalPerformanceTypeG pmRecord, AirInterfaceConfiguration airConfiguration) + throws InconsistentPMDataException { + this(nodeId, lp, pmRecord); + + this.setRadioSignalId(airConfiguration.getRadioSignalId()); + @NonNull + PerformanceData pmr = Helper.throwIfPerformanceDataNull(pmRecord.getPerformanceData(), + getUuidInterface(), getLayerProtocolName()); - /** - * Move data to generic type - * - * @param nodeId of node - * @param lp to get data from - * @param pmRecord data itself - * @param airConfiguration configuration for additional parameter - */ - public PerformanceDataAirInterface180907Builder(NodeId nodeId, Lp lp, - AirInterfaceHistoricalPerformanceTypeG pmRecord, AirInterfaceConfiguration airConfiguration) { - this(nodeId, lp, pmRecord); + PerformanceDataBuilder bPerformanceData = new PerformanceDataBuilder(); + bPerformanceData.setTimePeriod(pmr.getTimePeriod()); + bPerformanceData.setEs(pmr.getEs()); + bPerformanceData.setSes(pmr.getSes()); + bPerformanceData.setCses(pmr.getCses()); + bPerformanceData.setUnavailability(pmr.getUnavailability()); + bPerformanceData.setTxLevelMin(pmr.getTxLevelMin()); + bPerformanceData.setTxLevelMax(pmr.getTxLevelMax()); + bPerformanceData.setTxLevelAvg(pmr.getTxLevelAvg()); + bPerformanceData.setRxLevelMin(pmr.getRxLevelMin()); + bPerformanceData.setRxLevelMax(pmr.getRxLevelMax()); + bPerformanceData.setRxLevelAvg(pmr.getRxLevelAvg()); + bPerformanceData.setTime2States(pmr.getTime2States()); + bPerformanceData.setTime4StatesS(pmr.getTime4StatesS()); + bPerformanceData.setTime4States(pmr.getTime4States()); + bPerformanceData.setTime8States(pmr.getTime8States()); + bPerformanceData.setTime16StatesS(pmr.getTime16StatesS()); + bPerformanceData.setTime16States(pmr.getTime16States()); + bPerformanceData.setTime32States(pmr.getTime32States()); + bPerformanceData.setTime64States(pmr.getTime64States()); + bPerformanceData.setTime128States(pmr.getTime128States()); + bPerformanceData.setTime256States(pmr.getTime256States()); + bPerformanceData.setTime512States(pmr.getTime512States()); + bPerformanceData.setTime512StatesL(pmr.getTime512StatesL()); + bPerformanceData.setTime1024States(pmr.getTime1024States()); + bPerformanceData.setTime1024StatesL(pmr.getTime1024StatesL()); + bPerformanceData.setTime2048States(pmr.getTime2048States()); + bPerformanceData.setTime2048StatesL(pmr.getTime2048StatesL()); + bPerformanceData.setTime4096States(pmr.getTime4096States()); + bPerformanceData.setTime4096StatesL(pmr.getTime4096StatesL()); + bPerformanceData.setTime8192States(pmr.getTime8192States()); + bPerformanceData.setTime8192StatesL(pmr.getTime8192StatesL()); + bPerformanceData.setSnirMin(pmr.getSnirMin()); + bPerformanceData.setSnirMax(pmr.getSnirMax()); + bPerformanceData.setSnirAvg(pmr.getSnirAvg()); + bPerformanceData.setXpdMin(pmr.getXpdMin()); + bPerformanceData.setXpdMax(pmr.getXpdMax()); + bPerformanceData.setXpdAvg(pmr.getXpdAvg()); + bPerformanceData.setRfTempMin(pmr.getRfTempMin()); + bPerformanceData.setRfTempMax(pmr.getRfTempMax()); + bPerformanceData.setRfTempAvg(pmr.getRfTempAvg()); + bPerformanceData.setDefectBlocksSum(pmr.getDefectBlocksSum()); + this.setPerformanceData(bPerformanceData.build()); + } - this.setRadioSignalId(airConfiguration.getRadioSignalId()); - PerformanceData pmr = pmRecord.getPerformanceData(); - if (pmr != null) { - PerformanceDataBuilder bPerformanceData = new PerformanceDataBuilder(); - bPerformanceData.setTimePeriod(pmr.getTimePeriod()); - bPerformanceData.setEs(pmr.getEs()); - bPerformanceData.setSes(pmr.getSes()); - bPerformanceData.setCses(pmr.getCses()); - bPerformanceData.setUnavailability(pmr.getUnavailability()); - bPerformanceData.setTxLevelMin(pmr.getTxLevelMin()); - bPerformanceData.setTxLevelMax(pmr.getTxLevelMax()); - bPerformanceData.setTxLevelAvg(pmr.getTxLevelAvg()); - bPerformanceData.setRxLevelMin(pmr.getRxLevelMin()); - bPerformanceData.setRxLevelMax(pmr.getRxLevelMax()); - bPerformanceData.setRxLevelAvg(pmr.getRxLevelAvg()); - bPerformanceData.setTime2States(pmr.getTime2States()); - bPerformanceData.setTime4StatesS(pmr.getTime4StatesS()); - bPerformanceData.setTime4States(pmr.getTime4States()); - bPerformanceData.setTime8States(pmr.getTime8States()); - bPerformanceData.setTime16StatesS(pmr.getTime16StatesS()); - bPerformanceData.setTime16States(pmr.getTime16States()); - bPerformanceData.setTime32States(pmr.getTime32States()); - bPerformanceData.setTime64States(pmr.getTime64States()); - bPerformanceData.setTime128States(pmr.getTime128States()); - bPerformanceData.setTime256States(pmr.getTime256States()); - bPerformanceData.setTime512States(pmr.getTime512States()); - bPerformanceData.setTime512StatesL(pmr.getTime512StatesL()); - bPerformanceData.setTime1024States(pmr.getTime1024States()); - bPerformanceData.setTime1024StatesL(pmr.getTime1024StatesL()); - bPerformanceData.setTime2048States(pmr.getTime2048States()); - bPerformanceData.setTime2048StatesL(pmr.getTime2048StatesL()); - bPerformanceData.setTime4096States(pmr.getTime4096States()); - bPerformanceData.setTime4096StatesL(pmr.getTime4096StatesL()); - bPerformanceData.setTime8192States(pmr.getTime8192States()); - bPerformanceData.setTime8192StatesL(pmr.getTime8192StatesL()); - bPerformanceData.setSnirMin(pmr.getSnirMin()); - bPerformanceData.setSnirMax(pmr.getSnirMax()); - bPerformanceData.setSnirAvg(pmr.getSnirAvg()); - bPerformanceData.setXpdMin(pmr.getXpdMin()); - bPerformanceData.setXpdMax(pmr.getXpdMax()); - bPerformanceData.setXpdAvg(pmr.getXpdAvg()); - bPerformanceData.setRfTempMin(pmr.getRfTempMin()); - bPerformanceData.setRfTempMax(pmr.getRfTempMax()); - bPerformanceData.setRfTempAvg(pmr.getRfTempAvg()); - bPerformanceData.setDefectBlocksSum(pmr.getDefectBlocksSum()); - this.setPerformanceData(bPerformanceData.build()); - } - } + /** + * Move data to generic type + * + * @param nodeId of node + * @param lp to get data from + * @param pmRecord data itself + * @throws InconsistentPMDataException + */ + public PerformanceDataAirInterface180907Builder(NodeId nodeId, Lp lp, ContainerHistoricalPerformanceTypeG pmRecord) + throws InconsistentPMDataException { + this(nodeId, lp, (OtnHistoryDataG) pmRecord); + org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.container.historical.performance.type.g.@NonNull PerformanceData pmr = Helper + .throwIfPerformanceDataNull(pmRecord.getPerformanceData(), getUuidInterface(), + getLayerProtocolName()); - /** - * Move data to generic type - * - * @param nodeId of node - * @param lp to get data from - * @param pmRecord data itself - */ - public PerformanceDataAirInterface180907Builder(NodeId nodeId, Lp lp, - ContainerHistoricalPerformanceTypeG pmRecord) { - this(nodeId, lp, (OtnHistoryDataG) pmRecord); - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev180907.container.historical.performance.type.g.PerformanceData pmr = - pmRecord.getPerformanceData(); - if (pmr != null) { - PerformanceDataBuilder bPerformanceData = new PerformanceDataBuilder(); - bPerformanceData.setTimePeriod(pmr.getTimePeriod()); - bPerformanceData.setTxEthernetBytesMaxM(pmr.getTxEthernetBytesMaxM()); - bPerformanceData.setTxEthernetBytesMaxS(pmr.getTxEthernetBytesMaxS()); - bPerformanceData.setTxEthernetBytesSum(pmr.getTxEthernetBytesSum()); - this.setPerformanceData(bPerformanceData.build()); - } - } + PerformanceDataBuilder bPerformanceData = new PerformanceDataBuilder(); + bPerformanceData.setTimePeriod(pmr.getTimePeriod()); + bPerformanceData.setTxEthernetBytesMaxM(pmr.getTxEthernetBytesMaxM()); + bPerformanceData.setTxEthernetBytesMaxS(pmr.getTxEthernetBytesMaxS()); + bPerformanceData.setTxEthernetBytesSum(pmr.getTxEthernetBytesSum()); + this.setPerformanceData(bPerformanceData.build()); + } } diff --git a/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/pm/PerformanceDataAirInterface181010Builder.java b/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/pm/PerformanceDataAirInterface181010Builder.java index ccf4ed4c5..0c379b10e 100644 --- a/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/pm/PerformanceDataAirInterface181010Builder.java +++ b/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/pm/PerformanceDataAirInterface181010Builder.java @@ -18,7 +18,11 @@ package org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.ifpac.microwave.pm; import java.util.Optional; + +import org.eclipse.jdt.annotation.NonNull; import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.ifpac.microwave.Helper; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.util.InconsistentPMDataException; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.util.PmUtil; import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.logical.termination.point.g.Lp; import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.g._874._1.model.rev170320.OtnHistoryDataG; import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.AirInterfaceHistoricalPerformanceTypeG; @@ -32,100 +36,105 @@ import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology. public class PerformanceDataAirInterface181010Builder extends PmdataEntityBuilder { - private PerformanceDataAirInterface181010Builder(NodeId nodeId, Lp lp, OtnHistoryDataG pmRecord) { - super(); - Optional<GranularityPeriodType> gp = GranularityPeriodType - .forName(Helper.nnGetGranularityPeriodType(pmRecord.getGranularityPeriod()).getName()); - this.setGranularityPeriod(gp.orElse(GranularityPeriodType.Unknown)); - this.setUuidInterface(Helper.nnGetUniversalId(lp.getUuid()).getValue()); - this.setLayerProtocolName(Helper.nnGetLayerProtocolName(lp.getLayerProtocolName()).getValue()); - this.setNodeName(nodeId.getValue()); - this.setScannerId(pmRecord.getHistoryDataId()); - this.setTimeStamp(pmRecord.getPeriodEndTime()); - this.setSuspectIntervalFlag(pmRecord.isSuspectIntervalFlag()); - } + private PerformanceDataAirInterface181010Builder(NodeId nodeId, Lp lp, OtnHistoryDataG pmRecord) { + super(); + Optional<GranularityPeriodType> gp = GranularityPeriodType + .forName(Helper.nnGetGranularityPeriodType(pmRecord.getGranularityPeriod()).getName()); + this.setGranularityPeriod(gp.orElse(GranularityPeriodType.Unknown)); + this.setUuidInterface(Helper.nnGetUniversalId(lp.getUuid()).getValue()); + this.setLayerProtocolName(Helper.nnGetLayerProtocolName(lp.getLayerProtocolName()).getValue()); + this.setNodeName(nodeId.getValue()); + this.setScannerId(pmRecord.getHistoryDataId()); + this.setTimeStamp(pmRecord.getPeriodEndTime()); + this.setSuspectIntervalFlag(pmRecord.isSuspectIntervalFlag()); + } + + /** + * Move data to generic type + * + * @param nodeId of node + * @param lp to get data from + * @param pmRecord data itself + * @param airConfiguration configuration for additional parameter + * @throws InconsistentPMDataException + */ + public PerformanceDataAirInterface181010Builder(NodeId nodeId, Lp lp, + AirInterfaceHistoricalPerformanceTypeG pmRecord, AirInterfaceConfiguration airConfiguration) + throws InconsistentPMDataException { + + this(nodeId, lp, pmRecord); + + this.setRadioSignalId(airConfiguration.getRadioSignalId()); + @NonNull + PerformanceData pmr = Helper.throwIfPerformanceDataNull(pmRecord.getPerformanceData(), + getUuidInterface(), getLayerProtocolName()); - /** - * Move data to generic type - * - * @param nodeId of node - * @param lp to get data from - * @param pmRecord data itself - * @param airConfiguration configuration for additional parameter - */ - public PerformanceDataAirInterface181010Builder(NodeId nodeId, Lp lp, - AirInterfaceHistoricalPerformanceTypeG pmRecord, AirInterfaceConfiguration airConfiguration) { - this(nodeId, lp, pmRecord); + PerformanceDataBuilder bPerformanceData = new PerformanceDataBuilder(); + bPerformanceData.setTimePeriod(pmr.getTimePeriod()); + bPerformanceData.setEs(pmr.getEs()); + bPerformanceData.setSes(pmr.getSes()); + bPerformanceData.setCses(pmr.getCses()); + bPerformanceData.setUnavailability(pmr.getUnavailability()); + bPerformanceData.setTxLevelMin(pmr.getTxLevelMin()); + bPerformanceData.setTxLevelMax(pmr.getTxLevelMax()); + bPerformanceData.setTxLevelAvg(pmr.getTxLevelAvg()); + bPerformanceData.setRxLevelMin(pmr.getRxLevelMin()); + bPerformanceData.setRxLevelMax(pmr.getRxLevelMax()); + bPerformanceData.setRxLevelAvg(pmr.getRxLevelAvg()); + bPerformanceData.setTime2States(pmr.getTime2States()); + bPerformanceData.setTime4StatesS(pmr.getTime4StatesS()); + bPerformanceData.setTime4States(pmr.getTime4States()); + bPerformanceData.setTime8States(pmr.getTime8States()); + bPerformanceData.setTime16StatesS(pmr.getTime16StatesS()); + bPerformanceData.setTime16States(pmr.getTime16States()); + bPerformanceData.setTime32States(pmr.getTime32States()); + bPerformanceData.setTime64States(pmr.getTime64States()); + bPerformanceData.setTime128States(pmr.getTime128States()); + bPerformanceData.setTime256States(pmr.getTime256States()); + bPerformanceData.setTime512States(pmr.getTime512States()); + bPerformanceData.setTime512StatesL(pmr.getTime512StatesL()); + bPerformanceData.setTime1024States(pmr.getTime1024States()); + bPerformanceData.setTime1024StatesL(pmr.getTime1024StatesL()); + bPerformanceData.setTime2048States(pmr.getTime2048States()); + bPerformanceData.setTime2048StatesL(pmr.getTime2048StatesL()); + bPerformanceData.setTime4096States(pmr.getTime4096States()); + bPerformanceData.setTime4096StatesL(pmr.getTime4096StatesL()); + bPerformanceData.setTime8192States(pmr.getTime8192States()); + bPerformanceData.setTime8192StatesL(pmr.getTime8192StatesL()); + bPerformanceData.setSnirMin(pmr.getSnirMin()); + bPerformanceData.setSnirMax(pmr.getSnirMax()); + bPerformanceData.setSnirAvg(pmr.getSnirAvg()); + bPerformanceData.setXpdMin(pmr.getXpdMin()); + bPerformanceData.setXpdMax(pmr.getXpdMax()); + bPerformanceData.setXpdAvg(pmr.getXpdAvg()); + bPerformanceData.setRfTempMin(pmr.getRfTempMin()); + bPerformanceData.setRfTempMax(pmr.getRfTempMax()); + bPerformanceData.setRfTempAvg(pmr.getRfTempAvg()); + bPerformanceData.setDefectBlocksSum(pmr.getDefectBlocksSum()); + this.setPerformanceData(bPerformanceData.build()); + } - this.setRadioSignalId(airConfiguration.getRadioSignalId()); - PerformanceData pmr = pmRecord.getPerformanceData(); - if (pmr != null) { - PerformanceDataBuilder bPerformanceData = new PerformanceDataBuilder(); - bPerformanceData.setTimePeriod(pmr.getTimePeriod()); - bPerformanceData.setEs(pmr.getEs()); - bPerformanceData.setSes(pmr.getSes()); - bPerformanceData.setCses(pmr.getCses()); - bPerformanceData.setUnavailability(pmr.getUnavailability()); - bPerformanceData.setTxLevelMin(pmr.getTxLevelMin()); - bPerformanceData.setTxLevelMax(pmr.getTxLevelMax()); - bPerformanceData.setTxLevelAvg(pmr.getTxLevelAvg()); - bPerformanceData.setRxLevelMin(pmr.getRxLevelMin()); - bPerformanceData.setRxLevelMax(pmr.getRxLevelMax()); - bPerformanceData.setRxLevelAvg(pmr.getRxLevelAvg()); - bPerformanceData.setTime2States(pmr.getTime2States()); - bPerformanceData.setTime4StatesS(pmr.getTime4StatesS()); - bPerformanceData.setTime4States(pmr.getTime4States()); - bPerformanceData.setTime8States(pmr.getTime8States()); - bPerformanceData.setTime16StatesS(pmr.getTime16StatesS()); - bPerformanceData.setTime16States(pmr.getTime16States()); - bPerformanceData.setTime32States(pmr.getTime32States()); - bPerformanceData.setTime64States(pmr.getTime64States()); - bPerformanceData.setTime128States(pmr.getTime128States()); - bPerformanceData.setTime256States(pmr.getTime256States()); - bPerformanceData.setTime512States(pmr.getTime512States()); - bPerformanceData.setTime512StatesL(pmr.getTime512StatesL()); - bPerformanceData.setTime1024States(pmr.getTime1024States()); - bPerformanceData.setTime1024StatesL(pmr.getTime1024StatesL()); - bPerformanceData.setTime2048States(pmr.getTime2048States()); - bPerformanceData.setTime2048StatesL(pmr.getTime2048StatesL()); - bPerformanceData.setTime4096States(pmr.getTime4096States()); - bPerformanceData.setTime4096StatesL(pmr.getTime4096StatesL()); - bPerformanceData.setTime8192States(pmr.getTime8192States()); - bPerformanceData.setTime8192StatesL(pmr.getTime8192StatesL()); - bPerformanceData.setSnirMin(pmr.getSnirMin()); - bPerformanceData.setSnirMax(pmr.getSnirMax()); - bPerformanceData.setSnirAvg(pmr.getSnirAvg()); - bPerformanceData.setXpdMin(pmr.getXpdMin()); - bPerformanceData.setXpdMax(pmr.getXpdMax()); - bPerformanceData.setXpdAvg(pmr.getXpdAvg()); - bPerformanceData.setRfTempMin(pmr.getRfTempMin()); - bPerformanceData.setRfTempMax(pmr.getRfTempMax()); - bPerformanceData.setRfTempAvg(pmr.getRfTempAvg()); - bPerformanceData.setDefectBlocksSum(pmr.getDefectBlocksSum()); - this.setPerformanceData(bPerformanceData.build()); - } - } + /** + * Move data to generic type + * + * @param nodeId of node + * @param lp to get data from + * @param pmRecord data itself + * @throws InconsistentPMDataException + */ + public PerformanceDataAirInterface181010Builder(NodeId nodeId, Lp lp, ContainerHistoricalPerformanceTypeG pmRecord) + throws InconsistentPMDataException { + this(nodeId, lp, (OtnHistoryDataG) pmRecord); + org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.container.historical.performance.type.g.@NonNull PerformanceData pmr = Helper + .throwIfPerformanceDataNull(pmRecord.getPerformanceData(), getUuidInterface(), + getLayerProtocolName()); - /** - * Move data to generic type - * - * @param nodeId of node - * @param lp to get data from - * @param pmRecord data itself - */ - public PerformanceDataAirInterface181010Builder(NodeId nodeId, Lp lp, - ContainerHistoricalPerformanceTypeG pmRecord) { - this(nodeId, lp, (OtnHistoryDataG) pmRecord); - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.container.historical.performance.type.g.PerformanceData pmr = - pmRecord.getPerformanceData(); - if (pmr != null) { - PerformanceDataBuilder bPerformanceData = new PerformanceDataBuilder(); - bPerformanceData.setTimePeriod(pmr.getTimePeriod()); - bPerformanceData.setTxEthernetBytesMaxM(pmr.getTxEthernetBytesMaxM()); - bPerformanceData.setTxEthernetBytesMaxS(pmr.getTxEthernetBytesMaxS()); - bPerformanceData.setTxEthernetBytesSum(pmr.getTxEthernetBytesSum()); - this.setPerformanceData(bPerformanceData.build()); - } - } + PerformanceDataBuilder bPerformanceData = new PerformanceDataBuilder(); + bPerformanceData.setTimePeriod(pmr.getTimePeriod()); + bPerformanceData.setTxEthernetBytesMaxM(pmr.getTxEthernetBytesMaxM()); + bPerformanceData.setTxEthernetBytesMaxS(pmr.getTxEthernetBytesMaxS()); + bPerformanceData.setTxEthernetBytesSum(pmr.getTxEthernetBytesSum()); + this.setPerformanceData(bPerformanceData.build()); + } } diff --git a/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElement12Base.java b/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElement12Base.java index 0e1a448b5..8c593038b 100644 --- a/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElement12Base.java +++ b/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElement12Base.java @@ -38,6 +38,8 @@ import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServic import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.FaultData; import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.InventoryInformationDcae; import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.PerformanceDataLtp; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.util.InconsistentPMDataException; +import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfAccessor; import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfBindingAccessor; import org.opendaylight.mdsal.binding.api.MountPoint; import org.opendaylight.mdsal.common.api.LogicalDatastoreType; @@ -103,10 +105,11 @@ public abstract class ONFCoreNetworkElement12Base extends ONFCoreNetworkElementB * Constructor */ - protected ONFCoreNetworkElement12Base(@NonNull NetconfBindingAccessor acessor, @NonNull DeviceManagerServiceProvider serviceProvider) { + protected ONFCoreNetworkElement12Base(@NonNull NetconfBindingAccessor acessor, + @NonNull DeviceManagerServiceProvider serviceProvider) { super(acessor); this.optionalNe = Optional.empty(); - this.nodeId = getAcessor().get().getNodeId(); + this.nodeId = acessor.getNodeId(); this.isNetworkElementCurrentProblemsSupporting12 = acessor.getCapabilites().isSupportingNamespaceAndRevision(NetworkElementPac.QNAME); this.equipment = new ONFCoreNetworkElement12Equipment(acessor, this); @@ -158,7 +161,7 @@ public abstract class ONFCoreNetworkElement12Base extends ONFCoreNetworkElementB synchronized (pmLock) { boolean change = false; - if (!optionalNe.isPresent()) { + if (optionalNe.isEmpty()) { LOG.debug("Unable to read NE data for mountpoint {}", getMountpoint()); if (!interfaceList.isEmpty()) { interfaceList.clear(); @@ -169,8 +172,10 @@ public abstract class ONFCoreNetworkElement12Base extends ONFCoreNetworkElementB } else { NetworkElement ne = optionalNe.get(); Optional<Guicutthrough> oGuicutthrough = getGuicutthrough(ne); - if (oGuicutthrough.isPresent()) { - databaseService.writeGuiCutThroughData(oGuicutthrough.get(), getAcessor().get().getNodeId().getValue()); + Optional<NetconfAccessor> netconfAccessorOpt = getAcessor(); + if (oGuicutthrough.isPresent() && netconfAccessorOpt.isPresent()) { + databaseService.writeGuiCutThroughData(oGuicutthrough.get(), + netconfAccessorOpt.get().getNodeId().getValue()); } LOG.debug("Mountpoint '{}' NE-Name '{}'", getMountpoint(), ne.getName()); List<Lp> actualInterfaceList = getLtpList(ne); @@ -361,13 +366,11 @@ public abstract class ONFCoreNetworkElement12Base extends ONFCoreNetworkElementB List<String> uuids = new ArrayList<>(); LOG.debug("request inventory information. filter: {}" + layerProtocolFilter); - if (optionalNe != null) { - // uuids - for (Lp lp : this.interfaceList) { - if (layerProtocolFilter == null || layerProtocolFilter.isEmpty() || layerProtocolFilter - .equals(Helper.nnGetLayerProtocolName(lp.getLayerProtocolName()).getValue())) { - uuids.add(Helper.nnGetUniversalId(lp.getUuid()).getValue()); - } + // uuids + for (Lp lp : this.interfaceList) { + if (layerProtocolFilter == null || layerProtocolFilter.isEmpty() || layerProtocolFilter + .equals(Helper.nnGetLayerProtocolName(lp.getLayerProtocolName()).getValue())) { + uuids.add(Helper.nnGetUniversalId(lp.getUuid()).getValue()); } } LOG.debug("uuids found: {}", uuids); @@ -387,7 +390,6 @@ public abstract class ONFCoreNetworkElement12Base extends ONFCoreNetworkElementB LOG.debug("PM reset iterator"); } - @SuppressWarnings("null") @Override public boolean hasNext() { boolean res; @@ -398,7 +400,6 @@ public abstract class ONFCoreNetworkElement12Base extends ONFCoreNetworkElementB return res; } - @SuppressWarnings("null") @Override public void next() { synchronized (pmLock) { @@ -412,15 +413,22 @@ public abstract class ONFCoreNetworkElement12Base extends ONFCoreNetworkElementB } } - @SuppressWarnings("null") @Override public String pmStatusToString() { StringBuilder res = new StringBuilder(); synchronized (pmLock) { - res.append(pmLp == null ? "no interface" - : Helper.nnGetLayerProtocolName(pmLp.getLayerProtocolName()).getValue()); + if (pmLp == null) { + res.append("no interface"); + } else { + res.append("ActualLP="); + res.append(Helper.nnGetLayerProtocolName(pmLp.getLayerProtocolName()).getValue()); + } + res.append(" IFList="); + int no=0; for (Lp lp : getInterfaceList()) { - res.append("IF:"); + res.append("["); + res.append(no++); + res.append("]="); res.append(Helper.nnGetLayerProtocolName(lp.getLayerProtocolName()).getValue()); res.append(" "); } @@ -440,16 +448,17 @@ public abstract class ONFCoreNetworkElement12Base extends ONFCoreNetworkElementB } @Override - public Optional<PerformanceDataLtp> getLtpHistoricalPerformanceData() { + public Optional<PerformanceDataLtp> getLtpHistoricalPerformanceData() throws InconsistentPMDataException { return Optional.empty(); } //Guicutthrough - public Optional<Guicutthrough> getGuicutthrough(NetworkElement ne) { + private Optional<Guicutthrough> getGuicutthrough(NetworkElement ne) { Extension extension = ne.nonnullExtension().get(new ExtensionKey("webUri")); - if (extension != null) { + Optional<NetconfAccessor> netconfAccessorOpt = getAcessor(); + if (extension != null && netconfAccessorOpt.isPresent()) { GuicutthroughBuilder gcBuilder = new GuicutthroughBuilder(); - gcBuilder.setName(getAcessor().get().getNodeId().getValue()); + gcBuilder.setName(netconfAccessorOpt.get().getNodeId().getValue()); gcBuilder.setWeburi(extension.getValue()); return Optional.of(gcBuilder.build()); } else { diff --git a/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElement12Microwave.java b/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElement12Microwave.java index 736fd4742..766ebdd23 100644 --- a/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElement12Microwave.java +++ b/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElement12Microwave.java @@ -33,6 +33,7 @@ import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.EquipmentService; import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.FaultService; import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.FaultData; import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.PerformanceDataLtp; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.util.InconsistentPMDataException; import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfBindingAccessor; import org.opendaylight.mdsal.binding.api.MountPoint; import org.opendaylight.mdsal.binding.api.NotificationService; @@ -350,11 +351,10 @@ public class ONFCoreNetworkElement12Microwave extends ONFCoreNetworkElement12Bas } @Override - public Optional<PerformanceDataLtp> getLtpHistoricalPerformanceData() { + public Optional<PerformanceDataLtp> getLtpHistoricalPerformanceData() throws InconsistentPMDataException { synchronized (getPmLock()) { if (pmLp != null) { LOG.debug("Enter query PM"); - @SuppressWarnings("null") @NonNull Lp lp = pmLp; ONFLayerProtocolName lpName = ONFLayerProtocolName.valueOf(lp.getLayerProtocolName()); diff --git a/sdnr/wt/devicemanager-onap/onf12/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestWrapperMicrowaveModelRev170324.java b/sdnr/wt/devicemanager-onap/onf12/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestWrapperMicrowaveModelRev170324.java index 9135c38cb..4049a549d 100644 --- a/sdnr/wt/devicemanager-onap/onf12/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestWrapperMicrowaveModelRev170324.java +++ b/sdnr/wt/devicemanager-onap/onf12/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestWrapperMicrowaveModelRev170324.java @@ -29,6 +29,7 @@ import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.ifpac.microwave.Wrapper import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.util.ONFLayerProtocolName; import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServiceProvider; import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.FaultData; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.util.InconsistentPMDataException; import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfBindingAccessor; import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.TransactionUtils; import org.opendaylight.mdsal.binding.api.DataBroker; @@ -285,7 +286,7 @@ public class TestWrapperMicrowaveModelRev170324 { } @Test - public void testgetLtpHistoricalPerformanceData() { + public void testgetLtpHistoricalPerformanceData() throws InconsistentPMDataException { InstanceIdentifier<AirInterfaceConfiguration> mwAirInterfaceConfigurationIID = InstanceIdentifier.builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(uid)) .child(AirInterfaceConfiguration.class).build(); diff --git a/sdnr/wt/devicemanager-onap/onf12/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestWrapperMicrowaveModelRev180907.java b/sdnr/wt/devicemanager-onap/onf12/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestWrapperMicrowaveModelRev180907.java index bc4434f26..078890fd2 100644 --- a/sdnr/wt/devicemanager-onap/onf12/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestWrapperMicrowaveModelRev180907.java +++ b/sdnr/wt/devicemanager-onap/onf12/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestWrapperMicrowaveModelRev180907.java @@ -29,6 +29,7 @@ import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.ifpac.microwave.Wrapper import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.util.ONFLayerProtocolName; import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServiceProvider; import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.FaultData; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.util.InconsistentPMDataException; import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfBindingAccessor; import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.TransactionUtils; import org.opendaylight.mdsal.common.api.LogicalDatastoreType; @@ -281,7 +282,7 @@ public class TestWrapperMicrowaveModelRev180907 { } @Test - public void testgetLtpHistoricalPerformanceData() { + public void testgetLtpHistoricalPerformanceData() throws InconsistentPMDataException { InstanceIdentifier<AirInterfaceConfiguration> mwAirInterfaceConfigurationIID = InstanceIdentifier.builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(uid)) .child(AirInterfaceConfiguration.class).build(); diff --git a/sdnr/wt/devicemanager-onap/onf12/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestWrapperMicrowaveModelRev181010.java b/sdnr/wt/devicemanager-onap/onf12/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestWrapperMicrowaveModelRev181010.java index 3dfbdd2e0..51e9dae72 100644 --- a/sdnr/wt/devicemanager-onap/onf12/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestWrapperMicrowaveModelRev181010.java +++ b/sdnr/wt/devicemanager-onap/onf12/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestWrapperMicrowaveModelRev181010.java @@ -29,6 +29,7 @@ import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.ifpac.microwave.Wrapper import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.util.ONFLayerProtocolName; import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServiceProvider; import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.FaultData; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.util.InconsistentPMDataException; import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfBindingAccessor; import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.TransactionUtils; import org.opendaylight.mdsal.binding.api.DataBroker; @@ -286,7 +287,7 @@ public class TestWrapperMicrowaveModelRev181010 { } @Test - public void testgetLtpHistoricalPerformanceData() { + public void testgetLtpHistoricalPerformanceData() throws InconsistentPMDataException { InstanceIdentifier<AirInterfaceConfiguration> mwAirInterfaceConfigurationIID = InstanceIdentifier.builder(MwAirInterfacePac.class, new MwAirInterfacePacKey(uid)) .child(AirInterfaceConfiguration.class).build(); diff --git a/sdnr/wt/devicemanager-onap/onf12/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestWrapperNoPmData.java b/sdnr/wt/devicemanager-onap/onf12/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestWrapperNoPmData.java new file mode 100644 index 000000000..1cda8716d --- /dev/null +++ b/sdnr/wt/devicemanager-onap/onf12/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/test/TestWrapperNoPmData.java @@ -0,0 +1,56 @@ +/* + * ============LICENSE_START======================================================================== + * ONAP : ccsdk feature sdnr wt + * ================================================================================================= + * 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.onf.ifpac.microwave.test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertThrows; +import org.junit.Test; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.ifpac.microwave.pm.PerformanceDataAirInterface170324Builder; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.util.InconsistentPMDataException; +import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.UniversalId; +import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.logical.termination.point.g.Lp; +import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.logical.termination.point.g.LpBuilder; +import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.air._interface.historical.performances.g.HistoricalPerformanceDataList; +import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.air._interface.historical.performances.g.HistoricalPerformanceDataListBuilder; +import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.air._interface.historical.performance.type.g.PerformanceData; +import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.air._interface.historical.performance.type.g.PerformanceDataBuilder; +import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.air._interface.pac.AirInterfaceConfiguration; +import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.air._interface.pac.AirInterfaceConfigurationBuilder; +import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId; + +public class TestWrapperNoPmData { + + @Test + public void test() { + NodeId nodeId = new NodeId("TestNode"); + Lp lp = new LpBuilder().setUuid(new UniversalId("NodeUUID")).build(); + //Build empty, without PerformanceData + HistoricalPerformanceDataList pmRecord = + new HistoricalPerformanceDataListBuilder().setHistoryDataId("1").build(); + AirInterfaceConfiguration airConfiguration = new AirInterfaceConfigurationBuilder().build(); + + @SuppressWarnings("unused") + Exception exception = assertThrows(InconsistentPMDataException.class, () -> { + PerformanceDataAirInterface170324Builder pmdata = + new PerformanceDataAirInterface170324Builder(nodeId, lp, pmRecord, airConfiguration); + }); + String expectedMessage = "Ignore record without PerformanceData. Node/Lp: NodeUUID/default"; + String actualMessage = exception.getMessage(); + assertEquals(actualMessage,expectedMessage); + } +} |