diff options
244 files changed, 2540 insertions, 3277 deletions
diff --git a/aafshiro/features/ccsdk-aafshiro/pom.xml b/aafshiro/features/ccsdk-aafshiro/pom.xml index 570520def..d0f68ef9f 100755 --- a/aafshiro/features/ccsdk-aafshiro/pom.xml +++ b/aafshiro/features/ccsdk-aafshiro/pom.xml @@ -27,7 +27,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>single-feature-parent</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/aafshiro/features/features-aafshiro/pom.xml b/aafshiro/features/features-aafshiro/pom.xml index 77ea8ca77..12374aece 100755 --- a/aafshiro/features/features-aafshiro/pom.xml +++ b/aafshiro/features/features-aafshiro/pom.xml @@ -27,7 +27,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>feature-repo-parent</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/aafshiro/features/pom.xml b/aafshiro/features/pom.xml index 8ee604c93..4c2454990 100755 --- a/aafshiro/features/pom.xml +++ b/aafshiro/features/pom.xml @@ -27,7 +27,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>odlparent-lite</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/aafshiro/installer/pom.xml b/aafshiro/installer/pom.xml index 8133496ff..55f997caf 100755 --- a/aafshiro/installer/pom.xml +++ b/aafshiro/installer/pom.xml @@ -27,7 +27,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>odlparent-lite</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/aafshiro/pom.xml b/aafshiro/pom.xml index 1ace6f85f..95470e43b 100755 --- a/aafshiro/pom.xml +++ b/aafshiro/pom.xml @@ -27,7 +27,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>odlparent-lite</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/features/ccsdk-features-all/pom.xml b/features/ccsdk-features-all/pom.xml index cebc35214..3c938ed65 100644 --- a/features/ccsdk-features-all/pom.xml +++ b/features/ccsdk-features-all/pom.xml @@ -27,7 +27,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>single-feature-parent</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/features/features-features/pom.xml b/features/features-features/pom.xml index 596fd269a..f6043b8f4 100644 --- a/features/features-features/pom.xml +++ b/features/features-features/pom.xml @@ -27,7 +27,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>feature-repo-parent</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/features/installer/pom.xml b/features/installer/pom.xml index 4735006d6..c9ab47cf3 100755 --- a/features/installer/pom.xml +++ b/features/installer/pom.xml @@ -27,7 +27,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>odlparent-lite</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/features/pom.xml b/features/pom.xml index 867c8ff8f..ae9327dc6 100755 --- a/features/pom.xml +++ b/features/pom.xml @@ -27,7 +27,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>odlparent-lite</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> @@ -25,7 +25,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>odlparent-lite</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/apigateway/feature/pom.xml b/sdnr/wt/apigateway/feature/pom.xml index 3987f29bf..7ff391f35 100644 --- a/sdnr/wt/apigateway/feature/pom.xml +++ b/sdnr/wt/apigateway/feature/pom.xml @@ -28,7 +28,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>single-feature-parent</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/apigateway/installer/pom.xml b/sdnr/wt/apigateway/installer/pom.xml index a813a31dd..b2d99962d 100755 --- a/sdnr/wt/apigateway/installer/pom.xml +++ b/sdnr/wt/apigateway/installer/pom.xml @@ -25,7 +25,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>odlparent-lite</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/apigateway/pom.xml b/sdnr/wt/apigateway/pom.xml index e5112c098..64458cc56 100755 --- a/sdnr/wt/apigateway/pom.xml +++ b/sdnr/wt/apigateway/pom.xml @@ -28,7 +28,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>odlparent-lite</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/apigateway/provider/pom.xml b/sdnr/wt/apigateway/provider/pom.xml index 837cdbd85..d283f6e8b 100644 --- a/sdnr/wt/apigateway/provider/pom.xml +++ b/sdnr/wt/apigateway/provider/pom.xml @@ -28,7 +28,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>binding-parent</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/common-yang/iana-crypt-hash/pom.xml b/sdnr/wt/common-yang/iana-crypt-hash/pom.xml index e7e9aee49..9e0dcf80a 100755 --- a/sdnr/wt/common-yang/iana-crypt-hash/pom.xml +++ b/sdnr/wt/common-yang/iana-crypt-hash/pom.xml @@ -20,13 +20,14 @@ ~ ============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.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> 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 deleted file mode 100644 index 7e8327a09..000000000 --- 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 +++ /dev/null @@ -1,23 +0,0 @@ -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 deleted file mode 100644 index 7c4a63d2b..000000000 --- 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 +++ /dev/null @@ -1,23 +0,0 @@ -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 deleted file mode 100644 index 282a6a26d..000000000 --- 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 +++ /dev/null @@ -1,23 +0,0 @@ -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 deleted file mode 100644 index 81391922d..000000000 --- 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 +++ /dev/null @@ -1,23 +0,0 @@ -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 deleted file mode 100644 index 9f10ae87f..000000000 --- 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 +++ /dev/null @@ -1,23 +0,0 @@ -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 deleted file mode 100644 index a1c195faf..000000000 --- a/sdnr/wt/common-yang/ietf-alarms/src/main/yang/ietf-alarms@2019-09-11.yang +++ /dev/null @@ -1,1526 +0,0 @@ -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/onap/pom.xml b/sdnr/wt/common-yang/onap/pom.xml deleted file mode 100755 index 5817f6295..000000000 --- a/sdnr/wt/common-yang/onap/pom.xml +++ /dev/null @@ -1,47 +0,0 @@ -<?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.3</version> - <relativePath/> - </parent> - - <groupId>org.onap.ccsdk.features.sdnr.wt</groupId> - <artifactId>onap-system</artifactId> - <version>1.5.1-SNAPSHOT</version> - <packaging>bundle</packaging> - - <name>ccsdk-features :: ${project.artifactId}</name> - - <dependencies> - <dependency> - <groupId>org.onap.ccsdk.features.sdnr.wt</groupId> - <artifactId>rfc7317-ietf-system</artifactId> - <version>1.5.1-SNAPSHOT</version> - </dependency> - </dependencies> -</project> diff --git a/sdnr/wt/common-yang/onap/src/main/yang/onap-system.yang b/sdnr/wt/common-yang/onap/src/main/yang/onap-system.yang deleted file mode 100644 index 3e194298e..000000000 --- a/sdnr/wt/common-yang/onap/src/main/yang/onap-system.yang +++ /dev/null @@ -1,59 +0,0 @@ -module onap-system { - yang-version 1.1; - namespace "urn:onap:system"; - prefix os; - - import ietf-inet-types { - prefix inet; - } - import ietf-system { - prefix sys; - } - - organization - "ONAP - Open Network Automation Platform"; - contact - "Web: <https://www.onap.org> - Editors: - Alex Stancu <mailto:alexandru.stancu@highstreet-technologies.com> - Adrian Lita <mailto:adrian.lita@highstreet-technologies.com> - Martin Skorupski <mailto:martin.skorupski@highstreet-technologies.com>"; - description - "This module augments ietf-system with ONAP details. - - Copyright 2020 the O-RAN Alliance. - - 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."; - - revision 2020-10-26 { - description - "Initial revision for the ietf-system augmentation for ONAP."; - reference - "https://jira.onap.org/browse/SDNC-1396"; - } - - augment "/sys:system" { - leaf name { - type string; - description - "The name of the system."; - } - leaf web-ui { - type inet:uri; - description - "The URI of the system Web UI."; - } - description - "Enhancing the system information."; - } -} diff --git a/sdnr/wt/common-yang/openroadm-pm-types/pom.xml b/sdnr/wt/common-yang/openroadm-pm-types/pom.xml index 8b8b9e00e..bdadbc1f6 100755 --- a/sdnr/wt/common-yang/openroadm-pm-types/pom.xml +++ b/sdnr/wt/common-yang/openroadm-pm-types/pom.xml @@ -22,13 +22,14 @@ ~ ============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.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/common-yang/pom.xml b/sdnr/wt/common-yang/pom.xml index 726979d0d..f5b38c410 100755 --- a/sdnr/wt/common-yang/pom.xml +++ b/sdnr/wt/common-yang/pom.xml @@ -20,13 +20,14 @@ ~ ============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>odlparent-lite</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> @@ -38,12 +39,11 @@ <name>ccsdk-features :: ${project.artifactId}</name> <modules> - <module>onap</module> <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> </modules> diff --git a/sdnr/wt/common-yang/rfc7317-ietf-system/pom.xml b/sdnr/wt/common-yang/rfc7317-ietf-system/pom.xml index 227110bfd..2c81091b3 100755 --- a/sdnr/wt/common-yang/rfc7317-ietf-system/pom.xml +++ b/sdnr/wt/common-yang/rfc7317-ietf-system/pom.xml @@ -22,13 +22,14 @@ ~ ============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.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/common-yang/rfc8341/pom.xml b/sdnr/wt/common-yang/rfc8341/pom.xml index e12d4a5ee..01581d3c4 100755 --- a/sdnr/wt/common-yang/rfc8341/pom.xml +++ b/sdnr/wt/common-yang/rfc8341/pom.xml @@ -20,13 +20,14 @@ ~ ============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.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/common-yang/ietf-alarms/pom.xml b/sdnr/wt/common-yang/test-yang/pom.xml index 1f2740450..df82f22a9 100755..100644 --- a/sdnr/wt/common-yang/ietf-alarms/pom.xml +++ b/sdnr/wt/common-yang/test-yang/pom.xml @@ -3,9 +3,11 @@ ~ ============LICENSE_START======================================================= ~ ONAP : ccsdk features ~ ================================================================================ - ~ Copyright (C) 2020 highstreet technologies GmbH Intellectual Property. + ~ 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 @@ -20,27 +22,39 @@ ~ ============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.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> <groupId>org.onap.ccsdk.features.sdnr.wt</groupId> - <artifactId>ietf-alarms</artifactId> + <artifactId>sdnr-wt-test-yang</artifactId> <version>1.5.1-SNAPSHOT</version> <packaging>bundle</packaging> <name>ccsdk-features :: ${project.artifactId}</name> + <licenses> + <license> + <name>Apache License, Version 2.0</name> + <url>http://www.apache.org/licenses/LICENSE-2.0</url> + </license> + </licenses> - <dependencies> - <dependency> + <dependencies> + <dependency> <groupId>org.opendaylight.mdsal.binding.model.ietf</groupId> <artifactId>rfc6991-ietf-yang-types</artifactId> - </dependency> + </dependency> + <dependency> + <groupId>org.opendaylight.mdsal.binding.model.ietf</groupId> + <artifactId>rfc6991-ietf-inet-types</artifactId> + </dependency> </dependencies> + </project> diff --git a/sdnr/wt/common-yang/utils/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/inet/types/rev130715/HostBuilder.java b/sdnr/wt/common-yang/test-yang/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/inet/types/rev130715/HostBuilder.java index 3d859e8b5..3d859e8b5 100644 --- a/sdnr/wt/common-yang/utils/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/inet/types/rev130715/HostBuilder.java +++ b/sdnr/wt/common-yang/test-yang/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/inet/types/rev130715/HostBuilder.java diff --git a/sdnr/wt/common-yang/utils/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/inet/types/rev130715/IpAddressBuilder.java b/sdnr/wt/common-yang/test-yang/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/inet/types/rev130715/IpAddressBuilder.java index 62771f669..62771f669 100644 --- a/sdnr/wt/common-yang/utils/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/inet/types/rev130715/IpAddressBuilder.java +++ b/sdnr/wt/common-yang/test-yang/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/inet/types/rev130715/IpAddressBuilder.java diff --git a/sdnr/wt/common-yang/utils/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/inet/types/rev130715/IpAddressNoZoneBuilder.java b/sdnr/wt/common-yang/test-yang/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/inet/types/rev130715/IpAddressNoZoneBuilder.java index d7b295263..d7b295263 100644 --- a/sdnr/wt/common-yang/utils/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/inet/types/rev130715/IpAddressNoZoneBuilder.java +++ b/sdnr/wt/common-yang/test-yang/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/inet/types/rev130715/IpAddressNoZoneBuilder.java diff --git a/sdnr/wt/common-yang/utils/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/inet/types/rev130715/IpPrefixBuilder.java b/sdnr/wt/common-yang/test-yang/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/inet/types/rev130715/IpPrefixBuilder.java index d5fff3db4..d5fff3db4 100644 --- a/sdnr/wt/common-yang/utils/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/inet/types/rev130715/IpPrefixBuilder.java +++ b/sdnr/wt/common-yang/test-yang/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/inet/types/rev130715/IpPrefixBuilder.java diff --git a/sdnr/wt/common-yang/test-yang/src/main/yang/test-yang-utils.yang b/sdnr/wt/common-yang/test-yang/src/main/yang/test-yang-utils.yang new file mode 100644 index 000000000..eb62a859a --- /dev/null +++ b/sdnr/wt/common-yang/test-yang/src/main/yang/test-yang-utils.yang @@ -0,0 +1,79 @@ +module test-yang-utils { + + yang-version 1.1; + namespace "urn:test:yang:utils"; + prefix tesyangutils; + + import ietf-yang-types { + prefix yang; + reference + "RFC 6991: Common YANG Data Types."; + } + + import ietf-inet-types { + prefix inet; + } + + typedef AddressType { + type enumeration { + enum OFFICE { + description + "Office Address"; + } + enum HOME { + description + "Home Address"; + } + } + } + + identity item-code { + description + "Base identity"; + } + + typedef item-code { + type identityref { + base item-code; + } + description + "Item code - Could be bar code, QR code or any other code to uniquely identify an item"; + } + + grouping address-location-entity { + leaf id { + type string; + description + "Unique ID of the address"; + } + leaf address-type { + type AddressType; + description + "Type of Address"; + } + leaf delivery-date-time { + type yang:date-and-time; + description + "Package delivery date and time"; + } + leaf delivery-url { + type inet:uri; + description + "Delivery URL"; + } + list item-list { + key "item-key"; + leaf item-key { + type item-code; + } + description + "Unique code of the ordered item"; + } + } + + container address-location { + description + "builder"; + uses address-location-entity; + } +}
\ No newline at end of file diff --git a/sdnr/wt/common-yang/utils/pom.xml b/sdnr/wt/common-yang/utils/pom.xml index 300890642..ec49e852d 100644 --- a/sdnr/wt/common-yang/utils/pom.xml +++ b/sdnr/wt/common-yang/utils/pom.xml @@ -22,13 +22,14 @@ ~ ============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.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> @@ -64,6 +65,10 @@ <artifactId>jackson-databind</artifactId> </dependency> <dependency> + <groupId>com.fasterxml.jackson.datatype</groupId> + <artifactId>jackson-datatype-jsr310</artifactId> + </dependency> + <dependency> <groupId>org.opendaylight.mdsal.binding.model.ietf</groupId> <artifactId>rfc6991-ietf-yang-types</artifactId> <scope>provided</scope> @@ -73,16 +78,22 @@ <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> </dependency> <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>sdnr-wt-test-yang</artifactId> + <version>${project.version}</version> + <scope>test</scope> + </dependency> + <dependency> <groupId>org.opendaylight.netconf</groupId> <artifactId>sal-netconf-connector</artifactId> <scope>test</scope> @@ -106,7 +117,7 @@ <plugin> <groupId>org.opendaylight.yangtools</groupId> <artifactId>yang-maven-plugin</artifactId> - <version>7.0.9</version> + <version>9.0.1</version> <executions> <execution> <id>binding</id> @@ -123,7 +134,7 @@ <dependency> <groupId>org.opendaylight.mdsal</groupId> <artifactId>mdsal-binding-java-api-generator</artifactId> - <version>8.0.7</version> + <version>10.0.2</version> <scope>compile</scope> </dependency> </dependencies> diff --git a/sdnr/wt/common-yang/utils/src/main/java/org/onap/ccsdk/features/sdnr/wt/yang/mapper/YangToolsMapper.java b/sdnr/wt/common-yang/utils/src/main/java/org/onap/ccsdk/features/sdnr/wt/yang/mapper/YangToolsMapper.java index 0d9045658..dbc233016 100644 --- a/sdnr/wt/common-yang/utils/src/main/java/org/onap/ccsdk/features/sdnr/wt/yang/mapper/YangToolsMapper.java +++ b/sdnr/wt/common-yang/utils/src/main/java/org/onap/ccsdk/features/sdnr/wt/yang/mapper/YangToolsMapper.java @@ -29,6 +29,7 @@ import com.fasterxml.jackson.databind.KeyDeserializer; import com.fasterxml.jackson.databind.MapperFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; import org.onap.ccsdk.features.sdnr.wt.yang.mapper.mapperextensions.YangToolsBuilderAnnotationIntrospector; import org.onap.ccsdk.features.sdnr.wt.yang.mapper.mapperextensions.YangToolsModule; import org.slf4j.Logger; @@ -58,6 +59,7 @@ public class YangToolsMapper extends ObjectMapper { this.annotationIntrospector = yangToolsBuilderAnnotationIntrospector; this.module = new YangToolsModule(); this.registerModule(this.module); + this.registerModule(new JavaTimeModule()); configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); setPropertyNamingStrategy(PropertyNamingStrategies.KEBAB_CASE); setSerializationInclusion(Include.NON_NULL); diff --git a/sdnr/wt/common-yang/utils/src/main/java/org/onap/ccsdk/features/sdnr/wt/yang/mapper/YangToolsMapper2.java b/sdnr/wt/common-yang/utils/src/main/java/org/onap/ccsdk/features/sdnr/wt/yang/mapper/YangToolsMapper2.java index 6b5704078..1c7d58b48 100644 --- a/sdnr/wt/common-yang/utils/src/main/java/org/onap/ccsdk/features/sdnr/wt/yang/mapper/YangToolsMapper2.java +++ b/sdnr/wt/common-yang/utils/src/main/java/org/onap/ccsdk/features/sdnr/wt/yang/mapper/YangToolsMapper2.java @@ -27,7 +27,6 @@ import java.lang.reflect.Method; import javax.annotation.Nullable; import org.eclipse.jdt.annotation.NonNull; import org.onap.ccsdk.features.sdnr.wt.yang.mapper.mapperextensions.YangToolsBuilderAnnotationIntrospector; -import org.opendaylight.yangtools.concepts.Builder; import org.opendaylight.yangtools.yang.binding.DataObject; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/sdnr/wt/common-yang/utils/src/main/java/org/onap/ccsdk/features/sdnr/wt/yang/mapper/YangToolsMapperHelper.java b/sdnr/wt/common-yang/utils/src/main/java/org/onap/ccsdk/features/sdnr/wt/yang/mapper/YangToolsMapperHelper.java index e72e962bb..9ca07fe59 100644 --- a/sdnr/wt/common-yang/utils/src/main/java/org/onap/ccsdk/features/sdnr/wt/yang/mapper/YangToolsMapperHelper.java +++ b/sdnr/wt/common-yang/utils/src/main/java/org/onap/ccsdk/features/sdnr/wt/yang/mapper/YangToolsMapperHelper.java @@ -25,6 +25,7 @@ import com.fasterxml.jackson.databind.DeserializationContext; import com.google.common.collect.Maps; import java.lang.reflect.Constructor; +import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.time.Instant; @@ -38,14 +39,11 @@ import java.util.Map; import java.util.Optional; import java.util.concurrent.ConcurrentHashMap; import javax.annotation.Nullable; + import org.opendaylight.mdsal.dom.api.DOMEvent; import org.opendaylight.mdsal.dom.api.DOMNotification; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime; -import org.opendaylight.yangtools.concepts.Builder; -import org.opendaylight.yangtools.yang.binding.EventInstantAware; -import org.opendaylight.yangtools.yang.binding.Identifiable; -import org.opendaylight.yangtools.yang.binding.Identifier; -import org.opendaylight.yangtools.yang.binding.Notification; +import org.opendaylight.yangtools.yang.binding.*; import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; import org.osgi.framework.FrameworkUtil; @@ -131,12 +129,12 @@ public class YangToolsMapperHelper { } @SuppressWarnings("unchecked") - public static <B extends Builder<?>> Class<B> findBuilderClass(DeserializationContext ctxt, Class<?> clazz) + public static Class<?> findBuilderClass(DeserializationContext ctxt, Class<?> clazz) throws ClassNotFoundException { - return (Class<B>) findClass(getBuilderClassName(clazz)); + return findClass(getBuilderClassName(clazz)); } - public static <B extends Builder<?>> Optional<Class<B>> findBuilderClassOptional(DeserializationContext ctxt, + public static Optional<Class<?>> findBuilderClassOptional(DeserializationContext ctxt, Class<?> clazz) { try { return Optional.of(findBuilderClass(ctxt, clazz)); @@ -145,6 +143,15 @@ public class YangToolsMapperHelper { } } + public static <T extends BaseIdentity, S extends T> S getIdentityValueFromClass(Class<S> clazz) { + try { + Field valueField = clazz.getDeclaredField("VALUE"); + return (S) valueField.get(clazz); + } catch (NoSuchFieldException | IllegalAccessException ignore) { + } + return null; + } + public static boolean hasClassDeclaredMethod(Class<?> clazz, String name) { Method[] methods = clazz.getDeclaredMethods(); for (Method m : methods) { @@ -238,7 +245,8 @@ public class YangToolsMapperHelper { * @param name with attribute name, not null or empty * @return converted string or null if name was empty or null */ - public @Nullable static String toCamelCaseAttributeName(final String name) { + public @Nullable + static String toCamelCaseAttributeName(final String name) { if (name == null || name.isEmpty()) return null; @@ -306,15 +314,17 @@ public class YangToolsMapperHelper { } return DateAndTime.getDefaultInstance(ZonedDateTime.ofInstant(time, ZoneOffset.UTC).format(formatterOutput)); } - - - public static <K extends Identifier<V>, V extends Identifiable<K>> Map<K,V> toMap(List<V> list) { - return list == null || list.isEmpty() ? null : Maps.uniqueIndex(list, Identifiable::key); + + + public static <K extends Identifier<V>, V extends Identifiable<K>> Map<K, V> toMap(List<V> list) { + return list == null || list.isEmpty() ? null : Maps.uniqueIndex(list, Identifiable::key); } - + @SuppressWarnings("unchecked") - public static <S,T> T callBuild(S builder) throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException { - Method method = builder.getClass().getMethod("build"); - return (T) method.invoke(builder); - } + public static <S, T> T callBuild(S builder) + throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, + InvocationTargetException { + Method method = builder.getClass().getMethod("build"); + return (T) method.invoke(builder); + } } diff --git a/sdnr/wt/common-yang/utils/src/main/java/org/onap/ccsdk/features/sdnr/wt/yang/mapper/mapperextensions/YangToolsDeserializerModifier.java b/sdnr/wt/common-yang/utils/src/main/java/org/onap/ccsdk/features/sdnr/wt/yang/mapper/mapperextensions/YangToolsDeserializerModifier.java index b7f1782b6..b2fb31385 100644 --- a/sdnr/wt/common-yang/utils/src/main/java/org/onap/ccsdk/features/sdnr/wt/yang/mapper/mapperextensions/YangToolsDeserializerModifier.java +++ b/sdnr/wt/common-yang/utils/src/main/java/org/onap/ccsdk/features/sdnr/wt/yang/mapper/mapperextensions/YangToolsDeserializerModifier.java @@ -35,16 +35,14 @@ import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.NoSuchElementException; import java.util.Optional; -import java.util.Set; import org.onap.ccsdk.features.sdnr.wt.yang.mapper.YangToolsMapperHelper; import org.onap.ccsdk.features.sdnr.wt.yang.mapper.serialize.BaseIdentityDeserializer; import org.onap.ccsdk.features.sdnr.wt.yang.mapper.serialize.ClassDeserializer; import org.onap.ccsdk.features.sdnr.wt.yang.mapper.serialize.IdentifierDeserializer; -import org.onap.ccsdk.features.sdnr.wt.yang.mapper.serialize.SetDeserializer; import org.onap.ccsdk.features.sdnr.wt.yang.mapper.serialize.TypeObjectDeserializer; +import org.opendaylight.yangtools.concepts.Identifier; import org.opendaylight.yangtools.yang.binding.BaseIdentity; -import org.opendaylight.yangtools.yang.binding.Identifier; import org.opendaylight.yangtools.yang.binding.ScalarTypeObject; import org.opendaylight.yangtools.yang.binding.TypeObject; import org.slf4j.Logger; @@ -67,7 +65,7 @@ public class YangToolsDeserializerModifier extends BeanDeserializerModifier { } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | NoSuchElementException | SecurityException e) { Method method = clazz.getDeclaredMethod(getEnumMethodName2, String.class); - Optional<Enum<?>> result = (Optional<Enum<?>>) method.invoke(null, value); + Optional<Enum<?>> result = Optional.ofNullable((Enum<?>) method.invoke(null, value)); LOG.debug("Deserialize '{}' with class '{}' to '{}'", value, clazz.getName(), result); return result.orElseThrow(); } @@ -109,6 +107,8 @@ public class YangToolsDeserializerModifier extends BeanDeserializerModifier { deser = new TypeObjectDeserializer<ScalarTypeObject<?>>(type, deser); } else if (YangToolsMapperHelper.implementsInterface(rawClass, BaseIdentity.class)) { deser = new BaseIdentityDeserializer<BaseIdentity>(deser); + } else if (YangToolsMapperHelper.implementsInterface(rawClass, Identifier.class)) { + deser = new BaseIdentityDeserializer<Identifier>(deser); } else if (rawClass.equals(Class.class)) { deser = new ClassDeserializer(rawClass); } diff --git a/sdnr/wt/common-yang/utils/src/main/java/org/onap/ccsdk/features/sdnr/wt/yang/mapper/mapperextensions/YangToolsModule.java b/sdnr/wt/common-yang/utils/src/main/java/org/onap/ccsdk/features/sdnr/wt/yang/mapper/mapperextensions/YangToolsModule.java index 02628dc16..8091a6042 100644 --- a/sdnr/wt/common-yang/utils/src/main/java/org/onap/ccsdk/features/sdnr/wt/yang/mapper/mapperextensions/YangToolsModule.java +++ b/sdnr/wt/common-yang/utils/src/main/java/org/onap/ccsdk/features/sdnr/wt/yang/mapper/mapperextensions/YangToolsModule.java @@ -23,11 +23,10 @@ package org.onap.ccsdk.features.sdnr.wt.yang.mapper.mapperextensions; import com.fasterxml.jackson.databind.module.SimpleModule; import java.util.Map; -import org.onap.ccsdk.features.sdnr.wt.yang.mapper.serialize.DateAndTimeSerializer; -import org.onap.ccsdk.features.sdnr.wt.yang.mapper.serialize.EnumSerializer; -import org.onap.ccsdk.features.sdnr.wt.yang.mapper.serialize.MapSerializer; -import org.onap.ccsdk.features.sdnr.wt.yang.mapper.serialize.TypeObjectSerializer; + +import org.onap.ccsdk.features.sdnr.wt.yang.mapper.serialize.*; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime; +import org.opendaylight.yangtools.yang.binding.BaseIdentity; import org.opendaylight.yangtools.yang.binding.ScalarTypeObject; import org.opendaylight.yangtools.yang.binding.TypeObject; @@ -44,7 +43,7 @@ public class YangToolsModule extends SimpleModule { addSerializer(ScalarTypeObject.class, new TypeObjectSerializer()); addSerializer(Enum.class, new EnumSerializer()); addSerializer(Map.class, new MapSerializer()); - + addSerializer(BaseIdentity.class, new BaseIdentitySerializer()); } } diff --git a/sdnr/wt/common-yang/utils/src/main/java/org/onap/ccsdk/features/sdnr/wt/yang/mapper/serialize/BaseIdentityDeserializer.java b/sdnr/wt/common-yang/utils/src/main/java/org/onap/ccsdk/features/sdnr/wt/yang/mapper/serialize/BaseIdentityDeserializer.java index f85f80e2c..1c4226322 100644 --- a/sdnr/wt/common-yang/utils/src/main/java/org/onap/ccsdk/features/sdnr/wt/yang/mapper/serialize/BaseIdentityDeserializer.java +++ b/sdnr/wt/common-yang/utils/src/main/java/org/onap/ccsdk/features/sdnr/wt/yang/mapper/serialize/BaseIdentityDeserializer.java @@ -25,8 +25,16 @@ import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.DeserializationContext; import com.fasterxml.jackson.databind.JsonDeserializer; + import java.io.IOException; +import java.lang.reflect.Type; +import java.util.List; +import java.util.stream.Collectors; + +import com.google.common.reflect.ClassPath; +import org.onap.ccsdk.features.sdnr.wt.yang.mapper.YangToolsMapper; import org.onap.ccsdk.features.sdnr.wt.yang.mapper.YangToolsMapperHelper; +import org.opendaylight.yangtools.yang.binding.BaseIdentity; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -39,25 +47,35 @@ public class BaseIdentityDeserializer<T> extends JsonDeserializer<T> { this.deser = deser; } + private static List<Class<? extends BaseIdentity>> getTypesInNamespace(String packageName) throws IOException { + return ClassPath.from(Thread.currentThread().getContextClassLoader()).getTopLevelClasses(packageName). + stream().map(e -> (Class<? extends BaseIdentity>)e.load()).collect(Collectors.toList()); + } + @SuppressWarnings("unchecked") @Override public T deserialize(JsonParser parser, DeserializationContext ctxt) throws IOException, JsonProcessingException { - LOG.debug("BaseIdentityDeserializer class for '{}'",parser.getValueAsString()); + LOG.debug("BaseIdentityDeserializer class for '{}'", parser.getValueAsString()); String clazzToSearch = parser.getValueAsString(); + String simpleName; + Class<? extends BaseIdentity> clazz; // clazz from Elasticsearch is full qualified int lastDot = clazzToSearch.lastIndexOf("."); if (lastDot > -1) { - clazzToSearch = clazzToSearch.substring(lastDot+1); + simpleName = clazzToSearch.substring(lastDot + 1); + clazz = getTypesInNamespace(clazzToSearch.substring(0, lastDot)).stream() + .filter(e -> e.getSimpleName().equals(simpleName)).findFirst().orElse(null); + if (clazz != null) + return (T) YangToolsMapperHelper.getIdentityValueFromClass(clazz); } else { - clazzToSearch = clazzToSearch.substring(0, 1).toUpperCase() + clazzToSearch.substring(1); + simpleName = clazzToSearch.substring(0, 1).toUpperCase() + clazzToSearch.substring(1); } - Class<?> clazz; try { - clazz = YangToolsMapperHelper.findClass(clazzToSearch); + clazz = (Class<? extends BaseIdentity>) YangToolsMapperHelper.findClass(simpleName); if (clazz != null) - return (T)clazz; + return (T) YangToolsMapperHelper.getIdentityValueFromClass(clazz); } catch (ClassNotFoundException e) { - LOG.warn("BaseIdentityDeserializer class not found for '"+parser.getValueAsString()+"'",e); + LOG.warn("BaseIdentityDeserializer class not found for '" + parser.getValueAsString() + "'", e); } return (T) deser.deserialize(parser, ctxt); } diff --git a/sdnr/wt/common-yang/utils/src/main/java/org/onap/ccsdk/features/sdnr/wt/yang/mapper/serialize/BaseIdentitySerializer.java b/sdnr/wt/common-yang/utils/src/main/java/org/onap/ccsdk/features/sdnr/wt/yang/mapper/serialize/BaseIdentitySerializer.java new file mode 100644 index 000000000..29d4fc049 --- /dev/null +++ b/sdnr/wt/common-yang/utils/src/main/java/org/onap/ccsdk/features/sdnr/wt/yang/mapper/serialize/BaseIdentitySerializer.java @@ -0,0 +1,21 @@ +package org.onap.ccsdk.features.sdnr.wt.yang.mapper.serialize; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.databind.JsonSerializer; +import com.fasterxml.jackson.databind.SerializerProvider; +import org.opendaylight.yangtools.yang.binding.BaseIdentity; + +import java.io.IOException; + +public class BaseIdentitySerializer extends JsonSerializer<BaseIdentity> { + + @Override + public void serialize(BaseIdentity value, JsonGenerator gen, SerializerProvider serializers) throws IOException { + String clsName = value.getClass().getName(); + int idx = clsName.indexOf("$"); + if(idx>0){ + clsName = clsName.substring(0,idx); + } + gen.writeString(clsName); + } +}
\ No newline at end of file diff --git a/sdnr/wt/common-yang/utils/src/main/java/org/onap/ccsdk/features/sdnr/wt/yang/mapper/serialize/TypeObjectDeserializer.java b/sdnr/wt/common-yang/utils/src/main/java/org/onap/ccsdk/features/sdnr/wt/yang/mapper/serialize/TypeObjectDeserializer.java index b857a2ffb..5e3fe13bb 100644 --- a/sdnr/wt/common-yang/utils/src/main/java/org/onap/ccsdk/features/sdnr/wt/yang/mapper/serialize/TypeObjectDeserializer.java +++ b/sdnr/wt/common-yang/utils/src/main/java/org/onap/ccsdk/features/sdnr/wt/yang/mapper/serialize/TypeObjectDeserializer.java @@ -31,7 +31,6 @@ import java.lang.reflect.InvocationTargetException; import java.util.NoSuchElementException; import java.util.Optional; import org.onap.ccsdk.features.sdnr.wt.yang.mapper.YangToolsMapperHelper; -import org.opendaylight.yangtools.concepts.Builder; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -59,7 +58,7 @@ public class TypeObjectDeserializer<T> extends JsonDeserializer<T> { //try get method for default instance if ((oRes = YangToolsMapperHelper.getDefaultInstance(clazz, arg)).isEmpty()) { //try to find builder with getDefaultInstance method - Optional<Class<Builder<?>>> oBuilderClazz = YangToolsMapperHelper.findBuilderClassOptional(ctxt, clazz); + Optional<Class<?>> oBuilderClazz = YangToolsMapperHelper.findBuilderClassOptional(ctxt, clazz); LOG.debug("Try builder class present:{}",oBuilderClazz.isPresent()); if (oBuilderClazz.isEmpty() || ((oRes = YangToolsMapperHelper.getDefaultInstance(oBuilderClazz.get(), arg)).isEmpty())) { diff --git a/sdnr/wt/common-yang/utils/src/test/java/org/onap/ccsdk/features/sdnr/wt/yang/mapper/TestYangToolsMapper.java b/sdnr/wt/common-yang/utils/src/test/java/org/onap/ccsdk/features/sdnr/wt/yang/mapper/TestYangToolsMapper.java index 2e51e8404..81df00789 100644 --- a/sdnr/wt/common-yang/utils/src/test/java/org/onap/ccsdk/features/sdnr/wt/yang/mapper/TestYangToolsMapper.java +++ b/sdnr/wt/common-yang/utils/src/test/java/org/onap/ccsdk/features/sdnr/wt/yang/mapper/TestYangToolsMapper.java @@ -34,7 +34,7 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types. import org.opendaylight.yang.gen.v1.urn.test.yang.utils.norev.AddressLocation; import org.opendaylight.yang.gen.v1.urn.test.yang.utils.norev.AddressLocationBuilder; import org.opendaylight.yang.gen.v1.urn.test.yang.utils.norev.AddressType; -import org.opendaylight.yang.gen.v1.urn.test.yang.utils.norev.ItemCode; +import org.opendaylight.yang.gen.v1.urn.test.yang.utils.norev.ItemCodeIdentity; import org.opendaylight.yang.gen.v1.urn.test.yang.utils.norev.address.location.entity.ItemList; import org.opendaylight.yang.gen.v1.urn.test.yang.utils.norev.address.location.entity.ItemListBuilder; import org.opendaylight.yang.gen.v1.urn.test.yang.utils.norev.address.location.entity.ItemListKey; @@ -47,7 +47,29 @@ public class TestYangToolsMapper { public void init() { MAPPER.addKeyDeserializer(ItemListKey.class, new IdentifierDeserializer()); } + @Test + public void testYangMapperDeser2() { + AddressLocation al = null; + try { + al = MAPPER.readValue( + "{\n" + + " \"address-type\": \"OFFICE\",\n" + + " \"delivery-date-time\": \"2022-03-15T11:12:13.890Z\",\n" + + " \"delivery-url\": \"delivery.uri\",\n" + + " \"test-id\": \"org.opendaylight.yang.gen.v1.urn.test.yang.utils.norev.ItemCodeIdentity\"" + + "}", + AddressLocation.class); + } catch (JsonProcessingException e) { + e.printStackTrace(); + } + assertEquals(AddressType.OFFICE, al.getAddressType()); + assertEquals("2022-03-15T11:12:13.890Z", al.getDeliveryDateTime().getValue()); + assertEquals(ItemCodeIdentity.VALUE, al.getTestId()); + System.out.println("Delivery Date = " + al.getDeliveryDateTime().getValue()); + System.out.println(al.getItemList()); + System.out.println(al.getDeliveryUrl().getValue()); + } @Test public void testYangMapperDeser() { AddressLocation al = null; @@ -60,7 +82,7 @@ public class TestYangToolsMapper { + " \"delivery-url\": \"delivery.uri\",\n" + " \"item-list\": [\n" + " {\n" - + " \"item-key\": \"org.opendaylight.yang.gen.v1.urn.test.yang.utils.norev.ItemCode\"\n" + + " \"item-key\": \"org.opendaylight.yang.gen.v1.urn.test.yang.utils.norev.ItemCodeIdentity\"\n" + " }\n" + " ]\n" + "}", @@ -78,8 +100,8 @@ public class TestYangToolsMapper { @Test public void testYangMapperSer() { Map<ItemListKey, ItemList> items = new HashMap<ItemListKey, ItemList>(); - ItemList il = new ItemListBuilder().setItemKey(ItemCode.class).build(); - items.put(new ItemListKey(ItemCode.class), il); + ItemList il = new ItemListBuilder().setItemKey(ItemCodeIdentity.VALUE).build(); + items.put(new ItemListKey(ItemCodeIdentity.VALUE), il); Uri uri = new Uri("delivery.uri"); diff --git a/sdnr/wt/common-yang/utils/src/test/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/inet/types/rev130715/HostBuilder.java b/sdnr/wt/common-yang/utils/src/test/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/inet/types/rev130715/HostBuilder.java deleted file mode 100644 index 3d859e8b5..000000000 --- a/sdnr/wt/common-yang/utils/src/test/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/inet/types/rev130715/HostBuilder.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715; -import java.lang.String; -import java.lang.UnsupportedOperationException; -import javax.annotation.processing.Generated; - -/** - * 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. - * - */ -@Generated("mdsal-binding-generator") -public class HostBuilder { - private HostBuilder() { - //Exists only to defeat instantiation. - } - - public static Host getDefaultInstance(String defaultValue) { - throw new UnsupportedOperationException("Not yet implemented"); - } - -} diff --git a/sdnr/wt/common-yang/utils/src/test/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/inet/types/rev130715/IpAddressBuilder.java b/sdnr/wt/common-yang/utils/src/test/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/inet/types/rev130715/IpAddressBuilder.java deleted file mode 100644 index 62771f669..000000000 --- a/sdnr/wt/common-yang/utils/src/test/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/inet/types/rev130715/IpAddressBuilder.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715; -import java.lang.String; -import java.lang.UnsupportedOperationException; -import javax.annotation.processing.Generated; - -/** - * 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. - * - */ -@Generated("mdsal-binding-generator") -public class IpAddressBuilder { - private IpAddressBuilder() { - //Exists only to defeat instantiation. - } - - public static IpAddress getDefaultInstance(String defaultValue) { - throw new UnsupportedOperationException("Not yet implemented"); - } - -} diff --git a/sdnr/wt/common-yang/utils/src/test/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/inet/types/rev130715/IpAddressNoZoneBuilder.java b/sdnr/wt/common-yang/utils/src/test/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/inet/types/rev130715/IpAddressNoZoneBuilder.java deleted file mode 100644 index d7b295263..000000000 --- a/sdnr/wt/common-yang/utils/src/test/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/inet/types/rev130715/IpAddressNoZoneBuilder.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715; -import java.lang.String; -import java.lang.UnsupportedOperationException; -import javax.annotation.processing.Generated; - -/** - * 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. - * - */ -@Generated("mdsal-binding-generator") -public class IpAddressNoZoneBuilder { - private IpAddressNoZoneBuilder() { - //Exists only to defeat instantiation. - } - - public static IpAddressNoZone getDefaultInstance(String defaultValue) { - throw new UnsupportedOperationException("Not yet implemented"); - } - -} diff --git a/sdnr/wt/common-yang/utils/src/test/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/inet/types/rev130715/IpPrefixBuilder.java b/sdnr/wt/common-yang/utils/src/test/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/inet/types/rev130715/IpPrefixBuilder.java deleted file mode 100644 index d5fff3db4..000000000 --- a/sdnr/wt/common-yang/utils/src/test/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/inet/types/rev130715/IpPrefixBuilder.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715; -import java.lang.String; -import java.lang.UnsupportedOperationException; -import javax.annotation.processing.Generated; - -/** - * 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. - * - */ -@Generated("mdsal-binding-generator") -public class IpPrefixBuilder { - private IpPrefixBuilder() { - //Exists only to defeat instantiation. - } - - public static IpPrefix getDefaultInstance(String defaultValue) { - throw new UnsupportedOperationException("Not yet implemented"); - } - -} diff --git a/sdnr/wt/common-yang/utils/src/test/yang/test-yang-utils.yang b/sdnr/wt/common-yang/utils/src/test/yang/test-yang-utils.yang index eb62a859a..a43a151e1 100644 --- a/sdnr/wt/common-yang/utils/src/test/yang/test-yang-utils.yang +++ b/sdnr/wt/common-yang/utils/src/test/yang/test-yang-utils.yang @@ -3,52 +3,52 @@ module test-yang-utils { yang-version 1.1; namespace "urn:test:yang:utils"; prefix tesyangutils; - + import ietf-yang-types { prefix yang; reference "RFC 6991: Common YANG Data Types."; } - + import ietf-inet-types { prefix inet; } - + typedef AddressType { type enumeration { enum OFFICE { - description + description "Office Address"; } enum HOME { - description + description "Home Address"; } } } - - identity item-code { + + identity item-code-identity { description "Base identity"; } typedef item-code { type identityref { - base item-code; + base item-code-identity; } description "Item code - Could be bar code, QR code or any other code to uniquely identify an item"; } - + grouping address-location-entity { leaf id { type string; - description + description "Unique ID of the address"; } leaf address-type { type AddressType; - description + description "Type of Address"; } leaf delivery-date-time { @@ -58,7 +58,7 @@ module test-yang-utils { } leaf delivery-url { type inet:uri; - description + description "Delivery URL"; } list item-list { @@ -66,13 +66,18 @@ module test-yang-utils { leaf item-key { type item-code; } - description + description "Unique code of the ordered item"; } + leaf test-id { + type item-code; + description "test identity leaf"; + } + } - + container address-location { - description + description "builder"; uses address-location-entity; } diff --git a/sdnr/wt/common/pom.xml b/sdnr/wt/common/pom.xml index c9ade22e1..f84a8c98e 100644 --- a/sdnr/wt/common/pom.xml +++ b/sdnr/wt/common/pom.xml @@ -28,7 +28,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>binding-parent</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/data-provider/dblib/pom.xml b/sdnr/wt/data-provider/dblib/pom.xml index ffaad4dcb..719760c62 100644 --- a/sdnr/wt/data-provider/dblib/pom.xml +++ b/sdnr/wt/data-provider/dblib/pom.xml @@ -22,13 +22,14 @@ ~ ============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.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/SqlDBClient.java b/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/SqlDBClient.java index b93145cbb..dc1241156 100644 --- a/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/SqlDBClient.java +++ b/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/SqlDBClient.java @@ -63,7 +63,6 @@ public class SqlDBClient { private static final String SELECT_VERSION_QUERY = "SELECT @@version as version"; private static final String DBNAME_DEFAULT = "sdnrdb"; - private static final int DEFAULT_POOLSIZE = 50; private final String dbConnectionString; private final String dbName; private final String dbHost; @@ -306,7 +305,8 @@ public class SqlDBClient { } public Connection getConnection() throws SQLException { - return DriverManager.getConnection(this.dbConnectionString); + return this.connectionPool.getConnection(); + //return DriverManager.getConnection(this.dbConnectionString); } public boolean delete(String query) throws SQLException { diff --git a/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/data/PropertyList.java b/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/data/PropertyList.java new file mode 100644 index 000000000..d2321fc2b --- /dev/null +++ b/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/data/PropertyList.java @@ -0,0 +1,36 @@ +/* + * ============LICENSE_START======================================================= + * ONAP : ccsdk features + * ================================================================================ + * Copyright (C) 2023 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.dataprovider.database.sqldb.data; + +import java.util.ArrayList; +import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.sqldb.database.SqlDBMapper; +import org.opendaylight.yangtools.yang.binding.DataObject; + +@SuppressWarnings("serial") +public class PropertyList extends ArrayList<SqlPropertyInfo> { + + + public PropertyList(Class<? extends DataObject> clazz){ + super(SqlDBMapper.getProperties(clazz)); + } + +} diff --git a/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/data/SqlDBDataProvider.java b/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/data/SqlDBDataProvider.java index cb66fc6fb..d00941d86 100644 --- a/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/data/SqlDBDataProvider.java +++ b/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/data/SqlDBDataProvider.java @@ -28,7 +28,6 @@ import java.sql.ResultSet; import java.sql.SQLException; import java.util.List; import java.util.concurrent.TimeUnit; -import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.DatabaseDataProvider; import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.sqldb.SqlDBClient; import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.sqldb.SqlDBConfig; import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.sqldb.data.entity.HtDatabaseEventsService; @@ -39,9 +38,11 @@ import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.sqldb.database.SqlD import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.sqldb.database.SqlDBStatusReader; import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.sqldb.query.DeleteQuery; import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DataProvider; +import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DatabaseDataProvider; import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.HtDatabaseMaintenance; import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.HtDatabaseMediatorserver; import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.HtUserdataManager; +import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.InventoryTreeProvider; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.CreateMaintenanceInput; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.CreateMaintenanceOutputBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.CreateMediatorServerInput; @@ -64,6 +65,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.pro import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.ReadFaultcurrentListOutputBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.ReadFaultlogListOutputBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.ReadGuiCutThroughEntryOutputBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.ReadInventoryDeviceListOutputBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.ReadInventoryListOutputBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.ReadMaintenanceListOutputBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.ReadMediatorServerListOutputBuilder; @@ -101,6 +103,7 @@ public class SqlDBDataProvider extends HtDatabaseEventsService implements Databa private final SqlDBReaderWriter<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.read.maintenance.list.output.Data> maintenanceRW; private final SqlDBStatusReader readStatus; private final HtUserdataManager usermanager; + private final InventoryTreeProvider inventoryTreeProvider; public SqlDBReaderWriter<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.read.maintenance.list.output.Data> getMaintenanceReaderWriter() { @@ -145,6 +148,8 @@ public class SqlDBDataProvider extends HtDatabaseEventsService implements Databa LOG.warn("problem setting controllerId: ", e); } } + this.inventoryTreeProvider = new SqlDbInventoryTreeProvider(this.dbClient, this.getControllerId()); + } @@ -242,6 +247,17 @@ public class SqlDBDataProvider extends HtDatabaseEventsService implements Databa } @Override + public ReadInventoryDeviceListOutputBuilder readInventoryDeviceList(EntityInput input) { + ReadInventoryDeviceListOutputBuilder outputBuilder = new ReadInventoryDeviceListOutputBuilder(); + QueryResult<String> result = this.equipmentRW.getDataDeviceList(input); + outputBuilder.setPagination( + new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.read.inventory.device.list.output.PaginationBuilder( + result.getPagination()).build()); + outputBuilder.setData(result.getResultSet()); + return outputBuilder; + } + + @Override public ReadConnectionlogListOutputBuilder readConnectionlogList(EntityInput input) { ReadConnectionlogListOutputBuilder outputBuilder = new ReadConnectionlogListOutputBuilder(); QueryResult<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.read.connectionlog.list.output.Data> result = @@ -504,7 +520,7 @@ public class SqlDBDataProvider extends HtDatabaseEventsService implements Databa } LOG.info("set controllerId {}", this.controllerId); String query = - String.format("SELECT * FROM `%s` WHERE `id`='%s';", this.controllerTableName, this.controllerId); + String.format("SELECT * FROM `%s` WHERE `id`='%s'", this.controllerTableName, this.controllerId); LOG.trace(query); ResultSet data = this.dbClient.read(query); @@ -515,6 +531,7 @@ public class SqlDBDataProvider extends HtDatabaseEventsService implements Databa try { if(data!=null){data.close();} } catch (SQLException ignore) { } return this.dbClient.write(query); } else { + this.controllerId = data.getString(0); LOG.trace("controllerId already set"); } return true; @@ -533,5 +550,10 @@ public class SqlDBDataProvider extends HtDatabaseEventsService implements Databa return this.usermanager; } + @Override + public InventoryTreeProvider getInventoryTreeProvider() { + return this.inventoryTreeProvider; + } + } diff --git a/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/data/SqlDbInventoryTreeProvider.java b/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/data/SqlDbInventoryTreeProvider.java new file mode 100644 index 000000000..425007016 --- /dev/null +++ b/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/data/SqlDbInventoryTreeProvider.java @@ -0,0 +1,89 @@ +/* + * ============LICENSE_START======================================================= + * ONAP : ccsdk features + * ================================================================================ + * Copyright (C) 2023 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.dataprovider.database.sqldb.data; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import org.onap.ccsdk.features.sdnr.wt.common.database.queries.SortOrder; +import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.sqldb.SqlDBClient; +import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.sqldb.database.SqlDBReaderWriter; +import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.BaseInventoryTreeProvider; +import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.types.YangHelper2; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.Entity; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.EntityInput; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.Inventory; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.InventoryEntity; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.ReadInventoryListInputBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.entity.input.Filter; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.entity.input.FilterBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.entity.input.FilterKey; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.entity.input.Sortorder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.entity.input.SortorderBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.entity.input.SortorderKey; + +public class SqlDbInventoryTreeProvider extends BaseInventoryTreeProvider { + private final SqlDBReaderWriter<Inventory> dbReader; + + public SqlDbInventoryTreeProvider(SqlDBClient dbClient, String controllerId) { + this.dbReader = new SqlDBReaderWriter<>(dbClient, Entity.Inventoryequipment, "", Inventory.class, controllerId); + } + + @Override + protected List<String> getAllNodeIds() { + return this.dbReader.readAll(INVENTORY_PROPERTY_NODEID); + } + + @Override + protected List<InventoryEntity> search(String filter, String sortOrderProperty, SortOrder sortOrder) { + return new ArrayList<>(this.dbReader.searchAll(Inventory.class, null, filter)); + } + + @Override + protected List<InventoryEntity> search(String filter, String nodeId, String parentUuid, String uuid, + String sortOrderProperty, SortOrder sortOrder) { + List<Filter> filters = new ArrayList<>(); + if (nodeId != null) { + filters.add(new FilterBuilder().setProperty(INVENTORY_PROPERTY_NODEID).setFiltervalue(nodeId).build()); + } + EntityInput input = new ReadInventoryListInputBuilder() + .setFilter(YangHelper2.getListOrMap(FilterKey.class, filters)).build(); + return new ArrayList<>(this.dbReader.searchAll(Inventory.class, input, filter)); + } + + @Override + protected List<InventoryEntity> getItemsForNodes(List<String> nodeIds, String sortOrderProperty, + SortOrder sortOrder) { + Map<FilterKey, Filter> nodeFilter = new HashMap<>(); + Filter filter = new FilterBuilder().setProperty(INVENTORY_PROPERTY_NODEID) + .setFiltervalues(nodeIds.stream().collect(Collectors.toSet())).build(); + nodeFilter.put(filter.key(), filter); + Map<SortorderKey, Sortorder> so = new HashMap<>(); + Sortorder soItem = new SortorderBuilder().setProperty(sortOrderProperty) + .setSortorder(YangHelper2.getSortOrder(sortOrder)).build(); + so.put(soItem.key(), soItem); + EntityInput input = new ReadInventoryListInputBuilder().setFilter(nodeFilter).setSortorder(so).build(); + return new ArrayList<>(this.dbReader.readAll(Inventory.class, input)); + } +} diff --git a/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/data/SqlPropertyInfo.java b/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/data/SqlPropertyInfo.java new file mode 100644 index 000000000..76e5d70fe --- /dev/null +++ b/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/data/SqlPropertyInfo.java @@ -0,0 +1,56 @@ +/* + * ============LICENSE_START======================================================= + * ONAP : ccsdk features + * ================================================================================ + * Copyright (C) 2023 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.dataprovider.database.sqldb.data; + +import java.lang.reflect.Method; +import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.sqldb.database.SqlDBMapper; + +public class SqlPropertyInfo { + + private final Class<?> javaType; + private final String name; + private final String sqlType; + + public SqlPropertyInfo(Method method) throws SqlDBMapper.UnableToMapClassException { + this.name = SqlDBMapper.getColumnName(method); + this.javaType = method.getReturnType(); + this.sqlType = SqlDBMapper.getDBType(this.javaType); + } + + public SqlPropertyInfo(String name, Class<?> javaType, String sqlType){ + this.name =name; + this.javaType = javaType; + this.sqlType = sqlType; + } + + public boolean isSqlStringType(){ + return String.class.equals(this.javaType); + } + + public String getName() { + return this.name; + } + + public String getSqlType() { + return sqlType; + } +} diff --git a/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/data/UserdataBuilder.java b/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/data/UserdataBuilder.java index bb1268cc9..b10aaaa60 100644 --- a/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/data/UserdataBuilder.java +++ b/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/data/UserdataBuilder.java @@ -26,7 +26,6 @@ import java.util.HashMap; import java.util.Map; import java.util.Objects; import javax.annotation.processing.Generated; -import org.opendaylight.yangtools.concepts.Builder; import org.opendaylight.yangtools.yang.binding.AbstractAugmentable; import org.opendaylight.yangtools.yang.binding.Augmentation; import org.opendaylight.yangtools.yang.binding.DataObject; @@ -71,7 +70,7 @@ import org.opendaylight.yangtools.yang.binding.DataObject; * */ @Generated("mdsal-binding-generator") -public class UserdataBuilder implements Builder<Userdata> { +public class UserdataBuilder { private String _id; private String _value; @@ -148,7 +147,7 @@ public class UserdataBuilder implements Builder<Userdata> { return this; } - @Override + public Userdata build() { return new UserdataImpl(this); } diff --git a/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/data/entity/HtDatabaseEventsService.java b/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/data/entity/HtDatabaseEventsService.java index 776c91fe5..09baa3775 100644 --- a/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/data/entity/HtDatabaseEventsService.java +++ b/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/data/entity/HtDatabaseEventsService.java @@ -35,6 +35,7 @@ import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.sqldb.SqlDBConfig; import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.sqldb.database.SqlDBMapper; import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.sqldb.database.SqlDBReaderWriter; import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.sqldb.database.SqlDBReaderWriterFault; +import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.sqldb.database.SqlDBReaderWriterInventory; import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.sqldb.database.SqlDBReaderWriterPm; import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DataProvider; import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.NetconfTimeStamp; @@ -68,12 +69,12 @@ public class HtDatabaseEventsService implements DataProvider { private static final NetconfTimeStamp NETCONFTIME_CONVERTER = NetconfTimeStampImpl.getConverter();; protected final SqlDBClient dbClient; - protected final String controllerId; + protected String controllerId; protected final SqlDBReaderWriter<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.read.connectionlog.list.output.Data> connectionlogRW; protected final SqlDBReaderWriter<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.read.eventlog.list.output.Data> eventlogRW; protected final SqlDBReaderWriter<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.read.faultlog.list.output.Data> eventRWFaultLog; protected final SqlDBReaderWriterFault<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.read.faultcurrent.list.output.Data> eventRWFaultCurrent; - protected final SqlDBReaderWriter<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.read.inventory.list.output.Data> equipmentRW; + protected final SqlDBReaderWriterInventory<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.read.inventory.list.output.Data> equipmentRW; protected final SqlDBReaderWriter<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.read.gui.cut.through.entry.output.Data> guicutthroughRW; protected final SqlDBReaderWriter<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.read.network.element.connection.list.output.Data> networkelementConnectionRW; protected final SqlDBReaderWriterPm<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.read.pmdata._15m.list.output.Data> pm15mRW; @@ -101,7 +102,7 @@ public class HtDatabaseEventsService implements DataProvider { this.eventRWFaultCurrent = new SqlDBReaderWriterFault<>(dbClient, Entity.Faultcurrent, config.getDbSuffix(), org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.read.faultcurrent.list.output.Data.class, this.controllerId); - this.equipmentRW = new SqlDBReaderWriter<>(dbClient, Entity.Inventoryequipment, config.getDbSuffix(), + this.equipmentRW = new SqlDBReaderWriterInventory<>(dbClient, Entity.Inventoryequipment, config.getDbSuffix(), org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.read.inventory.list.output.Data.class, this.controllerId); this.guicutthroughRW = new SqlDBReaderWriter<>(dbClient, diff --git a/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/database/SqlDBMapper.java b/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/database/SqlDBMapper.java index 1c24636db..8167c7bbf 100644 --- a/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/database/SqlDBMapper.java +++ b/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/database/SqlDBMapper.java @@ -34,7 +34,8 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; - +import java.util.stream.Collectors; +import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.sqldb.data.SqlPropertyInfo; import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.sqldb.query.filters.DBKeyValuePair; import org.onap.ccsdk.features.sdnr.wt.yang.mapper.YangToolsMapper; import org.onap.ccsdk.features.sdnr.wt.yang.mapper.YangToolsMapperHelper; @@ -91,8 +92,7 @@ public class SqlDBMapper { } public static <T> String createTable(Class<T> clazz, Entity e, String suffix, boolean autoIndex, - boolean withControllerId) - throws UnableToMapClassException { + boolean withControllerId) throws UnableToMapClassException { StringBuilder sb = new StringBuilder(); sb.append("CREATE TABLE IF NOT EXISTS `" + e.getName() + suffix + "` (\n"); if (autoIndex) { @@ -101,7 +101,7 @@ public class SqlDBMapper { } else { sb.append("`" + ID_DBCOL + "` " + STRING_DBTYPE + " " + getColumnOptions(ID_DBCOL, STRING_DBTYPE) + ",\n"); } - if(withControllerId) { + if (withControllerId) { sb.append("`" + ODLID_DBCOL + "` " + ODLID_DBTYPE + " " + getColumnOptions(ODLID_DBCOL, ODLID_DBTYPE) + ",\n"); } for (Method method : getFilteredMethods(clazz, true)) { @@ -115,7 +115,7 @@ public class SqlDBMapper { sb.append("`" + colName + "` " + dbType + " " + options + ",\n"); } sb.append("primary key(" + ID_DBCOL + ")"); - if(withControllerId) { + if (withControllerId) { sb.append(",foreign key(`" + ODLID_DBCOL + "`) references " + TABLENAME_CONTROLLER + "(" + ID_DBCOL + ")"); } @@ -138,6 +138,12 @@ public class SqlDBMapper { return options.toString(); } + /** + * + * @param clazz Class to scan for methods for their properties + * @param getterOrSetter true for using only getters, false using setters + * @return + */ public static List<Method> getFilteredMethods(Class<?> clazz, boolean getterOrSetter) { Method[] methods = clazz.getMethods(); List<Method> list = new ArrayList<>(); @@ -220,7 +226,7 @@ public class SqlDBMapper { return convertCamelToKebabCase(camelName); } - private static String getDBType(Class<?> valueType) throws UnableToMapClassException { + public static String getDBType(Class<?> valueType) throws UnableToMapClassException { String type = mariaDBTypeMap.getOrDefault(valueType, null); if (type == null) { if (implementsInterface(valueType, DataObject.class) || implementsInterface(valueType, List.class) @@ -292,6 +298,16 @@ public class SqlDBMapper { return result.toString(); } + public static List<SqlPropertyInfo> getProperties(Class<? extends DataObject> clazz) { + return getFilteredMethods(clazz, true).stream().map(e -> { + try { + return new SqlPropertyInfo(e); + } catch (UnableToMapClassException ex) { + throw new RuntimeException(ex); + } + }).collect(Collectors.toList()); + } + public static class UnableToMapClassException extends Exception { private static final long serialVersionUID = 1L; @@ -307,11 +323,12 @@ public class SqlDBMapper { } public static String escape(String o) { - return o.replace("'", "\'"); + return o.replace("'", "\\'"); } public static boolean isComplex(Class<?> valueType) { - return DataObject.class.isAssignableFrom(valueType) || List.class.isAssignableFrom(valueType); + return DataObject.class.isAssignableFrom(valueType) || List.class.isAssignableFrom(valueType) + || Set.class.isAssignableFrom(valueType); } public static Object getNumericValue(Object value, Class<?> valueType) { @@ -353,15 +370,15 @@ public class SqlDBMapper { } @SuppressWarnings("unchecked") - public static <S,T> List<T> read(ResultSet data, Class<T> clazz, String column) + public static <S, T> List<T> read(ResultSet data, Class<T> clazz, String column) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, SQLException, InstantiationException, SecurityException, NoSuchMethodException, JsonProcessingException { - if(data==null) { + if (data == null) { return Arrays.asList(); } S builder = findPOJOBuilder(clazz); - if(builder==null && column==null) { - throw new InstantiationException("unable to find builder for class "+clazz.getName()); + if (builder == null && column == null) { + throw new InstantiationException("unable to find builder for class " + clazz.getName()); } List<T> list = new ArrayList<>(); @@ -387,13 +404,14 @@ public class SqlDBMapper { } @SuppressWarnings("unchecked") - private static <S,T> T callBuild(S builder) throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException { - Method method = builder.getClass().getMethod("build"); - return (T) method.invoke(builder); - } + private static <S, T> T callBuild(S builder) throws NoSuchMethodException, SecurityException, + IllegalAccessException, IllegalArgumentException, InvocationTargetException { + Method method = builder.getClass().getMethod("build"); + return (T) method.invoke(builder); + } - @SuppressWarnings("unchecked") - private static <S,T> S findPOJOBuilder(Class<T> ac) throws InstantiationException, IllegalAccessException, + @SuppressWarnings("unchecked") + private static <S, T> S findPOJOBuilder(Class<T> ac) throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, SecurityException, NoSuchMethodException { try { String builder = null; @@ -407,7 +425,7 @@ public class SqlDBMapper { } if (builder != null) { Class<?> innerBuilder = YangToolsMapperHelper.findClass(builder); - //Class<Builder<T>> builderClass = (Class<Builder<T>>) innerBuilder; + // Class<Builder<T>> builderClass = (Class<Builder<T>>) innerBuilder; return (S) innerBuilder.getDeclaredConstructor().newInstance(); } } catch (ClassNotFoundException e) { @@ -464,9 +482,9 @@ public class SqlDBMapper { } else if (dstType.equals(Long.class)) { return value; } else if (dstType.equals(Integer.class)) { - return (int)value; + return (int) value; } else if (dstType.equals(Byte.class)) { - return (byte)value; + return (byte) value; } return null; } diff --git a/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/database/SqlDBReader.java b/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/database/SqlDBReader.java new file mode 100644 index 000000000..9798d12f8 --- /dev/null +++ b/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/database/SqlDBReader.java @@ -0,0 +1,210 @@ +/* + * ============LICENSE_START======================================================= + * ONAP : ccsdk features + * ================================================================================ + * Copyright (C) 2023 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.dataprovider.database.sqldb.database; + +import com.fasterxml.jackson.core.JsonProcessingException; +import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.sqldb.SqlDBClient; +import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.sqldb.data.PropertyList; +import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.sqldb.data.rpctypehelper.QueryResult; +import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.sqldb.query.SelectQuery; +import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.sqldb.query.SqlQuery; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.Entity; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.EntityInput; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.entity.input.Filter; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.entity.input.FilterBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.entity.input.FilterKey; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.lang.reflect.InvocationTargetException; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Optional; + +public class SqlDBReader<T extends DataObject> { + private static final Logger LOG = LoggerFactory.getLogger(SqlDBReader.class); + + protected final Entity entity; + private final Class<T> clazz; + protected final SqlDBClient dbService; + protected final String controllerId; + protected final String tableName; + protected final boolean ignoreControllerId; + protected final PropertyList propertyList; + public SqlDBReader(SqlDBClient dbService, Entity e, String dbSuffix, Class<T> clazz, + String controllerId) { + this(dbService, e, dbSuffix, clazz, controllerId, false); + } + + public SqlDBReader(SqlDBClient dbService, Entity e, String dbSuffix, Class<T> clazz, + String controllerId, boolean ignoreControllerId) { + this.dbService = dbService; + this.entity = e; + this.clazz = clazz; + this.tableName = this.entity.getName() + dbSuffix; + this.controllerId = controllerId; + this.ignoreControllerId = ignoreControllerId; + this.propertyList = new PropertyList(clazz); + } + + public long count(List<Filter> filter) throws SQLException { + String query; + if (filter == null || filter.isEmpty()) { + // query = String.format("SELECT table_rows FROM `information_schema`.`tables` " + // + "WHERE `table_schema` = '%s' AND `table_name` = '%s'", this.dbName, this.tableName); + query = String.format("SELECT COUNT(`id`) FROM `%s`", this.tableName); + } else { + query = String.format("SELECT COUNT(`id`) FROM `%s` %s", this.tableName, + SqlQuery.getWhereExpression(filter)); + } + ResultSet data = this.dbService.read(query); + if (data == null) { + return 0; + } + long cnt = 0; + if (data.next()) { + cnt = data.getLong(1); + } + try { + data.close(); + } catch (SQLException ignore) { + } + return cnt; + } + + public long count(List<Filter> list, String controllerId) throws SQLException { + if (list == null) { + list = new ArrayList<>(); + } + Optional<Filter> cFilter = + list.stream().filter(e -> SqlDBMapper.ODLID_DBCOL.equals(e.getProperty())).findFirst(); + if (!cFilter.isEmpty()) { + list.remove(cFilter.get()); + } + if (controllerId != null) { + list.add( + new FilterBuilder().setProperty(SqlDBMapper.ODLID_DBCOL).setFiltervalue(this.controllerId).build()); + } + return this.count(list); + } + + public QueryResult<T> getData(EntityInput input) { + SelectQuery query = new SelectQuery(this.tableName, input, this.controllerId); + if (LOG.isTraceEnabled()) { + LOG.trace("query={}", query.toSql()); + } + try { + ResultSet data = this.dbService.read(query.toSql()); + List<T> mappedData = SqlDBMapper.read(data, clazz); + final Map<FilterKey, Filter> filter = input.getFilter(); + try { + if (data != null) { + data.close(); + } + } catch (SQLException ignore) { + } + long total = this.count(filter != null ? new ArrayList<>(filter.values()) : null, this.controllerId); + return new QueryResult<T>(mappedData, query.getPage(), query.getPageSize(), total); + } catch (SQLException | IllegalAccessException | IllegalArgumentException | InvocationTargetException + | InstantiationException | SecurityException | NoSuchMethodException | JsonProcessingException e) { + LOG.warn("problem reading data {}: ", this.entity, e); + } + return QueryResult.createEmpty(); + } + + public <S extends DataObject> List<S> readAll(Class<S> clazz) { + SelectQuery query = new SelectQuery(this.tableName, this.controllerId); + if (LOG.isTraceEnabled()) { + LOG.trace("query={}", query.toSql()); + } + return this.readAll(clazz, query); + } + + public <S extends DataObject> List<S> readAll(Class<S> clazz, EntityInput input) { + SelectQuery query = new SelectQuery(this.tableName, input, this.controllerId); + return this.readAll(clazz, query); + } + public <S extends DataObject> List<S> searchAll(Class<S> clazz, EntityInput input, String searchTerm) { + SelectQuery query = new SelectQuery(this.tableName, input, this.controllerId); + if(searchTerm!=null && !searchTerm.isEmpty()) { + query.setAllPropertyFilter(searchTerm, this.propertyList); + } + return this.readAll(clazz, query); + } + public <S extends DataObject> List<S> readAll(Class<S> clazz, SelectQuery query) { + try { + ResultSet data = this.dbService.read(query.toSql()); + List<S> mappedData = SqlDBMapper.read(data, clazz); + try { + data.close(); + } catch (SQLException ignore) { + } + return mappedData; + } catch (SQLException | IllegalAccessException | IllegalArgumentException | InvocationTargetException + | InstantiationException | SecurityException | NoSuchMethodException | JsonProcessingException e) { + LOG.warn("problem reading all data{}: ", this.entity, e); + } + return null; + } + + public List<String> readAll(String key) { + SelectQuery query = new SelectQuery(this.tableName, key, this.controllerId).groupBy(key); + if (LOG.isTraceEnabled()) { + LOG.trace("query={}", query.toSql()); + } + try { + ResultSet data = this.dbService.read(query.toSql()); + List<String> mappedData = SqlDBMapper.read(data, String.class, key); + try { + data.close(); + } catch (SQLException ignore) { + } + return mappedData; + } catch (SQLException | IllegalAccessException | IllegalArgumentException | InvocationTargetException + | InstantiationException | SecurityException | NoSuchMethodException | JsonProcessingException e) { + LOG.warn("problem reading all data {} for key: ", this.entity, key, e); + } + return null; + } + + public T read(String id) { + SelectQuery query = + new SelectQuery(this.tableName, this.controllerId).addFilter(SqlDBMapper.ID_DBCOL, id); + if (LOG.isTraceEnabled()) { + LOG.trace("query={}", query.toSql()); + } + T item = null; + try { + ResultSet data = this.dbService.read(query.toSql()); + List<T> mappedData = SqlDBMapper.read(data, clazz); + item = mappedData.size() > 0 ? mappedData.get(0) : null; + } catch (SQLException | IllegalAccessException | IllegalArgumentException | InvocationTargetException + | InstantiationException | SecurityException | NoSuchMethodException | JsonProcessingException e) { + LOG.warn("problem reading data {}: ", this.entity, e); + } + return item; + } +} diff --git a/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/database/SqlDBReaderWriter.java b/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/database/SqlDBReaderWriter.java index 56a986e55..0df2dc5d6 100644 --- a/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/database/SqlDBReaderWriter.java +++ b/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/database/SqlDBReaderWriter.java @@ -21,128 +21,39 @@ */ package org.onap.ccsdk.features.sdnr.wt.dataprovider.database.sqldb.database; -import com.fasterxml.jackson.core.JsonProcessingException; -import java.lang.reflect.InvocationTargetException; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.Optional; import org.eclipse.jdt.annotation.Nullable; import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.sqldb.SqlDBClient; -import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.sqldb.data.rpctypehelper.QueryResult; import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.sqldb.query.DeleteQuery; import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.sqldb.query.InsertQuery; -import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.sqldb.query.SelectQuery; -import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.sqldb.query.SqlQuery; import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.sqldb.query.UpdateQuery; import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.sqldb.query.UpsertQuery; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.Entity; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.EntityInput; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.entity.input.Filter; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.entity.input.FilterBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.entity.input.FilterKey; import org.opendaylight.yangtools.yang.binding.DataObject; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class SqlDBReaderWriter<T extends DataObject> { +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.SQLException; +import java.util.Arrays; +import java.util.List; - private static final Logger LOG = LoggerFactory.getLogger(SqlDBReaderWriter.class); +public class SqlDBReaderWriter<T extends DataObject> extends SqlDBReader<T> { - protected final Entity entity; - private final Class<T> clazz; - protected final SqlDBClient dbService; - protected final String controllerId; - protected final String tableName; - private final boolean ignoreControllerId; + private static final Logger LOG = LoggerFactory.getLogger(SqlDBReaderWriter.class); public SqlDBReaderWriter(SqlDBClient dbService, Entity e, String dbSuffix, Class<T> clazz, String controllerId) { - this(dbService, e, dbSuffix, clazz, controllerId, false); + super(dbService, e, dbSuffix, clazz, controllerId); } public SqlDBReaderWriter(SqlDBClient dbService, Entity e, String dbSuffix, Class<T> clazz, String controllerId, boolean ignoreControllerId) { - this.dbService = dbService; - this.entity = e; - this.clazz = clazz; - this.tableName = this.entity.getName() + dbSuffix; - this.controllerId = controllerId; - this.ignoreControllerId = ignoreControllerId; - } - - public long count(List<Filter> filter) throws SQLException { - String query; - if (filter == null || filter.isEmpty()) { - // query = String.format("SELECT table_rows FROM `information_schema`.`tables` " - // + "WHERE `table_schema` = '%s' AND `table_name` = '%s'", this.dbName, this.tableName); - query = String.format("SELECT COUNT(`id`) FROM `%s`", this.tableName); - } else { - query = String.format("SELECT COUNT(`id`) FROM `%s` %s", this.tableName, - SqlQuery.getWhereExpression(filter)); - } - ResultSet data = this.dbService.read(query); - if(data==null) { - return 0; - } - long cnt = 0; - if (data.next()) { - cnt = data.getLong(1); - } - try { - data.close(); - } catch (SQLException ignore) { - } - return cnt; - } - - public long count(List<Filter> list, String controllerId) throws SQLException { - if (list == null) { - list = new ArrayList<>(); - } - Optional<Filter> cFilter = - list.stream().filter(e -> SqlDBMapper.ODLID_DBCOL.equals(e.getProperty())).findFirst(); - if (!cFilter.isEmpty()) { - list.remove(cFilter.get()); - } - if (controllerId != null) { - list.add( - new FilterBuilder().setProperty(SqlDBMapper.ODLID_DBCOL).setFiltervalue(this.controllerId).build()); - } - return this.count(list); - } - - public QueryResult<T> getData(EntityInput input) { - SelectQuery query = new SelectQuery(this.tableName, input, this.controllerId); - if (LOG.isTraceEnabled()) { - LOG.trace("query={}", query.toSql()); - } - try { - ResultSet data = this.dbService.read(query.toSql()); - List<T> mappedData = SqlDBMapper.read(data, clazz); - final Map<FilterKey, Filter> filter = input.getFilter(); - try { - if(data!=null) { - data.close(); - } - } catch (SQLException ignore) { - } - long total = this.count(filter != null ? new ArrayList<>(filter.values()) : null, this.controllerId); - return new QueryResult<T>(mappedData, query.getPage(), query.getPageSize(), total); - } catch (SQLException | IllegalAccessException | IllegalArgumentException | InvocationTargetException - | InstantiationException | SecurityException | NoSuchMethodException | JsonProcessingException e) { - LOG.warn("problem reading data {}: ", this.entity, e); - } - return QueryResult.createEmpty(); + super(dbService, e, dbSuffix, clazz, controllerId, ignoreControllerId); } - - public <S extends DataObject> String write(S object, String id) { if (id == null) { return this.writeWithoutId(object); @@ -309,62 +220,4 @@ public class SqlDBReaderWriter<T extends DataObject> { public int remove(@Nullable String id) { return this.remove(Arrays.asList(new FilterBuilder().setProperty("id").setFiltervalue(id).build())); } - - public <S extends DataObject> List<S> readAll(Class<S> clazz) { - SelectQuery query = new SelectQuery(this.tableName); - if (LOG.isTraceEnabled()) { - LOG.trace("query={}", query.toSql()); - } - try { - ResultSet data = this.dbService.read(query.toSql()); - List<S> mappedData = SqlDBMapper.read(data, clazz); - try { - data.close(); - } catch (SQLException ignore) { - } - return mappedData; - } catch (SQLException | IllegalAccessException | IllegalArgumentException | InvocationTargetException - | InstantiationException | SecurityException | NoSuchMethodException | JsonProcessingException e) { - LOG.warn("problem reading all data{}: ", this.entity, e); - } - return null; - } - - public List<String> readAll(String key) { - SelectQuery query = new SelectQuery(this.tableName, key, this.controllerId).groupBy(key); - if (LOG.isTraceEnabled()) { - LOG.trace("query={}", query.toSql()); - } - try { - ResultSet data = this.dbService.read(query.toSql()); - List<String> mappedData = SqlDBMapper.read(data, String.class, key); - try { - data.close(); - } catch (SQLException ignore) { - } - return mappedData; - } catch (SQLException | IllegalAccessException | IllegalArgumentException | InvocationTargetException - | InstantiationException | SecurityException | NoSuchMethodException | JsonProcessingException e) { - LOG.warn("problem reading all data {} for key: ", this.entity, key, e); - } - return null; - } - - public T read(String id) { - SelectQuery query = - new SelectQuery(this.tableName, this.controllerId).addFilter(SqlDBMapper.ID_DBCOL, id); - if (LOG.isTraceEnabled()) { - LOG.trace("query={}", query.toSql()); - } - T item = null; - try { - ResultSet data = this.dbService.read(query.toSql()); - List<T> mappedData = SqlDBMapper.read(data, clazz); - item = mappedData.size()>0? mappedData.get(0): null; - } catch (SQLException | IllegalAccessException | IllegalArgumentException | InvocationTargetException - | InstantiationException | SecurityException | NoSuchMethodException | JsonProcessingException e) { - LOG.warn("problem reading data {}: ", this.entity, e); - } - return item; - } } diff --git a/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/database/SqlDBReaderWriterInventory.java b/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/database/SqlDBReaderWriterInventory.java new file mode 100644 index 000000000..5ed44cb29 --- /dev/null +++ b/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/database/SqlDBReaderWriterInventory.java @@ -0,0 +1,87 @@ +/* + * ============LICENSE_START======================================================= + * ONAP : ccsdk features + * ================================================================================ + * Copyright (C) 2021 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.dataprovider.database.sqldb.database; + +import com.fasterxml.jackson.core.JsonProcessingException; +import java.lang.reflect.InvocationTargetException; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.sqldb.SqlDBClient; +import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.sqldb.data.rpctypehelper.QueryResult; +import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.sqldb.query.SelectQuery; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.Entity; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.EntityInput; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.entity.input.Filter; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.entity.input.FilterKey; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class SqlDBReaderWriterInventory<T extends DataObject> extends SqlDBReaderWriter<T> { + + private final Logger LOG = LoggerFactory.getLogger(SqlDBReaderWriterInventory.class); + + private static final String KEY = "node-id"; + + private static final FilterKey FILTERKEY = new FilterKey(KEY); + + public SqlDBReaderWriterInventory(SqlDBClient dbService, Entity e, String dbSuffix, Class<T> clazz, + String controllerId) { + super(dbService, e, dbSuffix, clazz, controllerId); + } + + /** + * get aggregated devices list + * + * @param input filter should be empty/no filter handled, only sortorder for KEY ('node-name') + * @return + */ + public QueryResult<String> getDataDeviceList(EntityInput input) { + + SelectQuery query = new SelectQuery(this.tableName, KEY, this.controllerId).groupBy(KEY); + query.setPagination(input.getPagination()); + Map<FilterKey, Filter> filter = input.getFilter(); + if (filter != null) { + for (Filter f : filter.values()) { + query.addFilter(f.getProperty(), f.getFiltervalue()); + } + } + + try { + ResultSet data = this.dbService.read(query.toSql()); + List<String> mappedData = SqlDBMapper.read(data, String.class, KEY); + try { data.close(); } catch (SQLException ignore) { } + Map<FilterKey, Filter> inpFilter = input.getFilter(); + long total = this.count(inpFilter != null ? new ArrayList<>(inpFilter.values()) : null, this.controllerId); + return new QueryResult<>(mappedData, query.getPage(), query.getPageSize(), total); + } catch (SQLException | IllegalAccessException | IllegalArgumentException | InvocationTargetException + | InstantiationException | SecurityException | NoSuchMethodException | JsonProcessingException e) { + LOG.warn("problem reading device list: ", e); + } + return null; + } + + +} diff --git a/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/database/SqlDBReaderWriterUserdata.java b/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/database/SqlDBReaderWriterUserdata.java index 258cd160f..398e9501a 100644 --- a/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/database/SqlDBReaderWriterUserdata.java +++ b/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/database/SqlDBReaderWriterUserdata.java @@ -30,8 +30,4 @@ public class SqlDBReaderWriterUserdata extends SqlDBReaderWriter<Userdata> { public SqlDBReaderWriterUserdata(SqlDBClient dbService, Entity e, String dbSuffix) { super(dbService, e, dbSuffix, Userdata.class, null, true); } - - - - } diff --git a/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/query/InsertQuery.java b/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/query/InsertQuery.java index f52fbd55a..c505816ef 100644 --- a/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/query/InsertQuery.java +++ b/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/query/InsertQuery.java @@ -107,7 +107,7 @@ public class InsertQuery<T extends DataObject> implements SqlQuery { } if (this.id != null && !cols.contains("`id`")) { cols.add("`id`"); - args.add("'" + this.id + "'"); + args.add("'" + SqlDBMapper.escape(this.id) + "'"); } if (!this.ignoreControllerId) { args.add("'" + this.controllerId + "'"); diff --git a/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/query/SelectQuery.java b/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/query/SelectQuery.java index a4df26bae..48165f1bf 100644 --- a/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/query/SelectQuery.java +++ b/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/query/SelectQuery.java @@ -28,7 +28,9 @@ import java.util.Map; import java.util.Set; import java.util.stream.Collectors; import org.eclipse.jdt.annotation.Nullable; +import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.sqldb.data.PropertyList; import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.sqldb.database.SqlDBMapper; +import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.sqldb.query.filters.SqlDBSearchFilter; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.EntityInput; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SortOrder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.entity.input.Filter; @@ -49,10 +51,12 @@ public class SelectQuery implements SqlQuery { private final String tableName; private final List<Filter> filters; private final List<String> sortExpressions; + private final String controllerId; private long page; private long pageSize; private final List<String> fields; private final List<String> groups; + private SqlDBSearchFilter allPropertyFilter; public SelectQuery(String tableName) { this(tableName, (String)null); @@ -68,6 +72,8 @@ public class SelectQuery implements SqlQuery { this.groups = new ArrayList<>(); this.page = DEFAULT_PAGE; this.pageSize = DEFAULT_PAGESIZE; + this.controllerId = controllerId; + this.allPropertyFilter = null; if (controllerId != null) { this.addFilter(SqlDBMapper.ODLID_DBCOL, controllerId); } @@ -146,7 +152,9 @@ public class SelectQuery implements SqlQuery { public void addSortOrder(String col, String order) { this.sortExpressions.add(String.format("`%s` %s", col, order)); } - + public void setAllPropertyFilter(String filter, PropertyList propertyList) { + this.allPropertyFilter = new SqlDBSearchFilter(propertyList, filter); + } public void setPagination(long page, long pageSize) { this.page = page; this.pageSize = pageSize; @@ -175,7 +183,7 @@ public class SelectQuery implements SqlQuery { } else { sb.append(String.format("SELECT `%s` FROM `%s`", String.join("`,`", this.fields), this.tableName)); } - sb.append(SqlQuery.getWhereExpression(this.filters)); + sb.append(SqlQuery.getWhereExpression(this.filters, this.controllerId, this.allPropertyFilter)); if (this.groups.size() > 0) { sb.append(String.format(" GROUP BY `%s`", String.join("`,`", this.groups))); } @@ -198,5 +206,27 @@ public class SelectQuery implements SqlQuery { this.groups.add(group); return this; } + @Override + public String toString() { + StringBuilder builder = new StringBuilder(); + builder.append("SelectQuery [tableName="); + builder.append(tableName); + builder.append(", filters="); + builder.append(filters); + builder.append(", sortExpressions="); + builder.append(sortExpressions); + builder.append(", page="); + builder.append(page); + builder.append(", pageSize="); + builder.append(pageSize); + builder.append(", fields="); + builder.append(fields); + builder.append(", groups="); + builder.append(groups); + builder.append("]"); + return builder.toString(); + } + + } diff --git a/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/query/SqlQuery.java b/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/query/SqlQuery.java index c954faadb..89638cc8b 100644 --- a/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/query/SqlQuery.java +++ b/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/query/SqlQuery.java @@ -36,6 +36,7 @@ import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.sqldb.database.SqlD import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.sqldb.query.filters.DBFilterKeyValuePair; import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.sqldb.query.filters.RangeSqlDBFilter; import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.sqldb.query.filters.RegexSqlDBFilter; +import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.sqldb.query.filters.SqlDBSearchFilter; import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.NetconfTimeStamp; import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.types.NetconfTimeStampImpl; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.entity.input.Filter; @@ -58,26 +59,32 @@ public interface SqlQuery { return getWhereExpression(filters, null); } public static String getWhereExpression(Collection<Filter> filters, String controllerId) { + return getWhereExpression(filters, controllerId, null); + } + public static String getWhereExpression(Collection<Filter> filters, String controllerId, SqlDBSearchFilter allPropertyFilter) { if (filters == null && controllerId == null) { return ""; } StringBuilder sb = new StringBuilder(); List<String> filters2 = filters != null - ? filters.stream().filter(e -> !"*".equals(e.getFiltervalue())).map(e -> getFilterExpression(e)) + ? filters.stream().filter(e -> !isFilterEmpty(e)).map(e -> getFilterExpression(e)) .collect(Collectors.toList()) : new ArrayList<>(); - if(controllerId!=null) { + if (controllerId != null) { filters2.add(getFilterExpression(SqlDBMapper.ODLID_DBCOL, controllerId)); } - if (!filters2.isEmpty() ) { + if(allPropertyFilter!=null){ + filters2.add(allPropertyFilter.getFilterExpression(true)); + } + if (!filters2.isEmpty()) { sb.append(" WHERE "); sb.append(StringUtil.join(" AND ", filters2)); } return sb.toString(); } - public static String getFilterExpression(Filter filter) { + private static String getFilterExpression(Filter filter) { String property = filter.getProperty(); List<String> values = collectValues(filter.getFiltervalue(), filter.getFiltervalues()).stream() .filter(e -> !"*".equals(e)).collect(Collectors.toList()); @@ -95,7 +102,7 @@ public interface SqlQuery { return null; } - public static String getFilterExpression(String property, String value) { + private static String getFilterExpression(String property, String value) { String filter = null; if (DbFilter.hasSearchParams(value)) { if (TIMESTAMPPROPERTYNAMES.contains(property.toLowerCase())) { @@ -118,7 +125,7 @@ public interface SqlQuery { return new DBFilterKeyValuePair(property, value).getFilterExpression(); } - static List<String> collectValues(String filtervalue, Set<String> filtervalues) { + private static List<String> collectValues(String filtervalue, Set<String> filtervalues) { if (filtervalues == null) { return Arrays.asList(filtervalue); } @@ -367,4 +374,18 @@ public interface SqlQuery { return upperEnd; } + + private static boolean isFilterEmpty(Filter filter) { + @Nullable Set<String> filtervalues = filter.getFiltervalues(); + @Nullable String filtervalue = filter.getFiltervalue(); + + List<String> allValues = filtervalues == null ? new ArrayList<>() : new ArrayList<>(filtervalues); + if (filtervalue != null) { + allValues.add(filtervalue); + } + + return allValues.isEmpty() || allValues.contains("*"); + } + + } diff --git a/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/query/filters/DBKeyValuePair.java b/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/query/filters/DBKeyValuePair.java index 70b683a1a..7ea393da5 100644 --- a/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/query/filters/DBKeyValuePair.java +++ b/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/query/filters/DBKeyValuePair.java @@ -23,6 +23,8 @@ package org.onap.ccsdk.features.sdnr.wt.dataprovider.database.sqldb.query.filter import java.math.BigInteger; +import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.sqldb.database.SqlDBMapper; + public class DBKeyValuePair<T> implements SqlDBFilter { private final String key; @@ -62,7 +64,7 @@ public class DBKeyValuePair<T> implements SqlDBFilter { } else if (this.getValue() instanceof BigInteger) { return String.format("`%s`=%d", this.key, (BigInteger)this.value); } else { - return String.format("`%s`='%s'", this.key, this.value); + return String.format("`%s`='%s'", this.key, SqlDBMapper.escape(this.value)); } } } diff --git a/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/query/filters/SqlDBFilter.java b/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/query/filters/SqlDBFilter.java index 2997c7040..3ff2bdbea 100644 --- a/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/query/filters/SqlDBFilter.java +++ b/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/query/filters/SqlDBFilter.java @@ -25,4 +25,8 @@ public interface SqlDBFilter { public String getFilterExpression(); + default String getFilterExpression(boolean enclose) { + return enclose ? String.format("(%s)", this.getFilterExpression()) : this.getFilterExpression(); + } + } diff --git a/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/query/filters/SqlDBSearchFilter.java b/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/query/filters/SqlDBSearchFilter.java new file mode 100644 index 000000000..db5f2cb3b --- /dev/null +++ b/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/sqldb/query/filters/SqlDBSearchFilter.java @@ -0,0 +1,45 @@ +/* + * ============LICENSE_START======================================================= + * ONAP : ccsdk features + * ================================================================================ + * Copyright (C) 2023 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.dataprovider.database.sqldb.query.filters; + +import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.sqldb.data.PropertyList; + +import java.util.List; +import java.util.stream.Collectors; + +public class SqlDBSearchFilter implements SqlDBFilter { + private final PropertyList propertyList; + private final String filter; + + public SqlDBSearchFilter(PropertyList propertyList, String filter) { + this.propertyList = propertyList; + this.filter = filter; + } + + @Override + public String getFilterExpression() { + List<String> tmp = this.propertyList.stream() + .map(e -> new RegexSqlDBFilter(e.getName(), this.filter).getFilterExpression()) + .collect(Collectors.toList()); + return String.join(" OR ", tmp); + } +} diff --git a/sdnr/wt/data-provider/dblib/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/dblib/test/TestMariaDataProvider.java b/sdnr/wt/data-provider/dblib/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/dblib/test/TestMariaDataProvider.java index 33703042e..5942321cf 100644 --- a/sdnr/wt/data-provider/dblib/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/dblib/test/TestMariaDataProvider.java +++ b/sdnr/wt/data-provider/dblib/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/dblib/test/TestMariaDataProvider.java @@ -23,14 +23,13 @@ */ package org.onap.ccsdk.features.sdnr.wt.dataprovider.dblib.test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import ch.vorburger.exec.ManagedProcessException; import java.io.IOException; import java.sql.SQLException; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.concurrent.TimeUnit; @@ -38,6 +37,10 @@ import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import org.junit.AfterClass; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; import org.junit.BeforeClass; import org.junit.Test; import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.sqldb.SqlDBClient; @@ -80,6 +83,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.pro import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.Guicutthrough; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.GuicutthroughBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.Inventory; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.InventoryBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.MaintenanceEntity; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.NetworkElementConnectionBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.NetworkElementConnectionEntity; @@ -92,6 +96,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.pro import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.ReadFaultcurrentListOutputBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.ReadFaultlogListOutputBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.ReadGuiCutThroughEntryOutputBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.ReadInventoryDeviceListOutputBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.ReadInventoryListOutputBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.ReadMaintenanceListOutputBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.ReadMediatorServerListOutputBuilder; @@ -118,7 +123,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.pro import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.read.network.element.connection.list.output.Data; import org.opendaylight.yangtools.yang.common.Uint32; import org.opendaylight.yangtools.yang.common.Uint64; -import ch.vorburger.exec.ManagedProcessException; public class TestMariaDataProvider { @@ -390,8 +394,47 @@ public class TestMariaDataProvider { dbProvider.writeInventory(NODEID1, list); data = dbProvider.readInventoryList(createInput(1, 50)); assertEquals(22, data.getData().size()); + ReadInventoryDeviceListOutputBuilder data2 = dbProvider.readInventoryDeviceList(createInput(1, 20)); + assertEquals(2, data2.getData().size()); + assertTrue(data2.getData().contains("sim1") && data2.getData().contains("sim2")); data = dbProvider.readInventoryList(createInput("tree-level", "0", 1, 50)); assertEquals(5, data.getData().size()); + + try { + dbProvider.writeInventory("sim3", loadListFile("/inventory2.json", Inventory.class)); + } catch (IOException e) { + fail("problem loading inventory data2"); + } + data2 = dbProvider.readInventoryDeviceList(createInput(1, 20)); + assertEquals(3, data2.getData().size()); + assertTrue(data2.getData().contains("sim1") && data2.getData().contains("sim2") && + data2.getData().contains("sim3")); + } + + @Test + public void testInventoryWithComplexTypes() { + try { + dbClient.delete(new DeleteQuery(Entity.Inventoryequipment, null).toSql()); + } catch (SQLException e) { + e.printStackTrace(); + fail("problem clearing inventoryequipment"); + } + ReadInventoryListOutputBuilder data = dbProvider.readInventoryList(createInput(1, 20)); + assertEquals(0, data.getData().size()); + try { + Inventory inventory = new InventoryBuilder() + .setContainedHolder(new HashSet<>( + Arrays.asList("STM1-1", "Radio-2A", "LAN-3-SFP", "Radio-1A", "STM1-2", "LAN-4-SFP"))) + .setSerial("14209652001003620").setDescription("INDOOR UNIT ALCPlus2e") + .setTreeLevel(Uint32.valueOf(0)).setNodeId("NTS_ONF14").build(); + dbProvider.writeInventory(NODEID1, new ArrayList<Inventory>(Arrays.asList(inventory))); + } catch (Exception e) { + e.printStackTrace(); + fail("problem loading inventory data"); + + } + data = dbProvider.readInventoryList(createInput(1, 50)); + assertEquals(1, data.getData().size()); } @Test diff --git a/sdnr/wt/data-provider/dblib/src/test/resources/inventory2.json b/sdnr/wt/data-provider/dblib/src/test/resources/inventory2.json new file mode 100644 index 000000000..b13220f28 --- /dev/null +++ b/sdnr/wt/data-provider/dblib/src/test/resources/inventory2.json @@ -0,0 +1,364 @@ +[ + { + "description": "WS/p8.module/a2.module#5", + "date": "2013-04-13T00:00:00.0Z", + "version": "a2.module-newest", + "node-id": "sim3", + "uuid": "a2.module-1.1.5.5", + "parent-uuid": "CARD-1.1.5.0", + "contained-holder": [ + "SUBRACK-1.55.0.0" + ], + "tree-level": 2, + "manufacturer-identifier": "ONF-Wireless-Transport", + "serial": "310330015", + "part-type-id": "3EM23141AD01", + "model-identifier": "CRPQABVFAA", + "type-name": "a2.module" + }, + { + "description": "WS/DS1", + "date": "2007-08-27T00:00:00.0Z", + "version": "p1.module", + "node-id": "sim3", + "uuid": "CARD-1.1.7.0", + "parent-uuid": "SHELF-1.1.0.0", + "contained-holder": [], + "tree-level": 1, + "manufacturer-identifier": "CIT", + "serial": "serial-number-s3s", + "part-type-id": "part-number-s3s", + "model-identifier": "model-id-s3s", + "type-name": "p1.module_A" + }, + { + "description": "MWR#55Ch#1/a2.moduletraff", + "date": "2013-04-13T00:00:00.0Z", + "version": "a2.module-newest", + "node-id": "sim3", + "uuid": "a2.module-1.55.1.2", + "parent-uuid": "IDU-1.55.0.0", + "contained-holder": [], + "tree-level": 1, + "manufacturer-identifier": "ONF-Wireless-Transport", + "serial": "310330015", + "part-type-id": "3EM23141AD01", + "model-identifier": "CRPQABVFAA", + "type-name": "a2.module" + }, + { + "description": "MWR#65Ch#1/a2.moduletraff", + "date": "2013-04-13T00:00:00.0Z", + "version": "a2.module-newest", + "node-id": "sim3", + "uuid": "a2.module-1.65.1.2", + "parent-uuid": "IDU-1.65.0.0", + "contained-holder": [], + "tree-level": 1, + "manufacturer-identifier": "ONF-Wireless-Transport", + "serial": "310330008", + "part-type-id": "3EM23141AD01", + "model-identifier": "CRPQABVFAA", + "type-name": "a2.module" + }, + { + "description": "WS-8", + "date": "2017-09-09T00:00:00.0Z", + "version": "a2.module-newest", + "node-id": "sim3", + "uuid": "SHELF-1.1.0.0", + "parent-uuid": "network-element", + "contained-holder": [ + "SLOT-1.1.1.0", + "SLOT-1.1.2.0", + "SLOT-1.1.3.0", + "SLOT-1.1.4.0", + "SLOT-1.1.5.0", + "SLOT-1.1.6.0", + "SLOT-1.1.7.0", + "SLOT-1.1.8.0", + "SLOT-1.1.9.0" + ], + "tree-level": 0, + "manufacturer-identifier": "ONF-Wireless-Transport", + "serial": "Serial1", + "part-type-id": "Partnumber", + "model-identifier": "model-id", + "type-name": "WS-8" + }, + { + "description": "WS/CORE-MAIN/a2.module#5", + "date": "2005-11-09T00:00:00.0Z", + "version": "a2.module-newest", + "node-id": "sim3", + "uuid": "a2.module-1.1.1.5", + "parent-uuid": "CARD-1.1.1.0", + "contained-holder": [ + "SUBRACK-1.15.0.0" + ], + "tree-level": 2, + "manufacturer-identifier": "ONF-Wireless-Transport", + "serial": "0003548168", + "part-type-id": "3FE25774AA01", + "model-identifier": "VAUIAEYAAA", + "type-name": "a2.module" + }, + { + "description": "WS/CORE-MAIN/a2.module#8", + "date": "2010-02-05T00:00:00.0Z", + "version": "a2.module-newest", + "node-id": "sim3", + "uuid": "a2.module-1.1.1.8", + "parent-uuid": "CARD-1.1.1.0", + "contained-holder": [ + "SUBRACK-1.18.0.0" + ], + "tree-level": 2, + "manufacturer-identifier": "ONF-Wireless-Transport", + "serial": "01T441601301", + "part-type-id": "1AB376720002", + "model-identifier": "NGI7AMLMAA", + "type-name": "a2.module" + }, + { + "description": "WS/p8.module/a2.module#5", + "date": "2013-04-13T00:00:00.0Z", + "version": "a2.module-newest", + "node-id": "sim3", + "uuid": "a2.module-1.1.6.5", + "parent-uuid": "CARD-1.1.6.0", + "contained-holder": [ + "SUBRACK-1.65.0.0" + ], + "tree-level": 2, + "manufacturer-identifier": "ONF-Wireless-Transport", + "serial": "310330008", + "part-type-id": "3EM23141AD01", + "model-identifier": "CRPQABVFAA", + "type-name": "a2.module" + }, + { + "description": "MWR-hyper Dir#5.6-Ch#1", + "date": "", + "version": "extrem-hyper", + "node-id": "sim3", + "uuid": "ODU-1.56.0.0", + "parent-uuid": "network-element", + "contained-holder": [ + "PORT-1.56.1.2", + "PORT-1.56.1.3", + "PORT-1.56.1.4" + ], + "tree-level": 0, + "manufacturer-identifier": "", + "serial": "", + "part-type-id": "", + "model-identifier": "", + "type-name": "MWR-hyper" + }, + { + "description": "MWR#56Ch#1/a2.moduletraff", + "date": "2017-09-09T00:00:00.0Z", + "version": "a2.module-newest", + "node-id": "sim3", + "uuid": "a2.module-1.56.1.2", + "parent-uuid": "ODU-1.56.0.0", + "contained-holder": [], + "tree-level": 1, + "manufacturer-identifier": "ONF-Wireless-Transport", + "serial": "Serial1", + "part-type-id": "Partnumber", + "model-identifier": "model-id", + "type-name": "a2.module" + }, + { + "description": "MWR-ng Dir#6.5-Ch#1", + "date": "2014-01-16T00:00:00.0Z", + "version": "MWR-ng", + "node-id": "sim3", + "uuid": "IDU-1.65.0.0", + "parent-uuid": "network-element", + "contained-holder": [ + "PORT-1.65.1.4", + "PORT-1.65.1.2" + ], + "tree-level": 0, + "manufacturer-identifier": "ONF-Wireless-Transport", + "serial": "WAUZZI", + "part-type-id": "3DB76047BAAA02", + "model-identifier": "model-id-s3s", + "type-name": "MWR-ng" + }, + { + "description": "MWR#55Ch#0/RxDiv", + "date": "2014-01-08T00:00:00.0Z", + "version": "2017", + "node-id": "sim3", + "uuid": "CARD-1.65.1.4", + "parent-uuid": "IDU-1.65.0.0", + "contained-holder": [], + "tree-level": 1, + "manufacturer-identifier": "ONF-Wireless-Transport", + "serial": "Serie2017-13", + "part-type-id": "partNo2017-12", + "model-identifier": "model-id-s3s", + "type-name": "RxDiv" + }, + { + "description": "WS/p8.module", + "date": "2013-11-23T00:00:00.0Z", + "version": "234", + "node-id": "sim3", + "uuid": "CARD-1.1.6.0", + "parent-uuid": "SHELF-1.1.0.0", + "contained-holder": [ + "PORT-1.1.6.5", + "PORT-1.1.6.7", + "PORT-1.1.6.6", + "PORT-1.1.6.8" + ], + "tree-level": 1, + "manufacturer-identifier": "SAN", + "serial": "serial-number-124", + "part-type-id": "part-number-12", + "model-identifier": "model-id-12", + "type-name": "p8.module" + }, + { + "description": "WS/DS3", + "date": "2008-10-21T00:00:00.0Z", + "version": "unknown", + "node-id": "sim3", + "uuid": "CARD-1.1.8.0", + "parent-uuid": "SHELF-1.1.0.0", + "contained-holder": [], + "tree-level": 1, + "manufacturer-identifier": "ONF-Wireless-Transport", + "serial": "sd-dsa-eqw", + "part-type-id": "unknown", + "model-identifier": "model-id-s3s", + "type-name": "p4.module" + }, + { + "description": "WS/wind", + "date": "2007-02-19T00:00:00.0Z", + "version": "wind", + "node-id": "sim3", + "uuid": "CARD-1.1.9.0", + "parent-uuid": "SHELF-1.1.0.0", + "contained-holder": [], + "tree-level": 1, + "manufacturer-identifier": "CIT", + "serial": "proto-type", + "part-type-id": "party-yea", + "model-identifier": "model-id-s3s", + "type-name": "wind" + }, + { + "description": "MWR#55Ch#1/RxDiv", + "date": "2014-01-07T00:00:00.0Z", + "version": "2017", + "node-id": "sim3", + "uuid": "CARD-1.55.1.4", + "parent-uuid": "IDU-1.55.0.0", + "contained-holder": [], + "tree-level": 1, + "manufacturer-identifier": "ONF-Wireless-Transport", + "serial": "Serie2017-12", + "part-type-id": "partNo2017-12", + "model-identifier": "model-id-s3s", + "type-name": "RxDiv" + }, + { + "description": "WS/CORE-MAIN/a2.module#7", + "date": "2009-01-19T00:00:00.0Z", + "version": "a2.module-newest", + "node-id": "sim3", + "uuid": "a2.module-1.1.1.7", + "parent-uuid": "CARD-1.1.1.0", + "contained-holder": [ + "SUBRACK-1.17.0.0" + ], + "tree-level": 2, + "manufacturer-identifier": "ONF-Wireless-Transport", + "serial": "91T403003322", + "part-type-id": "1AB187280031", + "model-identifier": "mod2", + "type-name": "a2.module" + }, + { + "description": "MWR-ng Dir#5.5-Ch#1", + "date": "2014-01-15T00:00:00.0Z", + "version": "MWR-ng", + "node-id": "sim3", + "uuid": "IDU-1.55.0.0", + "parent-uuid": "network-element", + "contained-holder": [ + "PORT-1.55.1.2", + "PORT-1.55.1.4" + ], + "tree-level": 0, + "manufacturer-identifier": "ONF-Wireless-Transport", + "serial": "Serie2017-14", + "part-type-id": "3DB76047BAAA02", + "model-identifier": "model-id-s3s", + "type-name": "MWR-ng" + }, + { + "description": "WS/CORE-MAIN", + "date": "2015-08-17T00:00:00.0Z", + "version": "123", + "node-id": "sim3", + "uuid": "CARD-1.1.1.0", + "parent-uuid": "SHELF-1.1.0.0", + "contained-holder": [ + "PORT-1.1.1.6", + "PORT-1.1.1.5", + "PORT-1.1.1.8", + "PORT-1.1.1.7" + ], + "tree-level": 1, + "manufacturer-identifier": "SAN", + "serial": "asdf-asdasd-asd", + "part-type-id": "part-number-2", + "model-identifier": "model-id-2", + "type-name": "latest" + }, + { + "description": "WS/p8.module", + "date": "2013-10-21T00:00:00.0Z", + "version": "234", + "node-id": "sim3", + "uuid": "CARD-1.1.5.0", + "parent-uuid": "SHELF-1.1.0.0", + "contained-holder": [ + "PORT-1.1.5.6", + "PORT-1.1.5.5", + "PORT-1.1.5.8", + "PORT-1.1.5.7" + ], + "tree-level": 1, + "manufacturer-identifier": "SAN", + "serial": "africa", + "part-type-id": "part-number-12", + "model-identifier": "model-id-12", + "type-name": "p8.module" + }, + { + "description": "WS/p8.module/a2.module#6", + "date": "", + "version": "", + "node-id": "sim3", + "uuid": "a2.module-1.1.5.6", + "parent-uuid": "CARD-1.1.5.0", + "contained-holder": [ + "SUBRACK-1.56.0.0" + ], + "tree-level": 2, + "manufacturer-identifier": "", + "serial": "", + "part-type-id": "", + "model-identifier": "", + "type-name": "a2.module" + } +]
\ No newline at end of file diff --git a/sdnr/wt/data-provider/feature/pom.xml b/sdnr/wt/data-provider/feature/pom.xml index 0204097e6..d28c03782 100644 --- a/sdnr/wt/data-provider/feature/pom.xml +++ b/sdnr/wt/data-provider/feature/pom.xml @@ -22,13 +22,14 @@ ~ ============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>single-feature-parent</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/data-provider/installer/pom.xml b/sdnr/wt/data-provider/installer/pom.xml index b61ff667a..69086ecb8 100755 --- a/sdnr/wt/data-provider/installer/pom.xml +++ b/sdnr/wt/data-provider/installer/pom.xml @@ -22,13 +22,14 @@ ~ ============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>odlparent-lite</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/data-provider/model/pom.xml b/sdnr/wt/data-provider/model/pom.xml index c683a7a05..56526ef50 100644 --- a/sdnr/wt/data-provider/model/pom.xml +++ b/sdnr/wt/data-provider/model/pom.xml @@ -22,13 +22,14 @@ ~ ============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.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> @@ -71,6 +72,11 @@ <artifactId>jackson-databind</artifactId> <scope>provided</scope> </dependency> + <dependency> + <groupId>org.json</groupId> + <artifactId>json</artifactId> + <scope>provided</scope> + </dependency> </dependencies> <build> diff --git a/sdnr/wt/data-provider/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/model/BaseInventoryTreeProvider.java b/sdnr/wt/data-provider/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/model/BaseInventoryTreeProvider.java new file mode 100644 index 000000000..3d7f82ebd --- /dev/null +++ b/sdnr/wt/data-provider/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/model/BaseInventoryTreeProvider.java @@ -0,0 +1,206 @@ +/* + * ============LICENSE_START======================================================= + * ONAP : ccsdk features + * ================================================================================ + * Copyright (C) 2023 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.dataprovider.model; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import org.onap.ccsdk.features.sdnr.wt.common.database.queries.SortOrder; +import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.types.DataTreeChildObject; +import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.types.DataTreeObject; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.InventoryEntity; +import org.opendaylight.yangtools.yang.common.Uint32; + +public abstract class BaseInventoryTreeProvider implements InventoryTreeProvider { + + private static final String INVENTORY_PROPERTY_TREELEVEL = "tree-level"; + protected static final String INVENTORY_PROPERTY_NODEID = "node-id"; + protected static final String INVENTORY_PROPERTY_UUID = "uuid"; + protected static final String INVENTORY_PROPERTY_PARENTUUID = "parent-uuid"; + + protected abstract List<String> getAllNodeIds(); + + protected abstract List<InventoryEntity> search(String filter, String sortOrderProperty, SortOrder sortOrder); + + protected abstract List<InventoryEntity> search(String filter, String nodeId, String parentUuid, String uuid, + String sortOrderProperty, SortOrder sortOrder); + + protected abstract List<InventoryEntity> getItemsForNodes(List<String> nodeIds, String sortOrderProperty, + SortOrder sortOrder); + + + @Override + public DataTreeObject readInventoryTree(List<String> tree, String filter) throws IOException { + + //root nodes will be node-information -> below inventory + if (tree == null || tree.size() <= 0) { + return this.readInventoryTreeWithNode(filter); + } + //root node will be inventory on tree-level if sliced treePath + else { + return this.readInventoryTreeForNode(tree.get(0), tree.subList(0, tree.size() - 1), filter); + } + + } + + /** + * Provide inventory list for a node, starting from element described by path + * @param nodeId node + * @param path describing element + * @param filter + * @return Inventory tree + */ + private DataTreeObject readInventoryTreeForNode(String nodeId, List<String> path, String filter) + throws IOException { + DataTreeObject tree = new DataTreeObject(INVENTORY_PROPERTY_PARENTUUID, INVENTORY_PROPERTY_UUID); + //get parent uuid of path + final String parentUuid = path.size() > 1 ? path.get(path.size() - 2) : null; + //get uuid of path + final String uuid = path.size() > 0 ? path.get(path.size() - 1) : null; + List<InventoryEntity> matches = + this.search(filter, nodeId, parentUuid, uuid, INVENTORY_PROPERTY_TREELEVEL, SortOrder.ASCENDING); + //tree.a(subtreePath); + List<InventoryEntity> others = + this.search((String) null, nodeId, null, null, INVENTORY_PROPERTY_TREELEVEL, SortOrder.ASCENDING); + if (matches.size() > 0) { + int treeLevelToStart = (path == null || path.size() <= 0) ? 0 : path.size() - 1; + //build tree + //fill root elems + for (InventoryEntity hit : matches) { + if (hit.getTreeLevel().longValue() == treeLevelToStart) { + tree.put(hit.getId(), + new DataTreeChildObject(hit.getUuid(), true) + .setProperty(INVENTORY_PROPERTY_UUID, hit.getUuid()) + .setProperty(INVENTORY_PROPERTY_PARENTUUID, hit.getParentUuid())); + } + } + for (InventoryEntity hit : others) { + if (hit.getTreeLevel().longValue() == treeLevelToStart) { + tree.putIfNotExists(hit.getId(), + new DataTreeChildObject(hit.getUuid(), false) + .setProperty(INVENTORY_PROPERTY_UUID, hit.getUuid()) + .setProperty(INVENTORY_PROPERTY_PARENTUUID, hit.getParentUuid())); + } + } + //fill child elems + for (InventoryEntity hit : matches) { + if (hit.getTreeLevel().longValue() > treeLevelToStart) { + tree.put(hit.getTreeLevel().longValue() - treeLevelToStart - 1, hit.getId(), + new DataTreeChildObject(hit.getUuid(), true) + .setProperty(INVENTORY_PROPERTY_UUID, hit.getUuid()) + .setProperty(INVENTORY_PROPERTY_PARENTUUID, hit.getParentUuid())); + } + } + for (InventoryEntity hit : others) { + if (hit.getTreeLevel().longValue() > treeLevelToStart) { + tree.putIfNotExists(hit.getTreeLevel().longValue() - treeLevelToStart - 1, hit.getId(), + new DataTreeChildObject(hit.getUuid(), false) + .setProperty(INVENTORY_PROPERTY_UUID, hit.getUuid()) + .setProperty(INVENTORY_PROPERTY_PARENTUUID, hit.getParentUuid())); + } + } + tree.removeUnmatchedPaths(); + } + return tree; + } + + /** + * node will be root elements inventory information below from level-1 + * + * @param filter + * @return + * @throws IOException + */ + private DataTreeObject readInventoryTreeWithNode(String filter) throws IOException { + DataTreeObject tree = new DataTreeObject(INVENTORY_PROPERTY_PARENTUUID, INVENTORY_PROPERTY_UUID); + + List<InventoryEntity> matches = this.search(filter, INVENTORY_PROPERTY_TREELEVEL, SortOrder.ASCENDING); + List<InventoryEntity> others = null; + if (matches.size() > 0) { + if (filter != null) { + //find all parents up to tree-level 0 + String nodeId = ""; + List<String> alreadyInList = new ArrayList<>(); + for (InventoryEntity hit : matches) { + nodeId = hit.getNodeId(); + if (alreadyInList.contains(nodeId)) { + continue; + } + alreadyInList.add(nodeId); + tree.put(nodeId, + new DataTreeChildObject(nodeId, false).setProperty(INVENTORY_PROPERTY_UUID, nodeId)); + + } + others = this.getItemsForNodes(alreadyInList, INVENTORY_PROPERTY_TREELEVEL, SortOrder.ASCENDING); + } else { + List<String> nodeIds = this.getAllNodeIds(); + for (String node : nodeIds) { + tree.put(node, new DataTreeChildObject(node, false).setProperty(INVENTORY_PROPERTY_UUID, node)); + } + } + + //build tree + //fill root elems + for (InventoryEntity hit : matches) { + if (hit.getTreeLevel() == Uint32.ZERO) { + tree.put(0, hit.getId(), + new DataTreeChildObject(hit.getUuid(), true) + .setProperty(INVENTORY_PROPERTY_UUID, hit.getUuid()) + .setProperty(INVENTORY_PROPERTY_PARENTUUID, hit.getNodeId())); + } + } + if (others != null) { + for (InventoryEntity hit : others) { + if (hit.getTreeLevel() == Uint32.ZERO) { + tree.putIfNotExists(0, hit.getId(), + new DataTreeChildObject(hit.getUuid(), false) + .setProperty(INVENTORY_PROPERTY_UUID, hit.getUuid()) + .setProperty(INVENTORY_PROPERTY_PARENTUUID, hit.getNodeId())); + } + } + } + //fill child elements + for (InventoryEntity hit : matches) { + long treeLevel = hit.getTreeLevel().longValue(); + if (treeLevel > 0) { + tree.put(treeLevel, hit.getId(), + new DataTreeChildObject(hit.getUuid(), true) + .setProperty(INVENTORY_PROPERTY_UUID, hit.getUuid()) + .setProperty(INVENTORY_PROPERTY_PARENTUUID, hit.getParentUuid())); + } + } + if (others != null) { + for (InventoryEntity hit : others) { + long treeLevel = hit.getTreeLevel().longValue(); + if (treeLevel > 0) { + tree.putIfNotExists(treeLevel, hit.getId(), + new DataTreeChildObject(hit.getUuid(), false) + .setProperty(INVENTORY_PROPERTY_UUID, hit.getUuid()) + .setProperty(INVENTORY_PROPERTY_PARENTUUID, hit.getParentUuid())); + } + } + } + tree.removeUnmatchedPaths(); + } + return tree; + } +} diff --git a/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/DatabaseDataProvider.java b/sdnr/wt/data-provider/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/model/DatabaseDataProvider.java index fbd105aa1..97b8b0de5 100644 --- a/sdnr/wt/data-provider/dblib/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/DatabaseDataProvider.java +++ b/sdnr/wt/data-provider/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/model/DatabaseDataProvider.java @@ -21,15 +21,11 @@ * ============LICENSE_END========================================================= * */ -package org.onap.ccsdk.features.sdnr.wt.dataprovider.database; +package org.onap.ccsdk.features.sdnr.wt.dataprovider.model; import java.io.IOException; import java.util.concurrent.TimeUnit; import org.onap.ccsdk.features.sdnr.wt.common.database.HtDatabaseClient; -import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DataProvider; -import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.HtDatabaseMaintenance; -import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.HtDatabaseMediatorserver; -import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.HtUserdataManager; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.CreateMaintenanceInput; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.CreateMaintenanceOutputBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.CreateMediatorServerInput; @@ -48,8 +44,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.pro import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.ReadEventlogListOutputBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.ReadFaultcurrentListOutputBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.ReadFaultlogListOutputBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.ReadGuiCutThroughEntryOutput; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.ReadGuiCutThroughEntryOutputBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.ReadInventoryDeviceListOutputBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.ReadInventoryListOutputBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.ReadMaintenanceListOutputBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.ReadMediatorServerListOutputBuilder; @@ -138,4 +134,8 @@ public interface DatabaseDataProvider { HtUserdataManager getUserManager(); + InventoryTreeProvider getInventoryTreeProvider(); + + ReadInventoryDeviceListOutputBuilder readInventoryDeviceList(EntityInput input); + } diff --git a/sdnr/wt/data-provider/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/model/InventoryTreeProvider.java b/sdnr/wt/data-provider/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/model/InventoryTreeProvider.java new file mode 100644 index 000000000..e9523418a --- /dev/null +++ b/sdnr/wt/data-provider/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/model/InventoryTreeProvider.java @@ -0,0 +1,31 @@ +/* + * ============LICENSE_START======================================================= + * ONAP : ccsdk features + * ================================================================================ + * Copyright (C) 2023 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.dataprovider.model; + +import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.types.DataTreeObject; + +import java.io.IOException; +import java.util.List; + +public interface InventoryTreeProvider { + public DataTreeObject readInventoryTree(List<String> tree, String filter) throws IOException; +} diff --git a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/DataTreeChildObject.java b/sdnr/wt/data-provider/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/model/types/DataTreeChildObject.java index 05e6d2f13..227020505 100644 --- a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/DataTreeChildObject.java +++ b/sdnr/wt/data-provider/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/model/types/DataTreeChildObject.java @@ -19,7 +19,7 @@ * ============LICENSE_END========================================================= * */ -package org.onap.ccsdk.features.sdnr.wt.dataprovider.http; +package org.onap.ccsdk.features.sdnr.wt.dataprovider.model.types; import java.util.ArrayList; import java.util.HashMap; @@ -31,23 +31,15 @@ import org.json.JSONObject; public class DataTreeChildObject { private final String label; -// private final String ownSeverity; -// private final String childrenSeveritySummary; - private final boolean isMatch; + private final boolean isSearchMatch; private final Map<String, DataTreeChildObject> children; private final Map<String, Object> properties; - public boolean isMatch() { - return this.isMatch; - } - public DataTreeChildObject(String label, boolean isMatch, Map<String, DataTreeChildObject> children, String ownSeverity, String childrenSeveritySummary) { this.label = label; - this.isMatch = isMatch; + this.isSearchMatch = isMatch; this.children = children; -// this.ownSeverity = ownSeverity; -// this.childrenSeveritySummary = childrenSeveritySummary; this.properties = new HashMap<>(); } @@ -56,26 +48,18 @@ public class DataTreeChildObject { return this; } - public Object getProperty(String key, Object defaultValue) { - return this.properties.getOrDefault(key, defaultValue); - } - - /** - * @param string - * @param b - */ public DataTreeChildObject(String label, boolean isMatch) { this(label, isMatch, new HashMap<>(), null, null); } - /** - * @param treeLevel - * @param id - * @param data - * @param childKey - * @param parentKey - * @return - */ + public boolean isMatch() { + return this.isSearchMatch; + } + + public Object getProperty(String key, Object defaultValue) { + return this.properties.getOrDefault(key, defaultValue); + } + public boolean putChild(long treeLevel, String id, DataTreeChildObject data, String parentKey, String childKey) { Object itemValue; Object itemValueToMatch = data.getProperty(parentKey, null); @@ -100,14 +84,6 @@ public class DataTreeChildObject { return false; } - /** - * @param treeLevel - * @param id - * @param data - * @param parentKey - * @param childKey - * @return - */ public boolean putChildIfNotExists(long treeLevel, String id, DataTreeChildObject data, String parentKey, String childKey) { Object itemValue; @@ -134,13 +110,10 @@ public class DataTreeChildObject { return false; } - /** - * @return - */ public JSONObject toJSONObject() { JSONObject o = new JSONObject(); o.put("label", this.label); - o.put("isMatch", this.isMatch); + o.put("isMatch", this.isSearchMatch); JSONObject c = new JSONObject(); if (this.children != null) { for (Entry<String, DataTreeChildObject> entry : this.children.entrySet()) { @@ -148,15 +121,13 @@ public class DataTreeChildObject { } } o.put("children", c); - //o.put("ownSeverity", null); - //o.put("childrenSeveritySummary", null); return o; } public boolean hasChildMatching() { boolean match = false; for (DataTreeChildObject child : this.children.values()) { - match = match || child.hasChildMatching() || this.isMatch; + match = match || child.hasChildMatching() || this.isSearchMatch; if (match) { break; } @@ -164,13 +135,10 @@ public class DataTreeChildObject { return match; } - /** - * - */ public void removeUnmatchedPaths() { List<String> toRemove = new ArrayList<>(); for (Entry<String, DataTreeChildObject> entry : this.children.entrySet()) { - if (!(entry.getValue().hasChildMatching() || entry.getValue().isMatch)) { + if (!(entry.getValue().hasChildMatching() || entry.getValue().isSearchMatch)) { toRemove.add(entry.getKey()); } else { entry.getValue().removeUnmatchedPaths(); @@ -182,6 +150,6 @@ public class DataTreeChildObject { } public boolean hasChildren() { - return this.children!=null && !this.children.isEmpty(); + return this.children != null && !this.children.isEmpty(); } } diff --git a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/DataTreeObject.java b/sdnr/wt/data-provider/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/model/types/DataTreeObject.java index f12ff3deb..c4b2b128d 100644 --- a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/DataTreeObject.java +++ b/sdnr/wt/data-provider/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/model/types/DataTreeObject.java @@ -19,7 +19,7 @@ * ============LICENSE_END========================================================= * */ -package org.onap.ccsdk.features.sdnr.wt.dataprovider.http; +package org.onap.ccsdk.features.sdnr.wt.dataprovider.model.types; import java.util.ArrayList; import java.util.HashMap; @@ -32,58 +32,33 @@ public class DataTreeObject extends HashMap<String, DataTreeChildObject> { private final String parentKey; private final String childKey; - public DataTreeObject createTreeByPath(String[] pathFilter) { - - if (pathFilter != null && pathFilter.length > 0) { - for (String key : this.keySet()) { - if (key.equals(pathFilter[0])) { - DataTreeChildObject o = this.getChildElemByPath(this.get(key), slice(pathFilter, 1)); - DataTreeObject r = new DataTreeObject(this.parentKey, this.childKey); - r.put(key, o); - return r; - } - } - } - - return null; - - } - - private DataTreeChildObject getChildElemByPath(DataTreeChildObject source, String[] pathFilter) { - - if (pathFilter != null && pathFilter.length > 0) { - // for(String key:source..keySet()) { - // if(key.equals(pathFilter[0])){ - // DataTreeChildObject o= this.getChildElemByPath(this.get(key),slice(pathFilter,1)); - // } - // } - } - - return null; - } - public DataTreeObject(String parentKey, String childKey) { this.parentKey = parentKey; this.childKey = childKey; } - /** - * @param treeLevel - * @param id - * @param data - */ public void put(long treeLevel, String id, DataTreeChildObject data) { for (DataTreeChildObject entry : this.values()) { if (entry.putChild(treeLevel, id, data, this.parentKey, this.childKey)) { break; } } + } + + public void putIfNotExists(long treeLevel, String id, DataTreeChildObject data) { + for (DataTreeChildObject entry : this.values()) { + if (entry.putChildIfNotExists(treeLevel, id, data, this.parentKey, this.childKey)) { + break; + } + } + } + public void putIfNotExists(String id, DataTreeChildObject data) { + if (!this.containsKey(id)) { + this.put(id, data); + } } - /** - * - */ public String toJSON() { JSONObject o = new JSONObject(); for (Entry<String, DataTreeChildObject> entry : this.entrySet()) { @@ -92,9 +67,6 @@ public class DataTreeObject extends HashMap<String, DataTreeChildObject> { return o.toString(); } - /** - * - */ public void removeUnmatchedPaths() { List<String> toRemove = new ArrayList<>(); for (Entry<String,DataTreeChildObject> entry : this.entrySet()) { @@ -109,34 +81,7 @@ public class DataTreeObject extends HashMap<String, DataTreeChildObject> { } - /** - * @param treeLevel - * @param id - * @param setProperty - */ - public void putIfNotExists(long treeLevel, String id, DataTreeChildObject data) { - for (DataTreeChildObject entry : this.values()) { - if (entry.putChildIfNotExists(treeLevel, id, data, this.parentKey, this.childKey)) { - break; - } - } - } - - /** - * @param id - * @param data - */ - public void putIfNotExists(String id, DataTreeChildObject data) { - if (!this.containsKey(id)) { - this.put(id, data); - } - } - /** - * @param source - * @param i - * @return - */ public static String[] slice(String[] source, int start) { String[] r = new String[source.length - start]; for (int i = 0; i < r.length; i++) { diff --git a/sdnr/wt/data-provider/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/model/types/YangHelper2.java b/sdnr/wt/data-provider/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/model/types/YangHelper2.java index 423ebab0b..d0169ce06 100644 --- a/sdnr/wt/data-provider/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/model/types/YangHelper2.java +++ b/sdnr/wt/data-provider/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/model/types/YangHelper2.java @@ -29,6 +29,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SortOrder; import org.opendaylight.yangtools.yang.binding.Identifiable; import org.opendaylight.yangtools.yang.binding.Identifier; import org.opendaylight.yangtools.yang.common.Uint16; @@ -113,4 +114,9 @@ public class YangHelper2 { return org.opendaylight.yangtools.yang.binding.ScalarTypeObject.class; } + public static SortOrder getSortOrder(org.onap.ccsdk.features.sdnr.wt.common.database.queries.SortOrder sortOrder){ + return sortOrder== org.onap.ccsdk.features.sdnr.wt.common.database.queries.SortOrder.ASCENDING? + SortOrder.Ascending:SortOrder.Descending; + } + } diff --git a/sdnr/wt/data-provider/model/src/main/yang/data-provider@2020-11-10.yang b/sdnr/wt/data-provider/model/src/main/yang/data-provider@2020-11-10.yang index 72ac45a56..0c89b675b 100644 --- a/sdnr/wt/data-provider/model/src/main/yang/data-provider@2020-11-10.yang +++ b/sdnr/wt/data-provider/model/src/main/yang/data-provider@2020-11-10.yang @@ -2015,6 +2015,26 @@ module data-provider { } } + rpc read-inventory-device-list { + description + "Get list of mountpoints with inventory data"; + input { + uses entity-input; + } + output { + container pagination { + uses pagination-output-g; + description + "The pagination details used by the provider to filter the data."; + } + leaf-list data { + type string; + description + "The list of found mountpoint names."; + } + } + } + rpc read-status { description "Read status information of controller"; diff --git a/sdnr/wt/data-provider/pom.xml b/sdnr/wt/data-provider/pom.xml index 631f2db68..7c2430f1a 100755 --- a/sdnr/wt/data-provider/pom.xml +++ b/sdnr/wt/data-provider/pom.xml @@ -22,13 +22,14 @@ ~ ============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>odlparent-lite</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/data-provider/provider/pom.xml b/sdnr/wt/data-provider/provider/pom.xml index 0b456e5c2..b94c73ea2 100644 --- a/sdnr/wt/data-provider/provider/pom.xml +++ b/sdnr/wt/data-provider/provider/pom.xml @@ -22,13 +22,14 @@ ~ ============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.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> @@ -89,8 +90,8 @@ <version>${project.version}</version> </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> @@ -144,6 +145,12 @@ <artifactId>mariaDB4j</artifactId> <scope>test</scope> </dependency> + <dependency> + <groupId>org.osgi</groupId> + <artifactId>osgi.cmpn</artifactId> + <version>7.0.0</version> + <scope>compile</scope> + </dependency> <!-- MariaDB end --> </dependencies> diff --git a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/elasticsearch/EsDataObjectReaderWriter2.java b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/elasticsearch/EsDataObjectReaderWriter2.java index a10864c96..dbb73bdad 100644 --- a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/elasticsearch/EsDataObjectReaderWriter2.java +++ b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/elasticsearch/EsDataObjectReaderWriter2.java @@ -28,7 +28,6 @@ import java.lang.reflect.InvocationTargetException; import java.util.List; import javax.annotation.Nonnull; import javax.annotation.Nullable; -import org.eclipse.jdt.annotation.NonNull; import org.onap.ccsdk.features.sdnr.wt.common.database.DatabaseClient; import org.onap.ccsdk.features.sdnr.wt.common.database.SearchHit; import org.onap.ccsdk.features.sdnr.wt.common.database.SearchResult; @@ -36,7 +35,6 @@ import org.onap.ccsdk.features.sdnr.wt.common.database.queries.QueryBuilder; import org.onap.ccsdk.features.sdnr.wt.yang.mapper.YangToolsMapper2; import org.onap.ccsdk.features.sdnr.wt.yang.mapper.YangToolsMapperHelper; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.Entity; -import org.opendaylight.yangtools.concepts.Builder; import org.opendaylight.yangtools.yang.binding.DataObject; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -60,7 +58,7 @@ public class EsDataObjectReaderWriter2<T extends DataObject> { private String dataTypeName; /** Elasticsearch Database client to be used **/ - private DatabaseClient db; + protected DatabaseClient db; /** Mapper with configuration to use opendaylight yang-tools builder pattern for object creation **/ private YangToolsMapper2<T> yangtoolsMapper; diff --git a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/elasticsearch/data/acessor/DataObjectAcessor.java b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/elasticsearch/data/acessor/DataObjectAcessor.java index ec467eab1..8319d5d4f 100644 --- a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/elasticsearch/data/acessor/DataObjectAcessor.java +++ b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/elasticsearch/data/acessor/DataObjectAcessor.java @@ -57,4 +57,5 @@ public class DataObjectAcessor<T extends DataObject> extends EsDataObjectReaderW SearchResult<T> result = doReadAll(queryBuilder, ignoreException); return new QueryResult<>(queryByFilter, result); } + } diff --git a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/elasticsearch/data/acessor/DataObjectAcessorInventory.java b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/elasticsearch/data/acessor/DataObjectAcessorInventory.java new file mode 100644 index 000000000..622333403 --- /dev/null +++ b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/elasticsearch/data/acessor/DataObjectAcessorInventory.java @@ -0,0 +1,81 @@ +/* + * ============LICENSE_START======================================================= + * ONAP : ccsdk features + * ================================================================================ + * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. + * All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + * + */ +package org.onap.ccsdk.features.sdnr.wt.dataprovider.database.elasticsearch.data.acessor; + +import java.io.IOException; +import org.onap.ccsdk.features.sdnr.wt.common.database.ExtRestClient; +import org.onap.ccsdk.features.sdnr.wt.common.database.HtDatabaseClient; +import org.onap.ccsdk.features.sdnr.wt.common.database.SearchResult; +import org.onap.ccsdk.features.sdnr.wt.common.database.requests.SearchRequest; +import org.onap.ccsdk.features.sdnr.wt.common.database.responses.AggregationEntries; +import org.onap.ccsdk.features.sdnr.wt.common.database.responses.SearchResponse; +import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.elasticsearch.data.rpctypehelper.QueryByFilter; +import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.elasticsearch.data.rpctypehelper.QueryResult; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.Entity; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.EntityInput; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class DataObjectAcessorInventory<T extends DataObject> extends DataObjectAcessorWithId<T> { + + private final Logger LOG = LoggerFactory.getLogger(DataObjectAcessorInventory.class); + + private static final String KEY = "node-id"; + + private ExtRestClient dbClient; + + public DataObjectAcessorInventory(HtDatabaseClient dbClient, Entity entity, Class<T> clazz, + boolean doFullsizeRequest) throws ClassNotFoundException { + super(dbClient, entity, clazz, doFullsizeRequest); + LOG.info("Create DataObjectAcessorInventory"); + this.dbClient = dbClient; + } + + + /** + * get aggregated devices list + * + * @param input filter should be empty/no filter handled, only sortorder for KEY ('node-name') + * @return + * @throws IOException + */ + public QueryResult<String> getDataDeviceList(EntityInput input) { + + QueryByFilter queryByFilter = new QueryByFilter(input); + SearchRequest request = + queryByFilter.getSearchRequestAggregated(KEY,this.getDataTypeName(), this.getDataTypeName(), this.doFullsizeRequest); + try { + SearchResponse response = this.dbClient.search(request); + AggregationEntries aggs = response.getAggregations(KEY); + String[] uuids = + aggs.getKeysAsPagedStringList(queryByFilter.getPageSize(), queryByFilter.getPageStartIndex()); + long totalSize = aggs.size(); + return new QueryResult<String>(queryByFilter.getPage(), queryByFilter.getPageSize(), + new SearchResult<String>(uuids, totalSize)); + } catch (IOException e) { + throw new RuntimeException("problem reading nodes for req=" + request, e); + } + + } + +} diff --git a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/elasticsearch/data/acessor/DataObjectAcessorPm.java b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/elasticsearch/data/acessor/DataObjectAcessorPm.java index 04849004f..8e04db07b 100644 --- a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/elasticsearch/data/acessor/DataObjectAcessorPm.java +++ b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/elasticsearch/data/acessor/DataObjectAcessorPm.java @@ -72,7 +72,7 @@ public class DataObjectAcessorPm<T extends DataObject> extends DataObjectAcessor public DataObjectAcessorPm(HtDatabaseClient dbClient, Intervall mode, Entity entity, Class<T> clazz, boolean doFullsizeRequest) throws ClassNotFoundException { super(dbClient, entity, clazz, doFullsizeRequest); - LOG.info("DataObjectAcessorPm"); + LOG.info("Create DataObjectAcessorPm"); this.dbClient = dbClient; this.mode = mode; } @@ -113,7 +113,7 @@ public class DataObjectAcessorPm<T extends DataObject> extends DataObjectAcessor QueryByFilter queryByFilter = new QueryByFilter(input); SearchRequest request = - queryByFilter.getSearchRequestBySortOrder(NODE_KEY, UUID_KEY, mode.getIndex(), mode.getType(), this.doFullsizeRequest); + queryByFilter.getSearchRequestAggregated(NODE_KEY, mode.getIndex(), mode.getType(), this.doFullsizeRequest); try { SearchResponse response = this.dbClient.search(request); AggregationEntries aggs = response.getAggregations(KEY); diff --git a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/elasticsearch/data/entity/FaultEntityManager.java b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/elasticsearch/data/entity/FaultEntityManager.java index 64156dc07..708467d0d 100644 --- a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/elasticsearch/data/entity/FaultEntityManager.java +++ b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/elasticsearch/data/entity/FaultEntityManager.java @@ -21,8 +21,6 @@ */ package org.onap.ccsdk.features.sdnr.wt.dataprovider.database.elasticsearch.data.entity; -import java.util.regex.Matcher; -import java.util.regex.Pattern; import javax.annotation.Nonnull; import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.sqldb.data.entity.DatabaseIdGenerator; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.Fault; @@ -38,7 +36,7 @@ public class FaultEntityManager { /** * Specific problems are not moving into current problem list - * + * * @param problemName to be verified * @return true if problem is current */ @@ -52,7 +50,7 @@ public class FaultEntityManager { /** * Specific problems are not moving into current problem list - * + * * @param fault to be verified * @return true if cleared indication */ @@ -62,7 +60,7 @@ public class FaultEntityManager { /** * Create a specific ES id for the current log. - * + * * @return a string with the generated ES Id */ public static String genSpecificEsId(String nodeName, String objectId, String problemName) { @@ -80,7 +78,7 @@ public class FaultEntityManager { /** * Create Es id - * + * * @param fault used to create uuid for faultcurrent * @return String with Id */ diff --git a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/elasticsearch/data/entity/HtDatabaseEventsService.java b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/elasticsearch/data/entity/HtDatabaseEventsService.java index 9cfe4e50d..8367a87d3 100644 --- a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/elasticsearch/data/entity/HtDatabaseEventsService.java +++ b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/elasticsearch/data/entity/HtDatabaseEventsService.java @@ -38,7 +38,6 @@ import org.onap.ccsdk.features.sdnr.wt.common.database.queries.BoolQueryBuilder; import org.onap.ccsdk.features.sdnr.wt.common.database.queries.QueryBuilder; import org.onap.ccsdk.features.sdnr.wt.common.database.queries.QueryBuilders; import org.onap.ccsdk.features.sdnr.wt.common.database.queries.RangeQueryBuilder; -import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.DatabaseDataProvider; import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.elasticsearch.EsDataObjectReaderWriter2; import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.ArchiveCleanProvider; import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DataInconsistencyException; @@ -97,16 +96,11 @@ public class HtDatabaseEventsService implements ArchiveCleanProvider, DataProvid private final EsDataObjectReaderWriter2<GuicutthroughEntity> guiCutThroughDB; private final EsDataObjectReaderWriter2<PmdataEntity> pmData15mDB; private final EsDataObjectReaderWriter2<PmdataEntity> pmData24hDB; - - @SuppressWarnings("unused") - private final DatabaseDataProvider dataProvider; // --- Construct and initialize - public HtDatabaseEventsService(HtDatabaseClient client, DatabaseDataProvider elasticSearchDataProvider) - throws Exception { + public HtDatabaseEventsService(HtDatabaseClient client) throws Exception { LOG.info("Create {} start", HtDatabaseEventsService.class); - this.dataProvider = elasticSearchDataProvider; try { // Create control structure @@ -124,8 +118,8 @@ public class HtDatabaseEventsService implements ArchiveCleanProvider, DataProvid eventRWFaultLogDB = new EsDataObjectReaderWriter2<>(client, Entity.Faultlog, FaultlogEntity.class, FaultlogBuilder.class); - eventRWFCMLogDB = new EsDataObjectReaderWriter2<>(client, Entity.Cmlog, CmlogEntity.class, - CmlogBuilder.class); + eventRWFCMLogDB = + new EsDataObjectReaderWriter2<>(client, Entity.Cmlog, CmlogEntity.class, CmlogBuilder.class); eventRWConnectionLogDB = new EsDataObjectReaderWriter2<>(client, Entity.Connectionlog, ConnectionlogEntity.class, ConnectionlogBuilder.class); @@ -460,7 +454,7 @@ public class HtDatabaseEventsService implements ArchiveCleanProvider, DataProvid @Override public boolean updateNetworkConnection22(NetworkElementConnectionEntity networkElementConnectionEntitiy, String nodeId) { - LOG.info("update networkelement-connection for {} with data {}", nodeId, networkElementConnectionEntitiy); + LOG.debug("update networkelement-connection for {} with data {}", nodeId, networkElementConnectionEntitiy); return this.networkelementConnectionDB.updateOrCreate(networkElementConnectionEntitiy, nodeId, Arrays.asList("is-required", "username", "password")) != null; // NetworkElementConnectionEntity e = @@ -530,7 +524,7 @@ public class HtDatabaseEventsService implements ArchiveCleanProvider, DataProvid QueryBuilder queryFaultLog = EsFaultLogDevicemanager.getQueryForTimeStamp(netconfTimeStamp); numberOfElements += eventRWFaultLogDB.doReadAll(queryFaultLog).getTotal(); - QueryBuilder queryCMLog = EsCMLogDevicemanager.getQueryForTimeStamp(netconfTimeStamp); + QueryBuilder queryCMLog = EsCMLogDevicemanager.getQueryForTimeStamp(netconfTimeStamp); numberOfElements += eventRWFCMLogDB.doReadAll(queryCMLog).getTotal(); return numberOfElements; diff --git a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/elasticsearch/data/entity/HtDatabaseMaintenanceService.java b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/elasticsearch/data/entity/HtDatabaseMaintenanceService.java index 9f4c0f399..c280f4fb3 100644 --- a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/elasticsearch/data/entity/HtDatabaseMaintenanceService.java +++ b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/elasticsearch/data/entity/HtDatabaseMaintenanceService.java @@ -80,7 +80,7 @@ public class HtDatabaseMaintenanceService implements HtDatabaseMaintenance { if (maintenanceRW.write(m, m.getNodeId()) == null) { throw new IllegalArgumentException("Problem writing to database: " + m.getId()); } - LOG.info("Wrote maintenance object {}", m.toString()); + LOG.debug("Wrote maintenance object {}", m.toString()); } return m; } diff --git a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/elasticsearch/data/rpctypehelper/QueryByFilter.java b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/elasticsearch/data/rpctypehelper/QueryByFilter.java index 69f9bcc29..51584484b 100644 --- a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/elasticsearch/data/rpctypehelper/QueryByFilter.java +++ b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/elasticsearch/data/rpctypehelper/QueryByFilter.java @@ -130,16 +130,16 @@ public class QueryByFilter { } } - public SearchRequest getSearchRequestBySortOrder(String nodeKey, String uuidKey, String index, String dataType, - boolean doFullsizeRequest) { - Sortorder soNode = getSortOrder(sortOrder, nodeKey); + public SearchRequest getSearchRequestAggregated(String aggregationKey, String index, String dataType, + boolean doFullsizeRequest) { + Sortorder soNode = getSortOrder(sortOrder, aggregationKey); SearchRequest request = new SearchRequest(index, dataType); QueryBuilder query = null; if (soNode != null) { query = QueryBuilders.matchAllQuery().setFullsizeRequest(doFullsizeRequest) - .aggregations(nodeKey, convert(soNode.getSortorder())).size(0); + .aggregations(aggregationKey, convert(soNode.getSortorder())).size(0); } else { - query = QueryBuilders.matchAllQuery().setFullsizeRequest(doFullsizeRequest).aggregations(nodeKey).size(0); + query = QueryBuilders.matchAllQuery().setFullsizeRequest(doFullsizeRequest).aggregations(aggregationKey).size(0); } request.setQuery(query); return request; diff --git a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/elasticsearch/impl/ElasticSearchDataProvider.java b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/elasticsearch/impl/ElasticSearchDataProvider.java index 753930cdd..71372275a 100644 --- a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/elasticsearch/impl/ElasticSearchDataProvider.java +++ b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/elasticsearch/impl/ElasticSearchDataProvider.java @@ -29,8 +29,8 @@ import java.util.List; import java.util.concurrent.TimeUnit; import org.onap.ccsdk.features.sdnr.wt.common.database.HtDatabaseClient; import org.onap.ccsdk.features.sdnr.wt.common.database.config.HostInfo; -import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.DatabaseDataProvider; import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.elasticsearch.EsConfig; +import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.elasticsearch.data.acessor.DataObjectAcessorInventory; import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.elasticsearch.data.acessor.DataObjectAcessorPm; import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.elasticsearch.data.acessor.DataObjectAcessorPm.Intervall; import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.elasticsearch.data.acessor.DataObjectAcessorStatus; @@ -38,10 +38,13 @@ import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.elasticsearch.data. import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.elasticsearch.data.entity.HtDatabaseEventsService; import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.elasticsearch.data.entity.HtDatabaseMaintenanceService; import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.elasticsearch.data.rpctypehelper.QueryResult; +import org.onap.ccsdk.features.sdnr.wt.dataprovider.impl.DataTreeProviderImpl; import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DataProvider; +import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DatabaseDataProvider; import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.HtDatabaseMaintenance; import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.HtDatabaseMediatorserver; import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.HtUserdataManager; +import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.InventoryTreeProvider; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.CreateMaintenanceInput; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.CreateMaintenanceOutputBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.CreateMediatorServerInput; @@ -65,6 +68,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.pro import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.ReadFaultcurrentListOutputBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.ReadFaultlogListOutputBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.ReadGuiCutThroughEntryOutputBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.ReadInventoryDeviceListOutputBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.ReadInventoryListOutputBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.ReadMaintenanceListOutputBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.ReadMediatorServerListOutputBuilder; @@ -82,6 +86,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.pro import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.UpdateMediatorServerOutputBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.UpdateNetworkElementConnectionInput; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.UpdateNetworkElementConnectionOutputBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.read.inventory.list.output.Data; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -100,7 +105,7 @@ public class ElasticSearchDataProvider implements DatabaseDataProvider { private final DataObjectAcessorWithId<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.read.mediator.server.list.output.Data> mediatorserverRW; private final DataObjectAcessorWithId<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.read.maintenance.list.output.Data> maintenanceRW; private final DataObjectAcessorWithId<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.read.gui.cut.through.entry.output.Data> guicutthroughRW; - private final DataObjectAcessorWithId<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.read.inventory.list.output.Data> equipmentRW; + private final DataObjectAcessorInventory<Data> equipmentRW; private final DataObjectAcessorWithId<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.read.connectionlog.list.output.Data> connnectionlogRW; private final DataObjectAcessorWithId<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.read.eventlog.list.output.Data> eventlogRW; private final DataObjectAcessorWithId<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.read.network.element.connection.list.output.Data> networkelementConnectionRW; @@ -111,6 +116,7 @@ public class ElasticSearchDataProvider implements DatabaseDataProvider { private final HtDatabaseEventsService databaseService; private final HtDatabaseMaintenanceService databaseMaintenanceService; private final HtUserdataManager usermanager; + private final InventoryTreeProvider inventoryTreeProvider; private final HtDatabaseMediatorserver dbMediatorServerService = new HtDatabaseMediatorserver() { @@ -158,7 +164,7 @@ public class ElasticSearchDataProvider implements DatabaseDataProvider { doFullsizeRequests); this.guicutthroughRW.setWriteInterface(Guicutthrough.class); - this.equipmentRW = new DataObjectAcessorWithId<>(dbClient, Entity.Inventoryequipment, + this.equipmentRW = new DataObjectAcessorInventory<>(dbClient, Entity.Inventoryequipment, org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.read.inventory.list.output.Data.class, doFullsizeRequests); @@ -197,9 +203,10 @@ public class ElasticSearchDataProvider implements DatabaseDataProvider { this.readStatus = new DataObjectAcessorStatus(dbClient, Entity.Faultcurrent, doFullsizeRequests); - this.databaseService = new HtDatabaseEventsService(dbClient, this); + this.databaseService = new HtDatabaseEventsService(dbClient); this.databaseMaintenanceService = new HtDatabaseMaintenanceService(dbClient); this.usermanager = new HtUserdataManagerImpl(this.dbClient); + this.inventoryTreeProvider = new DataTreeProviderImpl(this.dbClient); } /*------------------------- @@ -297,6 +304,17 @@ public class ElasticSearchDataProvider implements DatabaseDataProvider { } @Override + public ReadInventoryDeviceListOutputBuilder readInventoryDeviceList(EntityInput input) { + ReadInventoryDeviceListOutputBuilder outputBuilder = new ReadInventoryDeviceListOutputBuilder(); + QueryResult<String> result = equipmentRW.getDataDeviceList(input); + outputBuilder.setPagination( + new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.read.inventory.device.list.output.PaginationBuilder( + result.getPagination()).build()); + outputBuilder.setData(result.getResult().getHitSets()); + return outputBuilder; + } + + @Override public ReadConnectionlogListOutputBuilder readConnectionlogList(EntityInput input) { ReadConnectionlogListOutputBuilder outputBuilder = new ReadConnectionlogListOutputBuilder(); QueryResult<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.read.connectionlog.list.output.Data> result = @@ -547,5 +565,9 @@ public class ElasticSearchDataProvider implements DatabaseDataProvider { return this.usermanager; } + @Override + public InventoryTreeProvider getInventoryTreeProvider() { + return this.inventoryTreeProvider; + } } diff --git a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/nodb/NoDbDatabaseDataProvider.java b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/nodb/NoDbDatabaseDataProvider.java index 54cf32ce0..02b58bf72 100644 --- a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/nodb/NoDbDatabaseDataProvider.java +++ b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/nodb/NoDbDatabaseDataProvider.java @@ -24,11 +24,12 @@ package org.onap.ccsdk.features.sdnr.wt.dataprovider.database.nodb; import java.io.IOException; import java.util.concurrent.TimeUnit; import org.onap.ccsdk.features.sdnr.wt.common.database.HtDatabaseClient; -import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.DatabaseDataProvider; import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DataProvider; +import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DatabaseDataProvider; import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.HtDatabaseMaintenance; import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.HtDatabaseMediatorserver; import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.HtUserdataManager; +import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.InventoryTreeProvider; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.CreateMaintenanceInput; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.CreateMaintenanceOutputBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.CreateMediatorServerInput; @@ -48,6 +49,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.pro import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.ReadFaultcurrentListOutputBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.ReadFaultlogListOutputBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.ReadGuiCutThroughEntryOutputBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.ReadInventoryDeviceListOutputBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.ReadInventoryListOutputBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.ReadMaintenanceListOutputBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.ReadMediatorServerListOutputBuilder; @@ -72,12 +74,14 @@ public class NoDbDatabaseDataProvider implements DatabaseDataProvider { private final HtDatabaseMediatorserver mediatorserver; private final HtDatabaseMaintenance maintenance; private final DataProvider dataprovider; + private final InventoryTreeProvider inventoryTreeProvider; public NoDbDatabaseDataProvider() { this.usermanger = new NoDbHtUserdataManager(); this.mediatorserver = new NoDbHtDatabaseMediatorserver(); this.maintenance = new NoDbHtDatabaseMaintenance(); this.dataprovider = new NoDbDataProvider(); + this.inventoryTreeProvider = new NoDbInventoryTreeProvider(); } @Override public HtDatabaseClient getRawClient() { @@ -241,4 +245,14 @@ public class NoDbDatabaseDataProvider implements DatabaseDataProvider { public HtUserdataManager getUserManager() { return this.usermanger; } + + @Override + public InventoryTreeProvider getInventoryTreeProvider() { + return this.inventoryTreeProvider; + } + + @Override + public ReadInventoryDeviceListOutputBuilder readInventoryDeviceList(EntityInput input) { + return new ReadInventoryDeviceListOutputBuilder(); + } } diff --git a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/nodb/NoDbInventoryTreeProvider.java b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/nodb/NoDbInventoryTreeProvider.java new file mode 100644 index 000000000..ad2960f64 --- /dev/null +++ b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/nodb/NoDbInventoryTreeProvider.java @@ -0,0 +1,35 @@ +/* + * ============LICENSE_START======================================================= + * ONAP : ccsdk features + * ================================================================================ + * Copyright (C) 2023 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.dataprovider.database.nodb; + +import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.InventoryTreeProvider; +import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.types.DataTreeObject; + +import java.io.IOException; +import java.util.List; + +public class NoDbInventoryTreeProvider implements InventoryTreeProvider { + @Override + public DataTreeObject readInventoryTree(List<String> tree, String filter) throws IOException { + return new DataTreeObject("",""); + } +} diff --git a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/DataTreeHttpServlet.java b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/DataTreeHttpServlet.java index 3c4a7621b..2f7b9e3fc 100644 --- a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/DataTreeHttpServlet.java +++ b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/DataTreeHttpServlet.java @@ -32,14 +32,18 @@ import java.util.List; import java.util.Optional; import java.util.regex.Matcher; import java.util.regex.Pattern; +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.json.JSONObject; -import org.onap.ccsdk.features.sdnr.wt.common.database.HtDatabaseClient; -import org.onap.ccsdk.features.sdnr.wt.dataprovider.impl.DataTreeProviderImpl; +import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.InventoryTreeProvider; +import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.types.DataTreeObject; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.Entity; +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; @@ -47,22 +51,22 @@ import org.slf4j.LoggerFactory; * @author Michael Dürre * */ + +@HttpWhiteboardServletPattern("/tree/*") +@HttpWhiteboardServletName("DataTreeHttpServlet") +@Component(service = Servlet.class) public class DataTreeHttpServlet extends HttpServlet { private static final long serialVersionUID = 1L; - private final DataTreeProviderImpl dataTreeProvider; + private InventoryTreeProvider dataTreeProvider; private static final Logger LOG = LoggerFactory.getLogger(DataTreeHttpServlet.class); public DataTreeHttpServlet() { super(); - this.dataTreeProvider = new DataTreeProviderImpl(); } - /** - * @param client - */ - public void setDatabaseClient(HtDatabaseClient client) { - this.dataTreeProvider.setDatabaseClient(client); + public void setInventoryTreeProvider(InventoryTreeProvider provider) { + this.dataTreeProvider = provider; } @@ -109,7 +113,7 @@ public class DataTreeHttpServlet extends HttpServlet { LOG.debug("GET request for {}", uri); final EntityWithTree e = getEntity(uri); if (e != null) { - LOG.info("GET request for {} to e={} with tree={}", uri, e.entity, e.tree); + LOG.debug("GET request for {} to e={} with tree={}", uri, e.entity, e.tree); switch (e.entity) { case Inventoryequipment: DataTreeObject o = this.dataTreeProvider.readInventoryTree(e.tree, null); @@ -170,7 +174,7 @@ public class DataTreeHttpServlet extends HttpServlet { final Matcher matcher = pattern.matcher(uri); if (matcher.find() && matcher.groupCount() > 0) { try { - Optional<Entity> oe = Entity.forName(matcher.group(1)); + Optional<Entity> oe = Optional.ofNullable(Entity.forName(matcher.group(1))); if (oe.isPresent()) { return new EntityWithTree(oe.get(), matcher.groupCount() > 1 ? matcher.group(2) : null); } else { diff --git a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/MsServlet.java b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/MsServlet.java index 103dec70d..85658d439 100644 --- a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/MsServlet.java +++ b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/MsServlet.java @@ -22,15 +22,22 @@ package org.onap.ccsdk.features.sdnr.wt.dataprovider.http; import java.io.IOException; +import javax.servlet.Servlet; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.onap.ccsdk.features.sdnr.wt.common.http.BaseServlet; import org.onap.ccsdk.features.sdnr.wt.dataprovider.impl.MediatorServerDataProvider; import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.HtDatabaseMediatorserver; +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("/ms/*") +@HttpWhiteboardServletName("MsServlet") +@Component(service = Servlet.class) public class MsServlet extends BaseServlet { /** diff --git a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/UserdataHttpServlet.java b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/UserdataHttpServlet.java index b51d2a6df..92bccce6f 100644 --- a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/UserdataHttpServlet.java +++ b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/UserdataHttpServlet.java @@ -26,6 +26,7 @@ import java.nio.charset.StandardCharsets; import java.util.Base64; import java.util.regex.Matcher; import java.util.regex.Pattern; +import javax.servlet.Servlet; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; @@ -33,9 +34,15 @@ import javax.servlet.http.HttpServletResponse; import org.json.JSONObject; import org.onap.ccsdk.features.sdnr.wt.common.http.BaseHTTPClient; import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.HtUserdataManager; +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({"/userdata","/userdata/*"}) +@HttpWhiteboardServletName("UserdataHttpServlet") +@Component(service = Servlet.class) public class UserdataHttpServlet extends HttpServlet { private static final long serialVersionUID = 1L; @@ -50,10 +57,10 @@ public class UserdataHttpServlet extends HttpServlet { final String uri = req.getRequestURI(); final Matcher matcher = PATTERN.matcher(uri); if (matcher.find()) { - LOG.info("GET found match"); + LOG.debug("GET found match"); this.handleGetRequest(req, resp, matcher.groupCount() > 0 ? matcher.group(1) : null); } else { - LOG.info("no valid request"); + LOG.debug("no valid request"); super.doGet(req, resp); } } @@ -63,11 +70,11 @@ public class UserdataHttpServlet extends HttpServlet { final String uri = req.getRequestURI(); final Matcher matcher = PATTERN.matcher(uri); if (matcher.find()) { - LOG.info("PUT found match"); + LOG.debug("PUT found match"); final String payload = getPayload(req); this.handlePutRequest(req, resp, payload, matcher.groupCount() > 0 ? matcher.group(1) : null); } else { - LOG.info("no valid request"); + LOG.debug("no valid request"); super.doPut(req, resp); } } @@ -81,10 +88,10 @@ public class UserdataHttpServlet extends HttpServlet { final String uri = req.getRequestURI(); final Matcher matcher = PATTERN.matcher(uri); if (matcher.find()) { - LOG.info("DELETE found match"); + LOG.debug("DELETE found match"); this.handleDeleteRequest(req, resp, matcher.groupCount() > 0 ? matcher.group(1) : null); } else { - LOG.info("no valid request"); + LOG.debug("no valid request"); super.doPut(req, resp); } } diff --git a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/about/AboutHttpServlet.java b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/about/AboutHttpServlet.java index 40a46e6fb..45bd80cd6 100644 --- a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/about/AboutHttpServlet.java +++ b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/about/AboutHttpServlet.java @@ -29,6 +29,7 @@ import java.util.Map; import java.util.Map.Entry; import java.util.jar.Attributes; import java.util.jar.Manifest; +import javax.servlet.Servlet; import javax.servlet.ServletException; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServlet; @@ -41,9 +42,16 @@ import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.types.NetconfTimeStamp import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; import org.osgi.framework.FrameworkUtil; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.ServiceScope; +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("/about") +@HttpWhiteboardServletName("AboutHttpServlet") +@Component(service = Servlet.class) public class AboutHttpServlet extends HttpServlet { /** @@ -98,7 +106,6 @@ public class AboutHttpServlet extends HttpServlet { this.BUNDLESTATE_LUT.put(Bundle.STARTING, "starting"); this.BUNDLESTATE_LUT.put(Bundle.STOPPING, "stopping"); this.BUNDLESTATE_LUT.put(Bundle.ACTIVE, "active"); - } protected String getGroupIdOrDefault(String def) { 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 868bf7ec6..c623d9955 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 @@ -72,6 +72,8 @@ public class ODLVersionLUT { } if(odlMdsalVersionLUT==null) { odlMdsalVersionLUT = new HashMap<>(); + 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)"); odlMdsalVersionLUT.put("9.0.2","sulfur-SR0 (0.16.0)"); odlMdsalVersionLUT.put("8.0.11","phosphorus-SR2 (0.15.2)"); diff --git a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/yangschema/YangSchemaHttpServlet.java b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/yangschema/YangSchemaHttpServlet.java index 86f67b1de..f9fa2e931 100644 --- a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/yangschema/YangSchemaHttpServlet.java +++ b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/http/yangschema/YangSchemaHttpServlet.java @@ -23,13 +23,21 @@ package org.onap.ccsdk.features.sdnr.wt.dataprovider.http.yangschema; import java.io.IOException; import java.text.ParseException; +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.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("/yang-schema/*") +@HttpWhiteboardServletName("YangSchemaHttpServlet") +@Component(service = Servlet.class) public class YangSchemaHttpServlet extends HttpServlet { /** * diff --git a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/impl/DataProviderImpl.java b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/impl/DataProviderImpl.java index e06a1a9a2..66ffdf8b3 100644 --- a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/impl/DataProviderImpl.java +++ b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/impl/DataProviderImpl.java @@ -87,7 +87,7 @@ public class DataProviderImpl implements IEntityDataProvider, AutoCloseable { try { // Start RPC Service this.rpcApiService = new DataProviderServiceImpl(rpcProviderService, this.mediatorServerServlet, this.dataBroker); - this.treeServlet.setDatabaseClient(this.rpcApiService.getRawClient()); + this.treeServlet.setInventoryTreeProvider(this.rpcApiService.getInventoryTreeProvider()); this.userdataServlet.setDatabaseClient(this.rpcApiService.getHtDatabaseUserManager()); LOG.info("Session Initiated end. Initialization done"); } catch (Exception e) { @@ -109,7 +109,7 @@ public class DataProviderImpl implements IEntityDataProvider, AutoCloseable { /** * Used to close all Services, that should support AutoCloseable Pattern * - * @param toClose + * @param toCloseList * @throws Exception */ private void close(AutoCloseable... toCloseList) throws Exception { diff --git a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/impl/DataProviderServiceImpl.java b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/impl/DataProviderServiceImpl.java index b75108ab2..d21d50f83 100644 --- a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/impl/DataProviderServiceImpl.java +++ b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/impl/DataProviderServiceImpl.java @@ -27,9 +27,6 @@ import com.google.common.util.concurrent.ListenableFuture; import java.io.IOException; import java.io.PrintWriter; import java.io.StringWriter; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.Arrays; import java.util.Map; import java.util.Optional; import java.util.Set; @@ -39,15 +36,16 @@ import java.util.stream.Collectors; import org.eclipse.jdt.annotation.NonNull; import org.onap.ccsdk.features.sdnr.wt.common.configuration.ConfigurationFileRepresentation; import org.onap.ccsdk.features.sdnr.wt.common.database.HtDatabaseClient; -import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.DatabaseDataProvider; import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.elasticsearch.impl.ElasticSearchDataProvider; import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.nodb.NoDbDatabaseDataProvider; import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.sqldb.data.SqlDBDataProvider; import org.onap.ccsdk.features.sdnr.wt.dataprovider.http.MsServlet; import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DataProvider; +import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DatabaseDataProvider; import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.HtDatabaseMaintenance; import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.HtUserdataManager; import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.IEsConfig; +import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.InventoryTreeProvider; import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.SdnrDbType; import org.onap.ccsdk.features.sdnr.wt.yang.mapper.YangToolsMapperHelper; import org.opendaylight.mdsal.binding.api.DataBroker; @@ -82,6 +80,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.pro import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.ReadFaultlogListOutput; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.ReadGuiCutThroughEntryInput; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.ReadGuiCutThroughEntryOutput; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.ReadInventoryDeviceListInput; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.ReadInventoryDeviceListOutput; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.ReadInventoryListInput; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.ReadInventoryListOutput; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.ReadMaintenanceListInput; @@ -141,7 +141,6 @@ public class DataProviderServiceImpl implements DataProviderService, AutoCloseab private final DatabaseDataProvider dataProvider; private final ConfigurationFileRepresentation configuration; private final DataProviderConfig dbConfig; - private final HtUserdataManager dbUserManager; private final DataBroker dataBroker; private final MsServlet mediatorServerServlet; @@ -161,7 +160,6 @@ public class DataProviderServiceImpl implements DataProviderService, AutoCloseab else { this.dataProvider = new NoDbDatabaseDataProvider(); } - this.dbUserManager = this.dataProvider.getUserManager(); this.dataProvider.waitForYellowDatabaseStatus(DATABASE_TIMEOUT_MS, TimeUnit.MILLISECONDS); mediatorServerServlet.setDataProvider(this.dataProvider.getHtDatabaseMediatorServer()); // Register ourselves as the REST API RPC implementation @@ -296,6 +294,15 @@ public class DataProviderServiceImpl implements DataProviderService, AutoCloseab } @Override + public ListenableFuture<RpcResult<ReadInventoryDeviceListOutput>> readInventoryDeviceList( + ReadInventoryDeviceListInput input) { + LOG.debug("RPC Request: readInventoryDeviceList with input {}", input); + RpcResultBuilder<ReadInventoryDeviceListOutput> result = + read(() -> DataProviderServiceImpl.this.dataProvider.readInventoryDeviceList(input)); + return result.buildFuture(); + } + + @Override public ListenableFuture<RpcResult<ReadPmdata15mLtpListOutput>> readPmdata15mLtpList( ReadPmdata15mLtpListInput input) { LOG.debug("RPC Request: readPmdata15mLtpList with input {}", input); @@ -495,6 +502,10 @@ public class DataProviderServiceImpl implements DataProviderService, AutoCloseab return buf.toString(); } + public InventoryTreeProvider getInventoryTreeProvider() { + return this.dataProvider.getInventoryTreeProvider(); + } + private interface GetEntityInput<O extends DataObject,B> { B get() throws IOException; } @@ -515,7 +526,7 @@ public class DataProviderServiceImpl implements DataProviderService, AutoCloseab public HtUserdataManager getHtDatabaseUserManager() { - return this.dbUserManager; + return this.dataProvider.getUserManager(); } diff --git a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/impl/DataTreeProviderImpl.java b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/impl/DataTreeProviderImpl.java index cb62e3326..f5f1e4583 100644 --- a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/impl/DataTreeProviderImpl.java +++ b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/impl/DataTreeProviderImpl.java @@ -21,294 +21,114 @@ */ package org.onap.ccsdk.features.sdnr.wt.dataprovider.impl; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import org.json.JSONObject; import org.onap.ccsdk.features.sdnr.wt.common.database.HtDatabaseClient; -import org.onap.ccsdk.features.sdnr.wt.common.database.SearchHit; +import org.onap.ccsdk.features.sdnr.wt.common.database.SearchResult; import org.onap.ccsdk.features.sdnr.wt.common.database.queries.BoolQueryBuilder; import org.onap.ccsdk.features.sdnr.wt.common.database.queries.QueryBuilder; import org.onap.ccsdk.features.sdnr.wt.common.database.queries.QueryBuilders; import org.onap.ccsdk.features.sdnr.wt.common.database.queries.SortOrder; -import org.onap.ccsdk.features.sdnr.wt.common.database.requests.Search7Request; import org.onap.ccsdk.features.sdnr.wt.common.database.requests.SearchRequest; import org.onap.ccsdk.features.sdnr.wt.common.database.responses.AggregationEntries; import org.onap.ccsdk.features.sdnr.wt.common.database.responses.SearchResponse; -import org.onap.ccsdk.features.sdnr.wt.dataprovider.http.DataTreeChildObject; -import org.onap.ccsdk.features.sdnr.wt.dataprovider.http.DataTreeObject; +import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.elasticsearch.data.acessor.DataObjectAcessorWithId; +import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.BaseInventoryTreeProvider; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.Entity; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.Inventory; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.InventoryEntity; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; /** * @author Michael Dürre - * */ -public class DataTreeProviderImpl { +public class DataTreeProviderImpl extends BaseInventoryTreeProvider { + private static final Logger LOG = LoggerFactory.getLogger(DataTreeProviderImpl.class); private static final long MAXSIZE_PERSEARCH = 10; - private HtDatabaseClient dbClient; - private static final String INVENTORY_PROPERTY_TREELEVEL = "tree-level"; - private static final String INVENTORY_PROPERTY_NODEID = "node-id"; - private static final String INVENTORY_PROPERTY_UUID = "uuid"; - private static final String INVENTORY_PROPERTY_PARENTUUID = "parent-uuid"; - private static final String INVENTORY_PROPERTY_FOR_LABEL_CHILD = "uuid"; - private static final String INVENTORY_PROPERTY_FOR_LABEL = "uuid"; - - private List<SearchHit> search(Entity e, String filter, String propTreeLevel) throws IOException { - return this.search(e, filter, null, null, null, null, null, null, propTreeLevel); - } - - private List<SearchHit> search(Entity e, String filter, String nodeKey, String nodeId, String parentKey, - String parentValue, String childKey, String childValue, String propTreeLevel) throws IOException { - QueryBuilder query = - filter == null ? QueryBuilders.matchAllQuery() : QueryBuilders.searchAllFieldsQuery(filter); - if ((nodeId != null && nodeKey != null) || (parentKey != null && parentValue != null)) { - BoolQueryBuilder bquery = new BoolQueryBuilder(); - if (filter != null) { - bquery.must(query); - } - if (nodeId != null) { - bquery.must(QueryBuilders.matchQuery(nodeKey, nodeId)); - } - query = bquery; - + private final HtDatabaseClient dbClient; + private final DataObjectAcessorWithId<Inventory> dbReader; + + public DataTreeProviderImpl(HtDatabaseClient dbClient) { + this.dbClient = dbClient; + try { + this.dbReader = new DataObjectAcessorWithId<>(dbClient,Entity.Inventoryequipment,Inventory.class,true); + } catch (ClassNotFoundException e) { + throw new RuntimeException(e); } - return this.search(e, query, propTreeLevel); } - private List<SearchHit> search(Entity e, QueryBuilder query, String propTreeLevel) throws IOException { - List<SearchHit> list = new ArrayList<SearchHit>(); - query.sort(propTreeLevel, SortOrder.ASCENDING); - SearchRequest request = new Search7Request(Entity.Inventoryequipment.getName()); + private List<InventoryEntity> search(QueryBuilder query) { + query.size(MAXSIZE_PERSEARCH); - request.setQuery(query); - SearchResponse response = this.dbClient.search(request); - SearchHit[] matches = response.getHits(); - for (SearchHit hit : matches) { - list.add(hit); - } + SearchResult<Inventory> response = null; + response = this.dbReader.doReadAll(query); + List<Inventory> matches = response.getHits(); + List<InventoryEntity> list = new ArrayList<>(); + list.addAll(matches); if (response.getTotal() > MAXSIZE_PERSEARCH) { long todo = response.getTotal(); long from = MAXSIZE_PERSEARCH; while (todo > from) { - request.setQuery(query.from(from)); + query.from(from); from += MAXSIZE_PERSEARCH; //merge into list - response = this.dbClient.search(request); + response = this.dbReader.doReadAll(query); matches = response.getHits(); - for (SearchHit hit : matches) { - list.add(hit); - } + list.addAll(matches); } } return list; } - /** - * @param iNVENTORY_PROPERTY_NODEID2 - * @return - * @throws IOException - */ - private AggregationEntries searchAggregated(Entity e, String key) throws IOException { - QueryBuilder query = QueryBuilders.matchAllQuery().aggregations(key).size(MAXSIZE_PERSEARCH); - SearchRequest request = new Search7Request(e.getName()); - request.setQuery(query); - SearchResponse response = this.dbClient.search(request); - return response.getAggregations(key); - } - - /** - * - * @param tree - * @param filter - * @param - * @return - * @throws IOException - */ - public DataTreeObject readInventoryTree(List<String> tree, String filter) throws IOException { - //root nodes will be node-information -> below inventory - if (tree == null || tree.size() <= 0) { - return this.readInventoryTreeWithNode(filter); - } - //root node will be inventory on tree-level if sliced treePath - else { - return this.readInventoryTreeForNode(tree.get(0), tree.subList(0, tree.size() - 1), filter); + @Override + protected List<String> getAllNodeIds() { + QueryBuilder query = QueryBuilders.matchAllQuery().setFullsizeRequest(true).aggregations(INVENTORY_PROPERTY_NODEID).size(0); + SearchRequest request = new SearchRequest(Entity.Inventoryequipment.getName(),Entity.Inventoryequipment.getName()); + request.setQuery(query); + try { + SearchResponse response = this.dbClient.search(request); + AggregationEntries aggs = response.getAggregations(INVENTORY_PROPERTY_NODEID); + return new ArrayList<>(aggs.keySet()); + } catch (IOException e) { + LOG.warn("problem reading nodes of inventory: ", e); } - + return List.of(); } - /** - * @param string - * @param slice - * @param filter - * @param mode - * @return - */ - private DataTreeObject readInventoryTreeForNode(String nodeId, List<String> list, String filter) - throws IOException { - DataTreeObject tree = new DataTreeObject(INVENTORY_PROPERTY_PARENTUUID, INVENTORY_PROPERTY_UUID); - final String parentUuid = list.size() > 1 ? list.get(list.size() - 2) : null; - final String uuid = list.size() > 0 ? list.get(list.size() - 1) : null; - List<SearchHit> matches = this.search(Entity.Inventoryequipment, filter, INVENTORY_PROPERTY_NODEID, nodeId, - INVENTORY_PROPERTY_PARENTUUID, parentUuid, INVENTORY_PROPERTY_UUID, uuid, INVENTORY_PROPERTY_TREELEVEL); - - //tree.a(subtreePath); - List<SearchHit> others = this.search(Entity.Inventoryequipment, (String) null, INVENTORY_PROPERTY_NODEID, nodeId, - null, null, null, null, INVENTORY_PROPERTY_TREELEVEL); - if (matches.size() > 0) { - int treeLevelToStart = (list == null || list.size() <= 0) ? 0 : list.size() - 1; - //build tree - JSONObject hitData; - //fill root elems - for (SearchHit hit : matches) { - hitData = hit.getSource(); - if (hitData.getLong(INVENTORY_PROPERTY_TREELEVEL) == treeLevelToStart) { - tree.put(hit.getId(), - new DataTreeChildObject(hitData.getString(INVENTORY_PROPERTY_FOR_LABEL), true) - .setProperty(INVENTORY_PROPERTY_UUID, hitData.getString(INVENTORY_PROPERTY_UUID)) - .setProperty(INVENTORY_PROPERTY_PARENTUUID, - hitData.getString(INVENTORY_PROPERTY_PARENTUUID))); - } - } - for (SearchHit hit : others) { - hitData = hit.getSource(); - if (hitData.getLong(INVENTORY_PROPERTY_TREELEVEL) == treeLevelToStart) { - tree.putIfNotExists(hit.getId(), - new DataTreeChildObject(hitData.getString(INVENTORY_PROPERTY_FOR_LABEL), false) - .setProperty(INVENTORY_PROPERTY_UUID, hitData.getString(INVENTORY_PROPERTY_UUID)) - .setProperty(INVENTORY_PROPERTY_PARENTUUID, - hitData.getString(INVENTORY_PROPERTY_PARENTUUID))); - } - } - //fill child elems - for (SearchHit hit : matches) { - hitData = hit.getSource(); - if (hitData.getLong(INVENTORY_PROPERTY_TREELEVEL) > treeLevelToStart) { - tree.put(hitData.getLong(INVENTORY_PROPERTY_TREELEVEL) - treeLevelToStart - 1, hit.getId(), - new DataTreeChildObject(hitData.getString(INVENTORY_PROPERTY_FOR_LABEL), true) - .setProperty(INVENTORY_PROPERTY_UUID, hitData.getString(INVENTORY_PROPERTY_UUID)) - .setProperty(INVENTORY_PROPERTY_PARENTUUID, - hitData.getString(INVENTORY_PROPERTY_PARENTUUID))); - } - } - for (SearchHit hit : others) { - hitData = hit.getSource(); - if (hitData.getLong(INVENTORY_PROPERTY_TREELEVEL) > treeLevelToStart) { - tree.putIfNotExists(hitData.getLong(INVENTORY_PROPERTY_TREELEVEL) - treeLevelToStart - 1, hit.getId(), - new DataTreeChildObject(hitData.getString(INVENTORY_PROPERTY_FOR_LABEL), false) - .setProperty(INVENTORY_PROPERTY_UUID, hitData.getString(INVENTORY_PROPERTY_UUID)) - .setProperty(INVENTORY_PROPERTY_PARENTUUID, - hitData.getString(INVENTORY_PROPERTY_PARENTUUID))); - } - } - tree.removeUnmatchedPaths(); - } - return tree; + @Override + protected List<InventoryEntity> search(String filter, String sortOrderProperty, SortOrder sortOrder) { + return this.search(filter, null, null, null, sortOrderProperty, sortOrder); } - /** - * node will be root elements inventory information below from level-1 - * - * @param filter - * @return - * @throws IOException - */ - private DataTreeObject readInventoryTreeWithNode(String filter) throws IOException { - DataTreeObject tree = new DataTreeObject(INVENTORY_PROPERTY_PARENTUUID, INVENTORY_PROPERTY_UUID); - - List<SearchHit> matches = this.search(Entity.Inventoryequipment, filter, INVENTORY_PROPERTY_TREELEVEL); - List<SearchHit> others = null; - if (matches.size() > 0) { + @Override + protected List<InventoryEntity> search(String filter, String nodeId, String parentUuid, String uuid, String sortOrderProperty, SortOrder sortOrder) { + QueryBuilder query = + filter == null ? QueryBuilders.matchAllQuery() : QueryBuilders.searchAllFieldsQuery(filter); + if ((nodeId != null) || (parentUuid != null)) { + BoolQueryBuilder bquery = new BoolQueryBuilder(); if (filter != null) { - //find all parents up to tree-level 0 - String nodeId = ""; - List<String> alreadyInList = new ArrayList<>(); - BoolQueryBuilder query2 = QueryBuilders.boolQuery(); - for (SearchHit hit : matches) { - nodeId = hit.getSource().getString(INVENTORY_PROPERTY_NODEID); - if (alreadyInList.contains(nodeId)) { - continue; - } - query2.should(QueryBuilders.matchQuery(INVENTORY_PROPERTY_NODEID, nodeId)); - alreadyInList.add(nodeId); - tree.put(nodeId, - new DataTreeChildObject(nodeId, false).setProperty(INVENTORY_PROPERTY_UUID, nodeId)); - - } - others = this.search(Entity.Inventoryequipment, query2, INVENTORY_PROPERTY_TREELEVEL); - } else { - AggregationEntries nodes = this.searchAggregated(Entity.Inventoryequipment, INVENTORY_PROPERTY_NODEID); - for (String node : nodes.keySet()) { - tree.put(node, new DataTreeChildObject(node, false).setProperty(INVENTORY_PROPERTY_UUID, node)); - } - } - - //build tree - JSONObject hitData; - //fill root elems - for (SearchHit hit : matches) { - hitData = hit.getSource(); - if (hitData.getLong(INVENTORY_PROPERTY_TREELEVEL) == 0) { - tree.put(0, hit.getId(), - new DataTreeChildObject(hitData.getString(INVENTORY_PROPERTY_FOR_LABEL), true) - .setProperty(INVENTORY_PROPERTY_UUID, hitData.getString(INVENTORY_PROPERTY_UUID)) - .setProperty(INVENTORY_PROPERTY_PARENTUUID, - hitData.getString(INVENTORY_PROPERTY_NODEID))); - } - } - if (others != null) { - for (SearchHit hit : others) { - hitData = hit.getSource(); - if (hitData.getLong(INVENTORY_PROPERTY_TREELEVEL) == 0) { - tree.putIfNotExists(0, hit.getId(), - new DataTreeChildObject(hitData.getString(INVENTORY_PROPERTY_FOR_LABEL), false) - .setProperty(INVENTORY_PROPERTY_UUID, - hitData.getString(INVENTORY_PROPERTY_UUID)) - .setProperty(INVENTORY_PROPERTY_PARENTUUID, - hitData.getString(INVENTORY_PROPERTY_NODEID))); - } - } - } - //fill child elements - for (SearchHit hit : matches) { - hitData = hit.getSource(); - long treeLevel = hitData.getLong(INVENTORY_PROPERTY_TREELEVEL); - if (treeLevel > 0) { - tree.put(treeLevel, hit.getId(), - new DataTreeChildObject(hitData.getString(INVENTORY_PROPERTY_FOR_LABEL_CHILD), true) - .setProperty(INVENTORY_PROPERTY_UUID, hitData.getString(INVENTORY_PROPERTY_UUID)) - .setProperty(INVENTORY_PROPERTY_PARENTUUID, - hitData.getString(INVENTORY_PROPERTY_PARENTUUID))); - } + bquery.must(query); } - if (others != null) { - for (SearchHit hit : others) { - hitData = hit.getSource(); - long treeLevel = hitData.getLong(INVENTORY_PROPERTY_TREELEVEL); - if (hitData.getLong(INVENTORY_PROPERTY_TREELEVEL) > 0) { - tree.putIfNotExists(treeLevel, hit.getId(), - new DataTreeChildObject(hitData.getString(INVENTORY_PROPERTY_FOR_LABEL_CHILD), false) - .setProperty(INVENTORY_PROPERTY_UUID, - hitData.getString(INVENTORY_PROPERTY_UUID)) - .setProperty(INVENTORY_PROPERTY_PARENTUUID, - hitData.getString(INVENTORY_PROPERTY_PARENTUUID))); - } - } + if (nodeId != null) { + bquery.must(QueryBuilders.matchQuery(INVENTORY_PROPERTY_NODEID, nodeId)); } - tree.removeUnmatchedPaths(); + query = bquery; } - return tree; + query.sort(sortOrderProperty, sortOrder); + return this.search(query); } - - - /** - * @param client - */ - public void setDatabaseClient(HtDatabaseClient client) { - this.dbClient = client; - + @Override + protected List<InventoryEntity> getItemsForNodes(List<String> nodeIds, String sortOrderProperty, SortOrder sortOrder) { + BoolQueryBuilder query = QueryBuilders.boolQuery(); + nodeIds.forEach(e->query.should(QueryBuilders.matchQuery(INVENTORY_PROPERTY_NODEID,e))); + return this.search(query); } + } diff --git a/sdnr/wt/data-provider/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml b/sdnr/wt/data-provider/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml index d5f8a991a..5a681d76f 100644 --- a/sdnr/wt/data-provider/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml +++ b/sdnr/wt/data-provider/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml @@ -29,42 +29,20 @@ <reference id="rpcProviderService" interface="org.opendaylight.mdsal.binding.api.RpcProviderService"/> <reference id="dataBroker" interface="org.opendaylight.mdsal.binding.api.DataBroker"/> - - <bean id="aboutServlet" - class="org.onap.ccsdk.features.sdnr.wt.dataprovider.http.about.AboutHttpServlet"> - </bean> - <service interface="javax.servlet.http.HttpServlet" - ref="aboutServlet"> - <service-properties> - <entry key="alias" value="/about"/> - </service-properties> - </service> + + <bean id="aboutServlet" class="org.onap.ccsdk.features.sdnr.wt.dataprovider.http.about.AboutHttpServlet" /> <bean id="msServlet" class="org.onap.ccsdk.features.sdnr.wt.dataprovider.http.MsServlet"> </bean> - <service interface="javax.servlet.http.HttpServlet" ref="msServlet"> - <service-properties> - <entry key="alias" value="/ms"/> - </service-properties> - </service> + <bean id="treeServlet" class="org.onap.ccsdk.features.sdnr.wt.dataprovider.http.DataTreeHttpServlet"> </bean> - <service interface="javax.servlet.http.HttpServlet" ref="treeServlet"> - <service-properties> - <entry key="alias" value="/tree"/> - </service-properties> - </service> <bean id="userdataServlet" class="org.onap.ccsdk.features.sdnr.wt.dataprovider.http.UserdataHttpServlet"> </bean> - <service interface="javax.servlet.http.HttpServlet" ref="userdataServlet"> - <service-properties> - <entry key="alias" value="/userdata"/> - </service-properties> - </service> <bean id="provider" class="org.onap.ccsdk.features.sdnr.wt.dataprovider.impl.DataProviderImpl" @@ -80,12 +58,6 @@ <bean id="yangServlet" class="org.onap.ccsdk.features.sdnr.wt.dataprovider.http.yangschema.YangSchemaHttpServlet"> </bean> - <service interface="javax.servlet.http.HttpServlet" - ref="yangServlet"> - <service-properties> - <entry key="alias" value="/yang-schema"/> - </service-properties> - </service> <service ref="provider" interface="org.onap.ccsdk.features.sdnr.wt.dataprovider.model.IEntityDataProvider"/> diff --git a/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestCRUDforDatabase.java b/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestCRUDforDatabase.java index 08b1d00aa..268015a4d 100644 --- a/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestCRUDforDatabase.java +++ b/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestCRUDforDatabase.java @@ -36,8 +36,6 @@ import java.util.List; import java.util.Map; import java.util.Set; import java.util.concurrent.TimeUnit; - -import org.eclipse.jdt.annotation.Nullable; import org.junit.BeforeClass; import org.junit.Test; import org.onap.ccsdk.features.sdnr.wt.common.database.HtDatabaseClient; @@ -46,10 +44,11 @@ import org.onap.ccsdk.features.sdnr.wt.common.database.SearchResult; import org.onap.ccsdk.features.sdnr.wt.common.database.config.HostInfo; import org.onap.ccsdk.features.sdnr.wt.common.database.queries.QueryBuilders; import org.onap.ccsdk.features.sdnr.wt.common.database.requests.BaseRequest; -import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.DatabaseDataProvider; +import org.onap.ccsdk.features.sdnr.wt.common.test.JSONAssert; import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.elasticsearch.impl.ElasticSearchDataProvider; import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.elasticsearch.impl.HtUserdataManagerImpl; import org.onap.ccsdk.features.sdnr.wt.dataprovider.http.UserdataHttpServlet; +import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DatabaseDataProvider; import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.types.YangHelper2; import org.onap.ccsdk.features.sdnr.wt.dataprovider.test.util.HostInfoForTest; import org.onap.ccsdk.features.sdnr.wt.dataprovider.yangtools.DataProviderYangToolsMapper; @@ -187,12 +186,12 @@ public class TestCRUDforDatabase { "org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.CreateFaultcurrentInput", SeverityType.Warning, "nodeA"); - createNeConnection("nodeA","10.20.30.40",30000, ConnectionLogStatus.Connected); - createNeConnection("nodeB","10.20.30.40",31000, ConnectionLogStatus.Connected); - createNeConnection("nodeC","10.20.30.40",32000, ConnectionLogStatus.Connected); - createNeConnection("nodeAD","10.20.30.40",33000, ConnectionLogStatus.Connected); - createNeConnection("nodeE","10.20.30.40",34000, ConnectionLogStatus.Connected); - createNeConnection("nodeF","10.20.30.40",35000, ConnectionLogStatus.Connected); + createNeConnection("nodeA", "10.20.30.40", 30000, ConnectionLogStatus.Connected); + createNeConnection("nodeB", "10.20.30.40", 31000, ConnectionLogStatus.Connected); + createNeConnection("nodeC", "10.20.30.40", 32000, ConnectionLogStatus.Connected); + createNeConnection("nodeAD", "10.20.30.40", 33000, ConnectionLogStatus.Connected); + createNeConnection("nodeE", "10.20.30.40", 34000, ConnectionLogStatus.Connected); + createNeConnection("nodeF", "10.20.30.40", 35000, ConnectionLogStatus.Connected); //== READ ================================ List<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.read.status.output.Data> readOutput = @@ -1052,7 +1051,7 @@ public class TestCRUDforDatabase { assertTrue(holder.contains(holderArray[0])); assertTrue(holder.contains(holderArray[1])); assertTrue(holder.contains(holderArray[2])); - + // ==DELETE============================ System.out.println("delete after test"); @@ -1538,7 +1537,7 @@ public class TestCRUDforDatabase { boolean success = client.setUserdata(USERNAME, DATA1); assertTrue(success); String data = client.getUserdata(USERNAME); - //JSONAssert.assertEquals(DATA1,data,false); + JSONAssert.assertEquals(DATA1,data,false); assertEquals("admin", UserdataHttpServlet.decodeJWTPayloadUsername(String.format("Bearer %s", "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJhZG1pbkBzZG4iLCJyb2xlcyI6WyJ1c2VyIiwiYWRtaW4iXSwiaXN" @@ -1571,19 +1570,12 @@ public class TestCRUDforDatabase { return createFaultEntity(initialDbId, entityType, implementedInterface, severity, nodeId); } - private void createNeConnection(String nodeId, String host, int port, ConnectionLogStatus connectionStatus) { - try { - dbProvider.createNetworkElementConnection(new NetworkElementConnectionBuilder().setId(nodeId) - .setNodeId(nodeId).setStatus(connectionStatus).setHost(host).setPort(Uint32.valueOf(port)).build()); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - private String createFaultEntity(String initialDbId, String entityType, String implementedInterface, - SeverityType severity) { - return createFaultEntity(initialDbId, entityType, implementedInterface, severity, "s1"); + private void createNeConnection(String nodeId, String host, int port, ConnectionLogStatus connectionStatus) + throws IOException { + dbProvider.createNetworkElementConnection(new NetworkElementConnectionBuilder().setId(nodeId).setNodeId(nodeId) + .setStatus(connectionStatus).setHost(host).setPort(Uint32.valueOf(port)).build()); } + private String createFaultEntity(String initialDbId, String entityType, String implementedInterface, SeverityType severity, String nodeId) { // ==CREATE============================ @@ -1594,7 +1586,7 @@ public class TestCRUDforDatabase { dbId = dbRawProvider.doUpdateOrCreate(entityType, initialDbId, "{\n" + "\"timestamp\": \"2019-10-28T11:55:58.3Z\",\n" + "\"object-id\": \"LP-MWPS-RADIO\",\n" - + "\"severity\": \"" + severity.toString() + "\",\n" + "\"node-id\": \""+nodeId+"\",\n" + + "\"severity\": \"" + severity.toString() + "\",\n" + "\"node-id\": \"" + nodeId + "\",\n" + "\"implemented-interface\": \"" + implementedInterface + "\",\n" + "\"counter\": 4340,\n" + "\"problem\": \"signalIsLost\",\n" + "\"type\": \"ProblemNotificationXml\"\n" + "}"); diff --git a/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestEventService.java b/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestEventService.java index 0db019005..4c6e1b893 100644 --- a/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestEventService.java +++ b/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestEventService.java @@ -39,7 +39,7 @@ import org.onap.ccsdk.features.sdnr.wt.common.database.SearchResult; import org.onap.ccsdk.features.sdnr.wt.common.database.config.HostInfo; import org.onap.ccsdk.features.sdnr.wt.common.database.queries.QueryBuilders; import org.onap.ccsdk.features.sdnr.wt.common.database.requests.DeleteByQueryRequest; -import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.DatabaseDataProvider; +import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DatabaseDataProvider; import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.elasticsearch.data.entity.FaultEntityManager; import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.elasticsearch.data.entity.HtDatabaseEventsService; import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.elasticsearch.impl.ElasticSearchDataProvider; @@ -98,7 +98,7 @@ public class TestEventService { dbRawProvider = HtDatabaseClient.getClient(hosts); try { - service = new HtDatabaseEventsService(dbRawProvider, dbProvider); + service = new HtDatabaseEventsService(dbRawProvider); } catch (Exception e) { e.printStackTrace(); fail(e.getMessage()); diff --git a/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestInventoryConsistency.java b/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestInventoryConsistency.java index ce1bd78fa..d1b5cfcfd 100644 --- a/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestInventoryConsistency.java +++ b/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestInventoryConsistency.java @@ -21,20 +21,29 @@ */ package org.onap.ccsdk.features.sdnr.wt.dataprovider.test; -import static org.junit.Assert.fail; import java.io.IOException; import java.util.ArrayList; import java.util.List; +import java.util.Set; import java.util.concurrent.TimeUnit; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.fail; import org.junit.BeforeClass; import org.junit.Test; import org.onap.ccsdk.features.sdnr.wt.common.database.SearchHit; import org.onap.ccsdk.features.sdnr.wt.common.database.config.HostInfo; -import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.DatabaseDataProvider; import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.elasticsearch.impl.ElasticSearchDataProvider; +import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DatabaseDataProvider; import org.onap.ccsdk.features.sdnr.wt.dataprovider.test.util.HostInfoForTest; import org.onap.ccsdk.features.sdnr.wt.yang.mapper.YangToolsMapper; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.Entity; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.Inventory; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.ReadInventoryDeviceListInputBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.ReadInventoryDeviceListOutputBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.entity.input.PaginationBuilder; +import org.opendaylight.yangtools.yang.common.Uint32; +import org.opendaylight.yangtools.yang.common.Uint64; public class TestInventoryConsistency { @@ -51,10 +60,11 @@ public class TestInventoryConsistency { @Test public void test1() { YangToolsMapper mapper = new YangToolsMapper(); + SearchHit[] hits = null; try { - SearchHit[] hits = TestTree.loadEntries("test1.json"); + hits = TestTree.loadEntries("test1.json"); List<Inventory> inventoryList = new ArrayList<>(); - for(SearchHit hit:hits) { + for (SearchHit hit : hits) { inventoryList.add(mapper.readValue(hit.getSourceAsString(), Inventory.class)); } dbProvider.getDataProvider().writeInventory(TEST1NODEID, inventoryList); @@ -63,5 +73,14 @@ public class TestInventoryConsistency { e.printStackTrace(); fail(e.getMessage()); } + SearchHit sim2Hit = hits[hits.length-1]; + dbProvider.getRawClient().doWriteRaw(Entity.Inventoryequipment.getName(),sim2Hit.getId(),sim2Hit.getSourceAsString(),true); + ReadInventoryDeviceListOutputBuilder deviceListWithInventory = + dbProvider.readInventoryDeviceList(new ReadInventoryDeviceListInputBuilder().setPagination( + new PaginationBuilder().setSize(Uint32.valueOf(20)).setPage(Uint64.valueOf(1)) + .build()).build()); + assertNotNull(deviceListWithInventory); + assertEquals(2, deviceListWithInventory.getPagination().getTotal().intValue()); + assertEquals(Set.of("sim1", "sim2"), deviceListWithInventory.getData()); } } diff --git a/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestMaintenanceServiceData.java b/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestMaintenanceServiceData.java index e85ed8cdd..1b95050d4 100644 --- a/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestMaintenanceServiceData.java +++ b/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestMaintenanceServiceData.java @@ -33,7 +33,7 @@ import org.onap.ccsdk.features.sdnr.wt.common.database.HtDatabaseClient; import org.onap.ccsdk.features.sdnr.wt.common.database.config.HostInfo; import org.onap.ccsdk.features.sdnr.wt.common.database.queries.QueryBuilders; import org.onap.ccsdk.features.sdnr.wt.common.database.requests.DeleteByQueryRequest; -import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.DatabaseDataProvider; +import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DatabaseDataProvider; import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.elasticsearch.impl.ElasticSearchDataProvider; import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.HtDatabaseMaintenance; import org.onap.ccsdk.features.sdnr.wt.dataprovider.test.util.HostInfoForTest; diff --git a/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestMediatorServerService.java b/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestMediatorServerService.java index 408f6a636..dcd2eb0c7 100644 --- a/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestMediatorServerService.java +++ b/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestMediatorServerService.java @@ -32,7 +32,7 @@ import org.onap.ccsdk.features.sdnr.wt.common.database.HtDatabaseClient; import org.onap.ccsdk.features.sdnr.wt.common.database.config.HostInfo; import org.onap.ccsdk.features.sdnr.wt.common.database.queries.QueryBuilders; import org.onap.ccsdk.features.sdnr.wt.common.database.requests.DeleteByQueryRequest; -import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.DatabaseDataProvider; +import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DatabaseDataProvider; import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.elasticsearch.impl.ElasticSearchDataProvider; import org.onap.ccsdk.features.sdnr.wt.dataprovider.impl.MediatorServerDataProvider; import org.onap.ccsdk.features.sdnr.wt.dataprovider.test.util.HostInfoForTest; diff --git a/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestNetconfNodeBuilder.java b/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestNetconfNodeBuilder.java index f7a5a841c..85db4b2a0 100644 --- a/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestNetconfNodeBuilder.java +++ b/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestNetconfNodeBuilder.java @@ -21,16 +21,17 @@ */ package org.onap.ccsdk.features.sdnr.wt.dataprovider.test; +import org.junit.Test; import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNode; import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNodeBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.netconf.node.credentials.Credentials; import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.netconf.node.credentials.credentials.LoginPassword; import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.netconf.node.credentials.credentials.LoginPasswordBuilder; +@SuppressWarnings("deprecation") public class TestNetconfNodeBuilder { - @SuppressWarnings("deprecation") - //@Test + @Test public void test() { NetconfNodeBuilder netconfNodeBuilder = new NetconfNodeBuilder(); diff --git a/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestNetconfTimestamp.java b/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestNetconfTimestamp.java index 1081e3cfe..a21373277 100644 --- a/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestNetconfTimestamp.java +++ b/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestNetconfTimestamp.java @@ -21,14 +21,13 @@ */ package org.onap.ccsdk.features.sdnr.wt.dataprovider.test; -import static org.junit.Assert.*; - +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; import java.util.Calendar; import java.util.Date; import java.util.TimeZone; import java.util.regex.Matcher; import java.util.regex.Pattern; - import org.junit.Test; import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.NetconfTimeStamp; import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.types.NetconfTimeStampImpl; @@ -64,7 +63,7 @@ public class TestNetconfTimestamp { @Test(expected = IllegalArgumentException.class) public void testMillisMalformed() { - long millis = converter.getTimeStampFromNetconfAsMilliseconds(NETCONF_DEF_MILLIS_STRING_MALFORMAED); + converter.getTimeStampFromNetconfAsMilliseconds(NETCONF_DEF_MILLIS_STRING_MALFORMAED); } diff --git a/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestTree.java b/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestTree.java index 29f35560e..b7689ed49 100644 --- a/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestTree.java +++ b/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestTree.java @@ -35,12 +35,12 @@ import org.onap.ccsdk.features.sdnr.wt.common.database.config.HostInfo; import org.onap.ccsdk.features.sdnr.wt.common.database.queries.QueryBuilders; import org.onap.ccsdk.features.sdnr.wt.common.database.requests.DeleteByQueryRequest; import org.onap.ccsdk.features.sdnr.wt.common.test.JSONAssert; -import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.DatabaseDataProvider; import org.onap.ccsdk.features.sdnr.wt.dataprovider.database.elasticsearch.impl.ElasticSearchDataProvider; import org.onap.ccsdk.features.sdnr.wt.dataprovider.http.DataTreeHttpServlet; import org.onap.ccsdk.features.sdnr.wt.dataprovider.http.DataTreeHttpServlet.EntityWithTree; -import org.onap.ccsdk.features.sdnr.wt.dataprovider.http.DataTreeObject; import org.onap.ccsdk.features.sdnr.wt.dataprovider.impl.DataTreeProviderImpl; +import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DatabaseDataProvider; +import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.types.DataTreeObject; import org.onap.ccsdk.features.sdnr.wt.dataprovider.test.util.HostInfoForTest; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.Entity; @@ -56,8 +56,6 @@ public class TestTree { dbProvider = new ElasticSearchDataProvider(hosts); dbProvider.waitForYellowDatabaseStatus(30, TimeUnit.SECONDS); dbRawProvider = HtDatabaseClient.getClient(hosts); - - } public static void clearTestData(HtDatabaseClient dbRawProvider) throws IOException { @@ -85,50 +83,24 @@ public class TestTree { } @Test - public void testInventoryTree() throws IOException { - test1(); - //test2(); - - } - - private void test1() throws IOException { + public void testInventoryTree1() throws IOException { clearTestData(dbRawProvider); fillTestData(dbRawProvider, "test1.json"); - DataTreeProviderImpl provider = new DataTreeProviderImpl(); - provider.setDatabaseClient(dbRawProvider); + DataTreeProviderImpl provider = new DataTreeProviderImpl(dbRawProvider); DataTreeObject tree = provider.readInventoryTree(null, null); - System.out.println(tree.toJSON()); JSONObject o = new JSONObject(tree.toJSON()); + System.out.println("Tree1.1: "+o); JSONAssert.assertContainsExactKeys(o, new String[]{"sim1","sim2"}); JSONObject children = o.getJSONObject("sim1").getJSONObject("children"); this.assertSim1(children); tree = provider.readInventoryTree(Arrays.asList("sim1"), "*"); this.assertSim1(new JSONObject(tree.toJSON())); - System.out.println(tree.toJSON()); + System.out.println("Tree1.2: "+tree.toJSON()); } - private void test2() throws IOException { - clearTestData(dbRawProvider); - fillTestData(dbRawProvider, "test2.json"); - DataTreeProviderImpl provider = new DataTreeProviderImpl(); - provider.setDatabaseClient(dbRawProvider); - - - DataTreeObject tree = - provider.readInventoryTree(Arrays.asList("netconf_server_simulator"), "*"); - System.out.println(tree.toJSON()); - JSONObject o = new JSONObject(tree.toJSON()); - JSONAssert.assertContainsOnlyKey(o, "sim1"); - JSONObject children = o.getJSONObject("sim1").getJSONObject("children"); - this.assertSim1(children); - - tree = provider.readInventoryTree(Arrays.asList("sim1"), "*"); - this.assertSim1(new JSONObject(tree.toJSON())); - System.out.println(tree.toJSON()); - } private void assertSim1(JSONObject sim1Children) { JSONAssert.assertContainsExactKeys(sim1Children, diff --git a/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestYangGenSalMapping.java b/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestYangGenSalMapping.java index 910f63daf..ed6642a6f 100644 --- a/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestYangGenSalMapping.java +++ b/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestYangGenSalMapping.java @@ -23,11 +23,9 @@ package org.onap.ccsdk.features.sdnr.wt.dataprovider.test; import java.io.IOException; import java.math.BigInteger; -import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; - import org.eclipse.jdt.annotation.Nullable; import org.json.JSONObject; import org.junit.Test; diff --git a/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestYangGenSalMappingOpenRoadm.java b/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestYangGenSalMappingOpenRoadm.java index 35ddaf2f3..0192b47db 100644 --- a/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestYangGenSalMappingOpenRoadm.java +++ b/sdnr/wt/data-provider/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/test/TestYangGenSalMappingOpenRoadm.java @@ -37,6 +37,7 @@ import org.onap.ccsdk.features.sdnr.wt.yang.mapper.YangToolsMapper2; import org.opendaylight.yang.gen.v1.http.org.openroadm.pm.types.rev191129.PmDataType; import org.opendaylight.yang.gen.v1.http.org.openroadm.pm.types.rev191129.PmDataTypeBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.openroadm.pm.types.rev200413.BIPErrorCounter; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.openroadm.pm.types.rev200413.DelayTCM2Up; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.openroadm.pm.types.rev200413.OpticalPowerInputOSCMin; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.GranularityPeriodType; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.PmdataEntity; @@ -57,12 +58,12 @@ public class TestYangGenSalMappingOpenRoadm extends Mockito { out("Test: " + method()); MeasurementBuilder measurementBuilder1 = new MeasurementBuilder(); - measurementBuilder1.setPmKey(OpticalPowerInputOSCMin.class); + measurementBuilder1.setPmKey(OpticalPowerInputOSCMin.VALUE); measurementBuilder1.setPmValue(new PmDataType(Uint64.valueOf(64L))); Measurement measurement1 = measurementBuilder1.build(); MeasurementBuilder measurementBuilder2 = new MeasurementBuilder(); - measurementBuilder2.setPmKey(BIPErrorCounter.class); + measurementBuilder2.setPmKey(BIPErrorCounter.VALUE); measurementBuilder2.setPmValue(new PmDataType(Uint64.valueOf(65L))); Measurement measurement2 = measurementBuilder2.build(); @@ -98,7 +99,7 @@ public class TestYangGenSalMappingOpenRoadm extends Mockito { assertNotNull("PerformanceData", performanceData); @Nullable Map<MeasurementKey, Measurement> measurement = performanceData.getMeasurement(); assertNotNull("Measurement", measurement); - Measurement measurement1 = measurement.get(new MeasurementKey(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.openroadm.pm.types.rev200413.OpticalPowerInputOSCMin.class)); + Measurement measurement1 = measurement.get(new MeasurementKey(OpticalPowerInputOSCMin.VALUE)); assertTrue("Measurement=64", measurement1.getPmValue().stringValue().equals("64")); } @@ -144,7 +145,7 @@ public class TestYangGenSalMappingOpenRoadm extends Mockito { assertNotNull("PerformanceData", performanceData); @Nullable Map<MeasurementKey, Measurement> measurement = performanceData.getMeasurement(); assertNotNull("Measurement", measurement); - Measurement measurement1 = measurement.get(new MeasurementKey(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.openroadm.pm.types.rev200413.DelayTCM2Up.class)); + Measurement measurement1 = measurement.get(new MeasurementKey(DelayTCM2Up.VALUE)); assertTrue("Measurement=11298624220985537708", measurement1.getPmValue().stringValue().equals("11298624220985537708")); } /* diff --git a/sdnr/wt/data-provider/setup/pom.xml b/sdnr/wt/data-provider/setup/pom.xml index bedd548c2..d8f8e8c38 100644 --- a/sdnr/wt/data-provider/setup/pom.xml +++ b/sdnr/wt/data-provider/setup/pom.xml @@ -22,13 +22,14 @@ ~ ============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.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/devicemanager-core/feature/pom.xml b/sdnr/wt/devicemanager-core/feature/pom.xml index 5e31233b3..a06c14a17 100644 --- a/sdnr/wt/devicemanager-core/feature/pom.xml +++ b/sdnr/wt/devicemanager-core/feature/pom.xml @@ -28,7 +28,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>single-feature-parent</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/devicemanager-core/installer/pom.xml b/sdnr/wt/devicemanager-core/installer/pom.xml index cdcba876d..c1136e4d4 100755 --- a/sdnr/wt/devicemanager-core/installer/pom.xml +++ b/sdnr/wt/devicemanager-core/installer/pom.xml @@ -28,7 +28,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>odlparent-lite</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/devicemanager-core/model/pom.xml b/sdnr/wt/devicemanager-core/model/pom.xml index fb3143831..dcc810f84 100644 --- a/sdnr/wt/devicemanager-core/model/pom.xml +++ b/sdnr/wt/devicemanager-core/model/pom.xml @@ -28,7 +28,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>binding-parent</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/devicemanager-core/pom.xml b/sdnr/wt/devicemanager-core/pom.xml index b419ee952..78bd7c2dd 100755 --- a/sdnr/wt/devicemanager-core/pom.xml +++ b/sdnr/wt/devicemanager-core/pom.xml @@ -28,7 +28,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>odlparent-lite</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/devicemanager-core/provider/pom.xml b/sdnr/wt/devicemanager-core/provider/pom.xml index 8cfcf1c9b..e6f64c902 100644 --- a/sdnr/wt/devicemanager-core/provider/pom.xml +++ b/sdnr/wt/devicemanager-core/provider/pom.xml @@ -28,7 +28,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>binding-parent</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/feature/pom.xml b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/feature/pom.xml index 28e37a591..026c57a36 100644 --- a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/feature/pom.xml +++ b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/feature/pom.xml @@ -28,7 +28,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>single-feature-parent</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/installer/pom.xml b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/installer/pom.xml index 9a671a4f2..dcdf11d0d 100755 --- a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/installer/pom.xml +++ b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/installer/pom.xml @@ -28,7 +28,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>odlparent-lite</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/model/pom.xml b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/model/pom.xml index 5eeba7679..63ec4e256 100644 --- a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/model/pom.xml +++ b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/model/pom.xml @@ -28,7 +28,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>binding-parent</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/pom.xml b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/pom.xml index c2b7964d4..6e44b5e98 100755 --- a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/pom.xml +++ b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/pom.xml @@ -28,7 +28,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>odlparent-lite</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/pom.xml b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/pom.xml index 4cf744fe1..bc21f6ffd 100644 --- a/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/pom.xml +++ b/sdnr/wt/devicemanager-o-ran-sc/o-ran/ru-fh/provider/pom.xml @@ -28,7 +28,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>binding-parent</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> @@ -114,11 +114,6 @@ <artifactId>rfc7317-ietf-system</artifactId> <version>${project.version}</version> </dependency> - <dependency> - <groupId>${project.groupId}</groupId> - <artifactId>onap-system</artifactId> - <version>${project.version}</version> - </dependency> <!-- begin for testing --> <dependency> <groupId>org.mockito</groupId> diff --git a/sdnr/wt/devicemanager-onap/adapter-manager/feature/pom.xml b/sdnr/wt/devicemanager-onap/adapter-manager/feature/pom.xml index ac879675c..69b27db61 100644 --- a/sdnr/wt/devicemanager-onap/adapter-manager/feature/pom.xml +++ b/sdnr/wt/devicemanager-onap/adapter-manager/feature/pom.xml @@ -28,7 +28,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>single-feature-parent</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/devicemanager-onap/adapter-manager/installer/pom.xml b/sdnr/wt/devicemanager-onap/adapter-manager/installer/pom.xml index 54f6bd55a..0294f8379 100755 --- a/sdnr/wt/devicemanager-onap/adapter-manager/installer/pom.xml +++ b/sdnr/wt/devicemanager-onap/adapter-manager/installer/pom.xml @@ -28,7 +28,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>odlparent-lite</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/devicemanager-onap/adapter-manager/model/pom.xml b/sdnr/wt/devicemanager-onap/adapter-manager/model/pom.xml index 2ff46dddd..352603b4b 100644 --- a/sdnr/wt/devicemanager-onap/adapter-manager/model/pom.xml +++ b/sdnr/wt/devicemanager-onap/adapter-manager/model/pom.xml @@ -28,7 +28,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>binding-parent</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/devicemanager-onap/adapter-manager/pom.xml b/sdnr/wt/devicemanager-onap/adapter-manager/pom.xml index 2e0807277..fce8ddc2b 100755 --- a/sdnr/wt/devicemanager-onap/adapter-manager/pom.xml +++ b/sdnr/wt/devicemanager-onap/adapter-manager/pom.xml @@ -28,7 +28,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>odlparent-lite</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/devicemanager-onap/adapter-manager/provider/pom.xml b/sdnr/wt/devicemanager-onap/adapter-manager/provider/pom.xml index 2a4f2c078..f85121b1e 100644 --- a/sdnr/wt/devicemanager-onap/adapter-manager/provider/pom.xml +++ b/sdnr/wt/devicemanager-onap/adapter-manager/provider/pom.xml @@ -28,7 +28,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>binding-parent</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/devicemanager-onap/onf12/feature/pom.xml b/sdnr/wt/devicemanager-onap/onf12/feature/pom.xml index a47cf6433..e917230e7 100644 --- a/sdnr/wt/devicemanager-onap/onf12/feature/pom.xml +++ b/sdnr/wt/devicemanager-onap/onf12/feature/pom.xml @@ -22,13 +22,14 @@ ~ ============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>single-feature-parent</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/devicemanager-onap/onf12/installer/pom.xml b/sdnr/wt/devicemanager-onap/onf12/installer/pom.xml index e1fec5c54..f2bf93765 100755 --- a/sdnr/wt/devicemanager-onap/onf12/installer/pom.xml +++ b/sdnr/wt/devicemanager-onap/onf12/installer/pom.xml @@ -22,13 +22,14 @@ ~ ============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>odlparent-lite</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/devicemanager-onap/onf12/model/pom.xml b/sdnr/wt/devicemanager-onap/onf12/model/pom.xml index 717250ab4..70f4cf8e8 100644 --- a/sdnr/wt/devicemanager-onap/onf12/model/pom.xml +++ b/sdnr/wt/devicemanager-onap/onf12/model/pom.xml @@ -22,13 +22,14 @@ ~ ============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.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/devicemanager-onap/onf12/pom.xml b/sdnr/wt/devicemanager-onap/onf12/pom.xml index d6e73440f..0bf9bbb40 100755 --- a/sdnr/wt/devicemanager-onap/onf12/pom.xml +++ b/sdnr/wt/devicemanager-onap/onf12/pom.xml @@ -22,13 +22,14 @@ ~ ============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>odlparent-lite</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/devicemanager-onap/onf12/provider/pom.xml b/sdnr/wt/devicemanager-onap/onf12/provider/pom.xml index 2c25468af..641e5ba7e 100644 --- a/sdnr/wt/devicemanager-onap/onf12/provider/pom.xml +++ b/sdnr/wt/devicemanager-onap/onf12/provider/pom.xml @@ -22,13 +22,14 @@ ~ ============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.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/equipment/ONFCoreNetworkElement12Equipment.java b/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/equipment/ONFCoreNetworkElement12Equipment.java index 3c0878495..30f039568 100644 --- a/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/equipment/ONFCoreNetworkElement12Equipment.java +++ b/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/equipment/ONFCoreNetworkElement12Equipment.java @@ -271,7 +271,7 @@ public class ONFCoreNetworkElement12Equipment { final Class<?> clazzPac = Equipment.class; - LOG.info("DBRead Get equipment for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(), + LOG.debug("DBRead Get equipment for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(), coreData.getMountpoint(), interfacePacUuid.getValue()); InstanceIdentifier<Equipment> equipmentIID = @@ -292,7 +292,7 @@ public class ONFCoreNetworkElement12Equipment { final Class<?> clazzPac = Equipment.class; - LOG.info("DBRead Get all equipment for class {} from mountpoint {}", clazzPac.getSimpleName(), + LOG.debug("DBRead Get all equipment for class {} from mountpoint {}", clazzPac.getSimpleName(), coreData.getMountpoint()); InstanceIdentifier<Equipment> equipmentIID = InstanceIdentifier.builder(Equipment.class).build(); diff --git a/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/equipment/WrapperEquipmentPacRev170402.java b/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/equipment/WrapperEquipmentPacRev170402.java index d0b4cc51a..c2cb87f47 100644 --- a/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/equipment/WrapperEquipmentPacRev170402.java +++ b/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/equipment/WrapperEquipmentPacRev170402.java @@ -69,7 +69,7 @@ public class WrapperEquipmentPacRev170402 implements OnfInterfacePac { final Class<EquipmentPacKey> clazzPacKey = EquipmentPacKey.class; final Class<EquipmentCurrentProblems> clazzProblems = EquipmentCurrentProblems.class; - LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(), + LOG.debug("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(), acessor.getNodeId(), interfacePacUuid.getValue()); try { diff --git a/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/WrapperMicrowaveModelRev170324.java b/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/WrapperMicrowaveModelRev170324.java index 553c0103b..58aede57d 100644 --- a/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/WrapperMicrowaveModelRev170324.java +++ b/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/WrapperMicrowaveModelRev170324.java @@ -199,7 +199,7 @@ public class WrapperMicrowaveModelRev170324 implements OnfMicrowaveModel, Microw } else if (qName.equals(MwTdmContainerPac.QNAME)) { res = MwTdmContainerPac.class; } - LOG.info("Found QName {} mapped to {}", String.valueOf(qName), String.valueOf(res)); + LOG.debug("Found QName {} mapped to {}", String.valueOf(qName), String.valueOf(res)); return res; } @@ -278,7 +278,7 @@ public class WrapperMicrowaveModelRev170324 implements OnfMicrowaveModel, Microw final Class<MwAirInterfacePac> clazzPac = MwAirInterfacePac.class; String mountpointId = acessor.getNodeId().getValue(); - LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(), + LOG.debug("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(), mountpointId, interfacePacUuid.getValue()); // Step 2.2: construct data and the relative iid @@ -315,7 +315,7 @@ public class WrapperMicrowaveModelRev170324 implements OnfMicrowaveModel, Microw final Class<MwEthernetContainerPac> clazzPac = MwEthernetContainerPac.class; String mountpointId = acessor.getNodeId().getValue(); - LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(), + LOG.debug("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(), mountpointId, interfacePacUuid.getValue()); InstanceIdentifier<EthernetContainerCurrentProblems> mwEthInterfaceIID = InstanceIdentifier @@ -349,7 +349,7 @@ public class WrapperMicrowaveModelRev170324 implements OnfMicrowaveModel, Microw final Class<AirInterfaceDiversityCurrentProblems> clazzProblems = AirInterfaceDiversityCurrentProblems.class; String mountpointId = acessor.getNodeId().getValue(); - LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(), + LOG.debug("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(), mountpointId, interfacePacUuid.getValue()); InstanceIdentifier<AirInterfaceDiversityCurrentProblems> mwEthInterfaceIID = InstanceIdentifier @@ -382,7 +382,7 @@ public class WrapperMicrowaveModelRev170324 implements OnfMicrowaveModel, Microw final Class<PureEthernetStructureCurrentProblems> clazzProblems = PureEthernetStructureCurrentProblems.class; String mountpointId = acessor.getNodeId().getValue(); - LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(), + LOG.debug("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(), mountpointId, interfacePacUuid.getValue()); InstanceIdentifier<PureEthernetStructureCurrentProblems> mwEthInterfaceIID = InstanceIdentifier @@ -415,7 +415,7 @@ public class WrapperMicrowaveModelRev170324 implements OnfMicrowaveModel, Microw final Class<HybridMwStructureCurrentProblems> clazzProblems = HybridMwStructureCurrentProblems.class; String mountpointId = acessor.getNodeId().getValue(); - LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(), + LOG.debug("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(), mountpointId, interfacePacUuid.getValue()); InstanceIdentifier<HybridMwStructureCurrentProblems> mwEthInterfaceIID = InstanceIdentifier @@ -456,7 +456,7 @@ public class WrapperMicrowaveModelRev170324 implements OnfMicrowaveModel, Microw final Class<TdmContainerCurrentProblems> clazzProblems = TdmContainerCurrentProblems.class; String mountpointId = acessor.getNodeId().getValue(); - LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(), + LOG.debug("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(), mountpointId, interfacePacUuid.getValue()); try { @@ -575,8 +575,8 @@ public class WrapperMicrowaveModelRev170324 implements OnfMicrowaveModel, Microw SeverityType severity) { Optional<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType> res = - org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType - .forName(severity.name()); + Optional.ofNullable(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType + .forName(severity.name())); return res.orElse( org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType.NonAlarmed); } diff --git a/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/WrapperMicrowaveModelRev180907.java b/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/WrapperMicrowaveModelRev180907.java index 5ce91ed65..75b380f34 100644 --- a/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/WrapperMicrowaveModelRev180907.java +++ b/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/WrapperMicrowaveModelRev180907.java @@ -221,7 +221,7 @@ public class WrapperMicrowaveModelRev180907 implements OnfMicrowaveModel, Microw } else if (qName.equals(MwTdmContainerPac.QNAME)) { res = MwTdmContainerPac.class; } - LOG.info("Found QName {} mapped to {}", String.valueOf(qName), String.valueOf(res)); + LOG.debug("Found QName {} mapped to {}", String.valueOf(qName), String.valueOf(res)); return res; } @@ -287,7 +287,7 @@ public class WrapperMicrowaveModelRev180907 implements OnfMicrowaveModel, Microw final Class<MwAirInterfacePac> clazzPac = MwAirInterfacePac.class; - LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(), + LOG.debug("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(), mountpointId, interfacePacUuid.getValue()); // Step 2.2: construct data and the relative iid @@ -321,7 +321,7 @@ public class WrapperMicrowaveModelRev180907 implements OnfMicrowaveModel, Microw final Class<MwEthernetContainerPac> clazzPac = MwEthernetContainerPac.class; - LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(), + LOG.debug("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(), mountpointId, interfacePacUuid.getValue()); InstanceIdentifier<EthernetContainerCurrentProblems> mwEthInterfaceIID = InstanceIdentifier @@ -353,7 +353,7 @@ public class WrapperMicrowaveModelRev180907 implements OnfMicrowaveModel, Microw final Class<MwAirInterfaceDiversityPac> clazzPac = MwAirInterfaceDiversityPac.class; final Class<AirInterfaceDiversityCurrentProblems> clazzProblems = AirInterfaceDiversityCurrentProblems.class; - LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(), + LOG.debug("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(), mountpointId, interfacePacUuid.getValue()); InstanceIdentifier<AirInterfaceDiversityCurrentProblems> mwEthInterfaceIID = InstanceIdentifier @@ -384,7 +384,7 @@ public class WrapperMicrowaveModelRev180907 implements OnfMicrowaveModel, Microw final Class<MwPureEthernetStructurePac> clazzPac = MwPureEthernetStructurePac.class; final Class<PureEthernetStructureCurrentProblems> clazzProblems = PureEthernetStructureCurrentProblems.class; - LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(), + LOG.debug("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(), mountpointId, interfacePacUuid.getValue()); InstanceIdentifier<PureEthernetStructureCurrentProblems> mwEthInterfaceIID = InstanceIdentifier @@ -415,7 +415,7 @@ public class WrapperMicrowaveModelRev180907 implements OnfMicrowaveModel, Microw final Class<MwHybridMwStructurePac> clazzPac = MwHybridMwStructurePac.class; final Class<HybridMwStructureCurrentProblems> clazzProblems = HybridMwStructureCurrentProblems.class; - LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(), + LOG.debug("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(), mountpointId, interfacePacUuid.getValue()); InstanceIdentifier<HybridMwStructureCurrentProblems> mwEthInterfaceIID = InstanceIdentifier @@ -454,7 +454,7 @@ public class WrapperMicrowaveModelRev180907 implements OnfMicrowaveModel, Microw final Class<MwTdmContainerPacKey> clazzPacKey = MwTdmContainerPacKey.class; final Class<TdmContainerCurrentProblems> clazzProblems = TdmContainerCurrentProblems.class; - LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(), + LOG.debug("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(), mountpointId, interfacePacUuid.getValue()); try { @@ -568,8 +568,8 @@ public class WrapperMicrowaveModelRev180907 implements OnfMicrowaveModel, Microw SeverityType severity) { Optional<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType> res = - org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType - .forName(severity.name()); + Optional.ofNullable(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType + .forName(severity.name())); return res.orElse( org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType.NonAlarmed); } diff --git a/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/WrapperMicrowaveModelRev181010.java b/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/WrapperMicrowaveModelRev181010.java index 747ff96a9..95af73927 100644 --- a/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/WrapperMicrowaveModelRev181010.java +++ b/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/WrapperMicrowaveModelRev181010.java @@ -216,7 +216,7 @@ public class WrapperMicrowaveModelRev181010 implements OnfMicrowaveModel, Microw } else if (qName.equals(MwTdmContainerPac.QNAME)) { res = MwTdmContainerPac.class; } - LOG.info("Found QName {} mapped to {}", String.valueOf(qName), String.valueOf(res)); + LOG.debug("Found QName {} mapped to {}", String.valueOf(qName), String.valueOf(res)); return res; } @@ -280,7 +280,7 @@ public class WrapperMicrowaveModelRev181010 implements OnfMicrowaveModel, Microw final Class<MwAirInterfacePac> clazzPac = MwAirInterfacePac.class; - LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(), + LOG.debug("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(), mountpointId, interfacePacUuid.getValue()); // Step 2.2: construct data and the relative iid @@ -317,7 +317,7 @@ public class WrapperMicrowaveModelRev181010 implements OnfMicrowaveModel, Microw final Class<MwEthernetContainerPac> clazzPac = MwEthernetContainerPac.class; - LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(), + LOG.debug("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(), mountpointId, interfacePacUuid.getValue()); InstanceIdentifier<EthernetContainerCurrentProblems> mwEthInterfaceIID = InstanceIdentifier @@ -352,7 +352,7 @@ public class WrapperMicrowaveModelRev181010 implements OnfMicrowaveModel, Microw final Class<MwAirInterfaceDiversityPac> clazzPac = MwAirInterfaceDiversityPac.class; final Class<AirInterfaceDiversityCurrentProblems> clazzProblems = AirInterfaceDiversityCurrentProblems.class; - LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(), + LOG.debug("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(), mountpointId, interfacePacUuid.getValue()); InstanceIdentifier<AirInterfaceDiversityCurrentProblems> mwEthInterfaceIID = InstanceIdentifier @@ -386,7 +386,7 @@ public class WrapperMicrowaveModelRev181010 implements OnfMicrowaveModel, Microw final Class<MwPureEthernetStructurePac> clazzPac = MwPureEthernetStructurePac.class; final Class<PureEthernetStructureCurrentProblems> clazzProblems = PureEthernetStructureCurrentProblems.class; - LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(), + LOG.debug("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(), mountpointId, interfacePacUuid.getValue()); InstanceIdentifier<PureEthernetStructureCurrentProblems> mwEthInterfaceIID = InstanceIdentifier @@ -420,7 +420,7 @@ public class WrapperMicrowaveModelRev181010 implements OnfMicrowaveModel, Microw final Class<MwHybridMwStructurePac> clazzPac = MwHybridMwStructurePac.class; final Class<HybridMwStructureCurrentProblems> clazzProblems = HybridMwStructureCurrentProblems.class; - LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(), + LOG.debug("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(), mountpointId, interfacePacUuid.getValue()); InstanceIdentifier<HybridMwStructureCurrentProblems> mwEthInterfaceIID = InstanceIdentifier @@ -462,7 +462,7 @@ public class WrapperMicrowaveModelRev181010 implements OnfMicrowaveModel, Microw final Class<MwTdmContainerPacKey> clazzPacKey = MwTdmContainerPacKey.class; final Class<TdmContainerCurrentProblems> clazzProblems = TdmContainerCurrentProblems.class; - LOG.info("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(), + LOG.debug("DBRead Get problems for class {} from mountpoint {} for uuid {}", clazzPac.getSimpleName(), mountpointId, interfacePacUuid.getValue()); try { @@ -584,8 +584,8 @@ public class WrapperMicrowaveModelRev181010 implements OnfMicrowaveModel, Microw SeverityType severity) { Optional<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType> res = - org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType - .forName(severity.name()); + Optional.ofNullable(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType + .forName(severity.name())); return res.orElse( org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType.NonAlarmed); } diff --git a/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/pm/PerformanceDataAirInterface170324Builder.java b/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/pm/PerformanceDataAirInterface170324Builder.java index 242e100a7..6398c76a8 100644 --- a/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/pm/PerformanceDataAirInterface170324Builder.java +++ b/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/pm/PerformanceDataAirInterface170324Builder.java @@ -17,11 +17,9 @@ package org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.ifpac.microwave.pm; import java.util.Optional; - import org.eclipse.jdt.annotation.NonNull; import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.ifpac.microwave.Helper; import org.onap.ccsdk.features.sdnr.wt.devicemanager.util.InconsistentPMDataException; -import org.onap.ccsdk.features.sdnr.wt.devicemanager.util.PmUtil; import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.logical.termination.point.g.Lp; import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.g._874._1.model.rev170320.OtnHistoryDataG; import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.AirInterfaceHistoricalPerformanceTypeG; @@ -35,103 +33,104 @@ import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology. public class PerformanceDataAirInterface170324Builder extends PmdataEntityBuilder { - private PerformanceDataAirInterface170324Builder(NodeId nodeId, Lp lp, OtnHistoryDataG pmRecord) { - super(); - Optional<GranularityPeriodType> gp = GranularityPeriodType - .forName(Helper.nnGetGranularityPeriodType(pmRecord.getGranularityPeriod()).getName()); - this.setGranularityPeriod(gp.orElse(GranularityPeriodType.Unknown)); - this.setUuidInterface(Helper.nnGetUniversalId(lp.getUuid()).getValue()); - this.setLayerProtocolName(Helper.nnGetLayerProtocolName(lp.getLayerProtocolName()).getValue()); - this.setNodeName(nodeId.getValue()); - this.setScannerId(pmRecord.getHistoryDataId()); - this.setTimeStamp(pmRecord.getPeriodEndTime()); - this.setSuspectIntervalFlag(pmRecord.requireSuspectIntervalFlag()); - } + private PerformanceDataAirInterface170324Builder(NodeId nodeId, Lp lp, OtnHistoryDataG pmRecord) { + super(); + Optional<GranularityPeriodType> gp = Optional.ofNullable(GranularityPeriodType + .forName(Helper.nnGetGranularityPeriodType(pmRecord.getGranularityPeriod()).getName())); + this.setGranularityPeriod(gp.orElse(GranularityPeriodType.Unknown)); + this.setUuidInterface(Helper.nnGetUniversalId(lp.getUuid()).getValue()); + this.setLayerProtocolName(Helper.nnGetLayerProtocolName(lp.getLayerProtocolName()).getValue()); + this.setNodeName(nodeId.getValue()); + this.setScannerId(pmRecord.getHistoryDataId()); + this.setTimeStamp(pmRecord.getPeriodEndTime()); + this.setSuspectIntervalFlag(pmRecord.requireSuspectIntervalFlag()); + } - /** - * Move data to generic type - * - * @param nodeId of node - * @param lp to get data from - * @param pmRecord data itself - * @param airConfiguration configuration for additional parameter - * @throws InconsistentPMDataException - */ - public PerformanceDataAirInterface170324Builder(NodeId nodeId, Lp lp, - AirInterfaceHistoricalPerformanceTypeG pmRecord, AirInterfaceConfiguration airConfiguration) - throws InconsistentPMDataException { - this(nodeId, lp, pmRecord); + /** + * Move data to generic type + * + * @param nodeId of node + * @param lp to get data from + * @param pmRecord data itself + * @param airConfiguration configuration for additional parameter + * @throws InconsistentPMDataException + */ + public PerformanceDataAirInterface170324Builder(NodeId nodeId, Lp lp, + AirInterfaceHistoricalPerformanceTypeG pmRecord, AirInterfaceConfiguration airConfiguration) + throws InconsistentPMDataException { + this(nodeId, lp, pmRecord); - this.setRadioSignalId(airConfiguration.getRadioSignalId()); - @NonNull - PerformanceData pmr = Helper.throwIfPerformanceDataNull(pmRecord.getPerformanceData(), - getUuidInterface(), getLayerProtocolName()); + this.setRadioSignalId(airConfiguration.getRadioSignalId()); + @NonNull + PerformanceData pmr = Helper.throwIfPerformanceDataNull(pmRecord.getPerformanceData(), getUuidInterface(), + getLayerProtocolName()); - PerformanceDataBuilder bPerformanceData = new PerformanceDataBuilder(); - bPerformanceData.setTimePeriod(pmr.getTimePeriod()); - bPerformanceData.setEs(pmr.getEs()); - bPerformanceData.setSes(pmr.getSes()); - bPerformanceData.setCses(pmr.getCses()); - bPerformanceData.setUnavailability(pmr.getUnavailability()); - bPerformanceData.setTxLevelMin(pmr.getTxLevelMin()); - bPerformanceData.setTxLevelMax(pmr.getTxLevelMax()); - bPerformanceData.setTxLevelAvg(pmr.getTxLevelAvg()); - bPerformanceData.setRxLevelMin(pmr.getRxLevelMin()); - bPerformanceData.setRxLevelMax(pmr.getRxLevelMax()); - bPerformanceData.setRxLevelAvg(pmr.getRxLevelAvg()); - bPerformanceData.setTime2States(pmr.getTime2States()); - bPerformanceData.setTime4StatesS(pmr.getTime4StatesS()); - bPerformanceData.setTime4States(pmr.getTime4States()); - bPerformanceData.setTime8States(pmr.getTime8States()); - bPerformanceData.setTime16StatesS(pmr.getTime16StatesS()); - bPerformanceData.setTime16States(pmr.getTime16States()); - bPerformanceData.setTime32States(pmr.getTime32States()); - bPerformanceData.setTime64States(pmr.getTime64States()); - bPerformanceData.setTime128States(pmr.getTime128States()); - bPerformanceData.setTime256States(pmr.getTime256States()); - bPerformanceData.setTime512States(pmr.getTime512States()); - bPerformanceData.setTime512StatesL(pmr.getTime512StatesL()); - bPerformanceData.setTime1024States(pmr.getTime1024States()); - bPerformanceData.setTime1024StatesL(pmr.getTime1024StatesL()); - bPerformanceData.setTime2048States(pmr.getTime2048States()); - bPerformanceData.setTime2048StatesL(pmr.getTime2048StatesL()); - bPerformanceData.setTime4096States(pmr.getTime4096States()); - bPerformanceData.setTime4096StatesL(pmr.getTime4096StatesL()); - bPerformanceData.setTime8192States(pmr.getTime8192States()); - bPerformanceData.setTime8192StatesL(pmr.getTime8192StatesL()); - bPerformanceData.setSnirMin(pmr.getSnirMin()); - bPerformanceData.setSnirMax(pmr.getSnirMax()); - bPerformanceData.setSnirAvg(pmr.getSnirAvg()); - bPerformanceData.setXpdMin(pmr.getXpdMin()); - bPerformanceData.setXpdMax(pmr.getXpdMax()); - bPerformanceData.setXpdAvg(pmr.getXpdAvg()); - bPerformanceData.setRfTempMin(pmr.getRfTempMin()); - bPerformanceData.setRfTempMax(pmr.getRfTempMax()); - bPerformanceData.setRfTempAvg(pmr.getRfTempAvg()); - bPerformanceData.setDefectBlocksSum(pmr.getDefectBlocksSum()); - this.setPerformanceData(bPerformanceData.build()); - } + PerformanceDataBuilder bPerformanceData = new PerformanceDataBuilder(); + bPerformanceData.setTimePeriod(pmr.getTimePeriod()); + bPerformanceData.setEs(pmr.getEs()); + bPerformanceData.setSes(pmr.getSes()); + bPerformanceData.setCses(pmr.getCses()); + bPerformanceData.setUnavailability(pmr.getUnavailability()); + bPerformanceData.setTxLevelMin(pmr.getTxLevelMin()); + bPerformanceData.setTxLevelMax(pmr.getTxLevelMax()); + bPerformanceData.setTxLevelAvg(pmr.getTxLevelAvg()); + bPerformanceData.setRxLevelMin(pmr.getRxLevelMin()); + bPerformanceData.setRxLevelMax(pmr.getRxLevelMax()); + bPerformanceData.setRxLevelAvg(pmr.getRxLevelAvg()); + bPerformanceData.setTime2States(pmr.getTime2States()); + bPerformanceData.setTime4StatesS(pmr.getTime4StatesS()); + bPerformanceData.setTime4States(pmr.getTime4States()); + bPerformanceData.setTime8States(pmr.getTime8States()); + bPerformanceData.setTime16StatesS(pmr.getTime16StatesS()); + bPerformanceData.setTime16States(pmr.getTime16States()); + bPerformanceData.setTime32States(pmr.getTime32States()); + bPerformanceData.setTime64States(pmr.getTime64States()); + bPerformanceData.setTime128States(pmr.getTime128States()); + bPerformanceData.setTime256States(pmr.getTime256States()); + bPerformanceData.setTime512States(pmr.getTime512States()); + bPerformanceData.setTime512StatesL(pmr.getTime512StatesL()); + bPerformanceData.setTime1024States(pmr.getTime1024States()); + bPerformanceData.setTime1024StatesL(pmr.getTime1024StatesL()); + bPerformanceData.setTime2048States(pmr.getTime2048States()); + bPerformanceData.setTime2048StatesL(pmr.getTime2048StatesL()); + bPerformanceData.setTime4096States(pmr.getTime4096States()); + bPerformanceData.setTime4096StatesL(pmr.getTime4096StatesL()); + bPerformanceData.setTime8192States(pmr.getTime8192States()); + bPerformanceData.setTime8192StatesL(pmr.getTime8192StatesL()); + bPerformanceData.setSnirMin(pmr.getSnirMin()); + bPerformanceData.setSnirMax(pmr.getSnirMax()); + bPerformanceData.setSnirAvg(pmr.getSnirAvg()); + bPerformanceData.setXpdMin(pmr.getXpdMin()); + bPerformanceData.setXpdMax(pmr.getXpdMax()); + bPerformanceData.setXpdAvg(pmr.getXpdAvg()); + bPerformanceData.setRfTempMin(pmr.getRfTempMin()); + bPerformanceData.setRfTempMax(pmr.getRfTempMax()); + bPerformanceData.setRfTempAvg(pmr.getRfTempAvg()); + bPerformanceData.setDefectBlocksSum(pmr.getDefectBlocksSum()); + this.setPerformanceData(bPerformanceData.build()); + } - /** - * Move data to generic type - * - * @param nodeId of node - * @param lp to get data from - * @param pmRecord data itself - * @throws InconsistentPMDataException - */ - public PerformanceDataAirInterface170324Builder(NodeId nodeId, Lp lp, ContainerHistoricalPerformanceTypeG pmRecord) - throws InconsistentPMDataException { - this(nodeId, lp, (OtnHistoryDataG) pmRecord); - org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.container.historical.performance.type.g.@NonNull PerformanceData pmr = Helper - .throwIfPerformanceDataNull(pmRecord.getPerformanceData(), getUuidInterface(), getLayerProtocolName()); + /** + * Move data to generic type + * + * @param nodeId of node + * @param lp to get data from + * @param pmRecord data itself + * @throws InconsistentPMDataException + */ + public PerformanceDataAirInterface170324Builder(NodeId nodeId, Lp lp, ContainerHistoricalPerformanceTypeG pmRecord) + throws InconsistentPMDataException { + this(nodeId, lp, (OtnHistoryDataG) pmRecord); + org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.container.historical.performance.type.g.@NonNull PerformanceData pmr = + Helper.throwIfPerformanceDataNull(pmRecord.getPerformanceData(), getUuidInterface(), + getLayerProtocolName()); - PerformanceDataBuilder bPerformanceData = new PerformanceDataBuilder(); - bPerformanceData.setTimePeriod(pmr.getTimePeriod()); - bPerformanceData.setTxEthernetBytesMaxM(pmr.getTxEthernetBytesMaxM()); - bPerformanceData.setTxEthernetBytesMaxS(pmr.getTxEthernetBytesMaxS()); - bPerformanceData.setTxEthernetBytesSum(pmr.getTxEthernetBytesSum()); - this.setPerformanceData(bPerformanceData.build()); - } + PerformanceDataBuilder bPerformanceData = new PerformanceDataBuilder(); + bPerformanceData.setTimePeriod(pmr.getTimePeriod()); + bPerformanceData.setTxEthernetBytesMaxM(pmr.getTxEthernetBytesMaxM()); + bPerformanceData.setTxEthernetBytesMaxS(pmr.getTxEthernetBytesMaxS()); + bPerformanceData.setTxEthernetBytesSum(pmr.getTxEthernetBytesSum()); + this.setPerformanceData(bPerformanceData.build()); + } } diff --git a/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/pm/PerformanceDataAirInterface180907Builder.java b/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/pm/PerformanceDataAirInterface180907Builder.java index 7faca3c06..db1b7208a 100644 --- a/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/pm/PerformanceDataAirInterface180907Builder.java +++ b/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/pm/PerformanceDataAirInterface180907Builder.java @@ -38,8 +38,8 @@ public class PerformanceDataAirInterface180907Builder extends PmdataEntityBuilde private PerformanceDataAirInterface180907Builder(NodeId nodeId, Lp lp, OtnHistoryDataG pmRecord) { super(); - Optional<GranularityPeriodType> gp = GranularityPeriodType - .forName(Helper.nnGetGranularityPeriodType(pmRecord.getGranularityPeriod()).getName()); + Optional<GranularityPeriodType> gp = Optional.ofNullable(GranularityPeriodType + .forName(Helper.nnGetGranularityPeriodType(pmRecord.getGranularityPeriod()).getName())); this.setGranularityPeriod(gp.orElse(GranularityPeriodType.Unknown)); this.setUuidInterface(Helper.nnGetUniversalId(lp.getUuid()).getValue()); this.setLayerProtocolName(Helper.nnGetLayerProtocolName(lp.getLayerProtocolName()).getValue()); diff --git a/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/pm/PerformanceDataAirInterface181010Builder.java b/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/pm/PerformanceDataAirInterface181010Builder.java index 6b42bd2d3..e2b519507 100644 --- a/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/pm/PerformanceDataAirInterface181010Builder.java +++ b/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ifpac/microwave/pm/PerformanceDataAirInterface181010Builder.java @@ -38,8 +38,8 @@ public class PerformanceDataAirInterface181010Builder extends PmdataEntityBuilde private PerformanceDataAirInterface181010Builder(NodeId nodeId, Lp lp, OtnHistoryDataG pmRecord) { super(); - Optional<GranularityPeriodType> gp = GranularityPeriodType - .forName(Helper.nnGetGranularityPeriodType(pmRecord.getGranularityPeriod()).getName()); + Optional<GranularityPeriodType> gp = Optional.ofNullable(GranularityPeriodType + .forName(Helper.nnGetGranularityPeriodType(pmRecord.getGranularityPeriod()).getName())); this.setGranularityPeriod(gp.orElse(GranularityPeriodType.Unknown)); this.setUuidInterface(Helper.nnGetUniversalId(lp.getUuid()).getValue()); this.setLayerProtocolName(Helper.nnGetLayerProtocolName(lp.getLayerProtocolName()).getValue()); diff --git a/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElement12Base.java b/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElement12Base.java index 8c593038b..00f979125 100644 --- a/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElement12Base.java +++ b/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElement12Base.java @@ -288,7 +288,7 @@ public abstract class ONFCoreNetworkElement12Base extends ONFCoreNetworkElementB */ protected FaultData readNetworkElementCurrentProblems12(FaultData resultList) { - LOG.info("DBRead Get {} NetworkElementCurrentProblems12", getMountpoint()); + LOG.debug("DBRead Get {} NetworkElementCurrentProblems12", getMountpoint()); InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.onf.core.model.conditional.packages.rev170402.NetworkElementPac> networkElementCurrentProblemsIID = InstanceIdentifier.builder( diff --git a/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElement12Basic.java b/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElement12Basic.java index da9b45fd3..c58289f28 100644 --- a/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElement12Basic.java +++ b/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElement12Basic.java @@ -112,7 +112,7 @@ public class ONFCoreNetworkElement12Basic extends ONFCoreNetworkElement12Base { int problems = faultService.removeAllCurrentProblemsOfNode(nodeId); FaultData resultList = readAllCurrentProblemsOfNode(); faultService.initCurrentProblemStatus(nodeId, resultList); - LOG.info("Resync mountpoint {} for device {}. Removed {}. Current problems: {}", getMountpoint(), + LOG.debug("Resync mountpoint {} for device {}. Removed {}. Current problems: {}", getMountpoint(), getUuId(), problems, resultList.size()); } } @@ -163,7 +163,7 @@ public class ONFCoreNetworkElement12Basic extends ONFCoreNetworkElement12Base { equipmentService.writeEquipment(nodeId, equipment.getEquipmentData()); - LOG.info("Found info at {} for device {} number of problems: {}", getMountpoint(), getUuId(), + LOG.debug("Found info at {} for device {} number of problems: {}", getMountpoint(), getUuId(), resultList.size()); } diff --git a/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElement12Microwave.java b/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElement12Microwave.java index 766ebdd23..1e6264b94 100644 --- a/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElement12Microwave.java +++ b/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElement12Microwave.java @@ -119,7 +119,7 @@ public class ONFCoreNetworkElement12Microwave extends ONFCoreNetworkElement12Bas int problems = microwaveEventListener.removeAllCurrentProblemsOfNode(nodeId); FaultData resultList = readAllCurrentProblemsOfNode(); microwaveEventListener.initCurrentProblemStatus(nodeId, resultList); - LOG.info("Resync mountpoint {} for device {}. Removed {}. Current problems: {}", getMountpoint(), + LOG.debug("Resync mountpoint {} for device {}. Removed {}. Current problems: {}", getMountpoint(), getUuId(), problems, resultList.size()); } } @@ -218,7 +218,7 @@ public class ONFCoreNetworkElement12Microwave extends ONFCoreNetworkElement12Bas LOG.debug("DB write current problems completed"); equipmentService.writeEquipment(nodeId, equipment.getEquipmentData()); - LOG.info("Found info at {} for device {} number of problems: {}", getMountpoint(), getUuId(), + LOG.debug("Found info at {} for device {} number of problems: {}", getMountpoint(), getUuId(), resultList.size()); } @@ -321,7 +321,7 @@ public class ONFCoreNetworkElement12Microwave extends ONFCoreNetworkElement12Bas // QName qName = // org.opendaylight.yangtools.yang.common.QName.create("urn:onf:params:xml:ns:yang:microwave-model", // "2017-03-24", "mw-air-interface-pac").intern(); - LOG.info("LpExtension capability={} revision={} conditionalPackage={}", capability, revision, + LOG.debug("LpExtension capability={} revision={} conditionalPackage={}", capability, revision, conditionalPackage); if (capability != null && !capability.isEmpty() && !revision.isEmpty() && !conditionalPackage.isEmpty()) { try { @@ -377,7 +377,7 @@ public class ONFCoreNetworkElement12Microwave extends ONFCoreNetworkElement12Bas */ @Override public void doRegisterEventListener(MountPoint mountPoint) { - LOG.info("Begin registration listener for Mountpoint"); + LOG.debug("Begin registration listener for Mountpoint"); final Optional<NotificationService> optionalNotificationService = mountPoint.getService(NotificationService.class); if (optionalNotificationService.isPresent()) { @@ -385,7 +385,7 @@ public class ONFCoreNetworkElement12Microwave extends ONFCoreNetworkElement12Bas // notificationService.registerNotificationListener(microwaveEventListener); listenerRegistrationresult = notificationService.registerNotificationListener(microwaveModel.getNotificationListener()); - LOG.info("End registration listener for Mountpoint Result: {}", listenerRegistrationresult); + LOG.debug("End registration listener for Mountpoint Result: {}", listenerRegistrationresult); } else { LOG.error("Could not get NotificationService, hence microwave notification listener not registered"); } diff --git a/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElementBase.java b/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElementBase.java index 318741dd9..8195772a8 100644 --- a/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElementBase.java +++ b/sdnr/wt/devicemanager-onap/onf12/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/onf/ne/ONFCoreNetworkElementBase.java @@ -46,7 +46,7 @@ public abstract class ONFCoreNetworkElementBase implements AutoCloseable, ONFCor private final NetconfBindingAccessor acessor; protected ONFCoreNetworkElementBase(NetconfBindingAccessor acessor) { - LOG.info("Create ONFCoreNetworkElementBase"); + LOG.debug("Create ONFCoreNetworkElementBase"); this.mountPointNodeName = acessor.getNodeId().getValue(); this.nodeId = acessor.getNodeId(); this.netconfNodeDataBroker = acessor.getDataBroker(); diff --git a/sdnr/wt/devicemanager-onap/onf14/feature/pom.xml b/sdnr/wt/devicemanager-onap/onf14/feature/pom.xml index 33d317eb8..c7a6656a2 100644 --- a/sdnr/wt/devicemanager-onap/onf14/feature/pom.xml +++ b/sdnr/wt/devicemanager-onap/onf14/feature/pom.xml @@ -28,7 +28,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>single-feature-parent</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/devicemanager-onap/onf14/installer/pom.xml b/sdnr/wt/devicemanager-onap/onf14/installer/pom.xml index cb67c9f0f..932c235ea 100755 --- a/sdnr/wt/devicemanager-onap/onf14/installer/pom.xml +++ b/sdnr/wt/devicemanager-onap/onf14/installer/pom.xml @@ -28,7 +28,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>odlparent-lite</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/devicemanager-onap/onf14/model/pom.xml b/sdnr/wt/devicemanager-onap/onf14/model/pom.xml index 7134ac537..d4bf517c4 100644 --- a/sdnr/wt/devicemanager-onap/onf14/model/pom.xml +++ b/sdnr/wt/devicemanager-onap/onf14/model/pom.xml @@ -28,7 +28,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>binding-parent</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/devicemanager-onap/onf14/pom.xml b/sdnr/wt/devicemanager-onap/onf14/pom.xml index 8b462cea4..74f42ee80 100755 --- a/sdnr/wt/devicemanager-onap/onf14/pom.xml +++ b/sdnr/wt/devicemanager-onap/onf14/pom.xml @@ -28,7 +28,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>odlparent-lite</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/devicemanager-onap/onf14/provider/pom.xml b/sdnr/wt/devicemanager-onap/onf14/provider/pom.xml index 0afacc4bc..a9282756f 100644 --- a/sdnr/wt/devicemanager-onap/onf14/provider/pom.xml +++ b/sdnr/wt/devicemanager-onap/onf14/provider/pom.xml @@ -28,7 +28,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>binding-parent</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/devicemanager-onap/openroadm/feature/pom.xml b/sdnr/wt/devicemanager-onap/openroadm/feature/pom.xml index 7d58d040c..0af0f904c 100644 --- a/sdnr/wt/devicemanager-onap/openroadm/feature/pom.xml +++ b/sdnr/wt/devicemanager-onap/openroadm/feature/pom.xml @@ -20,13 +20,14 @@ ~ ============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>single-feature-parent</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/devicemanager-onap/openroadm/installer/pom.xml b/sdnr/wt/devicemanager-onap/openroadm/installer/pom.xml index 5863cac55..256774a60 100755 --- a/sdnr/wt/devicemanager-onap/openroadm/installer/pom.xml +++ b/sdnr/wt/devicemanager-onap/openroadm/installer/pom.xml @@ -26,7 +26,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>odlparent-lite</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/devicemanager-onap/openroadm/model/pom.xml b/sdnr/wt/devicemanager-onap/openroadm/model/pom.xml index 70a17f527..788a3a301 100644 --- a/sdnr/wt/devicemanager-onap/openroadm/model/pom.xml +++ b/sdnr/wt/devicemanager-onap/openroadm/model/pom.xml @@ -20,13 +20,14 @@ ~ ============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.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/devicemanager-onap/openroadm/pom.xml b/sdnr/wt/devicemanager-onap/openroadm/pom.xml index ef2680984..09913a114 100755 --- a/sdnr/wt/devicemanager-onap/openroadm/pom.xml +++ b/sdnr/wt/devicemanager-onap/openroadm/pom.xml @@ -20,13 +20,14 @@ ~ ============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>odlparent-lite</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/devicemanager-onap/openroadm/provider/pom.xml b/sdnr/wt/devicemanager-onap/openroadm/provider/pom.xml index afc4dc7c3..a017c5676 100644 --- a/sdnr/wt/devicemanager-onap/openroadm/provider/pom.xml +++ b/sdnr/wt/devicemanager-onap/openroadm/provider/pom.xml @@ -20,13 +20,14 @@ ~ ============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.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> @@ -52,11 +53,6 @@ <dependencies> <dependency> <groupId>${project.groupId}</groupId> - <artifactId>ietf-alarms</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>${project.groupId}</groupId> <artifactId>sdnr-wt-devicemanager-onap-openroadm-model</artifactId> <version>${project.version}</version> </dependency> @@ -112,6 +108,13 @@ <groupId>net.bytebuddy</groupId> <scope>test</scope> </dependency> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>sdnr-wt-yang-utils</artifactId> + <version>${project.version}</version> + <scope>provided</scope> + </dependency> + <!-- end for testing --> </dependencies> diff --git a/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/InitialDeviceAlarmReader.java b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/InitialDeviceAlarmReader.java index 6472e6653..6fba55b55 100644 --- a/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/InitialDeviceAlarmReader.java +++ b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/InitialDeviceAlarmReader.java @@ -103,7 +103,7 @@ public class InitialDeviceAlarmReader { // Mapping Severity of AlarmNotification to SeverityType of FaultLog protected static SeverityType checkSeverityValue(Severity severity) { SeverityType severityType = null; - log.info("Device Severity: {}", severity.getName()); + log.debug("Device Severity: {}", severity.getName()); switch (severity.getName()) { case ("warning"): @@ -139,13 +139,13 @@ public class InitialDeviceAlarmReader { // Read Alarm Data private ActiveAlarmList getActiveAlarmList(NetconfBindingAccessor accessor) { final Class<ActiveAlarmList> classAlarm = ActiveAlarmList.class; - log.info("Get Alarm data for element {}", accessor.getNodeId().getValue()); + log.debug("Get Alarm data for element {}", accessor.getNodeId().getValue()); InstanceIdentifier<ActiveAlarmList> alarmDataIid = InstanceIdentifier.builder(classAlarm).build(); ActiveAlarmList alarmData = accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, alarmDataIid); - log.info("AlarmData {}", alarmData); + log.debug("AlarmData {}", alarmData); return alarmData; } diff --git a/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/OpenroadmDeviceChangeNotificationListener.java b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/OpenroadmDeviceChangeNotificationListener.java index a39e62ce1..582518e0b 100644 --- a/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/OpenroadmDeviceChangeNotificationListener.java +++ b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/OpenroadmDeviceChangeNotificationListener.java @@ -75,7 +75,7 @@ public class OpenroadmDeviceChangeNotificationListener implements OrgOpenroadmDe @Override public void onChangeNotification(ChangeNotification notification) { - log.info("onDeviceConfigChange(1){}", notification); + log.debug("onDeviceConfigChange(1){}", notification); StringBuffer sb = new StringBuffer(); @NonNull @@ -89,9 +89,9 @@ public class OpenroadmDeviceChangeNotificationListener implements OrgOpenroadmDe InstanceIdentifier<?> target = edit.getTarget(); if (target != null) { eventlogBuilder.setObjectId(target.getPathArguments().toString()); - log.info("TARGET: {} {}", target.getClass(), target.getTargetType()); + log.debug("TARGET: {} {}", target.getClass(), target.getTargetType()); for (PathArgument pa : target.getPathArguments()) { - log.info("PathArgument {}", pa); + log.debug("PathArgument {}", pa); } eventlogBuilder.setAttributeName(target.getTargetType().getName()); } @@ -101,7 +101,7 @@ public class OpenroadmDeviceChangeNotificationListener implements OrgOpenroadmDe eventlogBuilder.setCounter(counter); eventlogBuilder.setSourceType(SourceType.Netconf); databaseProvider.writeEventLog(eventlogBuilder.build()); - log.info("onDeviceConfigChange (2) {}", sb); + log.debug("onDeviceConfigChange (2) {}", sb); counter++; } this.notificationServiceService.sendNotification(notification, this.netconfAccessor.getNodeId(), @@ -112,7 +112,7 @@ public class OpenroadmDeviceChangeNotificationListener implements OrgOpenroadmDe public void onCreateTechInfoNotification(CreateTechInfoNotification notification) { DateAndTime now = NetconfTimeStampImpl.getConverter().getTimeStamp(); - log.info("onCreateTechInfoNotification(1){}", notification); + log.debug("onCreateTechInfoNotification(1){}", notification); EventlogBuilder eventlogBuilder = new EventlogBuilder(); eventlogBuilder.setId(notification.getShelfId()).setAttributeName(notification.getShelfId()) .setObjectId(notification.getShelfId()).setNodeId(this.netconfAccessor.getNodeId().getValue()) @@ -121,7 +121,7 @@ public class OpenroadmDeviceChangeNotificationListener implements OrgOpenroadmDe databaseProvider.writeEventLog(eventlogBuilder.build()); this.notificationServiceService.sendNotification(notification, this.netconfAccessor.getNodeId(), CreateTechInfoNotification.QNAME, now); - log.info("Create-techInfo Notification written "); + log.debug("Create-techInfo Notification written "); counter++; } // end of public methods diff --git a/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/OpenroadmFaultNotificationListener.java b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/OpenroadmFaultNotificationListener.java index 23bb24cd9..865edcbbc 100644 --- a/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/OpenroadmFaultNotificationListener.java +++ b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/OpenroadmFaultNotificationListener.java @@ -80,7 +80,7 @@ public class OpenroadmFaultNotificationListener implements OrgOpenroadmAlarmList @Override public void onAlarmNotification(AlarmNotification notification) { - log.info("AlarmNotification is {} \t {}", notification.getId(), notification.getAdditionalDetail()); + log.debug("AlarmNotification is {} \t {}", notification.getId(), notification.getAdditionalDetail()); String affectedResourceName = getAffectedResourceName(notification.getResource().getResource().getResource()); String probableCauseName = getProbableCauseName(notification.getProbableCause()); @@ -98,7 +98,7 @@ public class OpenroadmFaultNotificationListener implements OrgOpenroadmAlarmList this.notificationService.sendNotification(notification,new NodeId(netconfAccessor.getNodeId().getValue()), AlarmNotification.QNAME, notification.getRaiseTime()); count++; - log.info("Notification is written into the database {}", faultAlarm.getObjectId()); + log.debug("Notification is written into the database {}", faultAlarm.getObjectId()); } diff --git a/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/OpenroadmInventoryInput.java b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/OpenroadmInventoryInput.java index abaec72ab..416cf7e6d 100644 --- a/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/OpenroadmInventoryInput.java +++ b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/OpenroadmInventoryInput.java @@ -56,7 +56,7 @@ public class OpenroadmInventoryInput { // public methods public Inventory getInventoryData(Uint32 treeLevel) { InventoryBuilder inventoryBuilder = new InventoryBuilder(); - log.info("Info for device {}", this.openRoadmDevice.getInfo().getNodeId().getValue()); + log.debug("Info for device {}", this.openRoadmDevice.getInfo().getNodeId().getValue()); inventoryBuilder.setNodeId(this.accessor.getNodeId().getValue()) .setUuid(this.openRoadmDevice.getInfo().getNodeId() == null ? "N/A" : this.openRoadmDevice.getInfo().getNodeId().getValue()) @@ -68,13 +68,14 @@ public class OpenroadmInventoryInput { .setVersion(this.openRoadmDevice.getInfo().getOpenroadmVersion().getName()) .setDescription("org-openroadm-device").setParentUuid("None") .setTypeName(this.openRoadmDevice.getInfo().getNodeType().getName()).setPartTypeId("device"); - log.info("Inventory data written for device {}", this.openRoadmDevice.getInfo().getNodeId().getValue()); + log.debug("Inventory data written for device {}", this.openRoadmDevice.getInfo().getNodeId().getValue()); return inventoryBuilder.build(); } public Inventory getShelvesInventory(Shelves shelf, Uint32 treeLevel) { InventoryBuilder inventoryBuilder = new InventoryBuilder(); - inventoryBuilder.setNodeId(this.accessor.getNodeId().getValue()).setId(shelf.getShelfName()) + inventoryBuilder.setNodeId(this.accessor.getNodeId().getValue()) + .setId(this.accessor.getNodeId().getValue() + "/" + shelf.getShelfName()) .setDescription((shelf.getUserDescription() == null) ? ("Position: " + shelf.getShelfPosition() + "\nState: " + shelf.getOperationalState()) : (shelf.getUserDescription()) + "\nPosition: " + shelf.getShelfPosition() + "\nState: " @@ -84,13 +85,14 @@ public class OpenroadmInventoryInput { .setTypeName(shelf.getShelfType()).setPartTypeId(shelf.getClei()) .setManufacturerIdentifier(shelf.getVendor()).setModelIdentifier(shelf.getModel()) .setVersion(shelf.getHardwareVersion()).setDate(shelf.getManufactureDate().getValue()); - log.info("Inventory data written for Shelf {}", shelf.getShelfName()); + log.debug("Inventory data written for Shelf {}", shelf.getShelfName()); return inventoryBuilder.build(); } public Inventory getInterfacesInventory(Interface deviceInterface, Uint32 treeLevel) { InventoryBuilder inventoryBuilder = new InventoryBuilder(); - inventoryBuilder.setNodeId(this.accessor.getNodeId().getValue()).setId(deviceInterface.getName()) + inventoryBuilder.setNodeId(this.accessor.getNodeId().getValue()) + .setId(this.accessor.getNodeId().getValue() + "/" + deviceInterface.getName()) .setDescription((deviceInterface.getDescription() == null) ? "N/A" : deviceInterface.getDescription()) .setUuid(deviceInterface.getName()).setSerial(deviceInterface.getName()) .setParentUuid((deviceInterface.getSupportingCircuitPackName() != null) @@ -99,12 +101,11 @@ public class OpenroadmInventoryInput { : this.openRoadmDevice.getInfo().getNodeId().getValue())) .setTreeLevel(treeLevel) .setTypeName((deviceInterface.getType() == null) ? "Interface" - : deviceInterface.getType().getName().substring(69, - deviceInterface.getType().getName().length())) + : deviceInterface.getType().getClass().getSimpleName()) .setPartTypeId("Interface").setManufacturerIdentifier(this.openRoadmDevice.getInfo().getVendor()) .setModelIdentifier(this.openRoadmDevice.getInfo().getModel()).setVersion("N/A") .setDate(this.openRoadmDevice.getInfo().getCurrentDatetime().getValue()); - log.info("Inventory data written for Interface {}", deviceInterface.getName()); + log.debug("Inventory data written for Interface {}", deviceInterface.getName()); return inventoryBuilder.build(); } @@ -114,8 +115,9 @@ public class OpenroadmInventoryInput { inventoryBuilder.setNodeId(this.accessor.getNodeId().getValue()).setUuid(circuitPack.getCircuitPackName()) .setDate((circuitPack.getManufactureDate() == null) ? "N/A" : circuitPack.getManufactureDate().getValue().substring(0, 19)) - .setId(circuitPack.getCircuitPackName()).setManufacturerIdentifier(circuitPack.getVendor()) - .setModelIdentifier(circuitPack.getModel()).setSerial(circuitPack.getSerialId()).setTreeLevel(treeLevel) + .setId(this.accessor.getNodeId().getValue() + "/" + circuitPack.getCircuitPackName()) + .setManufacturerIdentifier(circuitPack.getVendor()).setModelIdentifier(circuitPack.getModel()) + .setSerial(circuitPack.getSerialId()).setTreeLevel(treeLevel) .setVersion(circuitPack.getHardwareVersion()) .setDescription("ProductCode: " + circuitPack.getProductCode() + " " + "Mode: " + circuitPack.getCircuitPackMode()) @@ -125,14 +127,15 @@ public class OpenroadmInventoryInput { ? circuitPack.getParentCircuitPack().getCircuitPackName() : ((circuitPack.getShelf() != null) ? circuitPack.getShelf() : this.openRoadmDevice.getInfo().getNodeId().getValue())); - log.info("Inventory data written for CircuitPack {}", circuitPack.getCircuitPackName()); + log.debug("Inventory data written for CircuitPack {}", circuitPack.getCircuitPackName()); return inventoryBuilder.build(); } public Inventory getXponderInventory(Xponder xpdr, Uint32 treeLevel) { InventoryBuilder inventoryBuilder = new InventoryBuilder(); - inventoryBuilder.setNodeId(this.accessor.getNodeId().getValue()).setId(xpdr.getXpdrNumber().toString()) + inventoryBuilder.setNodeId(this.accessor.getNodeId().getValue()) + .setId(this.accessor.getNodeId().getValue() + "/" + xpdr.getXpdrNumber().toString()) .setDescription("Xponder\nLifecycleState: " + xpdr.getLifecycleState().getName()) .setUuid(xpdr.getXpdrNumber().toString()).setSerial(xpdr.getXpdrNumber().toString()) .setParentUuid(this.openRoadmDevice.getInfo().getNodeId().getValue()).setTreeLevel(treeLevel) @@ -141,7 +144,7 @@ public class OpenroadmInventoryInput { .setModelIdentifier(this.openRoadmDevice.getInfo().getModel()) .setVersion(this.openRoadmDevice.getInfo().getOpenroadmVersion().getName()) .setDate(this.openRoadmDevice.getInfo().getCurrentDatetime().getValue()); - log.info("Inventory data written for Xponder{}", xpdr.getXpdrNumber()); + log.debug("Inventory data written for Xponder{}", xpdr.getXpdrNumber()); return inventoryBuilder.build(); } diff --git a/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/OpenroadmNetworkElement.java b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/OpenroadmNetworkElement.java index 996ff69e7..4cbecc29a 100644 --- a/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/OpenroadmNetworkElement.java +++ b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/OpenroadmNetworkElement.java @@ -85,7 +85,7 @@ public class OpenroadmNetworkElement extends OpenroadmNetworkElementBase { super(netconfAccess, serviceProvider); - log.info("Create {}", OpenroadmNetworkElement.class.getSimpleName()); + log.debug("Create {}", OpenroadmNetworkElement.class.getSimpleName()); this.openRdmListenerRegistrationResult = null; this.openRdmListener = new OpenroadmChangeNotificationListener(netconfAccessor, databaseService, serviceProvider.getWebsocketService()); @@ -98,7 +98,7 @@ public class OpenroadmNetworkElement extends OpenroadmNetworkElementBase { this.shelfProvisionedcircuitPacks = new Hashtable<>(); this.openRoadmPmData = new PmDataBuilderOpenRoadm(this.netconfAccessor); this.initialAlarmReader = new InitialDeviceAlarmReader(this.netconfAccessor, serviceProvider); - log.info("NodeId {}", this.netconfAccessor.getNodeId().getValue()); + log.debug("NodeId {}", this.netconfAccessor.getNodeId().getValue()); } @@ -110,7 +110,7 @@ public class OpenroadmNetworkElement extends OpenroadmNetworkElementBase { OrgOpenroadmDevice device = readDevice(this.netconfAccessor); if (device != null) { this.opnRdmInventoryInput = new OpenroadmInventoryInput(this.netconfAccessor, device); - log.info("openroadmMapper details{}", this.opnRdmInventoryInput.getClass().getName()); + log.debug("openroadmMapper details{}", this.opnRdmInventoryInput.getClass().getName()); List<Inventory> inventoryList = new ArrayList<>(); inventoryList.add(this.opnRdmInventoryInput.getInventoryData(Uint32.valueOf(equipmentLevel))); readShelvesData(inventoryList, device); @@ -126,12 +126,12 @@ public class OpenroadmNetworkElement extends OpenroadmNetworkElementBase { pmDataEntity = this.openRoadmPmData.buildPmDataEntity(this.openRoadmPmData.getPmData(this.netconfAccessor)); if (!pmDataEntity.isEmpty()) { this.databaseService.doWritePerformanceData(pmDataEntity); - log.info("PmDatEntity is written with size {}", pmDataEntity.size()); + log.debug("PmDatEntity is written with size {}", pmDataEntity.size()); for (PmdataEntity ent : pmDataEntity) { - log.info("GetNode: {}, granPeriod: {}", ent.getNodeName(), ent.getGranularityPeriod().getName()); + log.debug("GetNode: {}, granPeriod: {}", ent.getNodeName(), ent.getGranularityPeriod().getName()); } } else { - log.info("PmDatEntity is empty"); + log.debug("PmDatEntity is empty"); } } @@ -169,7 +169,7 @@ public class OpenroadmNetworkElement extends OpenroadmNetworkElementBase { Collection<Shelves> shelves = YangHelper.getCollection(device.getShelves()); if (shelves != null) { for (Shelves shelf : shelves) { - log.info( + log.debug( "Shelf Name: {}, \n Serial Id:{}, \n Product Code;{}, \n Position:{}, \n EquipmetState: {}, \n Hardware version: {}" + "\n ShelfType:{}, \n Vendor: {}, \n LifecycleState: {} ", shelf.getShelfName(), shelf.getSerialId(), shelf.getProductCode(), shelf.getShelfPosition(), @@ -183,13 +183,13 @@ public class OpenroadmNetworkElement extends OpenroadmNetworkElementBase { if (slot.getProvisionedCircuitPack() != null) { this.shelfProvisionedcircuitPacks.put(slot.getProvisionedCircuitPack(), equipmentLevel + 2); } - log.info("Slots for the shelf: {}", shelf.getShelfName()); - log.info("\n Slot Name: {}, \n Status: {}, \n Slot label: {} ", slot.getSlotName(), + log.debug("Slots for the shelf: {}", shelf.getShelfName()); + log.debug("\n Slot Name: {}, \n Status: {}, \n Slot label: {} ", slot.getSlotName(), slot.getSlotStatus(), slot.getLabel()); } } } - log.info("size of shelfProvisionedcircuitPacks: {} ", shelfProvisionedcircuitPacks.size()); + log.debug("size of shelfProvisionedcircuitPacks: {} ", shelfProvisionedcircuitPacks.size()); } } @@ -202,14 +202,14 @@ public class OpenroadmNetworkElement extends OpenroadmNetworkElementBase { inventoryList.add( this.opnRdmInventoryInput.getXponderInventory(xponder, Uint32.valueOf(equipmentLevel + 1))); - log.info("Xponders: No.: {} , \n Port: {} ,\n Type: {}", xponder.getXpdrNumber(), xponder.getXpdrPort(), + log.debug("Xponders: No.: {} , \n Port: {} ,\n Type: {}", xponder.getXpdrNumber(), xponder.getXpdrPort(), xponder.getXpdrType()); Collection<XpdrPort> xpdrportlist = YangHelper.getCollection(xponder.getXpdrPort()); if (xpdrportlist != null) { for (XpdrPort xpdrport : xpdrportlist) if (xpdrport.getCircuitPackName() != null) { this.shelfProvisionedcircuitPacks.put(xpdrport.getCircuitPackName(), equipmentLevel + 2); - log.info("Size of dict{}", this.shelfProvisionedcircuitPacks.size()); + log.debug("Size of dict{}", this.shelfProvisionedcircuitPacks.size()); } } @@ -228,11 +228,11 @@ public class OpenroadmNetworkElement extends OpenroadmNetworkElementBase { } for (CircuitPacks cp : circuitpackCollection) { - log.info("CP Name:{}", cp.getCircuitPackName()); + log.debug("CP Name:{}", cp.getCircuitPackName()); if (cp.getParentCircuitPack() == null && !this.shelfProvisionedcircuitPacks.containsKey(cp.getCircuitPackName())) { - log.info("cp has no parent and no shelf"); + log.debug("cp has no parent and no shelf"); this.circuitPacksRecord.put(cp.getCircuitPackName(), (equipmentLevel + 1)); inventoryList.add( this.opnRdmInventoryInput.getCircuitPackInventory(cp, Uint32.valueOf(equipmentLevel + 1))); @@ -241,7 +241,7 @@ public class OpenroadmNetworkElement extends OpenroadmNetworkElementBase { if (cp.getParentCircuitPack().getCpSlotName() != null && cp.getParentCircuitPack().getCircuitPackName() == null) { - log.info("Cp {} has slotname of the parent circuit pack but no parent circuit pack name", + log.debug("Cp {} has slotname of the parent circuit pack but no parent circuit pack name", cp.getCircuitPackName()); this.circuitPacksRecord.put(cp.getCircuitPackName(), (equipmentLevel + 3)); inventoryList.add(this.opnRdmInventoryInput.getCircuitPackInventory(cp, @@ -253,7 +253,7 @@ public class OpenroadmNetworkElement extends OpenroadmNetworkElementBase { } else if (cp.getParentCircuitPack().getCircuitPackName() != null && this.shelfProvisionedcircuitPacks .containsKey(cp.getParentCircuitPack().getCircuitPackName())) { - log.info("Cp {} has parent circuit pack and shelf", cp.getCircuitPackName()); + log.debug("Cp {} has parent circuit pack and shelf", cp.getCircuitPackName()); this.circuitPacksRecord.put(cp.getCircuitPackName(), (equipmentLevel + 3)); inventoryList.add(this.opnRdmInventoryInput.getCircuitPackInventory(cp, Uint32.valueOf(equipmentLevel + 3))); @@ -266,7 +266,7 @@ public class OpenroadmNetworkElement extends OpenroadmNetworkElementBase { .setId(cp.getParentCircuitPack().getCpSlotName()).build()); } - log.info("Cp has parent circuit pack but no shelf or a shelf but no parent circuit pack"); + log.debug("Cp has parent circuit pack but no shelf or a shelf but no parent circuit pack"); this.circuitPacksRecord.put(cp.getCircuitPackName(), (equipmentLevel + 2)); inventoryList.add(this.opnRdmInventoryInput.getCircuitPackInventory(cp, Uint32.valueOf(equipmentLevel + 2))); @@ -282,12 +282,12 @@ public class OpenroadmNetworkElement extends OpenroadmNetworkElementBase { Collection<Interface> interfaceList = YangHelper.getCollection(device.getInterface()); if (interfaceList != null) { for (Interface deviceInterface : interfaceList) { - log.info("\n InterfaceName: {}", deviceInterface.getName()); - log.info("Supporting CP {}", this.circuitPacksRecord.size()); + log.debug("\n InterfaceName: {}", deviceInterface.getName()); + log.debug("Supporting CP {}", this.circuitPacksRecord.size()); for (String s : this.circuitPacksRecord.keySet()) { - log.info("{} value {}", s, this.circuitPacksRecord.get(s)); + log.debug("{} value {}", s, this.circuitPacksRecord.get(s)); } - log.info("Interface {} and their supporting CP {}", deviceInterface.getName(), + log.debug("Interface {} and their supporting CP {}", deviceInterface.getName(), deviceInterface.getSupportingCircuitPackName()); if (deviceInterface.getSupportingCircuitPackName() != null) { if (this.circuitPacksRecord.containsKey(deviceInterface.getSupportingCircuitPackName())) { diff --git a/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/OpenroadmNetworkElementFactory.java b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/OpenroadmNetworkElementFactory.java index f4f486578..0df1e1add 100644 --- a/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/OpenroadmNetworkElementFactory.java +++ b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/OpenroadmNetworkElementFactory.java @@ -51,14 +51,14 @@ public class OpenroadmNetworkElementFactory implements NetworkElementFactory { if (accessor.getCapabilites().isSupportingNamespaceAndRevision(OrgOpenroadmDevice.QNAME)) { log.info("Create OpenRoadm device {} ", OpenroadmNetworkElement.class.getName()); - log.info("Node Id read by Acessor {}:", accessor.getNodeId().getValue()); + log.debug("Node Id read by Acessor {}:", accessor.getNodeId().getValue()); Optional<NetconfBindingAccessor> bindingAccessor = accessor.getNetconfBindingAccessor(); if (bindingAccessor.isPresent()) { return Optional.of(new OpenroadmNetworkElement(bindingAccessor.get(), serviceProvider)); } } else if (accessor.getCapabilites().isSupportingNamespaceAndRevision("http://org/openroadm/device","2018-10-19")) { log.info("Create OpenRoadm base device {} ", OpenroadmNetworkElementBase.class.getName()); - log.info("Node Id read by Acessor {}:", accessor.getNodeId().getValue()); + log.debug("Node Id read by Acessor {}:", accessor.getNodeId().getValue()); Optional<NetconfBindingAccessor> bindingAccessor = accessor.getNetconfBindingAccessor(); if (bindingAccessor.isPresent()) { return Optional.of(new OpenroadmNetworkElementBase(bindingAccessor.get(), serviceProvider)); diff --git a/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/PmDataBuilderOpenRoadm.java b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/PmDataBuilderOpenRoadm.java index b032348ca..9d5c91482 100644 --- a/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/PmDataBuilderOpenRoadm.java +++ b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/PmDataBuilderOpenRoadm.java @@ -28,8 +28,10 @@ import java.util.Enumeration; import java.util.HashMap; import java.util.List; import java.util.Map; + import org.onap.ccsdk.features.sdnr.wt.common.YangHelper; import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfBindingAccessor; +import org.onap.ccsdk.features.sdnr.wt.yang.mapper.YangToolsMapperHelper; import org.opendaylight.mdsal.common.api.LogicalDatastoreType; import org.opendaylight.yang.gen.v1.http.org.openroadm.pm.rev191129.HistoricalPmList; import org.opendaylight.yang.gen.v1.http.org.openroadm.pm.rev191129.historical.pm.group.HistoricalPm; @@ -63,8 +65,8 @@ import org.slf4j.LoggerFactory; /** * @author shabnam - * - * Reading Openroadm PM data and returning as PmDataEntitiy data + * <p> + * Reading Openroadm PM data and returning as PmDataEntitiy data */ public class PmDataBuilderOpenRoadm { // variables @@ -84,7 +86,7 @@ public class PmDataBuilderOpenRoadm { // Read PM data public HistoricalPmList getPmData(NetconfBindingAccessor accessor) { final Class<HistoricalPmList> pmDataClass = HistoricalPmList.class; - log.info("Get PM data for element {}", accessor.getNodeId().getValue()); + log.debug("Get PM data for element {}", accessor.getNodeId().getValue()); InstanceIdentifier<HistoricalPmList> pmDataIid = InstanceIdentifier.builder(pmDataClass).build(); return accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, pmDataIid); @@ -94,7 +96,7 @@ public class PmDataBuilderOpenRoadm { // Build PM entity for writing into the database public List<PmdataEntity> buildPmDataEntity(HistoricalPmList historicalPmEnitityList) { List<PmdataEntity> pmEntitiyList = new ArrayList<>(); - if(historicalPmEnitityList==null) { + if (historicalPmEnitityList == null) { return pmEntitiyList; } Collection<HistoricalPmEntry> pmDataEntryList = @@ -103,19 +105,19 @@ public class PmDataBuilderOpenRoadm { pmDataBuilder.setUuidInterface(pmDataEntry.getPmResourceType().getName()); Collection<HistoricalPm> historicalPmList = YangHelper.getCollection(pmDataEntry.getHistoricalPm()); for (HistoricalPm historicalPm : historicalPmList) { - log.info("PmName:{}", historicalPm.getType()); + log.debug("PmName:{}", historicalPm.getType()); // pmDataBuilder.setPerformanceData(value) try { writeperformanceData(historicalPm); } catch (ClassNotFoundException e) { - log.info("No relevant data found"); + log.debug("No relevant data found"); } pmEntitiyList.add(this.pmDataBuilder.build()); - log.info("PmListSize before db writing: {}", pmEntitiyList.size()); + log.debug("PmListSize before db writing: {}", pmEntitiyList.size()); } - log.info("PmListSize before db writing: {}", pmEntitiyList.size()); + log.debug("PmListSize before db writing: {}", pmEntitiyList.size()); } return pmEntitiyList; } @@ -124,7 +126,8 @@ public class PmDataBuilderOpenRoadm { // private methods private void writeperformanceData(HistoricalPm historicalPm) throws ClassNotFoundException { Collection<Measurement> measurementList = YangHelper.getCollection(historicalPm.getMeasurement()); - Map<MeasurementKey, org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.pmdata.grp.Measurement> measurementMap=new HashMap<>(); + Map<MeasurementKey, org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.pmdata.grp.Measurement> + measurementMap = new HashMap<>(); // Map Performance data of PmDataEntity with MeasurmentData-HistoricalPm PerformanceDataBuilder performanceDataBuilder = new PerformanceDataBuilder(); for (Measurement measurementData : measurementList) { @@ -133,9 +136,11 @@ public class PmDataBuilderOpenRoadm { if (measurementData.getValidity().getName().equals("suspect")) { this.pmDataBuilder.setSuspectIntervalFlag(true); } - measurementMap.put(new MeasurementKey(measurementBuilder(historicalPm.getType(), measurementData.getPmParameterUnit(), - measurementData.getPmParameterValue()).getPmKey()), measurementBuilder(historicalPm.getType(), measurementData.getPmParameterUnit(), - measurementData.getPmParameterValue())); + measurementMap.put( + new MeasurementKey(measurementBuilder(historicalPm.getType(), measurementData.getPmParameterUnit(), + measurementData.getPmParameterValue()).getPmKey()), + measurementBuilder(historicalPm.getType(), measurementData.getPmParameterUnit(), + measurementData.getPmParameterValue())); } @@ -144,7 +149,6 @@ public class PmDataBuilderOpenRoadm { } - // Mapping Granularity period of PmDataEntity with PmGranularity of MeasurmentData-HistoricalPm private GranularityPeriodType mapGranularityPeriod(PmGranularity pmGranularity) { @@ -175,11 +179,11 @@ public class PmDataBuilderOpenRoadm { new ArrayList<>(); URL root = Thread.currentThread().getContextClassLoader().getResource(packageName1); - log.info("path for type package: {}", root); + log.debug("path for type package: {}", root); Enumeration<URL> results = getFileURL(b, packageName); - log.info("FOund Packages {}", results); - if(results != null) { + log.debug("Found Packages {}", results); + if (results != null) { while (results.hasMoreElements()) { URL path = results.nextElement(); @@ -188,59 +192,47 @@ public class PmDataBuilderOpenRoadm { if (PerformanceMeasurementTypeId.class.isAssignableFrom(cls1)) { measTypeObjList.add((Class<? extends PerformanceMeasurementTypeId>) cls1); - - } - if(cls1!=null) { - log.info("Class Added {}", cls1.getSimpleName()); + log.debug("Class Added {}", cls1.getSimpleName()); } - - } - - + } } return measTypeObjList; } - private Class<? extends PerformanceMeasurementUnitId> setMeasurementUnit(String unitName) { - Class<? extends PerformanceMeasurementUnitId> measurementUnitClass = null; + private PerformanceMeasurementUnitId setMeasurementUnit(String unitName) { + switch (unitName) { case ("celsius"): - measurementUnitClass = Celsius.class; - break; - case("dB"): - measurementUnitClass = DB.class; - break; - case("dBm"): - measurementUnitClass = DBm.class; - break; - case("fahrenheit"): - measurementUnitClass = Fahrenheit.class; - break; - case("kHz"): - measurementUnitClass = KHz.class; - break; - case("mW"): - measurementUnitClass = MW.class; - break; + return Celsius.VALUE; + case ("dB"): + return DB.VALUE; + case ("dBm"): + return DBm.VALUE; + case ("fahrenheit"): + return Fahrenheit.VALUE; + case ("kHz"): + return KHz.VALUE; + case ("mW"): + return MW.VALUE; default: break; } - return measurementUnitClass; - } + return null; + } private org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.pmdata.grp.Measurement measurementBuilder( PmNamesEnum pmType, String pmUnit, PmDataType pmDataType) { MeasurementBuilder measBuilder = new MeasurementBuilder(); - if (pmType.getName().equals("erroredSeconds") ) { - measBuilder.setPmKey(ErroredSecond.class); + if (pmType.getName().equals("erroredSeconds")) { + measBuilder.setPmKey(ErroredSecond.VALUE); } else if (pmType.getName().equals("severelyErroredSeconds")) { - measBuilder.setPmKey(SeverelyErroredSecond.class); + measBuilder.setPmKey(SeverelyErroredSecond.VALUE); } else { for (Class<? extends PerformanceMeasurementTypeId> obj : setMeasurementTypeId()) { if (obj.toString().contains(pmType.name())) { - measBuilder.setPmKey(obj); + measBuilder.setPmKey(YangToolsMapperHelper.getIdentityValueFromClass(obj) ); } } } @@ -255,7 +247,7 @@ public class PmDataBuilderOpenRoadm { try { return bundle.loadClass(className); } catch (Exception e) { - log.info(String.format("Class [%s] could not be loaded. Message: [%s].", className, e.getMessage())); + log.debug(String.format("Class [%s] could not be loaded. Message: [%s].", className, e.getMessage())); } return null; } @@ -264,15 +256,15 @@ public class PmDataBuilderOpenRoadm { BundleContext context = b == null ? null : b.getBundleContext(); if (context == null) { - log.info("no bundle context available"); + log.debug("no bundle context available"); return null; } Bundle[] bundles = context.getBundles(); if (bundles == null || bundles.length <= 0) { - log.info("no bundles found"); + log.debug("no bundles found"); return null; } - log.info("found {} bundles", bundles.length); + log.debug("found {} bundles", bundles.length); Enumeration<URL> resultUrl = null; for (Bundle bundle : bundles) { diff --git a/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/OperatorStateBuilder.java b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/OperatorStateBuilder.java deleted file mode 100644 index 30a55a203..000000000 --- a/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/OperatorStateBuilder.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.alarms.rev190911; - -/** - * 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/devicemanager-onap/openroadm/provider/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/ResourceBuilder.java b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/ResourceBuilder.java deleted file mode 100644 index a803bae97..000000000 --- a/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/ResourceBuilder.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.alarms.rev190911; - -/** - * 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/devicemanager-onap/openroadm/provider/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/ResourceMatchBuilder.java b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/ResourceMatchBuilder.java deleted file mode 100644 index bbfa37f40..000000000 --- a/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/ResourceMatchBuilder.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.alarms.rev190911; - -/** - * 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/devicemanager-onap/openroadm/provider/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/SeverityWithClearBuilder.java b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/SeverityWithClearBuilder.java deleted file mode 100644 index 9fb90b438..000000000 --- a/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/SeverityWithClearBuilder.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.alarms.rev190911; - -/** - * 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/devicemanager-onap/openroadm/provider/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/alarms/ControlMaxAlarmStatusChangesBuilder.java b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/alarms/ControlMaxAlarmStatusChangesBuilder.java deleted file mode 100644 index 2b8e8af57..000000000 --- a/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/opendaylight/yang/gen/v1/urn/ietf/params/xml/ns/yang/ietf/alarms/rev190911/alarms/ControlMaxAlarmStatusChangesBuilder.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.alarms.rev190911.alarms; - -/** - * 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/devicemanager-onap/openroadm71/feature/pom.xml b/sdnr/wt/devicemanager-onap/openroadm71/feature/pom.xml index 7659ae15e..5a9bb8ff2 100644 --- a/sdnr/wt/devicemanager-onap/openroadm71/feature/pom.xml +++ b/sdnr/wt/devicemanager-onap/openroadm71/feature/pom.xml @@ -20,13 +20,14 @@ ~ ============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>single-feature-parent</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/devicemanager-onap/openroadm71/installer/pom.xml b/sdnr/wt/devicemanager-onap/openroadm71/installer/pom.xml index 0137f3132..b1a60c98c 100755 --- a/sdnr/wt/devicemanager-onap/openroadm71/installer/pom.xml +++ b/sdnr/wt/devicemanager-onap/openroadm71/installer/pom.xml @@ -26,7 +26,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>odlparent-lite</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/devicemanager-onap/openroadm71/model/pom.xml b/sdnr/wt/devicemanager-onap/openroadm71/model/pom.xml index 58f25f66d..1b444a074 100644 --- a/sdnr/wt/devicemanager-onap/openroadm71/model/pom.xml +++ b/sdnr/wt/devicemanager-onap/openroadm71/model/pom.xml @@ -20,13 +20,14 @@ ~ ============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.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/devicemanager-onap/openroadm71/pom.xml b/sdnr/wt/devicemanager-onap/openroadm71/pom.xml index 82d8b8f1a..5861ef9ab 100755 --- a/sdnr/wt/devicemanager-onap/openroadm71/pom.xml +++ b/sdnr/wt/devicemanager-onap/openroadm71/pom.xml @@ -20,13 +20,14 @@ ~ ============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>odlparent-lite</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/devicemanager-onap/openroadm71/provider/pom.xml b/sdnr/wt/devicemanager-onap/openroadm71/provider/pom.xml index 1d4ec88c4..56698cbbc 100644 --- a/sdnr/wt/devicemanager-onap/openroadm71/provider/pom.xml +++ b/sdnr/wt/devicemanager-onap/openroadm71/provider/pom.xml @@ -20,13 +20,14 @@ ~ ============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.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> @@ -50,13 +51,6 @@ </properties> <dependencies> - - <dependency> - <groupId>${project.groupId}</groupId> - <artifactId>ietf-alarms</artifactId> - <version>${project.version}</version> - <scope>provided</scope> - </dependency> <dependency> <groupId>${project.groupId}</groupId> <artifactId>sdnr-wt-devicemanager-onap-openroadm71-model</artifactId> @@ -113,6 +107,12 @@ <groupId>net.bytebuddy</groupId> <scope>test</scope> </dependency> + <dependency> + <groupId>org.onap.ccsdk.features.sdnr.wt</groupId> + <artifactId>sdnr-wt-yang-utils</artifactId> + <version>${project.version}</version> + <scope>compile</scope> + </dependency> <!-- end for testing --> </dependencies> diff --git a/sdnr/wt/devicemanager-onap/openroadm71/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm71/impl/InitialDeviceAlarmReader.java b/sdnr/wt/devicemanager-onap/openroadm71/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm71/impl/InitialDeviceAlarmReader.java index 5a9beaf9a..7a038bd60 100644 --- a/sdnr/wt/devicemanager-onap/openroadm71/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm71/impl/InitialDeviceAlarmReader.java +++ b/sdnr/wt/devicemanager-onap/openroadm71/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm71/impl/InitialDeviceAlarmReader.java @@ -105,7 +105,7 @@ public class InitialDeviceAlarmReader { // Mapping Severity of AlarmNotification to SeverityType of FaultLog protected static SeverityType checkSeverityValue(Severity severity) { SeverityType severityType = null; - log.info("Device Severity: {}", severity.getName()); + log.debug("Device Severity: {}", severity.getName()); switch (severity.getName()) { case ("warning"): @@ -141,13 +141,13 @@ public class InitialDeviceAlarmReader { // Read Alarm Data private Optional<ActiveAlarmList> getActiveAlarmList(NetconfBindingAccessor accessor) { final Class<ActiveAlarmList> classAlarm = ActiveAlarmList.class; - log.info("Get Alarm data for element {}", accessor.getNodeId().getValue()); + log.debug("Get Alarm data for element {}", accessor.getNodeId().getValue()); InstanceIdentifier<ActiveAlarmList> alarmDataIid = InstanceIdentifier.builder(classAlarm).build(); ActiveAlarmList alarmData = accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, alarmDataIid); - log.info("AlarmData {}", alarmData); + log.debug("AlarmData {}", alarmData); return Optional.ofNullable(alarmData); } diff --git a/sdnr/wt/devicemanager-onap/openroadm71/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm71/impl/OpenroadmChangeNotificationListener.java b/sdnr/wt/devicemanager-onap/openroadm71/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm71/impl/OpenroadmChangeNotificationListener.java index 747de40de..3a243842f 100644 --- a/sdnr/wt/devicemanager-onap/openroadm71/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm71/impl/OpenroadmChangeNotificationListener.java +++ b/sdnr/wt/devicemanager-onap/openroadm71/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm71/impl/OpenroadmChangeNotificationListener.java @@ -96,7 +96,7 @@ public class OpenroadmChangeNotificationListener implements IetfNetconfNotificat @Override public void onNetconfConfigChange(NetconfConfigChange notification) { - LOG.info("onNetconfConfigChange (1) {}", notification); + LOG.debug("onNetconfConfigChange (1) {}", notification); StringBuffer sb = new StringBuffer(); List<Edit> editList = notification.nonnullEdit(); for (Edit edit : editList) { diff --git a/sdnr/wt/devicemanager-onap/openroadm71/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm71/impl/OpenroadmDeviceChangeNotificationListener.java b/sdnr/wt/devicemanager-onap/openroadm71/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm71/impl/OpenroadmDeviceChangeNotificationListener.java index 3263e1de2..b914b31d5 100644 --- a/sdnr/wt/devicemanager-onap/openroadm71/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm71/impl/OpenroadmDeviceChangeNotificationListener.java +++ b/sdnr/wt/devicemanager-onap/openroadm71/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm71/impl/OpenroadmDeviceChangeNotificationListener.java @@ -75,7 +75,7 @@ public class OpenroadmDeviceChangeNotificationListener implements OrgOpenroadmDe @Override public void onChangeNotification(ChangeNotification notification) { - log.info("onDeviceConfigChange(1){}", notification); + log.debug("onDeviceConfigChange(1){}", notification); StringBuffer sb = new StringBuffer(); @NonNull @@ -89,9 +89,9 @@ public class OpenroadmDeviceChangeNotificationListener implements OrgOpenroadmDe InstanceIdentifier<?> target = edit.getTarget(); if (target != null) { eventlogBuilder.setObjectId(target.getPathArguments().toString()); - log.info("TARGET: {} {}", target.getClass(), target.getTargetType()); + log.debug("TARGET: {} {}", target.getClass(), target.getTargetType()); for (PathArgument pa : target.getPathArguments()) { - log.info("PathArgument {}", pa); + log.debug("PathArgument {}", pa); } eventlogBuilder.setAttributeName(target.getTargetType().getName()); } @@ -101,7 +101,7 @@ public class OpenroadmDeviceChangeNotificationListener implements OrgOpenroadmDe eventlogBuilder.setCounter(counter); eventlogBuilder.setSourceType(SourceType.Netconf); databaseProvider.writeEventLog(eventlogBuilder.build()); - log.info("onDeviceConfigChange (2) {}", sb); + log.debug("onDeviceConfigChange (2) {}", sb); counter++; } this.notificationServiceService.sendNotification(notification, this.netconfAccessor.getNodeId(), @@ -112,7 +112,7 @@ public class OpenroadmDeviceChangeNotificationListener implements OrgOpenroadmDe public void onCreateTechInfoNotification(CreateTechInfoNotification notification) { DateAndTime now = NetconfTimeStampImpl.getConverter().getTimeStamp(); - log.info("onCreateTechInfoNotification(1){}", notification); + log.debug("onCreateTechInfoNotification(1){}", notification); EventlogBuilder eventlogBuilder = new EventlogBuilder(); eventlogBuilder.setId(notification.getShelfId()).setAttributeName(notification.getShelfId()) .setObjectId(notification.getShelfId()).setNodeId(this.netconfAccessor.getNodeId().getValue()) @@ -121,7 +121,7 @@ public class OpenroadmDeviceChangeNotificationListener implements OrgOpenroadmDe databaseProvider.writeEventLog(eventlogBuilder.build()); this.notificationServiceService.sendNotification(notification, this.netconfAccessor.getNodeId(), CreateTechInfoNotification.QNAME, now); - log.info("Create-techInfo Notification written "); + log.debug("Create-techInfo Notification written "); counter++; } // end of public methods diff --git a/sdnr/wt/devicemanager-onap/openroadm71/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm71/impl/OpenroadmFaultNotificationListener.java b/sdnr/wt/devicemanager-onap/openroadm71/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm71/impl/OpenroadmFaultNotificationListener.java index 7a1116515..785778b5d 100644 --- a/sdnr/wt/devicemanager-onap/openroadm71/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm71/impl/OpenroadmFaultNotificationListener.java +++ b/sdnr/wt/devicemanager-onap/openroadm71/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm71/impl/OpenroadmFaultNotificationListener.java @@ -80,7 +80,7 @@ public class OpenroadmFaultNotificationListener implements OrgOpenroadmAlarmList @Override public void onAlarmNotification(AlarmNotification notification) { - log.info("AlarmNotification is {} \t {}", notification.getId(), notification.getAdditionalDetail()); + log.debug("AlarmNotification is {} \t {}", notification.getId(), notification.getAdditionalDetail()); String affectedResourceName = getAffectedResourceName(notification.getResource().getResource().getResource()); String probableCauseName = getProbableCauseName(notification.getProbableCause()); @@ -98,7 +98,7 @@ public class OpenroadmFaultNotificationListener implements OrgOpenroadmAlarmList this.notificationService.sendNotification(notification,new NodeId(netconfAccessor.getNodeId().getValue()), AlarmNotification.QNAME, notification.getRaiseTime()); count++; - log.info("Notification is written into the database {}", faultAlarm.getObjectId()); + log.debug("Notification is written into the database {}", faultAlarm.getObjectId()); } diff --git a/sdnr/wt/devicemanager-onap/openroadm71/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm71/impl/OpenroadmInventoryInput.java b/sdnr/wt/devicemanager-onap/openroadm71/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm71/impl/OpenroadmInventoryInput.java index 2f48d79f7..b383c9d70 100644 --- a/sdnr/wt/devicemanager-onap/openroadm71/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm71/impl/OpenroadmInventoryInput.java +++ b/sdnr/wt/devicemanager-onap/openroadm71/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm71/impl/OpenroadmInventoryInput.java @@ -58,7 +58,7 @@ public class OpenroadmInventoryInput { // public methods public Inventory getInventoryData(Uint32 treeLevel) { InventoryBuilder inventoryBuilder = new InventoryBuilder(); - log.info("Info for device {}", this.openRoadmDevice.getInfo().getNodeId().getValue()); + log.debug("Info for device {}", this.openRoadmDevice.getInfo().getNodeId().getValue()); Info info = this.openRoadmDevice.getInfo(); inventoryBuilder.setNodeId(this.accessor.getNodeId().getValue()) .setUuid(info.getNodeId() == null ? NOT_AVAILABLE : info.getNodeId().getValue()) @@ -68,13 +68,14 @@ public class OpenroadmInventoryInput { .setVersion(info.getOpenroadmVersion() != null ? info.getOpenroadmVersion().getName() : null) .setDescription("org-openroadm-device").setParentUuid("None").setTypeName(info.getNodeType().getName()) .setPartTypeId("device"); - log.info("Inventory data written for device {}", this.openRoadmDevice.getInfo().getNodeId().getValue()); + log.debug("Inventory data written for device {}", this.openRoadmDevice.getInfo().getNodeId().getValue()); return inventoryBuilder.build(); } public Inventory getShelvesInventory(Shelves shelf, Uint32 treeLevel) { InventoryBuilder inventoryBuilder = new InventoryBuilder(); - inventoryBuilder.setNodeId(this.accessor.getNodeId().getValue()).setId(shelf.getShelfName()) + inventoryBuilder.setNodeId(this.accessor.getNodeId().getValue()) + .setId(this.accessor.getNodeId().getValue() + "/" + shelf.getShelfName()) .setDescription((shelf.getUserDescription() == null) ? ("Position: " + shelf.getShelfPosition() + "\nState: " + shelf.getOperationalState()) : (shelf.getUserDescription()) + "\nPosition: " + shelf.getShelfPosition() + "\nState: " @@ -85,28 +86,29 @@ public class OpenroadmInventoryInput { .setManufacturerIdentifier(shelf.getVendor()).setModelIdentifier(shelf.getModel()) .setVersion(shelf.getHardwareVersion()) .setDate(shelf.getManufactureDate() != null ? shelf.getManufactureDate().getValue() : NOT_AVAILABLE); - log.info("Inventory data written for Shelf {}", shelf.getShelfName()); + log.debug("Inventory data written for Shelf {}", shelf.getShelfName()); return inventoryBuilder.build(); } public Inventory getInterfacesInventory(Interface deviceInterface, Uint32 treeLevel) { InventoryBuilder inventoryBuilder = new InventoryBuilder(); - inventoryBuilder.setNodeId(this.accessor.getNodeId().getValue()).setId(deviceInterface.getName()) + inventoryBuilder.setNodeId(this.accessor.getNodeId().getValue()) + .setId(this.accessor.getNodeId().getValue() + "/" + deviceInterface.getName()) .setDescription( (deviceInterface.getDescription() == null) ? NOT_AVAILABLE : deviceInterface.getDescription()) .setUuid(deviceInterface.getName()).setSerial(deviceInterface.getName()) .setParentUuid((deviceInterface.getSupportingCircuitPackName() != null) ? deviceInterface.getSupportingCircuitPackName() - // : ((deviceInterface.getSupportingInterface() != null) ? deviceInterface.getSupportingInterface() + // : ((deviceInterface.getSupportingInterface() != null) ? + // deviceInterface.getSupportingInterface() : this.openRoadmDevice.getInfo().getNodeId().getValue()) .setTreeLevel(treeLevel) .setTypeName((deviceInterface.getType() == null) ? "Interface" - : deviceInterface.getType().getName().substring(69, - deviceInterface.getType().getName().length())) + : deviceInterface.getType().getClass().getSimpleName()) .setPartTypeId("Interface").setManufacturerIdentifier(this.openRoadmDevice.getInfo().getVendor()) .setModelIdentifier(this.openRoadmDevice.getInfo().getModel()).setVersion("N/A") .setDate(this.openRoadmDevice.getInfo().getCurrentDatetime().getValue()); - log.info("Inventory data written for Interface {}", deviceInterface.getName()); + log.debug("Inventory data written for Interface {}", deviceInterface.getName()); return inventoryBuilder.build(); } @@ -116,8 +118,9 @@ public class OpenroadmInventoryInput { inventoryBuilder.setNodeId(this.accessor.getNodeId().getValue()).setUuid(circuitPack.getCircuitPackName()) .setDate((circuitPack.getManufactureDate() == null) ? NOT_AVAILABLE : circuitPack.getManufactureDate().getValue().substring(0, 19)) - .setId(circuitPack.getCircuitPackName()).setManufacturerIdentifier(circuitPack.getVendor()) - .setModelIdentifier(circuitPack.getModel()).setSerial(circuitPack.getSerialId()).setTreeLevel(treeLevel) + .setId(this.accessor.getNodeId().getValue() + "/" + circuitPack.getCircuitPackName()) + .setManufacturerIdentifier(circuitPack.getVendor()).setModelIdentifier(circuitPack.getModel()) + .setSerial(circuitPack.getSerialId()).setTreeLevel(treeLevel) .setVersion(circuitPack.getHardwareVersion()) .setDescription("ProductCode: " + circuitPack.getProductCode() + " " + "Mode: " + circuitPack.getCircuitPackMode()) @@ -127,14 +130,15 @@ public class OpenroadmInventoryInput { ? circuitPack.getParentCircuitPack().getCircuitPackName() : ((circuitPack.getShelf() != null) ? circuitPack.getShelf() : this.openRoadmDevice.getInfo().getNodeId().getValue())); - log.info("Inventory data written for CircuitPack {}", circuitPack.getCircuitPackName()); + log.debug("Inventory data written for CircuitPack {}", circuitPack.getCircuitPackName()); return inventoryBuilder.build(); } public Inventory getXponderInventory(Xponder xpdr, Uint32 treeLevel) { InventoryBuilder inventoryBuilder = new InventoryBuilder(); - inventoryBuilder.setNodeId(this.accessor.getNodeId().getValue()).setId(xpdr.getXpdrNumber().toString()) + inventoryBuilder.setNodeId(this.accessor.getNodeId().getValue()) + .setId(this.accessor.getNodeId().getValue() + "/" + xpdr.getXpdrNumber().toString()) .setDescription("Xponder\nLifecycleState: " + xpdr.getLifecycleState().getName()) .setUuid(xpdr.getXpdrNumber().toString()).setSerial(xpdr.getXpdrNumber().toString()) .setParentUuid(this.openRoadmDevice.getInfo().getNodeId().getValue()).setTreeLevel(treeLevel) @@ -143,7 +147,7 @@ public class OpenroadmInventoryInput { .setModelIdentifier(this.openRoadmDevice.getInfo().getModel()) .setVersion(this.openRoadmDevice.getInfo().getOpenroadmVersion().getName()) .setDate(this.openRoadmDevice.getInfo().getCurrentDatetime().getValue()); - log.info("Inventory data written for Xponder{}", xpdr.getXpdrNumber()); + log.debug("Inventory data written for Xponder{}", xpdr.getXpdrNumber()); return inventoryBuilder.build(); } diff --git a/sdnr/wt/devicemanager-onap/openroadm71/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm71/impl/OpenroadmNetworkElement.java b/sdnr/wt/devicemanager-onap/openroadm71/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm71/impl/OpenroadmNetworkElement.java index 2a22e1e9d..e4201bc44 100644 --- a/sdnr/wt/devicemanager-onap/openroadm71/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm71/impl/OpenroadmNetworkElement.java +++ b/sdnr/wt/devicemanager-onap/openroadm71/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm71/impl/OpenroadmNetworkElement.java @@ -85,7 +85,7 @@ public class OpenroadmNetworkElement extends OpenroadmNetworkElementBase { super(netconfAccess, serviceProvider); - LOG.info("Create {}", OpenroadmNetworkElement.class.getSimpleName()); + LOG.debug("Create {}", OpenroadmNetworkElement.class.getSimpleName()); this.openRdmListenerRegistrationResult = null; this.openRdmListener = new OpenroadmChangeNotificationListener(netconfAccessor, databaseService, serviceProvider.getWebsocketService()); @@ -98,7 +98,7 @@ public class OpenroadmNetworkElement extends OpenroadmNetworkElementBase { this.shelfProvisionedcircuitPacks = new Hashtable<>(); this.openRoadmPmData = new PmDataBuilderOpenRoadm(this.netconfAccessor); this.initialAlarmReader = new InitialDeviceAlarmReader(this.netconfAccessor, serviceProvider); - LOG.info("NodeId {}", this.netconfAccessor.getNodeId().getValue()); + LOG.debug("NodeId {}", this.netconfAccessor.getNodeId().getValue()); } @@ -109,7 +109,7 @@ public class OpenroadmNetworkElement extends OpenroadmNetworkElementBase { OrgOpenroadmDevice device = readDevice(this.netconfAccessor); this.opnRdmInventoryInput = new OpenroadmInventoryInput(this.netconfAccessor, device); - LOG.info("openroadmMapper details{}", this.opnRdmInventoryInput.getClass().getName()); + LOG.debug("openroadmMapper details{}", this.opnRdmInventoryInput.getClass().getName()); List<Inventory> inventoryList = new ArrayList<>(); inventoryList.add(this.opnRdmInventoryInput.getInventoryData(Uint32.valueOf(EQUIPMENTLEVEL_BASE))); readShelvesData(inventoryList, device); @@ -124,12 +124,12 @@ public class OpenroadmNetworkElement extends OpenroadmNetworkElementBase { pmDataEntity = this.openRoadmPmData.buildPmDataEntity(this.openRoadmPmData.getPmData(this.netconfAccessor)); if (!pmDataEntity.isEmpty()) { this.databaseService.doWritePerformanceData(pmDataEntity); - LOG.info("PmDatEntity is written with size {}", pmDataEntity.size()); + LOG.debug("PmDatEntity is written with size {}", pmDataEntity.size()); for (PmdataEntity ent : pmDataEntity) { - LOG.info("GetNode: {}, granPeriod: {}", ent.getNodeName(), ent.getGranularityPeriod().getName()); + LOG.debug("GetNode: {}, granPeriod: {}", ent.getNodeName(), ent.getGranularityPeriod().getName()); } } else { - LOG.info("PmDatEntity is empty"); + LOG.debug("PmDatEntity is empty"); } } @@ -148,7 +148,7 @@ public class OpenroadmNetworkElement extends OpenroadmNetworkElementBase { netconfAccessor.registerNotificationsStream(NetconfAccessor.DefaultNotificationsStream); } else { - LOG.info("device {} does not support netconf notification", netconfAccessor.getNodeId().getValue()); + LOG.debug("device {} does not support netconf notification", netconfAccessor.getNodeId().getValue()); } } @@ -172,7 +172,7 @@ public class OpenroadmNetworkElement extends OpenroadmNetworkElementBase { Collection<Shelves> shelves = YangHelper.getCollection(device.getShelves()); if (shelves != null) { for (Shelves shelf : shelves) { - LOG.info( + LOG.debug( "Shelf Name: {}, \n Serial Id:{}, \n Product Code;{}, \n Position:{}, \n EquipmetState: {}, \n Hardware version: {}" + "\n ShelfType:{}, \n Vendor: {}, \n LifecycleState: {} ", shelf.getShelfName(), shelf.getSerialId(), shelf.getProductCode(), shelf.getShelfPosition(), @@ -187,13 +187,13 @@ public class OpenroadmNetworkElement extends OpenroadmNetworkElementBase { this.shelfProvisionedcircuitPacks.put(slot.getProvisionedCircuitPack(), EQUIPMENTLEVEL_BASE + 2); } - LOG.info("Slots for the shelf: {}", shelf.getShelfName()); - LOG.info("\n Slot Name: {}, \n Status: {}, \n Slot label: {} ", slot.getSlotName(), + LOG.debug("Slots for the shelf: {}", shelf.getShelfName()); + LOG.debug("\n Slot Name: {}, \n Status: {}, \n Slot label: {} ", slot.getSlotName(), slot.getSlotStatus(), slot.getLabel()); } } } - LOG.info("size of shelfProvisionedcircuitPacks: {} ", shelfProvisionedcircuitPacks.size()); + LOG.debug("size of shelfProvisionedcircuitPacks: {} ", shelfProvisionedcircuitPacks.size()); } } @@ -206,7 +206,7 @@ public class OpenroadmNetworkElement extends OpenroadmNetworkElementBase { inventoryList.add(this.opnRdmInventoryInput.getXponderInventory(xponder, Uint32.valueOf(EQUIPMENTLEVEL_BASE + 1))); - LOG.info("Xponders: No.: {} , \n Port: {} ,\n Type: {}", xponder.getXpdrNumber(), xponder.getXpdrPort(), + LOG.debug("Xponders: No.: {} , \n Port: {} ,\n Type: {}", xponder.getXpdrNumber(), xponder.getXpdrPort(), xponder.getXpdrType()); Collection<XpdrPort> xpdrportlist = YangHelper.getCollection(xponder.getXpdrPort()); if (xpdrportlist != null) { @@ -214,7 +214,7 @@ public class OpenroadmNetworkElement extends OpenroadmNetworkElementBase { if (xpdrport.getCircuitPackName() != null) { this.shelfProvisionedcircuitPacks.put(xpdrport.getCircuitPackName(), EQUIPMENTLEVEL_BASE + 2); - LOG.info("Size of dict{}", this.shelfProvisionedcircuitPacks.size()); + LOG.debug("Size of dict{}", this.shelfProvisionedcircuitPacks.size()); } } @@ -233,11 +233,11 @@ public class OpenroadmNetworkElement extends OpenroadmNetworkElementBase { } for (CircuitPacks cp : circuitpackCollection) { - LOG.info("CP Name:{}", cp.getCircuitPackName()); + LOG.debug("CP Name:{}", cp.getCircuitPackName()); if (cp.getParentCircuitPack() == null && !this.shelfProvisionedcircuitPacks.containsKey(cp.getCircuitPackName())) { - LOG.info("cp has no parent and no shelf"); + LOG.debug("cp has no parent and no shelf"); this.circuitPacksRecord.put(cp.getCircuitPackName(), (EQUIPMENTLEVEL_BASE + 1)); inventoryList.add(this.opnRdmInventoryInput.getCircuitPackInventory(cp, Uint32.valueOf(EQUIPMENTLEVEL_BASE + 1))); @@ -246,7 +246,7 @@ public class OpenroadmNetworkElement extends OpenroadmNetworkElementBase { if (cp.getParentCircuitPack().getCpSlotName() != null && cp.getParentCircuitPack().getCircuitPackName() == null) { - LOG.info("Cp {} has slotname of the parent circuit pack but no parent circuit pack name", + LOG.debug("Cp {} has slotname of the parent circuit pack but no parent circuit pack name", cp.getCircuitPackName()); this.circuitPacksRecord.put(cp.getCircuitPackName(), (EQUIPMENTLEVEL_BASE + 3)); inventoryList.add(this.opnRdmInventoryInput.getCircuitPackInventory(cp, @@ -258,7 +258,7 @@ public class OpenroadmNetworkElement extends OpenroadmNetworkElementBase { } else if (cp.getParentCircuitPack().getCircuitPackName() != null && this.shelfProvisionedcircuitPacks .containsKey(cp.getParentCircuitPack().getCircuitPackName())) { - LOG.info("Cp {} has parent circuit pack and shelf", cp.getCircuitPackName()); + LOG.debug("Cp {} has parent circuit pack and shelf", cp.getCircuitPackName()); this.circuitPacksRecord.put(cp.getCircuitPackName(), (EQUIPMENTLEVEL_BASE + 3)); inventoryList.add(this.opnRdmInventoryInput.getCircuitPackInventory(cp, Uint32.valueOf(EQUIPMENTLEVEL_BASE + 3))); @@ -271,7 +271,7 @@ public class OpenroadmNetworkElement extends OpenroadmNetworkElementBase { .setId(cp.getParentCircuitPack().getCpSlotName()).build()); } - LOG.info("Cp has parent circuit pack but no shelf or a shelf but no parent circuit pack"); + LOG.debug("Cp has parent circuit pack but no shelf or a shelf but no parent circuit pack"); this.circuitPacksRecord.put(cp.getCircuitPackName(), (EQUIPMENTLEVEL_BASE + 2)); inventoryList.add(this.opnRdmInventoryInput.getCircuitPackInventory(cp, Uint32.valueOf(EQUIPMENTLEVEL_BASE + 2))); @@ -287,12 +287,12 @@ public class OpenroadmNetworkElement extends OpenroadmNetworkElementBase { Collection<Interface> interfaceList = YangHelper.getCollection(device.getInterface()); if (interfaceList != null) { for (Interface deviceInterface : interfaceList) { - LOG.info("\n InterfaceName: {}", deviceInterface.getName()); - LOG.info("Supporting CP {}", this.circuitPacksRecord.size()); + LOG.debug("\n InterfaceName: {}", deviceInterface.getName()); + LOG.debug("Supporting CP {}", this.circuitPacksRecord.size()); for (String s : this.circuitPacksRecord.keySet()) { - LOG.info("{} value {}", s, this.circuitPacksRecord.get(s)); + LOG.debug("{} value {}", s, this.circuitPacksRecord.get(s)); } - LOG.info("Interface {} and their supporting CP {}", deviceInterface.getName(), + LOG.debug("Interface {} and their supporting CP {}", deviceInterface.getName(), deviceInterface.getSupportingCircuitPackName()); if (deviceInterface.getSupportingCircuitPackName() != null) { if (this.circuitPacksRecord.containsKey(deviceInterface.getSupportingCircuitPackName())) { diff --git a/sdnr/wt/devicemanager-onap/openroadm71/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm71/impl/OpenroadmNetworkElementFactory.java b/sdnr/wt/devicemanager-onap/openroadm71/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm71/impl/OpenroadmNetworkElementFactory.java index 04b6b2ae1..60ece0780 100644 --- a/sdnr/wt/devicemanager-onap/openroadm71/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm71/impl/OpenroadmNetworkElementFactory.java +++ b/sdnr/wt/devicemanager-onap/openroadm71/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm71/impl/OpenroadmNetworkElementFactory.java @@ -51,7 +51,7 @@ public class OpenroadmNetworkElementFactory implements NetworkElementFactory { if (accessor.getCapabilites().isSupportingNamespaceAndRevision(OrgOpenroadmDevice.QNAME)) { log.info("Create OpenRoadm device {} ", OpenroadmNetworkElement.class.getName()); - log.info("Node Id read by Acessor {}:", accessor.getNodeId().getValue()); + log.debug("Node Id read by Acessor {}:", accessor.getNodeId().getValue()); Optional<NetconfBindingAccessor> bindingAccessor = accessor.getNetconfBindingAccessor(); if (bindingAccessor.isPresent()) { return Optional.of(new OpenroadmNetworkElement(bindingAccessor.get(), serviceProvider)); diff --git a/sdnr/wt/devicemanager-onap/openroadm71/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm71/impl/PmDataBuilderOpenRoadm.java b/sdnr/wt/devicemanager-onap/openroadm71/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm71/impl/PmDataBuilderOpenRoadm.java index 658c507cd..b58eb1dd4 100644 --- a/sdnr/wt/devicemanager-onap/openroadm71/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm71/impl/PmDataBuilderOpenRoadm.java +++ b/sdnr/wt/devicemanager-onap/openroadm71/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm71/impl/PmDataBuilderOpenRoadm.java @@ -30,6 +30,7 @@ import java.util.List; import java.util.Map; import org.onap.ccsdk.features.sdnr.wt.common.YangHelper; import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfBindingAccessor; +import org.onap.ccsdk.features.sdnr.wt.yang.mapper.YangToolsMapperHelper; import org.opendaylight.mdsal.common.api.LogicalDatastoreType; import org.opendaylight.yang.gen.v1.http.org.openroadm.pm.rev200529.HistoricalPmList; import org.opendaylight.yang.gen.v1.http.org.openroadm.pm.rev200529.historical.pm.group.HistoricalPm; @@ -84,7 +85,7 @@ public class PmDataBuilderOpenRoadm { // Read PM data public HistoricalPmList getPmData(NetconfBindingAccessor accessor) { final Class<HistoricalPmList> pmDataClass = HistoricalPmList.class; - log.info("Get PM data for element {}", accessor.getNodeId().getValue()); + log.debug("Get PM data for element {}", accessor.getNodeId().getValue()); InstanceIdentifier<HistoricalPmList> pmDataIid = InstanceIdentifier.builder(pmDataClass).build(); return accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, pmDataIid); @@ -103,19 +104,19 @@ public class PmDataBuilderOpenRoadm { pmDataBuilder.setUuidInterface(pmDataEntry.getPmResourceType().getName()); Collection<HistoricalPm> historicalPmList = YangHelper.getCollection(pmDataEntry.getHistoricalPm()); for (HistoricalPm historicalPm : historicalPmList) { - log.info("PmName:{}", historicalPm.getType()); + log.debug("PmName:{}", historicalPm.getType()); // pmDataBuilder.setPerformanceData(value) try { writeperformanceData(historicalPm); } catch (ClassNotFoundException e) { - log.info("No relevant data found"); + log.debug("No relevant data found"); } pmEntitiyList.add(this.pmDataBuilder.build()); - log.info("PmListSize before db writing: {}", pmEntitiyList.size()); + log.debug("PmListSize before db writing: {}", pmEntitiyList.size()); } - log.info("PmListSize before db writing: {}", pmEntitiyList.size()); + log.debug("PmListSize before db writing: {}", pmEntitiyList.size()); } return pmEntitiyList; } @@ -181,10 +182,10 @@ public class PmDataBuilderOpenRoadm { List<Class<? extends PerformanceMeasurementTypeId>> measTypeObjList = new ArrayList<>(); URL root = Thread.currentThread().getContextClassLoader().getResource(packageName1); - log.info("path for type package: {}", root); + log.debug("path for type package: {}", root); Enumeration<URL> results = getFileURL(b, packageName); - log.info("FOund Packages {}", results); + log.debug("FOund Packages {}", results); if (results != null) { while (results.hasMoreElements()) { URL path = results.nextElement(); @@ -197,7 +198,7 @@ public class PmDataBuilderOpenRoadm { } if (cls1 != null) { - log.info("Class Added {}", cls1.getSimpleName()); + log.debug("Class Added {}", cls1.getSimpleName()); } } @@ -208,31 +209,24 @@ public class PmDataBuilderOpenRoadm { return measTypeObjList; } - private Class<? extends PerformanceMeasurementUnitId> setMeasurementUnit(String unitName) { - Class<? extends PerformanceMeasurementUnitId> measurementUnitClass = null; + private PerformanceMeasurementUnitId setMeasurementUnit(String unitName) { switch (unitName) { case ("celsius"): - measurementUnitClass = Celsius.class; - break; + return Celsius.VALUE; case ("dB"): - measurementUnitClass = DB.class; - break; + return DB.VALUE; case ("dBm"): - measurementUnitClass = DBm.class; - break; + return DBm.VALUE; case ("fahrenheit"): - measurementUnitClass = Fahrenheit.class; - break; + return Fahrenheit.VALUE; case ("kHz"): - measurementUnitClass = KHz.class; - break; + return KHz.VALUE; case ("mW"): - measurementUnitClass = MW.class; - break; + return MW.VALUE; default: break; } - return measurementUnitClass; + return null; } private org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.pmdata.grp.Measurement measurementBuilder( @@ -240,13 +234,13 @@ public class PmDataBuilderOpenRoadm { MeasurementBuilder measBuilder = new MeasurementBuilder(); if (pmType.getName().equals("erroredSeconds")) { - measBuilder.setPmKey(ErroredSecond.class); + measBuilder.setPmKey(ErroredSecond.VALUE); } else if (pmType.getName().equals("severelyErroredSeconds")) { - measBuilder.setPmKey(SeverelyErroredSecond.class); + measBuilder.setPmKey(SeverelyErroredSecond.VALUE); } else { for (Class<? extends PerformanceMeasurementTypeId> obj : setMeasurementTypeId()) { if (obj.toString().contains(pmType.name())) { - measBuilder.setPmKey(obj); + measBuilder.setPmKey(YangToolsMapperHelper.getIdentityValueFromClass(obj)); } } } @@ -262,7 +256,7 @@ public class PmDataBuilderOpenRoadm { try { return bundle.loadClass(className); } catch (Exception e) { - log.info(String.format("Class [%s] could not be loaded. Message: [%s].", className, e.getMessage())); + log.debug(String.format("Class [%s] could not be loaded. Message: [%s].", className, e.getMessage())); } return null; } @@ -271,15 +265,15 @@ public class PmDataBuilderOpenRoadm { BundleContext context = b == null ? null : b.getBundleContext(); if (context == null) { - log.info("no bundle context available"); + log.debug("no bundle context available"); return null; } Bundle[] bundles = context.getBundles(); if (bundles == null || bundles.length <= 0) { - log.info("no bundles found"); + log.debug("no bundles found"); return null; } - log.info("found {} bundles", bundles.length); + log.debug("found {} bundles", bundles.length); Enumeration<URL> resultUrl = null; for (Bundle bundle : bundles) { diff --git a/sdnr/wt/devicemanager-onap/openroadm71/provider/src/main/java/org/opendaylight/yang/gen/v1/http/org/openroadm/pm/types/rev200327/PmDataTypeBuilder.java b/sdnr/wt/devicemanager-onap/openroadm71/provider/src/main/java/org/opendaylight/yang/gen/v1/http/org/openroadm/pm/types/rev200327/PmDataTypeBuilder.java deleted file mode 100644 index f470fb6ba..000000000 --- a/sdnr/wt/devicemanager-onap/openroadm71/provider/src/main/java/org/opendaylight/yang/gen/v1/http/org/openroadm/pm/types/rev200327/PmDataTypeBuilder.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.opendaylight.yang.gen.v1.http.org.openroadm.pm.types.rev200327; -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 PmDataTypeBuilder { - private PmDataTypeBuilder() { - //Exists only to defeat instantiation. - } - - public static PmDataType getDefaultInstance(String defaultValue) { - throw new UnsupportedOperationException("Not yet implemented"); - } - -} diff --git a/sdnr/wt/devicemanager-onap/openroadm71/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm71/test/TestOpenRoadmNetworkElement.java b/sdnr/wt/devicemanager-onap/openroadm71/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm71/test/TestOpenRoadmNetworkElement.java index a018df739..7ebb3af2e 100644 --- a/sdnr/wt/devicemanager-onap/openroadm71/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm71/test/TestOpenRoadmNetworkElement.java +++ b/sdnr/wt/devicemanager-onap/openroadm71/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm71/test/TestOpenRoadmNetworkElement.java @@ -85,10 +85,7 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types. import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import org.opendaylight.yangtools.yang.common.Uint16; -import org.opendaylight.yangtools.yang.common.Uint32; -import org.opendaylight.yangtools.yang.common.Uint64; -import org.opendaylight.yangtools.yang.common.Uint8; +import org.opendaylight.yangtools.yang.common.*; public class TestOpenRoadmNetworkElement { @@ -268,7 +265,7 @@ public class TestOpenRoadmNetworkElement { Measurement measurement = mock(Measurement.class); PmDataType pmDataType = mock(PmDataType.class); - when(pmDataType.getUint64()).thenReturn(Uint64.valueOf(2425425)); + when(pmDataType.getDecimal64()).thenReturn(Decimal64.valueOf(1,2425425)); when(measurement.getBinNumber()).thenReturn(Uint16.valueOf(1452)); when(measurement.getCompletionTime()).thenReturn(new DateAndTime("2018-10-22T15:23:43Z")); when(measurement.getGranularity()).thenReturn(PmGranularity._24Hour); diff --git a/sdnr/wt/devicemanager-onap/openroadm71/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm71/test/TestOpenRoadmPMDataBuilder.java b/sdnr/wt/devicemanager-onap/openroadm71/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm71/test/TestOpenRoadmPMDataBuilder.java index 49585acb2..cfeca1342 100644 --- a/sdnr/wt/devicemanager-onap/openroadm71/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm71/test/TestOpenRoadmPMDataBuilder.java +++ b/sdnr/wt/devicemanager-onap/openroadm71/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm71/test/TestOpenRoadmPMDataBuilder.java @@ -64,6 +64,7 @@ import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology. import org.opendaylight.yangtools.yang.binding.DataObject; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.PathArgument; +import org.opendaylight.yangtools.yang.common.Decimal64; import org.opendaylight.yangtools.yang.common.Uint16; import org.opendaylight.yangtools.yang.common.Uint64; @@ -79,7 +80,7 @@ public class TestOpenRoadmPMDataBuilder { private NodeId nodeId = new NodeId("RoadmA"); private HistoricalPmList historicalPmDatalist = mock(HistoricalPmList.class); private HistoricalPm historicalPm = mock(HistoricalPm.class); - private PmDataType pmDataType = new PmDataType(Uint64.valueOf(67508)); + private PmDataType pmDataType = new PmDataType(Decimal64.valueOf(1,67508)); private MeasurementBuilder measurementBuilder = new MeasurementBuilder(); private HistoricalPmBuilder historicalPmBuilder = new HistoricalPmBuilder(); private HistoricalPmEntryBuilder historicalPmEntryBuiler = new HistoricalPmEntryBuilder(); diff --git a/sdnr/wt/featureaggregator/feature-devicemanager-base/pom.xml b/sdnr/wt/featureaggregator/feature-devicemanager-base/pom.xml index 65e675e93..79ff4cbdd 100644 --- a/sdnr/wt/featureaggregator/feature-devicemanager-base/pom.xml +++ b/sdnr/wt/featureaggregator/feature-devicemanager-base/pom.xml @@ -28,7 +28,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>single-feature-parent</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/featureaggregator/feature-devicemanager/pom.xml b/sdnr/wt/featureaggregator/feature-devicemanager/pom.xml index 4bc87cfec..ff13478c5 100644 --- a/sdnr/wt/featureaggregator/feature-devicemanager/pom.xml +++ b/sdnr/wt/featureaggregator/feature-devicemanager/pom.xml @@ -28,7 +28,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>single-feature-parent</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/featureaggregator/feature-oauth/pom.xml b/sdnr/wt/featureaggregator/feature-oauth/pom.xml index 75b9f9493..c31f33d24 100644 --- a/sdnr/wt/featureaggregator/feature-oauth/pom.xml +++ b/sdnr/wt/featureaggregator/feature-oauth/pom.xml @@ -28,7 +28,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>single-feature-parent</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/featureaggregator/feature/pom.xml b/sdnr/wt/featureaggregator/feature/pom.xml index 56bd5973e..dfad5aa5a 100644 --- a/sdnr/wt/featureaggregator/feature/pom.xml +++ b/sdnr/wt/featureaggregator/feature/pom.xml @@ -28,7 +28,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>single-feature-parent</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/featureaggregator/installer/pom.xml b/sdnr/wt/featureaggregator/installer/pom.xml index 655c35a4a..88a96eb8d 100755 --- a/sdnr/wt/featureaggregator/installer/pom.xml +++ b/sdnr/wt/featureaggregator/installer/pom.xml @@ -28,7 +28,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>odlparent-lite</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/featureaggregator/pom.xml b/sdnr/wt/featureaggregator/pom.xml index 47a96e552..aac3d29fa 100755 --- a/sdnr/wt/featureaggregator/pom.xml +++ b/sdnr/wt/featureaggregator/pom.xml @@ -28,7 +28,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>odlparent-lite</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/helpserver/feature/pom.xml b/sdnr/wt/helpserver/feature/pom.xml index 9f10be00e..ff317acc8 100644 --- a/sdnr/wt/helpserver/feature/pom.xml +++ b/sdnr/wt/helpserver/feature/pom.xml @@ -28,7 +28,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>single-feature-parent</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/helpserver/installer/pom.xml b/sdnr/wt/helpserver/installer/pom.xml index 14c9338a1..c156f9a59 100755 --- a/sdnr/wt/helpserver/installer/pom.xml +++ b/sdnr/wt/helpserver/installer/pom.xml @@ -28,7 +28,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>odlparent-lite</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/helpserver/pom.xml b/sdnr/wt/helpserver/pom.xml index ad5dd0ad1..de8cdb32f 100755 --- a/sdnr/wt/helpserver/pom.xml +++ b/sdnr/wt/helpserver/pom.xml @@ -28,7 +28,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>odlparent-lite</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/helpserver/provider/pom.xml b/sdnr/wt/helpserver/provider/pom.xml index 5635ff68e..e30263e87 100644 --- a/sdnr/wt/helpserver/provider/pom.xml +++ b/sdnr/wt/helpserver/provider/pom.xml @@ -28,7 +28,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>binding-parent</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/mountpoint-registrar/feature/pom.xml b/sdnr/wt/mountpoint-registrar/feature/pom.xml index a113f31ec..25b90266b 100644 --- a/sdnr/wt/mountpoint-registrar/feature/pom.xml +++ b/sdnr/wt/mountpoint-registrar/feature/pom.xml @@ -28,7 +28,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>single-feature-parent</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/mountpoint-registrar/installer/pom.xml b/sdnr/wt/mountpoint-registrar/installer/pom.xml index 4282a48b8..5bdb64711 100755 --- a/sdnr/wt/mountpoint-registrar/installer/pom.xml +++ b/sdnr/wt/mountpoint-registrar/installer/pom.xml @@ -28,7 +28,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>odlparent-lite</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/mountpoint-registrar/model/pom.xml b/sdnr/wt/mountpoint-registrar/model/pom.xml index 7e3289a18..bdd19dd6f 100644 --- a/sdnr/wt/mountpoint-registrar/model/pom.xml +++ b/sdnr/wt/mountpoint-registrar/model/pom.xml @@ -28,7 +28,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>binding-parent</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/mountpoint-registrar/pom.xml b/sdnr/wt/mountpoint-registrar/pom.xml index 7ffd4bc87..81d378a3d 100755 --- a/sdnr/wt/mountpoint-registrar/pom.xml +++ b/sdnr/wt/mountpoint-registrar/pom.xml @@ -28,7 +28,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>odlparent-lite</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/mountpoint-registrar/provider/pom.xml b/sdnr/wt/mountpoint-registrar/provider/pom.xml index 3b1f5fba3..5cfd49bda 100644 --- a/sdnr/wt/mountpoint-registrar/provider/pom.xml +++ b/sdnr/wt/mountpoint-registrar/provider/pom.xml @@ -28,7 +28,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>binding-parent</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestMapping.java b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestMapping.java index 02b2bb41e..73f1d7291 100644 --- a/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestMapping.java +++ b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestMapping.java @@ -31,7 +31,7 @@ public class TestMapping { private static Optional<SeverityType> getSeverity(String faultSeverity) { - return SeverityType.forName(faultSeverity); // <-- mapping provided by generated classes. Manual mapping beneficial. + return Optional.ofNullable(SeverityType.forName(faultSeverity)); // <-- mapping provided by generated classes. Manual mapping beneficial. } private String updateFaultPayload(String faultNodeId, String faultCounter, String faultOccurrenceTime, diff --git a/sdnr/wt/mountpoint-state-provider/feature/pom.xml b/sdnr/wt/mountpoint-state-provider/feature/pom.xml index c3491726b..ed2ba3d47 100644 --- a/sdnr/wt/mountpoint-state-provider/feature/pom.xml +++ b/sdnr/wt/mountpoint-state-provider/feature/pom.xml @@ -28,7 +28,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>single-feature-parent</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/mountpoint-state-provider/installer/pom.xml b/sdnr/wt/mountpoint-state-provider/installer/pom.xml index 019116b29..4461eceb5 100755 --- a/sdnr/wt/mountpoint-state-provider/installer/pom.xml +++ b/sdnr/wt/mountpoint-state-provider/installer/pom.xml @@ -28,7 +28,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>odlparent-lite</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/mountpoint-state-provider/pom.xml b/sdnr/wt/mountpoint-state-provider/pom.xml index debbc0e9d..b0cbec4c2 100755 --- a/sdnr/wt/mountpoint-state-provider/pom.xml +++ b/sdnr/wt/mountpoint-state-provider/pom.xml @@ -28,7 +28,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>odlparent-lite</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/mountpoint-state-provider/provider/pom.xml b/sdnr/wt/mountpoint-state-provider/provider/pom.xml index 9e5a2300c..0b14c53c7 100644 --- a/sdnr/wt/mountpoint-state-provider/provider/pom.xml +++ b/sdnr/wt/mountpoint-state-provider/provider/pom.xml @@ -28,7 +28,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>binding-parent</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/netconfnode-state-service/feature/pom.xml b/sdnr/wt/netconfnode-state-service/feature/pom.xml index 52770332b..d517b8235 100644 --- a/sdnr/wt/netconfnode-state-service/feature/pom.xml +++ b/sdnr/wt/netconfnode-state-service/feature/pom.xml @@ -28,7 +28,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>single-feature-parent</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/netconfnode-state-service/installer/pom.xml b/sdnr/wt/netconfnode-state-service/installer/pom.xml index 870df75f1..fcb2c6803 100755 --- a/sdnr/wt/netconfnode-state-service/installer/pom.xml +++ b/sdnr/wt/netconfnode-state-service/installer/pom.xml @@ -28,7 +28,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>odlparent-lite</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/netconfnode-state-service/model/pom.xml b/sdnr/wt/netconfnode-state-service/model/pom.xml index 267d853ea..f6d23af34 100644 --- a/sdnr/wt/netconfnode-state-service/model/pom.xml +++ b/sdnr/wt/netconfnode-state-service/model/pom.xml @@ -28,7 +28,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>binding-parent</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/netconfnode-state-service/pom.xml b/sdnr/wt/netconfnode-state-service/pom.xml index 29cdf0215..6a4f5acef 100755 --- a/sdnr/wt/netconfnode-state-service/pom.xml +++ b/sdnr/wt/netconfnode-state-service/pom.xml @@ -28,7 +28,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>odlparent-lite</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/netconfnode-state-service/provider/pom.xml b/sdnr/wt/netconfnode-state-service/provider/pom.xml index 29b147e30..75b147334 100644 --- a/sdnr/wt/netconfnode-state-service/provider/pom.xml +++ b/sdnr/wt/netconfnode-state-service/provider/pom.xml @@ -28,7 +28,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>binding-parent</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/oauth-provider/pom.xml b/sdnr/wt/oauth-provider/pom.xml index 0be87bee3..2503a4ee6 100755 --- a/sdnr/wt/oauth-provider/pom.xml +++ b/sdnr/wt/oauth-provider/pom.xml @@ -28,7 +28,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>odlparent-lite</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/oauth-provider/provider-jar/pom.xml b/sdnr/wt/oauth-provider/provider-jar/pom.xml index 476e5da31..24489d4a1 100644 --- a/sdnr/wt/oauth-provider/provider-jar/pom.xml +++ b/sdnr/wt/oauth-provider/provider-jar/pom.xml @@ -28,7 +28,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>binding-parent</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/oauth-provider/provider-jar/src/main/java/org/onap/ccsdk/features/sdnr/wt/oauthprovider/filters/CustomizedMDSALDynamicAuthorizationFilter.java b/sdnr/wt/oauth-provider/provider-jar/src/main/java/org/onap/ccsdk/features/sdnr/wt/oauthprovider/filters/CustomizedMDSALDynamicAuthorizationFilter.java index b2523171d..26cdbe773 100644 --- a/sdnr/wt/oauth-provider/provider-jar/src/main/java/org/onap/ccsdk/features/sdnr/wt/oauthprovider/filters/CustomizedMDSALDynamicAuthorizationFilter.java +++ b/sdnr/wt/oauth-provider/provider-jar/src/main/java/org/onap/ccsdk/features/sdnr/wt/oauthprovider/filters/CustomizedMDSALDynamicAuthorizationFilter.java @@ -1,29 +1,11 @@ package org.onap.ccsdk.features.sdnr.wt.oauthprovider.filters; -import static com.google.common.base.Preconditions.checkArgument; -import static java.util.Objects.requireNonNull; - import com.google.common.collect.Iterables; import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; - -import java.io.IOException; -import java.util.*; -import java.util.concurrent.ExecutionException; -import javax.servlet.Filter; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - import org.apache.shiro.subject.Subject; import org.apache.shiro.web.filter.authz.AuthorizationFilter; -import org.opendaylight.aaa.shiro.web.env.ThreadLocals; -import org.opendaylight.mdsal.binding.api.ClusteredDataTreeChangeListener; -import org.opendaylight.mdsal.binding.api.DataBroker; -import org.opendaylight.mdsal.binding.api.DataTreeIdentifier; -import org.opendaylight.mdsal.binding.api.DataTreeModification; -import org.opendaylight.mdsal.binding.api.ReadTransaction; +import org.opendaylight.mdsal.binding.api.*; import org.opendaylight.mdsal.common.api.LogicalDatastoreType; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.aaa.rev161214.HttpAuthorization; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.aaa.rev161214.http.authorization.policies.Policies; @@ -33,7 +15,18 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -@SuppressWarnings("checkstyle:AbbreviationAsWordInName") +import javax.servlet.Filter; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.*; +import java.util.concurrent.ExecutionException; + +import static com.google.common.base.Preconditions.checkArgument; +import static java.util.Objects.requireNonNull; + public class CustomizedMDSALDynamicAuthorizationFilter extends AuthorizationFilter implements ClusteredDataTreeChangeListener<HttpAuthorization> { @@ -46,9 +39,10 @@ public class CustomizedMDSALDynamicAuthorizationFilter extends AuthorizationFilt private ListenerRegistration<?> reg; private volatile ListenableFuture<Optional<HttpAuthorization>> authContainer; + private static final ThreadLocal<DataBroker> DATABROKER_TL = new ThreadLocal<>(); public CustomizedMDSALDynamicAuthorizationFilter() { - dataBroker = requireNonNull(ThreadLocals.DATABROKER_TL.get()); + dataBroker = requireNonNull(DATABROKER_TL.get()); } @Override diff --git a/sdnr/wt/oauth-provider/provider-jar/src/test/java/org/onap/ccsdk/features/sdnr/wt/oauthprovider/test/TestRealm.java b/sdnr/wt/oauth-provider/provider-jar/src/test/java/org/onap/ccsdk/features/sdnr/wt/oauthprovider/test/TestRealm.java index 07efbcec3..c1d3fd1ea 100644 --- a/sdnr/wt/oauth-provider/provider-jar/src/test/java/org/onap/ccsdk/features/sdnr/wt/oauthprovider/test/TestRealm.java +++ b/sdnr/wt/oauth-provider/provider-jar/src/test/java/org/onap/ccsdk/features/sdnr/wt/oauthprovider/test/TestRealm.java @@ -31,6 +31,8 @@ import java.io.IOException; import java.util.Arrays; import java.util.HashSet; import java.util.List; +import java.util.function.Supplier; + import org.apache.shiro.authc.AuthenticationException; import org.apache.shiro.authc.AuthenticationInfo; import org.apache.shiro.authc.AuthenticationToken; @@ -45,20 +47,48 @@ import org.onap.ccsdk.features.sdnr.wt.oauthprovider.data.Config; import org.onap.ccsdk.features.sdnr.wt.oauthprovider.data.UserTokenPayload; import org.onap.ccsdk.features.sdnr.wt.oauthprovider.providers.AuthService; import org.onap.ccsdk.features.sdnr.wt.oauthprovider.providers.TokenCreator; +import org.opendaylight.aaa.api.Authentication; +import org.opendaylight.aaa.api.AuthenticationService; +import org.opendaylight.aaa.api.TokenStore; import org.opendaylight.aaa.api.shiro.principal.ODLPrincipal; -import org.opendaylight.aaa.shiro.web.env.ThreadLocals; +import org.opendaylight.aaa.shiro.realm.TokenAuthRealm; import org.opendaylight.aaa.tokenauthrealm.auth.AuthenticationManager; import org.opendaylight.aaa.tokenauthrealm.auth.TokenAuthenticators; +import org.opendaylight.mdsal.binding.api.DataBroker; public class TestRealm { private static OAuth2RealmToTest realm; private static TokenCreator tokenCreator; + private static final AuthenticationManager authManager = new AuthenticationManager(); + private static final TokenAuthenticators tokenAuth = new TokenAuthenticators(); + + private static final TokenStore tokenStore = new TokenStore(){ + + @Override + public void put(String token, Authentication auth) { + + } + + @Override + public Authentication get(String token) { + return null; + } + + @Override + public boolean delete(String token) { + return false; + } + + @Override + public long tokenExpiration() { + return 0; + } + }; @BeforeClass public static void init() throws IllegalArgumentException, Exception { - ThreadLocals.AUTH_SETVICE_TL.set(new AuthenticationManager()); - ThreadLocals.TOKEN_AUTHENICATORS_TL.set(new TokenAuthenticators()); + TokenAuthRealm.prepareForLoad(authManager,tokenAuth,tokenStore); try { Config config = Config.getInstance(TestConfig.TEST_CONFIG_FILENAME); tokenCreator = TokenCreator.getInstance(config); diff --git a/sdnr/wt/oauth-provider/provider-jar/src/test/java/org/onap/ccsdk/features/sdnr/wt/oauthprovider/test/helper/OdlJsonMapper.java b/sdnr/wt/oauth-provider/provider-jar/src/test/java/org/onap/ccsdk/features/sdnr/wt/oauthprovider/test/helper/OdlJsonMapper.java index 7213f80f5..b0cc0253b 100644 --- a/sdnr/wt/oauth-provider/provider-jar/src/test/java/org/onap/ccsdk/features/sdnr/wt/oauthprovider/test/helper/OdlJsonMapper.java +++ b/sdnr/wt/oauth-provider/provider-jar/src/test/java/org/onap/ccsdk/features/sdnr/wt/oauthprovider/test/helper/OdlJsonMapper.java @@ -29,7 +29,6 @@ import com.fasterxml.jackson.databind.PropertyNamingStrategy; import org.onap.ccsdk.features.sdnr.wt.yang.mapper.mapperextensions.YangToolsBuilderAnnotationIntrospector; import org.onap.ccsdk.features.sdnr.wt.yang.mapper.mapperextensions.YangToolsModule; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.aaa.rev161214.http.permission.Permissions; -import org.opendaylight.yangtools.concepts.Builder; public class OdlJsonMapper extends ObjectMapper { @@ -48,7 +47,7 @@ public class OdlJsonMapper extends ObjectMapper { this.registerModule(new YangToolsModule()); } - public static class PermissionsBuilder implements Builder<Permissions> { + public static class PermissionsBuilder { private Permissions _value; public PermissionsBuilder() { @@ -58,7 +57,7 @@ public class OdlJsonMapper extends ObjectMapper { this._value = value; } - @Override + public Permissions build() { return this._value; } diff --git a/sdnr/wt/oauth-provider/provider-osgi/pom.xml b/sdnr/wt/oauth-provider/provider-osgi/pom.xml index 8a1483a19..98bc2acab 100644 --- a/sdnr/wt/oauth-provider/provider-osgi/pom.xml +++ b/sdnr/wt/oauth-provider/provider-osgi/pom.xml @@ -28,7 +28,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>binding-parent</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/odlux/apps/apiDemo/pom.xml b/sdnr/wt/odlux/apps/apiDemo/pom.xml index f59a3a9b4..b6dc53e93 100644 --- a/sdnr/wt/odlux/apps/apiDemo/pom.xml +++ b/sdnr/wt/odlux/apps/apiDemo/pom.xml @@ -25,7 +25,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>binding-parent</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/odlux/apps/app-feature/pom.xml b/sdnr/wt/odlux/apps/app-feature/pom.xml index a9721e33d..19037cc85 100644 --- a/sdnr/wt/odlux/apps/app-feature/pom.xml +++ b/sdnr/wt/odlux/apps/app-feature/pom.xml @@ -28,7 +28,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>single-feature-parent</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/odlux/apps/app-installer/pom.xml b/sdnr/wt/odlux/apps/app-installer/pom.xml index a292a75fa..5af513ff4 100755 --- a/sdnr/wt/odlux/apps/app-installer/pom.xml +++ b/sdnr/wt/odlux/apps/app-installer/pom.xml @@ -25,7 +25,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>odlparent-lite</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/odlux/apps/configurationApp/pom.xml b/sdnr/wt/odlux/apps/configurationApp/pom.xml index 7110ba077..63475625d 100644 --- a/sdnr/wt/odlux/apps/configurationApp/pom.xml +++ b/sdnr/wt/odlux/apps/configurationApp/pom.xml @@ -25,7 +25,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>binding-parent</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/odlux/apps/connectApp/pom.xml b/sdnr/wt/odlux/apps/connectApp/pom.xml index 8c5e59cf3..c12048ebb 100644 --- a/sdnr/wt/odlux/apps/connectApp/pom.xml +++ b/sdnr/wt/odlux/apps/connectApp/pom.xml @@ -25,7 +25,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>binding-parent</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/odlux/apps/demoApp/pom.xml b/sdnr/wt/odlux/apps/demoApp/pom.xml index 6edf14379..07f990b79 100644 --- a/sdnr/wt/odlux/apps/demoApp/pom.xml +++ b/sdnr/wt/odlux/apps/demoApp/pom.xml @@ -25,7 +25,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>binding-parent</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/odlux/apps/eventLogApp/pom.xml b/sdnr/wt/odlux/apps/eventLogApp/pom.xml index 7d3948bac..19d9ad0c1 100644 --- a/sdnr/wt/odlux/apps/eventLogApp/pom.xml +++ b/sdnr/wt/odlux/apps/eventLogApp/pom.xml @@ -25,7 +25,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>binding-parent</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/odlux/apps/faultApp/pom.xml b/sdnr/wt/odlux/apps/faultApp/pom.xml index 8f563b7fb..31a376014 100644 --- a/sdnr/wt/odlux/apps/faultApp/pom.xml +++ b/sdnr/wt/odlux/apps/faultApp/pom.xml @@ -25,7 +25,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>binding-parent</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/odlux/apps/helpApp/pom.xml b/sdnr/wt/odlux/apps/helpApp/pom.xml index d7bf314e3..9da030913 100644 --- a/sdnr/wt/odlux/apps/helpApp/pom.xml +++ b/sdnr/wt/odlux/apps/helpApp/pom.xml @@ -25,7 +25,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>binding-parent</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/odlux/apps/inventoryApp/pom.xml b/sdnr/wt/odlux/apps/inventoryApp/pom.xml index af5ef5605..e39e26744 100644 --- a/sdnr/wt/odlux/apps/inventoryApp/pom.xml +++ b/sdnr/wt/odlux/apps/inventoryApp/pom.xml @@ -25,7 +25,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>binding-parent</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/odlux/apps/maintenanceApp/pom.xml b/sdnr/wt/odlux/apps/maintenanceApp/pom.xml index 303034b19..f70e5fd05 100644 --- a/sdnr/wt/odlux/apps/maintenanceApp/pom.xml +++ b/sdnr/wt/odlux/apps/maintenanceApp/pom.xml @@ -25,7 +25,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>binding-parent</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/odlux/apps/mediatorApp/pom.xml b/sdnr/wt/odlux/apps/mediatorApp/pom.xml index 85dbe2369..2f8a147de 100644 --- a/sdnr/wt/odlux/apps/mediatorApp/pom.xml +++ b/sdnr/wt/odlux/apps/mediatorApp/pom.xml @@ -25,7 +25,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>binding-parent</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/odlux/apps/minimumApp/pom.xml b/sdnr/wt/odlux/apps/minimumApp/pom.xml index 4c21dac29..57b08836b 100644 --- a/sdnr/wt/odlux/apps/minimumApp/pom.xml +++ b/sdnr/wt/odlux/apps/minimumApp/pom.xml @@ -25,7 +25,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>binding-parent</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/odlux/apps/performanceHistoryApp/pom.xml b/sdnr/wt/odlux/apps/performanceHistoryApp/pom.xml index f70f6ba5f..9c594efb1 100644 --- a/sdnr/wt/odlux/apps/performanceHistoryApp/pom.xml +++ b/sdnr/wt/odlux/apps/performanceHistoryApp/pom.xml @@ -25,7 +25,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>binding-parent</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/odlux/core/features/pom.xml b/sdnr/wt/odlux/core/features/pom.xml index 73a9a49f9..59d333be6 100644 --- a/sdnr/wt/odlux/core/features/pom.xml +++ b/sdnr/wt/odlux/core/features/pom.xml @@ -28,7 +28,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>single-feature-parent</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/odlux/core/installer/pom.xml b/sdnr/wt/odlux/core/installer/pom.xml index 3ead8acba..546873978 100755 --- a/sdnr/wt/odlux/core/installer/pom.xml +++ b/sdnr/wt/odlux/core/installer/pom.xml @@ -25,7 +25,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>odlparent-lite</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/odlux/core/model/pom.xml b/sdnr/wt/odlux/core/model/pom.xml index 5c2d131cf..745ded7e2 100644 --- a/sdnr/wt/odlux/core/model/pom.xml +++ b/sdnr/wt/odlux/core/model/pom.xml @@ -25,7 +25,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>binding-parent</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/odlux/core/pom.xml b/sdnr/wt/odlux/core/pom.xml index 389eff8da..380c92e77 100644 --- a/sdnr/wt/odlux/core/pom.xml +++ b/sdnr/wt/odlux/core/pom.xml @@ -25,7 +25,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>odlparent-lite</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/odlux/core/provider/pom.xml b/sdnr/wt/odlux/core/provider/pom.xml index 9a45045db..b40978532 100644 --- a/sdnr/wt/odlux/core/provider/pom.xml +++ b/sdnr/wt/odlux/core/provider/pom.xml @@ -25,7 +25,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>binding-parent</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/odlux/framework/pom.xml b/sdnr/wt/odlux/framework/pom.xml index 67d41248f..414f49827 100644 --- a/sdnr/wt/odlux/framework/pom.xml +++ b/sdnr/wt/odlux/framework/pom.xml @@ -25,7 +25,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>odlparent</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/odlux/installer/pom.xml b/sdnr/wt/odlux/installer/pom.xml index 722f85373..33aa48d89 100644 --- a/sdnr/wt/odlux/installer/pom.xml +++ b/sdnr/wt/odlux/installer/pom.xml @@ -25,7 +25,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>odlparent-lite</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/odlux/pom.xml b/sdnr/wt/odlux/pom.xml index e26d8c56e..2d91a4ba6 100644 --- a/sdnr/wt/odlux/pom.xml +++ b/sdnr/wt/odlux/pom.xml @@ -25,7 +25,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>odlparent-lite</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/pom.xml b/sdnr/wt/pom.xml index 9aab8104f..6aba8d70c 100644 --- a/sdnr/wt/pom.xml +++ b/sdnr/wt/pom.xml @@ -24,7 +24,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>odlparent-lite</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/readthedocs/pom.xml b/sdnr/wt/readthedocs/pom.xml index 205d7f901..13b790dfd 100644 --- a/sdnr/wt/readthedocs/pom.xml +++ b/sdnr/wt/readthedocs/pom.xml @@ -25,7 +25,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>odlparent-lite</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/websocketmanager/feature/pom.xml b/sdnr/wt/websocketmanager/feature/pom.xml index 851e13111..e0ef49b00 100644 --- a/sdnr/wt/websocketmanager/feature/pom.xml +++ b/sdnr/wt/websocketmanager/feature/pom.xml @@ -28,7 +28,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>single-feature-parent</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/websocketmanager/installer/pom.xml b/sdnr/wt/websocketmanager/installer/pom.xml index 5eeb462d6..09af75374 100755 --- a/sdnr/wt/websocketmanager/installer/pom.xml +++ b/sdnr/wt/websocketmanager/installer/pom.xml @@ -28,7 +28,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>odlparent-lite</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/websocketmanager/model/pom.xml b/sdnr/wt/websocketmanager/model/pom.xml index c2f816ae7..b21533802 100644 --- a/sdnr/wt/websocketmanager/model/pom.xml +++ b/sdnr/wt/websocketmanager/model/pom.xml @@ -28,7 +28,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>binding-parent</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/websocketmanager/pom.xml b/sdnr/wt/websocketmanager/pom.xml index af749e5c1..bd30e2ac0 100755 --- a/sdnr/wt/websocketmanager/pom.xml +++ b/sdnr/wt/websocketmanager/pom.xml @@ -28,7 +28,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>odlparent-lite</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> diff --git a/sdnr/wt/websocketmanager/provider/pom.xml b/sdnr/wt/websocketmanager/provider/pom.xml index 3b96d3295..db7ac81bb 100644 --- a/sdnr/wt/websocketmanager/provider/pom.xml +++ b/sdnr/wt/websocketmanager/provider/pom.xml @@ -28,7 +28,7 @@ <parent> <groupId>org.onap.ccsdk.parent</groupId> <artifactId>binding-parent</artifactId> - <version>2.5.3</version> + <version>2.5.4-SNAPSHOT</version> <relativePath/> </parent> |