diff options
Diffstat (limited to 'sdnr/wt/devicemanager-onap/openroadm')
64 files changed, 14646 insertions, 0 deletions
diff --git a/sdnr/wt/devicemanager-onap/openroadm/feature/pom.xml b/sdnr/wt/devicemanager-onap/openroadm/feature/pom.xml new file mode 100644 index 000000000..54f1f49e6 --- /dev/null +++ b/sdnr/wt/devicemanager-onap/openroadm/feature/pom.xml @@ -0,0 +1,48 @@ +<?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>single-feature-parent</artifactId> + <version>2.2.0-SNAPSHOT</version> + <relativePath/> + </parent> + + <groupId>org.onap.ccsdk.features.sdnr.wt</groupId> + <artifactId>sdnr-wt-devicemanager-onap-openroadm-feature</artifactId> + <version>1.2.0-SNAPSHOT</version> + <packaging>feature</packaging> + + <name>ccsdk-features :: ${project.artifactId}</name> + + <dependencies> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>sdnr-wt-devicemanager-onap-openroadm-provider</artifactId> + <version>${project.version}</version> + </dependency> + </dependencies> +</project> diff --git a/sdnr/wt/devicemanager-onap/openroadm/installer/pom.xml b/sdnr/wt/devicemanager-onap/openroadm/installer/pom.xml new file mode 100755 index 000000000..c07ce11f8 --- /dev/null +++ b/sdnr/wt/devicemanager-onap/openroadm/installer/pom.xml @@ -0,0 +1,113 @@ +<?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>odlparent-lite</artifactId> + <version>2.2.0-SNAPSHOT</version> + <relativePath/> + </parent> + + <groupId>org.onap.ccsdk.features.sdnr.wt</groupId> + <artifactId>sdnr-wt-devicemanager-onap-openroadm-installer</artifactId> + <version>1.2.0-SNAPSHOT</version> + <packaging>pom</packaging> + + <name>ccsdk-features :: ${project.artifactId}</name> + + <properties> + <application.name>sdnr-wt-devicemanager-onap-openroadm</application.name> + <include.transitive.dependencies>false</include.transitive.dependencies> + </properties> + + <dependencies> + <dependency> + <groupId>org.onap.ccsdk.features.sdnr.wt</groupId> + <artifactId>${application.name}-feature</artifactId> + <version>${project.version}</version> + <type>xml</type> + <classifier>features</classifier> + <exclusions> + <exclusion> + <groupId>*</groupId> + <artifactId>*</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.features.sdnr.wt</groupId> + <artifactId>${application.name}-provider</artifactId> + <version>${project.version}</version> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <artifactId>maven-assembly-plugin</artifactId> + <executions> + <execution> + <id>maven-repo-zip</id> + <goals> + <goal>single</goal> + </goals> + <phase>package</phase> + <configuration> + <attach>true</attach> + <finalName>stage/${application.name}-${project.version}</finalName> + <descriptors> + <descriptor>src/assembly/assemble_mvnrepo_zip.xml</descriptor> + </descriptors> + <appendAssemblyId>true</appendAssemblyId> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> + <executions> + <execution> + <id>copy-nested-dependencies</id> + <goals> + <goal>copy-dependencies</goal> + </goals> + <phase>prepare-package</phase> + <configuration> + <transitive>true</transitive> + <outputDirectory>${project.build.directory}/assembly/system</outputDirectory> + <overWriteReleases>false</overWriteReleases> + <overWriteSnapshots>true</overWriteSnapshots> + <overWriteIfNewer>true</overWriteIfNewer> + <useRepositoryLayout>true</useRepositoryLayout> + <addParentPoms>false</addParentPoms> + <copyPom>false</copyPom> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project> diff --git a/sdnr/wt/devicemanager-onap/openroadm/installer/src/assembly/assemble_mvnrepo_zip.xml b/sdnr/wt/devicemanager-onap/openroadm/installer/src/assembly/assemble_mvnrepo_zip.xml new file mode 100644 index 000000000..dfe5060bf --- /dev/null +++ b/sdnr/wt/devicemanager-onap/openroadm/installer/src/assembly/assemble_mvnrepo_zip.xml @@ -0,0 +1,47 @@ +<!-- + ~ ============LICENSE_START======================================================= + ~ ONAP : ccsdk features + ~ ================================================================================ + ~ Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved. + ~ ================================================================================ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License. + ~ ============LICENSE_END======================================================= + ~ + --> + +<!-- Defines how we build the .zip file which is our distribution. --> + +<assembly + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" + xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd"> + <id>repo</id> + <formats> + <format>zip</format> + </formats> + + <!-- we want "system" and related files right at the root level + as this file is suppose to be unzip on top of a karaf + distro. --> + <includeBaseDirectory>false</includeBaseDirectory> + + <fileSets> + <fileSet> + <directory>target/assembly/</directory> + <outputDirectory>.</outputDirectory> + <excludes> + </excludes> + </fileSet> + </fileSets> + +</assembly> diff --git a/sdnr/wt/devicemanager-onap/openroadm/model/pom.xml b/sdnr/wt/devicemanager-onap/openroadm/model/pom.xml new file mode 100644 index 000000000..923f29693 --- /dev/null +++ b/sdnr/wt/devicemanager-onap/openroadm/model/pom.xml @@ -0,0 +1,70 @@ +<?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.2.0-SNAPSHOT</version> + <relativePath/> + </parent> + + <groupId>org.onap.ccsdk.features.sdnr.wt</groupId> + <artifactId>sdnr-wt-devicemanager-onap-openroadm-model</artifactId> + <version>1.2.0-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> + + <properties> + <maven.javadoc.skip>true</maven.javadoc.skip> + </properties> + + <dependencies> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.jacoco</groupId> + <artifactId>jacoco-maven-plugin</artifactId> + <configuration> + <excludes> + <exclude>**/gen/**</exclude> + <exclude>**/generated-sources/**</exclude> + <exclude>**/yang-gen-sal/**</exclude> + <exclude>**/pax/**</exclude> + </excludes> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/sdnr/wt/devicemanager-onap/openroadm/model/src/main/yang/devicemanager-openroadm.yang b/sdnr/wt/devicemanager-onap/openroadm/model/src/main/yang/devicemanager-openroadm.yang new file mode 100644 index 000000000..b1f7980db --- /dev/null +++ b/sdnr/wt/devicemanager-onap/openroadm/model/src/main/yang/devicemanager-openroadm.yang @@ -0,0 +1,37 @@ +module devicemanager-openroadm{ + + yang-version 1; + namespace "urn:opendaylight:params:xml:ns:yang:devicemanager-openroadm"; + prefix devicemanager-openroadm; + + organization + "highstreet technologies GmbH"; + contact + "Web: <https://highstreet-technologies.com> + O-RAN: <https://wiki.o-ran-sc.org/display/OAM/Operations+and+Maintenance"; + + description + "DeviceManager openroadm Module + + Copyright 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."; + + revision 2020-03-02 { + description + "Initial revision"; + reference + "Implementation of openroadm"; + } +} diff --git a/sdnr/wt/devicemanager-onap/openroadm/pom.xml b/sdnr/wt/devicemanager-onap/openroadm/pom.xml new file mode 100755 index 000000000..fe585c325 --- /dev/null +++ b/sdnr/wt/devicemanager-onap/openroadm/pom.xml @@ -0,0 +1,60 @@ +<?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>odlparent-lite</artifactId> + <version>2.2.0-SNAPSHOT</version> + <relativePath/> + </parent> + + <groupId>org.onap.ccsdk.features.sdnr.wt</groupId> + <artifactId>sdnr-wt-devicemanager-onap-openroadm-top</artifactId> + <version>1.2.0-SNAPSHOT</version> + <packaging>pom</packaging> + + <name>ccsdk-features :: ${project.artifactId}</name> + + <modules> + <module>model</module> + <module>provider</module> + <module>feature</module> + <module>installer</module> + </modules> + + <properties> + <feature-name>sdnr-wt-devicemanager-onap-openroadm</feature-name> + </properties> + <!-- <reporting> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-project-info-reports-plugin</artifactId> + <version>2.9</version> + </plugin> + </plugins> + </reporting> --> +</project> diff --git a/sdnr/wt/devicemanager-onap/openroadm/provider/copyright b/sdnr/wt/devicemanager-onap/openroadm/provider/copyright new file mode 100644 index 000000000..754b6218f --- /dev/null +++ b/sdnr/wt/devicemanager-onap/openroadm/provider/copyright @@ -0,0 +1,17 @@ +/** + * ============LICENSE_START======================================================================== + * ONAP : ccsdk feature sdnr wt + * ================================================================================================= + * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved. + * ================================================================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + * ============LICENSE_END========================================================================== + */ diff --git a/sdnr/wt/devicemanager-onap/openroadm/provider/pom.xml b/sdnr/wt/devicemanager-onap/openroadm/provider/pom.xml new file mode 100644 index 000000000..c1f50fb55 --- /dev/null +++ b/sdnr/wt/devicemanager-onap/openroadm/provider/pom.xml @@ -0,0 +1,121 @@ +<?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.2.0-SNAPSHOT</version> + <relativePath/> + </parent> + + <groupId>org.onap.ccsdk.features.sdnr.wt</groupId> + <artifactId>sdnr-wt-devicemanager-onap-openroadm-provider</artifactId> + <version>1.2.0-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> + + <properties> + <maven.javadoc.skip>true</maven.javadoc.skip> + <maven.build.timestamp.format>yyyy-MM-dd HH:mm</maven.build.timestamp.format> + <buildtime>${maven.build.timestamp} UTC</buildtime> + </properties> + + <dependencies> + <!-- begin for testing --> + <dependency> + <groupId>org.mockito</groupId> + <artifactId>mockito-core</artifactId> + <version>2.28.2</version> + <scope>test</scope> + </dependency> + <dependency> + <artifactId>byte-buddy</artifactId> + <groupId>net.bytebuddy</groupId> + <version>1.9.10</version> + <scope>test</scope> + </dependency> + + <!-- end for testing --> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>sdnr-wt-devicemanager-onap-openroadm-model</artifactId> + <version>${project.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>sdnr-wt-devicemanager-core-model</artifactId> + <version>${project.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>sdnr-wt-netconfnode-state-service-model</artifactId> + <version>${project.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.opendaylight.netconf</groupId> + <artifactId>sal-netconf-connector</artifactId> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.osgi</groupId> + <artifactId>org.osgi.core</artifactId> + <scope>provided</scope> + </dependency> + </dependencies> + + <build> + <resources> + <resource> + <directory>src/main/resources</directory> + <filtering>true</filtering> + </resource> + </resources> + <plugins> + <plugin> + <groupId>org.jacoco</groupId> + <artifactId>jacoco-maven-plugin</artifactId> + <configuration> + <excludes> + <exclude>**/gen/**</exclude> + <exclude>**/generated-sources/**</exclude> + <exclude>**/yang-gen-sal/**</exclude> + <exclude>**/pax/**</exclude> + </excludes> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/DeviceManagerOpenroadmImpl.java b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/DeviceManagerOpenroadmImpl.java new file mode 100644 index 000000000..e522f4bd7 --- /dev/null +++ b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/DeviceManagerOpenroadmImpl.java @@ -0,0 +1,103 @@ +/* + * ============LICENSE_START======================================================= + * ONAP : ccsdk features + * ================================================================================ + * Copyright (C) 2020 highstreet technologies GmbH Intellectual Property. + * All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + * + */ +package org.onap.ccsdk.features.sdnr.wt.devicemanager.openroadm.impl; + +import org.onap.ccsdk.features.sdnr.wt.common.database.HtDatabaseClient; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.ne.factory.FactoryRegistration; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.NetconfNetworkElementService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * @author Shabnam Sultana + * + * Class to initialize the OpenRoadm Device Manager + **/ +public class DeviceManagerOpenroadmImpl implements AutoCloseable { + + // variables + private static final Logger LOG = LoggerFactory.getLogger(DeviceManagerOpenroadmImpl.class); + private static final String APPLICATION_NAME = "DeviceManagerOpenRoadm"; + @SuppressWarnings("unused") + private static final String CONFIGURATIONFILE = "etc/devicemanager-opeenroadm.properties"; + private NetconfNetworkElementService netconfNetworkElementService; + private HtDatabaseClient htDatabaseClient; + private Boolean devicemanagerInitializationOk = false; + private FactoryRegistration<OpenroadmNetworkElementFactory> resOpenRoadm; + // end of variables + + // Blueprint begin + // constructors + public DeviceManagerOpenroadmImpl() { + LOG.info("Creating provider for {}", APPLICATION_NAME); + resOpenRoadm = null; + } + // end of constructors + + // public methods + public void setNetconfNetworkElementService(NetconfNetworkElementService netconfNetworkElementService) { + this.netconfNetworkElementService = netconfNetworkElementService; + } + + public void init() throws Exception { + + LOG.info("Session Initiated start {}", APPLICATION_NAME); + + resOpenRoadm = netconfNetworkElementService.registerBindingNetworkElementFactory(new OpenroadmNetworkElementFactory()); + + + netconfNetworkElementService.writeToEventLog(APPLICATION_NAME, "startup", "done"); + this.devicemanagerInitializationOk = true; + + LOG.info("Session Initiated end. Initialization done {}", devicemanagerInitializationOk); + } + // Blueprint end + + @Override + public void close() throws Exception { + LOG.info("closing ..."); + close(htDatabaseClient); + close(resOpenRoadm); + LOG.info("closing done"); + } + // end of public methods + + // private methods + /** + * Used to close all Services, that should support AutoCloseable Pattern + * + * @param toClose + * @throws Exception + */ + private void close(AutoCloseable... toCloseList) { + for (AutoCloseable element : toCloseList) { + if (element != null) { + try { + element.close(); + } catch (Exception e) { + LOG.warn("Fail during close: ", e); + } + } + } + } + // end of private methods +} 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 new file mode 100644 index 000000000..6c8837327 --- /dev/null +++ b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/InitialDeviceAlarmReader.java @@ -0,0 +1,156 @@ +/* + * ============LICENSE_START======================================================= + * ONAP : ccsdk features + * ================================================================================ + * Copyright (C) 2020 highstreet technologies GmbH Intellectual Property. + * All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + * + */ +package org.onap.ccsdk.features.sdnr.wt.devicemanager.openroadm.impl; + +import java.util.Collection; +import java.util.List; +import org.eclipse.jdt.annotation.NonNull; +import org.onap.ccsdk.features.sdnr.wt.common.YangHelper; +import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DataProvider; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServiceProvider; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.FaultService; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.types.FaultData; +import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfBindingAccessor; +import org.opendaylight.mdsal.common.api.LogicalDatastoreType; +import org.opendaylight.yang.gen.v1.http.org.openroadm.alarm.rev191129.ActiveAlarmList; +import org.opendaylight.yang.gen.v1.http.org.openroadm.alarm.rev191129.Severity; +import org.opendaylight.yang.gen.v1.http.org.openroadm.alarm.rev191129.active.alarm.list.ActiveAlarms; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.Faultlog; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SeverityType; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * @author Shabnam Sultana + * + * Class to read the initial alarms at the time of device registration + * + **/ + +public class InitialDeviceAlarmReader { + // variables + private Integer count = 1; + private static final Logger log = LoggerFactory.getLogger(InitialDeviceAlarmReader.class); + private final NetconfBindingAccessor netConfAccesor; + private final @NonNull FaultService faultEventListener; + private final DataProvider dataProvider; + // end of variables + + // constructors + public InitialDeviceAlarmReader(NetconfBindingAccessor accessor, DeviceManagerServiceProvider serviceProvider) { + this.netConfAccesor = accessor; + this.faultEventListener = serviceProvider.getFaultService(); + this.dataProvider = serviceProvider.getDataProvider(); + } + // end of constructors + + // protected methods + // Mapping the alarm data with the fault data + protected FaultData writeFaultData() { + FaultData faultData = new FaultData(); + if (this.getActiveAlarmList(this.netConfAccesor).getActiveAlarms() != null) { + Collection<ActiveAlarms> activeAlarms = YangHelper.getCollection(this.getActiveAlarmList(this.netConfAccesor).getActiveAlarms()); + if (!activeAlarms.isEmpty()) { + for (ActiveAlarms activeAlarm : activeAlarms) { + faultData.add(this.netConfAccesor.getNodeId(), this.count, activeAlarm.getRaiseTime(), + activeAlarm.getResource().getDevice().getNodeId().getValue(), + activeAlarm.getProbableCause().getCause().getName(), + checkSeverityValue(activeAlarm.getSeverity())); + count = count + 1; + } + return faultData; + } + } + return faultData; + } + + // Write into the FaultLog + protected void writeAlarmLog(FaultData faultData) { + if (faultData != null) { + List<Faultlog> faultLog = faultData.getProblemList(); + for (Faultlog fe : faultLog) { + this.dataProvider.writeFaultLog(fe); + } + } + } + + // Use the FaultService for Alarm notifications + protected void faultService() { + this.faultEventListener.initCurrentProblemStatus(this.netConfAccesor.getNodeId(), writeFaultData()); + writeAlarmLog(writeFaultData()); + } + // Mapping Severity of AlarmNotification to SeverityType of FaultLog + protected static SeverityType checkSeverityValue(Severity severity) { + SeverityType severityType = null; + log.info("Device Severity: {}", severity.getName()); + + switch (severity.getName()) { + case ("warning"): + severityType = SeverityType.Warning; + break; + case ("major"): + severityType = SeverityType.Major; + break; + case ("minor"): + severityType = SeverityType.Minor; + break; + case ("clear"): + severityType = SeverityType.NonAlarmed; + break; + case ("critical"): + severityType = SeverityType.Critical; + break; + case ("indeterminate"): + severityType = SeverityType.Critical; + break; + default: + severityType = SeverityType.Critical; + break; + + } + return severityType; + + } + // end of protected methods + + // private methods + + // Read Alarm Data + private ActiveAlarmList getActiveAlarmList(NetconfBindingAccessor accessor) { + final Class<ActiveAlarmList> classAlarm = ActiveAlarmList.class; + log.info("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); + return alarmData; + } + + + // end of private methods + + + +} diff --git a/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/OpenroadmChangeNotificationListener.java b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/OpenroadmChangeNotificationListener.java new file mode 100644 index 000000000..3af6d7aca --- /dev/null +++ b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/OpenroadmChangeNotificationListener.java @@ -0,0 +1,130 @@ +/* + * ============LICENSE_START======================================================= + * ONAP : ccsdk features + * ================================================================================ + * Copyright (C) 2020 highstreet technologies GmbH Intellectual Property. + * All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + * + */ +package org.onap.ccsdk.features.sdnr.wt.devicemanager.openroadm.impl; + +import java.util.List; +import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DataProvider; +import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.types.NetconfTimeStampImpl; +import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfAccessor; +import org.onap.ccsdk.features.sdnr.wt.websocketmanager.model.WebsocketManagerService; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.notifications.rev120206.IetfNetconfNotificationsListener; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.notifications.rev120206.NetconfCapabilityChange; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.notifications.rev120206.NetconfConfigChange; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.notifications.rev120206.NetconfConfirmedCommit; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.notifications.rev120206.NetconfSessionEnd; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.notifications.rev120206.NetconfSessionStart; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.notifications.rev120206.netconf.config.change.Edit; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.EventlogBuilder; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.PathArgument; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + + +/** + * @author Shabnam Sultana + * + * Listener for change notifications + * + **/ +public class OpenroadmChangeNotificationListener implements IetfNetconfNotificationsListener { + + // variables + private static final Logger log = LoggerFactory.getLogger(OpenroadmChangeNotificationListener.class); + private final NetconfAccessor netconfAccessor; + private final DataProvider databaseService; + private final WebsocketManagerService notificationServiceService; + // end of variables + + // constructors + public OpenroadmChangeNotificationListener(NetconfAccessor netconfAccessor, DataProvider databaseService, + WebsocketManagerService notificationService) { + this.netconfAccessor = netconfAccessor; + this.databaseService = databaseService; + this.notificationServiceService = notificationService; + } + // end of constructors + + // public methods + @Override + public void onNetconfConfirmedCommit(NetconfConfirmedCommit notification) { + log.info("onNetconfConfirmedCommit {} ", notification); + this.notificationServiceService.sendNotification(notification, this.netconfAccessor.getNodeId().getValue(), + NetconfConfirmedCommit.QNAME, NetconfTimeStampImpl.getConverter().getTimeStamp()); + } + + @Override + public void onNetconfSessionStart(NetconfSessionStart notification) { + log.info("onNetconfSessionStart {} ", notification); + this.notificationServiceService.sendNotification(notification, this.netconfAccessor.getNodeId().getValue(), + NetconfSessionStart.QNAME, NetconfTimeStampImpl.getConverter().getTimeStamp()); + + } + + @Override + public void onNetconfSessionEnd(NetconfSessionEnd notification) { + log.info("onNetconfSessionEnd {}", notification); + this.notificationServiceService.sendNotification(notification, this.netconfAccessor.getNodeId().getValue(), + NetconfSessionEnd.QNAME, NetconfTimeStampImpl.getConverter().getTimeStamp()); + } + + @Override + public void onNetconfCapabilityChange(NetconfCapabilityChange notification) { + log.info("onNetconfCapabilityChange {}", notification); + this.notificationServiceService.sendNotification(notification, this.netconfAccessor.getNodeId().getValue(), + NetconfCapabilityChange.QNAME, NetconfTimeStampImpl.getConverter().getTimeStamp()); + } + + @Override + public void onNetconfConfigChange(NetconfConfigChange notification) { + log.info("onNetconfConfigChange (1) {}", notification); + StringBuffer sb = new StringBuffer(); + List<Edit> editList = notification.nonnullEdit(); + for (Edit edit : editList) { + if (sb.length() > 0) { + sb.append(", "); + } + sb.append(edit); + + EventlogBuilder eventlogBuilder = new EventlogBuilder(); + + InstanceIdentifier<?> target = edit.getTarget(); + if (target != null) { + eventlogBuilder.setObjectId(target.toString()); + log.info("TARGET: {} {}", target.getClass(), target.getTargetType()); + for (PathArgument pa : target.getPathArguments()) { + log.info("PathArgument {}", pa); + } + } + eventlogBuilder.setNodeId(netconfAccessor.getNodeId().getValue()); + eventlogBuilder.setNewValue(String.valueOf(edit.getOperation())); + databaseService.writeEventLog(eventlogBuilder.build()); + } + log.info("onNetconfConfigChange (2) {}", sb); + this.notificationServiceService.sendNotification(notification, this.netconfAccessor.getNodeId().getValue(), + NetconfConfigChange.QNAME, NetconfTimeStampImpl.getConverter().getTimeStamp()); + + } + + // 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/OpenroadmDeviceChangeNotificationListener.java b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/OpenroadmDeviceChangeNotificationListener.java new file mode 100644 index 000000000..daea1adb3 --- /dev/null +++ b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/OpenroadmDeviceChangeNotificationListener.java @@ -0,0 +1,129 @@ +/* + * ============LICENSE_START======================================================= + * ONAP : ccsdk features + * ================================================================================ + * Copyright (C) 2020 highstreet technologies GmbH Intellectual Property. + * All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + * + */ +package org.onap.ccsdk.features.sdnr.wt.devicemanager.openroadm.impl; + +import java.util.List; +import org.eclipse.jdt.annotation.NonNull; +import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DataProvider; +import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.NetconfTimeStamp; +import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.types.NetconfTimeStampImpl; +import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfAccessor; +import org.onap.ccsdk.features.sdnr.wt.websocketmanager.model.WebsocketManagerService; +import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev191129.ChangeNotification; +import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev191129.CreateTechInfoNotification; +import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev191129.OrgOpenroadmDeviceListener; +import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev191129.OtdrScanResult; +import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev191129.change.notification.Edit; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.EventlogBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SourceType; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.PathArgument; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * @author Shabnam Sultana + * + * Listener for Open roadm device specific change notifications + **/ + +public class OpenroadmDeviceChangeNotificationListener implements OrgOpenroadmDeviceListener { + // variables + private static final Logger log = LoggerFactory.getLogger(OpenroadmDeviceChangeNotificationListener.class); + private Integer counter = 1; + private final NetconfAccessor netconfAccessor; + private final DataProvider databaseProvider; + private final WebsocketManagerService notificationServiceService; + private static final NetconfTimeStamp ncTimeConverter = NetconfTimeStampImpl.getConverter(); + // end of variables + + // constructors + public OpenroadmDeviceChangeNotificationListener(NetconfAccessor netconfAccessor, DataProvider databaseService, + WebsocketManagerService faultService) { + this.netconfAccessor = netconfAccessor; + this.databaseProvider = databaseService; + this.notificationServiceService = faultService; + } + // end of constructors + + // public methods + @Override + public void onOtdrScanResult(OtdrScanResult notification) { + // TODO Auto-generated method stub + + } + + @Override + public void onChangeNotification(ChangeNotification notification) { + log.info("onDeviceConfigChange(1){}", notification); + StringBuffer sb = new StringBuffer(); + + @NonNull + List<Edit> editList = notification.nonnullEdit(); + for (Edit edit : editList) { + if (sb.length() > 0) { + sb.append(", "); + } + sb.append(edit); + EventlogBuilder eventlogBuilder = new EventlogBuilder(); + InstanceIdentifier<?> target = edit.getTarget(); + if (target != null) { + eventlogBuilder.setObjectId(target.getPathArguments().toString()); + log.info("TARGET: {} {}", target.getClass(), target.getTargetType()); + for (PathArgument pa : target.getPathArguments()) { + log.info("PathArgument {}", pa); + } + eventlogBuilder.setAttributeName(target.getTargetType().getName()); + } + eventlogBuilder.setNodeId(netconfAccessor.getNodeId().getValue()); + eventlogBuilder.setNewValue(String.valueOf(edit.getOperation())); + eventlogBuilder.setTimestamp(notification.getChangeTime()); + eventlogBuilder.setCounter(counter); + eventlogBuilder.setSourceType(SourceType.Netconf); + databaseProvider.writeEventLog(eventlogBuilder.build()); + log.info("onDeviceConfigChange (2) {}", sb); + counter++; + } + this.notificationServiceService.sendNotification(notification, this.netconfAccessor.getNodeId().getValue(), + ChangeNotification.QNAME, notification.getChangeTime()); + } + + @Override + public void onCreateTechInfoNotification(CreateTechInfoNotification notification) { + + DateAndTime now = NetconfTimeStampImpl.getConverter().getTimeStamp(); + log.info("onCreateTechInfoNotification(1){}", notification); + EventlogBuilder eventlogBuilder = new EventlogBuilder(); + eventlogBuilder.setId(notification.getShelfId()).setAttributeName(notification.getShelfId()) + .setObjectId(notification.getShelfId()).setNodeId(this.netconfAccessor.getNodeId().getValue()) + .setCounter(counter).setNewValue(notification.getStatus().getName()).setSourceType(SourceType.Netconf) + .setTimestamp(now); + databaseProvider.writeEventLog(eventlogBuilder.build()); + this.notificationServiceService.sendNotification(notification, this.netconfAccessor.getNodeId().getValue(), + CreateTechInfoNotification.QNAME, now); + log.info("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 new file mode 100644 index 000000000..10d0a5640 --- /dev/null +++ b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/OpenroadmFaultNotificationListener.java @@ -0,0 +1,78 @@ +/* + * ============LICENSE_START======================================================= + * ONAP : ccsdk features + * ================================================================================ + * Copyright (C) 2020 highstreet technologies GmbH Intellectual Property. + * All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + * + */ +package org.onap.ccsdk.features.sdnr.wt.devicemanager.openroadm.impl; + + +import org.eclipse.jdt.annotation.NonNull; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServiceProvider; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.FaultService; +import org.onap.ccsdk.features.sdnr.wt.websocketmanager.model.WebsocketManagerService; +import org.opendaylight.yang.gen.v1.http.org.openroadm.alarm.rev191129.AlarmNotification; +import org.opendaylight.yang.gen.v1.http.org.openroadm.alarm.rev191129.OrgOpenroadmAlarmListener; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.FaultlogBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.FaultlogEntity; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SourceType; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * @author Shabnam Sultana + * + * Listener for Open roadm device specific alarm notifications + **/ +public class OpenroadmFaultNotificationListener implements OrgOpenroadmAlarmListener { + private static final Logger log = LoggerFactory.getLogger(OpenroadmFaultNotificationListener.class); + + private final @NonNull FaultService faultEventListener; + private @NonNull WebsocketManagerService notificationService; + private Integer count = 1; + + + public OpenroadmFaultNotificationListener(DeviceManagerServiceProvider serviceProvider) { + this.faultEventListener = serviceProvider.getFaultService(); + this.notificationService = serviceProvider.getWebsocketService(); + + } + + @Override + public void onAlarmNotification(AlarmNotification notification) { + + + log.info("AlarmNotification {} \t {}", notification.getId(), notification.getAdditionalDetail()); + final String nodeId = notification.getResource().getDevice().getNodeId().getValue(); + FaultlogEntity faultAlarm = new FaultlogBuilder().setObjectId(notification.getCircuitId()) + .setProblem(notification.getProbableCause().getCause().getName()).setSourceType(SourceType.Netconf) + .setTimestamp(notification.getRaiseTime()).setId(notification.getId()).setNodeId(nodeId) + .setSeverity(InitialDeviceAlarmReader.checkSeverityValue(notification.getSeverity())).setCounter(count) + .build(); + + this.faultEventListener.faultNotification(faultAlarm); + this.notificationService.sendNotification(notification, nodeId, AlarmNotification.QNAME, + notification.getRaiseTime()); + count++; + log.info("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 new file mode 100644 index 000000000..abaec72ab --- /dev/null +++ b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/OpenroadmInventoryInput.java @@ -0,0 +1,149 @@ +/* + * ============LICENSE_START======================================================= + * ONAP : ccsdk features + * ================================================================================ + * Copyright (C) 2020 highstreet technologies GmbH Intellectual Property. + * All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + * + */ +package org.onap.ccsdk.features.sdnr.wt.devicemanager.openroadm.impl; + +import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfAccessor; +import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev191129.OrgOpenroadmDevice; +import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev191129.circuit.packs.CircuitPacks; +import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev191129.interfaces.grp.Interface; +import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev191129.org.openroadm.device.Xponder; +import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev191129.shelves.Shelves; +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.yangtools.yang.common.Uint32; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * @author Shabnam Sultana + * + * Reading the inventory data of an open roadm device + * + **/ +public class OpenroadmInventoryInput { + // variable + private static final Logger log = LoggerFactory.getLogger(OpenroadmInventoryInput.class); + private OrgOpenroadmDevice openRoadmDevice; + private final NetconfAccessor accessor; + // end of variables + + // constructors + public OpenroadmInventoryInput(NetconfAccessor netconfAccessor, OrgOpenroadmDevice roadmDevice) { + this.openRoadmDevice = roadmDevice; + this.accessor = netconfAccessor; + } + // end of constructors + + // public methods + public Inventory getInventoryData(Uint32 treeLevel) { + InventoryBuilder inventoryBuilder = new InventoryBuilder(); + log.info("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()) + .setDate(this.openRoadmDevice.getInfo().getCurrentDatetime().getValue()) + .setId(this.openRoadmDevice.getInfo().getNodeId().getValue()) + .setManufacturerIdentifier(this.openRoadmDevice.getInfo().getVendor()) + .setModelIdentifier(this.openRoadmDevice.getInfo().getModel()) + .setSerial(this.openRoadmDevice.getInfo().getSerialId()).setTreeLevel(treeLevel) + .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()); + return inventoryBuilder.build(); + } + + public Inventory getShelvesInventory(Shelves shelf, Uint32 treeLevel) { + InventoryBuilder inventoryBuilder = new InventoryBuilder(); + inventoryBuilder.setNodeId(this.accessor.getNodeId().getValue()).setId(shelf.getShelfName()) + .setDescription((shelf.getUserDescription() == null) + ? ("Position: " + shelf.getShelfPosition() + "\nState: " + shelf.getOperationalState()) + : (shelf.getUserDescription()) + "\nPosition: " + shelf.getShelfPosition() + "\nState: " + + shelf.getOperationalState()) + .setSerial(shelf.getSerialId()).setUuid(shelf.getShelfName()) + .setParentUuid(this.openRoadmDevice.getInfo().getNodeId().getValue()).setTreeLevel(treeLevel) + .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()); + return inventoryBuilder.build(); + } + + public Inventory getInterfacesInventory(Interface deviceInterface, Uint32 treeLevel) { + InventoryBuilder inventoryBuilder = new InventoryBuilder(); + inventoryBuilder.setNodeId(this.accessor.getNodeId().getValue()).setId(deviceInterface.getName()) + .setDescription((deviceInterface.getDescription() == null) ? "N/A" : deviceInterface.getDescription()) + .setUuid(deviceInterface.getName()).setSerial(deviceInterface.getName()) + .setParentUuid((deviceInterface.getSupportingCircuitPackName() != null) + ? deviceInterface.getSupportingCircuitPackName() + : ((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())) + .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()); + + return inventoryBuilder.build(); + } + + public Inventory getCircuitPackInventory(CircuitPacks circuitPack, Uint32 treeLevel) { + InventoryBuilder inventoryBuilder = new InventoryBuilder(); + 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) + .setVersion(circuitPack.getHardwareVersion()) + .setDescription("ProductCode: " + circuitPack.getProductCode() + " " + "Mode: " + + circuitPack.getCircuitPackMode()) + .setTypeName((circuitPack.getType() == null) ? circuitPack.getCircuitPackType() : circuitPack.getType()) + .setPartTypeId((circuitPack.getClei() == null) ? circuitPack.getType() : circuitPack.getClei()) + .setParentUuid((circuitPack.getParentCircuitPack() != null) + ? circuitPack.getParentCircuitPack().getCircuitPackName() + : ((circuitPack.getShelf() != null) ? circuitPack.getShelf() + : this.openRoadmDevice.getInfo().getNodeId().getValue())); + log.info("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()) + .setDescription("Xponder\nLifecycleState: " + xpdr.getLifecycleState().getName()) + .setUuid(xpdr.getXpdrNumber().toString()).setSerial(xpdr.getXpdrNumber().toString()) + .setParentUuid(this.openRoadmDevice.getInfo().getNodeId().getValue()).setTreeLevel(treeLevel) + .setTypeName(xpdr.getXpdrType().getName()).setPartTypeId(xpdr.getXpdrType().getName()) + .setManufacturerIdentifier(this.openRoadmDevice.getInfo().getVendor()) + .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()); + + return inventoryBuilder.build(); + } + // 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/OpenroadmNetworkElement.java b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/OpenroadmNetworkElement.java new file mode 100644 index 000000000..02f8547ae --- /dev/null +++ b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/OpenroadmNetworkElement.java @@ -0,0 +1,323 @@ +/* + * ============LICENSE_START======================================================= + * ONAP : ccsdk features + * ================================================================================ + * Copyright (C) 2020 highstreet technologies GmbH Intellectual Property. + * All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + * + */ +package org.onap.ccsdk.features.sdnr.wt.devicemanager.openroadm.impl; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Hashtable; +import java.util.List; +import org.eclipse.jdt.annotation.NonNull; +import org.onap.ccsdk.features.sdnr.wt.common.YangHelper; +import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.NetconfTimeStamp; +import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.types.NetconfTimeStampImpl; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServiceProvider; +import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfAccessor; +import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfBindingAccessor; +import org.opendaylight.mdsal.common.api.LogicalDatastoreType; +import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev191129.OrgOpenroadmDevice; +import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev191129.circuit.packs.CircuitPacks; +import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev191129.interfaces.grp.Interface; +import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev191129.org.openroadm.device.Xponder; +import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev191129.shelf.Slots; +import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev191129.shelves.Shelves; +import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev191129.xponder.XpdrPort; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.EventlogBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.Inventory; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.PmdataEntity; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SourceType; +import org.opendaylight.yangtools.concepts.ListenerRegistration; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; +import org.opendaylight.yangtools.yang.binding.NotificationListener; +import org.opendaylight.yangtools.yang.common.Uint32; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * @author Shabnam Sultana + * + * Creating the openroadm device as an optical network element and writing inventory, fault, pm data to elastic + * search db + * + **/ +public class OpenroadmNetworkElement extends OpenroadmNetworkElementBase { + + // variables + private final long equipmentLevel = 1; + private static final Logger log = LoggerFactory.getLogger(OpenroadmNetworkElement.class); + private Hashtable<String, Long> circuitPacksRecord; + private Hashtable<String, Long> shelfProvisionedcircuitPacks; + private ListenerRegistration<NotificationListener> openRdmListenerRegistrationResult; + private @NonNull final OpenroadmChangeNotificationListener openRdmListener; + private ListenerRegistration<NotificationListener> opnRdmFaultListenerRegistrationResult; + private @NonNull OpenroadmFaultNotificationListener opnRdmFaultListener; + private ListenerRegistration<NotificationListener> opnRdmDeviceListenerRegistrationResult; + private OpenroadmDeviceChangeNotificationListener opnRdmDeviceListener; + private OpenroadmInventoryInput opnRdmInventoryInput; + private PmDataBuilderOpenRoadm openRoadmPmData; + private InitialDeviceAlarmReader initialAlarmReader; + + private static final NetconfTimeStamp ncTimeConverter = NetconfTimeStampImpl.getConverter(); + private int counter = 1; + // end of variables + + // constructors + public OpenroadmNetworkElement(NetconfBindingAccessor netconfAccess, DeviceManagerServiceProvider serviceProvider) { + + super(netconfAccess, serviceProvider); + + log.info("Create {}", OpenroadmNetworkElement.class.getSimpleName()); + this.openRdmListenerRegistrationResult = null; + this.openRdmListener = new OpenroadmChangeNotificationListener(netconfAccessor, databaseService, + serviceProvider.getWebsocketService()); + this.opnRdmFaultListenerRegistrationResult = null; + this.opnRdmFaultListener = new OpenroadmFaultNotificationListener(serviceProvider); + this.opnRdmDeviceListenerRegistrationResult = null; + this.opnRdmDeviceListener = new OpenroadmDeviceChangeNotificationListener(netconfAccessor, databaseService, + serviceProvider.getWebsocketService()); + this.circuitPacksRecord = new Hashtable<>(); + this.shelfProvisionedcircuitPacks = new Hashtable<>(); + this.openRoadmPmData = new PmDataBuilderOpenRoadm(this.netconfAccessor); + this.initialAlarmReader = new InitialDeviceAlarmReader(this.netconfAccessor, serviceProvider); + log.info("NodeId {}", this.netconfAccessor.getNodeId().getValue()); + + + } + // end of constructors + + // public methods + public void initialReadFromNetworkElement() { + + OrgOpenroadmDevice device = readDevice(this.netconfAccessor); + this.opnRdmInventoryInput = new OpenroadmInventoryInput(this.netconfAccessor, device); + log.info("openroadmMapper details{}", this.opnRdmInventoryInput.getClass().getName()); + List<Inventory> inventoryList = new ArrayList<>(); + inventoryList.add(this.opnRdmInventoryInput.getInventoryData(Uint32.valueOf(equipmentLevel))); + readShelvesData(inventoryList, device); + readXpndrData(inventoryList, device); + readCircuitPacketData(inventoryList, device); + readInterfaceData(inventoryList, device); + this.databaseService.writeInventory(this.netconfAccessor.getNodeId().getValue(), inventoryList); + // Writing initial alarms at the time of device registration + initialAlarmReader.faultService(); + // Writing historical PM data at the time of device registration + List<PmdataEntity> pmDataEntity = new ArrayList<>(); + 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()); + for (PmdataEntity ent : pmDataEntity) { + log.info("GetNode: {}, granPeriod: {}", ent.getNodeName(), ent.getGranularityPeriod().getName()); + } + } else { + log.info("PmDatEntity is empty"); + } + } + + + @Override + public void register() { + initialReadFromNetworkElement(); + + this.openRdmListenerRegistrationResult = netconfAccessor.doRegisterNotificationListener(openRdmListener); + this.opnRdmFaultListenerRegistrationResult = + netconfAccessor.doRegisterNotificationListener(opnRdmFaultListener); + this.opnRdmDeviceListenerRegistrationResult = + netconfAccessor.doRegisterNotificationListener(opnRdmDeviceListener); + // Register netconf stream + netconfAccessor.registerNotificationsStream(NetconfAccessor.DefaultNotificationsStream); + } + + @Override + public void deregister() { + if (openRdmListenerRegistrationResult != null) { + this.openRdmListenerRegistrationResult.close(); + } + if (opnRdmFaultListenerRegistrationResult != null) { + this.opnRdmFaultListenerRegistrationResult.close(); + } + if (opnRdmDeviceListenerRegistrationResult != null) { + this.opnRdmDeviceListenerRegistrationResult.close(); + } + } + + // end of public methods + + // private methods + private void readShelvesData(List<Inventory> inventoryList, OrgOpenroadmDevice device) { + Collection<Shelves> shelves = YangHelper.getCollection(device.getShelves()); + if (shelves != null) { + for (Shelves shelf : shelves) { + log.info( + "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(), + shelf.getEquipmentState(), shelf.getHardwareVersion(), shelf.getShelfType(), shelf.getVendor(), + shelf.getLifecycleState()); + inventoryList + .add(this.opnRdmInventoryInput.getShelvesInventory(shelf, Uint32.valueOf(equipmentLevel + 1))); + Collection<Slots> slotList = YangHelper.getCollection(shelf.getSlots()); + if (slotList != null) { + for (Slots slot : slotList) { + 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(), + slot.getSlotStatus(), slot.getLabel()); + } + } + } + log.info("size of shelfProvisionedcircuitPacks: {} ", shelfProvisionedcircuitPacks.size()); + } + + } + + private void readXpndrData(List<Inventory> inventoryList, OrgOpenroadmDevice device) { + Collection<Xponder> xponderList = YangHelper.getCollection(device.getXponder()); + + if (xponderList != null) { + for (Xponder xponder : xponderList) { + + inventoryList.add( + this.opnRdmInventoryInput.getXponderInventory(xponder, Uint32.valueOf(equipmentLevel + 1))); + log.info("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()); + } + } + + } + } + } + + private void readCircuitPacketData(List<Inventory> inventoryList, OrgOpenroadmDevice device) { + Collection<CircuitPacks> circuitpackCollection = YangHelper.getCollection(device.getCircuitPacks()); + List<String> cpNameList = new ArrayList<>(); + + if (circuitpackCollection != null) { + // collect all circuit pack names. Required to check for invalid parents later on + for (CircuitPacks cp : circuitpackCollection) { + cpNameList.add(cp.getCircuitPackName()); + } + + for (CircuitPacks cp : circuitpackCollection) { + log.info("CP Name:{}", cp.getCircuitPackName()); + + if (cp.getParentCircuitPack() == null + && !this.shelfProvisionedcircuitPacks.containsKey(cp.getCircuitPackName())) { + log.info("cp has no parent and no shelf"); + this.circuitPacksRecord.put(cp.getCircuitPackName(), (equipmentLevel + 1)); + inventoryList.add( + this.opnRdmInventoryInput.getCircuitPackInventory(cp, Uint32.valueOf(equipmentLevel + 1))); + } else { + // check for missing valid parent circuit name + 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", + cp.getCircuitPackName()); + this.circuitPacksRecord.put(cp.getCircuitPackName(), (equipmentLevel + 3)); + inventoryList.add(this.opnRdmInventoryInput.getCircuitPackInventory(cp, + Uint32.valueOf(equipmentLevel + 3))); + databaseService.writeEventLog(writeIncorrectParentLog(cp.getCircuitPackName(), counter) + .setObjectId(device.getInfo().getNodeId().getValue()) + .setId(cp.getParentCircuitPack().getCpSlotName()) + .setNewValue("Missing parent circuit pack name").build()); + } else if (cp.getParentCircuitPack().getCircuitPackName() != null + && this.shelfProvisionedcircuitPacks + .containsKey(cp.getParentCircuitPack().getCircuitPackName())) { + log.info("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))); + } else { + // check for incorrect hierarchy + if (cp.getParentCircuitPack().getCircuitPackName() != null + && !cpNameList.contains(cp.getParentCircuitPack().getCircuitPackName())) { + databaseService.writeEventLog(writeIncorrectParentLog(cp.getCircuitPackName(), counter) + .setObjectId(device.getInfo().getNodeId().getValue()) + .setId(cp.getParentCircuitPack().getCpSlotName()).build()); + } + + log.info("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))); + } + + } + } + + } + } + + private void readInterfaceData(List<Inventory> inventoryList, OrgOpenroadmDevice device) { + 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()); + for (String s : this.circuitPacksRecord.keySet()) { + log.info("{} value {}", s, this.circuitPacksRecord.get(s)); + } + log.info("Interface {} and their supporting CP {}", deviceInterface.getName(), + deviceInterface.getSupportingCircuitPackName()); + if (deviceInterface.getSupportingCircuitPackName() != null) { + if (this.circuitPacksRecord.containsKey(deviceInterface.getSupportingCircuitPackName())) { + inventoryList.add(this.opnRdmInventoryInput.getInterfacesInventory(deviceInterface, + Uint32.valueOf( + this.circuitPacksRecord.get(deviceInterface.getSupportingCircuitPackName()) + + 1))); + } + } else { + inventoryList.add(this.opnRdmInventoryInput.getInterfacesInventory(deviceInterface, + Uint32.valueOf(equipmentLevel + 1))); + } + } + } + } + + private OrgOpenroadmDevice readDevice(NetconfBindingAccessor accessor) { + final Class<OrgOpenroadmDevice> openRoadmDev = OrgOpenroadmDevice.class; + InstanceIdentifier<OrgOpenroadmDevice> deviceId = InstanceIdentifier.builder(openRoadmDev).build(); + return accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, + deviceId); + } + + private EventlogBuilder writeIncorrectParentLog(String attributeName, Integer counter) { + EventlogBuilder eventlogBuilder = new EventlogBuilder(); + eventlogBuilder.setAttributeName(attributeName).setCounter(counter) + .setNodeId(this.netconfAccessor.getNodeId().getValue()).setSourceType(SourceType.Netconf) + .setNewValue("Invalid parent circuit-pack name") + .setTimestamp(new DateAndTime(ncTimeConverter.getTimeStamp())); + + return eventlogBuilder; + + } + // end of private methods +} diff --git a/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/OpenroadmNetworkElementBase.java b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/OpenroadmNetworkElementBase.java new file mode 100644 index 000000000..9949056bb --- /dev/null +++ b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/OpenroadmNetworkElementBase.java @@ -0,0 +1,74 @@ +/* + * ============LICENSE_START======================================================= + * ONAP : ccsdk features + * ================================================================================ + * Copyright (C) 2020 highstreet technologies GmbH Intellectual Property. + * All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + * + */ +package org.onap.ccsdk.features.sdnr.wt.devicemanager.openroadm.impl; + +import java.util.Optional; +import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DataProvider; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.ne.service.NetworkElement; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.ne.service.NetworkElementService; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServiceProvider; +import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfAccessor; +import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfBindingAccessor; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.NetworkElementDeviceType; +import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId; + +public class OpenroadmNetworkElementBase implements NetworkElement { + + protected final NetconfBindingAccessor netconfAccessor; + protected final DataProvider databaseService; + + public OpenroadmNetworkElementBase(NetconfBindingAccessor netconfAccess, + DeviceManagerServiceProvider serviceProvider) { + + this.netconfAccessor = netconfAccess; + this.databaseService = serviceProvider.getDataProvider(); + } + + @Override + public void register() {} + + @Override + public void deregister() {} + + @Override + public void warmstart() {} + + @Override + public NodeId getNodeId() { + return netconfAccessor.getNodeId(); + } + + @Override + public NetworkElementDeviceType getDeviceType() { + return NetworkElementDeviceType.OROADM; + } + + @Override + public <L extends NetworkElementService> Optional<L> getService(Class<L> clazz) { + return Optional.empty(); + } + + @Override + public Optional<NetconfAccessor> getAcessor() { + return Optional.of(netconfAccessor); + } +} 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 new file mode 100644 index 000000000..cc8eaa68e --- /dev/null +++ b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/OpenroadmNetworkElementFactory.java @@ -0,0 +1,71 @@ +/* + * ============LICENSE_START======================================================= + * ONAP : ccsdk features + * ================================================================================ + * Copyright (C) 2020 highstreet technologies GmbH Intellectual Property. + * All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + * + */ + +package org.onap.ccsdk.features.sdnr.wt.devicemanager.openroadm.impl; + +import java.util.Optional; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.ne.factory.NetworkElementFactory; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.ne.service.NetworkElement; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServiceProvider; +import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfAccessor; +import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfBindingAccessor; +import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev191129.OrgOpenroadmDevice; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * @author Shabnam Sultana + * + * Register the openroadm device as an optical network element + * + **/ + +public class OpenroadmNetworkElementFactory implements NetworkElementFactory { + + // variables + private static final Logger log = LoggerFactory.getLogger(OpenroadmNetworkElementFactory.class); + // end of variables + + // public methods + @Override + public Optional<NetworkElement> create(NetconfAccessor accessor, DeviceManagerServiceProvider serviceProvider) { + + if (accessor.getCapabilites().isSupportingNamespaceAndRevision(OrgOpenroadmDevice.QNAME)) { + log.info("Create OpenRoadm device {} ", OpenroadmNetworkElement.class.getName()); + log.info("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()); + Optional<NetconfBindingAccessor> bindingAccessor = accessor.getNetconfBindingAccessor(); + if (bindingAccessor.isPresent()) { + return Optional.of(new OpenroadmNetworkElementBase(bindingAccessor.get(), serviceProvider)); + } + } + return Optional.empty(); + } + // 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/PmDataBuilderOpenRoadm.java b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/PmDataBuilderOpenRoadm.java new file mode 100644 index 000000000..f1fd4471f --- /dev/null +++ b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/impl/PmDataBuilderOpenRoadm.java @@ -0,0 +1,290 @@ +/* + * ============LICENSE_START======================================================= + * ONAP : ccsdk features + * ================================================================================ + * Copyright (C) 2020 highstreet technologies GmbH Intellectual Property. + * All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + * + */ +package org.onap.ccsdk.features.sdnr.wt.devicemanager.openroadm.impl; + +import java.net.URL; +import java.util.ArrayList; +import java.util.Collection; +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.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; +import org.opendaylight.yang.gen.v1.http.org.openroadm.pm.rev191129.historical.pm.list.HistoricalPmEntry; +import org.opendaylight.yang.gen.v1.http.org.openroadm.pm.rev191129.historical.pm.val.group.Measurement; +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.PmGranularity; +import org.opendaylight.yang.gen.v1.http.org.openroadm.pm.types.rev191129.PmNamesEnum; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.g836.pm.types.rev200413.ErroredSecond; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.g836.pm.types.rev200413.SeverelyErroredSecond; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.openroadm.pm.types.rev200413.PerformanceMeasurementTypeId; +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; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.PmdataEntityBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.pmdata.entity.PerformanceDataBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.pmdata.grp.MeasurementBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.pmdata.grp.MeasurementKey; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.units.rev200413.Celsius; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.units.rev200413.DB; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.units.rev200413.DBm; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.units.rev200413.Fahrenheit; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.units.rev200413.KHz; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.units.rev200413.MW; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.units.rev200413.PerformanceMeasurementUnitId; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.osgi.framework.FrameworkUtil; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * @author shabnam + * + * Reading Openroadm PM data and returning as PmDataEntitiy data + */ +public class PmDataBuilderOpenRoadm { + // variables + private static final Logger log = LoggerFactory.getLogger(PmDataBuilderOpenRoadm.class); + private PmdataEntityBuilder pmDataBuilder; + private Bundle b = FrameworkUtil.getBundle(this.getClass()); + + // end of variables + // constructors + public PmDataBuilderOpenRoadm(NetconfBindingAccessor accessor) { + this.pmDataBuilder = new PmdataEntityBuilder(); + this.pmDataBuilder.setNodeName(accessor.getNodeId().getValue()); + } + + // end of constructors + // public methods + // Read PM data + public HistoricalPmList getPmData(NetconfBindingAccessor accessor) { + final Class<HistoricalPmList> pmDataClass = HistoricalPmList.class; + log.info("Get PM data for element {}", accessor.getNodeId().getValue()); + InstanceIdentifier<HistoricalPmList> pmDataIid = InstanceIdentifier.builder(pmDataClass).build(); + return accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, + pmDataIid); + + } + + // Build PM entity for writing into the database + public List<PmdataEntity> buildPmDataEntity(HistoricalPmList historicalPmEnitityList) { + List<PmdataEntity> pmEntitiyList = new ArrayList<>(); + Collection<HistoricalPmEntry> pmDataEntryList = + YangHelper.getCollection(historicalPmEnitityList.getHistoricalPmEntry()); + for (HistoricalPmEntry pmDataEntry : pmDataEntryList) { + pmDataBuilder.setUuidInterface(pmDataEntry.getPmResourceType().getName()); + Collection<HistoricalPm> historicalPmList = YangHelper.getCollection(pmDataEntry.getHistoricalPm()); + for (HistoricalPm historicalPm : historicalPmList) { + log.info("PmName:{}", historicalPm.getType()); + // pmDataBuilder.setPerformanceData(value) + + try { + writeperformanceData(historicalPm); + } catch (ClassNotFoundException e) { + log.info("No relevant data found"); + } + pmEntitiyList.add(this.pmDataBuilder.build()); + + log.info("PmListSize before db writing: {}", pmEntitiyList.size()); + } + log.info("PmListSize before db writing: {}", pmEntitiyList.size()); + } + return pmEntitiyList; + } + // end of public methods + + // 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 Performance data of PmDataEntity with MeasurmentData-HistoricalPm + PerformanceDataBuilder performanceDataBuilder = new PerformanceDataBuilder(); + for (Measurement measurementData : measurementList) { + this.pmDataBuilder.setGranularityPeriod(mapGranularityPeriod(measurementData.getGranularity())) + .setTimeStamp(measurementData.getCompletionTime()); + 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())); + + + } + + pmDataBuilder.setPerformanceData(performanceDataBuilder.setMeasurement(measurementMap).build()); + } + + + + // Mapping Granularity period of PmDataEntity with PmGranularity of MeasurmentData-HistoricalPm + private GranularityPeriodType mapGranularityPeriod(PmGranularity pmGranularity) { + + GranularityPeriodType granPeriod = null; + switch (pmGranularity.getName()) { + case ("notApplicable"): + granPeriod = GranularityPeriodType.Unknown; + break; + case ("15min"): + granPeriod = GranularityPeriodType.Period15Min; + break; + case ("24Hour"): + granPeriod = GranularityPeriodType.Period24Hours; + break; + default: + granPeriod = GranularityPeriodType.Period15Min; + break; + } + return granPeriod; + } + + private List<Class<? extends PerformanceMeasurementTypeId>> setMeasurementTypeId() { + String packageName = + "org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.openroadm.pm.types.rev200413"; + String packageName1 = + "/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/data/provider/openroadm/pm/types/rev200413/"; + List<Class<? extends PerformanceMeasurementTypeId>> measTypeObjList = + new ArrayList<>(); + URL root = Thread.currentThread().getContextClassLoader().getResource(packageName1); + + log.info("path for type package: {}", root); + + Enumeration<URL> results = getFileURL(b, packageName); + log.info("FOund Packages {}", results); + if(results != null) { + while (results.hasMoreElements()) { + URL path = results.nextElement(); + + Class<?> cls1 = loadClass(b, path.getFile()); + + if (PerformanceMeasurementTypeId.class.isAssignableFrom(cls1)) { + measTypeObjList.add((Class<? extends PerformanceMeasurementTypeId>) cls1); + + + } + if(cls1!=null) { + log.info("Class Added {}", cls1.getSimpleName()); + } + + } + + + } + + return measTypeObjList; + } + + private Class<? extends PerformanceMeasurementUnitId> setMeasurementUnit(String unitName) { + Class<? extends PerformanceMeasurementUnitId> measurementUnitClass = null; + 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; + default: + break; + } + return measurementUnitClass; + } + + 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); + } else if (pmType.getName().equals("severelyErroredSeconds")) { + measBuilder.setPmKey(SeverelyErroredSecond.class); + } else { + for (Class<? extends PerformanceMeasurementTypeId> obj : setMeasurementTypeId()) { + if (obj.toString().contains(pmType.name())) { + measBuilder.setPmKey(obj); + } + } + } + measBuilder.setPmUnit(setMeasurementUnit(pmUnit)); + measBuilder.setPmValue(pmDataType); + return measBuilder.build(); + + } + + private Class<?> loadClass(Bundle bundle, String classFilePath) { + String className = classFilePath.replaceFirst("^/", "").replace('/', '.').replaceFirst(".class$", ""); + try { + return bundle.loadClass(className); + } catch (Exception e) { + log.info(String.format("Class [%s] could not be loaded. Message: [%s].", className, e.getMessage())); + } + return null; + } + + private static Enumeration<URL> getFileURL(Bundle b, String classPath) { + + BundleContext context = b == null ? null : b.getBundleContext(); + if (context == null) { + log.info("no bundle context available"); + return null; + } + Bundle[] bundles = context.getBundles(); + if (bundles == null || bundles.length <= 0) { + log.info("no bundles found"); + return null; + } + log.info("found {} bundles", bundles.length); + Enumeration<URL> resultUrl = null; + + for (Bundle bundle : bundles) { + resultUrl = bundle.findEntries("/" + classPath.replace(".", "/"), "*.class", false); + if (resultUrl != null) { + break; + + } + + } + + return resultUrl; + } + + + // end of private methods +} + diff --git a/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/opendaylight/yang/gen/v1/http/org/openroadm/pm/types/rev191129/PmDataTypeBuilder.java b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/opendaylight/yang/gen/v1/http/org/openroadm/pm/types/rev191129/PmDataTypeBuilder.java new file mode 100644 index 000000000..249da71fb --- /dev/null +++ b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/java/org/opendaylight/yang/gen/v1/http/org/openroadm/pm/types/rev191129/PmDataTypeBuilder.java @@ -0,0 +1,21 @@ +package org.opendaylight.yang.gen.v1.http.org.openroadm.pm.types.rev191129; + +/** + * 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/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 new file mode 100644 index 000000000..30a55a203 --- /dev/null +++ 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 @@ -0,0 +1,21 @@ +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 new file mode 100644 index 000000000..a803bae97 --- /dev/null +++ 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 @@ -0,0 +1,21 @@ +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 new file mode 100644 index 000000000..bbfa37f40 --- /dev/null +++ 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 @@ -0,0 +1,21 @@ +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 new file mode 100644 index 000000000..9fb90b438 --- /dev/null +++ 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 @@ -0,0 +1,21 @@ +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 new file mode 100644 index 000000000..2b8e8af57 --- /dev/null +++ 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 @@ -0,0 +1,21 @@ +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/openroadm/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml new file mode 100644 index 000000000..ff3e6a72d --- /dev/null +++ b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ~ ============LICENSE_START======================================================= + ~ ONAP : ccsdk features + ~ ================================================================================ + ~ Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. + ~ All rights reserved. + ~ ================================================================================ + ~ Update Copyright (C) 2020 AT&T Intellectual Property. All rights reserved. + ~ ================================================================================ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License. + ~ ============LICENSE_END======================================================= + ~ + --> + +<blueprint xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0" + xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" odl:use-default-for-reference-types="true"> + + <reference id="netconfNetworkElementService" + availability="mandatory" activation="eager" + interface="org.onap.ccsdk.features.sdnr.wt.devicemanager.service.NetconfNetworkElementService"/> + + <bean id="provider" + class="org.onap.ccsdk.features.sdnr.wt.devicemanager.openroadm.impl.DeviceManagerOpenroadmImpl" + init-method="init" destroy-method="close"> + <property name="netconfNetworkElementService" ref="netconfNetworkElementService"/> + </bean> +</blueprint> diff --git a/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/resources/version.properties b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/resources/version.properties new file mode 100644 index 000000000..6638c04f9 --- /dev/null +++ b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/resources/version.properties @@ -0,0 +1,24 @@ +# +# ============LICENSE_START======================================================= +# ONAP : ccsdk features +# ================================================================================ +# Copyright (C) 2020 AT&T Intellectual Property. All rights reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END======================================================= +# +# + +# Properties filled in by maven during build process +version = ${project.version} +build = ${buildtime} diff --git a/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/yang/iana-hardware.yang b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/yang/iana-hardware.yang new file mode 100755 index 000000000..52bcaf3a0 --- /dev/null +++ b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/yang/iana-hardware.yang @@ -0,0 +1,180 @@ +module iana-hardware { +yang-version 1.1; +namespace "urn:ietf:params:xml:ns:yang:iana-hardware"; +prefix ianahw; + +organization "IANA"; +contact + " Internet Assigned Numbers Authority + Postal: ICANN + 12025 Waterfront Drive, Suite 300 + Los Angeles, CA 90094-2536 + United States of America + Tel: +1 310 301 5800 + E-Mail: iana@iana.org>"; + +description + "IANA-defined identities for hardware class. + The latest revision of this YANG module can be obtained from + the IANA website. + Requests for new values should be made to IANA via + email (iana@iana.org). + Copyright (c) 2018 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). + The initial version of this YANG module is part of RFC 8348; + see the RFC itself for full legal notices."; +reference + "https://www.iana.org/assignments/yang-parameters"; + +revision 2018-03-13 { + description + "Initial revision."; + reference + "RFC 8348: A YANG Data Model for Hardware Management"; +} + +/* + * Identities + */ + +identity hardware-class { + description + "This identity is the base for all hardware class + identifiers."; +} + +identity unknown { + base ianahw:hardware-class; + description + "This identity is applicable if the hardware class is unknown + to the server."; +} + +identity chassis { + base ianahw:hardware-class; + description + "This identity is applicable if the hardware class is an + overall container for networking equipment. Any class of + physical component, except a stack, may be contained within a + chassis; a chassis may only be contained within a stack."; +} + +identity backplane { + base ianahw:hardware-class; + description + "This identity is applicable if the hardware class is some sort + of device for aggregating and forwarding networking traffic, + such as a shared backplane in a modular ethernet switch. Note + that an implementation may model a backplane as a single + physical component, which is actually implemented as multiple + discrete physical components (within a chassis or stack)."; +} + +identity container { + base ianahw:hardware-class; + description + "This identity is applicable if the hardware class is capable + of containing one or more removable physical entities, + possibly of different types. For example, each (empty or + full) slot in a chassis will be modeled as a container. Note + that all removable physical components should be modeled + within a container component, such as field-replaceable + modules, fans, or power supplies. Note that all known + containers should be modeled by the agent, including empty + containers."; +} + +identity power-supply { + base ianahw:hardware-class; + description + "This identity is applicable if the hardware class is a + power-supplying component."; +} + +identity fan { + base ianahw:hardware-class; + description + "This identity is applicable if the hardware class is a fan or + other heat-reduction component."; +} + +identity sensor { + base ianahw:hardware-class; + description + "This identity is applicable if the hardware class is some sort + of sensor, such as a temperature sensor within a router + chassis."; +} + +identity module { + base ianahw:hardware-class; + description + "This identity is applicable if the hardware class is some sort + of self-contained sub-system. If a module component is + removable, then it should be modeled within a container + component; otherwise, it should be modeled directly within + another physical component (e.g., a chassis or another + module)."; +} + +identity port { + base ianahw:hardware-class; + description + "This identity is applicable if the hardware class is some sort + of networking port capable of receiving and/or transmitting + networking traffic."; +} + +identity stack { + base ianahw:hardware-class; + description + "This identity is applicable if the hardware class is some sort + of super-container (possibly virtual) intended to group + together multiple chassis entities. A stack may be realized + by a virtual cable, a real interconnect cable attached to + multiple chassis, or multiple interconnect cables. A stack + should not be modeled within any other physical components, + but a stack may be contained within another stack. Only + chassis components should be contained within a stack."; +} + +identity cpu { + base ianahw:hardware-class; + description + "This identity is applicable if the hardware class is some sort + of central processing unit."; +} + +identity energy-object { + base ianahw:hardware-class; + description + "This identity is applicable if the hardware class is some sort + of energy object, i.e., it is a piece of equipment that is + part of or attached to a communications network that is + monitored, it is controlled, or it aids in the management of + another device for Energy Management."; +} + +identity battery { + base ianahw:hardware-class; + description + "This identity is applicable if the hardware class is some sort + of battery."; +} + +identity storage-drive { + base ianahw:hardware-class; + description + "This identity is applicable if the hardware class is some sort + of component with data storage capability as its main + functionality, e.g., hard disk drive (HDD), solid-state device + (SSD), solid-state hybrid drive (SSHD), object storage device + (OSD), or other."; +} +} diff --git a/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/yang/ietf-alarms.yang b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/yang/ietf-alarms.yang new file mode 100644 index 000000000..856320b64 --- /dev/null +++ b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/yang/ietf-alarms.yang @@ -0,0 +1,1526 @@ +module ietf-alarms { + yang-version 1.1; + namespace "urn:ietf:params:xml:ns:yang:ietf-alarms"; + prefix al; + + import ietf-yang-types { + prefix yang; + reference + "RFC 6991: Common YANG Data Types."; + } + + organization + "IETF CCAMP Working Group"; + contact + "WG Web: <https://trac.ietf.org/trac/ccamp> + WG List: <mailto:ccamp@ietf.org> + + Editor: Stefan Vallin + <mailto:stefan@wallan.se> + + Editor: Martin Bjorklund + <mailto:mbj@tail-f.com>"; + description + "This module defines an interface for managing alarms. Main + inputs to the module design are the 3GPP Alarm Integration + Reference Point (IRP), ITU-T X.733, and ANSI/ISA-18.2 alarm + standards. + Main features of this module include: + + * Alarm list: + A list of all alarms. Cleared alarms stay in + the list until explicitly purged. + + * Operator actions on alarms: + Acknowledging and closing alarms. + + * Administrative actions on alarms: + Purging alarms from the list according to specific + criteria. + + * Alarm inventory: + A management application can read all + alarm types implemented by the system. + + * Alarm shelving: + Shelving (blocking) alarms according + to specific criteria. + + * Alarm profiles: + A management system can attach further + information to alarm types, for example, + overriding system-default severity + levels. + + This module uses a stateful view on alarms. An alarm is a state + for a specific resource (note that an alarm is not a + notification). An alarm type is a possible alarm state for a + resource. For example, the tuple: + + ('link-alarm', 'GigabitEthernet0/25') + + is an alarm of type 'link-alarm' on the resource + 'GigabitEthernet0/25'. + + Alarm types are identified using YANG identities and an optional + string-based qualifier. The string-based qualifier allows for + dynamic extension of the statically defined alarm types. Alarm + types identify a possible alarm state and not the individual + notifications. For example, the traditional 'link-down' and + 'link-up' notifications are two notifications referring to the + same alarm type 'link-alarm'. + + With this design, there is no ambiguity about how alarm and + alarm clear correlation should be performed; notifications that + report the same resource and alarm type are considered updates + of the same alarm, e.g., clearing an active alarm or changing + the severity of an alarm. The instrumentation can update the + severity and alarm text on an existing alarm. The above alarm + example can therefore look like the following: + + (('link-alarm', 'GigabitEthernet0/25'), + warning, + 'interface down while interface admin state is up') + + There is a clear separation between updates on the alarm from + the underlying resource, like clear, and updates from an + operator, like acknowledging or closing an alarm: + + (('link-alarm', 'GigabitEthernet0/25'), + warning, + 'interface down while interface admin state is up', + cleared, + closed) + + Administrative actions like removing closed alarms older than a + given time is supported. + + This YANG module does not define how the underlying + instrumentation detects and clears the specific alarms. That + belongs to the Standards Development Organization (SDO) or + enterprise that owns that specific technology. + + The key words 'MUST', 'MUST NOT', 'REQUIRED', 'SHALL', 'SHALL + NOT', 'SHOULD', 'SHOULD NOT', 'RECOMMENDED', 'NOT RECOMMENDED', + 'MAY', and 'OPTIONAL' in this document are to be interpreted as + described in BCP 14 (RFC 2119) (RFC 8174) when, and only when, + they appear in all capitals, as shown here. + + Copyright (c) 2019 IETF Trust and the persons identified as + authors of the code. All rights reserved. + + Redistribution and use in source and binary forms, with or + without modification, is permitted pursuant to, and subject to + the license terms contained in, the Simplified BSD License set + forth in Section 4.c of the IETF Trust's Legal Provisions + Relating to IETF Documents + (https://trustee.ietf.org/license-info). + + This version of this YANG module is part of RFC 8632; see + the RFC itself for full legal notices."; + + revision 2019-09-11 { + description + "Initial revision."; + reference + "RFC 8632: A YANG Data Model for Alarm Management"; + } + + /* + * Features + */ + + feature operator-actions { + description + "This feature indicates that the system supports operator + states on alarms."; + } + + feature alarm-shelving { + description + "This feature indicates that the system supports shelving + (blocking) alarms. + + Alarm shelving may have an impact on server processing + resources in order to match alarms against shelf + criteria."; + } + + feature alarm-history { + description + "This feature indicates that the server maintains a history + of state changes for each alarm. For example, if an alarm + toggles between cleared and active 10 times, these state + changes are present in a separate list in the alarm. + + Keeping the alarm history may have an impact on server + memory resources."; + } + + feature alarm-summary { + description + "This feature indicates that the server summarizes the number + of alarms per severity and operator state."; + } + + feature alarm-profile { + description + "The system enables clients to configure further information + to each alarm type."; + } + + feature severity-assignment { + description + "The system supports configurable alarm severity levels."; + reference + "ITU-T Recommendation M.3100: + Generic network information model + ITU-T Recommendation M.3160: + Generic, protocol-neutral management information model"; + } + + feature root-cause-analysis { + description + "The system supports identifying candidate root-cause + resources for an alarm, for example, a disk partition + root cause for a logger failure alarm."; + } + + feature service-impact-analysis { + description + "The system supports identifying candidate-impacted + resources for an alarm, for example, an interface state change + resulting in a link alarm, which can refer to a link as being + impacted."; + } + + feature alarm-correlation { + description + "The system supports correlating/grouping alarms + that belong together."; + } + + /* + * Identities + */ + + identity alarm-type-id { + description + "Base identity for alarm types. A unique identification of + the alarm, not including the resource. Different resources + can share alarm types. If the resource reports the same + alarm type, it is considered to be the same alarm. The alarm + type is a simplification of the different X.733 and 3GPP Alarm + IRP correlation mechanisms, and it allows for + hierarchical extensions. + + A string-based qualifier can be used in addition to the + identity in order to have different alarm types based on + information not known at design time, such as values in + textual SNMP Notification varbinds. + + Standards and vendors can define sub-identities to clearly + identify specific alarm types. + + This identity is abstract and MUST NOT be used for alarms."; + } + + /* + * Common types + */ + + typedef resource { + type union { + type instance-identifier { + require-instance false; + } + type yang:object-identifier; + type string; + type yang:uuid; + } + description + "This is an identification of the alarming resource, such as an + interface. It should be as fine-grained as possible to both + guide the operator and guarantee uniqueness of the alarms. + + If the alarming resource is modeled in YANG, this type will + be an instance-identifier. + + If the resource is an SNMP object, the type will be an + 'object-identifier'. + + If the resource is anything else, for example, a distinguished + name or a Common Information Model (CIM) path, this type will + be a string. + + If the alarming object is identified by a Universally Unique + Identifier (UUID), use the uuid type. Be cautious when using + this type, since a UUID is hard to use for an operator. + + If the server supports several models, the precedence should + be in the order as given in the union definition."; + } + + typedef resource-match { + type union { + type yang:xpath1.0; + type yang:object-identifier; + type string; + } + description + "This type is used to match resources of type 'resource'. + Since the type 'resource' is a union of different types, the + 'resource-match' type is also a union of corresponding types. + + If the type is given as an XPath 1.0 expression, a resource + of type 'instance-identifier' matches if the instance is part + of the node set that is the result of evaluating the XPath 1.0 + expression. For example, the XPath 1.0 expression: + + /ietf-interfaces:interfaces/ietf-interfaces:interface + [ietf-interfaces:type='ianaift:ethernetCsmacd'] + + would match the resource instance-identifier: + + /if:interfaces/if:interface[if:name='eth1'], + + assuming that the interface 'eth1' is of type + 'ianaift:ethernetCsmacd'. + + If the type is given as an object identifier, a resource of + type 'object-identifier' matches if the match object + identifier is a prefix of the resource's object identifier. + For example, the value: + + 1.3.6.1.2.1.2.2 + + would match the resource object identifier: + + 1.3.6.1.2.1.2.2.1.1.5 + + If the type is given as an UUID or a string, it is interpreted + as an XML Schema regular expression, which matches a resource + of type 'yang:uuid' or 'string' if the given regular + expression matches the resource string. + + If the type is given as an XPath expression, it is evaluated + in the following XPath context: + + o The set of namespace declarations is the set of prefix + and namespace pairs for all YANG modules implemented by + the server, where the prefix is the YANG module name and + the namespace is as defined by the 'namespace' statement + in the YANG module. + + If a leaf of this type is encoded in XML, all namespace + declarations in scope on the leaf element are added to + the set of namespace declarations. If a prefix found in + the XML is already present in the set of namespace + declarations, the namespace in the XML is used. + + o The set of variable bindings is empty. + + o The function library is the core function library, and + the functions are defined in Section 10 of RFC 7950. + + o The context node is the root node in the data tree."; + reference + "XML Schema Part 2: Datatypes Second Edition, + World Wide Web Consortium Recommendation + REC-xmlschema-2-20041028"; + } + + typedef alarm-text { + type string; + description + "The string used to inform operators about the alarm. This + MUST contain enough information for an operator to be able to + understand the problem and how to resolve it. If this string + contains structure, this format should be clearly documented + for programs to be able to parse that information."; + } + + typedef severity { + type enumeration { + enum indeterminate { + value 2; + description + "Indicates that the severity level could not be + determined. This level SHOULD be avoided."; + } + enum warning { + value 3; + description + "The 'warning' severity level indicates the detection of a + potential or impending service-affecting fault, before any + significant effects have been felt. Action should be + taken to further diagnose (if necessary) and correct the + problem in order to prevent it from becoming a more + serious service-affecting fault."; + } + enum minor { + value 4; + description + "The 'minor' severity level indicates the existence of a + non-service-affecting fault condition and that corrective + action should be taken in order to prevent a more serious + (for example, service-affecting) fault. Such a severity + can be reported, for example, when the detected alarm + condition is not currently degrading the capacity of the + resource."; + } + enum major { + value 5; + description + "The 'major' severity level indicates that a service- + affecting condition has developed and an urgent corrective + action is required. Such a severity can be reported, for + example, when there is a severe degradation in the + capability of the resource and its full capability must be + restored."; + } + enum critical { + value 6; + description + "The 'critical' severity level indicates that a service- + affecting condition has occurred and an immediate + corrective action is required. Such a severity can be + reported, for example, when a resource becomes totally out + of service and its capability must be restored."; + } + } + description + "The severity level of the alarm. Note well that the value + 'clear' is not included. Whether or not an alarm is cleared + is a separate boolean flag."; + reference + "ITU-T Recommendation X.733: Information Technology + - Open Systems Interconnection + - System Management: Alarm Reporting Function"; + } + + typedef severity-with-clear { + type union { + type enumeration { + enum cleared { + value 1; + description + "The alarm is cleared by the instrumentation."; + } + } + type severity; + } + description + "The severity level of the alarm including clear. This is used + only in notifications reporting state changes for an alarm."; + } + + typedef writable-operator-state { + type enumeration { + enum none { + value 1; + description + "The alarm is not being taken care of."; + } + enum ack { + value 2; + description + "The alarm is being taken care of. Corrective action not + taken yet or has failed"; + } + enum closed { + value 3; + description + "Corrective action taken successfully."; + } + } + description + "Operator states on an alarm. The 'closed' state indicates + that an operator considers the alarm being resolved. This is + separate from the alarm's 'is-cleared' leaf."; + } + + typedef operator-state { + type union { + type writable-operator-state; + type enumeration { + enum shelved { + value 4; + description + "The alarm is shelved. Alarms in /alarms/shelved-alarms/ + MUST be assigned this operator state by the server as + the last entry in the 'operator-state-change' list. The + text for that entry SHOULD include the shelf name."; + } + enum un-shelved { + value 5; + description + "The alarm is moved back to 'alarm-list' from a shelf. + Alarms that are moved from /alarms/shelved-alarms/ to + /alarms/alarm-list MUST be assigned this state by the + server as the last entry in the 'operator-state-change' + list. The text for that entry SHOULD include the shelf + name."; + } + } + } + description + "Operator states on an alarm. The 'closed' state indicates + that an operator considers the alarm being resolved. This is + separate from the alarm's 'is-cleared' leaf."; + } + + /* Alarm type */ + + typedef alarm-type-id { + type identityref { + base alarm-type-id; + } + description + "Identifies an alarm type. The description of the alarm type + id MUST indicate whether or not the alarm type is abstract. + An abstract alarm type is used as a base for other alarm type + ids and will not be used as a value for an alarm or be present + in the alarm inventory."; + } + + typedef alarm-type-qualifier { + type string; + description + "If an alarm type cannot be fully specified at design time by + 'alarm-type-id', this string qualifier is used in addition to + fully define a unique alarm type. + + The definition of alarm qualifiers is considered to be part of + the instrumentation and is out of scope for this module. An + empty string is used when this is part of a key."; + } + + /* + * Groupings + */ + + grouping common-alarm-parameters { + description + "Common parameters for an alarm. + + This grouping is used both in the alarm list and in the + notification representing an alarm-state change."; + leaf resource { + type resource; + mandatory true; + description + "The alarming resource. See also 'alt-resource'. This could + be, for example, a reference to the alarming interface"; + } + leaf alarm-type-id { + type alarm-type-id; + mandatory true; + description + "This leaf and the leaf 'alarm-type-qualifier' together + provide a unique identification of the alarm type."; + } + leaf alarm-type-qualifier { + type alarm-type-qualifier; + description + "This leaf is used when the 'alarm-type-id' leaf cannot + uniquely identify the alarm type. Normally, this is not the + case, and this leaf is the empty string."; + } + leaf-list alt-resource { + type resource; + description + "Used if the alarming resource is available over other + interfaces. This field can contain SNMP OIDs, CIM paths, or + 3GPP distinguished names, for example."; + } + list related-alarm { + if-feature "alarm-correlation"; + key "resource alarm-type-id alarm-type-qualifier"; + description + "References to related alarms. Note that the related alarm + might have been purged from the alarm list."; + leaf resource { + type leafref { + path "/alarms/alarm-list/alarm/resource"; + require-instance false; + } + description + "The alarming resource for the related alarm."; + } + leaf alarm-type-id { + type leafref { + path "/alarms/alarm-list/alarm" + + "[resource=current()/../resource]" + + "/alarm-type-id"; + require-instance false; + } + description + "The alarm type identifier for the related alarm."; + } + leaf alarm-type-qualifier { + type leafref { + path "/alarms/alarm-list/alarm" + + "[resource=current()/../resource]" + + "[alarm-type-id=current()/../alarm-type-id]" + + "/alarm-type-qualifier"; + require-instance false; + } + description + "The alarm qualifier for the related alarm."; + } + } + leaf-list impacted-resource { + if-feature "service-impact-analysis"; + type resource; + description + "Resources that might be affected by this alarm. If the + system creates an alarm on a resource and also has a mapping + to other resources that might be impacted, these resources + can be listed in this leaf-list. In this way, the system + can create one alarm instead of several. For example, if an + interface has an alarm, the 'impacted-resource' can + reference the aggregated port channels."; + } + leaf-list root-cause-resource { + if-feature "root-cause-analysis"; + type resource; + description + "Resources that are candidates for causing the alarm. If the + system has a mechanism to understand the candidate root + causes of an alarm, this leaf-list can be used to list the + root-cause candidate resources. In this way, the system can + create one alarm instead of several. An example might be a + logging system (alarm resource) that fails; the alarm can + reference the file system in the 'root-cause-resource' + leaf-list. Note that the intended use is not to also send + an alarm with the 'root-cause-resource' as an alarming + resource. The 'root-cause-resource' leaf-list is a hint and + should not also generate an alarm for the same problem."; + } + } + + grouping alarm-state-change-parameters { + description + "Parameters for an alarm-state change. + + This grouping is used both in the alarm list's status-change + list and in the notification representing an alarm-state + change."; + leaf time { + type yang:date-and-time; + mandatory true; + description + "The time the status of the alarm changed. The value + represents the time the real alarm-state change appeared in + the resource and not when it was added to the alarm + list. The /alarm-list/alarm/last-changed MUST be set to the + same value."; + } + leaf perceived-severity { + type severity-with-clear; + mandatory true; + description + "The severity of the alarm as defined by X.733. Note that + this may not be the original severity since the alarm may + have changed severity."; + reference + "ITU-T Recommendation X.733: Information Technology + - Open Systems Interconnection + - System Management: Alarm Reporting Function"; + } + leaf alarm-text { + type alarm-text; + mandatory true; + description + "A user-friendly text describing the alarm-state change."; + reference + "ITU-T Recommendation X.733: Information Technology + - Open Systems Interconnection + - System Management: Alarm Reporting Function"; + } + } + + grouping operator-parameters { + description + "This grouping defines parameters that can be changed by an + operator."; + leaf time { + type yang:date-and-time; + mandatory true; + description + "Timestamp for operator action on the alarm."; + } + leaf operator { + type string; + mandatory true; + description + "The name of the operator that has acted on this alarm."; + } + leaf state { + type operator-state; + mandatory true; + description + "The operator's view of the alarm state."; + } + leaf text { + type string; + description + "Additional optional textual information provided by the + operator."; + } + } + + grouping resource-alarm-parameters { + description + "Alarm parameters that originate from the resource view."; + leaf is-cleared { + type boolean; + mandatory true; + description + "Indicates the current clearance state of the alarm. An + alarm might toggle from active alarm to cleared alarm and + back to active again."; + } + leaf last-raised { + type yang:date-and-time; + mandatory true; + description + "An alarm may change severity level and toggle between + active and cleared during its lifetime. This leaf indicates + the last time it was raised ('is-cleared' = 'false')."; + } + leaf last-changed { + type yang:date-and-time; + mandatory true; + description + "A timestamp when the 'status-change' or + 'operator-state-change' list was last changed."; + } + leaf perceived-severity { + type severity; + mandatory true; + description + "The last severity of the alarm. + + If an alarm was raised with severity 'warning' but later + changed to 'major', this leaf will show 'major'."; + } + leaf alarm-text { + type alarm-text; + mandatory true; + description + "The last reported alarm text. This text should contain + information for an operator to be able to understand the + problem and how to resolve it."; + } + list status-change { + if-feature "alarm-history"; + key "time"; + min-elements 1; + description + "A list of status-change events for this alarm. + + The entry with latest timestamp in this list MUST + correspond to the leafs 'is-cleared', 'perceived-severity', + and 'alarm-text' for the alarm. + + This list is ordered according to the timestamps of alarm + state changes. The first item corresponds to the latest + state change. + + The following state changes create an entry in this + list: + - changed severity (warning, minor, major, critical) + - clearance status; this also updates the 'is-cleared' + leaf + - alarm-text update"; + uses alarm-state-change-parameters; + } + } + + grouping filter-input { + description + "Grouping to specify a filter construct on alarm information."; + leaf alarm-clearance-status { + type enumeration { + enum any { + description + "Ignore alarm-clearance status."; + } + enum cleared { + description + "Filter cleared alarms."; + } + enum not-cleared { + description + "Filter not-cleared alarms."; + } + } + mandatory true; + description + "The clearance status of the alarm."; + } + container older-than { + presence "Age specification"; + description + "Matches the 'last-status-change' leaf in the alarm."; + choice age-spec { + description + "Filter using date and time age."; + case seconds { + leaf seconds { + type uint16; + description + "Age expressed in seconds."; + } + } + case minutes { + leaf minutes { + type uint16; + description + "Age expressed in minutes."; + } + } + case hours { + leaf hours { + type uint16; + description + "Age expressed in hours."; + } + } + case days { + leaf days { + type uint16; + description + "Age expressed in days."; + } + } + case weeks { + leaf weeks { + type uint16; + description + "Age expressed in weeks."; + } + } + } + } + container severity { + presence "Severity filter"; + choice sev-spec { + description + "Filter based on severity level."; + leaf below { + type severity; + description + "Severity less than this leaf."; + } + leaf is { + type severity; + description + "Severity level equal to this leaf."; + } + leaf above { + type severity; + description + "Severity level higher than this leaf."; + } + } + description + "Filter based on severity."; + } + container operator-state-filter { + if-feature "operator-actions"; + presence "Operator state filter"; + leaf state { + type operator-state; + description + "Filter on operator state."; + } + leaf user { + type string; + description + "Filter based on which operator."; + } + description + "Filter based on operator state."; + } + } + + /* + * The /alarms data tree + */ + + container alarms { + description + "The top container for this module."; + container control { + description + "Configuration to control the alarm behavior."; + leaf max-alarm-status-changes { + type union { + type uint16; + type enumeration { + enum infinite { + description + "The status-change entries are accumulated + infinitely."; + } + } + } + default "32"; + description + "The 'status-change' entries are kept in a circular list + per alarm. When this number is exceeded, the oldest + status change entry is automatically removed. If the + value is 'infinite', the status-change entries are + accumulated infinitely."; + } + leaf notify-status-changes { + type enumeration { + enum all-state-changes { + description + "Send notifications for all status changes."; + } + enum raise-and-clear { + description + "Send notifications only for raise, clear, and + re-raise. Notifications for severity-level changes or + alarm-text changes are not sent."; + } + enum severity-level { + description + "Only send notifications for alarm-state changes + crossing the level specified in + 'notify-severity-level'. Always send clear + notifications."; + } + } + must '. != "severity-level" or ../notify-severity-level' { + description + "When notify-status-changes is 'severity-level', a value + must be given for 'notify-severity-level'."; + } + default "all-state-changes"; + description + "This leaf controls the notifications sent for alarm status + updates. There are three options: + + 1. Notifications are sent for all updates, severity-level + changes, and alarm-text changes. + + 2. Notifications are only sent for alarm raise and clear. + + 3. Notifications are sent for status changes equal to or + above the specified severity level. Clear + notifications shall always be sent. Notifications + shall also be sent for state changes that make an + alarm less severe than the specified level. + + For example, in option 3, assume that the severity level + is set to major and that the alarm has the following state + changes: + + [(Time, severity, clear)]: + [(T1, major, -), (T2, minor, -), (T3, warning, -), + (T4, minor, -), (T5, major, -), (T6, critical, -), + (T7, major. -), (T8, major, clear)] + + In that case, notifications will be sent at times + T1, T2, T5, T6, T7, and T8."; + } + leaf notify-severity-level { + when '../notify-status-changes = "severity-level"'; + type severity; + description + "Only send notifications for alarm-state changes crossing + the specified level. Always send clear notifications."; + } + container alarm-shelving { + if-feature "alarm-shelving"; + description + "The 'alarm-shelving/shelf' list is used to shelve + (block/filter) alarms. The conditions in the shelf + criteria are logically ANDed. The first matching shelf is + used, and an alarm is shelved only for this first match. + Matching alarms MUST appear in the + /alarms/shelved-alarms/shelved-alarm list, and + non-matching /alarms MUST appear in the + /alarms/alarm-list/alarm list. The server does not send + any notifications for shelved alarms. + + The server MUST maintain states (e.g., severity + changes) for the shelved alarms. + + Alarms that match the criteria shall have an + operator state 'shelved'. When the shelf + configuration removes an alarm from the shelf, the server + shall add the operator state 'un-shelved'."; + list shelf { + key "name"; + //ordered-by user; + leaf name { + type string; + description + "An arbitrary name for the alarm shelf."; + } + description + "Each entry defines the criteria for shelving alarms. + Criteria are ANDed. If no criteria are specified, + all alarms will be shelved."; + leaf-list resource { + type resource-match; + description + "Shelve alarms for matching resources."; + } + list alarm-type { + key "alarm-type-id alarm-type-qualifier-match"; + description + "Any alarm matching the combined criteria of + 'alarm-type-id' and 'alarm-type-qualifier-match' + MUST be matched."; + leaf alarm-type-id { + type alarm-type-id; + description + "Shelve all alarms that have an 'alarm-type-id' that + is equal to or derived from the given + 'alarm-type-id'."; + } + leaf alarm-type-qualifier-match { + type string; + description + "An XML Schema regular expression that is used to + match an alarm type qualifier. Shelve all alarms + that match this regular expression for the alarm + type qualifier."; + reference + "XML Schema Part 2: Datatypes Second Edition, + World Wide Web Consortium Recommendation + REC-xmlschema-2-20041028"; + } + } + leaf description { + type string; + description + "An optional textual description of the shelf. This + description should include the reason for shelving + these alarms."; + } + } + } + } + container alarm-inventory { + config false; + description + "The 'alarm-inventory/alarm-type' list contains all possible + alarm types for the system. + + If the system knows for which resources a specific alarm + type can appear, it is also identified in the inventory. + The list also tells if each alarm type has a corresponding + clear state. The inventory shall only contain concrete + alarm types. + + The alarm inventory MUST be updated by the system when new + alarms can appear. This can be the case when installing new + software modules or inserting new card types. A + notification 'alarm-inventory-changed' is sent when the + inventory is changed."; + list alarm-type { + key "alarm-type-id alarm-type-qualifier"; + description + "An entry in this list defines a possible alarm."; + leaf alarm-type-id { + type alarm-type-id; + description + "The statically defined alarm type identifier for this + possible alarm."; + } + leaf alarm-type-qualifier { + type alarm-type-qualifier; + description + "The optionally dynamically defined alarm type identifier + for this possible alarm."; + } + leaf-list resource { + type resource-match; + description + "Optionally, specifies for which resources the alarm type + is valid."; + } + leaf will-clear { + type boolean; + mandatory true; + description + "This leaf tells the operator if the alarm will be + cleared when the correct corrective action has been + taken. Implementations SHOULD strive for detecting the + cleared state for all alarm types. + + If this leaf is 'true', the operator can monitor the + alarm until it becomes cleared after the corrective + action has been taken. + + If this leaf is 'false', the operator needs to validate + that the alarm is no longer active using other + mechanisms. Alarms can lack a corresponding clear due + to missing instrumentation or no logical + corresponding clear state."; + } + leaf-list severity-level { + type severity; + description + "This leaf-list indicates the possible severity levels of + this alarm type. Note well that 'clear' is not part of + the severity type. In general, the severity level + should be defined by the instrumentation based on the + dynamic state, rather than being defined statically by + the alarm type, in order to provide a relevant severity + level based on dynamic state and context. However, most + alarm types have a defined set of possible severity + levels, and this should be provided here."; + } + leaf description { + type string; + mandatory true; + description + "A description of the possible alarm. It SHOULD include + information on possible underlying root causes and + corrective actions."; + } + } + } + container summary { + if-feature "alarm-summary"; + config false; + description + "This container gives a summary of the number of alarms."; + list alarm-summary { + key "severity"; + description + "A global summary of all alarms in the system. The summary + does not include shelved alarms."; + leaf severity { + type severity; + description + "Alarm summary for this severity level."; + } + leaf total { + type yang:gauge32; + description + "Total number of alarms of this severity level."; + } + leaf not-cleared { + type yang:gauge32; + description + "Total number of alarms of this severity level + that are not cleared."; + } + leaf cleared { + type yang:gauge32; + description + "For this severity level, the number of alarms that are + cleared."; + } + leaf cleared-not-closed { + if-feature "operator-actions"; + type yang:gauge32; + description + "For this severity level, the number of alarms that are + cleared but not closed."; + } + leaf cleared-closed { + if-feature "operator-actions"; + type yang:gauge32; + description + "For this severity level, the number of alarms that are + cleared and closed."; + } + leaf not-cleared-closed { + if-feature "operator-actions"; + type yang:gauge32; + description + "For this severity level, the number of alarms that are + not cleared but closed."; + } + leaf not-cleared-not-closed { + if-feature "operator-actions"; + type yang:gauge32; + description + "For this severity level, the number of alarms that are + not cleared and not closed."; + } + } + leaf shelves-active { + if-feature "alarm-shelving"; + type empty; + description + "This is a hint to the operator that there are active + alarm shelves. This leaf MUST exist if the + /alarms/shelved-alarms/number-of-shelved-alarms is > 0."; + } + } + container alarm-list { + config false; + description + "The alarms in the system."; + leaf number-of-alarms { + type yang:gauge32; + description + "This object shows the total number of + alarms in the system, i.e., the total number + of entries in the alarm list."; + } + leaf last-changed { + type yang:date-and-time; + description + "A timestamp when the alarm list was last + changed. The value can be used by a manager to + initiate an alarm resynchronization procedure."; + } + list alarm { + key "resource alarm-type-id alarm-type-qualifier"; + description + "The list of alarms. Each entry in the list holds one + alarm for a given alarm type and resource. An alarm can + be updated from the underlying resource or by the user. + The following leafs are maintained by the resource: + 'is-cleared', 'last-change', 'perceived-severity', and + 'alarm-text'. An operator can change 'operator-state' and + 'operator-text'. + + Entries appear in the alarm list the first time an alarm + becomes active for a given alarm type and resource. + Entries do not get deleted when the alarm is cleared. + Clear status is represented as a boolean flag. + + Alarm entries are removed, i.e., purged, from the list by + an explicit purge action. For example, purge all alarms + that are cleared and in closed operator state that are + older than 24 hours. Purged alarms are removed from the + alarm list. If the alarm resource state changes after a + purge, the alarm will reappear in the alarm list. + + Systems may also remove alarms based on locally configured + policies; this is out of scope for this module."; + uses common-alarm-parameters; + leaf time-created { + type yang:date-and-time; + mandatory true; + description + "The timestamp when this alarm entry was created. This + represents the first time the alarm appeared; it can + also represent that the alarm reappeared after a purge. + Further state changes of the same alarm do not change + this leaf; these changes will update the 'last-changed' + leaf."; + } + uses resource-alarm-parameters; + list operator-state-change { + if-feature "operator-actions"; + key "time"; + description + "This list is used by operators to indicate the state of + human intervention on an alarm. For example, if an + operator has seen an alarm, the operator can add a new + item to this list indicating that the alarm is + acknowledged."; + uses operator-parameters; + } + action set-operator-state { + if-feature "operator-actions"; + description + "This is a means for the operator to indicate the level + of human intervention on an alarm."; + input { + leaf state { + type writable-operator-state; + mandatory true; + description + "Set this operator state."; + } + leaf text { + type string; + description + "Additional optional textual information."; + } + } + } + notification operator-action { + if-feature "operator-actions"; + description + "This notification is used to report that an operator + acted upon an alarm."; + uses operator-parameters; + } + } + action purge-alarms { + description + "This operation requests that the server delete entries + from the alarm list according to the supplied criteria. + + Typically, this operation is used to delete alarms that + are in closed operator state and older than a specified + time. + + The number of purged alarms is returned as an output + parameter."; + input { + uses filter-input; + } + output { + leaf purged-alarms { + type uint32; + description + "Number of purged alarms."; + } + } + } + action compress-alarms { + if-feature "alarm-history"; + description + "This operation requests that the server compress + entries in the alarm list by removing all but the + latest 'status-change' entry for all matching alarms. + Conditions in the input are logically ANDed. If no + input condition is given, all alarms are compressed."; + input { + leaf resource { + type resource-match; + description + "Compress the alarms matching this resource."; + } + leaf alarm-type-id { + type leafref { + path "/alarms/alarm-list/alarm/alarm-type-id"; + require-instance false; + } + description + "Compress alarms with this 'alarm-type-id'."; + } + leaf alarm-type-qualifier { + type leafref { + path "/alarms/alarm-list/alarm/alarm-type-qualifier"; + require-instance false; + } + description + "Compress the alarms with this + 'alarm-type-qualifier'."; + } + } + output { + leaf compressed-alarms { + type uint32; + description + "Number of compressed alarm entries."; + } + } + } + } + container shelved-alarms { + if-feature "alarm-shelving"; + config false; + description + "The shelved alarms. Alarms appear here if they match the + criteria in /alarms/control/alarm-shelving. This list does + not generate any notifications. The list represents alarms + that are considered not relevant by the operator. Alarms in + this list have an 'operator-state' of 'shelved'. This + cannot be changed."; + leaf number-of-shelved-alarms { + type yang:gauge32; + description + "This object shows the total number of current + alarms, i.e., the total number of entries + in the alarm list."; + } + leaf shelved-alarms-last-changed { + type yang:date-and-time; + description + "A timestamp when the shelved-alarm list was last changed. + The value can be used by a manager to initiate an alarm + resynchronization procedure."; + } + list shelved-alarm { + key "resource alarm-type-id alarm-type-qualifier"; + description + "The list of shelved alarms. Shelved alarms can only be + updated from the underlying resource; no operator actions + are supported."; + uses common-alarm-parameters; + leaf shelf-name { + type leafref { + path "/alarms/control/alarm-shelving/shelf/name"; + require-instance false; + } + description + "The name of the shelf."; + } + uses resource-alarm-parameters; + list operator-state-change { + if-feature "operator-actions"; + key "time"; + description + "This list is used by operators to indicate the state of + human intervention on an alarm. For shelved alarms, the + system has set the list item in the list to 'shelved'."; + uses operator-parameters; + } + } + action purge-shelved-alarms { + description + "This operation requests that the server delete entries from + the shelved-alarm list according to the supplied criteria. + In the shelved-alarm list, it makes sense to delete alarms + that are not relevant anymore. + + The number of purged alarms is returned as an output + parameter."; + input { + uses filter-input; + } + output { + leaf purged-alarms { + type uint32; + description + "Number of purged alarms."; + } + } + } + action compress-shelved-alarms { + if-feature "alarm-history"; + description + "This operation requests that the server compress entries + in the shelved-alarm list by removing all but the latest + 'status-change' entry for all matching shelved alarms. + Conditions in the input are logically ANDed. If no input + condition is given, all alarms are compressed."; + input { + leaf resource { + type leafref { + path "/alarms/shelved-alarms/shelved-alarm/resource"; + require-instance false; + } + description + "Compress the alarms with this resource."; + } + leaf alarm-type-id { + type leafref { + path "/alarms/shelved-alarms/shelved-alarm" + + "/alarm-type-id"; + require-instance false; + } + description + "Compress alarms with this 'alarm-type-id'."; + } + leaf alarm-type-qualifier { + type leafref { + path "/alarms/shelved-alarms/shelved-alarm" + + "/alarm-type-qualifier"; + require-instance false; + } + description + "Compress the alarms with this + 'alarm-type-qualifier'."; + } + } + output { + leaf compressed-alarms { + type uint32; + description + "Number of compressed alarm entries."; + } + } + } + } + list alarm-profile { + if-feature "alarm-profile"; + key "alarm-type-id alarm-type-qualifier-match resource"; + //ordered-by user; + description + "This list is used to assign further information or + configuration for each alarm type. This module supports a + mechanism where the client can override the system-default + alarm severity levels. The 'alarm-profile' is also a useful + augmentation point for specific additions to alarm types."; + leaf alarm-type-id { + type alarm-type-id; + description + "The alarm type identifier to match."; + } + leaf alarm-type-qualifier-match { + type string; + description + "An XML Schema regular expression that is used to match the + alarm type qualifier."; + reference + "XML Schema Part 2: Datatypes Second Edition, + World Wide Web Consortium Recommendation + REC-xmlschema-2-20041028"; + } + leaf resource { + type resource-match; + description + "Specifies which resources to match."; + } + leaf description { + type string; + mandatory true; + description + "A description of the alarm profile."; + } + container alarm-severity-assignment-profile { + if-feature "severity-assignment"; + description + "The client can override the system-default severity + level."; + reference + "ITU-T Recommendation M.3100: + Generic network information model + ITU-T Recommendation M.3160: + Generic, protocol-neutral management information model"; + leaf-list severity-level { + type severity; + //ordered-by user; + description + "Specifies the configured severity level(s) for the + matching alarm. If the alarm has several severity + levels, the leaf-list shall be given in rising severity + order. The original M3100/M3160 ASAP function only + allows for a one-to-one mapping between alarm type and + severity, but since YANG module supports stateful + alarms, the mapping must allow for several severity + levels. + + Assume a high-utilization alarm type with two thresholds + with the system-default severity levels of threshold1 = + warning and threshold2 = minor. Setting this leaf-list + to (minor, major) will assign the severity levels as + threshold1 = minor and threshold2 = major"; + } + } + } + } + + /* + * Notifications + */ + + notification alarm-notification { + description + "This notification is used to report a state change for an + alarm. The same notification is used for reporting a newly + raised alarm, a cleared alarm, or changing the text and/or + severity of an existing alarm."; + uses common-alarm-parameters; + uses alarm-state-change-parameters; + } + + notification alarm-inventory-changed { + description + "This notification is used to report that the list of possible + alarms has changed. This can happen when, for example, a new + software module is installed or a new physical card is + inserted."; + } +} diff --git a/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/yang/ietf-hardware.yang b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/yang/ietf-hardware.yang new file mode 100755 index 000000000..f444e26ee --- /dev/null +++ b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/yang/ietf-hardware.yang @@ -0,0 +1,1141 @@ +module ietf-hardware { +yang-version 1.1; +namespace "urn:ietf:params:xml:ns:yang:ietf-hardware"; +prefix hw; + +import ietf-inet-types { + prefix inet; +} +import ietf-yang-types { + prefix yang; +} +import iana-hardware { + prefix ianahw; +} + +organization + "IETF NETMOD (Network Modeling) Working Group"; + +contact + "WG Web: <https://datatracker.ietf.org/wg/netmod/> + WG List: <mailto:netmod@ietf.org> + Editor: Andy Bierman + <mailto:andy@yumaworks.com> + Editor: Martin Bjorklund + <mailto:mbj@tail-f.com> + Editor: Jie Dong + <mailto:jie.dong@huawei.com> + Editor: Dan Romascanu + <mailto:dromasca@gmail.com>"; + +description + "This module contains a collection of YANG definitions for + managing hardware. + This data model is designed for the Network Management Datastore + Architecture (NMDA) defined in RFC 8342. + Copyright (c) 2018 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 8348; see + the RFC itself for full legal notices."; + +revision 2018-03-13 { + description + "Initial revision."; + reference + "RFC 8348: A YANG Data Model for Hardware Management"; +} + +/* + * Features + */ + +feature entity-mib { + description + "This feature indicates that the device implements + the ENTITY-MIB."; + reference + "RFC 6933: Entity MIB (Version 4)"; +} + +feature hardware-state { + description + "Indicates that ENTITY-STATE-MIB objects are supported"; + reference + "RFC 4268: Entity State MIB"; +} + +feature hardware-sensor { + description + "Indicates that ENTITY-SENSOR-MIB objects are supported"; + reference + "RFC 3433: Entity Sensor Management Information Base"; +} + +/* + * Typedefs + */ + +typedef admin-state { + type enumeration { + enum unknown { + value 1; + description + "The resource is unable to report administrative state."; + } + enum locked { + value 2; + description + "The resource is administratively prohibited from use."; + } + enum shutting-down { + value 3; + description + "The resource usage is administratively limited to current + instances of use."; + } + enum unlocked { + value 4; + description + "The resource is not administratively prohibited from + use."; + } + } + description + "Represents the various possible administrative states."; + reference + "RFC 4268: Entity State MIB - EntityAdminState"; +} + +typedef oper-state { + type enumeration { + enum unknown { + value 1; + description + "The resource is unable to report its operational state."; + } + enum disabled { + value 2; + description + "The resource is totally inoperable."; + } + enum enabled { + value 3; + + description + "The resource is partially or fully operable."; + } + enum testing { + value 4; + description + "The resource is currently being tested and cannot + therefore report whether or not it is operational."; + } + } + description + "Represents the possible values of operational states."; + reference + "RFC 4268: Entity State MIB - EntityOperState"; +} + +typedef usage-state { + type enumeration { + enum unknown { + value 1; + description + "The resource is unable to report usage state."; + } + enum idle { + value 2; + description + "The resource is servicing no users."; + } + enum active { + value 3; + description + "The resource is currently in use, and it has sufficient + spare capacity to provide for additional users."; + } + enum busy { + value 4; + description + "The resource is currently in use, but it currently has no + spare capacity to provide for additional users."; + } + } + description + "Represents the possible values of usage states."; + reference + "RFC 4268: Entity State MIB - EntityUsageState"; +} + +typedef alarm-state { + type bits { + bit unknown { + position 0; + description + "The resource is unable to report alarm state."; + } + bit under-repair { + position 1; + description + "The resource is currently being repaired, which, depending + on the implementation, may make the other values in this + bit string not meaningful."; + } + bit critical { + position 2; + description + "One or more critical alarms are active against the + resource."; + } + bit major { + position 3; + description + "One or more major alarms are active against the + resource."; + } + bit minor { + position 4; + description + "One or more minor alarms are active against the + resource."; + } + bit warning { + position 5; + description + "One or more warning alarms are active against the + resource."; + } + bit indeterminate { + position 6; + description + "One or more alarms of whose perceived severity cannot be + determined are active against this resource."; + } + } + description + "Represents the possible values of alarm states. An alarm is a + persistent indication of an error or warning condition. + When no bits of this attribute are set, then no active alarms + are known against this component and it is not under repair."; + reference + "RFC 4268: Entity State MIB - EntityAlarmStatus"; +} + +typedef standby-state { + type enumeration { + enum unknown { + value 1; + description + "The resource is unable to report standby state."; + } + enum hot-standby { + value 2; + description + "The resource is not providing service, but it will be + immediately able to take over the role of the resource to + be backed up, without the need for initialization + activity, and will contain the same information as the + resource to be backed up."; + } + enum cold-standby { + value 3; + description + "The resource is to back up another resource, but it will + not be immediately able to take over the role of a + resource to be backed up and will require some + initialization activity."; + } + enum providing-service { + value 4; + description + "The resource is providing service."; + } + } + description + "Represents the possible values of standby states."; + reference + "RFC 4268: Entity State MIB - EntityStandbyStatus"; +} + +typedef sensor-value-type { + type enumeration { + enum other { + value 1; + description + "A measure other than those listed below."; + } + enum unknown { + value 2; + description + "An unknown measurement or arbitrary, relative numbers"; + } + enum volts-AC { + value 3; + description + "A measure of electric potential (alternating current)."; + } + enum volts-DC { + value 4; + description + "A measure of electric potential (direct current)."; + } + enum amperes { + value 5; + description + "A measure of electric current."; + } + enum watts { + value 6; + description + "A measure of power."; + } + enum hertz { + value 7; + description + "A measure of frequency."; + } + enum celsius { + value 8; + description + "A measure of temperature."; + } + enum percent-RH { + value 9; + description + "A measure of percent relative humidity."; + } + enum rpm { + value 10; + description + "A measure of shaft revolutions per minute."; + } + enum cmm { + value 11; + description + "A measure of cubic meters per minute (airflow)."; + } + enum truth-value { + value 12; + description + "Value is one of 1 (true) or 2 (false)"; + } + } + description + "A node using this data type represents the sensor measurement + data type associated with a physical sensor value. The actual + data units are determined by examining a node of this type + together with the associated sensor-value-scale node. + A node of this type SHOULD be defined together with nodes of + type sensor-value-scale and type sensor-value-precision. + These three types are used to identify the semantics of a node + of type sensor-value."; + reference + "RFC 3433: Entity Sensor Management Information Base - + EntitySensorDataType"; +} + +typedef sensor-value-scale { + type enumeration { + enum yocto { + value 1; + description + "Data scaling factor of 10^-24."; + } + enum zepto { + value 2; + description + "Data scaling factor of 10^-21."; + } + enum atto { + value 3; + description + "Data scaling factor of 10^-18."; + } + enum femto { + value 4; + description + "Data scaling factor of 10^-15."; + } + enum pico { + value 5; + description + "Data scaling factor of 10^-12."; + } + enum nano { + value 6; + description + "Data scaling factor of 10^-9."; + } + enum micro { + value 7; + description + "Data scaling factor of 10^-6."; + } + enum milli { + value 8; + description + "Data scaling factor of 10^-3."; + } + enum units { + value 9; + description + "Data scaling factor of 10^0."; + } + enum kilo { + value 10; + description + "Data scaling factor of 10^3."; + } + enum mega { + value 11; + description + "Data scaling factor of 10^6."; + } + enum giga { + value 12; + description + "Data scaling factor of 10^9."; + } + enum tera { + value 13; + description + "Data scaling factor of 10^12."; + } + enum peta { + value 14; + description + "Data scaling factor of 10^15."; + } + enum exa { + value 15; + description + "Data scaling factor of 10^18."; + } + enum zetta { + value 16; + description + "Data scaling factor of 10^21."; + } + enum yotta { + value 17; + description + "Data scaling factor of 10^24."; + } + } + description + "A node using this data type represents a data scaling factor, + represented with an International System of Units (SI) prefix. + The actual data units are determined by examining a node of + this type together with the associated sensor-value-type. + A node of this type SHOULD be defined together with nodes of + type sensor-value-type and type sensor-value-precision. + Together, associated nodes of these three types are used to + identify the semantics of a node of type sensor-value."; + reference + "RFC 3433: Entity Sensor Management Information Base - + EntitySensorDataScale"; +} + +typedef sensor-value-precision { + type int8 { + range "-8 .. 9"; + } + description + "A node using this data type represents a sensor value + precision range. + A node of this type SHOULD be defined together with nodes of + type sensor-value-type and type sensor-value-scale. Together, + associated nodes of these three types are used to identify the + semantics of a node of type sensor-value. + If a node of this type contains a value in the range 1 to 9, + it represents the number of decimal places in the fractional + part of an associated sensor-value fixed-point number. + If a node of this type contains a value in the range -8 to -1, + it represents the number of accurate digits in the associated + sensor-value fixed-point number. + The value zero indicates the associated sensor-value node is + not a fixed-point number. + Server implementers must choose a value for the associated + sensor-value-precision node so that the precision and accuracy + of the associated sensor-value node is correctly indicated. + For example, a component representing a temperature sensor + that can measure 0 to 100 degrees C in 0.1 degree + increments, +/- 0.05 degrees, would have a + sensor-value-precision value of '1', a sensor-value-scale + value of 'units', and a sensor-value ranging from '0' to + '1000'. The sensor-value would be interpreted as + 'degrees C * 10'."; + reference + "RFC 3433: Entity Sensor Management Information Base - + EntitySensorPrecision"; +} + +typedef sensor-value { + type int32 { + range "-1000000000 .. 1000000000"; + } + description + "A node using this data type represents a sensor value. + A node of this type SHOULD be defined together with nodes of + type sensor-value-type, type sensor-value-scale, and + type sensor-value-precision. Together, associated nodes of + those three types are used to identify the semantics of a node + of this data type. + The semantics of a node using this data type are determined by + the value of the associated sensor-value-type node. + If the associated sensor-value-type node is equal to 'voltsAC', + 'voltsDC', 'amperes', 'watts', 'hertz', 'celsius', or 'cmm', + then a node of this type MUST contain a fixed-point number + ranging from -999,999,999 to +999,999,999. The value + -1000000000 indicates an underflow error. The value + +1000000000 indicates an overflow error. The + sensor-value-precision indicates how many fractional digits + are represented in the associated sensor-value node. + If the associated sensor-value-type node is equal to + 'percentRH', then a node of this type MUST contain a number + ranging from 0 to 100. + If the associated sensor-value-type node is equal to 'rpm', + then a node of this type MUST contain a number ranging from + -999,999,999 to +999,999,999. + If the associated sensor-value-type node is equal to + 'truth-value', then a node of this type MUST contain either the + value 1 (true) or the value 2 (false). + If the associated sensor-value-type node is equal to 'other' or + 'unknown', then a node of this type MUST contain a number + ranging from -1000000000 to 1000000000."; + reference + "RFC 3433: Entity Sensor Management Information Base - + EntitySensorValue"; +} + +typedef sensor-status { + type enumeration { + enum ok { + value 1; + description + "Indicates that the server can obtain the sensor value."; + } + enum unavailable { + value 2; + description + "Indicates that the server presently cannot obtain the + sensor value."; + } + enum nonoperational { + value 3; + description + "Indicates that the server believes the sensor is broken. + The sensor could have a hard failure (disconnected wire) + or a soft failure such as out-of-range, jittery, or wildly + fluctuating readings."; + } + } + description + "A node using this data type represents the operational status + of a physical sensor."; + reference + "RFC 3433: Entity Sensor Management Information Base - + EntitySensorStatus"; +} + +/* + * Data nodes + */ + +container hardware { + description + "Data nodes representing components. + If the server supports configuration of hardware components, + then this data model is instantiated in the configuration + datastores supported by the server. The leaf-list 'datastore' + for the module 'ietf-hardware' in the YANG library provides + this information."; + + leaf last-change { + type yang:date-and-time; + config false; + description + "The time the '/hardware/component' list changed in the + operational state."; + } + + list component { + key name; + description + "List of components. + When the server detects a new hardware component, it + initializes a list entry in the operational state. + If the server does not support configuration of hardware + components, list entries in the operational state are + initialized with values for all nodes as detected by the + implementation. + Otherwise, this procedure is followed: + 1. If there is an entry in the '/hardware/component' list + in the intended configuration with values for the nodes + 'class', 'parent', and 'parent-rel-pos' that are equal + to the detected values, then the list entry in the + operational state is initialized with the configured + values, including the 'name'. + 2. Otherwise (i.e., there is no matching configuration + entry), the list entry in the operational state is + initialized with values for all nodes as detected by + the implementation. + If the '/hardware/component' list in the intended + configuration is modified, then the system MUST behave as if + it re-initializes itself and follow the procedure in (1)."; + reference + "RFC 6933: Entity MIB (Version 4) - entPhysicalEntry"; + + leaf name { + type string; + description + "The name assigned to this component. + This name is not required to be the same as + entPhysicalName."; + } + + leaf class { + type identityref { + base ianahw:hardware-class; + } + mandatory true; + description + "An indication of the general hardware type of the + component."; + reference + "RFC 6933: Entity MIB (Version 4) - entPhysicalClass"; + } + + leaf physical-index { + if-feature entity-mib; + type int32 { + range "1..2147483647"; + } + config false; + description + "The entPhysicalIndex for the entPhysicalEntry represented + by this list entry."; + reference + "RFC 6933: Entity MIB (Version 4) - entPhysicalIndex"; + } + + leaf description { + type string; + config false; + description + "A textual description of the component. This node should + contain a string that identifies the manufacturer's name + for the component and should be set to a distinct value + for each version or model of the component."; + reference + "RFC 6933: Entity MIB (Version 4) - entPhysicalDescr"; + } + + leaf parent { + type leafref { + path "../../component/name"; + require-instance false; + } + description + "The name of the component that physically contains this + component. + If this leaf is not instantiated, it indicates that this + component is not contained in any other component. + In the event that a physical component is contained by + more than one physical component (e.g., double-wide + modules), this node contains the name of one of these + components. An implementation MUST use the same name + every time this node is instantiated."; + reference + "RFC 6933: Entity MIB (Version 4) - entPhysicalContainedIn"; + } + + leaf parent-rel-pos { + type int32 { + range "0 .. 2147483647"; + } + description + "An indication of the relative position of this child + component among all its sibling components. Sibling + components are defined as components that: + o share the same value of the 'parent' node and + o share a common base identity for the 'class' node. + Note that the last rule gives implementations flexibility + in how components are numbered. For example, some + implementations might have a single number series for all + components derived from 'ianahw:port', while some others + might have different number series for different + components with identities derived from 'ianahw:port' (for + example, one for registered jack 45 (RJ45) and one for + small form-factor pluggable (SFP))."; + + reference + "RFC 6933: Entity MIB (Version 4) - + entPhysicalParentRelPos"; + } + + leaf-list contains-child { + type leafref { + path "../../component/name"; + } + config false; + description + "The name of the contained component."; + reference + "RFC 6933: Entity MIB (Version 4) - entPhysicalChildIndex"; + } + + leaf hardware-rev { + type string; + config false; + description + "The vendor-specific hardware revision string for the + component. The preferred value is the hardware revision + identifier actually printed on the component itself (if + present)."; + reference + "RFC 6933: Entity MIB (Version 4) - + entPhysicalHardwareRev"; + } + + leaf firmware-rev { + type string; + config false; + description + "The vendor-specific firmware revision string for the + component."; + reference + "RFC 6933: Entity MIB (Version 4) - + entPhysicalFirmwareRev"; + } + + leaf software-rev { + type string; + config false; + + description + "The vendor-specific software revision string for the + component."; + reference + "RFC 6933: Entity MIB (Version 4) - + entPhysicalSoftwareRev"; + } + + leaf serial-num { + type string; + config false; + description + "The vendor-specific serial number string for the + component. The preferred value is the serial number + string actually printed on the component itself (if + present)."; + reference + "RFC 6933: Entity MIB (Version 4) - entPhysicalSerialNum"; + } + + leaf mfg-name { + type string; + config false; + description + "The name of the manufacturer of this physical component. + The preferred value is the manufacturer name string + actually printed on the component itself (if present). + Note that comparisons between instances of the + 'model-name', 'firmware-rev', 'software-rev', and + 'serial-num' nodes are only meaningful amongst components + with the same value of 'mfg-name'. + If the manufacturer name string associated with the + physical component is unknown to the server, then this + node is not instantiated."; + reference + "RFC 6933: Entity MIB (Version 4) - entPhysicalMfgName"; + } + + leaf model-name { + type string; + config false; + description + "The vendor-specific model name identifier string + associated with this physical component. The preferred + value is the customer-visible part number, which may be + printed on the component itself. + If the model name string associated with the physical + component is unknown to the server, then this node is not + instantiated."; + reference + "RFC 6933: Entity MIB (Version 4) - entPhysicalModelName"; + } + + leaf alias { + type string; + description + "An 'alias' name for the component, as specified by a + network manager, that provides a non-volatile 'handle' for + the component. + If no configured value exists, the server MAY set the + value of this node to a locally unique value in the + operational state. + A server implementation MAY map this leaf to the + entPhysicalAlias MIB object. Such an implementation needs + to use some mechanism to handle the differences in size + and characters allowed between this leaf and + entPhysicalAlias. The definition of such a mechanism is + outside the scope of this document."; + reference + "RFC 6933: Entity MIB (Version 4) - entPhysicalAlias"; + } + + leaf asset-id { + type string; + description + "This node is a user-assigned asset tracking identifier for + the component. + A server implementation MAY map this leaf to the + entPhysicalAssetID MIB object. Such an implementation + needs to use some mechanism to handle the differences in + size and characters allowed between this leaf and + entPhysicalAssetID. The definition of such a mechanism is + outside the scope of this document."; + reference + "RFC 6933: Entity MIB (Version 4) - entPhysicalAssetID"; + } + + leaf is-fru { + type boolean; + config false; + + description + "This node indicates whether or not this component is + considered a 'field-replaceable unit' by the vendor. If + this node contains the value 'true', then this component + identifies a field-replaceable unit. For all components + that are permanently contained within a field-replaceable + unit, the value 'false' should be returned for this + node."; + reference + "RFC 6933: Entity MIB (Version 4) - entPhysicalIsFRU"; + } + + leaf mfg-date { + type yang:date-and-time; + config false; + description + "The date of manufacturing of the managed component."; + reference + "RFC 6933: Entity MIB (Version 4) - entPhysicalMfgDate"; + } + + leaf-list uri { + type inet:uri; + description + "This node contains identification information about the + component."; + reference + "RFC 6933: Entity MIB (Version 4) - entPhysicalUris"; + } + + leaf uuid { + type yang:uuid; + config false; + description + "A Universally Unique Identifier of the component."; + reference + "RFC 6933: Entity MIB (Version 4) - entPhysicalUUID"; + } + + container state { + if-feature hardware-state; + description + "State-related nodes"; + reference + "RFC 4268: Entity State MIB"; + + leaf state-last-changed { + type yang:date-and-time; + config false; + description + "The date and time when the value of any of the + admin-state, oper-state, usage-state, alarm-state, or + standby-state changed for this component. + If there has been no change since the last + re-initialization of the local system, this node + contains the date and time of local system + initialization. If there has been no change since the + component was added to the local system, this node + contains the date and time of the insertion."; + reference + "RFC 4268: Entity State MIB - entStateLastChanged"; + } + + leaf admin-state { + type admin-state; + description + "The administrative state for this component. + This node refers to a component's administrative + permission to service both other components within its + containment hierarchy as well other users of its + services defined by means outside the scope of this + module. + Some components exhibit only a subset of the remaining + administrative state values. Some components cannot be + locked; hence, this node exhibits only the 'unlocked' + state. Other components cannot be shut down gracefully; + hence, this node does not exhibit the 'shutting-down' + state."; + reference + "RFC 4268: Entity State MIB - entStateAdmin"; + } + + leaf oper-state { + type oper-state; + config false; + description + "The operational state for this component. + Note that this node does not follow the administrative + state. An administrative state of 'down' does not + predict an operational state of 'disabled'. + Note that some implementations may not be able to + accurately report oper-state while the admin-state node + has a value other than 'unlocked'. In these cases, this + node MUST have a value of 'unknown'."; + reference + "RFC 4268: Entity State MIB - entStateOper"; + } + + leaf usage-state { + type usage-state; + config false; + description + "The usage state for this component. + This node refers to a component's ability to service + more components in a containment hierarchy. + Some components will exhibit only a subset of the usage + state values. Components that are unable to ever + service any components within a containment hierarchy + will always have a usage state of 'busy'. In some + cases, a component will be able to support only one + other component within its containment hierarchy and + will therefore only exhibit values of 'idle' and + 'busy'."; + reference + "RFC 4268: Entity State MIB - entStateUsage"; + } + + leaf alarm-state { + type alarm-state; + config false; + description + "The alarm state for this component. It does not + include the alarms raised on child components within its + containment hierarchy."; + reference + "RFC 4268: Entity State MIB - entStateAlarm"; + } + + leaf standby-state { + type standby-state; + config false; + description + "The standby state for this component. + Some components will exhibit only a subset of the + remaining standby state values. If this component + cannot operate in a standby role, the value of this node + will always be 'providing-service'."; + reference + "RFC 4268: Entity State MIB - entStateStandby"; + } + } + + container sensor-data { + when 'derived-from-or-self(../class, + "ianahw:sensor")' { + description + "Sensor data nodes present for any component of type + 'sensor'"; + } + if-feature hardware-sensor; + config false; + + description + "Sensor-related nodes."; + reference + "RFC 3433: Entity Sensor Management Information Base"; + + leaf value { + type sensor-value; + description + "The most recent measurement obtained by the server + for this sensor. + A client that periodically fetches this node should also + fetch the nodes 'value-type', 'value-scale', and + 'value-precision', since they may change when the value + is changed."; + reference + "RFC 3433: Entity Sensor Management Information Base - + entPhySensorValue"; + } + + leaf value-type { + type sensor-value-type; + description + "The type of data units associated with the + sensor value"; + reference + "RFC 3433: Entity Sensor Management Information Base - + entPhySensorType"; + } + leaf value-scale { + type sensor-value-scale; + description + "The (power of 10) scaling factor associated + with the sensor value"; + reference + "RFC 3433: Entity Sensor Management Information Base - + entPhySensorScale"; + } + + leaf value-precision { + type sensor-value-precision; + description + "The number of decimal places of precision + associated with the sensor value"; + reference + "RFC 3433: Entity Sensor Management Information Base - + entPhySensorPrecision"; + } + + leaf oper-status { + type sensor-status; + description + "The operational status of the sensor."; + reference + "RFC 3433: Entity Sensor Management Information Base - + entPhySensorOperStatus"; + } + + leaf units-display { + type string; + description + "A textual description of the data units that should be + used in the display of the sensor value."; + reference + "RFC 3433: Entity Sensor Management Information Base - + entPhySensorUnitsDisplay"; + } + + leaf value-timestamp { + type yang:date-and-time; + description + "The time the status and/or value of this sensor was last + obtained by the server."; + reference + "RFC 3433: Entity Sensor Management Information Base - + entPhySensorValueTimeStamp"; + } + leaf value-update-rate { + type uint32; + units "milliseconds"; + description + "An indication of the frequency that the server updates + the associated 'value' node, represented in + milliseconds. The value zero indicates: + - the sensor value is updated on demand (e.g., + when polled by the server for a get-request), + - the sensor value is updated when the sensor + value changes (event-driven), or + - the server does not know the update rate."; + reference + "RFC 3433: Entity Sensor Management Information Base - + entPhySensorValueUpdateRate"; + } + } + } +} + +/* + * Notifications + */ + +notification hardware-state-change { + description + "A hardware-state-change notification is generated when the + value of /hardware/last-change changes in the operational + state."; + reference + "RFC 6933: Entity MIB (Version 4) - entConfigChange"; +} + +notification hardware-state-oper-enabled { + if-feature hardware-state; + description + "A hardware-state-oper-enabled notification signifies that a + component has transitioned into the 'enabled' state."; + + leaf name { + type leafref { + path "/hardware/component/name"; + } + + description + "The name of the component that has transitioned into the + 'enabled' state."; + } + leaf admin-state { + type leafref { + path "/hardware/component/state/admin-state"; + } + description + "The administrative state for the component."; + } + leaf alarm-state { + type leafref { + path "/hardware/component/state/alarm-state"; + } + description + "The alarm state for the component."; + } + reference + "RFC 4268: Entity State MIB - entStateOperEnabled"; +} + +notification hardware-state-oper-disabled { + if-feature hardware-state; + description + "A hardware-state-oper-disabled notification signifies that a + component has transitioned into the 'disabled' state."; + + leaf name { + type leafref { + path "/hardware/component/name"; + } + description + "The name of the component that has transitioned into the + 'disabled' state."; + } + leaf admin-state { + type leafref { + path "/hardware/component/state/admin-state"; + } + description + "The administrative state for the component."; + } + leaf alarm-state { + type leafref { + path "/hardware/component/state/alarm-state"; + } + + description + "The alarm state for the component."; + } + reference + "RFC 4268: Entity State MIB - entStateOperDisabled"; +} + +} diff --git a/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/yang/ietf-interfaces.yang b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/yang/ietf-interfaces.yang new file mode 100644 index 000000000..8dae9d3e2 --- /dev/null +++ b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/yang/ietf-interfaces.yang @@ -0,0 +1,1073 @@ +module ietf-interfaces { + yang-version 1.1; + namespace "urn:ietf:params:xml:ns:yang:ietf-interfaces"; + prefix if; + + import ietf-yang-types { + prefix yang; + } + + organization + "IETF NETMOD (Network Modeling) Working Group"; + + contact + "WG Web: <https://datatracker.ietf.org/wg/netmod/> + WG List: <mailto:netmod@ietf.org> + Editor: Martin Bjorklund + <mailto:mbj@tail-f.com>"; + + description + "This module contains a collection of YANG definitions for + managing network interfaces. + Copyright (c) 2018 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 8343; see + the RFC itself for full legal notices."; + + revision 2018-02-20 { + description + "Updated to support NMDA."; + reference + "RFC 8343: A YANG Data Model for Interface Management"; + } + + revision 2014-05-08 { + description + "Initial revision."; + reference + "RFC 7223: A YANG Data Model for Interface Management"; + } + + /* + * Typedefs + */ + + typedef interface-ref { + type leafref { + path "/if:interfaces/if:interface/if:name"; + } + description + "This type is used by data models that need to reference + interfaces."; + } + + /* + * Identities + */ + + identity interface-type { + description + "Base identity from which specific interface types are + derived."; + } + + /* + * Features + */ + + feature arbitrary-names { + description + "This feature indicates that the device allows user-controlled + interfaces to be named arbitrarily."; + } + feature pre-provisioning { + description + "This feature indicates that the device supports + pre-provisioning of interface configuration, i.e., it is + possible to configure an interface whose physical interface + hardware is not present on the device."; + } + feature if-mib { + description + "This feature indicates that the device implements + the IF-MIB."; + reference + "RFC 2863: The Interfaces Group MIB"; + } + + /* + * Data nodes + */ + + container interfaces { + description + "Interface parameters."; + + list interface { + key "name"; + + description + "The list of interfaces on the device. + The status of an interface is available in this list in the + operational state. If the configuration of a + system-controlled interface cannot be used by the system + (e.g., the interface hardware present does not match the + interface type), then the configuration is not applied to + the system-controlled interface shown in the operational + state. If the configuration of a user-controlled interface + cannot be used by the system, the configured interface is + not instantiated in the operational state. + System-controlled interfaces created by the system are + always present in this list in the operational state, + whether or not they are configured."; + + leaf name { + type string; + description + "The name of the interface. + A device MAY restrict the allowed values for this leaf, + possibly depending on the type of the interface. + For system-controlled interfaces, this leaf is the + device-specific name of the interface. + If a client tries to create configuration for a + system-controlled interface that is not present in the + operational state, the server MAY reject the request if + the implementation does not support pre-provisioning of + interfaces or if the name refers to an interface that can + never exist in the system. A Network Configuration + Protocol (NETCONF) server MUST reply with an rpc-error + with the error-tag 'invalid-value' in this case. + If the device supports pre-provisioning of interface + configuration, the 'pre-provisioning' feature is + advertised. + If the device allows arbitrarily named user-controlled + interfaces, the 'arbitrary-names' feature is advertised. + When a configured user-controlled interface is created by + the system, it is instantiated with the same name in the + operational state. + A server implementation MAY map this leaf to the ifName + MIB object. Such an implementation needs to use some + mechanism to handle the differences in size and characters + allowed between this leaf and ifName. The definition of + such a mechanism is outside the scope of this document."; + reference + "RFC 2863: The Interfaces Group MIB - ifName"; + } + + leaf description { + type string; + description + "A textual description of the interface. + A server implementation MAY map this leaf to the ifAlias + MIB object. Such an implementation needs to use some + mechanism to handle the differences in size and characters + allowed between this leaf and ifAlias. The definition of + such a mechanism is outside the scope of this document. + Since ifAlias is defined to be stored in non-volatile + storage, the MIB implementation MUST map ifAlias to the + value of 'description' in the persistently stored + configuration."; + reference + "RFC 2863: The Interfaces Group MIB - ifAlias"; + } + + leaf type { + type identityref { + base interface-type; + } + mandatory true; + description + "The type of the interface. + When an interface entry is created, a server MAY + initialize the type leaf with a valid value, e.g., if it + is possible to derive the type from the name of the + interface. + If a client tries to set the type of an interface to a + value that can never be used by the system, e.g., if the + type is not supported or if the type does not match the + name of the interface, the server MUST reject the request. + A NETCONF server MUST reply with an rpc-error with the + error-tag 'invalid-value' in this case."; + reference + "RFC 2863: The Interfaces Group MIB - ifType"; + } + + leaf enabled { + type boolean; + default "true"; + description + "This leaf contains the configured, desired state of the + interface. + Systems that implement the IF-MIB use the value of this + leaf in the intended configuration to set + IF-MIB.ifAdminStatus to 'up' or 'down' after an ifEntry + has been initialized, as described in RFC 2863. + Changes in this leaf in the intended configuration are + reflected in ifAdminStatus."; + reference + "RFC 2863: The Interfaces Group MIB - ifAdminStatus"; + } + + leaf link-up-down-trap-enable { + if-feature if-mib; + type enumeration { + enum enabled { + value 1; + description + "The device will generate linkUp/linkDown SNMP + notifications for this interface."; + } + enum disabled { + value 2; + description + "The device will not generate linkUp/linkDown SNMP + notifications for this interface."; + } + } + description + "Controls whether linkUp/linkDown SNMP notifications + should be generated for this interface. + If this node is not configured, the value 'enabled' is + operationally used by the server for interfaces that do + not operate on top of any other interface (i.e., there are + no 'lower-layer-if' entries), and 'disabled' otherwise."; + reference + "RFC 2863: The Interfaces Group MIB - + ifLinkUpDownTrapEnable"; + } + + leaf admin-status { + if-feature if-mib; + type enumeration { + enum up { + value 1; + description + "Ready to pass packets."; + } + enum down { + value 2; + description + "Not ready to pass packets and not in some test mode."; + } + enum testing { + value 3; + description + "In some test mode."; + } + } + config false; + mandatory true; + description + "The desired state of the interface. + This leaf has the same read semantics as ifAdminStatus."; + reference + "RFC 2863: The Interfaces Group MIB - ifAdminStatus"; + } + + leaf oper-status { + type enumeration { + enum up { + value 1; + description + "Ready to pass packets."; + } + enum down { + value 2; + + description + "The interface does not pass any packets."; + } + enum testing { + value 3; + description + "In some test mode. No operational packets can + be passed."; + } + enum unknown { + value 4; + description + "Status cannot be determined for some reason."; + } + enum dormant { + value 5; + description + "Waiting for some external event."; + } + enum not-present { + value 6; + description + "Some component (typically hardware) is missing."; + } + enum lower-layer-down { + value 7; + description + "Down due to state of lower-layer interface(s)."; + } + } + config false; + mandatory true; + description + "The current operational state of the interface. + This leaf has the same semantics as ifOperStatus."; + reference + "RFC 2863: The Interfaces Group MIB - ifOperStatus"; + } + + leaf last-change { + type yang:date-and-time; + config false; + description + "The time the interface entered its current operational + state. If the current state was entered prior to the + last re-initialization of the local network management + subsystem, then this node is not present."; + reference + "RFC 2863: The Interfaces Group MIB - ifLastChange"; + } + + leaf if-index { + if-feature if-mib; + type int32 { + range "1..2147483647"; + } + config false; + mandatory true; + description + "The ifIndex value for the ifEntry represented by this + interface."; + reference + "RFC 2863: The Interfaces Group MIB - ifIndex"; + } + + leaf phys-address { + type yang:phys-address; + config false; + description + "The interface's address at its protocol sub-layer. For + example, for an 802.x interface, this object normally + contains a Media Access Control (MAC) address. The + interface's media-specific modules must define the bit + and byte ordering and the format of the value of this + object. For interfaces that do not have such an address + (e.g., a serial line), this node is not present."; + reference + "RFC 2863: The Interfaces Group MIB - ifPhysAddress"; + } + + leaf-list higher-layer-if { + type interface-ref; + config false; + description + "A list of references to interfaces layered on top of this + interface."; + reference + "RFC 2863: The Interfaces Group MIB - ifStackTable"; + } + + leaf-list lower-layer-if { + type interface-ref; + config false; + + description + "A list of references to interfaces layered underneath this + interface."; + reference + "RFC 2863: The Interfaces Group MIB - ifStackTable"; + } + + leaf speed { + type yang:gauge64; + units "bits/second"; + config false; + description + "An estimate of the interface's current bandwidth in bits + per second. For interfaces that do not vary in + bandwidth or for those where no accurate estimation can + be made, this node should contain the nominal bandwidth. + For interfaces that have no concept of bandwidth, this + node is not present."; + reference + "RFC 2863: The Interfaces Group MIB - + ifSpeed, ifHighSpeed"; + } + + container statistics { + config false; + description + "A collection of interface-related statistics objects."; + + leaf discontinuity-time { + type yang:date-and-time; + mandatory true; + description + "The time on the most recent occasion at which any one or + more of this interface's counters suffered a + discontinuity. If no such discontinuities have occurred + since the last re-initialization of the local management + subsystem, then this node contains the time the local + management subsystem re-initialized itself."; + } + + leaf in-octets { + type yang:counter64; + description + "The total number of octets received on the interface, + including framing characters. + Discontinuities in the value of this counter can occur + at re-initialization of the management system and at + other times as indicated by the value of + 'discontinuity-time'."; + reference + "RFC 2863: The Interfaces Group MIB - ifHCInOctets"; + } + + leaf in-unicast-pkts { + type yang:counter64; + description + "The number of packets, delivered by this sub-layer to a + higher (sub-)layer, that were not addressed to a + multicast or broadcast address at this sub-layer. + Discontinuities in the value of this counter can occur + at re-initialization of the management system and at + other times as indicated by the value of + 'discontinuity-time'."; + reference + "RFC 2863: The Interfaces Group MIB - ifHCInUcastPkts"; + } + + leaf in-broadcast-pkts { + type yang:counter64; + description + "The number of packets, delivered by this sub-layer to a + higher (sub-)layer, that were addressed to a broadcast + address at this sub-layer. + Discontinuities in the value of this counter can occur + at re-initialization of the management system and at + other times as indicated by the value of + 'discontinuity-time'."; + reference + "RFC 2863: The Interfaces Group MIB - + ifHCInBroadcastPkts"; + } + + leaf in-multicast-pkts { + type yang:counter64; + description + "The number of packets, delivered by this sub-layer to a + higher (sub-)layer, that were addressed to a multicast + address at this sub-layer. For a MAC-layer protocol, + this includes both Group and Functional addresses. + Discontinuities in the value of this counter can occur + at re-initialization of the management system and at + other times as indicated by the value of + 'discontinuity-time'."; + reference + "RFC 2863: The Interfaces Group MIB - + ifHCInMulticastPkts"; + } + + leaf in-discards { + type yang:counter32; + description + "The number of inbound packets that were chosen to be + discarded even though no errors had been detected to + prevent their being deliverable to a higher-layer + protocol. One possible reason for discarding such a + packet could be to free up buffer space. + Discontinuities in the value of this counter can occur + at re-initialization of the management system and at + other times as indicated by the value of + 'discontinuity-time'."; + reference + "RFC 2863: The Interfaces Group MIB - ifInDiscards"; + } + + leaf in-errors { + type yang:counter32; + description + "For packet-oriented interfaces, the number of inbound + packets that contained errors preventing them from being + deliverable to a higher-layer protocol. For character- + oriented or fixed-length interfaces, the number of + inbound transmission units that contained errors + preventing them from being deliverable to a higher-layer + protocol. + Discontinuities in the value of this counter can occur + at re-initialization of the management system and at + other times as indicated by the value of + 'discontinuity-time'."; + reference + "RFC 2863: The Interfaces Group MIB - ifInErrors"; + } + + leaf in-unknown-protos { + type yang:counter32; + + description + "For packet-oriented interfaces, the number of packets + received via the interface that were discarded because + of an unknown or unsupported protocol. For + character-oriented or fixed-length interfaces that + support protocol multiplexing, the number of + transmission units received via the interface that were + discarded because of an unknown or unsupported protocol. + For any interface that does not support protocol + multiplexing, this counter is not present. + Discontinuities in the value of this counter can occur + at re-initialization of the management system and at + other times as indicated by the value of + 'discontinuity-time'."; + reference + "RFC 2863: The Interfaces Group MIB - ifInUnknownProtos"; + } + + leaf out-octets { + type yang:counter64; + description + "The total number of octets transmitted out of the + interface, including framing characters. + Discontinuities in the value of this counter can occur + at re-initialization of the management system and at + other times as indicated by the value of + 'discontinuity-time'."; + reference + "RFC 2863: The Interfaces Group MIB - ifHCOutOctets"; + } + + leaf out-unicast-pkts { + type yang:counter64; + description + "The total number of packets that higher-level protocols + requested be transmitted and that were not addressed + to a multicast or broadcast address at this sub-layer, + including those that were discarded or not sent. + Discontinuities in the value of this counter can occur + at re-initialization of the management system and at + other times as indicated by the value of + 'discontinuity-time'."; + reference + "RFC 2863: The Interfaces Group MIB - ifHCOutUcastPkts"; + } + + leaf out-broadcast-pkts { + type yang:counter64; + description + "The total number of packets that higher-level protocols + requested be transmitted and that were addressed to a + broadcast address at this sub-layer, including those + that were discarded or not sent. + Discontinuities in the value of this counter can occur + at re-initialization of the management system and at + other times as indicated by the value of + 'discontinuity-time'."; + reference + "RFC 2863: The Interfaces Group MIB - + ifHCOutBroadcastPkts"; + } + + leaf out-multicast-pkts { + type yang:counter64; + description + "The total number of packets that higher-level protocols + requested be transmitted and that were addressed to a + multicast address at this sub-layer, including those + that were discarded or not sent. For a MAC-layer + protocol, this includes both Group and Functional + addresses. + Discontinuities in the value of this counter can occur + at re-initialization of the management system and at + other times as indicated by the value of + 'discontinuity-time'."; + reference + "RFC 2863: The Interfaces Group MIB - + ifHCOutMulticastPkts"; + } + + leaf out-discards { + type yang:counter32; + description + "The number of outbound packets that were chosen to be + discarded even though no errors had been detected to + prevent their being transmitted. One possible reason + for discarding such a packet could be to free up buffer + space. + Discontinuities in the value of this counter can occur + at re-initialization of the management system and at + other times as indicated by the value of + 'discontinuity-time'."; + reference + "RFC 2863: The Interfaces Group MIB - ifOutDiscards"; + } + + leaf out-errors { + type yang:counter32; + description + "For packet-oriented interfaces, the number of outbound + packets that could not be transmitted because of errors. + For character-oriented or fixed-length interfaces, the + number of outbound transmission units that could not be + transmitted because of errors. + Discontinuities in the value of this counter can occur + at re-initialization of the management system and at + other times as indicated by the value of + 'discontinuity-time'."; + reference + "RFC 2863: The Interfaces Group MIB - ifOutErrors"; + } + } + + } + } + + /* + * Legacy typedefs + */ + + typedef interface-state-ref { + type leafref { + path "/if:interfaces-state/if:interface/if:name"; + } + status deprecated; + description + "This type is used by data models that need to reference + the operationally present interfaces."; + } + + /* + * Legacy operational state data nodes + */ + + container interfaces-state { + config false; + status deprecated; + description + "Data nodes for the operational state of interfaces."; + + list interface { + key "name"; + status deprecated; + + description + "The list of interfaces on the device. + System-controlled interfaces created by the system are + always present in this list, whether or not they are + configured."; + + leaf name { + type string; + status deprecated; + description + "The name of the interface. + A server implementation MAY map this leaf to the ifName + MIB object. Such an implementation needs to use some + mechanism to handle the differences in size and characters + allowed between this leaf and ifName. The definition of + such a mechanism is outside the scope of this document."; + reference + "RFC 2863: The Interfaces Group MIB - ifName"; + } + + leaf type { + type identityref { + base interface-type; + } + mandatory true; + status deprecated; + description + "The type of the interface."; + reference + "RFC 2863: The Interfaces Group MIB - ifType"; + } + + leaf admin-status { + if-feature if-mib; + type enumeration { + enum up { + value 1; + description + "Ready to pass packets."; + } + enum down { + value 2; + description + "Not ready to pass packets and not in some test mode."; + } + enum testing { + value 3; + description + "In some test mode."; + } + } + mandatory true; + status deprecated; + description + "The desired state of the interface. + This leaf has the same read semantics as ifAdminStatus."; + reference + "RFC 2863: The Interfaces Group MIB - ifAdminStatus"; + } + + leaf oper-status { + type enumeration { + enum up { + value 1; + description + "Ready to pass packets."; + } + enum down { + value 2; + description + "The interface does not pass any packets."; + } + enum testing { + value 3; + description + "In some test mode. No operational packets can + be passed."; + } + enum unknown { + value 4; + description + "Status cannot be determined for some reason."; + } + enum dormant { + value 5; + description + "Waiting for some external event."; + } + enum not-present { + value 6; + description + "Some component (typically hardware) is missing."; + } + enum lower-layer-down { + value 7; + description + "Down due to state of lower-layer interface(s)."; + } + } + mandatory true; + status deprecated; + description + "The current operational state of the interface. + This leaf has the same semantics as ifOperStatus."; + reference + "RFC 2863: The Interfaces Group MIB - ifOperStatus"; + } + + leaf last-change { + type yang:date-and-time; + status deprecated; + description + "The time the interface entered its current operational + state. If the current state was entered prior to the + last re-initialization of the local network management + subsystem, then this node is not present."; + reference + "RFC 2863: The Interfaces Group MIB - ifLastChange"; + } + + leaf if-index { + if-feature if-mib; + type int32 { + range "1..2147483647"; + } + mandatory true; + status deprecated; + description + "The ifIndex value for the ifEntry represented by this + interface."; + + reference + "RFC 2863: The Interfaces Group MIB - ifIndex"; + } + + leaf phys-address { + type yang:phys-address; + status deprecated; + description + "The interface's address at its protocol sub-layer. For + example, for an 802.x interface, this object normally + contains a Media Access Control (MAC) address. The + interface's media-specific modules must define the bit + and byte ordering and the format of the value of this + object. For interfaces that do not have such an address + (e.g., a serial line), this node is not present."; + reference + "RFC 2863: The Interfaces Group MIB - ifPhysAddress"; + } + + leaf-list higher-layer-if { + type interface-state-ref; + status deprecated; + description + "A list of references to interfaces layered on top of this + interface."; + reference + "RFC 2863: The Interfaces Group MIB - ifStackTable"; + } + + leaf-list lower-layer-if { + type interface-state-ref; + status deprecated; + description + "A list of references to interfaces layered underneath this + interface."; + reference + "RFC 2863: The Interfaces Group MIB - ifStackTable"; + } + + leaf speed { + type yang:gauge64; + units "bits/second"; + status deprecated; + description + "An estimate of the interface's current bandwidth in bits + per second. For interfaces that do not vary in + bandwidth or for those where no accurate estimation can + be made, this node should contain the nominal bandwidth. + For interfaces that have no concept of bandwidth, this + node is not present."; + reference + "RFC 2863: The Interfaces Group MIB - + ifSpeed, ifHighSpeed"; + } + + container statistics { + status deprecated; + description + "A collection of interface-related statistics objects."; + + leaf discontinuity-time { + type yang:date-and-time; + mandatory true; + status deprecated; + description + "The time on the most recent occasion at which any one or + more of this interface's counters suffered a + discontinuity. If no such discontinuities have occurred + since the last re-initialization of the local management + subsystem, then this node contains the time the local + management subsystem re-initialized itself."; + } + + leaf in-octets { + type yang:counter64; + status deprecated; + description + "The total number of octets received on the interface, + including framing characters. + Discontinuities in the value of this counter can occur + at re-initialization of the management system and at + other times as indicated by the value of + 'discontinuity-time'."; + reference + "RFC 2863: The Interfaces Group MIB - ifHCInOctets"; + } + + leaf in-unicast-pkts { + type yang:counter64; + status deprecated; + description + "The number of packets, delivered by this sub-layer to a + higher (sub-)layer, that were not addressed to a + multicast or broadcast address at this sub-layer. + Discontinuities in the value of this counter can occur + at re-initialization of the management system and at + other times as indicated by the value of + 'discontinuity-time'."; + reference + "RFC 2863: The Interfaces Group MIB - ifHCInUcastPkts"; + } + + leaf in-broadcast-pkts { + type yang:counter64; + status deprecated; + description + "The number of packets, delivered by this sub-layer to a + higher (sub-)layer, that were addressed to a broadcast + address at this sub-layer. + Discontinuities in the value of this counter can occur + at re-initialization of the management system and at + other times as indicated by the value of + 'discontinuity-time'."; + reference + "RFC 2863: The Interfaces Group MIB - + ifHCInBroadcastPkts"; + } + + leaf in-multicast-pkts { + type yang:counter64; + status deprecated; + description + "The number of packets, delivered by this sub-layer to a + higher (sub-)layer, that were addressed to a multicast + address at this sub-layer. For a MAC-layer protocol, + this includes both Group and Functional addresses. + Discontinuities in the value of this counter can occur + at re-initialization of the management system and at + other times as indicated by the value of + 'discontinuity-time'."; + reference + "RFC 2863: The Interfaces Group MIB - + ifHCInMulticastPkts"; + } + + leaf in-discards { + type yang:counter32; + status deprecated; + + description + "The number of inbound packets that were chosen to be + discarded even though no errors had been detected to + prevent their being deliverable to a higher-layer + protocol. One possible reason for discarding such a + packet could be to free up buffer space. + Discontinuities in the value of this counter can occur + at re-initialization of the management system and at + other times as indicated by the value of + 'discontinuity-time'."; + reference + "RFC 2863: The Interfaces Group MIB - ifInDiscards"; + } + + leaf in-errors { + type yang:counter32; + status deprecated; + description + "For packet-oriented interfaces, the number of inbound + packets that contained errors preventing them from being + deliverable to a higher-layer protocol. For character- + oriented or fixed-length interfaces, the number of + inbound transmission units that contained errors + preventing them from being deliverable to a higher-layer + protocol. + Discontinuities in the value of this counter can occur + at re-initialization of the management system and at + other times as indicated by the value of + 'discontinuity-time'."; + reference + "RFC 2863: The Interfaces Group MIB - ifInErrors"; + } + + leaf in-unknown-protos { + type yang:counter32; + status deprecated; + description + "For packet-oriented interfaces, the number of packets + received via the interface that were discarded because + of an unknown or unsupported protocol. For + character-oriented or fixed-length interfaces that + support protocol multiplexing, the number of + transmission units received via the interface that were + discarded because of an unknown or unsupported protocol. + For any interface that does not support protocol + multiplexing, this counter is not present. + Discontinuities in the value of this counter can occur + at re-initialization of the management system and at + other times as indicated by the value of + 'discontinuity-time'."; + reference + "RFC 2863: The Interfaces Group MIB - ifInUnknownProtos"; + } + + leaf out-octets { + type yang:counter64; + status deprecated; + description + "The total number of octets transmitted out of the + interface, including framing characters. + Discontinuities in the value of this counter can occur + at re-initialization of the management system and at + other times as indicated by the value of + 'discontinuity-time'."; + reference + "RFC 2863: The Interfaces Group MIB - ifHCOutOctets"; + } + + leaf out-unicast-pkts { + type yang:counter64; + status deprecated; + description + "The total number of packets that higher-level protocols + requested be transmitted and that were not addressed + to a multicast or broadcast address at this sub-layer, + including those that were discarded or not sent. + Discontinuities in the value of this counter can occur + at re-initialization of the management system and at + other times as indicated by the value of + 'discontinuity-time'."; + reference + "RFC 2863: The Interfaces Group MIB - ifHCOutUcastPkts"; + } + + leaf out-broadcast-pkts { + type yang:counter64; + status deprecated; + + description + "The total number of packets that higher-level protocols + requested be transmitted and that were addressed to a + broadcast address at this sub-layer, including those + that were discarded or not sent. + Discontinuities in the value of this counter can occur + at re-initialization of the management system and at + other times as indicated by the value of + 'discontinuity-time'."; + reference + "RFC 2863: The Interfaces Group MIB - + ifHCOutBroadcastPkts"; + } + + leaf out-multicast-pkts { + type yang:counter64; + status deprecated; + description + "The total number of packets that higher-level protocols + requested be transmitted and that were addressed to a + multicast address at this sub-layer, including those + that were discarded or not sent. For a MAC-layer + protocol, this includes both Group and Functional + addresses. + Discontinuities in the value of this counter can occur + at re-initialization of the management system and at + other times as indicated by the value of + 'discontinuity-time'."; + reference + "RFC 2863: The Interfaces Group MIB - + ifHCOutMulticastPkts"; + } + + leaf out-discards { + type yang:counter32; + status deprecated; + description + "The number of outbound packets that were chosen to be + discarded even though no errors had been detected to + prevent their being transmitted. One possible reason + for discarding such a packet could be to free up buffer + space. + Discontinuities in the value of this counter can occur + at re-initialization of the management system and at + other times as indicated by the value of + 'discontinuity-time'."; + reference + "RFC 2863: The Interfaces Group MIB - ifOutDiscards"; + } + + leaf out-errors { + type yang:counter32; + status deprecated; + description + "For packet-oriented interfaces, the number of outbound + packets that could not be transmitted because of errors. + For character-oriented or fixed-length interfaces, the + number of outbound transmission units that could not be + transmitted because of errors. + Discontinuities in the value of this counter can occur + at re-initialization of the management system and at + other times as indicated by the value of + 'discontinuity-time'."; + reference + "RFC 2863: The Interfaces Group MIB - ifOutErrors"; + } + } + } + } +} diff --git a/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/yang/org-openroadm-alarm.yang b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/yang/org-openroadm-alarm.yang new file mode 100644 index 000000000..7b7b5e0da --- /dev/null +++ b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/yang/org-openroadm-alarm.yang @@ -0,0 +1,181 @@ +module org-openroadm-alarm { + namespace "http://org/openroadm/alarm"; + prefix org-openroadm-alarm; + + import ietf-yang-types { + prefix yang; + revision-date 2013-07-15; + } + import org-openroadm-resource { + prefix org-openroadm-resource; + revision-date 2019-11-29; + } + import org-openroadm-probable-cause { + prefix org-openroadm-probable-cause; + revision-date 2019-11-29; + } + + organization + "Open ROADM MSA"; + contact + "OpenROADM.org"; + description + "YANG definitions of an alarm. + + Copyright of the Members of the Open ROADM MSA Agreement dated (c) 2016, + All other rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. + * Neither the Members of the Open ROADM MSA Agreement nor the names of its + contributors may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE MEMBERS OF THE OPEN ROADM MSA AGREEMENT ''AS IS'' + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT THE MEMBERS OF THE OPEN ROADM MSA AGREEMENT BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE."; + + revision 2019-11-29 { + description + "Version 6.1.0"; + } + revision 2019-09-27 { + description + "Version 6.0.0"; + } + revision 2019-05-31 { + description + "Version 5.1.0"; + } + revision 2019-03-29 { + description + "Version 5.0.0"; + } + revision 2018-11-30 { + description + "Version 4.1.0"; + } + revision 2018-09-28 { + description + "Version 4.0.0"; + } + revision 2018-03-30 { + description + "Version 3.0.0"; + } + revision 2017-12-15 { + description + "Version 2.2"; + } + revision 2017-09-29 { + description + "Version 2.1"; + } + revision 2017-07-28 { + description + "Version 2.0.1 - added revision-date to imports"; + } + revision 2016-10-14 { + description + "Version 1.2"; + } + + typedef severity { + type enumeration { + enum critical { + value 1; + } + enum major { + value 2; + } + enum minor { + value 3; + } + enum warning { + value 4; + } + enum clear { + value 5; + } + enum indeterminate { + value 6; + } + } + description + "Severity, based on X.733 perceived severity"; + } + + grouping alarm { + leaf id { + type string; + mandatory true; + description + "Uniquely id for this alarm, within the given management domain"; + } + container resource { + description + "Resource under alarm"; + uses org-openroadm-resource:resource; + } + container probableCause { + description + "Probable cause of alarm"; + uses org-openroadm-probable-cause:probable-cause; + } + leaf raiseTime { + type yang:date-and-time; + mandatory true; + description + "Time alarm was raised"; + } + leaf severity { + type severity; + mandatory true; + description + "Severity of alarm. Based on X.733 perceived severity."; + } + leaf circuit-id { + type string; + description + "Circuit-id for alarm correlation."; + } + leaf additional-detail { + type string; + description + "Provide additional descriptive text about the probable cause."; + } + leaf corrective-action { + type string; + description + "Provide recommended corrective actions for this probable cause, i.e. replace or restart a circuit pack, check wiring for the reported source, or secondary failure to be correlated "; + } + } + + notification alarm-notification { + description + "Notification sent on initial alarm creation, as well as any time the alarm changes state, including clear"; + uses alarm; + } + container active-alarm-list { + config false; + description + "List of currently active alarms. An alarm is removed from this table when the state transitions to clear."; + list activeAlarms { + key "id"; + uses alarm; + } + } +} diff --git a/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/yang/org-openroadm-common-alarm-pm-types.yang b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/yang/org-openroadm-common-alarm-pm-types.yang new file mode 100644 index 000000000..d13b85b3f --- /dev/null +++ b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/yang/org-openroadm-common-alarm-pm-types.yang @@ -0,0 +1,81 @@ +module org-openroadm-common-alarm-pm-types { + namespace "http://org/openroadm/common-alarm-pm-types"; + prefix org-openroadm-common-alarm-pm-types; + + organization + "Open ROADM MSA"; + contact + "OpenROADM.org"; + description + "YANG definitions of common alarm and pm types. + + Copyright of the Members of the Open ROADM MSA Agreement dated (c) 2016, + All other rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. + * Neither the Members of the Open ROADM MSA Agreement nor the names of its + contributors may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE MEMBERS OF THE OPEN ROADM MSA AGREEMENT ''AS IS'' + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT THE MEMBERS OF THE OPEN ROADM MSA AGREEMENT BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE"; + + revision 2019-11-29 { + description + "Version 6.1.0"; + } + revision 2018-11-30 { + description + "Version 4.1.0"; + } + revision 2018-03-30 { + description + "Version 3.0.0"; + } + + typedef direction { + type enumeration { + enum tx { + value 1; + } + enum rx { + value 2; + } + enum bidirectional { + value 3; + } + enum notApplicable { + value 4; + } + } + } + + typedef location { + type enumeration { + enum notApplicable { + value 1; + } + enum nearEnd { + value 2; + } + enum farEnd { + value 3; + } + } + } +} diff --git a/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/yang/org-openroadm-common-amplifier-types.yang b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/yang/org-openroadm-common-amplifier-types.yang new file mode 100644 index 000000000..d5500a173 --- /dev/null +++ b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/yang/org-openroadm-common-amplifier-types.yang @@ -0,0 +1,99 @@ +module org-openroadm-common-amplifier-types { + namespace "http://org/openroadm/common-amplifier-types"; + prefix org-openroadm-common-amplifier-types; + + organization + "Open ROADM MSA"; + contact + "OpenROADM.org"; + description + "YANG definitions of common types. + + Copyright of the Members of the Open ROADM MSA Agreement dated (c) 2016, + All other rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. + * Neither the Members of the Open ROADM MSA Agreement nor the names of its + contributors may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE MEMBERS OF THE OPEN ROADM MSA AGREEMENT ''AS IS'' + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT THE MEMBERS OF THE OPEN ROADM MSA AGREEMENT BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE"; + + revision 2019-11-29 { + description + "Version 6.1.0"; + } + revision 2018-11-30 { + description + "Version 4.1.0"; + } + revision 2018-03-30 { + description + "Version 3.0.0"; + } + + typedef amplifier-types { + type enumeration { + enum standard { + value 1; + } + } + description + "identifier for amplifier type + 1. standard for amplifier as defined initially in the ROADM MSA specifications + To be completed if/when additional amplifier types are required "; + } + + typedef line-amplifier-control-mode { + type enumeration { + enum gainLoss { + value 2; + } + enum off { + value 3; + } + } + description + "Identifies the line amplifier control mode, either off or gain."; + } + + typedef amplifier-gain-range { + type enumeration { + enum gain-range-1 { + value 1; + } + enum gain-range-2 { + value 2; + } + enum gain-range-3 { + value 3; + } + enum gain-range-4 { + value 4; + } + } + description + "Operational mode for the amplifier: + this parameter allows modeling different operational modes (gain ranges) ,notably for switched-gain amplifiers. + It indicates which performance model shall be used by the path feasibility engine. + For standard amplifier, or when performance evaluation is based on incremental noise, use gain-range-1. + When performance evaluation is based on advanced parameters, specify used gain-range (1 to 4). + Up to release 2.1, only gain-range-1 is to be used (default value) "; + } +} diff --git a/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/yang/org-openroadm-common-equipment-types.yang b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/yang/org-openroadm-common-equipment-types.yang new file mode 100644 index 000000000..f5189c314 --- /dev/null +++ b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/yang/org-openroadm-common-equipment-types.yang @@ -0,0 +1,102 @@ +module org-openroadm-common-equipment-types { + namespace "http://org/openroadm/common-equipment-types"; + prefix org-openroadm-common-equipment-types; + + organization + "Open ROADM MSA"; + contact + "OpenROADM.org"; + description + "YANG definitions of common types. + + Copyright of the Members of the Open ROADM MSA Agreement dated (c) 2016, + All other rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. + * Neither the Members of the Open ROADM MSA Agreement nor the names of its + contributors may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE MEMBERS OF THE OPEN ROADM MSA AGREEMENT ''AS IS'' + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT THE MEMBERS OF THE OPEN ROADM MSA AGREEMENT BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE"; + + revision 2019-11-29 { + description + "Version 6.1.0"; + } + revision 2018-11-30 { + description + "Version 4.1.0"; + } + revision 2018-03-30 { + description + "Version 3.0.0"; + } + + typedef optic-types { + type enumeration { + enum gray { + value 1; + } + enum dwdm { + value 2; + } + } + } + + typedef equipment-type-enum { + type enumeration { + enum other { + value 1; + } + enum powerSupply { + value 2; + } + enum shelfProcessor { + value 3; + } + enum crossConnect { + value 4; + } + enum fan { + value 5; + } + enum accessPanel { + value 6; + } + enum circuitPack { + value 7; + } + } + } + + grouping equipment-type { + leaf type { + type equipment-type-enum; + config false; + mandatory true; + } + leaf extension { + type string; + config false; + mandatory false; + description + "Populated with equipment type when enum value is set to 'other'"; + } + } +} diff --git a/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/yang/org-openroadm-common-link-types.yang b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/yang/org-openroadm-common-link-types.yang new file mode 100644 index 000000000..5e57dfc0a --- /dev/null +++ b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/yang/org-openroadm-common-link-types.yang @@ -0,0 +1,94 @@ +module org-openroadm-common-link-types { + namespace "http://org/openroadm/common-link-types"; + prefix org-openroadm-common-link-types; + + organization + "Open ROADM MSA"; + contact + "OpenROADM.org"; + description + "YANG definitions of common link types. + + Copyright of the Members of the Open ROADM MSA Agreement dated (c) 2016, + All other rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. + * Neither the Members of the Open ROADM MSA Agreement nor the names of its + contributors may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE MEMBERS OF THE OPEN ROADM MSA AGREEMENT ''AS IS'' + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT THE MEMBERS OF THE OPEN ROADM MSA AGREEMENT BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE"; + + revision 2019-11-29 { + description + "Version 6.1.0"; + } + revision 2018-11-30 { + description + "Version 4.1.0"; + } + revision 2018-03-30 { + description + "Version 3.0.0"; + } + + typedef power-dBm { + type decimal64 { + fraction-digits 2; + } + units "dBm"; + description + "Power value in dBm."; + } + + typedef ratio-dB { + type decimal64 { + fraction-digits 3; + } + units "dB"; + description + "Power ratio in dB."; + } + + typedef fiber-pmd { + type decimal64 { + fraction-digits 2; + } + units "ps/(km[1/2])"; + description + "Polarization Mode Dispersion expressed in ps/km(1/2)."; + } + + typedef optical-control-mode { + type enumeration { + enum power { + value 1; + } + enum gainLoss { + value 2; + } + enum off { + value 3; + } + } + description + "Optical Control Mode: identifies specific algorithm related to power management and general optical control."; + reference "openroadm.org: Open ROADM MSA Specification."; + } +} diff --git a/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/yang/org-openroadm-common-node-types.yang b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/yang/org-openroadm-common-node-types.yang new file mode 100644 index 000000000..d8a914ba0 --- /dev/null +++ b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/yang/org-openroadm-common-node-types.yang @@ -0,0 +1,69 @@ +module org-openroadm-common-node-types { + namespace "http://org/openroadm/common-node-types"; + prefix org-openroadm-common-node-types; + + organization + "Open ROADM MSA"; + contact + "OpenROADM.org"; + description + "YANG definitions of common node types. + + Copyright of the Members of the Open ROADM MSA Agreement dated (c) 2016, + All other rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. + * Neither the Members of the Open ROADM MSA Agreement nor the names of its + contributors may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE MEMBERS OF THE OPEN ROADM MSA AGREEMENT ''AS IS'' + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT THE MEMBERS OF THE OPEN ROADM MSA AGREEMENT BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE"; + + revision 2019-11-29 { + description + "Version 6.1.0"; + } + revision 2018-11-30 { + description + "Version 4.1.0"; + } + revision 2018-09-28 { + description + "Version 4.0.0"; + } + revision 2018-03-30 { + description + "Version 3.0.0"; + } + + typedef node-id-type { + type string { + length "7..63"; + pattern '([a-zA-Z][a-zA-Z0-9-]{5,61}[a-zA-Z0-9])' { + error-message + "A node-id must be 7 to 63 characters in length. + A node-id can contain letters, numbers, and hyphens. + The first character must be a letter. + The last character must be a letter or number."; + } + } + description + "Globally unique identifier for a device."; + } +} diff --git a/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/yang/org-openroadm-common-optical-channel-types.yang b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/yang/org-openroadm-common-optical-channel-types.yang new file mode 100644 index 000000000..42b72f7d2 --- /dev/null +++ b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/yang/org-openroadm-common-optical-channel-types.yang @@ -0,0 +1,350 @@ +module org-openroadm-common-optical-channel-types { + namespace "http://org/openroadm/common-optical-channel-types"; + prefix org-openroadm-common-optical-channel-types; + + organization + "Open ROADM MSA"; + contact + "OpenROADM.org"; + description + "YANG definitions of common optical channel types. + + Copyright of the Members of the Open ROADM MSA Agreement dated (c) 2016, + All other rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. + * Neither the Members of the Open ROADM MSA Agreement nor the names of its + contributors may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE MEMBERS OF THE OPEN ROADM MSA AGREEMENT ''AS IS'' + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT THE MEMBERS OF THE OPEN ROADM MSA AGREEMENT BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE"; + + revision 2019-11-29 { + description + "Version 6.1.0"; + } + revision 2019-09-27 { + description + "Version 6.0.0"; + } + revision 2019-03-29 { + description + "Version 5.0.0"; + } + revision 2018-11-30 { + description + "Version 4.1.0"; + } + revision 2018-05-30 { + description + "Version 3.1.0"; + } + revision 2018-03-30 { + description + "Version 3.0.0"; + } + + identity och-rate-identity { + description + "A unique och rate identification"; + } + + identity otsi-rate-identity { + status deprecated; + description + "A unique OTSi rate identification"; + } + + identity fec-identity { + description + "A unique FEC identification"; + } + + identity sc-fec { + base fec-identity; + description + "Staircase FEC identification"; + } + + identity rs-fec { + base fec-identity; + description + "Reed Solomon FEC identification"; + } + + identity o-fec { + base fec-identity; + description + "OpenROADM FEC identification"; + } + + identity foic-identity { + description + "A unique FOICx.k identification (G.709.3 FlexO-LR and + G.709.1 FlexO-SR)"; + } + + identity flexo-otsi-rate-identity { + description + "A unique rate identification. Applicable to specify OTSi rate. Also + applicable to FOIC rate when associated with FlexO processing + (G.709.3 FlexO-LR Table 11-2, G.709.1 FlexO-SR clause 9.2.2 + Table 11-1, 12-1, 13-1) and G.Sup58."; + } + + identity foic1.2 { + base foic-identity; + description + "Applicable to the FlexO type defined in G.Sup58"; + } + + identity foic1.4 { + base foic-identity; + description + "Applicable to the FlexO type defined in G.709.1 and G.709.3"; + } + + identity foic2.4 { + base foic-identity; + description + "Applicable to the FlexO type defined in G.709.1"; + } + + identity foic2.8 { + base foic-identity; + description + "Applicable to the FlexO type defined in G.Sup58"; + } + + identity foic3.6 { + base foic-identity; + description + "Applicable to the FlexO type defined in future"; + } + + identity foic4.8 { + base foic-identity; + description + "Applicable to the FlexO type defined in G.709.1"; + } + + identity foic4.16 { + base foic-identity; + description + "Applicable to the FlexO type defined in G.Sup58"; + } + + identity R1T-flexo-otsi { + base flexo-otsi-rate-identity; + description + "Applicable instance for flexo/otsi rate identity"; + } + + identity R900G-flexo-otsi { + base flexo-otsi-rate-identity; + description + "Applicable instance for flexo/otsi rate identity"; + } + + identity R800G-flexo-otsi { + base flexo-otsi-rate-identity; + description + "Applicable instance for flexo/otsi rate identity"; + } + + identity R700G-flexo-otsi { + base flexo-otsi-rate-identity; + description + "Applicable instance for flexo/otsi rate identity"; + } + + identity R600G-flexo-otsi { + base flexo-otsi-rate-identity; + description + "Applicable instance for flexo/otsi rate identity"; + } + + identity R500G-flexo-otsi { + base flexo-otsi-rate-identity; + description + "Applicable instance for flexo/otsi rate identity"; + } + + identity R400G-flexo-otsi { + base flexo-otsi-rate-identity; + description + "Applicable instance for flexo/otsi rate identity"; + } + + identity R300G-flexo-otsi { + base flexo-otsi-rate-identity; + description + "Applicable instance for flexo/otsi rate identity"; + } + + identity R200G-flexo-otsi { + base flexo-otsi-rate-identity; + description + "Applicable instance for flexo/otsi rate identity"; + } + + identity R200G { + base och-rate-identity; + description + "Identity for 200G Rate"; + } + + identity R100G-flexo-otsi { + base flexo-otsi-rate-identity; + description + "Applicable instance for otsi/flexo rate identity"; + } + + identity R100G { + base och-rate-identity; + description + "Identity for 100G Rate"; + } + + identity R56G-foic-otsi { + base flexo-otsi-rate-identity; + description + "Applicable instance for otsi rate identity"; + } + + identity R28G-foic-otsi { + base flexo-otsi-rate-identity; + description + "Applicable instance for otsi rate identity"; + } + + identity R10.7G { + base och-rate-identity; + description + "Identity for 10.7G Rate"; + } + + identity R11.1G { + base och-rate-identity; + description + "Identity for 11.1G Rate"; + } + + typedef frequency-THz { + type decimal64 { + fraction-digits 8; + } + units "THz"; + description + "Frequency value in THz."; + } + + typedef frequency-GHz { + type decimal64 { + fraction-digits 5; + } + units "GHz"; + description + "Frequency value in GHz."; + } + + typedef wavelength-duplication-type { + type enumeration { + enum one-per-srg { + value 1; + description + "The SRG cannot handle wavelength duplication. Attempting to provision a connection on this SRG that uses the same wavelength as an existing service will result in failure."; + } + enum one-per-degree { + value 2; + description + "The SRG can handle wavelength duplication, but only one per degree. Attempting to provision a connection on this SRG that uses the same wavelength as an existing service will succeed, so long as the connections are not using the same degree."; + } + } + description + "One per srg is applied to C/D add/drop group + one per degree is applied to C/D/C add drop group"; + } + + typedef modulation-format { + type enumeration { + enum bpsk { + value 0; + description + "binary phase-shift keying"; + } + enum dc-dp-bpsk { + value 1; + description + "DC dual-polarization binary phase-shift keying"; + } + enum qpsk { + value 2; + description + "quadrature phase-shift keying"; + } + enum dp-qpsk { + value 3; + description + "dual-polarization binary phase-shift keying"; + } + enum qam16 { + value 4; + description + "quadrature amplitude modulation 16"; + } + enum dp-qam16 { + value 5; + description + "dual-polarization quadrature amplitude modulation 16"; + } + enum dc-dp-qam16 { + value 6; + description + "DC dual-polarization quadrature amplitude modulation 16"; + } + enum qam8 { + value 7; + description + "quadrature amplitude modulation 8"; + } + enum dp-qam8 { + value 8; + description + "dual-polarization quadrature amplitude modulation 8"; + } + enum dc-dp-qam8 { + value 9; + description + "DC dual-polarization quadrature amplitude modulation 8"; + } + } + description + "Modulation format"; + } + + typedef provision-mode-type { + type enumeration { + enum explicit; + enum profile; + } + description + "Provision Mode Type On Optical Channel"; + } +} diff --git a/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/yang/org-openroadm-common-state-types.yang b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/yang/org-openroadm-common-state-types.yang new file mode 100644 index 000000000..901a01372 --- /dev/null +++ b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/yang/org-openroadm-common-state-types.yang @@ -0,0 +1,113 @@ +module org-openroadm-common-state-types { + namespace "http://org/openroadm/common-state-types"; + prefix org-openroadm-common-state-types; + + organization + "Open ROADM MSA"; + contact + "OpenROADM.org"; + description + "YANG definitions of common types. + + Copyright of the Members of the Open ROADM MSA Agreement dated (c) 2016, + All other rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. + * Neither the Members of the Open ROADM MSA Agreement nor the names of its + contributors may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE MEMBERS OF THE OPEN ROADM MSA AGREEMENT ''AS IS'' + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT THE MEMBERS OF THE OPEN ROADM MSA AGREEMENT BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE"; + + revision 2019-11-29 { + description + "Version 6.1.0"; + } + revision 2018-11-30 { + description + "Version 4.1.0"; + } + revision 2018-09-28 { + description + "Version 4.0.0"; + } + revision 2018-03-30 { + description + "Version 3.0.0"; + } + + typedef lifecycle-state { + type enumeration { + enum deployed { + value 1; + } + enum planned { + value 2; + } + enum maintenance { + value 3; + } + enum deploying { + value 4; + } + enum undeploying { + value 5; + } + enum undeployed { + value 6; + } + enum proposed { + value 7; + } + enum draft { + value 8; + } + enum deploy-failed { + value 9; + } + enum undeploy-failed { + value 10; + } + enum deployed-augmented { + value 11; + } + enum deployed-updating { + value 12; + } + } + description + "Lifecycle state."; + } + + typedef state { + type enumeration { + enum inService { + value 1; + } + enum outOfService { + value 2; + } + enum degraded { + value 3; + } + } + description + "State that indicates whether the resource is able to provide fulfill its role - carry traffic, etc."; + } +} diff --git a/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/yang/org-openroadm-common-types.yang b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/yang/org-openroadm-common-types.yang new file mode 100644 index 000000000..9fc6984b2 --- /dev/null +++ b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/yang/org-openroadm-common-types.yang @@ -0,0 +1,270 @@ +module org-openroadm-common-types { + namespace "http://org/openroadm/common-types"; + prefix org-openroadm-common-types; + + organization + "Open ROADM MSA"; + contact + "OpenROADM.org"; + description + "YANG definitions of common types. + + Copyright of the Members of the Open ROADM MSA Agreement dated (c) 2016, + All other rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. + * Neither the Members of the Open ROADM MSA Agreement nor the names of its + contributors may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE MEMBERS OF THE OPEN ROADM MSA AGREEMENT ''AS IS'' + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT THE MEMBERS OF THE OPEN ROADM MSA AGREEMENT BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE"; + + revision 2019-11-29 { + description + "Version 6.1.0"; + } + revision 2019-09-27 { + description + "Version 6.0.0"; + } + revision 2019-05-31 { + description + "Version 5.1.0"; + } + revision 2019-03-29 { + description + "Version 5.0.0"; + } + revision 2018-11-30 { + description + "Version 4.1.0"; + } + revision 2018-09-28 { + description + "Version 4.0.0"; + } + revision 2018-03-30 { + description + "Version 3.0.0"; + } + revision 2017-12-15 { + description + "Version 2.2"; + } + revision 2017-09-29 { + description + "Version 2.1"; + } + revision 2017-06-26 { + description + "Version 2.0"; + } + revision 2016-10-14 { + description + "Version 1.2"; + } + + typedef activate-notification-type { + type enumeration { + enum activate { + value 1; + description + "software or database activation"; + } + enum commit { + value 2; + description + "commit the software or database. + For software activate, this event can happen in the following scenarios: + 1) immediately when user issue sw-activate command without validationTimer + or if the validationTimer is specified as 00-00-00; + 2) when user issue cancel-validation-timer before it expires and with accept=true. + For database activate, this event can occur in the following scenarios: + 1) immediately when user issue db-activate command without rollBackTimer + or if the rollBackTimer is specified as 00-00-00; + 2) when user issue cancel-rollback-timer before it expires and with accept=true."; + } + enum cancel { + value 3; + description + "cancel the database or software activation operation. + For software activate, this event can happen in the following cases: + 1) when the validationTimer expires; + 2) when the user issues cancel-validation-timer with accept=false. + For database activate, this event can happen in the following cases: + 1) when the rollBackTimer expires; + 2) when the user issues cancel-rollback-timer with accept=false."; + } + } + description + "Type of notification on software or database activation events"; + } + + typedef rpc-status { + type enumeration { + enum Successful { + value 1; + } + enum Failed { + value 2; + } + } + description + "status of RPC "; + } + + typedef extended-rpc-status { + type enumeration { + enum Successful { + value 1; + } + enum Failed { + value 2; + } + enum In-progress { + value 3; + } + } + description + "status of RPC "; + } + + typedef openroadm-version-type { + type enumeration { + enum 1.0 { + value 1; + description + "value for 1.0"; + } + enum 2.0 { + value 2; + description + "value for 2.0"; + } + enum 2.1 { + value 3; + description + "value for 2.1"; + } + enum 2.2 { + value 4; + description + "value for 2.2"; + } + enum 3.0 { + value 5; + description + "value for 3.0"; + } + enum 3.1 { + value 6; + description + "value for 3.1"; + } + enum 4.0 { + value 7; + description + "value for 4.0"; + } + enum 2.2.1 { + value 8; + description + "value for 2.2.1"; + } + enum 4.1 { + value 9; + description + "value for 4.1"; + } + enum 3.1.1 { + value 10; + description + "value for 3.1.1"; + } + enum 5.0 { + value 11; + description + "value for 5.0"; + } + enum 5.1 { + value 12; + description + "value for 5.1"; + } + enum 6.0 { + value 13; + description + "value for 6.0"; + } + enum 6.1 { + value 14; + description + "value for 6.1"; + } + } + description + "OpenROADM version enum type"; + } + + grouping rpc-response-status { + leaf status { + type rpc-status; + mandatory true; + description + "Successful or Failed"; + } + leaf status-message { + type string; + description + "Gives a more detailed status"; + } + } + + grouping extended-rpc-response-status { + leaf status { + type extended-rpc-status; + mandatory true; + description + "Successful, Failed or In-progress"; + } + leaf status-message { + type string; + description + "Gives a more detailed status."; + } + } + + grouping eth-rate-and-burst-size { + description + "Grouping of ethernet committed rate and burst size."; + leaf committed-info-rate { + type uint32; + mandatory true; + description + "Committed Information Rate (CIR), unit in Mbps. For example, 1250 Mbps"; + } + leaf committed-burst-size { + type uint16; + mandatory true; + description + "Committed Burst Size, unit in 1KB (K Byte). + Range 16 | 32 | 64 | 128 | 512 | 1024. Default: 16"; + } + } +} diff --git a/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/yang/org-openroadm-device-types.yang b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/yang/org-openroadm-device-types.yang new file mode 100644 index 000000000..89087d940 --- /dev/null +++ b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/yang/org-openroadm-device-types.yang @@ -0,0 +1,151 @@ +module org-openroadm-device-types { + namespace "http://org/openroadm/device-types"; + prefix org-openroadm-device-types; + + organization + "Open ROADM MSA"; + contact + "OpenROADM.org"; + description + "YANG definitions of device types. + + Copyright of the Members of the Open ROADM MSA Agreement dated (c) 2016, + All other rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. + * Neither the Members of the Open ROADM MSA Agreement nor the names of its + contributors may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE MEMBERS OF THE OPEN ROADM MSA AGREEMENT ''AS IS'' + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT THE MEMBERS OF THE OPEN ROADM MSA AGREEMENT BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE"; + + revision 2019-11-29 { + description + "Version 6.1.0"; + } + revision 2018-11-30 { + description + "Version 4.1.0"; + } + revision 2018-03-30 { + description + "Version 3.0.0"; + } + + typedef node-types { + type enumeration { + enum rdm { + value 1; + } + enum xpdr { + value 2; + } + enum ila { + value 3; + } + enum extplug { + value 4; + } + } + description + "Identifier for node type + 1. rdm for ROADM + 2. xpdr for Transponder, Regen + 3. ila for in-line amplifier + 4. extplug for external pluggable"; + } + + typedef xpdr-node-types { + type enumeration { + enum tpdr { + value 1; + } + enum mpdr { + value 2; + } + enum switch { + value 3; + } + enum regen { + value 4; + } + enum regen-uni { + value 5; + } + } + description + "Identifier for Xponder node type + 1. Transponder + 2. Muxponder + 3. OTN switchponder + 4. Regenerator + 5. Regenerator based on unidirectional model"; + } + + typedef port-qual { + type enumeration { + enum roadm-internal { + value 1; + } + enum roadm-external { + value 2; + } + enum xpdr-network { + value 3; + } + enum xpdr-client { + value 4; + } + enum otdr { + value 5; + } + enum switch-network { + value 6; + } + enum switch-client { + value 7; + } + enum ila-external { + value 8; + } + enum ila-internal { + value 9; + } + } + } + + grouping physical-location { + leaf rack { + type string; + mandatory false; + } + leaf shelf { + type string; + mandatory false; + } + leaf slot { + type string; + mandatory false; + } + leaf subSlot { + type string; + mandatory false; + } + } +} diff --git a/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/yang/org-openroadm-device.yang b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/yang/org-openroadm-device.yang new file mode 100644 index 000000000..0180be8f5 --- /dev/null +++ b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/yang/org-openroadm-device.yang @@ -0,0 +1,2179 @@ +module org-openroadm-device { + namespace "http://org/openroadm/device"; + prefix org-openroadm-device; + + import ietf-yang-types { + prefix ietf-yang-types; + revision-date 2013-07-15; + } + import ietf-inet-types { + prefix ietf-inet-types; + revision-date 2013-07-15; + } + import ietf-netconf { + prefix ietf-nc; + revision-date 2011-06-01; + } + import org-openroadm-common-types { + prefix org-openroadm-common-types; + revision-date 2019-11-29; + } + import org-openroadm-common-alarm-pm-types { + prefix org-openroadm-common-alarm-pm-types; + revision-date 2019-11-29; + } + import org-openroadm-common-equipment-types { + prefix org-openroadm-common-equipment-types; + revision-date 2019-11-29; + } + import org-openroadm-common-state-types { + prefix org-openroadm-common-state-types; + revision-date 2019-11-29; + } + import org-openroadm-common-amplifier-types { + prefix org-openroadm-common-amplifier-types; + revision-date 2019-11-29; + } + import org-openroadm-common-link-types { + prefix org-openroadm-common-link-types; + revision-date 2019-11-29; + } + import org-openroadm-common-node-types { + prefix org-openroadm-common-node-types; + revision-date 2019-11-29; + } + import org-openroadm-common-optical-channel-types { + prefix org-openroadm-common-optical-channel-types; + revision-date 2019-11-29; + } + import org-openroadm-device-types { + prefix org-openroadm-device-types; + revision-date 2019-11-29; + } + import org-openroadm-resource-types { + prefix org-openroadm-resource-types; + revision-date 2019-11-29; + } + import org-openroadm-physical-types { + prefix org-openroadm-physical-types; + revision-date 2019-11-29; + } + import org-openroadm-user-mgmt { + prefix org-openroadm-user-mgmt; + revision-date 2019-11-29; + } + import org-openroadm-port-types { + prefix org-openroadm-port-types; + revision-date 2019-11-29; + } + import org-openroadm-interfaces { + prefix org-openroadm-interfaces; + revision-date 2019-11-29; + } + import org-openroadm-swdl { + prefix org-openroadm-swdl; + revision-date 2019-11-29; + } + import org-openroadm-equipment-states-types { + prefix org-openroadm-equipment-states-types; + revision-date 2019-11-29; + } + import org-openroadm-switching-pool-types { + prefix org-openroadm-switching-pool-types; + revision-date 2019-11-29; + } + + organization + "Open ROADM MSA"; + contact + "OpenROADM.org"; + description + "YANG definitions of ROADM device + Copyright of the Members of the Open ROADM MSA Agreement dated (c) 2016, + All other rights reserved. + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. + * Neither the Members of the Open ROADM MSA Agreement nor the names of its + contributors may be used to endorse or promote products derived from this software + without specific prior written permission. + THIS SOFTWARE IS PROVIDED BY THE MEMBERS OF THE OPEN ROADM MSA AGREEMENT ''AS IS'' + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT THE MEMBERS OF THE OPEN ROADM MSA AGREEMENT BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + Also contains code components extracted from IETF netconf. These code components + are copyrighted and licensed as follows: + Copyright (c) 2016 IETF Trust and the persons identified as the document authors. + All rights reserved. + This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating + to IETF Documents (http://trustee.ietf.org/license-info) in effect on the date of + publication of this document. Please review these documents carefully, as they + describe your rights and restrictions with respect to this document. Code Components + extracted from this document must include Simplified BSD License text as described in + Section 4.e of the Trust Legal Provisions and are provided without warranty as + described in the Simplified BSD License."; + + revision 2019-11-29 { + description + "Version 6.1.0"; + } + revision 2019-09-27 { + description + "Version 6.0.0"; + } + revision 2019-05-31 { + description + "Version 5.1.0"; + } + revision 2019-03-29 { + description + "Version 5.0.0"; + } + revision 2018-11-30 { + description + "Version 4.1.0"; + } + revision 2018-09-28 { + description + "Version 4.0.0"; + } + revision 2018-05-30 { + description + "Version 3.1.0"; + } + revision 2018-03-30 { + description + "Version 3.0.0"; + } + revision 2017-12-15 { + description + "Version 2.2"; + } + revision 2017-09-29 { + description + "Version 2.1"; + } + revision 2017-07-28 { + description + "Version 2.0.1 - added revision-date to imports"; + } + revision 2017-06-26 { + description + "Version 2.0"; + } + revision 2017-02-06 { + description + "Version 1.2.1 - removed pattern for current-datetime in info tree and rpc"; + } + revision 2016-10-14 { + description + "Version 1.2"; + } + + identity connection-direction-identity { + description + "Bidrectional capable, or Bi and Unidirectional capable"; + } + + identity connection-direction_bi { + base connection-direction-identity; + description + "Bidrectional capable"; + } + + identity connection-direction_bi_and_uni { + base connection-direction-identity; + description + "Bi and Unidirectional capable"; + } + + typedef interface-ref { + type leafref { + path "/org-openroadm-device:org-openroadm-device/org-openroadm-device:interface/org-openroadm-device:name"; + } + description + "This type is used by data models that need to reference + configured interfaces."; + } + + grouping create-tech-info-group { + leaf shelf-id { + type leafref { + path "/org-openroadm-device/shelves/shelf-name"; + } + description + "shelf ID"; + } + leaf log-file-name { + type string; + description + "The log file name a vendor can specify for a given log collection operation"; + } + } + + grouping device-common { + leaf node-id { + type org-openroadm-common-node-types:node-id-type; + default "openroadm"; + description + "Globally unique identifier for a device."; + } + leaf node-number { + type uint32; + description + "Number assigned to a ROADM node at a + given office"; + } + leaf node-type { + type org-openroadm-device-types:node-types; + config true; + mandatory true; + description + "Identifier for node-type e.g Roadm, xponder. + Once the node-type is configured, it should not be modified."; + } + leaf clli { + type string; + description + "Common Language Location Identifier."; + } + uses org-openroadm-physical-types:node-info; + leaf ipAddress { + type ietf-inet-types:ip-address; + description + "IP Address of device"; + } + leaf prefix-length { + type uint8 { + range "0..128"; + } + description + "The length of the subnet prefix"; + } + leaf defaultGateway { + type ietf-inet-types:ip-address; + description + "Default Gateway"; + } + leaf source { + type enumeration { + enum static { + value 1; + } + enum dhcp { + value 2; + } + } + config false; + } + leaf current-ipAddress { + type ietf-inet-types:ip-address; + config false; + description + "Current IP Address of device"; + } + leaf current-prefix-length { + type uint8 { + range "0..128"; + } + config false; + description + "The current length of the subnet prefix"; + } + leaf current-defaultGateway { + type ietf-inet-types:ip-address; + config false; + description + "Current Default Gateway"; + } + leaf macAddress { + type ietf-yang-types:mac-address; + config false; + description + "MAC Address of device"; + } + leaf softwareVersion { + type string; + config false; + description + "Software version"; + } + leaf software-build { + type string; + config false; + description + "Software build version"; + } + leaf openroadm-version { + type org-openroadm-common-types:openroadm-version-type; + config false; + description + "openroadm version used on the device"; + } + leaf template { + type string; + description + "Template information used in the deployment."; + } + leaf current-datetime { + type ietf-yang-types:date-and-time; + config false; + description + "The current system date and time in UTC. Format: YYYY-MM-DDTHH:MM:SS.mm+ "; + } + leaf lifecycle-state { + type org-openroadm-common-state-types:lifecycle-state; + description + "Lifecycle State of the device node. Whether it is planned, deployed, in maintenance, etc."; + } + container geoLocation { + description + "GPS location"; + leaf latitude { + type decimal64 { + fraction-digits 16; + range "-90 .. 90"; + } + description + "[From wikipedia] Latitude is an angle (defined below) + which ranges from 0 at the Equator to 90 (North or + South) at the poles"; + } + leaf longitude { + type decimal64 { + fraction-digits 16; + range "-180 .. 180"; + } + description + "[From wikipedia] The longitude is measured as the + angle east or west from the Prime Meridian, ranging + from 0 at the Prime Meridian to +180 eastward and + -180 westward."; + } + } + } + + grouping slot-info { + description + "slots information. To be populated by NE during retrieval."; + leaf slot-name { + type string; + description + "The name of this slot."; + } + leaf label { + type string; + description + "Faceplate label"; + } + leaf provisioned-circuit-pack { + type leafref { + path "/org-openroadm-device/circuit-packs/circuit-pack-name"; + } + description + "The supported circuit-pack. It will be empty if holder status is empty-not-prov, or installed-not-prov"; + } + leaf slot-status { + type enumeration { + enum empty-not-prov { + value 1; + description + "Slot is empty and not provisioned"; + } + enum empty-prov-match { + value 2; + status deprecated; + description + "(Deprecated) Slot is empty and expected type is provisioned"; + } + enum empty-prov-mismatch { + value 3; + status deprecated; + description + "(Deprecated) Slot is empty and an unsupported type is provisioned"; + } + enum installed-not-prov { + value 4; + description + "Slot is occupied but not provisioned"; + } + enum installed-prov-match { + value 5; + description + "Slot is occupied with matching provisioned type"; + } + enum installed-prov-mismatch { + value 6; + description + "Slot is occupied with mismatched provisioned type"; + } + enum empty-prov { + value 7; + description + "Slot is empty and provisioned"; + } + } + } + } + + grouping shelves { + list shelves { + key "shelf-name"; + uses shelf; + } + } + + grouping user-description-grp { + description + "user description group"; + leaf user-description { + type string; + description + "user provided description"; + } + } + + grouping shelf { + leaf shelf-name { + type string; + description + "Unique identifier for this shelf within a device"; + } + leaf shelf-type { + type string; + mandatory true; + description + "The shelf type: describe the shelf with a unique string."; + } + leaf rack { + type string; + description + "Reflect the shelf physical location data including floor, aisle, bay values."; + } + leaf shelf-position { + type string; + description + "Reflect the shelf vertical position within an equipment bay."; + } + leaf lifecycle-state { + type org-openroadm-common-state-types:lifecycle-state; + description + "Lifecycle State of shelf. Whether it is planned, deployed, in maintenance, etc."; + } + leaf administrative-state { + type org-openroadm-equipment-states-types:admin-states; + mandatory true; + description + "Admin State of the shelf"; + } + uses org-openroadm-physical-types:common-info; + leaf equipment-state { + type org-openroadm-equipment-states-types:states; + description + "equipment state for the shelf, used to track the lifecycle state."; + } + leaf is-physical { + type boolean; + config false; + mandatory true; + description + "is the entity physical or logical"; + } + leaf is-passive { + type boolean; + config false; + mandatory true; + description + "is the entity passive and not actively managed by the device; + e.g., no physical inventory or plug-in notification supported"; + } + leaf faceplate-label { + type string; + config false; + mandatory true; + description + "label on the faceplace silk screening"; + } + uses user-description-grp; + leaf due-date { + type ietf-yang-types:date-and-time; + description + "due date for the shelf."; + } + list slots { + key "slot-name"; + config false; + description + "List of slots on this shelf. To be populated by NE during retrieval."; + uses slot-info; + } + } + + grouping circuit-packs { + list circuit-packs { + key "circuit-pack-name"; + description + "List of circuit packs. This includes common equipment, like fans, power supplies, etc."; + leaf circuit-pack-type { + type string; + mandatory true; + description + "Type of circuit-pack"; + } + leaf circuit-pack-product-code { + type string; + description + "Product Code for the circuit-pack"; + } + uses circuit-pack; + } + } + + grouping circuit-pack-features { + leaf software-load-version { + type string; + config false; + description + "Software version running on the circuit pack."; + } + list circuit-pack-features { + key "to-be-deleted"; + config false; + leaf to-be-deleted { + type string; + description + "Key to be deleted."; + } + container feature { + description + "List of features supported by the installed load and indications on whether the features have been applied or not."; + leaf description { + type string; + description + "Feature description."; + } + leaf boot { + type boolean; + description + "Flag to indicate boot loader or unprotected firmware update required"; + } + leaf activated { + type boolean; + description + "Indicator if the feature has been activated."; + } + } + } + list circuit-pack-components { + key "to-be-deleted"; + config false; + leaf to-be-deleted { + type string; + description + "Key to be deleted."; + } + container component { + description + "Optional list of components on the circuit-pack and the load information applicable to those components. If a load is not up to date and will upgrade when a cold restart occurs, the version that will be applied should also be listed. If there is no misalignment, this does not need to be reported."; + leaf name { + type string; + description + "Name of a component on the circuit-pack that can have a load applied to it."; + } + leaf boot { + type boolean; + description + "Flag to indicate boot loader or unprotected firmware update required"; + } + leaf current-version { + type string; + description + "Name of the load version currently running on the component."; + } + leaf version-to-apply { + type string; + description + "Name of the load version for the component that will be applied when cold restart occurs on the circuit-pack."; + } + } + } + } + + grouping circuit-pack { + leaf circuit-pack-name { + type string; + description + "Unique identifier for this circuit-pack within a device"; + } + leaf lifecycle-state { + type org-openroadm-common-state-types:lifecycle-state; + description + "Lifecycle State of circuit-pack. Whether it is planned, deployed, in maintenance, etc."; + } + leaf administrative-state { + type org-openroadm-equipment-states-types:admin-states; + mandatory true; + description + "Administrative state of circuit-pack"; + } + uses org-openroadm-physical-types:common-info; + container circuit-pack-category { + config false; + description + "General type of circuit-pack"; + uses org-openroadm-common-equipment-types:equipment-type; + } + leaf equipment-state { + type org-openroadm-equipment-states-types:states; + description + "Equipment state, which complements operational state."; + } + leaf circuit-pack-mode { + type string; + default "NORMAL"; + description + "Circuit-pack mode allowed. e.g. NORMAL or REGEN"; + } + leaf shelf { + type leafref { + path "/org-openroadm-device/shelves/shelf-name"; + } + mandatory true; + } + leaf slot { + type string; + mandatory true; + } + leaf subSlot { + type string; + mandatory false; + } + leaf is-pluggable-optics { + type boolean; + config false; + mandatory true; + description + "True if circuitpack is pluggable optics"; + } + leaf is-physical { + type boolean; + config false; + mandatory true; + description + "is the entity physical or logical"; + } + leaf is-passive { + type boolean; + config false; + mandatory true; + description + "is the entity passive and not actively managed by the device; + e.g., no physical inventory or plug-in notification supported"; + } + leaf faceplate-label { + type string; + config false; + mandatory true; + description + "label on the faceplace silk screening"; + } + uses user-description-grp; + leaf due-date { + type ietf-yang-types:date-and-time; + description + "due date for this circuit-pack."; + } + container parent-circuit-pack { + description + "In the case of circuit packs that contain other equipment (modules or pluggables), this captures the hierarchy of that equipment. It is a vendor specific design decision if the ports for single-port pluggables are modeled as children of the parent circuit-pack, or as children of the pluggable circuit-pack contained in the parent circuit-pack. For modules with multiple ports, it is recommended that ports be children of the module and not the carrier, to help in fault correlation and isolation in the case of a module failure."; + uses circuit-pack-name-g; + leaf cp-slot-name { + type string; + description + "Slot name on parent-circuit-pack."; + } + } + list cp-slots { + key "slot-name"; + config false; + description + "List of circuit-pack slots on this circuit-pack. To be populated by NE during retrieval."; + uses slot-info; + leaf slot-type { + type enumeration { + enum pluggable-optics-holder { + value 1; + description + "slot accepts dedicated pluggable port circuit-pack"; + } + enum other { + value 2; + description + "slot accepts parent circuit-pack"; + } + } + } + } + uses circuit-pack-features; + list ports { + key "port-name"; + description + "List of ports on this circuit-pack. Note that pluggables are considered independent circuit-packs. All ports that are physically present on a pluggable, need to be modeled as a port against that pluggable circuit-pack, and not against the parent circuit-pack."; + uses port; + container roadm-port { + when "../port-qual='roadm-external'"; + uses org-openroadm-port-types:roadm-port; + } + container transponder-port { + when "../port-qual='xpdr-network' or ../port-qual='xpdr-client' or ../port-qual='switch-network' or ../port-qual='switch-client'"; + uses org-openroadm-port-types:common-port; + } + container otdr-port { + when "../port-qual='otdr'"; + description + "Settings for otdr port."; + leaf launch-cable-length { + type uint32; + units "m"; + default "30"; + } + leaf port-direction { + type org-openroadm-common-alarm-pm-types:direction; + } + } + container ila-port { + when "../port-qual='ila-external'"; + uses org-openroadm-port-types:common-port; + } + } + } + + grouping odu-connection { + description + "Grouping used to define odu-connections."; + leaf connection-name { + type string; + description + "roadm-connection and odu-connection share the same resource-type and resource definition (e.g. connection)"; + } + leaf direction { + type enumeration { + enum unidirectional { + value 1; + } + enum bidirectional { + value 2; + } + } + default "bidirectional"; + description + "Directionality of connection. If bidirectional, both directions are created."; + } + container source { + leaf src-if { + type leafref { + path "/org-openroadm-device/interface/name"; + } + mandatory true; + } + } + container destination { + leaf dst-if { + type leafref { + path "/org-openroadm-device/interface/name"; + } + mandatory true; + } + } + } + + grouping connection { + description + "Grouping used to define connections."; + leaf connection-name { + type string; + } + leaf opticalControlMode { + type org-openroadm-common-link-types:optical-control-mode; + default "off"; + description + "Whether connection is currently in power or gain/loss mode"; + reference "openroadm.org: Open ROADM MSA Specification."; + } + leaf target-output-power { + type org-openroadm-common-link-types:power-dBm; + description + "The output target power for this connection. When set, the ROADM will work to ensure that current-output-power reaches this level."; + } + container source { + leaf src-if { + type leafref { + path "/org-openroadm-device/interface/name"; + } + mandatory true; + } + } + container destination { + leaf dst-if { + type leafref { + path "/org-openroadm-device/interface/name"; + } + mandatory true; + } + } + } + + grouping mc-capabilities-grp { + description + "Media channel capabilities grouping"; + leaf-list mc-capabilities { + type leafref { + path "/org-openroadm-device/mc-capability-profile/profile-name"; + } + config false; + description + "Media channel capabilities"; + } + } + + grouping degree { + leaf degree-number { + type uint16; + must 'not( current() > /org-openroadm-device/info/max-degrees) and current() > 0' { + error-message "Degree not supported by device "; + description + "Validating if the degree is supported by device"; + } + } + leaf lifecycle-state { + type org-openroadm-common-state-types:lifecycle-state; + description + "Lifecycle State of degree. Whether it is planned, deployed, in maintenance, etc."; + } + leaf max-wavelengths { + type uint16; + config false; + mandatory true; + description + "maximum number of wavelengths"; + } + list circuit-packs { + key "index"; + description + "list for Cards associated with a degree"; + leaf index { + type uint32; + } + uses circuit-pack-name-g { + refine "circuit-pack-name" { + mandatory true; + } + } + } + list connection-ports { + key "index"; + description + "Port associated with degree: One if bi-directional; two if uni-directional"; + leaf index { + type uint32; + } + uses port-name { + refine "circuit-pack-name" { + mandatory true; + } + refine "port-name" { + mandatory true; + } + } + } + container otdr-port { + description + "otdr port associated with degree."; + uses port-name; + } + uses mc-capabilities-grp; + } + + grouping amplifier { + leaf amp-number { + type uint8 { + range "1..128"; + } + description + "Unique identifier/number for the amplifier entry which corresponds to a logical amplifier"; + } + leaf amp-type { + type org-openroadm-common-amplifier-types:amplifier-types; + config false; + mandatory true; + description + "Amplifier type"; + } + leaf control-mode { + type org-openroadm-common-amplifier-types:line-amplifier-control-mode; + default "off"; + description + "Whether the line amplifier is currently in off or gainLoss mode. control-mode can only be set to gainLoss when target-gain, target-tilt and egress-average-channel-power are set and the OMS interfaces are provisioned. The amplifier will be turned off when the control-mode is set to off"; + } + leaf amp-gain-range { + type org-openroadm-common-amplifier-types:amplifier-gain-range; + default "gain-range-1"; + config false; + description + "Amplifier gain-range (gain-range 1 to 4 for switched gain amplifiers) + gain-range-1 (default value) for standard amplifiers"; + } + leaf target-gain { + type org-openroadm-common-link-types:ratio-dB; + config true; + description + "Target overall Amplifier Signal gain, excluding ASE, including VOA attenuation. + Defined as optional for ODL support, but shall be considered as mandatory and provided + by the controller when the control-mode is set to gainLoss for amplifier setting"; + } + leaf target-tilt { + type org-openroadm-common-link-types:ratio-dB; + config true; + description + "Target tilt configured in case of smart EDFA. + Tilt value provided as specified in Open-ROADM-MSA-specifications spreadsheet + Defined as optional for ODL support, but shall be considered as mandatory and provided + by the controller when the control-mode is set to gainLoss for amplifier setting"; + } + leaf egress-average-channel-power { + type org-openroadm-common-link-types:power-dBm; + config true; + description + "Based upon the total max power across the 4.8 THz passband. + Defined as optional for ODL support, but shall be considered as mandatory and provided + by the controller when the control-mode is set to gainLoss for amplifier setting"; + } + leaf out-voa-att { + type org-openroadm-common-link-types:ratio-dB; + config false; + description + "Used to provide the value output VOA attenuation, optional"; + } + leaf partner-amp { + type leafref { + path "/org-openroadm-device/line-amplifier/amp-number"; + } + config false; + description + "amp-number of amp module that is functionally associated to the amplifier + in the opposite direction"; + } + leaf ila-direction-label { + type string; + description + "Amplifier direction. Each operators may have its own naming convention. + Shall be consistent with tx-instance-port-direction-label and rx-instance-port-direction-label."; + } + leaf lifecycle-state { + type org-openroadm-common-state-types:lifecycle-state; + description + "Lifecycle State of the amplifier. Whether it is planned, deployed, in maintenance, etc."; + } + } + + grouping external-links { + description + "YANG definitions for external links.. + - physical links between ROADMs and between the ROADMs and XPonders, which can be added and removed manually."; + list external-link { + key "external-link-name"; + uses external-link; + } + } + + grouping external-link { + leaf external-link-name { + type string; + } + container source { + uses org-openroadm-resource-types:device-id { + refine "node-id" { + mandatory true; + } + } + uses org-openroadm-resource-types:port-name { + refine "circuit-pack-name" { + mandatory true; + } + refine "port-name" { + mandatory true; + } + } + } + container destination { + uses org-openroadm-resource-types:device-id { + refine "node-id" { + mandatory true; + } + } + uses org-openroadm-resource-types:port-name { + refine "circuit-pack-name" { + mandatory true; + } + refine "port-name" { + mandatory true; + } + } + } + } + + grouping internal-links { + list internal-link { + key "internal-link-name"; + config false; + uses internal-link; + } + } + + grouping internal-link { + leaf internal-link-name { + type string; + } + container source { + uses port-name { + refine "circuit-pack-name" { + mandatory true; + } + refine "port-name" { + mandatory true; + } + } + } + container destination { + uses port-name { + refine "circuit-pack-name" { + mandatory true; + } + refine "port-name" { + mandatory true; + } + } + } + } + + grouping physical-links { + description + "YANG definitions for physical links. + - physical links (fiber, cables,etc.) between ports within a node. "; + list physical-link { + key "physical-link-name"; + uses physical-link; + } + } + + grouping physical-link { + leaf physical-link-name { + type string; + } + leaf is-physical { + type boolean; + description + "is the entity physical or logical"; + } + uses user-description-grp; + container source { + uses port-name { + refine "circuit-pack-name" { + mandatory true; + } + refine "port-name" { + mandatory true; + } + } + } + container destination { + uses port-name { + refine "circuit-pack-name" { + mandatory true; + } + refine "port-name" { + mandatory true; + } + } + } + leaf lifecycle-state { + type org-openroadm-common-state-types:lifecycle-state; + description + "Lifecycle State of the physical link. Whether it is planned, deployed, in maintenance, etc."; + } + } + + grouping srg { + leaf max-add-drop-ports { + type uint16; + config false; + mandatory true; + description + "The max number of ports available for a given srg"; + } + leaf current-provisioned-add-drop-ports { + type uint16; + config false; + mandatory true; + description + "The number of ports currently provisioned for a given srg."; + } + leaf srg-number { + type uint16; + must 'not(current()>/org-openroadm-device/info/max-srgs) and current()>0' { + error-message "invalid SRG"; + description + "Validating if the srg is supported by add/drop group"; + } + } + leaf lifecycle-state { + type org-openroadm-common-state-types:lifecycle-state; + description + "Lifecycle State of shared-risk-group. Whether it is planned, deployed, in maintenance, etc."; + } + leaf wavelength-duplication { + type org-openroadm-common-optical-channel-types:wavelength-duplication-type; + config false; + mandatory true; + description + "Whether the SRG can handle duplicate wavelengths and if so to what extent."; + } + list circuit-packs { + key "index"; + description + "list for Cards associated with an add/drop group and srg"; + leaf index { + type uint32; + } + uses circuit-pack-name-g { + refine "circuit-pack-name" { + mandatory true; + } + } + } + uses mc-capabilities-grp; + } + + grouping xponder { + leaf xpdr-number { + type uint16; + must 'current() > 0' { + error-message "Xponder not supported by device "; + description + "Validating if the Xponder is supported by device"; + } + } + leaf xpdr-type { + type org-openroadm-device-types:xpdr-node-types; + mandatory true; + description + "Identifier for xponder-type e.g Transponder, Muxponder"; + } + leaf lifecycle-state { + type org-openroadm-common-state-types:lifecycle-state; + description + "Lifecycle State of xponder. Whether it is planned, deployed, in maintenance, etc."; + } + leaf recolor { + type boolean; + config false; + description + "Indication if recolor is supported"; + } + list xpdr-port { + key "index"; + description + "Network Ports with in a Xponder"; + leaf index { + type uint32; + } + uses port-name { + refine "circuit-pack-name" { + mandatory true; + } + refine "port-name" { + mandatory true; + } + } + leaf eqpt-srg-id { + type uint32; + description + "Shared Risk Group identifier. All ports in a circuit-pack will have same srg-id"; + } + } + } + + grouping degree-number { + leaf degree-number { + type leafref { + path "/org-openroadm-device/degree/degree-number"; + } + description + "Degree identifier. Unique within the context of a device."; + } + } + + grouping circuit-pack-name-g { + leaf circuit-pack-name { + type leafref { + path "/org-openroadm-device/circuit-packs/circuit-pack-name"; + } + description + "Circuit-Pack identifier. Unique within the context of a device."; + } + } + + grouping port-name { + uses circuit-pack-name-g; + leaf port-name { + type leafref { + path "/org-openroadm-device/circuit-packs[circuit-pack-name=current()/../circuit-pack-name]/ports/port-name"; + } + description + "Port identifier. Unique within the context of a circuit-pack."; + } + } + + grouping srg-number { + leaf srg-number { + type leafref { + path "/org-openroadm-device/shared-risk-group/srg-number"; + } + description + "Shared Risk Group identifier. Unique within the context of a device."; + } + } + + grouping supporting-port-name { + leaf supporting-circuit-pack-name { + type leafref { + path "/org-openroadm-device/circuit-packs/circuit-pack-name"; + } + description + "Identifier of the supporting circuit-pack."; + } + leaf supporting-port { + type leafref { + path "/org-openroadm-device/circuit-packs[circuit-pack-name=current()/../supporting-circuit-pack-name]/ports/port-name"; + } + description + "Identifier of the supporting port."; + } + } + + grouping supporting-circuit-pack-list-grp { + description + "supporting circuit pack list grouping"; + list supporting-port-list { + key "index"; + description + "supporting port list"; + leaf index { + type uint8; + description + "supporting circuit pack index"; + } + leaf circuit-pack-name { + type leafref { + path "/org-openroadm-device/circuit-packs/circuit-pack-name"; + } + mandatory true; + description + "The supported circuit-pack. It will be empty if holder status is empty-not-prov, or installed-not-prov"; + } + leaf-list port-list { + type leafref { + path "/org-openroadm-device/circuit-packs[circuit-pack-name=current()/../circuit-pack-name]/ports/port-name"; + } + description + "port list"; + } + } + } + + grouping interface-name { + description + "interface name grouping"; + leaf interface-name { + type leafref { + path "/org-openroadm-device/interface/name"; + } + config false; + description + "Name of an interface. Unique within the context of a device."; + } + } + + grouping interfaces-grp { + description + "OpenROADM Interface configuration parameters."; + list interface { + key "name"; + description + "The list of configured interfaces on the device."; + leaf name { + type string; + description + "The name of the interface."; + } + leaf description { + type string; + description + "A textual description of the interface."; + } + leaf type { + type identityref { + base org-openroadm-interfaces:interface-type; + } + mandatory true; + description + "The type of the interface."; + } + leaf lifecycle-state { + type org-openroadm-common-state-types:lifecycle-state; + description + "Lifecycle State of interface. Whether it is planned, deployed, in maintenance, etc."; + } + leaf administrative-state { + type org-openroadm-equipment-states-types:admin-states; + mandatory true; + } + leaf operational-state { + type org-openroadm-common-state-types:state; + config false; + mandatory true; + } + leaf circuit-id { + type string { + length "0..45"; + } + description + "circuit identifier/user label, + can be used in alarm correlation and/or connection management "; + } + leaf supporting-interface { + type leafref { + path "/org-openroadm-device/interface/name"; + } + description + "supporting interface"; + } + uses supporting-port-name; + leaf-list supporting-interface-list { + type leafref { + path "/org-openroadm-device/interface/name"; + } + description + "supporting interface list"; + } + uses supporting-circuit-pack-list-grp; + } + } + + grouping protection-groups { + description + "OpenROADM facility protection configuration parameters."; + container protection-grps { + description + "The list of configured protection groups on the device."; + } + } + + grouping port { + description + "Grouping of attributes related to a port object."; + leaf port-name { + type string; + mandatory true; + description + "Identifier for a port, unique within a circuit pack"; + } + uses supporting-circuit-pack-list-grp; + leaf port-type { + type string; + description + "Type of the pluggable or fixed port."; + } + leaf port-qual { + type org-openroadm-device-types:port-qual; + } + leaf port-wavelength-type { + type org-openroadm-port-types:port-wavelength-types; + config false; + description + "Type of port - single, multiple-wavelength, etc."; + } + leaf port-direction { + type org-openroadm-common-alarm-pm-types:direction; + config false; + mandatory true; + description + "Whether port is uni (tx/rx) or bi-directional and"; + } + leaf label { + type string; + config false; + status deprecated; + description + "Faceplate label"; + } + leaf is-physical { + type boolean; + config false; + mandatory true; + description + "is the entity physical or logical"; + } + leaf faceplate-label { + type string; + config false; + mandatory true; + description + "label on the faceplace silk screening"; + } + uses user-description-grp; + leaf circuit-id { + type string { + length "0..45"; + } + description + "circuit identifier/user label, + can be used in alarm correlation and/or connection management "; + } + leaf lifecycle-state { + type org-openroadm-common-state-types:lifecycle-state; + description + "Lifecycle State of port. Whether it is planned, deployed, in maintenance, etc."; + } + leaf administrative-state { + type org-openroadm-equipment-states-types:admin-states; + default "outOfService"; + description + "Administrative state of port. The value of this field independent of the state of its contained and containing resources. Setting this a port to administratively down will impact both its operational state, as well the operational state of its contained resources. If this port is an endpoint to a connection, internal-link, physical-link, etc, then administratively disabling this port will impact the operational state of those items unless they are using some form of port-protection schema."; + } + leaf operational-state { + type org-openroadm-common-state-types:state; + config false; + mandatory true; + description + "Operational state of a port"; + } + leaf-list supported-interface-capability { + type identityref { + base org-openroadm-port-types:supported-if-capability; + } + config false; + description + "Interface types supported on this port"; + } + leaf logical-connection-point { + type string; + description + "delete or replace with list logical-ports or connections?"; + } + container partner-port { + config false; + description + "For ports which are not identified as having a direction of bidirectional, this field is used to identify the port which corresponds to the reverse direction. A port pair should include a port for each direction (tx, rx) and report their mate as partner-port."; + uses port-name; + } + container parent-port { + config false; + description + "In the case of port hierarchy, this is the parent port, which is also modeled as port within this circuit-pack. This is used in the case of a port that supports a parallel connector that contains subports. The parent-port of the subport will be the port that contains this subport. This can be used to help isolate faults when a single fault on a parallel connector introduces symptomatic failures on the contained subports."; + uses port-name; + } + list interfaces { + key "interface-name"; + config false; + description + "List of the interfaces this port supports. This is a list of names of instances in the flat instance list. Implementations must provide the list of interfaces for port that has interfaces provisioned on that port."; + uses interface-name; + } + uses mc-capabilities-grp; + } + + // grouping org-openroadm-device-container-g { + container org-openroadm-device { + container info { + uses device-common; + leaf max-degrees { + type uint16; + config false; + description + "Max. number of degrees supported by device"; + } + leaf max-srgs { + type uint16; + config false; + description + "Max. number of SRGs in an add/drop group"; + } + leaf max-num-bin-15min-historical-pm { + type uint16; + config false; + description + "Max. number of bin the NE support for 15min historical PM"; + } + leaf max-num-bin-24hour-historical-pm { + type uint16; + config false; + description + "Max. number of bin the NE support for 24hour historical PM"; + } + } + container users { + description + "Stores a list of users"; + uses org-openroadm-user-mgmt:user-profile; + } + container pending-sw { + config false; + description + "pending software information"; + uses org-openroadm-swdl:sw-bank; + } + container database-info { + config false; + description + "database restore information"; + uses org-openroadm-swdl:database-info-group; + } + uses shelves; + uses circuit-packs; + uses interfaces-grp; + uses protection-groups; + container protocols { + description + "Contains the supported protocols"; + leaf lifecycle-state { + type org-openroadm-common-state-types:lifecycle-state; + description + "Lifecycle State of the protocols. Whether it is planned or deployed, etc."; + } + } + uses internal-links; + uses physical-links; + uses external-links; + list degree { + when "/org-openroadm-device/info/node-type='rdm'"; + key "degree-number"; + uses degree; + } + list shared-risk-group { + when "/org-openroadm-device/info/node-type='rdm'"; + key "srg-number"; + uses srg; + } + list line-amplifier { + when "/org-openroadm-device/info/node-type='ila'"; + key "amp-number"; + description + "lists amplifiers in different directions"; + uses amplifier; + list circuit-pack { + key "index"; + description + "list for Cards associated with an amplifier"; + leaf index { + type uint32; + } + uses circuit-pack-name-g { + refine "circuit-pack-name" { + mandatory true; + } + } + } + list line-port { + key "port-direction"; + description + "Port associated with an amplifier which face the line (ila-external): traffic port."; + leaf port-direction { + type org-openroadm-common-alarm-pm-types:direction; + config true; + mandatory true; + description + "partly allows identifying ports associated with logical amp :TX for egress, RX for ingress + TXRX in case of bidirectional port"; + } + leaf tx-instance-port-direction-label { + type string; + config true; + description + "Complements ports identification. Used notably in case of bidirectional ports, + and/or in multi-degree amplifier nodes. Allows associating one of the directions + specified in ila-direction-label. Shall be consistent with ila-direction-label"; + } + leaf rx-instance-port-direction-label { + type string; + config true; + description + "Complements ports identification. Used notably in case of bidirectional ports, + and/or in multi-degree amplifier nodes. Allows associating one of the directions + specified in ila-direction-label. Shall be consistent with ila-direction-label"; + } + uses port-name { + refine "circuit-pack-name" { + mandatory true; + } + refine "port-name" { + mandatory true; + } + } + } + list osc-port { + key "port-direction"; + description + "Ports associated with OSC"; + leaf port-direction { + type org-openroadm-common-alarm-pm-types:direction; + config true; + mandatory true; + description + "allows identifying ports associated with logical amp : + TX for OSC circuit-pack IN RX for OSC circuit-pack OUT"; + } + uses port-name { + refine "circuit-pack-name" { + mandatory true; + } + refine "port-name" { + mandatory true; + } + } + } + list otdr-port { + key "otdr-direction"; + description + "otdr ports associated with an ILA"; + leaf otdr-direction { + type string; + config true; + description + "allows identifying associated logical amp port in which OTDR is launched: + corresponds to rx-instance-port-direction-label of corresponding amplifier line-port"; + } + uses port-name { + refine "circuit-pack-name" { + mandatory true; + } + refine "port-name" { + mandatory true; + } + } + } + } + list xponder { + when "/org-openroadm-device/info/node-type='xpdr'"; + key "xpdr-number"; + uses xponder; + } + list roadm-connections { + when "/org-openroadm-device/info/node-type='rdm'"; + key "connection-name"; + uses connection; + } + list odu-connection { + when "/org-openroadm-device/info/node-type='xpdr'"; + key "connection-name"; + uses odu-connection; + } + list connection-map { + key "connection-map-number"; + config false; + leaf connection-map-number { + type uint32; + description + "Unique identifier for this connection-map entry"; + } + container source { + leaf circuit-pack-name { + type leafref { + path "/org-openroadm-device/circuit-packs/circuit-pack-name"; + } + mandatory true; + } + leaf port-name { + type leafref { + path "/org-openroadm-device/circuit-packs[circuit-pack-name=current()/../circuit-pack-name]/ports/port-name"; + } + mandatory true; + description + "Port identifier. Unique within the context of a circuit-pack."; + } + } + list destination { + key "circuit-pack-name port-name"; + min-elements 1; + leaf circuit-pack-name { + type leafref { + path "/org-openroadm-device/circuit-packs/circuit-pack-name"; + } + mandatory true; + } + leaf port-name { + type leafref { + path "/org-openroadm-device/circuit-packs[circuit-pack-name=current()/../circuit-pack-name]/ports/port-name"; + } + mandatory true; + description + "Port identifier. Unique within the context of a circuit-pack."; + } + } + } + list odu-switching-pools { + when "/org-openroadm-device/info/node-type='xpdr'"; + key "switching-pool-number"; + config false; + leaf switching-pool-number { + type uint16; + description + "Unique identifier for this odu-switching-pool"; + } + leaf switching-pool-type { + type org-openroadm-switching-pool-types:switching-pool-types; + description + "Blocking/Non-Blocking"; + } + leaf odu-connection-direction-capabilities { + type identityref { + base connection-direction-identity; + } + description + "Bidrectional capable, or Bi and Unidirectional capable"; + } + list non-blocking-list { + key "nbl-number"; + config false; + description + "List of ports in a non-blocking switch element"; + leaf nbl-number { + type uint16; + description + "Identifier for this non-blocking-list. Unique within odu-switching-pool"; + } + leaf interconnect-bandwidth-unit { + type uint32; + config false; + description + "Switch fabric interconnect bandwidth unit rate in bits per second. + Represents granularity of switch fabric"; + } + leaf interconnect-bandwidth { + type uint32; + config false; + description + "Total interconnect bandwidth for a non-blocking element expressed as + number of inter-connect-bandwidth units"; + } + list port-list { + key "circuit-pack-name port-name"; + leaf circuit-pack-name { + type leafref { + path "/org-openroadm-device/circuit-packs/circuit-pack-name"; + } + config false; + } + leaf port-name { + type leafref { + path "/org-openroadm-device/circuit-packs/ports/port-name"; + } + config false; + description + "Port name. Unique within device"; + } + } + list pluggable-optics-holder-list { + key "circuit-pack-name slot-name"; + leaf circuit-pack-name { + type leafref { + path "/org-openroadm-device/circuit-packs/circuit-pack-name"; + } + config false; + description + "Name of parent circuit-pack"; + } + leaf slot-name { + type leafref { + path "/org-openroadm-device/circuit-packs/cp-slots/slot-name"; + } + config false; + description + "Name of pluggable-optics-holder"; + } + } + } + } + list mc-capability-profile { + key "profile-name"; + config false; + description + "Media channel capability profile list"; + leaf profile-name { + type string; + description + "Media channel profile name"; + } + leaf center-freq-granularity { + type org-openroadm-common-optical-channel-types:frequency-GHz; + default "50"; + config false; + description + "Granularity of allowed center frequencies. The base frequency for this computation is 193.1 THz (G.694.1)"; + } + leaf min-edge-freq { + type org-openroadm-common-optical-channel-types:frequency-THz; + config false; + description + "Minimum edge frequency"; + } + leaf max-edge-freq { + type org-openroadm-common-optical-channel-types:frequency-THz; + config false; + description + "Maximum edge frequency"; + } + leaf slot-width-granularity { + type org-openroadm-common-optical-channel-types:frequency-GHz; + default "50"; + config false; + description + "Width of a slot measured in GHz."; + } + leaf min-slots { + type uint32; + default "1"; + config false; + description + "Minimum number of slots permitted to be joined together to form a media channel. Must be less than or equal to the max-slots"; + } + leaf max-slots { + type uint32; + default "1"; + config false; + description + "Maximum number of slots permitted to be joined together to form a media channel. Must be greater than or equal to the min-slots"; + } + } + } + // } + + grouping common-session-parms { + description + "Common session parameters to identify a + management session."; + leaf username { + type org-openroadm-user-mgmt:username-type; + mandatory true; + description + "Name of the user for the session."; + } + leaf session-id { + type ietf-nc:session-id-or-zero-type; + mandatory true; + description + "Identifier of the session. + A NETCONF session MUST be identified by a non-zero value. + A non-NETCONF session MAY be identified by the value zero."; + } + leaf source-host { + type ietf-inet-types:ip-address; + description + "Address of the remote host for the session."; + } + } + + grouping changed-by-parms { + description + "Common parameters to identify the source + of a change event, such as a configuration + or capability change."; + container changed-by { + description + "Indicates the source of the change. + If caused by internal action, then the + empty leaf 'server' will be present. + If caused by a management session, then + the name, remote host address, and session ID + of the session that made the change will be reported."; + choice server-or-user { + leaf server { + type empty; + description + "If present, the change was caused + by the server."; + } + case by-user { + uses common-session-parms; + } + } + } + } + + rpc led-control { + description + "This command is used to allow user to find an entity on the NE, + The specified entity will have LED blinking. + The equipmentLedOn alarm will be raised and cleared for the indication"; + input { + choice equipment-entity { + mandatory true; + case shelf { + leaf shelf-name { + type leafref { + path "/org-openroadm-device/shelves/shelf-name"; + } + mandatory true; + description + "shelf-name for the operation"; + } + } + case circuit-pack { + leaf circuit-pack-name { + type leafref { + path "/org-openroadm-device/circuit-packs/circuit-pack-name"; + } + mandatory true; + description + "circuit-pack-name for the operation"; + } + } + } + leaf enabled { + type boolean; + mandatory true; + description + "led-control enabled flag. + when enabled=true, equipmentLedOn alarm will be raised + when enabled=false, equipmentLedOn alarm will be cleared"; + } + } + output { + uses org-openroadm-common-types:rpc-response-status; + } + } + rpc create-tech-info { + description + "Collects all log data for debugging and place it in a location accessible via ftp/sftp. + This model assumes ASYNC operation, i.e. the command will return after the device accepts the command, + A create-tech-info-notification will be send out later for the result of the operation. + The log-file is cleared at the start of every create-tech-info operation in order to ensure + the up-to-date logs are collected. If a vendor does not support concurrent log collection, the second + create-tech-info command will be rejected."; + input { + leaf shelf-id { + type leafref { + path "/org-openroadm-device/shelves/shelf-name"; + } + description + "This optional field is used to specify the shelf for log collection. + When this filed is not provided, it is expected to collect logs for the whole node. + Vendor should reject the command if the whole node log collection is not supported."; + } + leaf log-option { + type string; + description + "The log type a vendor can specify. Maybe used in future"; + } + } + output { + uses create-tech-info-group; + uses org-openroadm-common-types:rpc-response-status; + } + } + rpc get-connection-port-trail { + input { + leaf connection-name { + type string; + mandatory true; + } + } + output { + uses org-openroadm-common-types:rpc-response-status; + list ports { + uses org-openroadm-device-types:physical-location; + uses port-name { + refine "circuit-pack-name" { + mandatory true; + } + refine "port-name" { + mandatory true; + } + } + } + } + } + rpc disable-automatic-shutoff { + input { + choice degree-or-amp { + mandatory true; + description + "The choice describes the option to specify the entity for the disable-automatic-shutoff RPC. It can be degree-number for rdm and amp-number for ila"; + case degree { + leaf degree-number { + type leafref { + path "/org-openroadm-device/degree/degree-number"; + } + mandatory true; + description + "The degree-number defined in degree"; + } + } + case amp { + leaf amp-number { + type leafref { + path "/org-openroadm-device/line-amplifier/amp-number"; + } + mandatory true; + description + "The amp-number defined in line-amplifier"; + } + } + } + leaf support-timer { + type uint16 { + range "1..600"; + } + default "20"; + } + } + output { + uses org-openroadm-common-types:rpc-response-status; + } + } + rpc start-scan { + input { + choice degree-or-amp { + mandatory true; + description + "The choice describes the option to specify the entity for the start-scan RPC. It can be degree-number for rdm and amp-number for ila"; + case degree { + leaf degree-number { + type leafref { + path "/org-openroadm-device/degree/degree-number"; + } + mandatory true; + description + "The degree-number defined in degree"; + } + } + case amp { + leaf amp-number { + type leafref { + path "/org-openroadm-device/line-amplifier/amp-number"; + } + mandatory true; + description + "The amp-number defined in line-amplifier"; + } + } + } + leaf port-direction { + type org-openroadm-common-alarm-pm-types:direction; + } + leaf distance { + type uint32; + } + leaf resolution { + type uint32; + } + } + output { + uses org-openroadm-common-types:rpc-response-status; + } + } + rpc set-current-datetime { + description + "Set the info/current-datetime leaf to the specified value."; + input { + leaf current-datetime { + type ietf-yang-types:date-and-time; + mandatory true; + description + "The current system date and time in UTC. Format: YYYY-MM-DDTHH:MM:SS"; + } + } + output { + uses org-openroadm-common-types:rpc-response-status; + } + } + notification create-tech-info-notification { + description + "This Notification is sent when the create-tech-info is complete or failed."; + uses create-tech-info-group; + uses org-openroadm-common-types:rpc-response-status; + } + notification otdr-scan-result { + description + "This Notification is sent when the otdr-scan-result is complete or failed."; + uses org-openroadm-common-types:rpc-response-status; + leaf result-file { + type string; + } + } + notification change-notification { + description + "The Notification that a resource has been added, modified or removed. + This notification can be triggered by changes in configuration and operational data. + It shall contain the changed field pointed by the xpath. + Typically it is not intended for frequently changing volatile data e.g. PM, power levels"; + leaf change-time { + type ietf-yang-types:date-and-time; + description + "The time the change occurs."; + } + uses changed-by-parms; + leaf datastore { + type enumeration { + enum running { + description + "The <running> datastore has changed."; + } + enum startup { + description + "The <startup> datastore has changed"; + } + } + default "running"; + description + "Indicates which configuration datastore has changed."; + } + list edit { + description + "An edit (change) record SHOULD be present for each distinct + edit operation that the server has detected on + the target datastore. This list MAY be omitted + if the detailed edit operations are not known. + The server MAY report entries in this list for + changes not made by a NETCONF session."; + leaf target { + type instance-identifier; + description + "Top most node associated with the configuration or operational change. + A server SHOULD set this object to the node within + the datastore that is being altered. A server MAY + set this object to one of the ancestors of the actual + node that was changed, or omit this object, if the + exact node is not known."; + } + leaf operation { + type ietf-nc:edit-operation-type; + description + "Type of edit operation performed. + A server MUST set this object to the NETCONF edit + operation performed on the target datastore."; + } + } + } + // uses org-openroadm-device-container-g; +}
\ No newline at end of file diff --git a/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/yang/org-openroadm-equipment-states-types.yang b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/yang/org-openroadm-equipment-states-types.yang new file mode 100644 index 000000000..ccfca1972 --- /dev/null +++ b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/yang/org-openroadm-equipment-states-types.yang @@ -0,0 +1,147 @@ +module org-openroadm-equipment-states-types { + namespace "http://org/openroadm/equipment/states/types"; + prefix org-openroadm-equipment-states-types; + + organization + "Open ROADM MSA"; + contact + "OpenROADM.org"; + description + "YANG definitions for types of states of equipment (slot/subslot). + + Copyright of the Members of the Open ROADM MSA Agreement dated (c) 2016, + All other rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. + * Neither the Members of the Open ROADM MSA Agreement nor the names of its + contributors may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE MEMBERS OF THE OPEN ROADM MSA AGREEMENT ''AS IS'' + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT THE MEMBERS OF THE OPEN ROADM MSA AGREEMENT BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE."; + + revision 2019-11-29 { + description + "Version 6.1.0"; + } + revision 2018-11-30 { + description + "Version 4.1.0"; + } + revision 2017-12-15 { + description + "Version 2.2"; + } + revision 2017-06-26 { + description + "Version 2.0"; + } + revision 2016-10-14 { + description + "Version 1.2"; + } + + typedef admin-states { + type enumeration { + enum inService { + value 1; + } + enum outOfService { + value 2; + } + enum maintenance { + value 3; + } + } + } + + typedef states { + type enumeration { + enum reserved-for-facility-planned { + value 1; + description + "equipment is planned for use by a service"; + } + enum not-reserved-planned { + value 2; + description + "equipment is planned by not reserved for any purpose"; + } + enum reserved-for-maintenance-planned { + value 3; + description + "equipment is planned for use as a maintenance spare"; + } + enum reserved-for-facility-unvalidated { + value 4; + description + "equipment is reserved for use by a service but not + validated against planned equipment"; + } + enum not-reserved-unvalidated { + value 5; + description + "equipment is not reserved for any purpose and + not validated against planned equipment"; + } + enum unknown-unvalidated { + value 6; + description + "unknown equipment not validated against planned equipment"; + } + enum reserved-for-maintenance-unvalidated { + value 7; + description + "equipment is to be used for use as a maintenance spare + but not validated against planned equipment"; + } + enum reserved-for-facility-available { + value 8; + description + "reserved for use by a service and available"; + } + enum not-reserved-available { + value 9; + description + "not reserved for use by a service and available"; + } + enum reserved-for-maintenance-available { + value 10; + description + "reserved as a maintenance spare and available"; + } + enum reserved-for-reversion-inuse { + value 11; + description + "equipment that is reserved as part of a home path + for a service that has been temporarily re-routed"; + } + enum not-reserved-inuse { + value 12; + description + "equipment in use for a service"; + } + enum reserved-for-maintenance-inuse { + value 13; + description + "maintenance spare equipment that is in use as a + maintenance spare"; + } + } + } +} diff --git a/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/yang/org-openroadm-interfaces.yang b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/yang/org-openroadm-interfaces.yang new file mode 100644 index 000000000..618c1e51b --- /dev/null +++ b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/yang/org-openroadm-interfaces.yang @@ -0,0 +1,181 @@ +module org-openroadm-interfaces { + namespace "http://org/openroadm/interfaces"; + prefix openROADM-if; + + organization + "Open ROADM MSA"; + contact + "OpenROADM.org"; + description + "YANG definitions for device facility interfaces. + Reused ietf-interfaces and some interface-type defined in iana-if-type. + + Copyright of the Members of the Open ROADM MSA Agreement dated (c) 2016, + All other rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. + * Neither the Members of the Open ROADM MSA Agreement nor the names of its + contributors may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE MEMBERS OF THE OPEN ROADM MSA AGREEMENT ''AS IS'' + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT THE MEMBERS OF THE OPEN ROADM MSA AGREEMENT BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + + Also contains code components extracted from IETF Interfaces. These code components + are copyrighted and licensed as follows: + + Copyright (c) 2016 IETF Trust and the persons identified as the document authors. + All rights reserved. + + This document is subject to BCP 78 and the IETF Trust’s Legal Provisions Relating + to IETF Documents (http://trustee.ietf.org/license-info) in effect on the date of + publication of this document. Please review these documents carefully, as they + describe your rights and restrictions with respect to this document. Code Components + extracted from this document must include Simplified BSD License text as described in + Section 4.e of the Trust Legal Provisions and are provided without warranty as + described in the Simplified BSD License."; + + revision 2019-11-29 { + description + "Version 6.1.0"; + } + revision 2019-05-31 { + description + "Version 5.1.0"; + } + revision 2018-11-30 { + description + "Version 4.1.0"; + } + revision 2018-09-28 { + description + "Version 4.0.0"; + } + revision 2018-03-30 { + description + "Version 3.0"; + } + revision 2017-06-26 { + description + "Version 2.0"; + } + revision 2016-10-14 { + description + "Version 1.2"; + } + + identity interface-type { + description + "Base identity from which specific interface types are + derived."; + } + + identity ethernetCsmacd { + base interface-type; + description + "For all Ethernet-like interfaces, regardless of speed, + as per RFC 3635."; + reference + "RFC 3635 - Definitions of Managed Objects for the + Ethernet-like Interface Types"; + } + + identity ip { + base interface-type; + description + "IP (for APPN HPR in IP networks)."; + } + + identity mediaChannelTrailTerminationPoint { + base interface-type; + description + "Media Channel Trail Termination Point"; + } + + identity networkMediaChannelConnectionTerminationPoint { + base interface-type; + description + "Network Media Channel Connection Termination Point"; + } + + identity opticalChannel { + base interface-type; + description + "Optical Channel."; + } + + identity opticalTransport { + base interface-type; + description + "Optical Transport."; + } + + identity otnOdu { + base interface-type; + description + "OTN Optical Data Unit."; + } + + identity otnOtu { + base interface-type; + description + "OTN Optical channel Transport Unit."; + } + + identity otsi { + base interface-type; + description + "OTSI interface."; + } + + identity otsi-group { + base interface-type; + description + "OTSI Group interface."; + } + + identity flexo { + base interface-type; + description + "Flexo interface."; + } + + identity flexo-group { + base interface-type; + description + "Flexo Group interface."; + } + + identity openROADMOpticalMultiplex { + base interface-type; + description + "Optical Transport Multiplex type for openROADM"; + } + + identity ppp { + base interface-type; + description + "PPP for IP GNE."; + } + + identity gcc { + base interface-type; + description + "ITU-T G.709 GCC."; + } +} diff --git a/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/yang/org-openroadm-otn-common-types.yang b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/yang/org-openroadm-otn-common-types.yang new file mode 100644 index 000000000..69b9e9d38 --- /dev/null +++ b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/yang/org-openroadm-otn-common-types.yang @@ -0,0 +1,343 @@ +module org-openroadm-otn-common-types { + namespace "http://org/openroadm/otn-common-types"; + prefix org-openroadm-otn-common-types; + + organization + "Open ROADM MSA"; + contact + "OpenROADM.org"; + description + "YANG definitions for common otn related type definitions. + + Copyright of the Members of the Open ROADM MSA Agreement dated (c) 2016, + All other rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. + * Neither the Members of the Open ROADM MSA Agreement nor the names of its + contributors may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE MEMBERS OF THE OPEN ROADM MSA AGREEMENT ''AS IS'' + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT THE MEMBERS OF THE OPEN ROADM MSA AGREEMENT BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + + Also contains code components extracted from IETF Interfaces. These code components + are copyrighted and licensed as follows: + + Copyright (c) 2016 IETF Trust and the persons identified as the document authors. + All rights reserved. + + This document is subject to BCP 78 and the IETF Trust’s Legal Provisions Relating + to IETF Documents (http://trustee.ietf.org/license-info) in effect on the date of + publication of this document. Please review these documents carefully, as they + describe your rights and restrictions with respect to this document. Code Components + extracted from this document must include Simplified BSD License text as described in + Section 4.e of the Trust Legal Provisions and are provided without warranty as + described in the Simplified BSD License."; + + revision 2019-11-29 { + description + "Version 6.1.0"; + } + revision 2019-09-27 { + description + "Version 6.0.0"; + } + revision 2018-11-30 { + description + "Version 4.1.0"; + } + revision 2018-09-28 { + description + "Version 4.0.0"; + } + revision 2018-03-30 { + description + "Version 3.0.0"; + } + revision 2017-12-15 { + description + "Version 2.2"; + } + revision 2017-09-29 { + description + "Version 2.1"; + } + + identity otu-rate-identity { + description + "A unique rate identification of the OTU."; + } + + identity OTUCn { + base otu-rate-identity; + description + "Identity for an OTUCn"; + } + + identity OTU4 { + base otu-rate-identity; + description + "Identity for an OTU4"; + } + + identity OTU3 { + base otu-rate-identity; + description + "Identity for an OTU3"; + } + + identity OTU2 { + base otu-rate-identity; + description + "Identity for an OTU2"; + } + + identity OTU2e { + base otu-rate-identity; + description + "Identity for an OTU2e"; + } + + identity OTU1 { + base otu-rate-identity; + description + "Identity for an OTU1"; + } + + identity OTU0 { + base otu-rate-identity; + description + "Identity for an OTU0"; + } + + identity OTUflex { + base otu-rate-identity; + description + "Identity for an OTUflex"; + } + + identity odu-rate-identity { + description + "A unique rate identification of the ODU."; + } + + identity ODUCn { + base odu-rate-identity; + description + "Identity for an ODUCn"; + } + + identity ODU4 { + base odu-rate-identity; + description + "Identity for an ODU4"; + } + + identity ODU3 { + base odu-rate-identity; + description + "Identity for an ODU3"; + } + + identity ODU2 { + base odu-rate-identity; + description + "Identity for an ODU2"; + } + + identity ODU2e { + base odu-rate-identity; + description + "Identity for an ODU2e"; + } + + identity ODU1 { + base odu-rate-identity; + description + "Identity for an ODU1"; + } + + identity ODU0 { + base odu-rate-identity; + description + "Identity for an ODU0"; + } + + identity ODUflex-cbr { + base odu-rate-identity; + description + "ODUFlex for CBR client signals (G.709)"; + } + + identity ODUflex-cbr-25G { + base odu-rate-identity; + description + "ODUFlex for CBR client signals 25G (G.709 17.13.1)"; + } + + identity ODUflex-cbr-200G { + base odu-rate-identity; + description + "ODUFlex for CBR client signals 200G (G.709 17.13.2)"; + } + + identity ODUflex-cbr-400G { + base odu-rate-identity; + description + "ODUFlex for CBR client signals 400G (G.709 17.13.2)"; + } + + identity ODUflex-imp { + base odu-rate-identity; + description + "ODUFlex for IMP (Idle insertion Mapping Procedure) mapped client signals (G.709)"; + } + + identity ODUflex-flexe { + base odu-rate-identity; + description + "ODUflex for FlexE-aware client signals (G.709)"; + } + + identity ODUflex-gfp { + base odu-rate-identity; + description + "ODUflex for GFP-F mapped client signals (G.709)"; + } + + identity odtu-type-identity { + description + "A unique identification for the MSI odtu type."; + } + + identity ODTUCn.ts { + base odtu-type-identity; + description + "ODTUCn.ts - OPUCn MSI type (G.709 clause 20.2)"; + } + + identity ODTU4.ts-Allocated { + base odtu-type-identity; + description + "OPU4 MSI - ODTU4.ts, OPU4 MSI TS is occupied/allocated. + Applies to all ODTU4.x mappings"; + } + + identity ODTU01 { + base odtu-type-identity; + description + "ODTU01 MSI type"; + } + + identity ODTU12 { + base odtu-type-identity; + description + "ODTU12 MSI type"; + } + + identity ODTU13 { + base odtu-type-identity; + description + "ODTU13 MSI type"; + } + + identity ODTU23 { + base odtu-type-identity; + description + "ODTU23 MSI type"; + } + + identity ODTU2.ts { + base odtu-type-identity; + description + "ODTU2.ts MSI type"; + } + + identity ODTU3.ts { + base odtu-type-identity; + description + "ODTU3.ts MSI type"; + } + + identity ODTU4.ts { + base odtu-type-identity; + description + "ODTU4.ts MSI type"; + } + + identity unallocated { + base odtu-type-identity; + description + "Unallocated MSI type"; + } + + identity odu-function-identity { + description + "A unique identification of the ODUk interface function."; + } + + identity ODU-TTP { + base odu-function-identity; + description + "ODU TTP facility facing trail termination"; + } + + identity ODU-CTP { + base odu-function-identity; + description + "ODU CTP connection termination"; + } + + identity ODU-TTP-CTP { + base odu-function-identity; + description + "ODU CTP mapper level connection termination with trail termination and client adaptation"; + } + + typedef payload-type-def { + type string { + length "2"; + pattern '[0-9a-fA-F]*'; + } + description + "Common type definition for odu payload-type"; + } + + typedef opucn-trib-slot-def { + type string; + description + "OPUCn trib slot in the form of 'A.B' with + A = 1..n + B = 1..20"; + } + + typedef tcm-direction-enum { + type enumeration { + enum up-tcm { + description + "TCM termination direction faces the switch fabric."; + } + enum down-tcm { + description + "TCM termination direction faces the facility"; + } + } + description + "Enumeration type for TCM direction"; + } +} diff --git a/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/yang/org-openroadm-physical-types.yang b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/yang/org-openroadm-physical-types.yang new file mode 100644 index 000000000..236093707 --- /dev/null +++ b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/yang/org-openroadm-physical-types.yang @@ -0,0 +1,153 @@ +module org-openroadm-physical-types { + namespace "http://org/openroadm/physical/types"; + prefix org-openroadm-physical-types; + + import org-openroadm-common-state-types { + prefix org-openroadm-common-state-types; + revision-date 2019-11-29; + } + import ietf-yang-types { + prefix yang; + revision-date 2013-07-15; + } + + organization + "Open ROADM MSA"; + contact + "OpenROADM.org"; + description + "YANG definitions of physical types. + + Copyright of the Members of the Open ROADM MSA Agreement dated (c) 2016, + All other rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. + * Neither the Members of the Open ROADM MSA Agreement nor the names of its + contributors may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE MEMBERS OF THE OPEN ROADM MSA AGREEMENT ''AS IS'' + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT THE MEMBERS OF THE OPEN ROADM MSA AGREEMENT BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE."; + + revision 2019-11-29 { + description + "Version 6.1.0"; + } + revision 2018-11-30 { + description + "Version 4.1.0"; + } + revision 2018-09-28 { + description + "Version 4.0.0"; + } + revision 2018-03-30 { + description + "Version 3.0.0"; + } + revision 2017-12-15 { + description + "Version 2.2"; + } + revision 2017-09-29 { + description + "Version 2.1"; + } + revision 2017-07-28 { + description + "Version 2.0.1 - added revision-date to imports"; + } + revision 2017-06-26 { + description + "Version 2.0"; + } + revision 2016-10-14 { + description + "Version 1.2"; + } + + grouping node-info { + description + "Physical inventory data used by the node"; + leaf vendor { + type string; + config false; + mandatory true; + description + "Vendor of the equipment"; + } + leaf model { + type string; + config false; + mandatory true; + description + "Physical resource model information."; + } + leaf serial-id { + type string; + config false; + mandatory true; + description + "Product Code for this physical resource"; + } + } + + grouping common-info { + description + "Physical inventory data used by all other entities"; + uses node-info; + leaf type { + type string; + config false; + description + "The specific type of this physical resource - ie the type of + shelf, type of circuit-pack, etc."; + } + leaf product-code { + type string; + config false; + description + "Product Code for this physical resource"; + } + leaf manufacture-date { + type yang:date-and-time; + config false; + description + "Manufacture date of physical resource"; + } + leaf clei { + type string; + config false; + description + "CLEI for this physical resource"; + } + leaf hardware-version { + type string; + config false; + description + "The version of the hardware."; + } + leaf operational-state { + type org-openroadm-common-state-types:state; + config false; + mandatory true; + description + "Operational state of the physical resource"; + } + } +} diff --git a/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/yang/org-openroadm-pm.yang b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/yang/org-openroadm-pm.yang new file mode 100644 index 000000000..2cebbb477 --- /dev/null +++ b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/yang/org-openroadm-pm.yang @@ -0,0 +1,350 @@ +module org-openroadm-pm { + namespace "http://org/openroadm/pm"; + prefix org-openroadm-pm; + + import ietf-yang-types { + prefix yang; + revision-date 2013-07-15; + } + import org-openroadm-common-types { + prefix org-openroadm-common-types; + revision-date 2019-11-29; + } + import org-openroadm-common-alarm-pm-types { + prefix org-openroadm-common-alarm-pm-types; + revision-date 2019-11-29; + } + import org-openroadm-resource { + prefix org-openroadm-resource; + revision-date 2019-11-29; + } + import org-openroadm-resource-types { + prefix org-openroadm-resource-types; + revision-date 2019-11-29; + } + import org-openroadm-pm-types { + prefix org-openroadm-pm-types; + revision-date 2019-11-29; + } + + organization + "Open ROADM MSA"; + contact + "OpenROADM.org"; + description + "YANG definitions of performance management. + + Copyright of the Members of the Open ROADM MSA Agreement dated (c) 2016, + All other rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. + * Neither the Members of the Open ROADM MSA Agreement nor the names of its + contributors may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE MEMBERS OF THE OPEN ROADM MSA AGREEMENT ''AS IS'' + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT THE MEMBERS OF THE OPEN ROADM MSA AGREEMENT BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE"; + + revision 2019-11-29 { + description + "Version 6.1.0"; + } + revision 2019-09-27 { + description + "Version 6.0.0"; + } + revision 2019-05-31 { + description + "Version 5.1.0"; + } + revision 2019-03-29 { + description + "Version 5.0.0"; + } + revision 2018-11-30 { + description + "Version 4.1.0"; + } + revision 2018-09-28 { + description + "Version 4.0.0"; + } + revision 2018-05-30 { + description + "Version 3.1.0"; + } + revision 2018-03-30 { + description + "Version 3.0.0"; + } + revision 2017-12-15 { + description + "Version 2.2"; + } + revision 2017-09-29 { + description + "Version 2.1"; + } + revision 2017-07-28 { + description + "Version 2.0.1 - added revision-date to imports"; + } + revision 2017-06-26 { + description + "Version 2.0"; + } + revision 2016-10-14 { + description + "Version 1.2"; + } + + feature historical-pm-retrieval { + description + "The device supports the ability to directly retrieve the historical + PM data from the YANG model."; + } + + grouping current-pm-group { + description + "PM Data with current values - both realtime (granularity=notApplicable) + and binned (granularity=15 minute, 24h))"; + leaf pm-resource-instance { + type instance-identifier; + config false; + mandatory true; + description + "Retrieves all PM associate with the resource instance"; + } + leaf pm-resource-type { + type org-openroadm-resource-types:resource-type-enum; + config false; + mandatory true; + description + "The supported pm-resource-type associated with the given resource instance."; + } + leaf pm-resource-type-extension { + type string; + config false; + description + "The resource type extension when the type is not defined in the resource-type-enum."; + } + leaf start-time { + type yang:date-and-time; + config false; + mandatory true; + description + "Represents the start time of the bin (15m, 24h granularity) or the start of data collection (notApplicable/untimed granularity)."; + } + leaf retrieval-time { + type yang:date-and-time; + config false; + mandatory true; + description + "Represents the time when the data is being read, not the bin start or end time."; + } + list current-pm { + key "type extension location direction"; + config false; + uses current-pm-val-group; + } + } + + grouping current-pm-val-group { + uses org-openroadm-pm-types:pm-names; + leaf location { + type org-openroadm-common-alarm-pm-types:location; + } + leaf direction { + type org-openroadm-common-alarm-pm-types:direction; + } + list measurement { + key "granularity"; + leaf granularity { + type org-openroadm-pm-types:pm-granularity; + } + uses org-openroadm-pm-types:pm-measurement; + } + } + + grouping historical-pm-group { + description + "PM Data with historical values - binned (granularity=15 minute, 24h))"; + leaf pm-resource-instance { + type instance-identifier; + config false; + mandatory true; + description + "Retrieves all PM associate with the resource instance"; + } + leaf pm-resource-type { + type org-openroadm-resource-types:resource-type-enum; + config false; + mandatory true; + } + leaf pm-resource-type-extension { + type string; + config false; + description + "The resource type extension when the type is not defined in the resource-type-enum."; + } + list historical-pm { + key "type extension location direction"; + uses historical-pm-val-group; + } + } + + grouping historical-pm-val-group { + description + "PM Data with historical values"; + uses org-openroadm-pm-types:pm-names; + leaf location { + type org-openroadm-common-alarm-pm-types:location; + } + leaf direction { + type org-openroadm-common-alarm-pm-types:direction; + } + list measurement { + key "granularity bin-number"; + leaf granularity { + type org-openroadm-pm-types:pm-granularity; + mandatory true; + } + leaf bin-number { + type uint16 { + range "1..max"; + } + config false; + mandatory true; + } + uses org-openroadm-pm-types:pm-measurement; + leaf completion-time { + type yang:date-and-time; + config false; + mandatory true; + description + "The time at the end of the period; For example if bin starts at + 01:15:00 and ends at 01:29:59, the completion-time is 01:29:59"; + } + } + } + + grouping collect-history-pm-group { + leaf pm-filename { + type string { + length "10..255"; + } + mandatory true; + description + "The file name to write the historical PM data. + The controller should be able to use this name to retrieve the file via ftp/sftp. + The file name should be unique for each RPC request since a new RPC request + could be initiated while the file transfer of the previous file is still in progress. + + The file content should be written in xml format based on the historical-pm-list + yang definition and the file should be gzip compressed."; + } + uses org-openroadm-common-types:rpc-response-status; + } + + rpc clear-pm { + description + "Command to initialize PM data"; + input { + uses org-openroadm-resource:resource; + leaf pm-type { + type enumeration { + enum current { + value 1; + } + enum all { + value 2; + } + } + default "current"; + } + leaf granularity { + type org-openroadm-pm-types:pm-granularity; + default "15min"; + } + } + output { + uses org-openroadm-common-types:rpc-response-status; + } + } + rpc collect-historical-pm-file { + description + "Command to query historical PM data. + The device should be able to process an rpc request for 15min data + and a separate request for 24hour data in parallel."; + input { + leaf from-bin-number { + type uint16 { + range "1..max"; + } + default "1"; + description + "The start bin-number of the range"; + } + leaf to-bin-number { + type uint16 { + range "1..max"; + } + default "1"; + description + "The end bin-number of the range"; + } + leaf granularity { + type org-openroadm-pm-types:pm-granularity; + default "15min"; + description + "The granularity of the retrieve, default to 15 minutes PM"; + } + } + output { + uses collect-history-pm-group; + } + } + notification historical-pm-collect-result { + description + "This Notification is sent when the pm collection is successful or failed."; + uses collect-history-pm-group; + } + container current-pm-list { + config false; + description + "List of current PMs."; + list current-pm-entry { + key "pm-resource-type pm-resource-type-extension pm-resource-instance"; + description + "List of current PM entries"; + uses current-pm-group; + } + } + container historical-pm-list { + if-feature "historical-pm-retrieval"; + config false; + description + "List of historical PM"; + list historical-pm-entry { + key "pm-resource-type pm-resource-type-extension pm-resource-instance"; + description + "List of historical PM entries"; + uses historical-pm-group; + } + } +} diff --git a/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/yang/org-openroadm-port-types.yang b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/yang/org-openroadm-port-types.yang new file mode 100644 index 000000000..2fed53821 --- /dev/null +++ b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/yang/org-openroadm-port-types.yang @@ -0,0 +1,420 @@ +module org-openroadm-port-types { + namespace "http://org/openroadm/port/types"; + prefix org-openroadm-port-types; + + import org-openroadm-common-link-types { + prefix org-openroadm-common-link-types; + revision-date 2019-11-29; + } + + organization + "Open ROADM MSA"; + contact + "OpenROADM.org"; + description + "YANG definitions for port types. + + Copyright of the Members of the Open ROADM MSA Agreement dated (c) 2016, + All other rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. + * Neither the Members of the Open ROADM MSA Agreement nor the names of its + contributors may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE MEMBERS OF THE OPEN ROADM MSA AGREEMENT ''AS IS'' + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT THE MEMBERS OF THE OPEN ROADM MSA AGREEMENT BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE."; + + revision 2019-11-29 { + description + "Version 6.1.0"; + } + revision 2019-05-31 { + description + "Version 5.1.0"; + } + revision 2019-03-29 { + description + "Version 5.0.0"; + } + revision 2018-11-30 { + description + "Version 4.1.0"; + } + revision 2018-09-28 { + description + "Version 4.0.0"; + } + revision 2018-03-30 { + description + "Version 3.0.0"; + } + revision 2017-12-15 { + description + "Version 2.2"; + } + revision 2017-09-29 { + description + "Version 2.1"; + } + revision 2017-07-28 { + description + "Version 2.0.1 - added revision-date to imports"; + } + revision 2017-06-26 { + description + "Version 2.0"; + } + revision 2016-10-14 { + description + "Version 1.2"; + } + + identity supported-if-capability { + description + "Base identity from which specific supported interfaces are derived"; + } + + identity if-100GE { + base supported-if-capability; + } + + identity if-OMS { + base supported-if-capability; + } + + identity if-OTS { + base supported-if-capability; + } + + identity if-OTS-OMS-MC-NMC { + base supported-if-capability; + } + + identity if-NMC { + base supported-if-capability; + } + + identity if-OCH { + base supported-if-capability; + } + + identity if-1GE { + base supported-if-capability; + } + + identity if-10GE { + base supported-if-capability; + } + + identity if-40GE { + base supported-if-capability; + } + + identity if-OCH-OTU1-ODU1 { + base supported-if-capability; + } + + identity if-OCH-OTU2-ODU2 { + base supported-if-capability; + } + + identity if-OCH-OTU2E-ODU2E { + base supported-if-capability; + } + + identity if-OCH-OTU3-ODU3 { + base supported-if-capability; + } + + identity if-OCH-OTU4-ODU4 { + base supported-if-capability; + } + + identity if-OTUCn-ODUCn { + base supported-if-capability; + } + + identity if-otsi-flexo-flexogroup { + base supported-if-capability; + } + + identity if-otsi-otsigroup { + base supported-if-capability; + } + + identity if-n-OTU4-ODU4 { + base supported-if-capability; + } + + identity if-otsi-otucn-oducn { + base supported-if-capability; + status deprecated; + } + + identity if-OTU4-ODU4 { + base supported-if-capability; + } + + identity if-OTU1-ODU1 { + base supported-if-capability; + } + + identity if-OTU2-ODU2 { + base supported-if-capability; + } + + identity if-OTU2e-ODU2e { + base supported-if-capability; + } + + identity if-OTU3-ODU3 { + base supported-if-capability; + } + + identity if-1GE-ODU0 { + base supported-if-capability; + } + + identity if-10GE-ODU2 { + base supported-if-capability; + } + + identity if-10GE-ODU2e { + base supported-if-capability; + } + + identity if-10GE-oduflexgfp { + base supported-if-capability; + } + + identity if-25GE-oduflexcbr { + base supported-if-capability; + } + + identity if-40GE-ODU3 { + base supported-if-capability; + } + + identity if-40GE-oduflexgfp { + base supported-if-capability; + } + + identity if-100GE-ODU4 { + base supported-if-capability; + } + + identity if-100GE-oduflexgfp { + base supported-if-capability; + } + + identity if-200GE-oduflexcbr { + base supported-if-capability; + } + + identity if-400GE-odufleximp { + base supported-if-capability; + } + + identity if-400GE-oduflexcbr { + base supported-if-capability; + } + + identity supported-xpdr-capability { + description + "Base identity from which specific supported xponder are derived"; + } + + identity Transponder { + base supported-xpdr-capability; + } + + identity Regen { + base supported-xpdr-capability; + } + + identity pluggable-identifiers-identity { + description + "Pluggable identifiers type"; + } + + identity SFP { + base pluggable-identifiers-identity; + } + + identity SFP-plus { + base pluggable-identifiers-identity; + } + + identity SFP28 { + base pluggable-identifiers-identity; + } + + identity SFP-DD { + base pluggable-identifiers-identity; + } + + identity DWDM-SFP { + base pluggable-identifiers-identity; + } + + identity DWDM-SFP-plus { + base pluggable-identifiers-identity; + } + + identity QSFP { + base pluggable-identifiers-identity; + } + + identity QSFP-plus { + base pluggable-identifiers-identity; + } + + identity QSFP28 { + base pluggable-identifiers-identity; + } + + identity QSFP28-DD { + base pluggable-identifiers-identity; + } + + identity QSFP-DD { + base pluggable-identifiers-identity; + } + + identity micro-QSFP { + base pluggable-identifiers-identity; + } + + identity OSFP { + base pluggable-identifiers-identity; + } + + identity CFP { + base pluggable-identifiers-identity; + } + + identity CFP2 { + base pluggable-identifiers-identity; + } + + identity CFP4 { + base pluggable-identifiers-identity; + } + + identity CFP8 { + base pluggable-identifiers-identity; + } + + identity CFP2-ACO { + base pluggable-identifiers-identity; + } + + identity CFP2-DCO { + base pluggable-identifiers-identity; + } + + identity XFP { + base pluggable-identifiers-identity; + } + + identity SFP56 { + base pluggable-identifiers-identity; + } + + identity QSFP56 { + base pluggable-identifiers-identity; + } + + identity QSFP56-DD { + base pluggable-identifiers-identity; + } + + identity SFP-other { + base pluggable-identifiers-identity; + } + + identity SFP-unspecified { + base pluggable-identifiers-identity; + } + + typedef port-wavelength-types { + type enumeration { + enum wavelength { + value 1; + description + "Port on a transponder or ROADM SRG add drop"; + } + enum multi-wavelength { + value 2; + description + "External port connecting to other roadm."; + } + } + description + "Port types."; + } + + typedef port-module-types { + type enumeration { + enum 100GBASE-LR4 { + value 1; + } + enum CWDM-4 { + value 2; + } + } + description + "Pluggable modue types."; + } + + grouping common-port { + leaf port-power-capability-min-rx { + type org-openroadm-common-link-types:power-dBm; + config false; + description + "Based on port capabilities, the minimum power in the system spec for this port to + provide optimum function in rx direction"; + } + leaf port-power-capability-min-tx { + type org-openroadm-common-link-types:power-dBm; + config false; + description + "Based on port capabilities, the minimum power in the system spec for this port to + provide optimum function in tx direction."; + } + leaf port-power-capability-max-rx { + type org-openroadm-common-link-types:power-dBm; + config false; + description + "Based on port capabilities, the maximum power in the system spec for this port to + provide optimum function in rx direction."; + } + leaf port-power-capability-max-tx { + type org-openroadm-common-link-types:power-dBm; + config false; + description + "Based on port capabilities, the maximum power in the system spec for this port to + provide optimum function in tx direction."; + } + } + + grouping roadm-port { + uses common-port; + } +} diff --git a/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/yang/org-openroadm-probable-cause.yang b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/yang/org-openroadm-probable-cause.yang new file mode 100644 index 000000000..4b752c8e5 --- /dev/null +++ b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/yang/org-openroadm-probable-cause.yang @@ -0,0 +1,843 @@ +module org-openroadm-probable-cause { + namespace "http://org/openroadm/probableCause"; + prefix org-openroadm-probable-cause; + + import org-openroadm-common-alarm-pm-types { + prefix org-openroadm-common-alarm-pm-types; + revision-date 2019-11-29; + } + + organization + "Open ROADM MSA"; + contact + "OpenROADM.org"; + description + "YANG definitions of Probable Causes. + + Copyright of the Members of the Open ROADM MSA Agreement dated (c) 2016, + All other rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. + * Neither the Members of the Open ROADM MSA Agreement nor the names of its + contributors may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE MEMBERS OF THE OPEN ROADM MSA AGREEMENT ''AS IS'' + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT THE MEMBERS OF THE OPEN ROADM MSA AGREEMENT BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE"; + + revision 2019-11-29 { + description + "Version 6.1.0"; + } + revision 2019-09-27 { + description + "Version 6.0.0"; + } + revision 2019-05-31 { + description + "Version 5.1.0"; + } + revision 2018-11-30 { + description + "Version 4.1.0"; + } + revision 2018-09-28 { + description + "Version 4.0.0"; + } + revision 2018-03-30 { + description + "Version 3.0.0"; + } + revision 2017-12-15 { + description + "Version 2.2"; + } + revision 2017-09-29 { + description + "Version 2.1"; + } + revision 2017-07-28 { + description + "Version 2.0.1 - added revision-date to imports"; + } + revision 2017-06-26 { + description + "Version 2.0"; + } + revision 2016-10-14 { + description + "Version 1.2"; + } + + typedef probable-cause-enum { + type enumeration { + enum vendorExtension { + value 1; + description + "vendorExtension"; + } + enum openConnectionIndication { + value 2; + description + "Open connection indication (OCI)"; + reference "G.798"; + } + enum alarmIndicationSignal { + value 3; + description + "Alarm indication signal"; + reference "G.798"; + } + enum lossOfSignal { + value 4; + description + "Loss of Signal"; + } + enum opticalLineFail { + value 5; + description + "Optical Line Fail"; + } + enum opticalPowerDegraded { + value 6; + description + "Optical Power Degraded"; + } + enum automaticLaserShutdown { + value 7; + description + "Automatic Laser Shutdown"; + } + enum serverSignalFail { + value 8; + description + "Server Signal Fail (SSF)"; + reference "G.798"; + } + enum lockedDefect { + value 10; + description + "Locked defect (LCK)"; + reference "G.798"; + } + enum trailTraceIdentifierMismatch { + value 11; + description + "Trail trace Identifier Mismatch (TIM)"; + reference "G.798"; + } + enum degradedDefect { + value 12; + description + "Degraded defect (DEG)"; + reference "G.798"; + } + enum backwardsDefectIndication { + value 13; + description + "Backward Defect Indication (BDI)"; + reference "G.798"; + } + enum otsSpanlossPowerOutOfSpecificationHigh { + value 14; + } + enum automaticShutoffDisabled { + value 15; + } + enum portLossOfLight { + value 17; + } + enum reflectionTooHigh { + value 18; + } + enum payloadMissingIndication { + value 22; + description + "Will be applicable to ROADM when OSC signaling supported in future (G.709 2016-06 Figure 15-1A, 1B)"; + } + enum forwardDefectIndication { + value 23; + description + "Will be applicable to ROADM when OSC signaling supported in future (G.709 2016-06 Figure 15-1A, 1B)"; + } + enum oscPowerOutOfSpecificationHigh { + value 24; + } + enum oscPowerOutOfSpecificationLow { + value 25; + } + enum powerOutOfSpecificationHigh { + value 26; + } + enum lossOfSynchronization { + value 27; + } + enum linkDown { + value 28; + } + enum equipmentFault { + value 29; + } + enum equipmentRemoved { + value 30; + } + enum equipmentMismatch { + value 31; + } + enum equipmentWarmup { + value 32; + } + enum equipmentLedOn { + value 33; + } + enum equipmentInterConnectFailure { + value 34; + } + enum equipmentMiscabledConnection { + value 35; + } + enum softwareVersionMismatch { + value 36; + } + enum softwareStageInProgress { + value 37; + } + enum databaseCorruption { + value 38; + } + enum databaseVersionMismatch { + value 44; + } + enum firmwareVersionMismatch { + value 46; + } + enum incompatibleFirmware { + value 49; + } + enum firmwareDownloadOrActivationFailure { + value 50; + } + enum firmwareInitInProgress { + value 51; + } + enum softwareReset { + value 52; + } + enum fanCoolingFail { + value 53; + } + enum administrativeDown { + value 54; + } + enum lampTest { + value 55; + } + enum powerProblemA { + value 56; + } + enum powerProblemB { + value 57; + } + enum shelfProvisioningMode { + value 58; + } + enum sysNameChanged { + value 59; + } + enum sysNtpNotSynchronized { + value 60; + } + enum lossOfFrame { + value 63; + } + enum lossOfMultiframe { + value 64; + } + enum backwardIncomingAlignmentError { + value 65; + } + enum incomingAlignmentError { + value 66; + } + enum payloadMismatch { + value 67; + } + enum clientSignalFailDefect { + value 68; + } + enum highBER { + value 123; + } + enum localFault { + value 124; + } + enum remoteFault { + value 125; + } + enum lossOfAlignment { + value 126; + } + enum lossOfFECAlignment { + value 127; + } + enum facilityLoopbackActive { + value 128; + } + enum facilityLoopback2Active { + value 129; + } + enum terminalLoopbackActive { + value 130; + } + enum facilityTestsignalActive { + value 131; + } + enum terminalTestsignalActive { + value 132; + } + enum certificateNotInstalled { + value 134; + } + enum lockoutOfProtection { + value 135; + } + enum forcedSwitchAwayFromWorking { + value 136; + } + enum forcedSwitchAwayFromProtect { + value 137; + } + enum automaticSwitchAwayFromWorkingDueToSF { + value 138; + } + enum automaticSwitchAwayFromProtectDueToSF { + value 139; + } + enum automaticSwitchDueToWTR { + value 140; + } + enum manualSwitchAwayFromWork { + value 141; + } + enum manualSwitchAwayFromProtect { + value 142; + } + enum automaticPowerReduction { + value 143; + } + enum lossOfSignalOSC { + value 144; + } + enum softwareValidateInProgress { + value 145; + } + enum databaseRollbackTimerInProgress { + value 146; + } + enum otdrScanInProgress { + value 147; + } + enum lldpFail { + value 148; + } + enum omsPowerOutOfSpecificationHigh { + value 149; + } + enum omsPowerOutOfSpecificationLow { + value 150; + } + enum automaticSwitchAwayFromWorkingDueToSD { + value 151; + } + enum automaticSwitchAwayFromProtectDueToSD { + value 152; + } + enum backwardIncomingAlignmentErrorTCM1-up { + value 153; + } + enum backwardIncomingAlignmentErrorTCM2-up { + value 154; + } + enum backwardIncomingAlignmentErrorTCM3-up { + value 155; + } + enum backwardIncomingAlignmentErrorTCM4-up { + value 156; + } + enum backwardIncomingAlignmentErrorTCM5-up { + value 157; + } + enum backwardIncomingAlignmentErrorTCM6-up { + value 158; + } + enum incomingAlignmentErrorTCM1-up { + value 159; + } + enum incomingAlignmentErrorTCM2-up { + value 160; + } + enum incomingAlignmentErrorTCM3-up { + value 161; + } + enum incomingAlignmentErrorTCM4-up { + value 162; + } + enum incomingAlignmentErrorTCM5-up { + value 163; + } + enum incomingAlignmentErrorTCM6-up { + value 164; + } + enum backwardsDefectIndicationTCM1-up { + value 165; + } + enum backwardsDefectIndicationTCM2-up { + value 166; + } + enum backwardsDefectIndicationTCM3-up { + value 167; + } + enum backwardsDefectIndicationTCM4-up { + value 168; + } + enum backwardsDefectIndicationTCM5-up { + value 169; + } + enum backwardsDefectIndicationTCM6-up { + value 170; + } + enum degradedDefectTCM1-up { + value 171; + } + enum degradedDefectTCM2-up { + value 172; + } + enum degradedDefectTCM3-up { + value 173; + } + enum degradedDefectTCM4-up { + value 174; + } + enum degradedDefectTCM5-up { + value 175; + } + enum degradedDefectTCM6-up { + value 176; + } + enum trailTraceIdentifierMisMatchTCM1-up { + value 177; + } + enum trailTraceIdentifierMisMatchTCM2-up { + value 178; + } + enum trailTraceIdentifierMisMatchTCM3-up { + value 179; + } + enum trailTraceIdentifierMisMatchTCM4-up { + value 180; + } + enum trailTraceIdentifierMisMatchTCM5-up { + value 181; + } + enum trailTraceIdentifierMisMatchTCM6-up { + value 182; + } + enum alarmIndicationSignalTCM1-up { + value 183; + } + enum alarmIndicationSignalTCM2-up { + value 184; + } + enum alarmIndicationSignalTCM3-up { + value 185; + } + enum alarmIndicationSignalTCM4-up { + value 186; + } + enum alarmIndicationSignalTCM5-up { + value 187; + } + enum alarmIndicationSignalTCM6-up { + value 188; + } + enum openConnectionIndicationTCM1-up { + value 189; + } + enum openConnectionIndicationTCM2-up { + value 190; + } + enum openConnectionIndicationTCM3-up { + value 191; + } + enum openConnectionIndicationTCM4-up { + value 192; + } + enum openConnectionIndicationTCM5-up { + value 193; + } + enum openConnectionIndicationTCM6-up { + value 194; + } + enum lockedDefectTCM1-up { + value 195; + } + enum lockedDefectTCM2-up { + value 196; + } + enum lockedDefectTCM3-up { + value 197; + } + enum lockedDefectTCM4-up { + value 198; + } + enum lockedDefectTCM5-up { + value 199; + } + enum lockedDefectTCM6-up { + value 200; + } + enum lossofTandemConnectionTCM1-up { + value 201; + } + enum lossofTandemConnectionTCM2-up { + value 202; + } + enum lossofTandemConnectionTCM3-up { + value 203; + } + enum lossofTandemConnectionTCM4-up { + value 204; + } + enum lossofTandemConnectionTCM5-up { + value 205; + } + enum lossofTandemConnectionTCM6-up { + value 206; + } + enum backwardIncomingAlignmentErrorTCM1-down { + value 207; + } + enum backwardIncomingAlignmentErrorTCM2-down { + value 208; + } + enum backwardIncomingAlignmentErrorTCM3-down { + value 209; + } + enum backwardIncomingAlignmentErrorTCM4-down { + value 210; + } + enum backwardIncomingAlignmentErrorTCM5-down { + value 211; + } + enum backwardIncomingAlignmentErrorTCM6-down { + value 212; + } + enum incomingAlignmentErrorTCM1-down { + value 213; + } + enum incomingAlignmentErrorTCM2-down { + value 214; + } + enum incomingAlignmentErrorTCM3-down { + value 215; + } + enum incomingAlignmentErrorTCM4-down { + value 216; + } + enum incomingAlignmentErrorTCM5-down { + value 217; + } + enum incomingAlignmentErrorTCM6-down { + value 218; + } + enum backwardsDefectIndicationTCM1-down { + value 219; + } + enum backwardsDefectIndicationTCM2-down { + value 220; + } + enum backwardsDefectIndicationTCM3-down { + value 221; + } + enum backwardsDefectIndicationTCM4-down { + value 222; + } + enum backwardsDefectIndicationTCM5-down { + value 223; + } + enum backwardsDefectIndicationTCM6-down { + value 224; + } + enum degradedDefectTCM1-down { + value 225; + } + enum degradedDefectTCM2-down { + value 226; + } + enum degradedDefectTCM3-down { + value 227; + } + enum degradedDefectTCM4-down { + value 228; + } + enum degradedDefectTCM5-down { + value 229; + } + enum degradedDefectTCM6-down { + value 230; + } + enum trailTraceIdentifierMisMatchTCM1-down { + value 231; + } + enum trailTraceIdentifierMisMatchTCM2-down { + value 232; + } + enum trailTraceIdentifierMisMatchTCM3-down { + value 233; + } + enum trailTraceIdentifierMisMatchTCM4-down { + value 234; + } + enum trailTraceIdentifierMisMatchTCM5-down { + value 235; + } + enum trailTraceIdentifierMisMatchTCM6-down { + value 236; + } + enum alarmIndicationSignalTCM1-down { + value 237; + } + enum alarmIndicationSignalTCM2-down { + value 238; + } + enum alarmIndicationSignalTCM3-down { + value 239; + } + enum alarmIndicationSignalTCM4-down { + value 240; + } + enum alarmIndicationSignalTCM5-down { + value 241; + } + enum alarmIndicationSignalTCM6-down { + value 242; + } + enum openConnectionIndicationTCM1-down { + value 243; + } + enum openConnectionIndicationTCM2-down { + value 244; + } + enum openConnectionIndicationTCM3-down { + value 245; + } + enum openConnectionIndicationTCM4-down { + value 246; + } + enum openConnectionIndicationTCM5-down { + value 247; + } + enum openConnectionIndicationTCM6-down { + value 248; + } + enum lockedDefectTCM1-down { + value 249; + } + enum lockedDefectTCM2-down { + value 250; + } + enum lockedDefectTCM3-down { + value 251; + } + enum lockedDefectTCM4-down { + value 252; + } + enum lockedDefectTCM5-down { + value 253; + } + enum lockedDefectTCM6-down { + value 254; + } + enum lossofTandemConnectionTCM1-down { + value 255; + } + enum lossofTandemConnectionTCM2-down { + value 256; + } + enum lossofTandemConnectionTCM3-down { + value 257; + } + enum lossofTandemConnectionTCM4-down { + value 258; + } + enum lossofTandemConnectionTCM5-down { + value 259; + } + enum lossofTandemConnectionTCM6-down { + value 260; + } + enum multiplexStructureIdentifierMismatch { + value 261; + description + "G798 : 6.2.9 (dMSIM)"; + } + enum lossOfOmfIndication { + value 262; + description + "G798 : 14.3.10.2 Figure 14-73 (dLOOMFI)"; + } + enum lossOfFrameAndLossOfMultiframe { + value 263; + description + "G798 : 6.2.5.3 (dLOFLOM)"; + } + enum lossOfDatabaseRedundancy { + value 264; + description + "loss of database redundancy"; + } + enum databaseLocked { + value 265; + description + "Database locked"; + } + enum createTechInfoInProgress { + value 266; + description + "create-tech-info in progress"; + } + enum circuitPackActivateFailed { + value 267; + description + "circuit-pack activation failed"; + } + enum softwareSubsystemFailed { + value 268; + description + "Software subsystem failed"; + } + enum diskFull { + value 269; + description + "Disk full"; + } + enum lossOfSignalPayload { + value 270; + description + "Loss Of Signal Payload"; + reference "G.798 6.2.1.2 dLOS-P, 16.8.2 OTSi/FlexO_A_Sk"; + } + enum lossOfLaneAlignment { + value 271; + description + "Loss Of Lane Alignment"; + reference + "G.798 15.3.1.2 FlexO-n/OTUCn_A_Sk that dLOL if the alignment process is in OLA state; + 16.8.2 OTSi/FlexO_A_Sk that dLOL based on the FEC alignment state diagram"; + } + enum groupIdMismatch { + value 272; + description + "Group Id Mismatch"; + reference "G.798 dGIDM in Annex B.1.1.2.1; G.798 15.3.1.2 FlexO-n/OTUCn_A_Sk"; + } + enum phyMapMismatch { + value 273; + description + "PHY Map Mismatch"; + reference "G.798 dPMM in Annex B.1.1.2.2; G.798 15.3.1.2 FlexO-n/OTUCn_A_Sk"; + } + enum powerOutOfSpecificationLow { + value 274; + } + enum gfpLossOfFrameDelineation { + value 275; + description + "GFP loss of frame delineation (dLFD G.806:6.2.5.2) is raised when the frame delineation process (clause 6.3.1 of [ITU-T G.7041]) is not in the 'SYNC' state"; + } + enum cmfLossOfSignal { + value 276; + description + "GFP client signal fail (dCSF G.806:6.2.6.4.1) is raised when a GFP frame with correct tHEC, with aPTI = '100' and a valid UPI code 0x01(G.7041: Table 6-4) is received"; + } + enum cmfLossOfSync { + value 277; + description + "GFP client signal fail (dCSF G.806:6.2.6.4.1) is raised when a GFP frame with correct tHEC, with aPTI = '100' and a valid UPI code 0x02(G.7041: Table 6-4) is received"; + } + enum cmfForwardDefectIndication { + value 278; + description + "GFP client signal fail (dCSF G.806:6.2.6.4.1) is raised when a GFP frame with correct tHEC, with aPTI = '100' and a valid UPI code 0x04(G.7041: Table 6-4) is received"; + } + enum cmfReverseDefectIndication { + value 279; + description + "GFP client signal fail (dCSF G.806:6.2.6.4.1) is raised when a GFP frame with correct tHEC, with aPTI = '100' and a valid UPI code 0x05(G.7041: Table 6-4) is received"; + } + } + description + "probable cause group"; + } + + grouping probable-cause { + leaf cause { + type probable-cause-enum; + mandatory true; + } + leaf extension { + type string; + mandatory false; + } + leaf direction { + type org-openroadm-common-alarm-pm-types:direction; + mandatory true; + description + "Direction indication of the alarm."; + } + leaf location { + type org-openroadm-common-alarm-pm-types:location; + mandatory true; + description + "location indication of the alarm."; + } + leaf type { + type enumeration { + enum communication { + value 1; + } + enum qualityOfService { + value 2; + } + enum processingError { + value 3; + } + enum equipment { + value 4; + } + enum environmental { + value 5; + } + } + mandatory false; + description + "Type of alarm. Based on X.733 event Type."; + } + } +} diff --git a/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/yang/org-openroadm-resource-types.yang b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/yang/org-openroadm-resource-types.yang new file mode 100644 index 000000000..1a5bd66dd --- /dev/null +++ b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/yang/org-openroadm-resource-types.yang @@ -0,0 +1,374 @@ +module org-openroadm-resource-types { + namespace "http://org/openroadm/resource/types"; + prefix org-openroadm-resource-types; + + import org-openroadm-common-node-types { + prefix org-openroadm-common-node-types; + revision-date 2019-11-29; + } + + organization + "Open ROADM MSA"; + contact + "OpenROADM.org"; + description + "YANG definitions of common resource types. + + Copyright of the Members of the Open ROADM MSA Agreement dated (c) 2016, + All other rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. + * Neither the Members of the Open ROADM MSA Agreement nor the names of its + contributors may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE MEMBERS OF THE OPEN ROADM MSA AGREEMENT ''AS IS'' + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT THE MEMBERS OF THE OPEN ROADM MSA AGREEMENT BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE"; + + revision 2019-11-29 { + description + "Version 6.1.0"; + } + revision 2018-11-30 { + description + "Version 4.1.0"; + } + revision 2018-09-28 { + description + "Version 4.0.0"; + } + revision 2018-03-30 { + description + "Version 3.0.0"; + } + revision 2017-12-15 { + description + "Version 2.2"; + } + revision 2017-09-29 { + description + "Version 2.1"; + } + revision 2017-06-26 { + description + "Version 2.0"; + } + revision 2016-10-14 { + description + "Version 1.2"; + } + + typedef resource-type-enum { + type enumeration { + enum other { + value 1; + description + "Resource of type not found in list."; + } + enum device { + value 2; + description + "device - ROAMD, Xponder, etc"; + } + enum degree { + value 3; + description + "degree"; + } + enum shared-risk-group { + value 4; + description + "shared-risk-group"; + } + enum connection { + value 5; + description + "connection - this is used by roadm-connection and odu-connection + since they are mutually exclusive in the model"; + } + enum connection-map { + value 6; + description + "connection-map"; + } + enum port { + value 7; + description + "port"; + } + enum circuit-pack { + value 8; + description + "circuit pack"; + } + enum internal-link { + value 9; + description + "internal-link"; + } + enum physical-link { + value 10; + description + "physical-link"; + } + enum interface { + value 11; + description + "interface"; + } + enum shelf { + value 12; + description + "shelf"; + } + enum service { + value 13; + description + "service"; + } + enum odu-sncp-pg { + value 14; + description + "odu-sncp-pg"; + } + enum line-amplifier { + value 15; + description + "line-amplifier"; + } + enum xponder { + value 16; + description + "xponder"; + } + enum versioned-service { + value 17; + description + "versioned-service"; + } + enum temp-service { + value 18; + description + "temp-service"; + } + } + } + + typedef resource-notification-type { + type enumeration { + enum resourceCreation { + value 1; + description + "A new instance of a resource has been created."; + } + enum resourceModification { + value 2; + description + "An existing instance of a resource has been modified. This shall be triggered by changes in configuration, state, status etc. + It shall not be triggered by changes in performance measurements, power and temperature readings or any other data that is highly volatile. "; + } + enum resourceDeletion { + value 3; + description + "An existing instance of a resource has been removed."; + } + } + description + "Type of notification about a resource"; + } + + grouping resource-type { + leaf type { + type resource-type-enum; + mandatory true; + } + leaf extension { + type string; + mandatory false; + } + } + + grouping device-id { + description + "Device identifier. Unique within the Controller."; + leaf node-id { + type org-openroadm-common-node-types:node-id-type; + description + "Node Id is a globally unique identifier for a device. + Same as leafref value in model, if applicable."; + } + } + + grouping circuit-pack-name { + leaf circuit-pack-name { + type string; + mandatory true; + description + "Circuit-Pack identifier. Unique within the context of a device. + Same as leafref value in model, if applicable."; + } + } + + grouping port-name { + uses circuit-pack-name; + leaf port-name { + type string; + description + "Port identifier. Unique within the context of a circuit-pack. + Same as leafref value in model, if applicable."; + } + } + + grouping physical-link-name { + leaf physical-link-name { + type string; + mandatory true; + description + "Physical Link identifier. Unique within the context of a device. + Same as leafref value in model, if applicable."; + } + } + + grouping internal-link-name { + leaf internal-link-name { + type string; + mandatory true; + description + "Internal Link identifier. Unique within the context of a device. + Same as leafref value in model, if applicable."; + } + } + + grouping connection-name { + leaf connection-name { + type string; + description + "Connection name. Unique within the context of a device. + Same as leafref value in model, if applicable."; + } + } + + grouping degree-number { + leaf degree-number { + type uint16; + description + "Degree identifier. Unique within the context of a device. + Same as leafref value in model, if applicable."; + } + } + + grouping srg-number { + leaf srg-number { + type uint16; + description + "Shared Risk Group identifier. Unique within the context of a device. + Same as leafref value in model, if applicable."; + } + } + + grouping shelf-name { + leaf shelf-name { + type string; + mandatory true; + description + "Shelf-id identifier. Unique within the context of a device. + Same as leafref value in model, if applicable."; + } + } + + grouping service-name { + leaf service-name { + type string; + mandatory true; + description + "Service identifier. Unique within the context of a network. + Same as leafref value in model, if applicable."; + } + } + + grouping versioned-service-name { + leaf versioned-service-name { + type string; + mandatory true; + description + "Service identifier. Unique within the context of a network. + Same as leafref value in model, if applicable."; + } + leaf version-number { + type uint64; + mandatory true; + description + "version-number of the service"; + } + } + + grouping temp-service-name { + leaf common-id { + type string; + mandatory true; + description + "Service identifier. Unique within the context of a network. + Same as leafref value in model, if applicable."; + } + } + + grouping interface-name { + leaf interface-name { + type string; + mandatory true; + description + "Interface identifier."; + } + } + + grouping other-resource-id { + leaf other-resource-id { + type string; + mandatory true; + description + "resource-id for other."; + } + } + + grouping odu-sncp-pg-name { + leaf odu-sncp-pg-name { + type string; + mandatory true; + description + "name of the odu-snc-pg"; + } + } + + grouping amp-number { + leaf amp-number { + type uint8; + mandatory true; + description + "number of the line-amplifier"; + } + } + + grouping xpdr-number { + leaf xpdr-number { + type uint16; + mandatory true; + description + "number of the xponder"; + } + } +} diff --git a/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/yang/org-openroadm-resource.yang b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/yang/org-openroadm-resource.yang new file mode 100644 index 000000000..5d102398e --- /dev/null +++ b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/yang/org-openroadm-resource.yang @@ -0,0 +1,358 @@ +module org-openroadm-resource { + namespace "http://org/openroadm/resource"; + prefix org-openroadm-resource; + + import org-openroadm-interfaces { + prefix org-openroadm-interfaces; + revision-date 2019-11-29; + } + import org-openroadm-otn-common-types { + prefix org-openroadm-otn-common-types; + revision-date 2019-11-29; + } + import org-openroadm-common-optical-channel-types { + prefix org-openroadm-common-optical-channel-types; + revision-date 2019-11-29; + } + import org-openroadm-resource-types { + prefix org-openroadm-resource-types; + revision-date 2019-11-29; + } + + organization + "Open ROADM MSA"; + contact + "OpenROADM.org"; + description + "YANG definitions of resources. + + Copyright of the Members of the Open ROADM MSA Agreement dated (c) 2016, + All other rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. + * Neither the Members of the Open ROADM MSA Agreement nor the names of its + contributors may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE MEMBERS OF THE OPEN ROADM MSA AGREEMENT ''AS IS'' + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT THE MEMBERS OF THE OPEN ROADM MSA AGREEMENT BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE"; + + revision 2019-11-29 { + description + "Version 6.1.0"; + } + revision 2019-09-27 { + description + "Version 6.0.0"; + } + revision 2019-05-31 { + description + "Version 5.1.0"; + } + revision 2019-03-29 { + description + "Version 5.0.0"; + } + revision 2018-11-30 { + description + "Version 4.1.0"; + } + revision 2018-09-28 { + description + "Version 4.0.0"; + } + revision 2018-03-30 { + description + "Version 3.0.0"; + } + revision 2017-12-15 { + description + "Version 2.2"; + } + revision 2017-09-29 { + description + "Version 2.1"; + } + revision 2017-07-28 { + description + "Version 2.0.1 - added revision-date to imports"; + } + revision 2017-06-26 { + description + "Version 2.0"; + } + revision 2016-10-14 { + description + "Version 1.2"; + } + + grouping eth-attributes { + leaf speed { + type uint32; + description + "Set speed of the interface, unit mbps. + This is for ETH facility. "; + } + } + + grouping mc-ttp-attributes { + description + "Media channel termination point. Models bandwidth allocation in physical media. Network media channels may be provisioned in the spectrum characterized by the frequency limits."; + leaf min-freq { + type org-openroadm-common-optical-channel-types:frequency-THz; + config true; + description + "Minimum Frequency in THz. Granularity is hardware dependent, based on pixel resolution. eg. ITU 12.5GHz frequency slots. Range covers C+L"; + } + leaf max-freq { + type org-openroadm-common-optical-channel-types:frequency-THz; + config true; + description + "Maximum Frequency in THz. Granularity is hardware dependent, based on pixel resolution. eg. ITU 12.5GHz frequency slots. Range covers C+L"; + } + } + + grouping nmc-ctp-attributes { + description + "Network Media Channel attributes"; + leaf frequency { + type org-openroadm-common-optical-channel-types:frequency-THz; + config true; + description + "Center Frequency in THz. This is not constrained by mc-capabilities. It must fit (when combined with width) inside any containing media channel."; + } + leaf width { + type org-openroadm-common-optical-channel-types:frequency-GHz; + config true; + description + "Frequency width in GHz. This is not constrained by mc-capabilities. It must fit (when combined with frequency) inside any containing media channel."; + } + } + + grouping och-attributes { + description + "Optical Channel attributes"; + leaf rate { + type identityref { + base org-openroadm-common-optical-channel-types:och-rate-identity; + } + description + "rate"; + } + leaf frequency { + type org-openroadm-common-optical-channel-types:frequency-THz; + description + "Center Frequency in THz."; + } + leaf width { + type org-openroadm-common-optical-channel-types:frequency-GHz; + config false; + description + "Frequency width in GHz."; + } + leaf modulation-format { + type org-openroadm-common-optical-channel-types:modulation-format; + description + "Modulation format"; + } + } + + grouping odu-attributes { + description + "ODU attributes"; + leaf rate { + type identityref { + base org-openroadm-otn-common-types:odu-rate-identity; + } + description + "rate identity of the ODU. 'identityref' is used + to allow to extend for future higher rates"; + } + container parent-odu-allocation { + description + "parent odu allocation"; + leaf trib-port-number { + type uint16 { + range "1 .. 80"; + } + description + "Assigned tributary port number in parent OPU"; + } + leaf-list trib-slots { + type uint16 { + range "1 .. 80"; + } + min-elements 1; + max-elements 80; + description + "Assigned trib slots occupied in parent OPU MSI"; + } + } + } + + grouping otu-attributes { + description + "OTU attributes"; + leaf rate { + type identityref { + base org-openroadm-otn-common-types:otu-rate-identity; + } + description + "rate identity of the OTU. 'identityref' is used + to allow to extend for future higher rates"; + } + } + + grouping resource-reporting { + leaf type { + type identityref { + base org-openroadm-interfaces:interface-type; + } + mandatory true; + description + "The type of the interface."; + } + container ethernet { + when "../type = 'ethernetCsmacd'"; + description + "Ethernet Interfaces"; + uses eth-attributes; + } + container mc-ttp { + when "../type = 'mediaChannelTrailTerminationPoint'"; + description + "Media Channel Trail Termination Point (MC-TTP)"; + uses mc-ttp-attributes; + } + container nmc-ctp { + when "../type = 'networkMediaChannelConnectionTerminationPoint'"; + description + "Network Media Channel Connection Termination Point (NMC-CTP)"; + uses nmc-ctp-attributes; + } + container och { + when "../type = 'opticalChannel'"; + description + "Optical Channel (OCh): + Models the optical channel interfaces for an Optical White Box."; + uses och-attributes; + } + container odu { + when "../type = 'otnOdu'"; + presence "Attribute Nodes for Optical Data Unit (ODU)"; + description + "Optical Channel Data Unit (ODU)"; + uses odu-attributes; + } + container otu { + when "../type = 'otnOtu'"; + description + "Optical Channel Transport Unit (OTU)"; + uses otu-attributes; + } + } + + grouping resource { + description + "This resource identifier is intended to provide a generic identifier + for any resource that can be used without specific knowledge of + the resource."; + container device { + description + "Device of the resource, used only when the system using this + model report on more than one device. "; + uses org-openroadm-resource-types:device-id; + } + container resource { + choice resource { + case circuit-pack { + uses org-openroadm-resource-types:circuit-pack-name; + } + case port { + container port { + uses org-openroadm-resource-types:port-name; + } + } + case connection { + uses org-openroadm-resource-types:connection-name { + refine "connection-name" { + mandatory true; + } + } + } + case physical-link { + uses org-openroadm-resource-types:physical-link-name; + } + case internal-link { + uses org-openroadm-resource-types:internal-link-name; + } + case shelf { + uses org-openroadm-resource-types:shelf-name; + } + case srg { + uses org-openroadm-resource-types:srg-number { + refine "srg-number" { + mandatory true; + } + } + } + case degree { + uses org-openroadm-resource-types:degree-number { + refine "degree-number" { + mandatory true; + } + } + } + case service { + uses org-openroadm-resource-types:service-name; + } + case interface { + uses org-openroadm-resource-types:interface-name; + } + case odu-sncp-pg { + uses org-openroadm-resource-types:odu-sncp-pg-name; + } + case other { + uses org-openroadm-resource-types:other-resource-id; + } + case device { + uses org-openroadm-resource-types:device-id { + refine "node-id" { + mandatory true; + } + } + } + case line-amplifier { + uses org-openroadm-resource-types:amp-number; + } + case xponder { + uses org-openroadm-resource-types:xpdr-number; + } + case versioned-service { + uses org-openroadm-resource-types:versioned-service-name; + } + case temp-service { + uses org-openroadm-resource-types:temp-service-name; + } + } + } + container resourceType { + uses org-openroadm-resource-types:resource-type; + } + } +} diff --git a/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/yang/org-openroadm-swdl.yang b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/yang/org-openroadm-swdl.yang new file mode 100644 index 000000000..79064b4d3 --- /dev/null +++ b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/yang/org-openroadm-swdl.yang @@ -0,0 +1,203 @@ +module org-openroadm-swdl { + namespace "http://org/openroadm/de/swdl"; + prefix org-openroadm-swdl; + + import ietf-yang-types { + prefix yang; + revision-date 2013-07-15; + } + import org-openroadm-common-types { + prefix org-openroadm-common-types; + revision-date 2019-11-29; + } + + organization + "Open ROADM MSA"; + contact + "OpenROADM.org"; + description + "Yang definitions for System Management. + + Copyright of the Members of the Open ROADM MSA Agreement dated (c) 2016, + All other rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. + * Neither the Members of the Open ROADM MSA Agreement nor the names of its + contributors may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE MEMBERS OF THE OPEN ROADM MSA AGREEMENT ''AS IS'' + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT THE MEMBERS OF THE OPEN ROADM MSA AGREEMENT BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE."; + + revision 2019-11-29 { + description + "Version 6.1.0"; + } + revision 2019-09-27 { + description + "Version 6.0.0"; + } + revision 2019-05-31 { + description + "Version 5.1.0"; + } + revision 2019-03-29 { + description + "Version 5.0.0"; + } + revision 2018-11-30 { + description + "Version 4.1.0"; + } + revision 2018-09-28 { + description + "Version 4.0.0"; + } + revision 2018-03-30 { + description + "Version 3.0.0"; + } + revision 2017-12-15 { + description + "Version 2.2"; + } + revision 2017-09-29 { + description + "Version 2.1"; + } + revision 2017-07-28 { + description + "Version 2.0.1 - added revision-date to imports"; + } + revision 2017-06-26 { + description + "Version 2.0"; + } + revision 2016-10-14 { + description + "Version 1.2"; + } + + grouping sw-bank { + description + "software bank group"; + leaf sw-version { + type string; + description + "Gissue of the SW in this bank"; + } + leaf sw-validation-timer { + type string { + pattern '(([0-1][0-9]|2[0-3])-([0-5][0-9])-([0-5][0-9]))'; + } + description + "value of validation timer in hh-mm-ss"; + } + leaf activation-date-time { + type yang:date-and-time; + description + "activation date and time: The date load was activated"; + } + } + + grouping database-info-group { + description + "database info group"; + leaf last-restored-time { + type yang:date-and-time; + description + "last restored time for the database, or the time that the database was created, whichever is later"; + } + leaf rollback-timer { + type string { + pattern '(([0-1][0-9]|2[0-3])-([0-5][0-9])-([0-5][0-9]))'; + } + description + "value of rollback timer in hh-mm-ss"; + } + leaf activation-date-time { + type yang:date-and-time; + description + "activation date and time: The date load was activated"; + } + } + + rpc sw-stage { + description + "SW stage - copies the SW from repo to staging bank"; + input { + leaf filename { + type string { + length "10..255"; + } + description + "file name which has the load"; + } + } + output { + uses org-openroadm-common-types:rpc-response-status; + } + } + rpc sw-activate { + description + "Activate new load"; + input { + leaf version { + type string; + description + " software version of the new load which is being activated"; + } + leaf validationTimer { + type string; + description + "validation timer hh-mm-ss"; + } + } + output { + uses org-openroadm-common-types:rpc-response-status; + } + } + rpc cancel-validation-timer { + description + "Cancel validation timer which user provisioned as part of activate command"; + input { + leaf accept { + type boolean; + default "true"; + description + " TRUE means validation timer is cancelled and new load is accepted"; + } + } + output { + uses org-openroadm-common-types:rpc-response-status; + } + } + notification sw-stage-notification { + description + "notification for sw-stage."; + uses org-openroadm-common-types:rpc-response-status; + } + notification sw-activate-notification { + description + "notification for sw-activate events."; + leaf sw-active-notification-type { + type org-openroadm-common-types:activate-notification-type; + } + uses org-openroadm-common-types:rpc-response-status; + } +} diff --git a/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/yang/org-openroadm-switching-pool-types.yang b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/yang/org-openroadm-switching-pool-types.yang new file mode 100644 index 000000000..a698a3ffd --- /dev/null +++ b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/yang/org-openroadm-switching-pool-types.yang @@ -0,0 +1,63 @@ +module org-openroadm-switching-pool-types { + namespace "http://org/openroadm/switching-pool-types"; + prefix org-openroadm-switching-pool-types; + + organization + "Open ROADM MSA"; + contact + "OpenROADM.org"; + description + "YANG definitions of common types. + + Copyright of the Members of the Open ROADM MSA Agreement dated (c) 2016, + All other rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. + * Neither the Members of the Open ROADM MSA Agreement nor the names of its + contributors may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE MEMBERS OF THE OPEN ROADM MSA AGREEMENT ''AS IS'' + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT THE MEMBERS OF THE OPEN ROADM MSA AGREEMENT BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE"; + + revision 2019-11-29 { + description + "Version 6.1.0"; + } + revision 2018-11-30 { + description + "Version 4.1.0"; + } + revision 2017-12-15 { + description + "Version 2.2"; + } + + typedef switching-pool-types { + type enumeration { + enum non-blocking { + value 1; + description + "Single non-blocking element"; + } + enum blocking { + value 2; + description + "Multiple connected non-blocking lists"; + } + } + } +} diff --git a/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/yang/org-openroadm-user-mgmt.yang b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/yang/org-openroadm-user-mgmt.yang new file mode 100644 index 000000000..846250f2a --- /dev/null +++ b/sdnr/wt/devicemanager-onap/openroadm/provider/src/main/yang/org-openroadm-user-mgmt.yang @@ -0,0 +1,161 @@ +module org-openroadm-user-mgmt { + namespace "http://org/openroadm/user-mgmt"; + prefix org-openroadm-user-mgmt; + + organization + "Open ROADM MSA"; + contact + "OpenROADM.org"; + description + "YANG definitions of user managements. + + Copyright of the Members of the Open ROADM MSA Agreement dated (c) 2016, + All other rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. + * Neither the Members of the Open ROADM MSA Agreement nor the names of its + contributors may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE MEMBERS OF THE OPEN ROADM MSA AGREEMENT ''AS IS'' + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT THE MEMBERS OF THE OPEN ROADM MSA AGREEMENT BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE"; + + revision 2019-11-29 { + description + "Version 6.1.0"; + } + revision 2018-11-30 { + description + "Version 4.1.0"; + } + revision 2017-12-15 { + description + "Version 2.2"; + } + revision 2017-09-29 { + description + "Version 2.1"; + } + revision 2017-06-26 { + description + "Version 2.0"; + } + revision 2016-10-14 { + description + "Version 1.2"; + } + + typedef username-type { + type string { + length "3..32"; + pattern '[a-z][a-z0-9]{2,31}' { + error-message + "A username must begin with a lowercase letter, The remainder + of the string may contain lowercase letters, or numbers 0 through 9."; + } + } + description + "The user name string identifying this entry."; + } + + typedef password-type { + type string { + length "8..128"; + pattern '[a-zA-Z0-9!$%\^()\[\]_\-~{}.+]*' { + error-message "Password content does not meet the requirements"; + } + } + description + "The password for this entry. This shouldn't be in clear text + The Password must contain at least 2 characters from + each of the following groups: + a) Lower case alphabetic (a-z) + b) Upper case alphabetic (A-Z) + c) Numeric 0-9 + d) Special characters Allowed !$%^()[]_-~{}.+ + Password must not contain Username."; + } + + grouping user-profile { + list user { + key "name"; + description + "The list of local users configured on this device."; + leaf name { + type username-type; + description + "The user name string identifying this entry."; + } + leaf password { + type password-type; + description + "The password for this entry."; + } + leaf group { + type enumeration { + enum sudo; + } + description + "The group to which the user is associated to."; + } + } + } + + rpc chg-password { + input { + leaf currentPassword { + type password-type; + mandatory true; + description + "provide the current password"; + } + leaf newPassword { + type password-type; + mandatory true; + description + "provide a new password"; + } + leaf newPasswordConfirm { + type password-type; + mandatory true; + description + "re-enter the new password "; + } + } + output { + leaf status { + type enumeration { + enum Successful { + value 1; + } + enum Failed { + value 2; + } + } + mandatory true; + description + "Successful or Failed"; + } + leaf status-message { + type string; + description + "Gives a more detailed reason for success / failure"; + } + } + } +} diff --git a/sdnr/wt/devicemanager-onap/openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestChangeNotificationListener.java b/sdnr/wt/devicemanager-onap/openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestChangeNotificationListener.java new file mode 100644 index 000000000..87f195dc3 --- /dev/null +++ b/sdnr/wt/devicemanager-onap/openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestChangeNotificationListener.java @@ -0,0 +1,92 @@ +/* + * ============LICENSE_START======================================================= + * ONAP : ccsdk features + * ================================================================================ + * Copyright (C) 2020 highstreet technologies GmbH Intellectual Property. + * All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + * + */ +package org.onap.ccsdk.features.sdnr.wt.devicemanager.openroadm.test; + +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; +import java.util.Arrays; +import java.util.List; +import org.eclipse.jdt.annotation.NonNull; +import org.junit.Test; +import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DataProvider; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.openroadm.impl.OpenroadmChangeNotificationListener; +import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfAccessor; +import org.onap.ccsdk.features.sdnr.wt.websocketmanager.model.WebsocketManagerService; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netconf.base._1._0.rev110601.EditOperationType; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.notifications.rev120206.NetconfConfigChange; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.notifications.rev120206.netconf.config.change.Edit; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.notifications.rev120206.netconf.config.change.EditBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.EventlogBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.EventlogEntity; +import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.PathArgument; + +public class TestChangeNotificationListener { + + private static final String NODEID = "node1"; + + @Test + public void test() { + + NetconfAccessor netconfAccessor = mock(NetconfAccessor.class); + DataProvider databaseService = mock(DataProvider.class); + WebsocketManagerService notificationService = mock(WebsocketManagerService.class); + OpenroadmChangeNotificationListener notifListener = + new OpenroadmChangeNotificationListener(netconfAccessor, databaseService, notificationService); + when(netconfAccessor.getNodeId()).thenReturn(new NodeId(NODEID)); + Iterable<? extends PathArgument> pathArguments = Arrays.asList(new PathArgument() { + + @Override + public int compareTo(PathArgument arg0) { + return 0; + } + + @Override + public Class<? extends DataObject> getType() { + return DataObject.class; + } + }); + InstanceIdentifier<?> target = InstanceIdentifier.create(pathArguments); + + notifListener.onNetconfConfigChange(createNotification(EditOperationType.Create, target)); + EventlogEntity event = new EventlogBuilder().setNodeId(NODEID) + .setNewValue(String.valueOf(EditOperationType.Create)).setObjectId(target.toString()).build(); + verify(databaseService).writeEventLog(event); + + } + + /** + * @param type + * @return + */ + private static NetconfConfigChange createNotification(EditOperationType type, InstanceIdentifier<?> target) { + NetconfConfigChange change = mock(NetconfConfigChange.class); + + @SuppressWarnings("null") + final @NonNull List<Edit> edits = Arrays.asList(new EditBuilder().setOperation(type).setTarget(target).build()); + when(change.nonnullEdit()).thenReturn(edits); + return change; + } +} diff --git a/sdnr/wt/devicemanager-onap/openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestDeviceManagerOpenRoadmImpl.java b/sdnr/wt/devicemanager-onap/openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestDeviceManagerOpenRoadmImpl.java new file mode 100644 index 000000000..c24e0f621 --- /dev/null +++ b/sdnr/wt/devicemanager-onap/openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestDeviceManagerOpenRoadmImpl.java @@ -0,0 +1,54 @@ +/* + * ============LICENSE_START======================================================= + * ONAP : ccsdk features + * ================================================================================ + * Copyright (C) 2020 highstreet technologies GmbH Intellectual Property. + * All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + * + */ +package org.onap.ccsdk.features.sdnr.wt.devicemanager.openroadm.test; + +import static org.junit.Assert.assertNotNull; +import static org.mockito.Mockito.mock; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.openroadm.impl.DeviceManagerOpenroadmImpl; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.NetconfNetworkElementService; + +public class TestDeviceManagerOpenRoadmImpl { + DeviceManagerOpenroadmImpl devMgrOpenRdmImpl; + NetconfNetworkElementService netcnfNtwrkElmntSrvc; + + @Before + public void init() { + netcnfNtwrkElmntSrvc = mock(NetconfNetworkElementService.class); + devMgrOpenRdmImpl = new DeviceManagerOpenroadmImpl(); + } + + @Test + public void test() throws Exception { + devMgrOpenRdmImpl.setNetconfNetworkElementService(netcnfNtwrkElmntSrvc); + assertNotNull(devMgrOpenRdmImpl); + + } + + @After + public void cleanUp() throws Exception { + devMgrOpenRdmImpl.close(); + } + +} diff --git a/sdnr/wt/devicemanager-onap/openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestOpenRoadmAlarmNotification.java b/sdnr/wt/devicemanager-onap/openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestOpenRoadmAlarmNotification.java new file mode 100644 index 000000000..ff0ddb43c --- /dev/null +++ b/sdnr/wt/devicemanager-onap/openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestOpenRoadmAlarmNotification.java @@ -0,0 +1,101 @@ +/* + * ============LICENSE_START======================================================= + * ONAP : ccsdk features + * ================================================================================ + * Copyright (C) 2020 highstreet technologies GmbH Intellectual Property. + * All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + * + */ +package org.onap.ccsdk.features.sdnr.wt.devicemanager.openroadm.test; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; +import java.io.IOException; +import org.eclipse.jdt.annotation.NonNull; +import org.junit.BeforeClass; +import org.junit.Test; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.openroadm.impl.OpenroadmFaultNotificationListener; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServiceProvider; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.FaultService; +import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfAccessor; +import org.onap.ccsdk.features.sdnr.wt.websocketmanager.model.WebsocketManagerService; +import org.opendaylight.yang.gen.v1.http.org.openroadm.alarm.rev191129.AlarmNotification; +import org.opendaylight.yang.gen.v1.http.org.openroadm.alarm.rev191129.Severity; +import org.opendaylight.yang.gen.v1.http.org.openroadm.alarm.rev191129.alarm.ProbableCause; +import org.opendaylight.yang.gen.v1.http.org.openroadm.alarm.rev191129.alarm.ProbableCauseBuilder; +import org.opendaylight.yang.gen.v1.http.org.openroadm.alarm.rev191129.alarm.Resource; +import org.opendaylight.yang.gen.v1.http.org.openroadm.alarm.rev191129.alarm.ResourceBuilder; +import org.opendaylight.yang.gen.v1.http.org.openroadm.common.node.types.rev191129.NodeIdType; +import org.opendaylight.yang.gen.v1.http.org.openroadm.probablecause.rev191129.ProbableCauseEnum; +import org.opendaylight.yang.gen.v1.http.org.openroadm.resource.rev191129.resource.Device; +import org.opendaylight.yang.gen.v1.http.org.openroadm.resource.rev191129.resource.DeviceBuilder; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime; + +public class TestOpenRoadmAlarmNotification { + private static final String myCircuitId = "Test_Id"; + private static final String myId = "Alarm_Id"; + DateAndTime myRaiseTime = new DateAndTime("2020-02-25T10:08:06.7Z"); + ProbableCause myProbableCause = + new ProbableCauseBuilder().setCause(ProbableCauseEnum.AutomaticLaserShutdown).build(); + Device device = new DeviceBuilder().setNodeId(NodeIdType.getDefaultInstance("zNhe2i5")).build(); + Resource myResource = new ResourceBuilder().setDevice(device).build(); + static DeviceManagerServiceProvider serviceProvider; + static @NonNull FaultService faultService; + static AlarmNotification notification; + Severity severity; + static NetconfAccessor accessor; + static WebsocketManagerService notificationService; + + @BeforeClass + public static void init() throws InterruptedException, IOException { + + accessor = mock(NetconfAccessor.class); + serviceProvider = mock(DeviceManagerServiceProvider.class); + faultService = mock(FaultService.class); + notificationService = mock(WebsocketManagerService.class); + } + + + + @Test + public void testNotification() { + severity = Severity.Critical; + when(serviceProvider.getFaultService()).thenReturn(faultService); + when(serviceProvider.getWebsocketService()).thenReturn(notificationService); + OpenroadmFaultNotificationListener alarmListener = + new OpenroadmFaultNotificationListener(serviceProvider); + notification = mock(AlarmNotification.class); + + when(notification.getId()).thenReturn(myId); + when(notification.getCircuitId()).thenReturn(myCircuitId); + when(notification.getRaiseTime()).thenReturn(myRaiseTime); + when(notification.getProbableCause()).thenReturn(myProbableCause); + when(notification.getResource()).thenReturn(myResource); + when(notification.getSeverity()).thenReturn(severity); + alarmListener.onAlarmNotification(notification); + System.out.println(notification.getId()); + assertEquals(myId, notification.getId()); + assertEquals(myCircuitId, notification.getCircuitId()); + assertEquals(myRaiseTime, notification.getRaiseTime()); + assertEquals(myProbableCause, notification.getProbableCause()); + assertEquals(myResource, notification.getResource()); + assertEquals(severity, notification.getSeverity()); + + + } + +} diff --git a/sdnr/wt/devicemanager-onap/openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestOpenRoadmDeviceChangeNotification.java b/sdnr/wt/devicemanager-onap/openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestOpenRoadmDeviceChangeNotification.java new file mode 100644 index 000000000..a6d276d48 --- /dev/null +++ b/sdnr/wt/devicemanager-onap/openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestOpenRoadmDeviceChangeNotification.java @@ -0,0 +1,125 @@ +/* + * ============LICENSE_START======================================================= + * ONAP : ccsdk features + * ================================================================================ + * Copyright (C) 2020 highstreet technologies GmbH Intellectual Property. + * All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + * + */ +package org.onap.ccsdk.features.sdnr.wt.devicemanager.openroadm.test; + +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; +import java.util.Arrays; +import java.util.List; +import org.eclipse.jdt.annotation.NonNull; +import org.junit.Test; +import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DataProvider; +import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.NetconfTimeStamp; +import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.types.NetconfTimeStampImpl; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.openroadm.impl.OpenroadmDeviceChangeNotificationListener; +import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfAccessor; +import org.onap.ccsdk.features.sdnr.wt.websocketmanager.model.WebsocketManagerService; +import org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev191129.RpcStatus; +import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev191129.ChangeNotification; +import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev191129.CreateTechInfoNotification; +import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev191129.CreateTechInfoNotificationBuilder; +import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev191129.change.notification.Edit; +import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev191129.change.notification.EditBuilder; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netconf.base._1._0.rev110601.EditOperationType; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.EventlogBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.EventlogEntity; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev201110.SourceType; +import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId; +import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.PathArgument; + + + +public class TestOpenRoadmDeviceChangeNotification { + private static final String NODEID = "Roadm1"; + private NetconfAccessor netconfAccessor = mock(NetconfAccessor.class); + private DataProvider databaseService = mock(DataProvider.class); + WebsocketManagerService notificationService = mock(WebsocketManagerService.class); + private OpenroadmDeviceChangeNotificationListener deviceChangeListener = + new OpenroadmDeviceChangeNotificationListener(netconfAccessor, databaseService, notificationService); + private static final NetconfTimeStamp ncTimeConverter = NetconfTimeStampImpl.getConverter(); + + @Test + public void testOnChangeNotification() { + + when(netconfAccessor.getNodeId()).thenReturn(new NodeId(NODEID)); + Iterable<? extends PathArgument> pathArguments = Arrays.asList(new PathArgument() { + + @Override + public int compareTo(PathArgument arg0) { + return 0; + } + + @Override + public Class<? extends DataObject> getType() { + return DataObject.class; + } + }); + InstanceIdentifier<?> target = InstanceIdentifier.create(pathArguments); + + deviceChangeListener.onChangeNotification(createNotification(EditOperationType.Create, target)); + EventlogEntity event = + new EventlogBuilder().setNodeId(NODEID).setNewValue(String.valueOf(EditOperationType.Create)) + .setObjectId(target.getPathArguments().toString()).setCounter(1) + .setAttributeName(target.getTargetType().getName()).setSourceType(SourceType.Netconf).build(); + verify(databaseService).writeEventLog(event); + + } + + @Test + public void testOnCreateTechInfoNotification() { + when(netconfAccessor.getNodeId()).thenReturn(new NodeId(NODEID)); + deviceChangeListener.onCreateTechInfoNotification(createTechInfoNotification()); + EventlogEntity event = new EventlogBuilder().setNodeId(NODEID).setCounter(1) + .setId(createTechInfoNotification().getShelfId()) + .setAttributeName(createTechInfoNotification().getShelfId()) + .setObjectId(createTechInfoNotification().getShelfId()) + .setNewValue(createTechInfoNotification().getStatus().getName()).setSourceType(SourceType.Netconf) + .setTimestamp(ncTimeConverter.getTimeStamp()).build(); + verify(databaseService).writeEventLog(event); + } + + /** + * @param type + * @return + */ + private static ChangeNotification createNotification(EditOperationType type, InstanceIdentifier<?> target) { + ChangeNotification change = mock(ChangeNotification.class); + + @SuppressWarnings("null") + final @NonNull List<Edit> edits = Arrays.asList(new EditBuilder().setOperation(type).setTarget(target).build()); + when(change.nonnullEdit()).thenReturn(edits); + return change; + } + + private static CreateTechInfoNotification createTechInfoNotification() { + CreateTechInfoNotificationBuilder techInfoNotificationBuilder = new CreateTechInfoNotificationBuilder(); + techInfoNotificationBuilder.setLogFileName("shjkdjld/EHJkk").setShelfId("dsjhdukdgkzw") + .setStatus(RpcStatus.Successful).setStatusMessage("TestSuccessful"); + return techInfoNotificationBuilder.build(); + + } + + +} diff --git a/sdnr/wt/devicemanager-onap/openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestOpenRoadmInventory.java b/sdnr/wt/devicemanager-onap/openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestOpenRoadmInventory.java new file mode 100644 index 000000000..e856511e5 --- /dev/null +++ b/sdnr/wt/devicemanager-onap/openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestOpenRoadmInventory.java @@ -0,0 +1,144 @@ +/* + * ============LICENSE_START======================================================= + * ONAP : ccsdk features + * ================================================================================ + * Copyright (C) 2020 highstreet technologies GmbH Intellectual Property. + * All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + * + */ +package org.onap.ccsdk.features.sdnr.wt.devicemanager.openroadm.test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; +import org.junit.Test; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.openroadm.impl.OpenroadmInventoryInput; +import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfAccessor; +import org.opendaylight.yang.gen.v1.http.org.openroadm.common.node.types.rev191129.NodeIdType; +import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev191129.LifecycleState; +import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev191129.State; +import org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev191129.OpenroadmVersionType; +import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev191129.OrgOpenroadmDevice; +import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev191129.circuit.packs.CircuitPacks; +import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev191129.interfaces.grp.Interface; +import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev191129.org.openroadm.device.Info; +import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev191129.org.openroadm.device.InfoBuilder; +import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev191129.org.openroadm.device.Xponder; +import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev191129.shelves.Shelves; +import org.opendaylight.yang.gen.v1.http.org.openroadm.device.types.rev191129.NodeTypes; +import org.opendaylight.yang.gen.v1.http.org.openroadm.device.types.rev191129.XpdrNodeTypes; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address; +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.common.Uint16; +import org.opendaylight.yangtools.yang.common.Uint32; +import org.opendaylight.yangtools.yang.common.Uint8; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class TestOpenRoadmInventory { + private static final Logger LOG = LoggerFactory.getLogger(OpenroadmInventoryInput.class); + private NetconfAccessor accessor = mock(NetconfAccessor.class); + private long value1 = 1; + private IpAddress ipAddress = new IpAddress(new Ipv4Address("127.0.0.11")); + private NodeId nodeId = new NodeId("RoadmA2"); + private Info info = new InfoBuilder().setNodeId(NodeIdType.getDefaultInstance("zNhe2i5")).setClli("NodeB") + .setSerialId("0002").setModel("model2").setVendor("VendorA").setCurrentIpAddress(ipAddress) + .setCurrentIpAddress(ipAddress).setCurrentDefaultGateway(new IpAddress(new Ipv4Address("127.0.0.20"))) + .setCurrentDefaultGateway(new IpAddress(new Ipv4Address("127.0.0.20"))).setNodeType(NodeTypes.Rdm) + .setCurrentDatetime(new DateAndTime("2017-10-22T15:23:43Z")).setSoftwareVersion("swversion1234") + .setPrefixLength(Uint8.valueOf(28)).setMaxDegrees(Uint16.valueOf(2)).setMaxSrgs(Uint16.valueOf(3)) + .setMaxNumBin15minHistoricalPm(Uint16.valueOf(32)).setMaxNumBin24hourHistoricalPm(Uint16.valueOf(7)) + .setOpenroadmVersion(OpenroadmVersionType._20).build(); + + private OrgOpenroadmDevice device = mock(OrgOpenroadmDevice.class);; + private Shelves shelf = mock(Shelves.class); + private Interface interfaces = mock(Interface.class); + private CircuitPacks cp = mock(CircuitPacks.class); + private Xponder xpdr = mock(Xponder.class); + OpenroadmInventoryInput roadmInventory = new OpenroadmInventoryInput(accessor, device); + + @Test + public void TestDevice() { + when(accessor.getNodeId()).thenReturn(nodeId); + when(device.getInfo()).thenReturn(info); + + roadmInventory.getInventoryData(Uint32.valueOf(value1)); + assertEquals(info, device.getInfo()); + + } + + @Test + public void TestShelves() { + when(accessor.getNodeId()).thenReturn(nodeId); + when(device.getInfo()).thenReturn(info); + when(shelf.getShelfPosition()).thenReturn("10"); + when(shelf.getOperationalState()).thenReturn(State.InService); + when(shelf.getSerialId()).thenReturn("nodeid-1"); + when(shelf.getShelfName()).thenReturn("Shelf1"); + when(shelf.getShelfType()).thenReturn("Shelf"); + when(shelf.getClei()).thenReturn("1234567890"); + when(shelf.getVendor()).thenReturn("vendorA"); + when(shelf.getModel()).thenReturn("1"); + when(shelf.getHardwareVersion()).thenReturn("0.1"); + when(shelf.getManufactureDate()).thenReturn(new DateAndTime("2017-10-22T15:23:43Z")); + assertNotNull(roadmInventory.getShelvesInventory(shelf, Uint32.valueOf(value1 + 1))); + + LOG.info("Shelves test completed"); + + } + + @Test + public void TestCircuitPacks() { + when(accessor.getNodeId()).thenReturn(nodeId); + when(cp.getCircuitPackName()).thenReturn("1/0"); + when(cp.getVendor()).thenReturn("VendorA"); + when(cp.getModel()).thenReturn("Model1"); + when(cp.getSerialId()).thenReturn("46277sgh6"); + when(cp.getClei()).thenReturn("136268785"); + when(cp.getHardwareVersion()).thenReturn("0.1"); + when(cp.getType()).thenReturn("WSS"); + when(cp.getProductCode()).thenReturn("oooooo"); + when(cp.getCircuitPackMode()).thenReturn("inServiceMode"); + when(device.getInfo()).thenReturn(info); + assertNotNull(roadmInventory.getCircuitPackInventory(cp, Uint32.valueOf(value1 + 1))); + + } + + @Test + public void TestInterfaces() { + when(accessor.getNodeId()).thenReturn(nodeId); + when(interfaces.getName()).thenReturn("1GE-interface-1"); + when(interfaces.getDescription()).thenReturn("Ethernet Interface"); + when(interfaces.getSupportingCircuitPackName()).thenReturn("1/0"); + when(device.getInfo()).thenReturn(info); + assertNotNull(roadmInventory.getInterfacesInventory(interfaces, Uint32.valueOf(value1 + 2))); + } + + @Test + public void TestXponder() { + when(xpdr.getXpdrNumber()).thenReturn(Uint16.valueOf(1)); + when(xpdr.getXpdrType()).thenReturn(XpdrNodeTypes.Mpdr); + when(xpdr.getLifecycleState()).thenReturn(LifecycleState.Deployed); + when(accessor.getNodeId()).thenReturn(nodeId); + when(device.getInfo()).thenReturn(info); + assertNotNull(roadmInventory.getXponderInventory(xpdr, Uint32.valueOf(value1 + 1))); + + } + +} diff --git a/sdnr/wt/devicemanager-onap/openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestOpenRoadmNetworkElement.java b/sdnr/wt/devicemanager-onap/openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestOpenRoadmNetworkElement.java new file mode 100644 index 000000000..f5b40d050 --- /dev/null +++ b/sdnr/wt/devicemanager-onap/openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestOpenRoadmNetworkElement.java @@ -0,0 +1,310 @@ +/* + * ============LICENSE_START======================================================= + * ONAP : ccsdk features + * ================================================================================ + * Copyright (C) 2020 highstreet technologies GmbH Intellectual Property. + * All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + * + */ +package org.onap.ccsdk.features.sdnr.wt.devicemanager.openroadm.test; + +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.eclipse.jdt.annotation.Nullable; +import org.junit.Before; +import org.junit.Ignore; +import org.junit.Test; +import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DataProvider; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.openroadm.impl.OpenroadmInventoryInput; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.openroadm.impl.OpenroadmNetworkElement; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServiceProvider; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.FaultService; +import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.Capabilities; +import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfBindingAccessor; +import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.TransactionUtils; +import org.opendaylight.mdsal.binding.api.DataBroker; +import org.opendaylight.mdsal.common.api.LogicalDatastoreType; +import org.opendaylight.yang.gen.v1.http.org.openroadm.alarm.rev191129.ActiveAlarmList; +import org.opendaylight.yang.gen.v1.http.org.openroadm.alarm.rev191129.Severity; +import org.opendaylight.yang.gen.v1.http.org.openroadm.alarm.rev191129.active.alarm.list.ActiveAlarms; +import org.opendaylight.yang.gen.v1.http.org.openroadm.alarm.rev191129.active.alarm.list.ActiveAlarmsKey; +import org.opendaylight.yang.gen.v1.http.org.openroadm.alarm.rev191129.alarm.ProbableCauseBuilder; +import org.opendaylight.yang.gen.v1.http.org.openroadm.alarm.rev191129.alarm.ResourceBuilder; +import org.opendaylight.yang.gen.v1.http.org.openroadm.common.node.types.rev191129.NodeIdType; +import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev191129.LifecycleState; +import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev191129.State; +import org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev191129.OpenroadmVersionType; +import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev191129.OrgOpenroadmDevice; +import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev191129.circuit.pack.ParentCircuitPack; +import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev191129.circuit.packs.CircuitPacks; +import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev191129.circuit.packs.CircuitPacksKey; +import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev191129.interfaces.grp.Interface; +import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev191129.interfaces.grp.InterfaceKey; +import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev191129.org.openroadm.device.Info; +import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev191129.org.openroadm.device.InfoBuilder; +import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev191129.org.openroadm.device.Xponder; +import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev191129.org.openroadm.device.XponderKey; +import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev191129.shelf.Slots; +import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev191129.shelf.SlotsKey; +import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev191129.shelves.Shelves; +import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev191129.shelves.ShelvesKey; +import org.opendaylight.yang.gen.v1.http.org.openroadm.device.types.rev191129.NodeTypes; +import org.opendaylight.yang.gen.v1.http.org.openroadm.device.types.rev191129.XpdrNodeTypes; +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; +import org.opendaylight.yang.gen.v1.http.org.openroadm.pm.rev191129.historical.pm.group.HistoricalPmKey; +import org.opendaylight.yang.gen.v1.http.org.openroadm.pm.rev191129.historical.pm.list.HistoricalPmEntry; +import org.opendaylight.yang.gen.v1.http.org.openroadm.pm.rev191129.historical.pm.list.HistoricalPmEntryKey; +import org.opendaylight.yang.gen.v1.http.org.openroadm.pm.rev191129.historical.pm.val.group.Measurement; +import org.opendaylight.yang.gen.v1.http.org.openroadm.pm.rev191129.historical.pm.val.group.MeasurementKey; +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.PmGranularity; +import org.opendaylight.yang.gen.v1.http.org.openroadm.pm.types.rev191129.PmNamesEnum; +import org.opendaylight.yang.gen.v1.http.org.openroadm.pm.types.rev191129.Validity; +import org.opendaylight.yang.gen.v1.http.org.openroadm.probablecause.rev191129.ProbableCauseEnum; +import org.opendaylight.yang.gen.v1.http.org.openroadm.resource.rev191129.resource.DeviceBuilder; +import org.opendaylight.yang.gen.v1.http.org.openroadm.resource.types.rev191129.ResourceTypeEnum; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address; +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; + +public class TestOpenRoadmNetworkElement { + + NetconfBindingAccessor accessor = mock(NetconfBindingAccessor.class); + DeviceManagerServiceProvider serviceProvider = mock(DeviceManagerServiceProvider.class); + DataProvider dataprovider = mock(DataProvider.class); + Capabilities capabilities = mock(Capabilities.class); + TransactionUtils transactionUtils = mock(TransactionUtils.class); + DataBroker dataBroker = mock(DataBroker.class); + FaultService faultService = mock(FaultService.class); + OrgOpenroadmDevice device; + OpenroadmInventoryInput inventoryData; + long level = 1; + private Shelves shelf = mock(Shelves.class); + private @Nullable Map<ShelvesKey, Shelves> shelfList; + private CircuitPacks cp, cp1, cp2, cp3; + private Interface interfaces = mock(Interface.class); + private Xponder xpdr = mock(Xponder.class); + private IpAddress ipAddress = new IpAddress(new Ipv4Address("127.0.0.11")); + private Info info = new InfoBuilder().setNodeId(NodeIdType.getDefaultInstance("zNhe2i5")).setClli("NodeB") + .setSerialId("0002").setModel("model2").setVendor("VendorA").setCurrentIpAddress(ipAddress) + .setCurrentIpAddress(ipAddress).setCurrentDefaultGateway(new IpAddress(new Ipv4Address("127.0.0.20"))) + .setCurrentDefaultGateway(new IpAddress(new Ipv4Address("127.0.0.20"))).setNodeType(NodeTypes.Rdm) + .setCurrentDatetime(new DateAndTime("2017-10-22T15:23:43Z")).setSoftwareVersion("swversion1234") + .setCurrentPrefixLength(Uint8.valueOf(45)).setMaxDegrees(Uint16.valueOf(56)).setMaxSrgs(Uint16.valueOf(251)) + .setMaxNumBin15minHistoricalPm(Uint16.valueOf(324)).setMaxNumBin24hourHistoricalPm(Uint16.valueOf(142)) + .setOpenroadmVersion(OpenroadmVersionType._20).build(); + private ActiveAlarmList alarmList = mock(ActiveAlarmList.class); + private ActiveAlarms activeAlarms = mock(ActiveAlarms.class); + private HistoricalPmList pmDataList = mock(HistoricalPmList.class); + private HistoricalPm historicalPm = mock(HistoricalPm.class); + + @Before + public void init() { + when(accessor.getCapabilites()).thenReturn(capabilities); + when(serviceProvider.getFaultService()).thenReturn(faultService); + when(serviceProvider.getDataProvider()).thenReturn(dataprovider); + NodeId nNodeId = new NodeId("RoadmA"); + when(accessor.getNodeId()).thenReturn(nNodeId); + when(accessor.getDataBroker()).thenReturn(dataBroker); + when(accessor.getTransactionUtils()).thenReturn(transactionUtils); + when(accessor.getCapabilites().isSupportingNamespaceAndRevision(OrgOpenroadmDevice.QNAME)).thenReturn(true); + final Class<OrgOpenroadmDevice> openRoadmDev = OrgOpenroadmDevice.class; + // Reading data from device + InstanceIdentifier<OrgOpenroadmDevice> deviceId = InstanceIdentifier.builder(openRoadmDev).build(); + device = mock(OrgOpenroadmDevice.class); + when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, + deviceId)).thenReturn(device); + + when(device.getInfo()).thenReturn(info); + inventoryData = new OpenroadmInventoryInput(accessor, device); + // Reading the shelfs data; + when(shelf.getShelfPosition()).thenReturn("10"); + when(shelf.getOperationalState()).thenReturn(State.InService); + when(shelf.getSerialId()).thenReturn("nodeid-1"); + when(shelf.getShelfName()).thenReturn("Shelf1"); + when(shelf.getShelfType()).thenReturn("Shelf"); + when(shelf.getClei()).thenReturn("1234567890"); + when(shelf.getVendor()).thenReturn("vendorA"); + when(shelf.getModel()).thenReturn("1"); + when(shelf.getHardwareVersion()).thenReturn("0.1"); + when(shelf.getManufactureDate()).thenReturn(new DateAndTime("2017-10-22T15:23:43Z")); + @Nullable + Map<SlotsKey, Slots> slotList = null; + Slots slots = mock(Slots.class); + when(slots.getLabel()).thenReturn("Slot56746"); + when(slots.getSlotName()).thenReturn("slotofRoadmA"); + when(slots.getProvisionedCircuitPack()).thenReturn("1/0"); + slotList = new HashMap<>(); + slotList.put(slots.key(), slots); + when(shelf.getSlots()).thenReturn(slotList); + shelfList = new HashMap<>(); + shelfList.put(shelf.key(), shelf); + when(device.getShelves()).thenReturn(shelfList); + + // Reading data from CircuitPacks + cp = mock(CircuitPacks.class); + when(cp.getCircuitPackName()).thenReturn("1/0"); + when(cp.getVendor()).thenReturn("VendorA"); + when(cp.getModel()).thenReturn("Model1"); + when(cp.getSerialId()).thenReturn("46277sgh6"); + when(cp.getClei()).thenReturn("136268785"); + when(cp.getHardwareVersion()).thenReturn("0.1"); + when(cp.getType()).thenReturn("WSS"); + when(cp.getProductCode()).thenReturn("oooooo"); + when(cp.getCircuitPackMode()).thenReturn("inServiceMode"); + + ParentCircuitPack parentCp = mock(ParentCircuitPack.class); + when(parentCp.getCircuitPackName()).thenReturn("1/0"); + when(parentCp.getCpSlotName()).thenReturn("Slot1"); + cp1 = mock(CircuitPacks.class); + when(cp1.getCircuitPackName()).thenReturn("1/0 EThernet"); + when(cp1.getVendor()).thenReturn("VendorA"); + when(cp1.getModel()).thenReturn("Model1678"); + when(cp1.getSerialId()).thenReturn("4627dgs7sgh6"); + when(cp1.getClei()).thenReturn("1362d68785"); + when(cp1.getHardwareVersion()).thenReturn("0.1"); + when(cp1.getType()).thenReturn("EthPlug"); + when(cp1.getProductCode()).thenReturn("oooooo"); + when(cp1.getCircuitPackMode()).thenReturn("inServiceMode"); + when(cp1.getParentCircuitPack()).thenReturn(parentCp); + + cp2 = mock(CircuitPacks.class); + when(cp2.getCircuitPackName()).thenReturn("2/0"); + when(cp2.getVendor()).thenReturn("VendorA"); + when(cp2.getModel()).thenReturn("Model1678"); + when(cp2.getSerialId()).thenReturn("4sads7sgh6"); + when(cp2.getClei()).thenReturn("1wew362d68785"); + when(cp2.getHardwareVersion()).thenReturn("0.1"); + when(cp2.getType()).thenReturn("WSS"); + when(cp2.getProductCode()).thenReturn("osooooo"); + when(cp2.getCircuitPackMode()).thenReturn("inServiceMode"); + + cp3 = mock(CircuitPacks.class); + when(parentCp.getCircuitPackName()).thenReturn("2/0"); + when(parentCp.getCpSlotName()).thenReturn("Slot1"); + when(cp3.getCircuitPackName()).thenReturn("2/0 OCS"); + when(cp3.getVendor()).thenReturn("VendorA"); + when(cp3.getModel()).thenReturn("Model1678"); + when(cp3.getSerialId()).thenReturn("dswsads7sgh6"); + when(cp3.getClei()).thenReturn("1ew62d68785"); + when(cp3.getHardwareVersion()).thenReturn("0.1"); + when(cp3.getType()).thenReturn("OCS Plug"); + when(cp3.getProductCode()).thenReturn("osooooo"); + when(cp3.getCircuitPackMode()).thenReturn("inServiceMode"); + when(cp3.getParentCircuitPack()).thenReturn(parentCp); + @Nullable + Map<CircuitPacksKey, CircuitPacks> cpList = new HashMap<>(); + cpList.put(cp.key(), cp); + cpList.put(cp1.key(), cp1); + cpList.put(cp2.key(), cp2); + cpList.put(cp3.key(), cp3); + when(device.getCircuitPacks()).thenReturn(cpList); + + // Reading Interface Data + when(interfaces.getName()).thenReturn("1GE-interface-1"); + when(interfaces.getDescription()).thenReturn("Ethernet Interface"); + when(interfaces.getSupportingCircuitPackName()).thenReturn("1/0 EThernet"); + @Nullable + Map<InterfaceKey, Interface> interfacesList = new HashMap<>(); + interfacesList.put(interfaces.key(), interfaces); + when(device.getInterface()).thenReturn(interfacesList); + + // Reading Xponder Data + when(xpdr.getXpdrNumber()).thenReturn(Uint16.valueOf(1)); + when(xpdr.getXpdrType()).thenReturn(XpdrNodeTypes.Mpdr); + when(xpdr.getLifecycleState()).thenReturn(LifecycleState.Deployed); + @Nullable + Map<XponderKey, Xponder> xpnderList = new HashMap<>(); + xpnderList.put(xpdr.key(), xpdr); + when(device.getXponder()).thenReturn(xpnderList); + + // Read initial Alarm data + final Class<ActiveAlarmList> classAlarm = ActiveAlarmList.class; + InstanceIdentifier<ActiveAlarmList> alarmDataIid = InstanceIdentifier.builder(classAlarm).build(); + when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, + alarmDataIid)).thenReturn(alarmList); + when(activeAlarms.getId()).thenReturn("Alarm1"); + when(activeAlarms.getCircuitId()).thenReturn("1/0"); + when(activeAlarms.getRaiseTime()).thenReturn(new DateAndTime("2017-10-22T15:23:43Z")); + when(activeAlarms.getSeverity()).thenReturn(Severity.Critical); + when(activeAlarms.getProbableCause()) + .thenReturn(new ProbableCauseBuilder().setCause(ProbableCauseEnum.AutomaticLaserShutdown).build()); + when(activeAlarms.getAdditionalDetail()).thenReturn("LaserShutdown"); + when(activeAlarms.getResource()).thenReturn(new ResourceBuilder() + .setDevice(new DeviceBuilder().setNodeId(NodeIdType.getDefaultInstance("zNhe2i5")).build()).build()); + @Nullable + Map<ActiveAlarmsKey, ActiveAlarms> activeAlarmlist = new HashMap<>(); + activeAlarmlist.put(activeAlarms.key(), activeAlarms); + when(alarmList.getActiveAlarms()).thenReturn(activeAlarmlist); + + // Read PM Data + final Class<HistoricalPmList> pmDataClass = HistoricalPmList.class; + InstanceIdentifier<HistoricalPmList> pmDataIid = InstanceIdentifier.builder(pmDataClass).build(); + when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, + pmDataIid)).thenReturn(pmDataList); + + Measurement measurement = mock(Measurement.class); + PmDataType pmDataType = mock(PmDataType.class); + when(pmDataType.getUint64()).thenReturn(Uint64.valueOf(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); + when(measurement.getPmParameterUnit()).thenReturn("6824545199534863756"); + when(measurement.getPmParameterValue()).thenReturn(pmDataType); + when(measurement.getValidity()).thenReturn(Validity.Partial); + + @Nullable + Map<MeasurementKey, Measurement> measurementList = new HashMap<>(); + measurementList.put(measurement.key(), measurement); + when(historicalPm.getMeasurement()).thenReturn(measurementList); + when(historicalPm.getType()).thenReturn(PmNamesEnum.ErroredSeconds); + when(historicalPm.getExtension()).thenReturn("OpticalPowerOutput"); + @Nullable + Map<HistoricalPmKey, HistoricalPm> historicalPmList = new HashMap<>(); + historicalPmList.put(historicalPm.key(), historicalPm); + HistoricalPmEntry histPmEntry = mock(HistoricalPmEntry.class); + when(histPmEntry.getHistoricalPm()).thenReturn(historicalPmList); + when(histPmEntry.getPmResourceType()).thenReturn(ResourceTypeEnum.CircuitPack); + @Nullable + Map<HistoricalPmEntryKey, HistoricalPmEntry> histPmList = new HashMap<>(); + histPmList.put(histPmEntry.key(), histPmEntry); + when(pmDataList.getHistoricalPmEntry()).thenReturn(histPmList); + + } + + + + @Ignore + @Test + public void test() { + OpenroadmNetworkElement optionalNe = new OpenroadmNetworkElement(accessor, serviceProvider); + optionalNe.initialReadFromNetworkElement(); + verify(dataprovider).writeInventory(accessor.getNodeId().getValue(), + Arrays.asList(inventoryData.getInventoryData(Uint32.valueOf(1)))); + } + +} diff --git a/sdnr/wt/devicemanager-onap/openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestOpenRoadmNetworkElementFactory.java b/sdnr/wt/devicemanager-onap/openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestOpenRoadmNetworkElementFactory.java new file mode 100644 index 000000000..40a48c358 --- /dev/null +++ b/sdnr/wt/devicemanager-onap/openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestOpenRoadmNetworkElementFactory.java @@ -0,0 +1,101 @@ +/* + * ============LICENSE_START======================================================= + * ONAP : ccsdk features + * ================================================================================ + * Copyright (C) 2020 highstreet technologies GmbH Intellectual Property. + * All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + * + */ +package org.onap.ccsdk.features.sdnr.wt.devicemanager.openroadm.test; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; +import java.io.IOException; +import java.util.Optional; +import org.junit.After; +import org.junit.BeforeClass; +import org.junit.Test; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.openroadm.impl.OpenroadmNetworkElementFactory; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServiceProvider; +import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.Capabilities; +import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfBindingAccessor; +import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.TransactionUtils; +import org.opendaylight.mdsal.binding.api.DataBroker; +import org.opendaylight.mdsal.common.api.LogicalDatastoreType; +import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev191129.OrgOpenroadmDevice; +import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; + +public class TestOpenRoadmNetworkElementFactory { + + private static NetconfBindingAccessor accessor; + private static DeviceManagerServiceProvider serviceProvider; + private static Capabilities capabilities; + private static TransactionUtils transactionUtils; + private static DataBroker dataBroker; + + @BeforeClass + public static void init() throws InterruptedException, IOException { + accessor = mock(NetconfBindingAccessor.class); + capabilities = mock(Capabilities.class); + dataBroker = mock(DataBroker.class); + transactionUtils = mock(TransactionUtils.class); + serviceProvider = mock(DeviceManagerServiceProvider.class); + when(accessor.getNodeId()).thenReturn(new NodeId("RoadmA2")); + when(accessor.getCapabilites()).thenReturn(capabilities); + when(accessor.getDataBroker()).thenReturn(dataBroker); + when(accessor.getTransactionUtils()).thenReturn(transactionUtils); + when(accessor.getNetconfBindingAccessor()).thenReturn(Optional.of(accessor)); + when(serviceProvider.getDataProvider()).thenReturn(null); + + final Class<OrgOpenroadmDevice> openRoadmDev = OrgOpenroadmDevice.class; + InstanceIdentifier<OrgOpenroadmDevice> deviceId = InstanceIdentifier.builder(openRoadmDev).build(); + when(accessor.getTransactionUtils().readData(accessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, + deviceId)).thenReturn(mock(OrgOpenroadmDevice.class)); + + when(accessor.getTransactionUtils()).thenReturn(mock(TransactionUtils.class)); + } + + @Test + public void testCapabiltiesAvailable1() { + when(accessor.getCapabilites().isSupportingNamespaceAndRevision(OrgOpenroadmDevice.QNAME)).thenReturn(true); + OpenroadmNetworkElementFactory factory = new OpenroadmNetworkElementFactory(); + assertTrue((factory.create(accessor, serviceProvider)).isPresent()); + } + + @Test + public void testCapabiltiesAvailable2() { + when(accessor.getCapabilites().isSupportingNamespaceAndRevision("http://org/openroadm/device", "2018-10-19")) + .thenReturn(true); + OpenroadmNetworkElementFactory factory = new OpenroadmNetworkElementFactory(); + assertTrue((factory.create(accessor, serviceProvider)).isPresent()); + } + + @Test + public void testCapabiltiesNotAvailable() throws Exception { + when(accessor.getCapabilites().isSupportingNamespaceAndRevision(OrgOpenroadmDevice.QNAME)).thenReturn(false); + OpenroadmNetworkElementFactory factory = new OpenroadmNetworkElementFactory(); + assertFalse(factory.create(accessor, serviceProvider).isPresent()); + } + + @After + public void cleanUp() throws Exception { + + } + +} diff --git a/sdnr/wt/devicemanager-onap/openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestOpenRoadmPMDataBuilder.java b/sdnr/wt/devicemanager-onap/openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestOpenRoadmPMDataBuilder.java new file mode 100644 index 000000000..5069acec9 --- /dev/null +++ b/sdnr/wt/devicemanager-onap/openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestOpenRoadmPMDataBuilder.java @@ -0,0 +1,186 @@ +/* + * ============LICENSE_START======================================================= + * ONAP : ccsdk features + * ================================================================================ + * Copyright (C) 2020 highstreet technologies GmbH Intellectual Property. + * All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + * + */ +package org.onap.ccsdk.features.sdnr.wt.devicemanager.openroadm.test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.junit.Before; +import org.junit.Test; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.openroadm.impl.PmDataBuilderOpenRoadm; +import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfBindingAccessor; +import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.TransactionUtils; +import org.opendaylight.mdsal.binding.api.DataBroker; +import org.opendaylight.mdsal.common.api.LogicalDatastoreType; +import org.opendaylight.yang.gen.v1.http.org.openroadm.common.alarm.pm.types.rev191129.Direction; +import org.opendaylight.yang.gen.v1.http.org.openroadm.common.alarm.pm.types.rev191129.Location; +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; +import org.opendaylight.yang.gen.v1.http.org.openroadm.pm.rev191129.historical.pm.group.HistoricalPmBuilder; +import org.opendaylight.yang.gen.v1.http.org.openroadm.pm.rev191129.historical.pm.group.HistoricalPmKey; +import org.opendaylight.yang.gen.v1.http.org.openroadm.pm.rev191129.historical.pm.list.HistoricalPmEntry; +import org.opendaylight.yang.gen.v1.http.org.openroadm.pm.rev191129.historical.pm.list.HistoricalPmEntryBuilder; +import org.opendaylight.yang.gen.v1.http.org.openroadm.pm.rev191129.historical.pm.list.HistoricalPmEntryKey; +import org.opendaylight.yang.gen.v1.http.org.openroadm.pm.rev191129.historical.pm.val.group.Measurement; +import org.opendaylight.yang.gen.v1.http.org.openroadm.pm.rev191129.historical.pm.val.group.MeasurementBuilder; +import org.opendaylight.yang.gen.v1.http.org.openroadm.pm.rev191129.historical.pm.val.group.MeasurementKey; +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.PmGranularity; +import org.opendaylight.yang.gen.v1.http.org.openroadm.pm.types.rev191129.PmNamesEnum; +import org.opendaylight.yang.gen.v1.http.org.openroadm.pm.types.rev191129.Validity; +import org.opendaylight.yang.gen.v1.http.org.openroadm.resource.types.rev191129.ResourceTypeEnum; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.units.rev200413.Celsius; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.units.rev200413.PerformanceMeasurementUnitId; +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.Uint64; + +public class TestOpenRoadmPMDataBuilder { + // variables + // end of variables + private NetconfBindingAccessor acessor = mock(NetconfBindingAccessor.class); + private DataBroker dataBroker = mock(DataBroker.class); + private TransactionUtils transactionUtils = mock(TransactionUtils.class); + // String nodeId = "RdmA"; + private PmDataBuilderOpenRoadm pmDataBuilderORoadm; + 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 MeasurementBuilder measurementBuilder = new MeasurementBuilder(); + private HistoricalPmBuilder historicalPmBuilder = new HistoricalPmBuilder(); + private HistoricalPmEntryBuilder historicalPmEntryBuiler = new HistoricalPmEntryBuilder(); + private List<Class<? extends PerformanceMeasurementUnitId>> performanceMeasUnitList = + new ArrayList<Class<? extends PerformanceMeasurementUnitId>>(); + private Map<MeasurementKey, Measurement> measurementData = new HashMap<MeasurementKey, Measurement>(); + private Map<HistoricalPmKey, HistoricalPm> historicalPMCollection = new HashMap<HistoricalPmKey, HistoricalPm>(); + private Map<HistoricalPmEntryKey, HistoricalPmEntry> historicalPmEntryCollection = + new HashMap<HistoricalPmEntryKey, HistoricalPmEntry>(); + + + + // public methods + @Before + public void init() { + when(acessor.getDataBroker()).thenReturn(dataBroker); + when(acessor.getTransactionUtils()).thenReturn(transactionUtils); + + + + } + + @Test + public void testGetPmData() { + when(acessor.getNodeId()).thenReturn(nodeId); + pmDataBuilderORoadm = new PmDataBuilderOpenRoadm(acessor); + + final Class<HistoricalPmList> pmDataClass = HistoricalPmList.class; + InstanceIdentifier<HistoricalPmList> pmDataListId = InstanceIdentifier.builder(pmDataClass).build(); + when(acessor.getTransactionUtils().readData(acessor.getDataBroker(), LogicalDatastoreType.OPERATIONAL, + pmDataListId)).thenReturn(historicalPmDatalist); + + assertEquals(historicalPmDatalist,pmDataBuilderORoadm.getPmData(acessor)); + + } + + @Test + public void testBuildPmDataEntity() { + when(acessor.getNodeId()).thenReturn(nodeId); + pmDataBuilderORoadm = new PmDataBuilderOpenRoadm(acessor); + + performanceMeasUnitList.add(Celsius.class); + measurementBuilder.setBinNumber(Uint16.valueOf(24657)) + .setCompletionTime(new DateAndTime("2020-10-22T15:23:43Z")).setGranularity(PmGranularity._24Hour) + .setPmParameterUnit("dBm").setPmParameterValue(pmDataType).setValidity(Validity.Suspect); + + measurementData.put(measurementBuilder.key(), measurementBuilder.build()); + historicalPmBuilder.setType(PmNamesEnum.SeverelyErroredSeconds).setDirection(Direction.Bidirectional) + .setExtension("sajhsiwiduwugdhegdeuz").setLocation(Location.NearEnd).setMeasurement(measurementData); + when(historicalPm.getMeasurement()).thenReturn(measurementData); + + historicalPMCollection.put(historicalPmBuilder.key(), historicalPmBuilder.build()); + historicalPmEntryBuiler.setPmResourceTypeExtension("dshjdekjdewkk") + .setPmResourceType(ResourceTypeEnum.CircuitPack).setHistoricalPm(historicalPMCollection); + + historicalPmEntryCollection.put(historicalPmEntryBuiler.key(), historicalPmEntryBuiler.build()); + when(historicalPmDatalist.getHistoricalPmEntry()).thenReturn(historicalPmEntryCollection); + + assertNotNull(pmDataBuilderORoadm.buildPmDataEntity(historicalPmDatalist)); + } + @Test + public void testBuildPmDataEntity1() { + when(acessor.getNodeId()).thenReturn(nodeId); + pmDataBuilderORoadm = new PmDataBuilderOpenRoadm(acessor); + + performanceMeasUnitList.add(Celsius.class); + measurementBuilder.setBinNumber(Uint16.valueOf(24657)) + .setCompletionTime(new DateAndTime("2020-10-22T15:23:43Z")).setGranularity(PmGranularity._15min) + .setPmParameterUnit("celsius").setPmParameterValue(pmDataType).setValidity(Validity.Suspect); + + measurementData.put(measurementBuilder.key(), measurementBuilder.build()); + historicalPmBuilder.setType(PmNamesEnum.ErroredSeconds).setDirection(Direction.Rx) + .setExtension("sajhsiwiduwugdhegdeuz").setLocation(Location.FarEnd).setMeasurement(measurementData); + when(historicalPm.getMeasurement()).thenReturn(measurementData); + + historicalPMCollection.put(historicalPmBuilder.key(), historicalPmBuilder.build()); + historicalPmEntryBuiler.setPmResourceTypeExtension("dshjdekjdewkk") + .setPmResourceType(ResourceTypeEnum.Device).setHistoricalPm(historicalPMCollection); + + historicalPmEntryCollection.put(historicalPmEntryBuiler.key(), historicalPmEntryBuiler.build()); + when(historicalPmDatalist.getHistoricalPmEntry()).thenReturn(historicalPmEntryCollection); + + assertNotNull(pmDataBuilderORoadm.buildPmDataEntity(historicalPmDatalist)); + } + // end of public methods + + + // constants + // end of constants + + // variables + // end of variables + + // constructors + // end of constructors + + // getters and setters + // end of getters and setters + + // private methods + // end of private methods + + + // end of public methods + + // static methods + // end of static methods + + // private classes + // end of private classes +} diff --git a/sdnr/wt/devicemanager-onap/openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestOpenroadmNetworkElementBase.java b/sdnr/wt/devicemanager-onap/openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestOpenroadmNetworkElementBase.java new file mode 100644 index 000000000..9a0f1942a --- /dev/null +++ b/sdnr/wt/devicemanager-onap/openroadm/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/devicemanager/openroadm/test/TestOpenroadmNetworkElementBase.java @@ -0,0 +1,62 @@ +/* + * ============LICENSE_START======================================================= + * ONAP : ccsdk features + * ================================================================================ + * Copyright (C) 2020 highstreet technologies GmbH Intellectual Property. + * All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + * + */ +package org.onap.ccsdk.features.sdnr.wt.devicemanager.openroadm.test; + +import static org.junit.Assert.assertNotNull; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; +import org.junit.Before; +import org.junit.Test; +import org.onap.ccsdk.features.sdnr.wt.dataprovider.model.DataProvider; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.openroadm.impl.OpenroadmNetworkElementBase; +import org.onap.ccsdk.features.sdnr.wt.devicemanager.service.DeviceManagerServiceProvider; +import org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice.NetconfBindingAccessor; +import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId; +public class TestOpenroadmNetworkElementBase { + // variables + private NetconfBindingAccessor netconfAccessor = mock(NetconfBindingAccessor.class); + private DeviceManagerServiceProvider deviceManagerSvcProvider = mock(DeviceManagerServiceProvider.class); + private DataProvider databaseService = mock(DataProvider.class); + private NodeId nodeId = new NodeId("RoadmA"); + private OpenroadmNetworkElementBase openRoadmNetElementBase = new OpenroadmNetworkElementBase(netconfAccessor,deviceManagerSvcProvider); + // end of variables + + // public methods + @Before + public void init() { + + when(netconfAccessor.getNodeId()).thenReturn(nodeId); + + } + + @Test + public void testGetNodeId() { + assertNotNull(openRoadmNetElementBase.getNodeId()); + + } + + @Test + public void testGetDeviceType() { + assertNotNull(openRoadmNetElementBase.getDeviceType()); + } + +} diff --git a/sdnr/wt/devicemanager-onap/openroadm/provider/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker b/sdnr/wt/devicemanager-onap/openroadm/provider/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker new file mode 100644 index 000000000..ca6ee9cea --- /dev/null +++ b/sdnr/wt/devicemanager-onap/openroadm/provider/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker @@ -0,0 +1 @@ +mock-maker-inline
\ No newline at end of file diff --git a/sdnr/wt/devicemanager-onap/openroadm/provider/src/test/resources/simplelogger.properties b/sdnr/wt/devicemanager-onap/openroadm/provider/src/test/resources/simplelogger.properties new file mode 100644 index 000000000..9af26dc96 --- /dev/null +++ b/sdnr/wt/devicemanager-onap/openroadm/provider/src/test/resources/simplelogger.properties @@ -0,0 +1,61 @@ +# +# ============LICENSE_START======================================================= +# ONAP : ccsdk features +# ================================================================================ +# Copyright (C) 2020 AT&T Intellectual Property. All rights reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END======================================================= +# +# + +# SLF4J's SimpleLogger configuration file +# Simple implementation of Logger that sends all enabled log messages, for all defined loggers, to System.err. + +# Default logging detail level for all instances of SimpleLogger. +# Must be one of ("trace", "debug", "info", "warn", or "error"). +# If not specified, defaults to "info". +org.slf4j.simpleLogger.defaultLogLevel=info + +# Logging detail level for a SimpleLogger instance named "xxx.yyy.zzz". +# Must be one of ("trace", "debug", "info", "warn", or "error"). +# If not specified, the default logging detail level is used. +# org.slf4j.simpleLogger.log.xxx.yyy=debug +org.slf4j.simpleLogger.log.org.onap.ccsdk.features.sdnr.wt.devicemanager=info +org.slf4j.simpleLogger.log.org.onap.ccsdk.features.sdnr.wt.devicemanager.test=debug +org.slf4j.simpleLogger.log.org.onap.ccsdk.features.sdnr.wt.database=debug +org.slf4j.simpleLogger.log.org.onap.ccsdk.features.sdnr.wt.devicemanager.archiveservice=info +org.slf4j.simpleLogger.log.org.onap.ccsdk.features.sdnr.wt.devicemanager.base.internalTypes.Resources=info +org.slf4j.simpleLogger.log.org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.container=info + +# Set to true if you want the current date and time to be included in output messages. +# Default is false, and will output the number of milliseconds elapsed since startup. +#org.slf4j.simpleLogger.showDateTime=false + +# The date and time format to be used in the output messages. +# The pattern describing the date and time format is the same that is used in java.text.SimpleDateFormat. +# If the format is not specified or is invalid, the default format is used. +# The default format is yyyy-MM-dd HH:mm:ss:SSS Z. +#org.slf4j.simpleLogger.dateTimeFormat=yyyy-MM-dd HH:mm:ss:SSS Z + +# Set to true if you want to output the current thread name. +# Defaults to true. +#org.slf4j.simpleLogger.showThreadName=true + +# Set to true if you want the Logger instance name to be included in output messages. +# Defaults to true. +#org.slf4j.simpleLogger.showLogName=true + +# Set to true if you want the last component of the name to be included in output messages. +# Defaults to false. +#org.slf4j.simpleLogger.showShortLogName=false |