diff options
46 files changed, 2440 insertions, 253 deletions
diff --git a/sdnr/wt/apigateway/provider/pom.xml b/sdnr/wt/apigateway/provider/pom.xml index d283f6e8b..3246ecb7a 100644 --- a/sdnr/wt/apigateway/provider/pom.xml +++ b/sdnr/wt/apigateway/provider/pom.xml @@ -22,6 +22,7 @@ ~ ============LICENSE_END======================================================= ~ --> + <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> @@ -45,8 +46,8 @@ <dependencies> <dependency> - <groupId>javax.servlet</groupId> - <artifactId>javax.servlet-api</artifactId> + <groupId>jakarta.servlet</groupId> + <artifactId>jakarta.servlet-api</artifactId> <scope>provided</scope> </dependency> <dependency> diff --git a/sdnr/wt/common-yang/ietf-alarms/pom.xml b/sdnr/wt/common-yang/ietf-alarms/pom.xml new file mode 100755 index 000000000..e2d432295 --- /dev/null +++ b/sdnr/wt/common-yang/ietf-alarms/pom.xml @@ -0,0 +1,47 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ~ ============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======================================================= + ~ + --> + +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.onap.ccsdk.parent</groupId> + <artifactId>binding-parent</artifactId> + <version>2.5.4-SNAPSHOT</version> + <relativePath/> + </parent> + + <groupId>org.onap.ccsdk.features.sdnr.wt</groupId> + <artifactId>ietf-alarms</artifactId> + <version>1.5.1-SNAPSHOT</version> + <packaging>bundle</packaging> + + <name>ccsdk-features :: ${project.artifactId}</name> + + <dependencies> + <dependency> + <groupId>org.opendaylight.mdsal.binding.model.ietf</groupId> + <artifactId>rfc6991-ietf-yang-types</artifactId> + </dependency> + </dependencies> +</project> diff --git a/sdnr/wt/common-yang/ietf-alarms/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/OperatorStateBuilder.java b/sdnr/wt/common-yang/ietf-alarms/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/OperatorStateBuilder.java new file mode 100644 index 000000000..7e8327a09 --- /dev/null +++ b/sdnr/wt/common-yang/ietf-alarms/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/OperatorStateBuilder.java @@ -0,0 +1,23 @@ +package org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.alarms.rev190911; +import java.lang.String; +import java.lang.UnsupportedOperationException; + +/** + * The purpose of generated class in src/main/java for Union types is to create new instances of unions from a string representation. + * In some cases it is very difficult to automate it since there can be unions such as (uint32 - uint16), or (string - uint32). + * + * The reason behind putting it under src/main/java is: + * This class is generated in form of a stub and needs to be finished by the user. This class is generated only once to prevent + * loss of user code. + * + */ +public class OperatorStateBuilder { + private OperatorStateBuilder() { + //Exists only to defeat instantiation. + } + + public static OperatorState getDefaultInstance(String defaultValue) { + throw new UnsupportedOperationException("Not yet implemented"); + } + +} diff --git a/sdnr/wt/common-yang/ietf-alarms/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/ResourceBuilder.java b/sdnr/wt/common-yang/ietf-alarms/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/ResourceBuilder.java new file mode 100644 index 000000000..7c4a63d2b --- /dev/null +++ b/sdnr/wt/common-yang/ietf-alarms/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/ResourceBuilder.java @@ -0,0 +1,23 @@ +package org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.alarms.rev190911; +import java.lang.String; +import java.lang.UnsupportedOperationException; + +/** + * The purpose of generated class in src/main/java for Union types is to create new instances of unions from a string representation. + * In some cases it is very difficult to automate it since there can be unions such as (uint32 - uint16), or (string - uint32). + * + * The reason behind putting it under src/main/java is: + * This class is generated in form of a stub and needs to be finished by the user. This class is generated only once to prevent + * loss of user code. + * + */ +public class ResourceBuilder { + private ResourceBuilder() { + //Exists only to defeat instantiation. + } + + public static Resource getDefaultInstance(String defaultValue) { + throw new UnsupportedOperationException("Not yet implemented"); + } + +} diff --git a/sdnr/wt/common-yang/ietf-alarms/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/ResourceMatchBuilder.java b/sdnr/wt/common-yang/ietf-alarms/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/ResourceMatchBuilder.java new file mode 100644 index 000000000..282a6a26d --- /dev/null +++ b/sdnr/wt/common-yang/ietf-alarms/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/ResourceMatchBuilder.java @@ -0,0 +1,23 @@ +package org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.alarms.rev190911; +import java.lang.String; +import java.lang.UnsupportedOperationException; + +/** + * The purpose of generated class in src/main/java for Union types is to create new instances of unions from a string representation. + * In some cases it is very difficult to automate it since there can be unions such as (uint32 - uint16), or (string - uint32). + * + * The reason behind putting it under src/main/java is: + * This class is generated in form of a stub and needs to be finished by the user. This class is generated only once to prevent + * loss of user code. + * + */ +public class ResourceMatchBuilder { + private ResourceMatchBuilder() { + //Exists only to defeat instantiation. + } + + public static ResourceMatch getDefaultInstance(String defaultValue) { + throw new UnsupportedOperationException("Not yet implemented"); + } + +} diff --git a/sdnr/wt/common-yang/ietf-alarms/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/SeverityWithClearBuilder.java b/sdnr/wt/common-yang/ietf-alarms/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/SeverityWithClearBuilder.java new file mode 100644 index 000000000..81391922d --- /dev/null +++ b/sdnr/wt/common-yang/ietf-alarms/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/SeverityWithClearBuilder.java @@ -0,0 +1,23 @@ +package org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.alarms.rev190911; +import java.lang.String; +import java.lang.UnsupportedOperationException; + +/** + * The purpose of generated class in src/main/java for Union types is to create new instances of unions from a string representation. + * In some cases it is very difficult to automate it since there can be unions such as (uint32 - uint16), or (string - uint32). + * + * The reason behind putting it under src/main/java is: + * This class is generated in form of a stub and needs to be finished by the user. This class is generated only once to prevent + * loss of user code. + * + */ +public class SeverityWithClearBuilder { + private SeverityWithClearBuilder() { + //Exists only to defeat instantiation. + } + + public static SeverityWithClear getDefaultInstance(String defaultValue) { + throw new UnsupportedOperationException("Not yet implemented"); + } + +} diff --git a/sdnr/wt/common-yang/ietf-alarms/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/alarms/ControlMaxAlarmStatusChangesBuilder.java b/sdnr/wt/common-yang/ietf-alarms/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/alarms/ControlMaxAlarmStatusChangesBuilder.java new file mode 100644 index 000000000..9f10ae87f --- /dev/null +++ b/sdnr/wt/common-yang/ietf-alarms/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/alarms/ControlMaxAlarmStatusChangesBuilder.java @@ -0,0 +1,23 @@ +package org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.alarms.rev190911.alarms; +import java.lang.String; +import java.lang.UnsupportedOperationException; + +/** + * The purpose of generated class in src/main/java for Union types is to create new instances of unions from a string representation. + * In some cases it is very difficult to automate it since there can be unions such as (uint32 - uint16), or (string - uint32). + * + * The reason behind putting it under src/main/java is: + * This class is generated in form of a stub and needs to be finished by the user. This class is generated only once to prevent + * loss of user code. + * + */ +public class ControlMaxAlarmStatusChangesBuilder { + private ControlMaxAlarmStatusChangesBuilder() { + //Exists only to defeat instantiation. + } + + public static Control.MaxAlarmStatusChanges getDefaultInstance(String defaultValue) { + throw new UnsupportedOperationException("Not yet implemented"); + } + +} diff --git a/sdnr/wt/common-yang/ietf-alarms/src/main/yang/ietf-alarms@2019-09-11.yang b/sdnr/wt/common-yang/ietf-alarms/src/main/yang/ietf-alarms@2019-09-11.yang new file mode 100644 index 000000000..a1c195faf --- /dev/null +++ b/sdnr/wt/common-yang/ietf-alarms/src/main/yang/ietf-alarms@2019-09-11.yang @@ -0,0 +1,1526 @@ +module ietf-alarms { + yang-version 1.1; + namespace "urn:ietf:params:xml:ns:yang:ietf-alarms"; + prefix al; + + import ietf-yang-types { + prefix yang; + reference + "RFC 6991: Common YANG Data Types."; + } + + organization + "IETF CCAMP Working Group"; + contact + "WG Web: <https://trac.ietf.org/trac/ccamp> + WG List: <mailto:ccamp@ietf.org> + + Editor: Stefan Vallin + <mailto:stefan@wallan.se> + + Editor: Martin Bjorklund + <mailto:mbj@tail-f.com>"; + description + "This module defines an interface for managing alarms. Main + inputs to the module design are the 3GPP Alarm Integration + Reference Point (IRP), ITU-T X.733, and ANSI/ISA-18.2 alarm + standards. + Main features of this module include: + + * Alarm list: + A list of all alarms. Cleared alarms stay in + the list until explicitly purged. + + * Operator actions on alarms: + Acknowledging and closing alarms. + + * Administrative actions on alarms: + Purging alarms from the list according to specific + criteria. + + * Alarm inventory: + A management application can read all + alarm types implemented by the system. + + * Alarm shelving: + Shelving (blocking) alarms according + to specific criteria. + + * Alarm profiles: + A management system can attach further + information to alarm types, for example, + overriding system-default severity + levels. + + This module uses a stateful view on alarms. An alarm is a state + for a specific resource (note that an alarm is not a + notification). An alarm type is a possible alarm state for a + resource. For example, the tuple: + + ('link-alarm', 'GigabitEthernet0/25') + + is an alarm of type 'link-alarm' on the resource + 'GigabitEthernet0/25'. + + Alarm types are identified using YANG identities and an optional + string-based qualifier. The string-based qualifier allows for + dynamic extension of the statically defined alarm types. Alarm + types identify a possible alarm state and not the individual + notifications. For example, the traditional 'link-down' and + 'link-up' notifications are two notifications referring to the + same alarm type 'link-alarm'. + + With this design, there is no ambiguity about how alarm and + alarm clear correlation should be performed; notifications that + report the same resource and alarm type are considered updates + of the same alarm, e.g., clearing an active alarm or changing + the severity of an alarm. The instrumentation can update the + severity and alarm text on an existing alarm. The above alarm + example can therefore look like the following: + + (('link-alarm', 'GigabitEthernet0/25'), + warning, + 'interface down while interface admin state is up') + + There is a clear separation between updates on the alarm from + the underlying resource, like clear, and updates from an + operator, like acknowledging or closing an alarm: + + (('link-alarm', 'GigabitEthernet0/25'), + warning, + 'interface down while interface admin state is up', + cleared, + closed) + + Administrative actions like removing closed alarms older than a + given time is supported. + + This YANG module does not define how the underlying + instrumentation detects and clears the specific alarms. That + belongs to the Standards Development Organization (SDO) or + enterprise that owns that specific technology. + + The key words 'MUST', 'MUST NOT', 'REQUIRED', 'SHALL', 'SHALL + NOT', 'SHOULD', 'SHOULD NOT', 'RECOMMENDED', 'NOT RECOMMENDED', + 'MAY', and 'OPTIONAL' in this document are to be interpreted as + described in BCP 14 (RFC 2119) (RFC 8174) when, and only when, + they appear in all capitals, as shown here. + + Copyright (c) 2019 IETF Trust and the persons identified as + authors of the code. All rights reserved. + + Redistribution and use in source and binary forms, with or + without modification, is permitted pursuant to, and subject to + the license terms contained in, the Simplified BSD License set + forth in Section 4.c of the IETF Trust's Legal Provisions + Relating to IETF Documents + (https://trustee.ietf.org/license-info). + + This version of this YANG module is part of RFC 8632; see + the RFC itself for full legal notices."; + + revision 2019-09-11 { + description + "Initial revision."; + reference + "RFC 8632: A YANG Data Model for Alarm Management"; + } + + /* + * Features + */ + + feature operator-actions { + description + "This feature indicates that the system supports operator + states on alarms."; + } + + feature alarm-shelving { + description + "This feature indicates that the system supports shelving + (blocking) alarms. + + Alarm shelving may have an impact on server processing + resources in order to match alarms against shelf + criteria."; + } + + feature alarm-history { + description + "This feature indicates that the server maintains a history + of state changes for each alarm. For example, if an alarm + toggles between cleared and active 10 times, these state + changes are present in a separate list in the alarm. + + Keeping the alarm history may have an impact on server + memory resources."; + } + + feature alarm-summary { + description + "This feature indicates that the server summarizes the number + of alarms per severity and operator state."; + } + + feature alarm-profile { + description + "The system enables clients to configure further information + to each alarm type."; + } + + feature severity-assignment { + description + "The system supports configurable alarm severity levels."; + reference + "ITU-T Recommendation M.3100: + Generic network information model + ITU-T Recommendation M.3160: + Generic, protocol-neutral management information model"; + } + + feature root-cause-analysis { + description + "The system supports identifying candidate root-cause + resources for an alarm, for example, a disk partition + root cause for a logger failure alarm."; + } + + feature service-impact-analysis { + description + "The system supports identifying candidate-impacted + resources for an alarm, for example, an interface state change + resulting in a link alarm, which can refer to a link as being + impacted."; + } + + feature alarm-correlation { + description + "The system supports correlating/grouping alarms + that belong together."; + } + + /* + * Identities + */ + + identity alarm-type-id { + description + "Base identity for alarm types. A unique identification of + the alarm, not including the resource. Different resources + can share alarm types. If the resource reports the same + alarm type, it is considered to be the same alarm. The alarm + type is a simplification of the different X.733 and 3GPP Alarm + IRP correlation mechanisms, and it allows for + hierarchical extensions. + + A string-based qualifier can be used in addition to the + identity in order to have different alarm types based on + information not known at design time, such as values in + textual SNMP Notification varbinds. + + Standards and vendors can define sub-identities to clearly + identify specific alarm types. + + This identity is abstract and MUST NOT be used for alarms."; + } + + /* + * Common types + */ + + typedef resource { + type union { + type instance-identifier { + require-instance false; + } + type yang:object-identifier; + type string; + type yang:uuid; + } + description + "This is an identification of the alarming resource, such as an + interface. It should be as fine-grained as possible to both + guide the operator and guarantee uniqueness of the alarms. + + If the alarming resource is modeled in YANG, this type will + be an instance-identifier. + + If the resource is an SNMP object, the type will be an + 'object-identifier'. + + If the resource is anything else, for example, a distinguished + name or a Common Information Model (CIM) path, this type will + be a string. + + If the alarming object is identified by a Universally Unique + Identifier (UUID), use the uuid type. Be cautious when using + this type, since a UUID is hard to use for an operator. + + If the server supports several models, the precedence should + be in the order as given in the union definition."; + } + + typedef resource-match { + type union { + type yang:xpath1.0; + type yang:object-identifier; + type string; + } + description + "This type is used to match resources of type 'resource'. + Since the type 'resource' is a union of different types, the + 'resource-match' type is also a union of corresponding types. + + If the type is given as an XPath 1.0 expression, a resource + of type 'instance-identifier' matches if the instance is part + of the node set that is the result of evaluating the XPath 1.0 + expression. For example, the XPath 1.0 expression: + + /ietf-interfaces:interfaces/ietf-interfaces:interface + [ietf-interfaces:type='ianaift:ethernetCsmacd'] + + would match the resource instance-identifier: + + /if:interfaces/if:interface[if:name='eth1'], + + assuming that the interface 'eth1' is of type + 'ianaift:ethernetCsmacd'. + + If the type is given as an object identifier, a resource of + type 'object-identifier' matches if the match object + identifier is a prefix of the resource's object identifier. + For example, the value: + + 1.3.6.1.2.1.2.2 + + would match the resource object identifier: + + 1.3.6.1.2.1.2.2.1.1.5 + + If the type is given as an UUID or a string, it is interpreted + as an XML Schema regular expression, which matches a resource + of type 'yang:uuid' or 'string' if the given regular + expression matches the resource string. + + If the type is given as an XPath expression, it is evaluated + in the following XPath context: + + o The set of namespace declarations is the set of prefix + and namespace pairs for all YANG modules implemented by + the server, where the prefix is the YANG module name and + the namespace is as defined by the 'namespace' statement + in the YANG module. + + If a leaf of this type is encoded in XML, all namespace + declarations in scope on the leaf element are added to + the set of namespace declarations. If a prefix found in + the XML is already present in the set of namespace + declarations, the namespace in the XML is used. + + o The set of variable bindings is empty. + + o The function library is the core function library, and + the functions are defined in Section 10 of RFC 7950. + + o The context node is the root node in the data tree."; + reference + "XML Schema Part 2: Datatypes Second Edition, + World Wide Web Consortium Recommendation + REC-xmlschema-2-20041028"; + } + + typedef alarm-text { + type string; + description + "The string used to inform operators about the alarm. This + MUST contain enough information for an operator to be able to + understand the problem and how to resolve it. If this string + contains structure, this format should be clearly documented + for programs to be able to parse that information."; + } + + typedef severity { + type enumeration { + enum indeterminate { + value 2; + description + "Indicates that the severity level could not be + determined. This level SHOULD be avoided."; + } + enum warning { + value 3; + description + "The 'warning' severity level indicates the detection of a + potential or impending service-affecting fault, before any + significant effects have been felt. Action should be + taken to further diagnose (if necessary) and correct the + problem in order to prevent it from becoming a more + serious service-affecting fault."; + } + enum minor { + value 4; + description + "The 'minor' severity level indicates the existence of a + non-service-affecting fault condition and that corrective + action should be taken in order to prevent a more serious + (for example, service-affecting) fault. Such a severity + can be reported, for example, when the detected alarm + condition is not currently degrading the capacity of the + resource."; + } + enum major { + value 5; + description + "The 'major' severity level indicates that a service- + affecting condition has developed and an urgent corrective + action is required. Such a severity can be reported, for + example, when there is a severe degradation in the + capability of the resource and its full capability must be + restored."; + } + enum critical { + value 6; + description + "The 'critical' severity level indicates that a service- + affecting condition has occurred and an immediate + corrective action is required. Such a severity can be + reported, for example, when a resource becomes totally out + of service and its capability must be restored."; + } + } + description + "The severity level of the alarm. Note well that the value + 'clear' is not included. Whether or not an alarm is cleared + is a separate boolean flag."; + reference + "ITU-T Recommendation X.733: Information Technology + - Open Systems Interconnection + - System Management: Alarm Reporting Function"; + } + + typedef severity-with-clear { + type union { + type enumeration { + enum cleared { + value 1; + description + "The alarm is cleared by the instrumentation."; + } + } + type severity; + } + description + "The severity level of the alarm including clear. This is used + only in notifications reporting state changes for an alarm."; + } + + typedef writable-operator-state { + type enumeration { + enum none { + value 1; + description + "The alarm is not being taken care of."; + } + enum ack { + value 2; + description + "The alarm is being taken care of. Corrective action not + taken yet or has failed"; + } + enum closed { + value 3; + description + "Corrective action taken successfully."; + } + } + description + "Operator states on an alarm. The 'closed' state indicates + that an operator considers the alarm being resolved. This is + separate from the alarm's 'is-cleared' leaf."; + } + + typedef operator-state { + type union { + type writable-operator-state; + type enumeration { + enum shelved { + value 4; + description + "The alarm is shelved. Alarms in /alarms/shelved-alarms/ + MUST be assigned this operator state by the server as + the last entry in the 'operator-state-change' list. The + text for that entry SHOULD include the shelf name."; + } + enum un-shelved { + value 5; + description + "The alarm is moved back to 'alarm-list' from a shelf. + Alarms that are moved from /alarms/shelved-alarms/ to + /alarms/alarm-list MUST be assigned this state by the + server as the last entry in the 'operator-state-change' + list. The text for that entry SHOULD include the shelf + name."; + } + } + } + description + "Operator states on an alarm. The 'closed' state indicates + that an operator considers the alarm being resolved. This is + separate from the alarm's 'is-cleared' leaf."; + } + + /* Alarm type */ + + typedef alarm-type-id { + type identityref { + base alarm-type-id; + } + description + "Identifies an alarm type. The description of the alarm type + id MUST indicate whether or not the alarm type is abstract. + An abstract alarm type is used as a base for other alarm type + ids and will not be used as a value for an alarm or be present + in the alarm inventory."; + } + + typedef alarm-type-qualifier { + type string; + description + "If an alarm type cannot be fully specified at design time by + 'alarm-type-id', this string qualifier is used in addition to + fully define a unique alarm type. + + The definition of alarm qualifiers is considered to be part of + the instrumentation and is out of scope for this module. An + empty string is used when this is part of a key."; + } + + /* + * Groupings + */ + + grouping common-alarm-parameters { + description + "Common parameters for an alarm. + + This grouping is used both in the alarm list and in the + notification representing an alarm-state change."; + leaf resource { + type resource; + mandatory true; + description + "The alarming resource. See also 'alt-resource'. This could + be, for example, a reference to the alarming interface"; + } + leaf alarm-type-id { + type alarm-type-id; + mandatory true; + description + "This leaf and the leaf 'alarm-type-qualifier' together + provide a unique identification of the alarm type."; + } + leaf alarm-type-qualifier { + type alarm-type-qualifier; + description + "This leaf is used when the 'alarm-type-id' leaf cannot + uniquely identify the alarm type. Normally, this is not the + case, and this leaf is the empty string."; + } + leaf-list alt-resource { + type resource; + description + "Used if the alarming resource is available over other + interfaces. This field can contain SNMP OIDs, CIM paths, or + 3GPP distinguished names, for example."; + } + list related-alarm { + if-feature "alarm-correlation"; + key "resource alarm-type-id alarm-type-qualifier"; + description + "References to related alarms. Note that the related alarm + might have been purged from the alarm list."; + leaf resource { + type leafref { + path "/alarms/alarm-list/alarm/resource"; + require-instance false; + } + description + "The alarming resource for the related alarm."; + } + leaf alarm-type-id { + type leafref { + path "/alarms/alarm-list/alarm" + + "[resource=current()/../resource]" + + "/alarm-type-id"; + require-instance false; + } + description + "The alarm type identifier for the related alarm."; + } + leaf alarm-type-qualifier { + type leafref { + path "/alarms/alarm-list/alarm" + + "[resource=current()/../resource]" + + "[alarm-type-id=current()/../alarm-type-id]" + + "/alarm-type-qualifier"; + require-instance false; + } + description + "The alarm qualifier for the related alarm."; + } + } + leaf-list impacted-resource { + if-feature "service-impact-analysis"; + type resource; + description + "Resources that might be affected by this alarm. If the + system creates an alarm on a resource and also has a mapping + to other resources that might be impacted, these resources + can be listed in this leaf-list. In this way, the system + can create one alarm instead of several. For example, if an + interface has an alarm, the 'impacted-resource' can + reference the aggregated port channels."; + } + leaf-list root-cause-resource { + if-feature "root-cause-analysis"; + type resource; + description + "Resources that are candidates for causing the alarm. If the + system has a mechanism to understand the candidate root + causes of an alarm, this leaf-list can be used to list the + root-cause candidate resources. In this way, the system can + create one alarm instead of several. An example might be a + logging system (alarm resource) that fails; the alarm can + reference the file system in the 'root-cause-resource' + leaf-list. Note that the intended use is not to also send + an alarm with the 'root-cause-resource' as an alarming + resource. The 'root-cause-resource' leaf-list is a hint and + should not also generate an alarm for the same problem."; + } + } + + grouping alarm-state-change-parameters { + description + "Parameters for an alarm-state change. + + This grouping is used both in the alarm list's status-change + list and in the notification representing an alarm-state + change."; + leaf time { + type yang:date-and-time; + mandatory true; + description + "The time the status of the alarm changed. The value + represents the time the real alarm-state change appeared in + the resource and not when it was added to the alarm + list. The /alarm-list/alarm/last-changed MUST be set to the + same value."; + } + leaf perceived-severity { + type severity-with-clear; + mandatory true; + description + "The severity of the alarm as defined by X.733. Note that + this may not be the original severity since the alarm may + have changed severity."; + reference + "ITU-T Recommendation X.733: Information Technology + - Open Systems Interconnection + - System Management: Alarm Reporting Function"; + } + leaf alarm-text { + type alarm-text; + mandatory true; + description + "A user-friendly text describing the alarm-state change."; + reference + "ITU-T Recommendation X.733: Information Technology + - Open Systems Interconnection + - System Management: Alarm Reporting Function"; + } + } + + grouping operator-parameters { + description + "This grouping defines parameters that can be changed by an + operator."; + leaf time { + type yang:date-and-time; + mandatory true; + description + "Timestamp for operator action on the alarm."; + } + leaf operator { + type string; + mandatory true; + description + "The name of the operator that has acted on this alarm."; + } + leaf state { + type operator-state; + mandatory true; + description + "The operator's view of the alarm state."; + } + leaf text { + type string; + description + "Additional optional textual information provided by the + operator."; + } + } + + grouping resource-alarm-parameters { + description + "Alarm parameters that originate from the resource view."; + leaf is-cleared { + type boolean; + mandatory true; + description + "Indicates the current clearance state of the alarm. An + alarm might toggle from active alarm to cleared alarm and + back to active again."; + } + leaf last-raised { + type yang:date-and-time; + mandatory true; + description + "An alarm may change severity level and toggle between + active and cleared during its lifetime. This leaf indicates + the last time it was raised ('is-cleared' = 'false')."; + } + leaf last-changed { + type yang:date-and-time; + mandatory true; + description + "A timestamp when the 'status-change' or + 'operator-state-change' list was last changed."; + } + leaf perceived-severity { + type severity; + mandatory true; + description + "The last severity of the alarm. + + If an alarm was raised with severity 'warning' but later + changed to 'major', this leaf will show 'major'."; + } + leaf alarm-text { + type alarm-text; + mandatory true; + description + "The last reported alarm text. This text should contain + information for an operator to be able to understand the + problem and how to resolve it."; + } + list status-change { + if-feature "alarm-history"; + key "time"; + min-elements 1; + description + "A list of status-change events for this alarm. + + The entry with latest timestamp in this list MUST + correspond to the leafs 'is-cleared', 'perceived-severity', + and 'alarm-text' for the alarm. + + This list is ordered according to the timestamps of alarm + state changes. The first item corresponds to the latest + state change. + + The following state changes create an entry in this + list: + - changed severity (warning, minor, major, critical) + - clearance status; this also updates the 'is-cleared' + leaf + - alarm-text update"; + uses alarm-state-change-parameters; + } + } + + grouping filter-input { + description + "Grouping to specify a filter construct on alarm information."; + leaf alarm-clearance-status { + type enumeration { + enum any { + description + "Ignore alarm-clearance status."; + } + enum cleared { + description + "Filter cleared alarms."; + } + enum not-cleared { + description + "Filter not-cleared alarms."; + } + } + mandatory true; + description + "The clearance status of the alarm."; + } + container older-than { + presence "Age specification"; + description + "Matches the 'last-status-change' leaf in the alarm."; + choice age-spec { + description + "Filter using date and time age."; + case seconds { + leaf seconds { + type uint16; + description + "Age expressed in seconds."; + } + } + case minutes { + leaf minutes { + type uint16; + description + "Age expressed in minutes."; + } + } + case hours { + leaf hours { + type uint16; + description + "Age expressed in hours."; + } + } + case days { + leaf days { + type uint16; + description + "Age expressed in days."; + } + } + case weeks { + leaf weeks { + type uint16; + description + "Age expressed in weeks."; + } + } + } + } + container severity { + presence "Severity filter"; + choice sev-spec { + description + "Filter based on severity level."; + leaf below { + type severity; + description + "Severity less than this leaf."; + } + leaf is { + type severity; + description + "Severity level equal to this leaf."; + } + leaf above { + type severity; + description + "Severity level higher than this leaf."; + } + } + description + "Filter based on severity."; + } + container operator-state-filter { + if-feature "operator-actions"; + presence "Operator state filter"; + leaf state { + type operator-state; + description + "Filter on operator state."; + } + leaf user { + type string; + description + "Filter based on which operator."; + } + description + "Filter based on operator state."; + } + } + + /* + * The /alarms data tree + */ + + container alarms { + description + "The top container for this module."; + container control { + description + "Configuration to control the alarm behavior."; + leaf max-alarm-status-changes { + type union { + type uint16; + type enumeration { + enum infinite { + description + "The status-change entries are accumulated + infinitely."; + } + } + } + default "32"; + description + "The 'status-change' entries are kept in a circular list + per alarm. When this number is exceeded, the oldest + status change entry is automatically removed. If the + value is 'infinite', the status-change entries are + accumulated infinitely."; + } + leaf notify-status-changes { + type enumeration { + enum all-state-changes { + description + "Send notifications for all status changes."; + } + enum raise-and-clear { + description + "Send notifications only for raise, clear, and + re-raise. Notifications for severity-level changes or + alarm-text changes are not sent."; + } + enum severity-level { + description + "Only send notifications for alarm-state changes + crossing the level specified in + 'notify-severity-level'. Always send clear + notifications."; + } + } + must '. != "severity-level" or ../notify-severity-level' { + description + "When notify-status-changes is 'severity-level', a value + must be given for 'notify-severity-level'."; + } + default "all-state-changes"; + description + "This leaf controls the notifications sent for alarm status + updates. There are three options: + + 1. Notifications are sent for all updates, severity-level + changes, and alarm-text changes. + + 2. Notifications are only sent for alarm raise and clear. + + 3. Notifications are sent for status changes equal to or + above the specified severity level. Clear + notifications shall always be sent. Notifications + shall also be sent for state changes that make an + alarm less severe than the specified level. + + For example, in option 3, assume that the severity level + is set to major and that the alarm has the following state + changes: + + [(Time, severity, clear)]: + [(T1, major, -), (T2, minor, -), (T3, warning, -), + (T4, minor, -), (T5, major, -), (T6, critical, -), + (T7, major. -), (T8, major, clear)] + + In that case, notifications will be sent at times + T1, T2, T5, T6, T7, and T8."; + } + leaf notify-severity-level { + when '../notify-status-changes = "severity-level"'; + type severity; + description + "Only send notifications for alarm-state changes crossing + the specified level. Always send clear notifications."; + } + container alarm-shelving { + if-feature "alarm-shelving"; + description + "The 'alarm-shelving/shelf' list is used to shelve + (block/filter) alarms. The conditions in the shelf + criteria are logically ANDed. The first matching shelf is + used, and an alarm is shelved only for this first match. + Matching alarms MUST appear in the + /alarms/shelved-alarms/shelved-alarm list, and + non-matching /alarms MUST appear in the + /alarms/alarm-list/alarm list. The server does not send + any notifications for shelved alarms. + + The server MUST maintain states (e.g., severity + changes) for the shelved alarms. + + Alarms that match the criteria shall have an + operator state 'shelved'. When the shelf + configuration removes an alarm from the shelf, the server + shall add the operator state 'un-shelved'."; + list shelf { + key "name"; + ordered-by user; + leaf name { + type string; + description + "An arbitrary name for the alarm shelf."; + } + description + "Each entry defines the criteria for shelving alarms. + Criteria are ANDed. If no criteria are specified, + all alarms will be shelved."; + leaf-list resource { + type resource-match; + description + "Shelve alarms for matching resources."; + } + list alarm-type { + key "alarm-type-id alarm-type-qualifier-match"; + description + "Any alarm matching the combined criteria of + 'alarm-type-id' and 'alarm-type-qualifier-match' + MUST be matched."; + leaf alarm-type-id { + type alarm-type-id; + description + "Shelve all alarms that have an 'alarm-type-id' that + is equal to or derived from the given + 'alarm-type-id'."; + } + leaf alarm-type-qualifier-match { + type string; + description + "An XML Schema regular expression that is used to + match an alarm type qualifier. Shelve all alarms + that match this regular expression for the alarm + type qualifier."; + reference + "XML Schema Part 2: Datatypes Second Edition, + World Wide Web Consortium Recommendation + REC-xmlschema-2-20041028"; + } + } + leaf description { + type string; + description + "An optional textual description of the shelf. This + description should include the reason for shelving + these alarms."; + } + } + } + } + container alarm-inventory { + config false; + description + "The 'alarm-inventory/alarm-type' list contains all possible + alarm types for the system. + + If the system knows for which resources a specific alarm + type can appear, it is also identified in the inventory. + The list also tells if each alarm type has a corresponding + clear state. The inventory shall only contain concrete + alarm types. + + The alarm inventory MUST be updated by the system when new + alarms can appear. This can be the case when installing new + software modules or inserting new card types. A + notification 'alarm-inventory-changed' is sent when the + inventory is changed."; + list alarm-type { + key "alarm-type-id alarm-type-qualifier"; + description + "An entry in this list defines a possible alarm."; + leaf alarm-type-id { + type alarm-type-id; + description + "The statically defined alarm type identifier for this + possible alarm."; + } + leaf alarm-type-qualifier { + type alarm-type-qualifier; + description + "The optionally dynamically defined alarm type identifier + for this possible alarm."; + } + leaf-list resource { + type resource-match; + description + "Optionally, specifies for which resources the alarm type + is valid."; + } + leaf will-clear { + type boolean; + mandatory true; + description + "This leaf tells the operator if the alarm will be + cleared when the correct corrective action has been + taken. Implementations SHOULD strive for detecting the + cleared state for all alarm types. + + If this leaf is 'true', the operator can monitor the + alarm until it becomes cleared after the corrective + action has been taken. + + If this leaf is 'false', the operator needs to validate + that the alarm is no longer active using other + mechanisms. Alarms can lack a corresponding clear due + to missing instrumentation or no logical + corresponding clear state."; + } + leaf-list severity-level { + type severity; + description + "This leaf-list indicates the possible severity levels of + this alarm type. Note well that 'clear' is not part of + the severity type. In general, the severity level + should be defined by the instrumentation based on the + dynamic state, rather than being defined statically by + the alarm type, in order to provide a relevant severity + level based on dynamic state and context. However, most + alarm types have a defined set of possible severity + levels, and this should be provided here."; + } + leaf description { + type string; + mandatory true; + description + "A description of the possible alarm. It SHOULD include + information on possible underlying root causes and + corrective actions."; + } + } + } + container summary { + if-feature "alarm-summary"; + config false; + description + "This container gives a summary of the number of alarms."; + list alarm-summary { + key "severity"; + description + "A global summary of all alarms in the system. The summary + does not include shelved alarms."; + leaf severity { + type severity; + description + "Alarm summary for this severity level."; + } + leaf total { + type yang:gauge32; + description + "Total number of alarms of this severity level."; + } + leaf not-cleared { + type yang:gauge32; + description + "Total number of alarms of this severity level + that are not cleared."; + } + leaf cleared { + type yang:gauge32; + description + "For this severity level, the number of alarms that are + cleared."; + } + leaf cleared-not-closed { + if-feature "operator-actions"; + type yang:gauge32; + description + "For this severity level, the number of alarms that are + cleared but not closed."; + } + leaf cleared-closed { + if-feature "operator-actions"; + type yang:gauge32; + description + "For this severity level, the number of alarms that are + cleared and closed."; + } + leaf not-cleared-closed { + if-feature "operator-actions"; + type yang:gauge32; + description + "For this severity level, the number of alarms that are + not cleared but closed."; + } + leaf not-cleared-not-closed { + if-feature "operator-actions"; + type yang:gauge32; + description + "For this severity level, the number of alarms that are + not cleared and not closed."; + } + } + leaf shelves-active { + if-feature "alarm-shelving"; + type empty; + description + "This is a hint to the operator that there are active + alarm shelves. This leaf MUST exist if the + /alarms/shelved-alarms/number-of-shelved-alarms is > 0."; + } + } + container alarm-list { + config false; + description + "The alarms in the system."; + leaf number-of-alarms { + type yang:gauge32; + description + "This object shows the total number of + alarms in the system, i.e., the total number + of entries in the alarm list."; + } + leaf last-changed { + type yang:date-and-time; + description + "A timestamp when the alarm list was last + changed. The value can be used by a manager to + initiate an alarm resynchronization procedure."; + } + list alarm { + key "resource alarm-type-id alarm-type-qualifier"; + description + "The list of alarms. Each entry in the list holds one + alarm for a given alarm type and resource. An alarm can + be updated from the underlying resource or by the user. + The following leafs are maintained by the resource: + 'is-cleared', 'last-change', 'perceived-severity', and + 'alarm-text'. An operator can change 'operator-state' and + 'operator-text'. + + Entries appear in the alarm list the first time an alarm + becomes active for a given alarm type and resource. + Entries do not get deleted when the alarm is cleared. + Clear status is represented as a boolean flag. + + Alarm entries are removed, i.e., purged, from the list by + an explicit purge action. For example, purge all alarms + that are cleared and in closed operator state that are + older than 24 hours. Purged alarms are removed from the + alarm list. If the alarm resource state changes after a + purge, the alarm will reappear in the alarm list. + + Systems may also remove alarms based on locally configured + policies; this is out of scope for this module."; + uses common-alarm-parameters; + leaf time-created { + type yang:date-and-time; + mandatory true; + description + "The timestamp when this alarm entry was created. This + represents the first time the alarm appeared; it can + also represent that the alarm reappeared after a purge. + Further state changes of the same alarm do not change + this leaf; these changes will update the 'last-changed' + leaf."; + } + uses resource-alarm-parameters; + list operator-state-change { + if-feature "operator-actions"; + key "time"; + description + "This list is used by operators to indicate the state of + human intervention on an alarm. For example, if an + operator has seen an alarm, the operator can add a new + item to this list indicating that the alarm is + acknowledged."; + uses operator-parameters; + } + action set-operator-state { + if-feature "operator-actions"; + description + "This is a means for the operator to indicate the level + of human intervention on an alarm."; + input { + leaf state { + type writable-operator-state; + mandatory true; + description + "Set this operator state."; + } + leaf text { + type string; + description + "Additional optional textual information."; + } + } + } + notification operator-action { + if-feature "operator-actions"; + description + "This notification is used to report that an operator + acted upon an alarm."; + uses operator-parameters; + } + } + action purge-alarms { + description + "This operation requests that the server delete entries + from the alarm list according to the supplied criteria. + + Typically, this operation is used to delete alarms that + are in closed operator state and older than a specified + time. + + The number of purged alarms is returned as an output + parameter."; + input { + uses filter-input; + } + output { + leaf purged-alarms { + type uint32; + description + "Number of purged alarms."; + } + } + } + action compress-alarms { + if-feature "alarm-history"; + description + "This operation requests that the server compress + entries in the alarm list by removing all but the + latest 'status-change' entry for all matching alarms. + Conditions in the input are logically ANDed. If no + input condition is given, all alarms are compressed."; + input { + leaf resource { + type resource-match; + description + "Compress the alarms matching this resource."; + } + leaf alarm-type-id { + type leafref { + path "/alarms/alarm-list/alarm/alarm-type-id"; + require-instance false; + } + description + "Compress alarms with this 'alarm-type-id'."; + } + leaf alarm-type-qualifier { + type leafref { + path "/alarms/alarm-list/alarm/alarm-type-qualifier"; + require-instance false; + } + description + "Compress the alarms with this + 'alarm-type-qualifier'."; + } + } + output { + leaf compressed-alarms { + type uint32; + description + "Number of compressed alarm entries."; + } + } + } + } + container shelved-alarms { + if-feature "alarm-shelving"; + config false; + description + "The shelved alarms. Alarms appear here if they match the + criteria in /alarms/control/alarm-shelving. This list does + not generate any notifications. The list represents alarms + that are considered not relevant by the operator. Alarms in + this list have an 'operator-state' of 'shelved'. This + cannot be changed."; + leaf number-of-shelved-alarms { + type yang:gauge32; + description + "This object shows the total number of current + alarms, i.e., the total number of entries + in the alarm list."; + } + leaf shelved-alarms-last-changed { + type yang:date-and-time; + description + "A timestamp when the shelved-alarm list was last changed. + The value can be used by a manager to initiate an alarm + resynchronization procedure."; + } + list shelved-alarm { + key "resource alarm-type-id alarm-type-qualifier"; + description + "The list of shelved alarms. Shelved alarms can only be + updated from the underlying resource; no operator actions + are supported."; + uses common-alarm-parameters; + leaf shelf-name { + type leafref { + path "/alarms/control/alarm-shelving/shelf/name"; + require-instance false; + } + description + "The name of the shelf."; + } + uses resource-alarm-parameters; + list operator-state-change { + if-feature "operator-actions"; + key "time"; + description + "This list is used by operators to indicate the state of + human intervention on an alarm. For shelved alarms, the + system has set the list item in the list to 'shelved'."; + uses operator-parameters; + } + } + action purge-shelved-alarms { + description + "This operation requests that the server delete entries from + the shelved-alarm list according to the supplied criteria. + In the shelved-alarm list, it makes sense to delete alarms + that are not relevant anymore. + + The number of purged alarms is returned as an output + parameter."; + input { + uses filter-input; + } + output { + leaf purged-alarms { + type uint32; + description + "Number of purged alarms."; + } + } + } + action compress-shelved-alarms { + if-feature "alarm-history"; + description + "This operation requests that the server compress entries + in the shelved-alarm list by removing all but the latest + 'status-change' entry for all matching shelved alarms. + Conditions in the input are logically ANDed. If no input + condition is given, all alarms are compressed."; + input { + leaf resource { + type leafref { + path "/alarms/shelved-alarms/shelved-alarm/resource"; + require-instance false; + } + description + "Compress the alarms with this resource."; + } + leaf alarm-type-id { + type leafref { + path "/alarms/shelved-alarms/shelved-alarm" + + "/alarm-type-id"; + require-instance false; + } + description + "Compress alarms with this 'alarm-type-id'."; + } + leaf alarm-type-qualifier { + type leafref { + path "/alarms/shelved-alarms/shelved-alarm" + + "/alarm-type-qualifier"; + require-instance false; + } + description + "Compress the alarms with this + 'alarm-type-qualifier'."; + } + } + output { + leaf compressed-alarms { + type uint32; + description + "Number of compressed alarm entries."; + } + } + } + } + list alarm-profile { + if-feature "alarm-profile"; + key "alarm-type-id alarm-type-qualifier-match resource"; + ordered-by user; + description + "This list is used to assign further information or + configuration for each alarm type. This module supports a + mechanism where the client can override the system-default + alarm severity levels. The 'alarm-profile' is also a useful + augmentation point for specific additions to alarm types."; + leaf alarm-type-id { + type alarm-type-id; + description + "The alarm type identifier to match."; + } + leaf alarm-type-qualifier-match { + type string; + description + "An XML Schema regular expression that is used to match the + alarm type qualifier."; + reference + "XML Schema Part 2: Datatypes Second Edition, + World Wide Web Consortium Recommendation + REC-xmlschema-2-20041028"; + } + leaf resource { + type resource-match; + description + "Specifies which resources to match."; + } + leaf description { + type string; + mandatory true; + description + "A description of the alarm profile."; + } + container alarm-severity-assignment-profile { + if-feature "severity-assignment"; + description + "The client can override the system-default severity + level."; + reference + "ITU-T Recommendation M.3100: + Generic network information model + ITU-T Recommendation M.3160: + Generic, protocol-neutral management information model"; + leaf-list severity-level { + type severity; + ordered-by user; + description + "Specifies the configured severity level(s) for the + matching alarm. If the alarm has several severity + levels, the leaf-list shall be given in rising severity + order. The original M3100/M3160 ASAP function only + allows for a one-to-one mapping between alarm type and + severity, but since YANG module supports stateful + alarms, the mapping must allow for several severity + levels. + + Assume a high-utilization alarm type with two thresholds + with the system-default severity levels of threshold1 = + warning and threshold2 = minor. Setting this leaf-list + to (minor, major) will assign the severity levels as + threshold1 = minor and threshold2 = major"; + } + } + } + } + + /* + * Notifications + */ + + notification alarm-notification { + description + "This notification is used to report a state change for an + alarm. The same notification is used for reporting a newly + raised alarm, a cleared alarm, or changing the text and/or + severity of an existing alarm."; + uses common-alarm-parameters; + uses alarm-state-change-parameters; + } + + notification alarm-inventory-changed { + description + "This notification is used to report that the list of possible + alarms has changed. This can happen when, for example, a new + software module is installed or a new physical card is + inserted."; + } +} diff --git a/sdnr/wt/common-yang/pom.xml b/sdnr/wt/common-yang/pom.xml index f5b38c410..e8ca00b95 100755 --- a/sdnr/wt/common-yang/pom.xml +++ b/sdnr/wt/common-yang/pom.xml @@ -42,6 +42,7 @@ <module>iana-crypt-hash</module> <module>rfc8341</module> <module>rfc7317-ietf-system</module> + <module>ietf-alarms</module> <module>openroadm-pm-types</module> <module>test-yang</module> <module>utils</module> diff --git a/sdnr/wt/common-yang/utils/pom.xml b/sdnr/wt/common-yang/utils/pom.xml index ec49e852d..54e0f0abd 100644 --- a/sdnr/wt/common-yang/utils/pom.xml +++ b/sdnr/wt/common-yang/utils/pom.xml @@ -1,27 +1,19 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- - ~ ============LICENSE_START======================================================= - ~ ONAP : ccsdk features - ~ ================================================================================ - ~ Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. - ~ All rights reserved. - ~ ================================================================================ - ~ Update Copyright (C) 2020 AT&T 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======================================================= - ~ - --> +<!-- ~ ============LICENSE_START======================================================= + ~ ONAP : ccsdk features ~ ================================================================================ + ~ Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. + ~ All rights reserved. ~ ================================================================================ + ~ Update Copyright (C) 2020 AT&T 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======================================================= + ~ --> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> @@ -78,11 +70,11 @@ <artifactId>mdsal-dom-api</artifactId> <scope>provided</scope> </dependency> - <dependency> - <groupId>org.opendaylight.mdsal.binding.model.ietf</groupId> - <artifactId>rfc6991-ietf-inet-types</artifactId> - <scope>test</scope> - </dependency> + <dependency> + <groupId>org.opendaylight.mdsal.binding.model.ietf</groupId> + <artifactId>rfc6991-ietf-inet-types</artifactId> + <scope>test</scope> + </dependency> <dependency> <groupId>org.json</groupId> <artifactId>json</artifactId> diff --git a/sdnr/wt/common/pom.xml b/sdnr/wt/common/pom.xml index f84a8c98e..969861c78 100644 --- a/sdnr/wt/common/pom.xml +++ b/sdnr/wt/common/pom.xml @@ -22,6 +22,7 @@ ~ ============LICENSE_END======================================================= ~ --> + <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> @@ -60,8 +61,8 @@ <scope>test</scope> </dependency> <dependency> - <groupId>javax.servlet</groupId> - <artifactId>javax.servlet-api</artifactId> + <groupId>jakarta.servlet</groupId> + <artifactId>jakarta.servlet-api</artifactId> <scope>provided</scope> </dependency> <dependency> diff --git a/sdnr/wt/common/src/main/java/org/onap/ccsdk/features/sdnr/wt/common/test/JSONAssert.java b/sdnr/wt/common/src/main/java/org/onap/ccsdk/features/sdnr/wt/common/test/JSONAssert.java index b207c3e00..060699cc0 100644 --- a/sdnr/wt/common/src/main/java/org/onap/ccsdk/features/sdnr/wt/common/test/JSONAssert.java +++ b/sdnr/wt/common/src/main/java/org/onap/ccsdk/features/sdnr/wt/common/test/JSONAssert.java @@ -21,6 +21,7 @@ */ package org.onap.ccsdk.features.sdnr.wt.common.test; +import java.util.Arrays; import java.util.Comparator; import java.util.Iterator; import org.json.JSONArray; @@ -45,6 +46,7 @@ public class JSONAssert { int x = this.test(o1.get(key), o2.get(key)); if (x != 0) { return x; + } else { } } return 0; @@ -53,8 +55,8 @@ public class JSONAssert { private int test(Object o1, Object o2) { int x; if ((o1 instanceof Double) && (o2 instanceof Double)) { - - return (((Double) o1).doubleValue() - ((Double) o2).doubleValue()) < 0 ? -1 : 1; + double delta = (((Double) o1).doubleValue() - ((Double) o2).doubleValue()); + return delta == 0.0 ? 0 : delta < 0 ? -1 : 1; } else if ((o1 instanceof Boolean) && (o2 instanceof Boolean)) { return ((Boolean) o1).booleanValue() == ((Boolean) o2).booleanValue() ? 0 : -1; @@ -183,50 +185,52 @@ public class JSONAssert { public static void assertContainsOnlyKey(JSONObject o, String key) { - if(o==null) { + if (o == null) { throw new AssertionError("object is null"); } - if(key==null) { + if (key == null) { throw new AssertionError("key is null"); } - Object[] keys= o.keySet().toArray(); - if(keys.length>1) { - throw new AssertionError("more than one key found"); + Object[] keys = o.keySet().toArray(); + if (keys.length > 1) { + throw new AssertionError("more than one key found: " + Arrays.toString(keys)); } - if(keys.length==0) { + if (keys.length == 0) { throw new AssertionError("no key found"); } - if(!key.equals(keys[0])) { - throw new AssertionError("different key found "+key+" <=> "+ keys[0]); + if (!key.equals(keys[0])) { + throw new AssertionError("different key found " + key + " <=> " + keys[0]); } } public static void assertContainsExactKeys(JSONObject o, String[] keys) { - if(o==null) { + if (o == null) { throw new AssertionError("object is null"); } - if(keys==null) { + if (keys == null) { throw new AssertionError("keys is null"); } - Object[] okeys= o.keySet().toArray(); - if(okeys.length!=keys.length) { - throw new AssertionError("found different amount of keys"); + Object[] okeys = o.keySet().toArray(); + if (okeys.length != keys.length) { + throw new AssertionError( + "found different amount of keys: " + Arrays.toString(okeys) + " expected:" + Arrays.toString(keys)); } - for(String k:keys) { - if(!o.keySet().contains(k)) { - throw new AssertionError("key "+ k+ " not found"); + for (String k : keys) { + if (!o.keySet().contains(k)) { + throw new AssertionError("key " + k + " not found"); } } } + public static void assertContainsNoKeys(JSONObject o) { - if(o==null) { + if (o == null) { throw new AssertionError("object is null"); } - Object[] okeys= o.keySet().toArray(); - if(okeys.length!=0) { + Object[] okeys = o.keySet().toArray(); + if (okeys.length != 0) { throw new AssertionError("found keys"); } } diff --git a/sdnr/wt/common/src/main/java/org/onap/ccsdk/features/sdnr/wt/common/threading/KeyBasedThreadpool.java b/sdnr/wt/common/src/main/java/org/onap/ccsdk/features/sdnr/wt/common/threading/KeyBasedThreadpool.java index c6bd16484..4fb4a00c1 100644 --- a/sdnr/wt/common/src/main/java/org/onap/ccsdk/features/sdnr/wt/common/threading/KeyBasedThreadpool.java +++ b/sdnr/wt/common/src/main/java/org/onap/ccsdk/features/sdnr/wt/common/threading/KeyBasedThreadpool.java @@ -91,7 +91,7 @@ public class KeyBasedThreadpool<T, S> implements GenericRunnableFactoryCallback< LOG.debug("key pool size reached. waiting for someone else to stop"); } } else { - LOG.info("nothing to execute. queue is empty."); + LOG.debug("nothing to execute. queue is empty."); } } diff --git a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/about/ODLVersionLUT.java b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/about/ODLVersionLUT.java index c623d9955..ef2dbcb94 100644 --- a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/about/ODLVersionLUT.java +++ b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/about/ODLVersionLUT.java @@ -34,10 +34,10 @@ public class ODLVersionLUT { } if (onapCCSDKVersion.startsWith("2.5.")) { return "ONAP London"; - } + } if (onapCCSDKVersion.startsWith("2.4.")) { return "ONAP Kohn"; - } + } if (onapCCSDKVersion.startsWith("2.3.")) { return "ONAP Jakarta"; } @@ -72,6 +72,7 @@ public class ODLVersionLUT { } if(odlMdsalVersionLUT==null) { odlMdsalVersionLUT = new HashMap<>(); + odlMdsalVersionLUT.put("10.0.5","chlorine-SR1 (0.17.1)"); odlMdsalVersionLUT.put("10.0.2","chlorine-SR0 (0.17.0)"); odlMdsalVersionLUT.put("9.0.5","sulfur-SR2 (0.16.2)"); odlMdsalVersionLUT.put("9.0.4","sulfur-SR1 (0.16.1)"); diff --git a/sdnr/wt/devicemanager-core/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/types/VESNotificationFieldsPOJO.java b/sdnr/wt/devicemanager-core/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/types/VESNotificationFieldsPOJO.java index 6beb04751..dd5d90ec3 100644 --- a/sdnr/wt/devicemanager-core/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/types/VESNotificationFieldsPOJO.java +++ b/sdnr/wt/devicemanager-core/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/types/VESNotificationFieldsPOJO.java @@ -40,7 +40,7 @@ public class VESNotificationFieldsPOJO { private String changeContact = ""; private String changeIdentifier = ""; private String changeType = ""; - @JsonIgnore +// @JsonIgnore private String newState = ""; @JsonIgnore private String oldState = ""; diff --git a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/devicemonitor/impl/DeviceMonitorImpl.java b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/devicemonitor/impl/DeviceMonitorImpl.java index 55e223c79..b6d9d0822 100644 --- a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/devicemonitor/impl/DeviceMonitorImpl.java +++ b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/devicemonitor/impl/DeviceMonitorImpl.java @@ -249,10 +249,10 @@ public class DeviceMonitorImpl implements DeviceMonitor, IConfigChangedListener LOG.debug("Register for monitoring {} {}", mountPointNodeName, mountPointNodeName.hashCode()); if (queue.containsKey(mountPointNodeName)) { - LOG.info("Monitoring task exists"); + LOG.debug("Monitoring task exists"); task = queue.get(mountPointNodeName); } else { - LOG.info("Do start of DeviceMonitor task"); + LOG.debug("Do start of DeviceMonitor task"); //Runnable task = new PerformanceManagerTask(queue, databaseService); task = new DeviceMonitorTask(mountPointNodeName, this.odlEventListener); queue.put(mountPointNodeName, task); diff --git a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/devicemonitor/impl/DeviceMonitorTask.java b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/devicemonitor/impl/DeviceMonitorTask.java index ea5f7da87..139e1cd47 100644 --- a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/devicemonitor/impl/DeviceMonitorTask.java +++ b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/devicemonitor/impl/DeviceMonitorTask.java @@ -116,11 +116,11 @@ public class DeviceMonitorTask implements Runnable { * @param scheduler for all the threads. */ public void start(ScheduledExecutorService scheduler) { - LOG.info("{} {} DeviceMonitor task to create", LOGMARKER, tickCounter); + LOG.debug("{} {} DeviceMonitor task to create", LOGMARKER, tickCounter); if (taskHandle == null) { startDisconnectSupervision(); taskHandle = scheduler.scheduleAtFixedRate(this, 0, 120, TimeUnit.SECONDS); - LOG.info("DeviceMonitor task scheduled"); + LOG.debug("DeviceMonitor task scheduled"); } else { LOG.error("{} {} Task already running.", LOGMARKER, tickCounter); } @@ -133,7 +133,7 @@ public class DeviceMonitorTask implements Runnable { */ public void deviceConnectIndication(@Nullable DeviceMonitoredNe neParam) { - LOG.info("{} {} Connect {} and stop.", LOGMARKER, tickCounter, mountPointName); + LOG.debug("{} {} Connect {} and stop.", LOGMARKER, tickCounter, mountPointName); clear(DeviceMonitorProblems.connectionLossOAM); synchronized (lockNe) { this.ne = neParam; @@ -147,7 +147,7 @@ public class DeviceMonitorTask implements Runnable { */ public void deviceDisconnectIndication() { - LOG.info("{} {} Disconnect {} and start.", LOGMARKER, tickCounter, mountPointName); + LOG.debug("{} {} Disconnect {} and start.", LOGMARKER, tickCounter, mountPointName); clear(DeviceMonitorProblems.connectionLossOAM); synchronized (lockNe) { this.ne = null; @@ -168,7 +168,7 @@ public class DeviceMonitorTask implements Runnable { //Cancel the task if (this.taskHandle != null) { this.taskHandle.cancel(false); - LOG.info("{} {} DeviceMonitor task canceled for {}", LOGMARKER, tickCounter, mountPointName); + LOG.debug("{} {} DeviceMonitor task canceled for {}", LOGMARKER, tickCounter, mountPointName); } else { LOG.error("{} {} Task already stopped", LOGMARKER, tickCounter); } diff --git a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/DeviceManagerApiServiceImpl.java b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/DeviceManagerApiServiceImpl.java index 4d5823a00..deec74828 100644 --- a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/DeviceManagerApiServiceImpl.java +++ b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/DeviceManagerApiServiceImpl.java @@ -106,7 +106,7 @@ public class DeviceManagerApiServiceImpl implements DevicemanagerService, AutoCl // For casablanca version no input was generated. public ListenableFuture<RpcResult<GetRequiredNetworkElementKeysOutput>> getRequiredNetworkElementKeys() { - LOG.info("RPC Request: getRequiredNetworkElementKeys"); + LOG.debug("RPC Request: getRequiredNetworkElementKeys"); RpcResultBuilder<GetRequiredNetworkElementKeysOutput> result; try { GetRequiredNetworkElementKeysOutputBuilder outputBuilder = @@ -123,7 +123,7 @@ public class DeviceManagerApiServiceImpl implements DevicemanagerService, AutoCl public ListenableFuture<RpcResult<ShowRequiredNetworkElementOutput>> showRequiredNetworkElement( ShowRequiredNetworkElementInput input) { - LOG.info("RPC Request: showRequiredNetworkElement input: {}", input.getMountpointName()); + LOG.debug("RPC Request: showRequiredNetworkElement input: {}", input.getMountpointName()); RpcResultBuilder<ShowRequiredNetworkElementOutput> result; try { @@ -140,7 +140,7 @@ public class DeviceManagerApiServiceImpl implements DevicemanagerService, AutoCl @Override public ListenableFuture<RpcResult<SetMaintenanceModeOutput>> setMaintenanceMode(SetMaintenanceModeInput input) { - LOG.info("RPC Request: setMaintenanceMode input: {}", input.getNodeId()); + LOG.debug("RPC Request: setMaintenanceMode input: {}", input.getNodeId()); RpcResultBuilder<SetMaintenanceModeOutput> result; try { @@ -158,7 +158,7 @@ public class DeviceManagerApiServiceImpl implements DevicemanagerService, AutoCl @Override public ListenableFuture<RpcResult<GetMaintenanceModeOutput>> getMaintenanceMode(GetMaintenanceModeInput input) { - LOG.info("RPC Request: getMaintenanceMode input: {}", input.getMountpointName()); + LOG.debug("RPC Request: getMaintenanceMode input: {}", input.getMountpointName()); @NonNull RpcResultBuilder<GetMaintenanceModeOutput> result; try { @@ -174,7 +174,7 @@ public class DeviceManagerApiServiceImpl implements DevicemanagerService, AutoCl @Override public ListenableFuture<RpcResult<TestMaintenanceModeOutput>> testMaintenanceMode(TestMaintenanceModeInput input) { - LOG.info("RPC Request: getMaintenanceMode input: {}", input.getMountpointName()); + LOG.debug("RPC Request: getMaintenanceMode input: {}", input.getMountpointName()); RpcResultBuilder<TestMaintenanceModeOutput> result; try { @@ -192,7 +192,7 @@ public class DeviceManagerApiServiceImpl implements DevicemanagerService, AutoCl @Override public ListenableFuture<RpcResult<ClearCurrentFaultByNodenameOutput>> clearCurrentFaultByNodename( ClearCurrentFaultByNodenameInput input) { - LOG.info("RPC Request: clearNetworkElementAlarms input: {}", input.getNodenames()); + LOG.debug("RPC Request: clearNetworkElementAlarms input: {}", input.getNodenames()); RpcResultBuilder<ClearCurrentFaultByNodenameOutput> result; try { if (this.resyncCallbackListener != null) { @@ -215,7 +215,7 @@ public class DeviceManagerApiServiceImpl implements DevicemanagerService, AutoCl @Override public ListenableFuture<RpcResult<PushFaultNotificationOutput>> pushFaultNotification( PushFaultNotificationInput input) { - LOG.info("RPC Received fault notification {}", input); + LOG.debug("RPC Received fault notification {}", input); RpcResultBuilder<PushFaultNotificationOutput> result; try { pushNotificationsListener.pushFaultNotification(input); @@ -229,7 +229,7 @@ public class DeviceManagerApiServiceImpl implements DevicemanagerService, AutoCl @Override public ListenableFuture<RpcResult<PushCmNotificationOutput>> pushCmNotification(PushCmNotificationInput input) { - LOG.info("RPC Received CM notification {}", input); + LOG.debug("RPC Received CM notification {}", input); RpcResultBuilder<PushCmNotificationOutput> result; try { pushNotificationsListener.pushCMNotification(input); @@ -244,7 +244,7 @@ public class DeviceManagerApiServiceImpl implements DevicemanagerService, AutoCl @Override public ListenableFuture<RpcResult<PushAttributeChangeNotificationOutput>> pushAttributeChangeNotification( PushAttributeChangeNotificationInput input) { - LOG.info("RPC Received change notification {}", input); + LOG.debug("RPC Received change notification {}", input); RpcResultBuilder<PushAttributeChangeNotificationOutput> result; try { pushNotificationsListener.pushAttributeChangeNotification(input); diff --git a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/DeviceManagerImpl.java b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/DeviceManagerImpl.java index 361356217..881f6b415 100644 --- a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/DeviceManagerImpl.java +++ b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/DeviceManagerImpl.java @@ -276,7 +276,7 @@ public class DeviceManagerImpl implements NetconfNetworkElementService, DeviceMa @Override public @NonNull <L extends NetworkElementFactory> FactoryRegistration<L> registerBindingNetworkElementFactory( @NonNull final L factory) { - LOG.info("Factory registration {}", factory.getClass().getName()); + LOG.debug("Factory registration {}", factory.getClass().getName()); factoryList.add(factory); factory.init(getServiceProvider()); diff --git a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/DeviceManagerNetconfConnectHandler.java b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/DeviceManagerNetconfConnectHandler.java index 4b4d1eded..8c0fe57c8 100644 --- a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/DeviceManagerNetconfConnectHandler.java +++ b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/DeviceManagerNetconfConnectHandler.java @@ -72,9 +72,9 @@ public class DeviceManagerNetconfConnectHandler extends DeviceManagerNetconfNotC //@NonNull NodeId nNodeId, @NonNull NetconfNode netconfNode, //@NonNull MountPoint mountPoint, @NonNull DataBroker netconfNodeDataBroker String mountPointNodeName = acessor.getNodeId().getValue(); - LOG.info("onEnterConnected - starting Event listener on Netconf for mountpoint {}", mountPointNodeName); + LOG.debug("onEnterConnected - starting Event listener on Netconf for mountpoint {}", mountPointNodeName); - LOG.info("Master mountpoint {}", mountPointNodeName); + LOG.debug("Master mountpoint {}", mountPointNodeName); // It is master for mountpoint and all data are available. // Make sure that specific mountPointNodeName is handled only once. @@ -103,7 +103,7 @@ public class DeviceManagerNetconfConnectHandler extends DeviceManagerNetconfNotC @Override public void onLeaveConnected(@NonNull NodeId nNodeId, @NonNull Optional<NetconfNode> optionalNetconfNode) { - LOG.info("onLeaveConnected {}", nNodeId); + LOG.debug("onLeaveConnected {}", nNodeId); String mountPointNodeName = nNodeId.getValue(); if (optionalNetconfNode.isPresent()) { @@ -156,7 +156,7 @@ public class DeviceManagerNetconfConnectHandler extends DeviceManagerNetconfNotC private void handleNeStartup(NodeId nodeId, NetworkElement inNe) { - LOG.info("NE Management for {} with {}", nodeId.getValue(), inNe.getClass().getName()); + LOG.debug("NE Management for {} with {}", nodeId.getValue(), inNe.getClass().getName()); NetworkElement result; synchronized (networkelementLock) { result = connectedNetworkElementRepresentations.put(nodeId.getValue(), inNe); @@ -177,7 +177,7 @@ public class DeviceManagerNetconfConnectHandler extends DeviceManagerNetconfNotC } private void sendUpdateNotification(NodeId nodeId, ConnectionStatus csts, NetconfNode nNode) { - LOG.info("update ConnectedState for device :: Name : {} ConnectionStatus {}", nodeId.getValue(), csts); + LOG.debug("update ConnectedState for device :: Name : {} ConnectionStatus {}", nodeId.getValue(), csts); if (isOdlEventListenerHandlerEnabled()) { getOdlEventListenerHandler().updateRegistration(nodeId, ConnectionStatus.class.getSimpleName(), csts != null ? csts.getName() : "null", nNode); diff --git a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/util/NotificationProxyParserImpl.java b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/util/NotificationProxyParserImpl.java index 802c05d0c..e8f12f955 100644 --- a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/util/NotificationProxyParserImpl.java +++ b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/impl/util/NotificationProxyParserImpl.java @@ -333,10 +333,10 @@ public class NotificationProxyParserImpl implements NotificationProxyParser { Instant time; if (notification instanceof EventInstantAware) { // If notification class extends/implements the EventInstantAware time = ((EventInstantAware) notification).eventInstant(); - log.info("Event time {}", time); + log.debug("Event time {}", time); } else { time = Instant.now(); - log.info("Defaulting to actual time of processing the notification - {}", time); + log.debug("Defaulting to actual time of processing the notification - {}", time); } return time; } diff --git a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/vescollectorconnector/impl/VESCollectorServiceImpl.java b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/vescollectorconnector/impl/VESCollectorServiceImpl.java index f1538fbff..945d42550 100644 --- a/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/vescollectorconnector/impl/VESCollectorServiceImpl.java +++ b/sdnr/wt/devicemanager-core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/vescollectorconnector/impl/VESCollectorServiceImpl.java @@ -99,7 +99,7 @@ public class VESCollectorServiceImpl implements VESCollectorService, IConfigChan @Override public boolean publishVESMessage(VESMessage message) { - LOG.info("In VESClient - {} ", message.getMessage()); + LOG.debug("In VESClient - {} ", message.getMessage()); BaseHTTPResponse response; try { String uri = "eventListener" + "/" + getConfig().getVersion(); @@ -162,7 +162,7 @@ public class VESCollectorServiceImpl implements VESCollectorService, IConfigChan Map<String, Object> outerEvent = new HashMap<String, Object>(); outerEvent.put("event", innerEvent); - LOG.info("in generateVESEvent - {}", objMapper.writeValueAsString(outerEvent)); + LOG.debug("In generateVESEvent - {}", objMapper.writeValueAsString(outerEvent)); return new VESMessage(objMapper.writeValueAsString(outerEvent)); } diff --git a/sdnr/wt/devicemanager-onap/adapter-manager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/adaptermanager/impl/DeviceManagerAdapterManagerImpl.java b/sdnr/wt/devicemanager-onap/adapter-manager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/adaptermanager/impl/DeviceManagerAdapterManagerImpl.java index 3a7aa8f40..3726cec51 100644 --- a/sdnr/wt/devicemanager-onap/adapter-manager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/adaptermanager/impl/DeviceManagerAdapterManagerImpl.java +++ b/sdnr/wt/devicemanager-onap/adapter-manager/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/adaptermanager/impl/DeviceManagerAdapterManagerImpl.java @@ -36,7 +36,7 @@ public class DeviceManagerAdapterManagerImpl implements AutoCloseable { // Blueprint begin public DeviceManagerAdapterManagerImpl() { - LOG.info("Creating provider for {}", APPLICATION_NAME); + LOG.debug("Creating provider for {}", APPLICATION_NAME); resAdapterManager = null; } 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 74eb8d010..b0949764e 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 @@ -49,7 +49,7 @@ public class NtsNetworkElement implements NetworkElement { private @NonNull ListenerRegistration<NotificationListener> listenerRegistrationresult; NtsNetworkElement(NetconfBindingAccessor netconfAccess, DeviceManagerServiceProvider serviceProvider) { - LOG.info("Create {}", NtsNetworkElement.class.getSimpleName()); + LOG.debug("Create {}", NtsNetworkElement.class.getSimpleName()); this.netconfAccessor = netconfAccess; this.databaseService = serviceProvider.getDataProvider(); this.notificationListener = new NotificationListenerImpl(netconfAccess,serviceProvider); diff --git a/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/impl/Onf14DomNetworkElement.java b/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/impl/Onf14DomNetworkElement.java index 56834a13d..6ff43bd69 100644 --- a/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/impl/Onf14DomNetworkElement.java +++ b/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/impl/Onf14DomNetworkElement.java @@ -17,19 +17,26 @@ */ package org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.dom.impl; +import java.util.Iterator; import java.util.Map; import java.util.Optional; import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; 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.ne.service.PerformanceDataProvider; import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.dom.impl.dataprovider.Onf14DomToInternalDataModel; import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.dom.impl.equipment.Onf14DomEquipmentManager; import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.dom.impl.interfaces.Onf14DomInterfacePacManager; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.dom.impl.interfaces.TechnologySpecificPacKeys; import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.dom.impl.util.Onf14DevicemanagerQNames; import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServiceProvider; 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.service.PerformanceManager; +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.NetconfDomAccessor; import org.opendaylight.mdsal.common.api.LogicalDatastoreType; @@ -47,7 +54,7 @@ import org.slf4j.LoggerFactory; * Representation of ONF Core model 1.4 device Top level element is "ControlConstruct" (replaces "NetworkElement" of * older ONF Version) NOTE: */ -public class Onf14DomNetworkElement implements NetworkElement { +public class Onf14DomNetworkElement implements NetworkElement, PerformanceDataProvider { private static final Logger log = LoggerFactory.getLogger(Onf14DomNetworkElement.class); @@ -55,9 +62,13 @@ public class Onf14DomNetworkElement implements NetworkElement { YangInstanceIdentifier.builder().node(Onf14DevicemanagerQNames.CORE_MODEL_CONTROL_CONSTRUCT_CONTAINER) .node(Onf14DevicemanagerQNames.CORE_MODEL_CC_TOP_LEVEL_EQPT).build(); + private final @NonNull Object pmLock = new Object(); + protected @Nullable TechnologySpecificPacKeys pmLp = null; + protected @Nullable Iterator<TechnologySpecificPacKeys> interfaceListIterator = null; private final NetconfDomAccessor netconfDomAccessor; private final DataProvider databaseService; private final @NonNull FaultService faultService; + private final @NonNull PerformanceManager performanceManager; private final @NonNull NotificationService notificationService; private final Onf14DomToInternalDataModel onf14Mapper; @@ -73,6 +84,7 @@ public class Onf14DomNetworkElement implements NetworkElement { this.databaseService = serviceProvider.getDataProvider(); this.notificationService = serviceProvider.getNotificationService(); this.faultService = serviceProvider.getFaultService(); + this.performanceManager = serviceProvider.getPerformanceManagerService(); this.namespaceRevision = namespaceRevision; this.onf14Mapper = new Onf14DomToInternalDataModel(); this.equipmentManager = new Onf14DomEquipmentManager(netconfDomAccessor, databaseService, onf14Mapper); @@ -84,16 +96,16 @@ public class Onf14DomNetworkElement implements NetworkElement { * reading the inventory (CoreModel 1.4 Equipment Model) and adding it to the DB */ public void initialReadFromNetworkElement() { - log.info("Calling read equipment"); + log.debug("Calling read equipment"); // Read complete device tree readEquipmentData(); - // Read fault data and subscribe for notifications - interfacePacManager.register(); - int problems = faultService.removeAllCurrentProblemsOfNode(netconfDomAccessor.getNodeId()); log.debug("Removed all {} problems from database at registration", problems); + // Read fault data and subscribe for notifications + interfacePacManager.register(); + } /** @@ -114,23 +126,28 @@ public class Onf14DomNetworkElement implements NetworkElement { if (netconfDomAccessor.isNotificationsRFC5277Supported()) { // Output notification streams to LOG Map<StreamKey, Stream> streams = netconfDomAccessor.getNotificationStreamsAsMap(); - log.info("Available notifications streams: {}", streams); + log.debug("Available notifications streams: {}", streams); // Register to default stream netconfDomAccessor.invokeCreateSubscription(); } + // -- Register NE to performance manager + performanceManager.registration(netconfDomAccessor.getNodeId(), this); } @Override - public void deregister() {} + public void deregister() { + performanceManager.deRegistration(netconfDomAccessor.getNodeId()); + } @Override public NodeId getNodeId() { return netconfDomAccessor.getNodeId(); } + @SuppressWarnings("unchecked") @Override public <L extends NetworkElementService> Optional<L> getService(Class<L> clazz) { - return Optional.empty(); + return clazz.isInstance(this) ? Optional.of((L) this) : Optional.empty(); } @Override @@ -148,7 +165,7 @@ public class Onf14DomNetworkElement implements NetworkElement { private void readEquipmentData() { Optional<NormalizedNode> topLevelEquipment = readTopLevelEquipment(netconfDomAccessor); - log.info("Top level equipment data is {}", topLevelEquipment.isPresent() ? topLevelEquipment.get() : null); + log.debug("Top level equipment data is {}", topLevelEquipment.isPresent() ? topLevelEquipment.get() : null); if (topLevelEquipment.isPresent()) { equipmentManager.setEquipmentData(topLevelEquipment.get()); } @@ -156,8 +173,78 @@ public class Onf14DomNetworkElement implements NetworkElement { } private Optional<NormalizedNode> readTopLevelEquipment(NetconfDomAccessor netconfDomAccessor) { - log.info("Reading Top level equipment data"); return netconfDomAccessor.readDataNode(LogicalDatastoreType.CONFIGURATION, TOPLEVELEQUIPMENT_IID); } + public Object getPmLock() { + return pmLock; + } + + @Override + public void resetPMIterator() { + synchronized (pmLock) { + interfaceListIterator = interfacePacManager.getAirInterfaceList().iterator(); + } + log.debug("PM reset iterator"); + } + + @Override + public boolean hasNext() { + boolean res; + synchronized (pmLock) { + res = interfaceListIterator != null ? interfaceListIterator.hasNext() : false; + } + log.debug("PM hasNext LTP {}", res); + return res; + } + + @Override + public void next() { + synchronized (pmLock) { + if (interfaceListIterator == null) { + pmLp = null; + log.debug("PM next LTP null"); + } else { + pmLp = interfaceListIterator.next(); + } + } + + } + + @Override + public Optional<PerformanceDataLtp> getLtpHistoricalPerformanceData() throws InconsistentPMDataException { + synchronized (getPmLock()) { + if (pmLp != null) { + log.debug("Enter query PM"); + @NonNull + TechnologySpecificPacKeys lp = pmLp; + return Optional.of(interfacePacManager.getLtpHistoricalPerformanceData(lp)); + } + return Optional.empty(); + } + } + + @Override + public String pmStatusToString() { + StringBuilder res = new StringBuilder(); + synchronized (pmLock) { + if (pmLp == null) { + res.append("no interface"); + } else { + res.append("ActualLP="); + res.append(pmLp.getLocalId()); + } + res.append(" IFList="); + int no = 0; + for (TechnologySpecificPacKeys lp : interfacePacManager.getAirInterfaceList()) { + res.append("["); + res.append(no++); + res.append("]="); + res.append(lp.getLocalId()); + res.append(" "); + } + } + return res.toString(); + } + } diff --git a/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/impl/Onf14DomNetworkElementFactory.java b/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/impl/Onf14DomNetworkElementFactory.java index b47f56d31..0c84cdf1b 100644 --- a/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/impl/Onf14DomNetworkElementFactory.java +++ b/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/impl/Onf14DomNetworkElementFactory.java @@ -39,13 +39,14 @@ public class Onf14DomNetworkElementFactory implements NetworkElementFactory { Optional<NetworkElement> ne = Optional.empty(); Capabilities capabilities = accessor.getCapabilites(); if (capabilities.isSupportingNamespace(Onf14DevicemanagerQNames.CORE_MODEL_CONTROL_CONSTRUCT_CONTAINER)) { - String namespaceRevision = capabilities.getRevisionForNamespace(Onf14DevicemanagerQNames.CORE_MODEL_CONTROL_CONSTRUCT_CONTAINER); + String namespaceRevision = capabilities + .getRevisionForNamespace(Onf14DevicemanagerQNames.CORE_MODEL_CONTROL_CONSTRUCT_CONTAINER); + + Optional<NetconfDomAccessor> domAccessor = accessor.getNetconfDomAccessor(); + if (domAccessor.isPresent()) { + ne = Optional.of(new Onf14DomNetworkElement(domAccessor.get(), serviceProvider, namespaceRevision)); + } - Optional<NetconfDomAccessor> domAccessor = accessor.getNetconfDomAccessor(); - if (domAccessor.isPresent()) { - ne = Optional.of(new Onf14DomNetworkElement(domAccessor.get(), serviceProvider, namespaceRevision)); - } - log.info("Create device:{}", ne.isPresent() ? ne.get().getClass().getSimpleName() : "not"); } return ne; diff --git a/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/impl/dataprovider/InternalDataModelSeverity.java b/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/impl/dataprovider/InternalDataModelSeverity.java index 6d31d7392..917a82122 100644 --- a/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/impl/dataprovider/InternalDataModelSeverity.java +++ b/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/impl/dataprovider/InternalDataModelSeverity.java @@ -30,10 +30,19 @@ import org.slf4j.LoggerFactory; public class InternalDataModelSeverity { private static Logger log = LoggerFactory.getLogger(InternalDataModelSeverity.class); - private static final Map<String, SeverityType> SEVERITYMAP = - Map.of("SEVERITY_TYPE_MAJOR", SeverityType.Major, "SEVERITY_TYPE_CRITICAL", SeverityType.Critical, - "SEVERITY_TYPE_MINOR", SeverityType.Minor, "SEVERITY_TYPE_WARNING", SeverityType.Warning); - + // @formatter:off + private static final Map<String, SeverityType> SEVERITYMAP = Map.of( + "SEVERITY_TYPE_MAJOR", SeverityType.Major, + "SEVERITY_AND_CLEARED_TYPE_MAJOR", SeverityType.Major, + "SEVERITY_TYPE_CRITICAL", SeverityType.Critical, + "SEVERITY_AND_CLEARED_TYPE_CRITICAL", SeverityType.Critical, + "SEVERITY_TYPE_MINOR", SeverityType.Minor, + "SEVERITY_AND_CLEARED_TYPE_MINOR", SeverityType.Minor, + "SEVERITY_TYPE_WARNING", SeverityType.Warning, + "SEVERITY_AND_CLEARED_TYPE_WARNING", SeverityType.Warning, + "SEVERITY_AND_CLEARED_TYPE_INDETERMINATE", SeverityType.NonAlarmed, + "SEVERITY_AND_CLEARED_TYPE_CLEARED", SeverityType.NonAlarmed); + // @formatter:on public static SeverityType mapSeverity(String severity) { log.debug("Severity is - {}", severity); SeverityType res = null; diff --git a/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/impl/dataprovider/Onf14DomToInternalDataModel.java b/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/impl/dataprovider/Onf14DomToInternalDataModel.java index 2a931378f..af817fe18 100644 --- a/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/impl/dataprovider/Onf14DomToInternalDataModel.java +++ b/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/impl/dataprovider/Onf14DomToInternalDataModel.java @@ -1,12 +1,9 @@ package org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.dom.impl.dataprovider; -import java.util.ArrayList; import java.util.Collection; import java.util.HashSet; -import java.util.List; import java.util.Objects; import java.util.Set; - import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.dom.impl.util.Onf14DMDOMUtility; import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.dom.impl.util.Onf14DevicemanagerQNames; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.Inventory; diff --git a/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/impl/equipment/Onf14DomEquipmentManager.java b/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/impl/equipment/Onf14DomEquipmentManager.java index 8f7a44858..5c7101199 100644 --- a/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/impl/equipment/Onf14DomEquipmentManager.java +++ b/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/impl/equipment/Onf14DomEquipmentManager.java @@ -65,56 +65,11 @@ public class Onf14DomEquipmentManager { this.equipmentUuidList = new ArrayList<>(); } + // public methods public List<String> getEquipmentUuidList() { return equipmentUuidList; } - private List<Inventory> collectEquipment(List<Inventory> list, MapEntryNode currentEq, MapEntryNode parentEq, - long treeLevel) { - - // if the Equipment UUID is already in the list, it was already processed - // needed for solving possible circular dependencies - if (equipmentUuidList.contains(Onf14DMDOMUtility.getUuidFromEquipment(currentEq))) { - log.debug("Not adding equipment with uuid {} because it was aleady added...", - Onf14DMDOMUtility.getUuidFromEquipment(currentEq)); - return list; - } - - // we add this to our internal list, such that we avoid circular dependencies - equipmentUuidList.add(Onf14DMDOMUtility.getUuidFromEquipment(currentEq)); - log.debug("Adding equipment with uuid {} to the database...", - Onf14DMDOMUtility.getUuidFromEquipment(currentEq)); - - // we add our current equipment to the database - list.add(onf14Mapper.getInternalEquipment(netconfDomAccessor.getNodeId(), currentEq, parentEq, treeLevel)); - - // we iterate the kids of our current equipment and add them to the database - // recursively - // the actual reference is here: - // /core-model:control-construct/equipment/contained-holder/occupying-fru - - MapNode containedHolderMap = (MapNode) currentEq - .childByArg(new NodeIdentifier(Onf14DevicemanagerQNames.CORE_MODEL_CC_EQPT_CONTAINED_HOLDER)); - if (containedHolderMap != null) { - Collection<MapEntryNode> containedHolderCollection = containedHolderMap.body(); - for (MapEntryNode holder : containedHolderCollection) { - String occupyingFru = Onf14DMDOMUtility.getLeafValue(holder, - Onf14DevicemanagerQNames.CORE_MODEL_CC_EQPT_OCCUPYING_FRU); - - if (occupyingFru != null) { - Optional<NormalizedNode> childEq = readEquipmentInstance(netconfDomAccessor, occupyingFru); - if (childEq.isPresent()) { - // current becomes parent and tree level increases by 1 - collectEquipment(list, (MapEntryNode) childEq.get(), currentEq, treeLevel + 1); - } - } - } - } - - return list; - } - - // public methods /** * Set all equipment data from controlConstruct into database and into this manager. * @@ -124,7 +79,7 @@ public class Onf14DomEquipmentManager { Objects.requireNonNull(controlConstruct); // the top-level-equipment list contains the root objects of the Equipment Model - log.debug("Getting list of topLevelEquipment for mountpoint {}", netconfDomAccessor.getNodeId()); + log.debug("Iterating through the list of topLevelEquipment for mountpoint {}", netconfDomAccessor.getNodeId()); // adding all root Equipment objects to the DB List<Inventory> inventoryList = new ArrayList<>(); for (String uuid : getTopLevelEquipment(controlConstruct)) { @@ -156,7 +111,7 @@ public class Onf14DomEquipmentManager { */ private Optional<NormalizedNode> readEquipmentInstance(NetconfDomAccessor accessData, String equipmentUuid) { - log.info("DBRead Get equipment from mountpoint {} for uuid {}", accessData.getNodeId().getValue(), + log.debug("DBRead Get equipment from mountpoint {} for uuid {}", accessData.getNodeId().getValue(), equipmentUuid); InstanceIdentifierBuilder equipmentIIDBuilder = YangInstanceIdentifier.builder() @@ -168,4 +123,49 @@ public class Onf14DomEquipmentManager { return accessData.readDataNode(LogicalDatastoreType.CONFIGURATION, equipmentIIDBuilder.build()); } + private List<Inventory> collectEquipment(List<Inventory> list, MapEntryNode currentEq, MapEntryNode parentEq, + long treeLevel) { + + // if the Equipment UUID is already in the list, it was already processed + // needed for solving possible circular dependencies + if (equipmentUuidList.contains(Onf14DMDOMUtility.getUuidFromEquipment(currentEq))) { + log.debug("Not adding equipment with uuid {} because it was aleady added...", + Onf14DMDOMUtility.getUuidFromEquipment(currentEq)); + return list; + } + + // we add this to our internal list, such that we avoid circular dependencies + equipmentUuidList.add(Onf14DMDOMUtility.getUuidFromEquipment(currentEq)); + log.debug("Adding equipment with uuid {} to the database...", + Onf14DMDOMUtility.getUuidFromEquipment(currentEq)); + + // we add our current equipment to the database + list.add(onf14Mapper.getInternalEquipment(netconfDomAccessor.getNodeId(), currentEq, parentEq, treeLevel)); + + // we iterate the kids of our current equipment and add them to the database + // recursively + // the actual reference is here: + // /core-model:control-construct/equipment/contained-holder/occupying-fru + + MapNode containedHolderMap = (MapNode) currentEq + .childByArg(new NodeIdentifier(Onf14DevicemanagerQNames.CORE_MODEL_CC_EQPT_CONTAINED_HOLDER)); + if (containedHolderMap != null) { + Collection<MapEntryNode> containedHolderCollection = containedHolderMap.body(); + for (MapEntryNode holder : containedHolderCollection) { + String occupyingFru = Onf14DMDOMUtility.getLeafValue(holder, + Onf14DevicemanagerQNames.CORE_MODEL_CC_EQPT_OCCUPYING_FRU); + + if (occupyingFru != null) { + Optional<NormalizedNode> childEq = readEquipmentInstance(netconfDomAccessor, occupyingFru); + if (childEq.isPresent()) { + // current becomes parent and tree level increases by 1 + collectEquipment(list, (MapEntryNode) childEq.get(), currentEq, treeLevel + 1); + } + } + } + } + + return list; + } + } diff --git a/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/impl/interfaces/Onf14DomInterfacePacManager.java b/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/impl/interfaces/Onf14DomInterfacePacManager.java index eed6f5da3..71f94dc26 100644 --- a/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/impl/interfaces/Onf14DomInterfacePacManager.java +++ b/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/impl/interfaces/Onf14DomInterfacePacManager.java @@ -28,16 +28,18 @@ import java.util.List; import java.util.Objects; import java.util.Optional; import org.eclipse.jdt.annotation.NonNull; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.dom.impl.Onf14DomAirInterfaceNotificationListener; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.dom.impl.Onf14DomEthernetContainerNotificationListener; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.dom.impl.Onf14DomWireInterfaceNotificationListener; import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.dom.impl.dataprovider.InternalDataModelSeverity; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.dom.impl.pm.PerformanceDataAirInterface; import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.dom.impl.util.Debug; import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.dom.impl.util.Onf14DMDOMUtility; import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.dom.impl.util.Onf14DevicemanagerQNames; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.dom.notifications.Onf14DomAirInterfaceNotificationListener; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.dom.notifications.Onf14DomEthernetContainerNotificationListener; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.dom.notifications.Onf14DomWireInterfaceNotificationListener; import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServiceProvider; 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.netconfnodestateservice.NetconfDomAccessor; import org.opendaylight.mdsal.common.api.LogicalDatastoreType; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime; @@ -47,6 +49,7 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.Augmentat import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.InstanceIdentifierBuilder; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier; import org.opendaylight.yangtools.yang.data.api.schema.AugmentationNode; +import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode; import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode; import org.opendaylight.yangtools.yang.data.api.schema.MapNode; import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; @@ -130,15 +133,77 @@ public class Onf14DomInterfacePacManager { registerForNotifications(); } + public List<TechnologySpecificPacKeys> getAirInterfaceList() { + return airInterfaceList; + } + + public PerformanceDataLtp readAirInterfaceHistoricalPerformanceData(String ltpUuid, String localId, + PerformanceDataLtp res) { + log.debug("Get historical performance data for class {} from mountpoint {} for LTP uuid {} and local-id {}", + Onf14DevicemanagerQNames.AIR_INTERFACE_2_0_MODULE, netconfDomAccessor.getNodeId().getValue(), ltpUuid, + localId); + + // constructing the IID needs the augmentation exposed by the air-interface-2-0 + // model + + InstanceIdentifierBuilder layerProtocolIID = + YangInstanceIdentifier.builder().node(Onf14DevicemanagerQNames.CORE_MODEL_CONTROL_CONSTRUCT_CONTAINER) + .node(Onf14DevicemanagerQNames.CORE_MODEL_CC_LTP) + .nodeWithKey(Onf14DevicemanagerQNames.CORE_MODEL_CC_LTP, + QName.create(Onf14DevicemanagerQNames.CORE_MODEL_CC_LTP, "uuid").intern(), ltpUuid) + .node(Onf14DevicemanagerQNames.CORE_MODEL_CC_LTP_LAYER_PROTOCOL) + .nodeWithKey(Onf14DevicemanagerQNames.CORE_MODEL_CC_LTP_LAYER_PROTOCOL, QName + .create(Onf14DevicemanagerQNames.CORE_MODEL_CC_LTP_LAYER_PROTOCOL, "local-id").intern(), + localId); + + @NonNull + AugmentationIdentifier airInterfacePacIID = YangInstanceIdentifier.AugmentationIdentifier + .create(Sets.newHashSet(Onf14DevicemanagerQNames.AIR_INTERFACE_PAC)); + + InstanceIdentifierBuilder augmentedAirInterfacePacIID = + YangInstanceIdentifier.builder(layerProtocolIID.build()).node(airInterfacePacIID); + + // reading historical performance list for this specific LTP and LP + Optional<NormalizedNode> airInterfacePacDataOpt = + netconfDomAccessor.readDataNode(LogicalDatastoreType.OPERATIONAL, augmentedAirInterfacePacIID.build()); + log.debug("Performance Data = {}", airInterfacePacDataOpt.get().body()); + if (airInterfacePacDataOpt.isPresent()) { + AugmentationNode airInterfacePacData = (AugmentationNode) airInterfacePacDataOpt.get(); + ContainerNode cn = (ContainerNode) airInterfacePacData + .childByArg(new NodeIdentifier(Onf14DevicemanagerQNames.AIR_INTERFACE_PAC)); + if (cn != null) { + ContainerNode airIntfHistPerf = (ContainerNode) cn + .childByArg(new NodeIdentifier(Onf14DevicemanagerQNames.AIR_INTERFACE_HISTORICAL_PERFORMANCES)); + if (airIntfHistPerf != null) { + MapNode airInterfaceHistoricalPerformanceList = (MapNode) airIntfHistPerf.childByArg( + new NodeIdentifier(Onf14DevicemanagerQNames.AIR_INTERFACE_HISTORICAL_PERFORMANCES_LIST)); + if (airInterfaceHistoricalPerformanceList != null) { + Collection<MapEntryNode> airInterfaceHistoricalPerfCollection = + airInterfaceHistoricalPerformanceList.body(); + for (MapEntryNode airInterfaceHistPerf : airInterfaceHistoricalPerfCollection) { + res.add(new PerformanceDataAirInterface(netconfDomAccessor.getNodeId(), ltpUuid, localId, + airInterfaceHistPerf)); + } + return res; + } else { + log.debug("DBRead Id {} empty CurrentProblemList", ltpUuid); + } + } + } + } + return null; + } + private void readAndWriteInterfaceCurrentProblems() { // Read all fault data FaultData resultList = new FaultData(); - int problems; + int problems = 0; readAllAirInterfaceCurrentProblems(resultList); problems = resultList.size(); log.debug("NETCONF read air interface current problems completed. Got back {} problems.", problems); - readAllEhernetContainerCurrentProblems(resultList); + + readAllEthernetContainerCurrentProblems(resultList); problems = resultList.size() - problems; log.debug("NETCONF read current problems completed. Got back {} problems.", problems); @@ -146,16 +211,18 @@ public class Onf14DomInterfacePacManager { problems = resultList.size(); log.debug("NETCONF read wire interface current problems completed. Got back {} problems.", problems); - faultService.initCurrentProblemStatus(netconfDomAccessor.getNodeId(), resultList); - log.debug("DB write current problems completed"); + + if (resultList.size() > 0) { + faultService.initCurrentProblemStatus(netconfDomAccessor.getNodeId(), resultList); + log.debug("DB write current problems completed"); + } } private void readKeys() { Optional<NormalizedNode> ltpData = readLtpData(netconfDomAccessor); - log.info("LTP Data is - {}", ltpData); + log.debug("LTP Data is - {}", ltpData); if (ltpData.isPresent()) { - log.debug("In readKeys - ltpData = {}", ltpData.get()); MapNode ccLtp = (MapNode) ltpData.get(); if (ccLtp != null) { @@ -194,7 +261,7 @@ public class Onf14DomInterfacePacManager { Onf14DMDOMUtility.getLeafValue(lpEntry, Onf14DevicemanagerQNames.CORE_MODEL_CC_LTP_LAYER_PROTOCOL_LOCAL_ID)); } - // if the LTP has an ethernetContainier technology extension, the layer protocol + // if the LTP has an ethernetContainer technology extension, the layer protocol // name is ethernet-container-layer else if (layerProtocolName.contains("LAYER_PROTOCOL_NAME_TYPE_ETHERNET_CONTAINER_LAYER")) { TechnologySpecificPacKeys ethernetContainerKey = new TechnologySpecificPacKeys( @@ -240,7 +307,7 @@ public class Onf14DomInterfacePacManager { } } - private void readAllEhernetContainerCurrentProblems(FaultData resultList) { + private void readAllEthernetContainerCurrentProblems(FaultData resultList) { int idxStart; // Start index for debug messages @@ -266,7 +333,7 @@ public class Onf14DomInterfacePacManager { private void readAirInterfaceCurrentProblemForLtp(String ltpUuid, String localId, FaultData resultList) { - log.info("DBRead Get current problems for class {} from mountpoint {} for LTP uuid {} and local-id {}", + log.debug("DBRead Get current problems for class {} from mountpoint {} for LTP uuid {} and local-id {}", Onf14DevicemanagerQNames.AIR_INTERFACE_2_0_MODULE, netconfDomAccessor.getNodeId().getValue(), ltpUuid, localId); @@ -296,7 +363,6 @@ public class Onf14DomInterfacePacManager { if (airInterfacePacDataOpt.isPresent()) { AugmentationNode airInterfacePacData = (AugmentationNode) airInterfacePacDataOpt.get(); - MapNode airInterfaceCurrentProblemsList = (MapNode) airInterfacePacData .childByArg(new NodeIdentifier(Onf14DevicemanagerQNames.AIR_INTERFACE_CURRENT_PROBLEMS_LIST)); if (airInterfaceCurrentProblemsList != null) { @@ -321,7 +387,7 @@ public class Onf14DomInterfacePacManager { private void readEthernetContainerCurrentProblemForLtp(String ltpUuid, String localId, FaultData resultList) { - log.info( + log.debug( "DBRead Get current problems for Ethernet Container from mountpoint {} for LTP uuid {} and local-id {}", netconfDomAccessor.getNodeId().getValue(), ltpUuid, localId); @@ -377,7 +443,7 @@ public class Onf14DomInterfacePacManager { private void readWireInterfaceCurrentProblemForLtp(String ltpUuid, String localId, FaultData resultList) { - log.info("DBRead Get current problems for Wire Interface from mountpoint {} for LTP uuid {} and local-id {}", + log.debug("DBRead Get current problems for Wire Interface from mountpoint {} for LTP uuid {} and local-id {}", netconfDomAccessor.getNodeId().getValue(), ltpUuid, localId); // constructing the IID needs the augmentation exposed by the wire-interface-2-0 @@ -419,7 +485,7 @@ public class Onf14DomInterfacePacManager { Onf14DMDOMUtility.getLeafValue(wireInterfaceProblem, Onf14DevicemanagerQNames.WIRE_INTERFACE_CURRENT_PROBLEMS_PROBLEM_NAME), InternalDataModelSeverity.mapSeverity(Onf14DMDOMUtility.getLeafValue(wireInterfaceProblem, - Onf14DevicemanagerQNames.WIRE_INTERFACE_CURRENT_PROBLEMS_PROBLEM_SEVERITY))); + Onf14DevicemanagerQNames.WIRE_INTERFACE_CURRENT_PROBLEMS_PROBLEM_SEVERITY))); } } else { log.debug("DBRead Id {} empty CurrentProblemList", ltpUuid); @@ -429,6 +495,7 @@ public class Onf14DomInterfacePacManager { } private void registerForNotifications() { + QName[] airInterfaceNotifications = {Onf14DevicemanagerQNames.AIR_INTERFACE_OBJECT_CREATE_NOTIFICATION, Onf14DevicemanagerQNames.AIR_INTERFACE_OBJECT_AVC_NOTIFICATION, Onf14DevicemanagerQNames.AIR_INTERFACE_OBJECT_DELETE_NOTIFICATION, @@ -455,4 +522,10 @@ public class Onf14DomInterfacePacManager { log.info("Reading Logical Termination Point data"); return netconfDomAccessor.readDataNode(LogicalDatastoreType.CONFIGURATION, LTP_IID); } + + public PerformanceDataLtp getLtpHistoricalPerformanceData(@NonNull TechnologySpecificPacKeys lp) { + PerformanceDataLtp res = new PerformanceDataLtp(); + readAirInterfaceHistoricalPerformanceData(lp.getLtpUuid(), lp.getLocalId(), res); + return res; + } } diff --git a/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/impl/pm/Helper.java b/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/impl/pm/Helper.java new file mode 100644 index 000000000..0a64f938e --- /dev/null +++ b/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/impl/pm/Helper.java @@ -0,0 +1,42 @@ +/* + * ============LICENSE_START======================================================================== + * ONAP : ccsdk feature sdnr wt + * ================================================================================================= + * Copyright (C) 2022 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.onf14.dom.impl.pm; + +import java.util.Map; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.GranularityPeriodType; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class Helper { + + private static Logger log = LoggerFactory.getLogger(Helper.class); + private static final Map<String, GranularityPeriodType> GRANULARITYMAP = + Map.of("GRANULARITY_PERIOD_TYPE_PERIOD-15-MIN", GranularityPeriodType.Period15Min, + "GRANULARITY_PERIOD_TYPE_PERIOD-24-HOURS", GranularityPeriodType.Period24Hours); + + public static GranularityPeriodType mapGranularityPeriod(String gp) { + log.debug("Granularity Period is - {}", gp); + GranularityPeriodType res = null; + if (gp != null) { + res = GRANULARITYMAP.get(gp); + } + return res == null ? GranularityPeriodType.Unknown : res; + } + +} diff --git a/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/impl/pm/PerformanceDataAirInterface.java b/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/impl/pm/PerformanceDataAirInterface.java new file mode 100644 index 000000000..8abdb1e8f --- /dev/null +++ b/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/impl/pm/PerformanceDataAirInterface.java @@ -0,0 +1,182 @@ +/* + * ============LICENSE_START======================================================================== + * ONAP : ccsdk feature sdnr wt + * ================================================================================================= + * Copyright (C) 2022 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.onf14.dom.impl.pm; + +import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.dom.impl.util.Onf14DMDOMUtility; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.dom.impl.util.Onf14DevicemanagerQNames; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.PmdataEntityBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.pmdata.entity.PerformanceDataBuilder; +import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId; +import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier; +import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode; +import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class PerformanceDataAirInterface extends PmdataEntityBuilder { + + private static final Logger log = LoggerFactory.getLogger(PerformanceDataAirInterface.class); + + public PerformanceDataAirInterface(NodeId nodeId, String ltpUuid, String localId, + MapEntryNode airInterfaceHistPerfEntry) { + log.debug("Performance Data of Air Interface = {}", airInterfaceHistPerfEntry); + String leafVal; + + this.setGranularityPeriod(Helper.mapGranularityPeriod(Onf14DMDOMUtility.getLeafValue(airInterfaceHistPerfEntry, + Onf14DevicemanagerQNames.AIR_INTERFACE_HISTORICAL_PERFORMANCES_LIST_GP))); + this.setUuidInterface(ltpUuid); + this.setLayerProtocolName(localId); // TODO + this.setNodeName(nodeId.getValue()); + this.setScannerId(Onf14DMDOMUtility.getLeafValue(airInterfaceHistPerfEntry, + Onf14DevicemanagerQNames.AIR_INTERFACE_HISTORICAL_PERFORMANCES_LIST_HDI)); + this.setTimeStamp(new DateAndTime(Onf14DMDOMUtility.getLeafValue(airInterfaceHistPerfEntry, + Onf14DevicemanagerQNames.AIR_INTERFACE_HISTORICAL_PERFORMANCES_LIST_PET))); + this.setSuspectIntervalFlag(Boolean.getBoolean(Onf14DMDOMUtility.getLeafValue(airInterfaceHistPerfEntry, + Onf14DevicemanagerQNames.AIR_INTERFACE_HISTORICAL_PERFORMANCES_LIST_SIF))); + + PerformanceDataBuilder bPerformanceData = new PerformanceDataBuilder(); + ContainerNode airInterfaceHistPerf = (ContainerNode) airInterfaceHistPerfEntry + .childByArg(new NodeIdentifier(Onf14DevicemanagerQNames.AIR_INTERFACE_HISTORICAL_PERFORMANCE_DATA)); + + if ((leafVal = Onf14DMDOMUtility.getLeafValue(airInterfaceHistPerf, + Onf14DevicemanagerQNames.AIR_INTERFACE_HISTORICAL_PERFORMANCE_ES)) != null) { + bPerformanceData.setEs(Integer.parseInt(leafVal)); + } + + if ((leafVal = Onf14DMDOMUtility.getLeafValue(airInterfaceHistPerf, + Onf14DevicemanagerQNames.AIR_INTERFACE_HISTORICAL_PERFORMANCE_SES)) != null) { + bPerformanceData.setSes(Integer.parseInt(leafVal)); + } + + if ((leafVal = Onf14DMDOMUtility.getLeafValue(airInterfaceHistPerf, + Onf14DevicemanagerQNames.AIR_INTERFACE_HISTORICAL_PERFORMANCE_CSES)) != null) { + bPerformanceData.setCses(Integer.parseInt(leafVal)); + } + + if ((leafVal = Onf14DMDOMUtility.getLeafValue(airInterfaceHistPerf, + Onf14DevicemanagerQNames.AIR_INTERFACE_HISTORICAL_PERFORMANCE_UNAVAILABILITY)) != null) { + bPerformanceData.setUnavailability(Integer.parseInt(leafVal)); + } + + if ((leafVal = Onf14DMDOMUtility.getLeafValue(airInterfaceHistPerf, + Onf14DevicemanagerQNames.AIR_INTERFACE_HISTORICAL_PERFORMANCE_TX_LEVEL_MIN)) != null) { + bPerformanceData.setTxLevelMin(Byte.parseByte(leafVal)); + } + + if ((leafVal = Onf14DMDOMUtility.getLeafValue(airInterfaceHistPerf, + Onf14DevicemanagerQNames.AIR_INTERFACE_HISTORICAL_PERFORMANCE_TX_LEVEL_MAX)) != null) { + bPerformanceData.setTxLevelMax(Byte.parseByte(leafVal)); + } + + if ((leafVal = Onf14DMDOMUtility.getLeafValue(airInterfaceHistPerf, + Onf14DevicemanagerQNames.AIR_INTERFACE_HISTORICAL_PERFORMANCE_TX_LEVEL_AVG)) != null) { + bPerformanceData.setTxLevelAvg(Byte.parseByte(leafVal)); + } + + if ((leafVal = Onf14DMDOMUtility.getLeafValue(airInterfaceHistPerf, + Onf14DevicemanagerQNames.AIR_INTERFACE_HISTORICAL_PERFORMANCE_RX_LEVEL_MIN)) != null) { + bPerformanceData.setTxLevelMin(Byte.parseByte(leafVal)); + } + + if ((leafVal = Onf14DMDOMUtility.getLeafValue(airInterfaceHistPerf, + Onf14DevicemanagerQNames.AIR_INTERFACE_HISTORICAL_PERFORMANCE_RX_LEVEL_MAX)) != null) { + bPerformanceData.setTxLevelMax(Byte.parseByte(leafVal)); + } + + if ((leafVal = Onf14DMDOMUtility.getLeafValue(airInterfaceHistPerf, + Onf14DevicemanagerQNames.AIR_INTERFACE_HISTORICAL_PERFORMANCE_RX_LEVEL_AVG)) != null) { + bPerformanceData.setTxLevelAvg(Byte.parseByte(leafVal)); + } + + + // //TODO: xstates-list 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()); + + + if ((leafVal = Onf14DMDOMUtility.getLeafValue(airInterfaceHistPerf, + Onf14DevicemanagerQNames.AIR_INTERFACE_HISTORICAL_PERFORMANCE_SNIR_MIN)) != null) { + bPerformanceData.setSnirMin(Byte.parseByte(leafVal)); + } + if ((leafVal = Onf14DMDOMUtility.getLeafValue(airInterfaceHistPerf, + Onf14DevicemanagerQNames.AIR_INTERFACE_HISTORICAL_PERFORMANCE_SNIR_MAX)) != null) { + bPerformanceData.setSnirMax(Byte.parseByte(leafVal)); + } + if ((leafVal = Onf14DMDOMUtility.getLeafValue(airInterfaceHistPerf, + Onf14DevicemanagerQNames.AIR_INTERFACE_HISTORICAL_PERFORMANCE_SNIR_AVG)) != null) { + bPerformanceData.setSnirAvg(Byte.parseByte(leafVal)); + } + + if ((leafVal = Onf14DMDOMUtility.getLeafValue(airInterfaceHistPerf, + Onf14DevicemanagerQNames.AIR_INTERFACE_HISTORICAL_PERFORMANCE_XPD_MIN)) != null) { + bPerformanceData.setXpdMin(Byte.parseByte(leafVal)); + } + if ((leafVal = Onf14DMDOMUtility.getLeafValue(airInterfaceHistPerf, + Onf14DevicemanagerQNames.AIR_INTERFACE_HISTORICAL_PERFORMANCE_XPD_MAX)) != null) { + bPerformanceData.setXpdMax(Byte.parseByte(leafVal)); + } + if ((leafVal = Onf14DMDOMUtility.getLeafValue(airInterfaceHistPerf, + Onf14DevicemanagerQNames.AIR_INTERFACE_HISTORICAL_PERFORMANCE_XPD_AVG)) != null) { + bPerformanceData.setXpdAvg(Byte.parseByte(leafVal)); + } + + if ((leafVal = Onf14DMDOMUtility.getLeafValue(airInterfaceHistPerf, + Onf14DevicemanagerQNames.AIR_INTERFACE_HISTORICAL_PERFORMANCE_RF_TEMP_MIN)) != null) { + bPerformanceData.setRfTempMin(Byte.parseByte(leafVal)); + } + if ((leafVal = Onf14DMDOMUtility.getLeafValue(airInterfaceHistPerf, + Onf14DevicemanagerQNames.AIR_INTERFACE_HISTORICAL_PERFORMANCE_RF_TEMP_MAX)) != null) { + bPerformanceData.setRfTempMax(Byte.parseByte(leafVal)); + } + if ((leafVal = Onf14DMDOMUtility.getLeafValue(airInterfaceHistPerf, + Onf14DevicemanagerQNames.AIR_INTERFACE_HISTORICAL_PERFORMANCE_RF_TEMP_AVG)) != null) { + bPerformanceData.setRfTempAvg(Byte.parseByte(leafVal)); + } + + if ((leafVal = Onf14DMDOMUtility.getLeafValue(airInterfaceHistPerf, + Onf14DevicemanagerQNames.AIR_INTERFACE_HISTORICAL_PERFORMANCE_DEFECT_BLOCKS_SUM)) != null) { + bPerformanceData.setDefectBlocksSum(Short.valueOf(leafVal)); + } + + if ((leafVal = Onf14DMDOMUtility.getLeafValue(airInterfaceHistPerf, + Onf14DevicemanagerQNames.AIR_INTERFACE_HISTORICAL_PERFORMANCE_TIME_PERIOD)) != null) { + bPerformanceData.setTimePeriod(Integer.parseInt(leafVal)); + } + + this.setPerformanceData(bPerformanceData.build()); + } +} diff --git a/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/impl/util/Debug.java b/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/impl/util/Debug.java index 978c71e31..1af1da617 100644 --- a/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/impl/util/Debug.java +++ b/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/impl/util/Debug.java @@ -27,23 +27,7 @@ import org.slf4j.LoggerFactory; public class Debug { - // constants private static final Logger log = LoggerFactory.getLogger(Debug.class); - // end of constants - - // variables - // end of variables - - // constructors - // end of constructors - - // getters and setters - // end of getters and setters - - // private methods - // end of private methods - - // public methods /** * LOG the newly added problems of the interface pac * @@ -62,11 +46,4 @@ public class Debug { } log.debug("Found problems {} {}", uuid, sb); } - // end of public methods - - // static methods - // end of static methods - - // private classes - // end of private classes } diff --git a/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/impl/util/Onf14DMDOMUtility.java b/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/impl/util/Onf14DMDOMUtility.java index 1cae567ff..ae1884dcb 100644 --- a/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/impl/util/Onf14DMDOMUtility.java +++ b/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/impl/util/Onf14DMDOMUtility.java @@ -1,3 +1,24 @@ +/* + * ============LICENSE_START======================================================= + * ONAP : ccsdk features + * ================================================================================ + * Copyright (C) 2022 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.onf14.dom.impl.util; import com.google.common.base.VerifyException; @@ -30,9 +51,11 @@ public class Onf14DMDOMUtility { try { LeafNode<?> optLeafNode = (LeafNode<?>) componentEntry.getChildByArg(leafNodeIdentifier); if (optLeafNode.body() instanceof QName) { - LOG.debug("Leaf is of type QName"); //Ex: ImmutableLeafNode{identifier=(urn:onf:yang:air-interface-2-0?revision=2020-01-21)severity, body=(urn:onf:yang:air-interface-2-0?revision=2020-01-21)SEVERITY_TYPE_MAJOR} + LOG.debug("Leaf is of type QName"); // Ex: + // ImmutableLeafNode{identifier=(urn:onf:yang:air-interface-2-0?revision=2020-01-21)severity, + // body=(urn:onf:yang:air-interface-2-0?revision=2020-01-21)SEVERITY_TYPE_MAJOR} String severity_ = optLeafNode.body().toString(); - return severity_.substring(severity_.indexOf(')')+1); //Any other solution?? + return severity_.substring(severity_.indexOf(')') + 1); // Any other solution?? } return optLeafNode.body().toString(); } catch (VerifyException ve) { @@ -74,4 +97,5 @@ public class Onf14DMDOMUtility { return Instant.now(); } } + } diff --git a/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/impl/util/Onf14DevicemanagerQNames.java b/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/impl/util/Onf14DevicemanagerQNames.java index 58abf021f..f4fd2118f 100644 --- a/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/impl/util/Onf14DevicemanagerQNames.java +++ b/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/impl/util/Onf14DevicemanagerQNames.java @@ -1,3 +1,24 @@ +/* + * ============LICENSE_START======================================================= + * ONAP : ccsdk features + * ================================================================================ + * Copyright (C) 2022 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.onf14.dom.impl.util; import org.opendaylight.yangtools.yang.common.QName; @@ -61,6 +82,8 @@ public class Onf14DevicemanagerQNames { // Air-interface public static final QNameModule AIR_INTERFACE_2_0_MODULE = QNameModule.create(XMLNamespace.of("urn:onf:yang:air-interface-2-0"), Revision.of("2020-01-21")); + public static final QName AIR_INTERFACE_2_0_MODULE_NS = + QName.create(XMLNamespace.of("urn:onf:yang:air-interface-2-0"), "air-interface-2-0"); public static final QName AIR_INTERFACE_PAC = QName.create(AIR_INTERFACE_2_0_MODULE, "air-interface-pac"); public static final QName AIR_INTERFACE_CURRENT_PROBLEMS = QName.create(AIR_INTERFACE_2_0_MODULE, "air-interface-current-problems"); @@ -74,6 +97,81 @@ public class Onf14DevicemanagerQNames { QName.create(AIR_INTERFACE_2_0_MODULE, "problem-name"); public static final QName AIR_INTERFACE_CURRENT_PROBLEMS_PROBLEM_SEVERITY = QName.create(AIR_INTERFACE_2_0_MODULE, "problem-severity"); + + // Historical Performance + public static final QName AIR_INTERFACE_HISTORICAL_PERFORMANCES = + QName.create(AIR_INTERFACE_2_0_MODULE, "air-interface-historical-performances"); + public static final QName AIR_INTERFACE_HISTORICAL_PERFORMANCES_LIST = + QName.create(AIR_INTERFACE_2_0_MODULE, "historical-performance-data-list"); + public static final QName AIR_INTERFACE_HISTORICAL_PERFORMANCES_LIST_GP = + QName.create(AIR_INTERFACE_2_0_MODULE, "granularity-period"); + public static final QName AIR_INTERFACE_HISTORICAL_PERFORMANCES_LIST_SIF = + QName.create(AIR_INTERFACE_2_0_MODULE, "suspect-interval-flag"); + public static final QName AIR_INTERFACE_HISTORICAL_PERFORMANCES_LIST_HDI = + QName.create(AIR_INTERFACE_2_0_MODULE, "history-data-id"); + public static final QName AIR_INTERFACE_HISTORICAL_PERFORMANCES_LIST_PET = + QName.create(AIR_INTERFACE_2_0_MODULE, "period-end-time"); + public static final QName AIR_INTERFACE_HISTORICAL_PERFORMANCE_DATA = + QName.create(AIR_INTERFACE_2_0_MODULE, "performance-data"); + + public static final QName AIR_INTERFACE_HISTORICAL_PERFORMANCE_ES = QName.create(AIR_INTERFACE_2_0_MODULE, "es"); + public static final QName AIR_INTERFACE_HISTORICAL_PERFORMANCE_SES = QName.create(AIR_INTERFACE_2_0_MODULE, "ses"); + public static final QName AIR_INTERFACE_HISTORICAL_PERFORMANCE_CSES = + QName.create(AIR_INTERFACE_2_0_MODULE, "cses"); + + public static final QName AIR_INTERFACE_HISTORICAL_PERFORMANCE_UNAVAILABILITY = + QName.create(AIR_INTERFACE_2_0_MODULE, "unavailability"); + + public static final QName AIR_INTERFACE_HISTORICAL_PERFORMANCE_TX_LEVEL_MIN = + QName.create(AIR_INTERFACE_2_0_MODULE, "tx-level-min"); + public static final QName AIR_INTERFACE_HISTORICAL_PERFORMANCE_TX_LEVEL_MAX = + QName.create(AIR_INTERFACE_2_0_MODULE, "tx-level-max"); + public static final QName AIR_INTERFACE_HISTORICAL_PERFORMANCE_TX_LEVEL_AVG = + QName.create(AIR_INTERFACE_2_0_MODULE, "tx-level-avg"); + + public static final QName AIR_INTERFACE_HISTORICAL_PERFORMANCE_RX_LEVEL_MIN = + QName.create(AIR_INTERFACE_2_0_MODULE, "rx-level-min"); + public static final QName AIR_INTERFACE_HISTORICAL_PERFORMANCE_RX_LEVEL_MAX = + QName.create(AIR_INTERFACE_2_0_MODULE, "rx-level-max"); + public static final QName AIR_INTERFACE_HISTORICAL_PERFORMANCE_RX_LEVEL_AVG = + QName.create(AIR_INTERFACE_2_0_MODULE, "rx-level-avg"); + + public static final QName AIR_INTERFACE_HISTORICAL_PERFORMANCE_TIME_XSTATES_LIST = + QName.create(AIR_INTERFACE_2_0_MODULE, "time-xstates-list"); + public static final QName AIR_INTERFACE_HISTORICAL_PERFORMANCE_TIME_XSTATE_SEQNO = + QName.create(AIR_INTERFACE_2_0_MODULE, "time-xstate-sequence-number"); + public static final QName AIR_INTERFACE_HISTORICAL_PERFORMANCE_TIME_XSTATE_TX_MODE = + QName.create(AIR_INTERFACE_2_0_MODULE, "transmission-mode"); + public static final QName AIR_INTERFACE_HISTORICAL_PERFORMANCE_TIME_XSTATE_TIME = + QName.create(AIR_INTERFACE_2_0_MODULE, "time"); + + public static final QName AIR_INTERFACE_HISTORICAL_PERFORMANCE_SNIR_MIN = + QName.create(AIR_INTERFACE_2_0_MODULE, "snir-min"); + public static final QName AIR_INTERFACE_HISTORICAL_PERFORMANCE_SNIR_MAX = + QName.create(AIR_INTERFACE_2_0_MODULE, "snir-max"); + public static final QName AIR_INTERFACE_HISTORICAL_PERFORMANCE_SNIR_AVG = + QName.create(AIR_INTERFACE_2_0_MODULE, "snir-avg"); + + public static final QName AIR_INTERFACE_HISTORICAL_PERFORMANCE_XPD_MIN = + QName.create(AIR_INTERFACE_2_0_MODULE, "xpd-min"); + public static final QName AIR_INTERFACE_HISTORICAL_PERFORMANCE_XPD_MAX = + QName.create(AIR_INTERFACE_2_0_MODULE, "xpd-max"); + public static final QName AIR_INTERFACE_HISTORICAL_PERFORMANCE_XPD_AVG = + QName.create(AIR_INTERFACE_2_0_MODULE, "xpd-avg"); + + public static final QName AIR_INTERFACE_HISTORICAL_PERFORMANCE_RF_TEMP_MIN = + QName.create(AIR_INTERFACE_2_0_MODULE, "rf-temp-min"); + public static final QName AIR_INTERFACE_HISTORICAL_PERFORMANCE_RF_TEMP_MAX = + QName.create(AIR_INTERFACE_2_0_MODULE, "rf-temp-max"); + public static final QName AIR_INTERFACE_HISTORICAL_PERFORMANCE_RF_TEMP_AVG = + QName.create(AIR_INTERFACE_2_0_MODULE, "rf-temp-avg"); + + public static final QName AIR_INTERFACE_HISTORICAL_PERFORMANCE_DEFECT_BLOCKS_SUM = + QName.create(AIR_INTERFACE_2_0_MODULE, "defect-blocks-sum"); + public static final QName AIR_INTERFACE_HISTORICAL_PERFORMANCE_TIME_PERIOD = + QName.create(AIR_INTERFACE_2_0_MODULE, "time-period"); + + // Creation notification public static final QName AIR_INTERFACE_OBJECT_CREATE_NOTIFICATION = QName.create(AIR_INTERFACE_2_0_MODULE, "object-creation-notification"); @@ -124,6 +222,8 @@ public class Onf14DevicemanagerQNames { // Ethernet interface public static final QNameModule ETHERNET_CONTAINER_2_0_MODULE = QNameModule.create(XMLNamespace.of("urn:onf:yang:ethernet-container-2-0"), Revision.of("2020-01-21")); + public static final QName ETHERNET_CONTAINER_2_0_NS = + QName.create(XMLNamespace.of("urn:onf:yang:ethernet-container-2-0"), "ethernet-container-2-0"); public static final QName ETHERNET_CONTAINER_PAC = QName.create(ETHERNET_CONTAINER_2_0_MODULE, "ethernet-container-pac"); public static final QName ETHERNET_CONTAINER_CURRENT_PROBLEMS = @@ -188,6 +288,8 @@ public class Onf14DevicemanagerQNames { //Wire interface public static final QNameModule WIRE_INTERFACE_2_0_MODULE = QNameModule.create(XMLNamespace.of("urn:onf:yang:wire-interface-2-0"), Revision.of("2020-01-23")); + public static final QName WIRE_INTERFACE_2_0_NS = + QName.create(XMLNamespace.of("urn:onf:yang:wire-interface-2-0"), "wire-interface-2-0"); public static final QName WIRE_INTERFACE_PAC = QName.create(WIRE_INTERFACE_2_0_MODULE, "wire-interface-pac"); public static final QName WIRE_INTERFACE_CURRENT_PROBLEMS = QName.create(WIRE_INTERFACE_2_0_MODULE, "wire-interface-current-problems"); diff --git a/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/impl/Onf14DomAirInterfaceNotificationListener.java b/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/notifications/Onf14DomAirInterfaceNotificationListener.java index c510a1ae6..e32ca0134 100644 --- a/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/impl/Onf14DomAirInterfaceNotificationListener.java +++ b/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/notifications/Onf14DomAirInterfaceNotificationListener.java @@ -19,7 +19,7 @@ * ============LICENSE_END========================================================= * */ -package org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.dom.impl; +package org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.dom.notifications; import org.eclipse.jdt.annotation.NonNull; import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.dom.impl.dataprovider.InternalDataModelSeverity; @@ -120,21 +120,20 @@ public class Onf14DomAirInterfaceNotificationListener implements DOMNotification private void onObjectProblemNotification(@NonNull DOMNotification domNotification) { ContainerNode cn = domNotification.getBody(); - FaultlogEntity faultAlarm = - new FaultlogBuilder() - .setObjectId(Onf14DMDOMUtility.getLeafValue(cn, - Onf14DevicemanagerQNames.AIR_INTERFACE_OBJECT_PROBLEM_NOTIFICATION_OBJECT_ID_REF)) - .setProblem(Onf14DMDOMUtility.getLeafValue(cn, - Onf14DevicemanagerQNames.AIR_INTERFACE_OBJECT_PROBLEM_NOTIFICATION_PROBLEM)) - .setSourceType(SourceType.Netconf) - .setTimestamp(new DateAndTime(Onf14DMDOMUtility.getLeafValue(cn, - Onf14DevicemanagerQNames.AIR_INTERFACE_OBJECT_PROBLEM_NOTIFICATION_TIMESTAMP))) - .setNodeId(this.netconfDomAccessor.getNodeId().getValue()) - .setSeverity(InternalDataModelSeverity.mapSeverity(Onf14DMDOMUtility.getLeafValue(cn, - Onf14DevicemanagerQNames.AIR_INTERFACE_OBJECT_PROBLEM_NOTIFICATION_SEVERITY))) - .setCounter(Integer.parseInt(Onf14DMDOMUtility.getLeafValue(cn, - Onf14DevicemanagerQNames.AIR_INTERFACE_OBJECT_PROBLEM_NOTIFICATION_COUNTER))) - .build(); + FaultlogEntity faultAlarm = new FaultlogBuilder() + .setObjectId(Onf14DMDOMUtility.getLeafValue(cn, + Onf14DevicemanagerQNames.AIR_INTERFACE_OBJECT_PROBLEM_NOTIFICATION_OBJECT_ID_REF)) + .setProblem(Onf14DMDOMUtility.getLeafValue(cn, + Onf14DevicemanagerQNames.AIR_INTERFACE_OBJECT_PROBLEM_NOTIFICATION_PROBLEM)) + .setSourceType(SourceType.Netconf) + .setTimestamp(new DateAndTime(Onf14DMDOMUtility.getLeafValue(cn, + Onf14DevicemanagerQNames.AIR_INTERFACE_OBJECT_PROBLEM_NOTIFICATION_TIMESTAMP))) + .setNodeId(this.netconfDomAccessor.getNodeId().getValue()) + .setSeverity(InternalDataModelSeverity.mapSeverity(Onf14DMDOMUtility.getLeafValue(cn, + Onf14DevicemanagerQNames.AIR_INTERFACE_OBJECT_PROBLEM_NOTIFICATION_SEVERITY))) + .setCounter(Integer.parseInt(Onf14DMDOMUtility.getLeafValue(cn, + Onf14DevicemanagerQNames.AIR_INTERFACE_OBJECT_PROBLEM_NOTIFICATION_COUNTER))) + .build(); serviceProvider.getFaultService().faultNotification(faultAlarm); serviceProvider.getWebsocketService().sendNotification(domNotification, netconfDomAccessor.getNodeId(), diff --git a/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/impl/Onf14DomEthernetContainerNotificationListener.java b/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/notifications/Onf14DomEthernetContainerNotificationListener.java index 5aa069efb..3f2b95e93 100644 --- a/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/impl/Onf14DomEthernetContainerNotificationListener.java +++ b/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/notifications/Onf14DomEthernetContainerNotificationListener.java @@ -1,4 +1,4 @@ -package org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.dom.impl; +package org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.dom.notifications; import org.eclipse.jdt.annotation.NonNull; import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.dom.impl.dataprovider.InternalDataModelSeverity; diff --git a/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/impl/Onf14DomWireInterfaceNotificationListener.java b/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/notifications/Onf14DomWireInterfaceNotificationListener.java index 401fbbe8d..9e7b35bc2 100644 --- a/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/impl/Onf14DomWireInterfaceNotificationListener.java +++ b/sdnr/wt/devicemanager-onap/onf14/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/notifications/Onf14DomWireInterfaceNotificationListener.java @@ -1,4 +1,4 @@ -package org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.dom.impl; +package org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.dom.notifications; import org.eclipse.jdt.annotation.NonNull; import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.dom.impl.dataprovider.InternalDataModelSeverity; @@ -73,20 +73,19 @@ public class Onf14DomWireInterfaceNotificationListener implements DOMNotificatio public void onProblemNotification(DOMNotification notification) { ContainerNode cn = notification.getBody(); - FaultlogEntity faultAlarm = - new FaultlogBuilder() - .setObjectId(Onf14DMDOMUtility.getLeafValue(cn, - Onf14DevicemanagerQNames.WIRE_INTERFACE_OBJECT_PROBLEM_NOTIFICATION_OBJECT_ID_REF)) - .setProblem(Onf14DMDOMUtility.getLeafValue(cn, - Onf14DevicemanagerQNames.WIRE_INTERFACE_OBJECT_PROBLEM_NOTIFICATION_PROBLEM)) - .setTimestamp(new DateAndTime(Onf14DMDOMUtility.getLeafValue(cn, - Onf14DevicemanagerQNames.WIRE_INTERFACE_OBJECT_PROBLEM_NOTIFICATION_TIMESTAMP))) - .setNodeId(this.netconfDomAccessor.getNodeId().getValue()).setSourceType(SourceType.Netconf) - .setSeverity(InternalDataModelSeverity.mapSeverity(Onf14DMDOMUtility.getLeafValue(cn, - Onf14DevicemanagerQNames.WIRE_INTERFACE_OBJECT_PROBLEM_NOTIFICATION_SEVERITY))) - .setCounter(Integer.parseInt(Onf14DMDOMUtility.getLeafValue(cn, - Onf14DevicemanagerQNames.WIRE_INTERFACE_OBJECT_PROBLEM_NOTIFICATION_COUNTER))) - .build(); + FaultlogEntity faultAlarm = new FaultlogBuilder() + .setObjectId(Onf14DMDOMUtility.getLeafValue(cn, + Onf14DevicemanagerQNames.WIRE_INTERFACE_OBJECT_PROBLEM_NOTIFICATION_OBJECT_ID_REF)) + .setProblem(Onf14DMDOMUtility.getLeafValue(cn, + Onf14DevicemanagerQNames.WIRE_INTERFACE_OBJECT_PROBLEM_NOTIFICATION_PROBLEM)) + .setTimestamp(new DateAndTime(Onf14DMDOMUtility.getLeafValue(cn, + Onf14DevicemanagerQNames.WIRE_INTERFACE_OBJECT_PROBLEM_NOTIFICATION_TIMESTAMP))) + .setNodeId(this.netconfDomAccessor.getNodeId().getValue()).setSourceType(SourceType.Netconf) + .setSeverity(InternalDataModelSeverity.mapSeverity(Onf14DMDOMUtility.getLeafValue(cn, + Onf14DevicemanagerQNames.WIRE_INTERFACE_OBJECT_PROBLEM_NOTIFICATION_SEVERITY))) + .setCounter(Integer.parseInt(Onf14DMDOMUtility.getLeafValue(cn, + Onf14DevicemanagerQNames.WIRE_INTERFACE_OBJECT_PROBLEM_NOTIFICATION_COUNTER))) + .build(); serviceProvider.getFaultService().faultNotification(faultAlarm); serviceProvider.getWebsocketService().sendNotification(notification, netconfDomAccessor.getNodeId(), Onf14DevicemanagerQNames.WIRE_INTERFACE_OBJECT_PROBLEM_NOTIFICATION, diff --git a/sdnr/wt/devicemanager-onap/onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/TestOnf14DomAirInterfaceNotificationListener.java b/sdnr/wt/devicemanager-onap/onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/TestOnf14DomAirInterfaceNotificationListener.java index a8e97e173..9b647a198 100644 --- a/sdnr/wt/devicemanager-onap/onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/TestOnf14DomAirInterfaceNotificationListener.java +++ b/sdnr/wt/devicemanager-onap/onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/TestOnf14DomAirInterfaceNotificationListener.java @@ -23,8 +23,8 @@ import org.junit.Before; import org.junit.Test; import org.mockito.Mockito; import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DataProvider; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.dom.impl.Onf14DomAirInterfaceNotificationListener; import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.dom.impl.util.Onf14DevicemanagerQNames; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.dom.notifications.Onf14DomAirInterfaceNotificationListener; import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.util.NetconfDeviceNotification; import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServiceProvider; import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.FaultService; diff --git a/sdnr/wt/devicemanager-onap/onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/TestOnf14DomEthernetContainerNotificationListener.java b/sdnr/wt/devicemanager-onap/onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/TestOnf14DomEthernetContainerNotificationListener.java index c2f7984a2..0b0c3aa6e 100644 --- a/sdnr/wt/devicemanager-onap/onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/TestOnf14DomEthernetContainerNotificationListener.java +++ b/sdnr/wt/devicemanager-onap/onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/TestOnf14DomEthernetContainerNotificationListener.java @@ -22,8 +22,8 @@ import org.junit.Before; import org.junit.Test; import org.mockito.Mockito; import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DataProvider; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.dom.impl.Onf14DomEthernetContainerNotificationListener; import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.dom.impl.util.Onf14DevicemanagerQNames; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.dom.notifications.Onf14DomEthernetContainerNotificationListener; import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.util.NetconfDeviceNotification; import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServiceProvider; import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.FaultService; diff --git a/sdnr/wt/devicemanager-onap/onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/TestOnf14DomNetworkElement.java b/sdnr/wt/devicemanager-onap/onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/TestOnf14DomNetworkElement.java index 0d30e4dd0..555bfd88d 100644 --- a/sdnr/wt/devicemanager-onap/onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/TestOnf14DomNetworkElement.java +++ b/sdnr/wt/devicemanager-onap/onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/TestOnf14DomNetworkElement.java @@ -15,6 +15,7 @@ import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.dom.impl.Onf14DomNetw import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.dom.impl.util.Onf14DevicemanagerQNames; import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServiceProvider; import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.FaultService; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.PerformanceManager; 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.NetconfDomAccessor; @@ -39,6 +40,8 @@ public class TestOnf14DomNetworkElement { @Mock FaultService faultService; @Mock + PerformanceManager pmService; + @Mock DeviceManagerServiceProvider serviceProvider; @Mock WebsocketManagerService websocketManagerService; @@ -60,14 +63,14 @@ public class TestOnf14DomNetworkElement { when(netconfDomAccessor.getNodeId()).thenReturn(nodeId); when(serviceProvider.getDataProvider()).thenReturn(dataProvider); when(serviceProvider.getFaultService()).thenReturn(faultService); + when(serviceProvider.getPerformanceManagerService()).thenReturn(pmService); when(netconfDomAccessor.readDataNode(LogicalDatastoreType.CONFIGURATION, TOPLEVELEQUIPMENT_IID)) .thenReturn(Optional.empty()); } @Test - public void test() { + public void testWithOldInterfaceRevisions() { Optional<NetworkElement> onfDomNe; - Onf14DomNetworkElementFactory factory = new Onf14DomNetworkElementFactory(); factory.init(serviceProvider); onfDomNe = factory.create(netconfDomAccessor, serviceProvider); @@ -78,7 +81,7 @@ public class TestOnf14DomNetworkElement { onfDomNe.get().getAcessor(); onfDomNe.get().getDeviceType(); onfDomNe.get().warmstart(); - onfDomNe.get().getService(null); + //onfDomNe.get().getService(null); assertEquals(onfDomNe.get().getNodeId().getValue(), "nSky"); } diff --git a/sdnr/wt/devicemanager-onap/onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/TestOnf14DomWireInterfaceNotificationListener.java b/sdnr/wt/devicemanager-onap/onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/TestOnf14DomWireInterfaceNotificationListener.java index 37cd5b45a..954acde78 100644 --- a/sdnr/wt/devicemanager-onap/onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/TestOnf14DomWireInterfaceNotificationListener.java +++ b/sdnr/wt/devicemanager-onap/onf14/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf14/dom/TestOnf14DomWireInterfaceNotificationListener.java @@ -23,8 +23,8 @@ import org.junit.Before; import org.junit.Test; import org.mockito.Mockito; import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DataProvider; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.dom.impl.Onf14DomWireInterfaceNotificationListener; import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.dom.impl.util.Onf14DevicemanagerQNames; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.dom.notifications.Onf14DomWireInterfaceNotificationListener; import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf14.util.NetconfDeviceNotification; import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServiceProvider; import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.FaultService; diff --git a/sdnr/wt/helpserver/provider/pom.xml b/sdnr/wt/helpserver/provider/pom.xml index e30263e87..5251d6c96 100644 --- a/sdnr/wt/helpserver/provider/pom.xml +++ b/sdnr/wt/helpserver/provider/pom.xml @@ -22,6 +22,7 @@ ~ ============LICENSE_END======================================================= ~ --> + <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> @@ -45,8 +46,8 @@ <dependencies> <dependency> - <groupId>javax.servlet</groupId> - <artifactId>javax.servlet-api</artifactId> + <groupId>jakarta.servlet</groupId> + <artifactId>jakarta.servlet-api</artifactId> <scope>provided</scope> </dependency> <dependency> @@ -60,11 +61,6 @@ <scope>provided</scope> </dependency> <dependency> - <groupId>org.osgi</groupId> - <artifactId>org.osgi.compendium</artifactId> - <scope>provided</scope> - </dependency> - <dependency> <groupId>org.mockito</groupId> <artifactId>mockito-core</artifactId> <scope>test</scope> @@ -75,6 +71,12 @@ <version>${project.version}</version> <scope>test</scope> </dependency> + <dependency> + <groupId>org.osgi</groupId> + <artifactId>osgi.cmpn</artifactId> + <version>7.0.0</version> + <scope>compile</scope> + </dependency> </dependencies> <build> diff --git a/sdnr/wt/helpserver/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/helpserver/HelpServlet.java b/sdnr/wt/helpserver/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/helpserver/HelpServlet.java index e9470ab09..ddd684019 100644 --- a/sdnr/wt/helpserver/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/helpserver/HelpServlet.java +++ b/sdnr/wt/helpserver/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/helpserver/HelpServlet.java @@ -26,14 +26,21 @@ import java.io.OutputStream; import java.net.URISyntaxException; import java.net.URLDecoder; import java.nio.file.Path; +import javax.servlet.Servlet; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.onap.ccsdk.features.sdnr.wt.helpserver.data.HelpInfrastructureObject; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.http.whiteboard.propertytypes.HttpWhiteboardServletName; +import org.osgi.service.http.whiteboard.propertytypes.HttpWhiteboardServletPattern; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +@HttpWhiteboardServletPattern("/help/*") +@HttpWhiteboardServletName("HelpServlet") +@Component(service = Servlet.class) public class HelpServlet extends HttpServlet implements AutoCloseable { private static Logger LOG = LoggerFactory.getLogger(HelpServlet.class); diff --git a/sdnr/wt/helpserver/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/helpserver/data/HelpInfrastructureObject.java b/sdnr/wt/helpserver/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/helpserver/data/HelpInfrastructureObject.java index 35dbeec9f..4adb54dea 100644 --- a/sdnr/wt/helpserver/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/helpserver/data/HelpInfrastructureObject.java +++ b/sdnr/wt/helpserver/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/helpserver/data/HelpInfrastructureObject.java @@ -144,7 +144,7 @@ public class HelpInfrastructureObject extends JSONObject { public static void createFilesFromResources() { if (KARAFHELPDIRECTORY.exists()) { - LOG.info("Delete existing directory"); + LOG.debug("Delete existing directory"); try { ExtactBundleResource.deleteRecursively(KARAFHELPDIRECTORY); } catch (IOException e1) { @@ -152,17 +152,17 @@ public class HelpInfrastructureObject extends JSONObject { } } - LOG.info("Extract"); + LOG.debug("Extract"); try { Bundle b = FrameworkUtil.getBundle(HelpInfrastructureObject.class); if (b == null) { - LOG.info("No bundlereference: Use target in filesystem."); + LOG.debug("No bundlereference: Use target in filesystem."); // URL helpRessource = // JarFileUtils.stringToJarURL("target/helpserver-impl-0.4.0-SNAPSHOT.jar",KARAFBUNDLERESOURCEHELPROOT); } else { - LOG.info("Bundle location:{} State:{}", b.getLocation(), b.getState()); - LOG.info("Write files from Resource"); + LOG.debug("Bundle location:{} State:{}", b.getLocation(), b.getState()); + LOG.debug("Write files from Resource"); ExtactBundleResource.copyBundleResoucesRecursively(b, "data/cache/com.highstreet.technologies.", KARAFBUNDLERESOURCEHELPROOT); } diff --git a/sdnr/wt/helpserver/provider/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/sdnr/wt/helpserver/provider/src/main/resources/OSGI-INF/blueprint/blueprint.xml index 387aa4557..354e8029f 100644 --- a/sdnr/wt/helpserver/provider/src/main/resources/OSGI-INF/blueprint/blueprint.xml +++ b/sdnr/wt/helpserver/provider/src/main/resources/OSGI-INF/blueprint/blueprint.xml @@ -28,10 +28,5 @@ <bean id="helpServlet" class="org.onap.ccsdk.features.sdnr.wt.helpserver.HelpServlet"> </bean> - - <service interface="javax.servlet.http.HttpServlet" ref="helpServlet"> - <service-properties> - <entry key="alias" value="/help"/> - </service-properties> - </service> + </blueprint> |