Initial commit of the O1 simulator framework. 32/1332/1
authorAlex Stancu <alexandru.stancu@highstreet-technologies.com>
Sat, 2 Nov 2019 08:38:59 +0000 (10:38 +0200)
committerAlex Stancu <alexandru.stancu@highstreet-technologies.com>
Sat, 2 Nov 2019 08:38:59 +0000 (10:38 +0200)
Signed-off-by: Alex Stancu <alexandru.stancu@highstreet-technologies.com>
Change-Id: Ifdc9e319ef6085354ed5dea637c702652a640a23

96 files changed:
.gitmodules [new file with mode: 0644]
LICENSE [new file with mode: 0644]
README.md [new file with mode: 0644]
docker-build-manager.sh [new file with mode: 0755]
docker-build-model.sh [new file with mode: 0755]
external/Netopeer2 [new submodule]
external/cJSON [new submodule]
external/libnetconf2 [new submodule]
external/libyang [new submodule]
external/pyang [new submodule]
external/sysrepo [new submodule]
ntsimulator/.gitignore [new file with mode: 0644]
ntsimulator/CMakeLists.txt [new file with mode: 0644]
ntsimulator/CMakeModules/FindSYSREPO.cmake [new file with mode: 0644]
ntsimulator/README.md [new file with mode: 0644]
ntsimulator/deploy/Dockerfile [new file with mode: 0644]
ntsimulator/deploy/manager/Dockerfile [new file with mode: 0644]
ntsimulator/deploy/manager/supervisord.conf.manager [new file with mode: 0644]
ntsimulator/deploy/supervisord.conf [new file with mode: 0644]
ntsimulator/docker-build.sh [new file with mode: 0755]
ntsimulator/inc/utils/utils.h [new file with mode: 0644]
ntsimulator/scripts/clean.sh [new file with mode: 0755]
ntsimulator/scripts/configuration.json [new file with mode: 0644]
ntsimulator/scripts/docker-compose.yml [new file with mode: 0644]
ntsimulator/scripts/docker_stats.sh [new file with mode: 0755]
ntsimulator/scripts/model-install.sh.in [new file with mode: 0755]
ntsimulator/scripts/model-uninstall.sh [new file with mode: 0644]
ntsimulator/scripts/model-uninstall.sh.in [new file with mode: 0644]
ntsimulator/scripts/nts_start.sh [new file with mode: 0755]
ntsimulator/scripts/stock_config.xml [new file with mode: 0644]
ntsimulator/scripts/tls/ca.key [new file with mode: 0644]
ntsimulator/scripts/tls/ca.pem [new file with mode: 0644]
ntsimulator/scripts/tls/ca.srl [new file with mode: 0644]
ntsimulator/scripts/tls/client.crt [new file with mode: 0644]
ntsimulator/scripts/tls/client.key [new file with mode: 0644]
ntsimulator/scripts/tls/enable_ssh_key.sh [new file with mode: 0755]
ntsimulator/scripts/tls/enable_tls.sh [new file with mode: 0755]
ntsimulator/scripts/tls/netconf_browser.crt [new file with mode: 0644]
ntsimulator/scripts/tls/netconf_browser.csr [new file with mode: 0644]
ntsimulator/src/CMakeLists.txt [new file with mode: 0644]
ntsimulator/src/ntsimulator-manager/CMakeLists.txt [new file with mode: 0644]
ntsimulator/src/ntsimulator-manager/ntsimulator-manager.c [new file with mode: 0644]
ntsimulator/src/ntsimulator-manager/simulator-operations.c [new file with mode: 0644]
ntsimulator/src/ntsimulator-manager/simulator-operations.h [new file with mode: 0644]
ntsimulator/src/o-ran-notifications/CMakeLists.txt [new file with mode: 0644]
ntsimulator/src/o-ran-notifications/o-ran-notifications.c [new file with mode: 0644]
ntsimulator/src/utils/utils.c [new file with mode: 0644]
ntsimulator/src/ves-messages/CMakeLists.txt [new file with mode: 0644]
ntsimulator/src/ves-messages/heartbeat.c [new file with mode: 0644]
ntsimulator/src/ves-messages/heartbeat.h [new file with mode: 0644]
ntsimulator/yang/auto-load-yangs.sh [new file with mode: 0755]
ntsimulator/yang/iana-hardware.yang [new file with mode: 0755]
ntsimulator/yang/iana-if-type.yang [new file with mode: 0644]
ntsimulator/yang/ietf-crypto-types.yang [new file with mode: 0644]
ntsimulator/yang/ietf-dhcpv6-types.yang [new file with mode: 0644]
ntsimulator/yang/ietf-hardware.yang [new file with mode: 0755]
ntsimulator/yang/ietf-inet-types.yang [new file with mode: 0755]
ntsimulator/yang/ietf-interfaces.yang [new file with mode: 0644]
ntsimulator/yang/ietf-ip.yang [new file with mode: 0644]
ntsimulator/yang/ietf-netconf-acm.yang [new file with mode: 0644]
ntsimulator/yang/ietf-netconf-monitoring.yang [new file with mode: 0644]
ntsimulator/yang/ietf-yang-types.yang [new file with mode: 0755]
ntsimulator/yang/manager/network-topology-simulator.xml [new file with mode: 0644]
ntsimulator/yang/manager/network-topology-simulator.yang [new file with mode: 0644]
ntsimulator/yang/o-ran-alarm-id.yang [new file with mode: 0644]
ntsimulator/yang/o-ran-ald-port.yang [new file with mode: 0644]
ntsimulator/yang/o-ran-ald.yang [new file with mode: 0644]
ntsimulator/yang/o-ran-beamforming.yang [new file with mode: 0644]
ntsimulator/yang/o-ran-compression-factors.yang [new file with mode: 0644]
ntsimulator/yang/o-ran-delay-management.yang [new file with mode: 0644]
ntsimulator/yang/o-ran-dhcp.yang [new file with mode: 0644]
ntsimulator/yang/o-ran-ecpri-delay.yang [new file with mode: 0644]
ntsimulator/yang/o-ran-externalio.yang [new file with mode: 0644]
ntsimulator/yang/o-ran-fan.yang [new file with mode: 0644]
ntsimulator/yang/o-ran-file-management.yang [new file with mode: 0644]
ntsimulator/yang/o-ran-fm.yang [new file with mode: 0644]
ntsimulator/yang/o-ran-hardware.yang [new file with mode: 0644]
ntsimulator/yang/o-ran-interfaces.yang [new file with mode: 0644]
ntsimulator/yang/o-ran-laa-operations.yang [new file with mode: 0644]
ntsimulator/yang/o-ran-laa.yang [new file with mode: 0644]
ntsimulator/yang/o-ran-lbm.yang [new file with mode: 0644]
ntsimulator/yang/o-ran-module-cap.yang [new file with mode: 0644]
ntsimulator/yang/o-ran-mplane-int.yang [new file with mode: 0644]
ntsimulator/yang/o-ran-operations.yang [new file with mode: 0644]
ntsimulator/yang/o-ran-performance-management.yang [new file with mode: 0644]
ntsimulator/yang/o-ran-processing-element.yang [new file with mode: 0644]
ntsimulator/yang/o-ran-software-management.yang [new file with mode: 0644]
ntsimulator/yang/o-ran-supervision.yang [new file with mode: 0644]
ntsimulator/yang/o-ran-sync.yang [new file with mode: 0644]
ntsimulator/yang/o-ran-trace.yang [new file with mode: 0644]
ntsimulator/yang/o-ran-transceiver.yang [new file with mode: 0644]
ntsimulator/yang/o-ran-troubleshooting.yang [new file with mode: 0644]
ntsimulator/yang/o-ran-udp-echo.yang [new file with mode: 0644]
ntsimulator/yang/o-ran-uplane-conf.yang [new file with mode: 0644]
ntsimulator/yang/o-ran-usermgmt.yang [new file with mode: 0644]
ntsimulator/yang/sysrepo-configuration-load.sh [new file with mode: 0755]

diff --git a/.gitmodules b/.gitmodules
new file mode 100644 (file)
index 0000000..ab5ecfa
--- /dev/null
@@ -0,0 +1,18 @@
+[submodule "cJSON"]
+       path = external/cJSON
+       url = https://github.com/Melacon/cJSON.git
+[submodule "libnetconf2"]
+       path = external/libnetconf2
+       url = https://github.com/Melacon/libnetconf2.git
+[submodule "libyang"]
+       path = external/libyang
+       url = https://github.com/Melacon/libyang.git
+[submodule "Netopeer2"]
+       path = external/Netopeer2
+       url = https://github.com/Melacon/Netopeer2.git
+[submodule "pyang"]
+       path = external/pyang
+       url = https://github.com/Melacon/pyang.git
+[submodule "sysrepo"]
+       path = external/sysrepo
+       url = https://github.com/Melacon/sysrepo.git
diff --git a/LICENSE b/LICENSE
new file mode 100644 (file)
index 0000000..261eeb9
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,201 @@
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   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.
diff --git a/README.md b/README.md
new file mode 100644 (file)
index 0000000..a3a7770
--- /dev/null
+++ b/README.md
@@ -0,0 +1 @@
+Network Topology Simulator (NTS)
\ No newline at end of file
diff --git a/docker-build-manager.sh b/docker-build-manager.sh
new file mode 100755 (executable)
index 0000000..6a61958
--- /dev/null
@@ -0,0 +1 @@
+docker build --build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') -t ntsim_manager -f ntsimulator/deploy/manager/Dockerfile .
diff --git a/docker-build-model.sh b/docker-build-model.sh
new file mode 100755 (executable)
index 0000000..b307c53
--- /dev/null
@@ -0,0 +1 @@
+docker build --build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') -t ntsim_oran -f ntsimulator/deploy/Dockerfile .
diff --git a/external/Netopeer2 b/external/Netopeer2
new file mode 160000 (submodule)
index 0000000..7807801
--- /dev/null
@@ -0,0 +1 @@
+Subproject commit 78078018e37f44c618b729b6763f9c9c291f27ca
diff --git a/external/cJSON b/external/cJSON
new file mode 160000 (submodule)
index 0000000..a766613
--- /dev/null
@@ -0,0 +1 @@
+Subproject commit a7666138a80552204c223dcb17cc2584edea5f87
diff --git a/external/libnetconf2 b/external/libnetconf2
new file mode 160000 (submodule)
index 0000000..795858f
--- /dev/null
@@ -0,0 +1 @@
+Subproject commit 795858fb1c9db6c82e9b8317a88d61803c74ac2d
diff --git a/external/libyang b/external/libyang
new file mode 160000 (submodule)
index 0000000..2c69ec1
--- /dev/null
@@ -0,0 +1 @@
+Subproject commit 2c69ec1cb0989eb87eea8c74e4d22b883a9e6839
diff --git a/external/pyang b/external/pyang
new file mode 160000 (submodule)
index 0000000..f227116
--- /dev/null
@@ -0,0 +1 @@
+Subproject commit f2271165b11b0aa71d1d32b9e439836a2bf718df
diff --git a/external/sysrepo b/external/sysrepo
new file mode 160000 (submodule)
index 0000000..6ae556a
--- /dev/null
@@ -0,0 +1 @@
+Subproject commit 6ae556a91d8c3fd1935b44dbfeae9211ecd21308
diff --git a/ntsimulator/.gitignore b/ntsimulator/.gitignore
new file mode 100644 (file)
index 0000000..4be233c
--- /dev/null
@@ -0,0 +1,55 @@
+# Prerequisites
+*.d
+
+# Object files
+*.o
+*.ko
+*.obj
+*.elf
+
+# Linker output
+*.ilk
+*.map
+*.exp
+
+# Precompiled Headers
+*.gch
+*.pch
+
+# Libraries
+*.lib
+*.a
+*.la
+*.lo
+
+# Shared objects (inc. Windows DLLs)
+*.dll
+*.so
+*.so.*
+*.dylib
+
+# Executables
+*.exe
+*.out
+*.app
+*.i*86
+*.x86_64
+*.hex
+
+# Debug files
+*.dSYM/
+*.su
+*.idb
+*.pdb
+
+# Kernel Module Compile Results
+*.mod*
+*.cmd
+.tmp_versions/
+modules.order
+Module.symvers
+Mkfile.old
+dkms.conf
+.cproject
+.project
+build
\ No newline at end of file
diff --git a/ntsimulator/CMakeLists.txt b/ntsimulator/CMakeLists.txt
new file mode 100644 (file)
index 0000000..3d3c52c
--- /dev/null
@@ -0,0 +1,95 @@
+cmake_minimum_required(VERSION 2.8.12)
+project(ntsimulator)
+set(PROJECT_DESC "Network Topology Simulator using sysrepo and netopeer2")
+include(GNUInstallDirs)
+
+# setup version
+set(NTSIMULATOR_MAJOR_VERSION 1)
+set(NTSIMULATOR_MINOR_VERSION 1)
+set(NTSIMULATOR_PATCH_VERSION 1)
+set(NTSIMULATOR_VERSION ${NTSIMULATOR_MAJOR_VERSION}.${NTSIMULATOR_MINOR_VERSION}.${NTSIMULATOR_PATCH_VERSION})
+set(NTSIMULATOR_SOVERSION ${NTSIMULATOR_MAJOR_VERSION}.${NTSIMULATOR_MINOR_VERSION})
+
+# osx specific
+set(CMAKE_MACOSX_RPATH TRUE)
+
+# set default build type if not specified by user
+if(NOT CMAKE_BUILD_TYPE)
+    set(CMAKE_BUILD_TYPE debug)
+endif()
+string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LOWER)
+
+set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
+
+set(CMAKE_C_FLAGS         "${CMAKE_C_FLAGS} -Wall -Wpedantic -std=gnu11 -Wno-language-extension-token")
+if(CMAKE_COMPILER_IS_GNUCC)
+    # disable strict aliasing in GCC, since it produces false alarams in libev
+    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-strict-aliasing")
+endif()
+set(CMAKE_C_FLAGS_RELEASE "-DNDEBUG -O2")
+set(CMAKE_C_FLAGS_DEBUG   "-g -O0")
+
+if(NOT UNIX)
+    message(FATAL_ERROR "Only Unix-like systems are supported.")
+endif()
+
+if(NOT DEFINED IS_DEVELOPER_CONFIGURATION)
+    if(CMAKE_BUILD_TYPE_LOWER MATCHES "debug" AND NOT CMAKE_BUILD_TYPE_LOWER MATCHES "^rel")
+        set(IS_DEVELOPER_CONFIGURATION true)
+    else()
+        set(IS_DEVELOPER_CONFIGURATION false)
+    endif()
+endif()
+
+# location of system repository
+if(${IS_DEVELOPER_CONFIGURATION})
+    set(REPOSITORY_LOC "${CMAKE_BINARY_DIR}/repository" CACHE PATH "System repository location, contains configuration schema and data files.")
+else()
+    set(REPOSITORY_LOC "/etc/sysrepo" CACHE PATH "System repository location, contains configuration schema and data files.")
+endif()
+
+# include custom Modules
+set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/CMakeModules/")
+include_directories(${CMAKE_CURRENT_BINARY_DIR})
+include_directories("${CMAKE_CURRENT_SOURCE_DIR}/inc")
+
+# find required libraries
+find_package(SYSREPO REQUIRED)
+include_directories(${SYSREPO_INCLUDE_DIR})
+
+# add subdirectories
+add_subdirectory(src)
+
+# Configure install file
+configure_file("${CMAKE_CURRENT_SOURCE_DIR}/scripts/model-install.sh.in" "${PROJECT_BINARY_DIR}/model-install.sh" ESCAPE_QUOTES @ONLY)
+
+# find sysrepoctl
+if (NOT SYSREPOCTL_EXECUTABLE)
+    find_program(SYSREPOCTL_EXECUTABLE sysrepoctl)
+endif()
+if (NOT SYSREPOCTL_EXECUTABLE)
+    message(FATAL_ERROR "Unable to find sysrepoctl, set SYSREPOCTL_EXECUTABLE manually.")
+endif()
+
+# find sysrepocfg
+if (NOT SYSREPOCFG_EXECUTABLE)
+    find_program(SYSREPOCFG_EXECUTABLE sysrepocfg)
+endif()
+if (NOT SYSREPOCFG_EXECUTABLE)
+    message(FATAL_ERROR "Unable to find sysrepocfg, set SYSREPOCFG_EXECUTABLE manually.")
+endif()
+
+# Command line options to be passed to `sysrepoctl` when working with modules
+# which should only be accessible by an administrator
+if (NOT SYSREPOCTL_ROOT_PERMS)
+    set(SYSREPOCTL_ROOT_PERMS "-o root:root -p 600")
+endif()
+
+install(CODE "
+    set(ENV{SYSREPOCTL} ${SYSREPOCTL_EXECUTABLE})
+    set(ENV{SYSREPOCFG} ${SYSREPOCFG_EXECUTABLE})
+    set(ENV{SYSREPOCTL_ROOT_PERMS} SYSREPOCTL_ROOT_PERMS)
+    execute_process(COMMAND ${PROJECT_BINARY_DIR}/model-install.sh)")
+
+
+
diff --git a/ntsimulator/CMakeModules/FindSYSREPO.cmake b/ntsimulator/CMakeModules/FindSYSREPO.cmake
new file mode 100644 (file)
index 0000000..7bce85c
--- /dev/null
@@ -0,0 +1,26 @@
+#  SYSREPO_FOUND - System has libsysrepo
+#  SYSREPO_INCLUDE_DIRS - The libsysrepo include directories
+#  SYSREPO_LIBRARIES - The libraries needed to use libsysrepo
+#  SYSREPO_DEFINITIONS - Compiler switches required for using libsysrepo
+
+find_package(PkgConfig QUIET)
+if(PKG_CONFIG_FOUND)
+    pkg_check_modules(PC_SYSREPO QUIET sysrepo)
+    set(SYSREPO_DEFINITIONS ${PC_SYSREPO_CFLAGS_OTHER})
+endif()
+
+find_path(SYSREPO_INCLUDE_DIR sysrepo.h
+          HINTS ${PC_SYSREPO_INCLUDEDIR} ${PC_SYSREPO_INCLUDE_DIRS}
+          PATH_SUFFIXES sysrepo)
+
+find_library(SYSREPO_LIBRARY NAMES sysrepo 
+             HINTS ${PC_SYSREPO_LIBDIR} ${PC_SYSREPO_LIBRARY_DIRS})
+
+set(SYSREPO_LIBRARIES ${SYSREPO_LIBRARY} )
+set(SYSREPO_INCLUDE_DIRS ${SYSREPO_INCLUDE_DIR})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(sysrepo  DEFAULT_MSG
+                                  SYSREPO_LIBRARY SYSREPO_INCLUDE_DIR)
+
+mark_as_advanced(SYSREPO_INCLUDE_DIR SYSREPO_LIBRARY)
diff --git a/ntsimulator/README.md b/ntsimulator/README.md
new file mode 100644 (file)
index 0000000..ddadd00
--- /dev/null
@@ -0,0 +1,2 @@
+# ntsimulator
+Network Topology Simulator
diff --git a/ntsimulator/deploy/Dockerfile b/ntsimulator/deploy/Dockerfile
new file mode 100644 (file)
index 0000000..b5457b5
--- /dev/null
@@ -0,0 +1,160 @@
+FROM ubuntu:18.04
+
+MAINTAINER alexandru.stancu@highstreet-technologies.com
+
+LABEL maintainer="alexandru.stancu@highstreet-technologies.com"
+
+#ARG BUILD_DATE
+
+#LABEL build-date=$BUILD_DATE
+
+RUN \
+      apt-get update && apt-get install -y \
+      # general tools
+      git \
+      cmake \
+      build-essential \
+      vim \
+      supervisor \
+      # libyang
+      libpcre3-dev \
+      pkg-config \
+      # sysrepo
+      libavl-dev \
+      libev-dev \
+      libprotobuf-c-dev \
+      protobuf-c-compiler \
+      # netopeer2 \
+      libssh-dev \
+      libssl-dev \
+      # bindings
+      swig \
+      python-dev \
+      libcurl4 \
+      libcurl4-openssl-dev \
+      curl \
+      bc \
+      python-setuptools \
+      python-pip
+
+# add netconf user
+RUN \
+      adduser --system netconf && \
+      echo "netconf:netconf" | chpasswd
+
+# generate ssh keys for netconf user
+RUN \
+      mkdir -p /home/netconf/.ssh && \
+      ssh-keygen -A && \
+      ssh-keygen -t dsa -P '' -f /home/netconf/.ssh/id_dsa && \
+      cat /home/netconf/.ssh/id_dsa.pub > /home/netconf/.ssh/authorized_keys && \
+#echo "Host *\n    StrictHostKeyChecking accept-new" >> /home/netconf/.ssh/config
+      echo "    StrictHostKeyChecking no" >> /etc/ssh/ssh_config && \
+      mkdir -p /root/.ssh && \
+      cat /home/netconf/.ssh/id_dsa.pub > /root/.ssh/authorized_keys
+       
+# use /opt/dev as working directory
+RUN mkdir /opt/dev
+WORKDIR /opt/dev
+
+# libcjson
+COPY ./cJSON /opt/dev/cJSON
+RUN \
+      cd cJSON && mkdir build && cd build && \
+      cmake .. -DENABLE_CJSON_UTILS=On -DENABLE_CJSON_TEST=Off -DCMAKE_INSTALL_PREFIX=/usr .. && \
+      make -j2 && \
+      make install && \
+      ldconfig
+
+# libyang
+COPY ./libyang /opt/dev/libyang
+RUN \
+      cd libyang && mkdir build && cd build && \
+      cmake -DCMAKE_BUILD_TYPE:String="Release" -DENABLE_BUILD_TESTS=OFF .. && \
+      make -j2 && \
+      make install && \
+      ldconfig
+
+# sysrepo
+COPY ./sysrepo /opt/dev/sysrepo
+RUN \
+      sed -i 's/#define MAX_BLOCKS_AVAIL_FOR_ALLOC    3/#define MAX_BLOCKS_AVAIL_FOR_ALLOC    6/g' ./sysrepo/src/common/sr_mem_mgmt.h && \
+      cd sysrepo && mkdir build && cd build && \
+      cmake -DCMAKE_BUILD_TYPE:String="Release" -DENABLE_TESTS=OFF -DREPOSITORY_LOC:PATH=/etc/sysrepo -DREQUEST_TIMEOUT=60 -DOPER_DATA_PROVIDE_TIMEOUT=60 .. && \
+      make -j2 && \
+      make install && \
+      ldconfig
+
+# libnetconf2
+COPY ./libnetconf2 /opt/dev/libnetconf2
+RUN \
+      cd libnetconf2 && mkdir build && cd build && \
+      cmake -DCMAKE_BUILD_TYPE:String="Release" -DENABLE_BUILD_TESTS=OFF .. && \
+      make -j2 && \
+      make install && \
+      ldconfig
+
+# keystore
+COPY ./Netopeer2 /opt/dev/Netopeer2
+RUN \
+      cd /opt/dev && \
+      cd Netopeer2 && \
+      cd keystored && mkdir build && cd build && \
+      cmake -DCMAKE_BUILD_TYPE:String="Release" .. && \
+      make -j2 && \
+      make install && \
+      ldconfig
+
+# overwrite number of endpoints exposed by the NETCONF server
+COPY ./ntsimulator/scripts/stock_config.xml /opt/dev/Netopeer2/server/stock_config.xml
+# netopeer2
+RUN \
+      cd /opt/dev && \
+      cd Netopeer2/server && mkdir build && cd build && \
+      cmake -DCMAKE_BUILD_TYPE:String="Release" .. && \
+      make -j2 && \
+      make install && \
+      cd ../../cli && mkdir build && cd build && \
+      cmake -DCMAKE_BUILD_TYPE:String="Release" .. && \
+      make -j2 && \
+      make install
+
+RUN pip install rstr && pip install exrex && pip install ipaddress
+         
+COPY ./pyang /opt/dev/pyang
+RUN \
+         cd /opt/dev && \
+         cd pyang && python setup.py build && python setup.py install
+         
+#NTSimulator Manager - notifications
+COPY ./ntsimulator /opt/dev/ntsimulator
+RUN \
+      cd /opt/dev && \
+      cd ntsimulator && mkdir build  && cd build && \
+      cmake .. && \
+      make -j2&& \
+      make install
+
+COPY ntsimulator/deploy/supervisord.conf /etc/supervisord.conf
+
+COPY ./ntsimulator/scripts/tls /home/netconf/.ssh
+
+COPY ./ntsimulator/yang /opt/dev/yang
+WORKDIR /opt/dev
+RUN \
+         cd yang && \
+         ./auto-load-yangs.sh
+         
+ENV EDITOR vim
+EXPOSE 830
+EXPOSE 831
+EXPOSE 832
+EXPOSE 833
+EXPOSE 834
+EXPOSE 835
+EXPOSE 836
+EXPOSE 837
+EXPOSE 838
+EXPOSE 839
+
+CMD ["sh", "-c", "/usr/bin/supervisord -c /etc/supervisord.conf"]
diff --git a/ntsimulator/deploy/manager/Dockerfile b/ntsimulator/deploy/manager/Dockerfile
new file mode 100644 (file)
index 0000000..2ceef5f
--- /dev/null
@@ -0,0 +1,138 @@
+FROM ubuntu:18.04
+
+MAINTAINER alexandru.stancu@highstreet-technologies.com
+LABEL maintainer="alexandru.stancu@highstreet-technologies.com"
+
+#ARG BUILD_DATE
+#LABEL build-date=$BUILD_DATE
+
+ENV NETCONF_BASE=40000
+ENV NTS_IP="127.0.0.1"
+ENV SCRIPTS_DIR=/opt/dev/scripts
+ENV DOCKER_ENGINE_VERSION="1.40"
+ENV MODELS_IMAGE="ntsim_oran"
+
+RUN \
+      apt-get update && apt-get install -y \
+      # general tools
+      git \
+      cmake \
+      build-essential \
+      vim \
+      supervisor \
+      # libyang
+      libpcre3-dev \
+      pkg-config \
+      # sysrepo
+      libavl-dev \
+      libev-dev \
+      libprotobuf-c-dev \
+      protobuf-c-compiler \
+      # netopeer2 \
+      libssh-dev \
+      libssl-dev \
+      # bindings
+      swig \
+      python-dev \
+      libcurl4 \
+      libcurl4-openssl-dev \
+      curl \
+      bc \
+      python-setuptools \
+      python-pip
+
+# add netconf user
+RUN \
+      adduser --system netconf && \
+      echo "netconf:netconf" | chpasswd
+
+# generate ssh keys for netconf user
+RUN \
+      mkdir -p /home/netconf/.ssh && \
+      ssh-keygen -A && \
+      ssh-keygen -t dsa -P '' -f /home/netconf/.ssh/id_dsa && \
+      cat /home/netconf/.ssh/id_dsa.pub > /home/netconf/.ssh/authorized_keys && \
+#echo "Host *\n    StrictHostKeyChecking accept-new" >> /home/netconf/.ssh/config
+      echo "    StrictHostKeyChecking no" >> /etc/ssh/ssh_config && \
+      mkdir -p /root/.ssh && \
+      cat /home/netconf/.ssh/id_dsa.pub > /root/.ssh/authorized_keys
+       
+# use /opt/dev as working directory
+RUN mkdir /opt/dev
+WORKDIR /opt/dev
+
+# libcjson
+COPY ./cJSON /opt/dev/cJSON
+RUN \
+      cd cJSON && mkdir build && cd build && \
+      cmake .. -DENABLE_CJSON_UTILS=On -DENABLE_CJSON_TEST=Off -DCMAKE_INSTALL_PREFIX=/usr .. && \
+      make -j2 && \
+      make install && \
+      ldconfig
+
+# libyang
+COPY ./libyang /opt/dev/libyang
+RUN \
+      cd libyang && mkdir build && cd build && \
+      cmake -DCMAKE_BUILD_TYPE:String="Release" -DENABLE_BUILD_TESTS=OFF .. && \
+      make -j2 && \
+      make install && \
+      ldconfig
+
+# sysrepo
+COPY ./sysrepo /opt/dev/sysrepo
+RUN \
+      sed -i 's/#define MAX_BLOCKS_AVAIL_FOR_ALLOC    3/#define MAX_BLOCKS_AVAIL_FOR_ALLOC    6/g' ./sysrepo/src/common/sr_mem_mgmt.h && \
+      cd sysrepo && mkdir build && cd build && \
+      cmake -DCMAKE_BUILD_TYPE:String="Release" -DENABLE_TESTS=OFF -DREPOSITORY_LOC:PATH=/etc/sysrepo -DREQUEST_TIMEOUT=60 -DOPER_DATA_PROVIDE_TIMEOUT=60 .. && \
+      make -j2 && \
+      make install && \
+      ldconfig
+
+# libnetconf2
+COPY ./libnetconf2 /opt/dev/libnetconf2
+RUN \
+      cd libnetconf2 && mkdir build && cd build && \
+      cmake -DCMAKE_BUILD_TYPE:String="Release" -DENABLE_BUILD_TESTS=OFF .. && \
+      make -j2 && \
+      make install && \
+      ldconfig
+
+# keystore
+COPY ./Netopeer2 /opt/dev/Netopeer2
+RUN \
+      cd /opt/dev && \
+      cd Netopeer2 && \
+      cd keystored && mkdir build && cd build && \
+      cmake -DCMAKE_BUILD_TYPE:String="Release" .. && \
+      make -j2 && \
+      make install && \
+      ldconfig
+
+# netopeer2
+RUN \
+      cd /opt/dev && \
+      cd Netopeer2/server && mkdir build && cd build && \
+      cmake -DCMAKE_BUILD_TYPE:String="Release" .. && \
+      make -j2 && \
+      make install && \
+      cd ../../cli && mkdir build && cd build && \
+      cmake -DCMAKE_BUILD_TYPE:String="Release" .. && \
+      make -j2 && \
+      make install
+
+#NTSimulator Manager
+COPY ./ntsimulator /opt/dev/ntsimulator
+RUN \
+      cd /opt/dev && \
+      cd ntsimulator && mkdir build  && cd build && \
+      cmake .. && \
+      make -j2 && \
+      make install
+
+COPY ntsimulator/deploy/manager/supervisord.conf.manager /etc/supervisord.conf
+         
+ENV EDITOR vim
+EXPOSE 830
+
+CMD ["sh", "-c", "/usr/bin/supervisord -c /etc/supervisord.conf"]
diff --git a/ntsimulator/deploy/manager/supervisord.conf.manager b/ntsimulator/deploy/manager/supervisord.conf.manager
new file mode 100644 (file)
index 0000000..127b6c4
--- /dev/null
@@ -0,0 +1,28 @@
+[supervisord]
+nodaemon=true
+logfile=/var/log/supervisord.log
+loglevel=debug
+
+[program:sysrepod]
+command=/usr/local/bin/sysrepod -d
+autorestart=true
+redirect_stderr=true
+priority=1
+
+[program:sysrepo-plugind]
+command=/usr/local/bin/sysrepo-plugind -d
+autorestart=true
+redirect_stderr=true
+priority=2
+
+[program:netopeer2-server]
+command=/usr/local/bin/netopeer2-server -d
+autorestart=true
+redirect_stderr=true
+priority=3
+
+[program:ntsimulator-manager]
+command=/usr/local/bin/ntsimulator-manager
+autorestart=true
+redirect_stderr=true
+priority=4
\ No newline at end of file
diff --git a/ntsimulator/deploy/supervisord.conf b/ntsimulator/deploy/supervisord.conf
new file mode 100644 (file)
index 0000000..e136beb
--- /dev/null
@@ -0,0 +1,50 @@
+[supervisord]
+nodaemon=true
+logfile=/var/log/supervisord.log
+loglevel=debug
+
+[program:sysrepod]
+command=/usr/local/bin/sysrepod -d
+autorestart=true
+redirect_stderr=true
+priority=1
+
+[program:sysrepo-plugind]
+command=/usr/local/bin/sysrepo-plugind -d
+autorestart=true
+redirect_stderr=true
+priority=2
+
+[program:netopeer2-server]
+command=/usr/local/bin/netopeer2-server -d
+autorestart=true
+redirect_stderr=true
+priority=3
+
+[program:sysrepo-config-load]
+directory=/opt/dev/yang
+command=/opt/dev/yang/sysrepo-configuration-load.sh
+autorestart=false
+redirect_stderr=true
+startretries=1
+priority=5
+
+[program:o-ran-notifications]
+command=/usr/local/bin/o-ran-notifications
+autorestart=true
+redirect_stderr=true
+priority=6
+
+[program:ves-heartbeat]
+command=/usr/local/bin/ves-heartbeat
+autorestart=true
+redirect_stderr=true
+priority=7
+
+[program:enable-tls]
+directory=/home/netconf/.ssh
+command=/home/netconf/.ssh/enable_tls.sh
+startsecs=0
+autorestart=false
+redirect_stderr=false
+priority=101
\ No newline at end of file
diff --git a/ntsimulator/docker-build.sh b/ntsimulator/docker-build.sh
new file mode 100755 (executable)
index 0000000..3c5adef
--- /dev/null
@@ -0,0 +1 @@
+docker build -t ntsimautogen -f deploy/Dockerfile .
diff --git a/ntsimulator/inc/utils/utils.h b/ntsimulator/inc/utils/utils.h
new file mode 100644 (file)
index 0000000..ceee130
--- /dev/null
@@ -0,0 +1,68 @@
+/*
+ * utils.h
+ *
+ *  Created on: Feb 19, 2019
+ *      Author: parallels
+ */
+
+#ifndef EXAMPLES_NTSIMULATOR_UTILS_H_
+#define EXAMPLES_NTSIMULATOR_UTILS_H_
+
+#include "sysrepo.h"
+#include "sysrepo/values.h"
+#include "sysrepo/xpath.h"
+
+#include <curl/curl.h>
+#include <stdlib.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <cjson/cJSON.h>
+
+#define TRUE 1
+#define FALSE 0
+
+#define NETCONF_CONNECTIONS_PER_DEVICE 10
+
+#define PREPARE_ADD_NEW_VALUE(v, num)  {\
+                                                                               num++;\
+                                                                               }
+
+#define CREATE_NEW_VALUE(rc, v, num)   {\
+                                                                               rc = sr_realloc_values(num, num+1, &v);\
+                                                                               if (SR_ERR_OK != rc) {\
+                                                                                       return rc;\
+                                                                               }\
+                                                                               num++;\
+                                                                               }
+
+void           set_curl_common_info_ves(CURL *curl);
+
+long           random_at_most(long max);
+void           getCurrentDateAndTime(char *date_and_time);
+int            getSecondsFromLastQuarterInterval(void);
+int            getSecondsFromLastDayInterval(void);
+void           getPreviousQuarterInterval(int number_of_intervals, char *date_and_time);
+void           getPreviousDayPmTimestamp(int number_of_intervals, char *date_and_time);
+long int       getMicrosecondsSinceEpoch(void);
+void           prepare_ves_message_curl(CURL *curl);
+
+cJSON* vesCreateCommonEventHeader(char *domain, char *event_type, char *source_name, int seq_id);
+cJSON* vesCreateHeartbeatFields(int heartbeat_interval);
+cJSON* vesCreatePnfRegistrationFields(int port, bool is_tls);
+cJSON* vesCreateFaultFields(char *alarm_condition, char *alarm_object, char *severity, char *date_time, char *specific_problem);
+
+char*  readConfigFileInString(void);
+void   writeConfigFile(char *config);
+
+int    getFaultNotificationDelayPeriodFromConfigJson(void);
+int    getVesHeartbeatPeriodFromConfigJson(void);
+char*  getVesAuthMethodFromConfigJson(void);
+char*  getVesIpFromConfigJson(void);
+int    getVesPortFromConfigJson(void);
+int    getVesRegistrationFromConfigJson(void);
+int    getNetconfAvailableFromConfigJson(void);
+int    getVesAvailableFromConfigJson(void);
+
+void   generateRandomMacAddress(char *mac_address);
+
+#endif /* EXAMPLES_NTSIMULATOR_UTILS_H_ */
diff --git a/ntsimulator/scripts/clean.sh b/ntsimulator/scripts/clean.sh
new file mode 100755 (executable)
index 0000000..cc4daf7
--- /dev/null
@@ -0,0 +1,25 @@
+#/bin/bash
+
+echo "Cleaning up..."
+
+mapfile -t NTS_containers < <( docker ps -a --filter "label=NTS" --format "{{.ID}}" )
+
+CONTAINERS=""
+
+if [ ${#NTS_containers[@]} -gt 0 ]
+then
+
+       for container in "${NTS_containers[@]}"
+       do
+               CONTAINERS="$CONTAINERS $container"
+       done
+       echo "Cleaning up ontainers: $CONTAINERS"
+       docker kill $CONTAINERS > /dev/null 2>&1
+       docker rm $CONTAINERS > /dev/null 2>&1
+fi
+
+echo "Cleaning NTS Manager container"
+docker kill NTS_Manager > /dev/null 2>&1
+docker rm NTS_Manager > /dev/null 2>&1
+
+echo "All cleaned up!"
diff --git a/ntsimulator/scripts/configuration.json b/ntsimulator/scripts/configuration.json
new file mode 100644 (file)
index 0000000..7587cad
--- /dev/null
@@ -0,0 +1,17 @@
+{
+       "notification-config":  {
+               "fault-notification-delay-period":      0,
+               "ves-heartbeat-period": 0,
+               "is-netconf-available": true,
+               "is-ves-available":     true
+       },
+       "ves-endpoint-details": {
+               "ves-endpoint-ip":      "172.17.0.1",
+               "ves-endpoint-port":    30007,
+               "ves-endpoint-auth-method":     "no-auth",
+               "ves-endpoint-username":        "",
+               "ves-endpoint-password":        "",
+               "ves-endpoint-certificate":     "",
+               "ves-registration":     false
+       }
+}
\ No newline at end of file
diff --git a/ntsimulator/scripts/docker-compose.yml b/ntsimulator/scripts/docker-compose.yml
new file mode 100644 (file)
index 0000000..14741b7
--- /dev/null
@@ -0,0 +1,19 @@
+version: '3'
+services:
+  ntsimulator:
+    image: "ntsim_manager:latest"
+    container_name: NTS_Manager
+    ports:
+     - "172.17.0.1:8300:830"
+    volumes:
+     - "/var/run/docker.sock:/var/run/docker.sock"
+     - "/home/parallels/workspace/highstreet/ntsimulator-o-ran/ntsimulator/scripts:/opt/dev/scripts"
+     - "/usr/bin/docker:/usr/bin/docker"
+    labels:
+      "NTS-manager": ""
+    environment:
+      NTS_IP: "172.17.0.1"
+      NETCONF_BASE: 50000
+      DOCKER_ENGINE_VERSION: "1.40"
+      MODELS_IMAGE: "ntsim_oran"
+
diff --git a/ntsimulator/scripts/docker_stats.sh b/ntsimulator/scripts/docker_stats.sh
new file mode 100755 (executable)
index 0000000..05d6309
--- /dev/null
@@ -0,0 +1,39 @@
+#!/bin/bash
+
+# This script is used to complete the output of the docker stats command.
+# The docker stats command does not compute the total amount of resources (RAM or CPU)
+
+# Get the output of the docker stat command. Will be displayed at the end
+# Without modifying the special variable IFS the ouput of the docker stats command won't have
+CPU_CORES=`nproc`
+# the new lines thus resulting in a failure when using awk to process each line
+IFS=;
+mapfile -t DOCKER_PS_RESULT < <(/usr/bin/docker ps --all --format "{{.ID}}" --filter "label=NTS")
+
+CONTAINERS=""
+
+if [ ${#DOCKER_PS_RESULT[@]} -gt 0 ]
+then
+
+       for container in "${DOCKER_PS_RESULT[@]}"
+       do
+               CONTAINERS="$CONTAINERS $container"
+       done
+fi
+
+if [ -z "$CONTAINERS" ]
+then
+       CPU_SCALED=0
+       SUM_RAM=0
+else
+       DOCKER_STATS_COMMAND="/usr/bin/docker stats --no-stream --format \"table {{.CPUPerc}}\t{{.MemUsage}}\" ${CONTAINERS}"
+       DOCKER_STATS_COMMAND_RESULT=$(eval "$DOCKER_STATS_COMMAND")
+
+       SUM_CPU=`echo $DOCKER_STATS_COMMAND_RESULT | tail -n +2 | sed "s/%//g" | awk '{s+=$1} END {print s}'`
+       SUM_RAM=`echo $DOCKER_STATS_COMMAND_RESULT | tail -n +2 | sed "s/%//g" | awk '{s+=$2} END {print s}'`
+
+       CPU_SCALED=$(echo "scale=2; $SUM_CPU/$CPU_CORES" | bc)
+fi
+
+# Output the result
+echo -e "CPU=${CPU_SCALED}%;RAM=${SUM_RAM}MiB"
\ No newline at end of file
diff --git a/ntsimulator/scripts/model-install.sh.in b/ntsimulator/scripts/model-install.sh.in
new file mode 100755 (executable)
index 0000000..316923e
--- /dev/null
@@ -0,0 +1,57 @@
+#!/bin/bash
+
+set -eu -o pipefail
+
+shopt -s failglob
+
+: ${SYSREPOCTL:=sysrepoctl}
+: ${SYSREPOCFG:=sysrepocfg}
+: ${SYSREPOCTL_ROOT_PERMS:=-o root:root -p 600}
+: ${YANG_DIR:=@CMAKE_CURRENT_SOURCE_DIR@/yang/manager}
+: ${STARTUP_DIR:=@CMAKE_CURRENT_SOURCE_DIR@/yang/startup}
+
+is_yang_module_installed() {
+    module=$1
+
+    $SYSREPOCTL -l | grep --count "^$module [^|]*|[^|]*| Installed .*$" > /dev/null
+}
+
+install_yang_module() {
+    module=$1
+
+    if ! is_yang_module_installed $module; then
+        echo "- Installing module $module..."
+        $SYSREPOCTL -i -g ${YANG_DIR}/$module.yang $SYSREPOCTL_ROOT_PERMS
+    else
+        echo "- Module $module already installed."
+    fi
+}
+
+uninstall_yang_module() {
+    module=$1
+
+    if is_yang_module_installed $module; then
+        echo "- Uninstalling module $module..."
+        $SYSREPOCTL -u -m $module
+    else
+        echo "- Module $module is not installed."
+    fi
+}
+
+enable_yang_module_feature() {
+    module=$1
+    feature=$2
+
+    if ! $SYSREPOCTL -l | grep --count "^$module [^|]*|[^|]*|[^|]*|[^|]*|[^|]*|[^|]*|.* $feature.*$" > /dev/null; then
+        echo "- Enabling feature $feature in $module..."
+        $SYSREPOCTL -m $module -e $feature
+    else
+        echo "- Feature $feature in $module already enabled."
+    fi
+}
+
+echo "- Installing network-topology-simulator..."
+install_yang_module network-topology-simulator
+
+echo "- Adding startup datastore in network-topology-simulator..."
+$SYSREPOCFG -d startup -i $YANG_DIR/network-topology-simulator.xml -f xml network-topology-simulator
diff --git a/ntsimulator/scripts/model-uninstall.sh b/ntsimulator/scripts/model-uninstall.sh
new file mode 100644 (file)
index 0000000..3284ac6
--- /dev/null
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+sleep 3
+
+set -eu -o pipefail
+
+shopt -s failglob
+
+: ${SYSREPOCTL:=sysrepoctl}
+
+echo "- Uninstalling microwave-model..."
+$SYSREPOCTL --uninstall --module=microwave-model
+
+echo "- Uninstalling core-model..."
+$SYSREPOCTL --uninstall --module=core-model
+
+exit 0
\ No newline at end of file
diff --git a/ntsimulator/scripts/model-uninstall.sh.in b/ntsimulator/scripts/model-uninstall.sh.in
new file mode 100644 (file)
index 0000000..a347271
--- /dev/null
@@ -0,0 +1,32 @@
+#!/bin/bash
+
+sleep 5
+
+set -eu -o pipefail
+
+shopt -s failglob
+
+: ${SYSREPOCTL:=sysrepoctl}
+: ${SYSREPOCFG:=sysrepocfg}
+: ${SYSREPOCTL_ROOT_PERMS:=-o root:root -p 600}
+: ${YANG_DIR:=@CMAKE_CURRENT_SOURCE_DIR@/yang}
+: ${STARTUP_DIR:=@CMAKE_CURRENT_SOURCE_DIR@/yang/startup}
+
+is_yang_module_installed() {
+    module=$1
+
+    $SYSREPOCTL -l | grep --count "^$module [^|]*|[^|]*| Installed .*$" > /dev/null
+}
+
+uninstall_yang_module() {
+    module=$1
+
+    if ! is_yang_module_installed $module; then
+        echo "- Module $module not installed, skipping..."
+    else
+        $SYSREPOCTL -u -m $$module
+    fi
+}
+
+echo "- Uninstalling code-model and microwave-model..."
+uninstall_yang_module microwave-model,core-model
diff --git a/ntsimulator/scripts/nts_start.sh b/ntsimulator/scripts/nts_start.sh
new file mode 100755 (executable)
index 0000000..c92ee90
--- /dev/null
@@ -0,0 +1 @@
+docker run -itd --name NTS_Manager -p 127.0.0.1:8300:830/tcp -e BUILD_TYPE=manager -e NTS_IP="127.0.0.1" -e NETCONF_BASE=40000 -v /var/run/docker.sock:/var/run/docker.sock -v $(pwd):/opt/dev/scripts -v /usr/bin/docker:/usr/bin/docker --label "NTS-manager" ntsimulator
diff --git a/ntsimulator/scripts/stock_config.xml b/ntsimulator/scripts/stock_config.xml
new file mode 100644 (file)
index 0000000..014c840
--- /dev/null
@@ -0,0 +1,95 @@
+<netconf-server xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-server">
+  <listen>
+    <endpoint>
+      <name>MNG0</name>
+      <ssh>
+        <address>0.0.0.0</address>
+        <port>830</port>
+        <host-keys>
+          <host-key>
+            <name>imported SSH key</name>
+            <public-key>ssh_host_rsa_key</public-key>
+          </host-key>
+        </host-keys>
+      </ssh>
+    </endpoint>
+    <endpoint>
+      <name>MNG1</name>
+      <ssh>
+        <address>0.0.0.0</address>
+        <port>831</port>
+        <host-keys>
+          <host-key>
+            <name>imported SSH key</name>
+            <public-key>ssh_host_rsa_key</public-key>
+          </host-key>
+        </host-keys>
+      </ssh>
+    </endpoint>
+    <endpoint>
+      <name>MNG2</name>
+      <ssh>
+        <address>0.0.0.0</address>
+        <port>832</port>
+        <host-keys>
+          <host-key>
+            <name>imported SSH key</name>
+            <public-key>ssh_host_rsa_key</public-key>
+          </host-key>
+        </host-keys>
+      </ssh>
+    </endpoint>
+    <endpoint>
+      <name>MNG3</name>
+      <ssh>
+        <address>0.0.0.0</address>
+        <port>833</port>
+        <host-keys>
+          <host-key>
+            <name>imported SSH key</name>
+            <public-key>ssh_host_rsa_key</public-key>
+          </host-key>
+        </host-keys>
+      </ssh>
+    </endpoint>
+    <endpoint>
+      <name>MNG4</name>
+      <ssh>
+        <address>0.0.0.0</address>
+        <port>834</port>
+        <host-keys>
+          <host-key>
+            <name>imported SSH key</name>
+            <public-key>ssh_host_rsa_key</public-key>
+          </host-key>
+        </host-keys>
+      </ssh>
+    </endpoint>
+    <endpoint>
+      <name>MNG5</name>
+      <ssh>
+        <address>0.0.0.0</address>
+        <port>835</port>
+        <host-keys>
+          <host-key>
+            <name>imported SSH key</name>
+            <public-key>ssh_host_rsa_key</public-key>
+          </host-key>
+        </host-keys>
+      </ssh>
+    </endpoint>
+    <endpoint>
+      <name>MNG6</name>
+      <ssh>
+        <address>0.0.0.0</address>
+        <port>836</port>
+        <host-keys>
+          <host-key>
+            <name>imported SSH key</name>
+            <public-key>ssh_host_rsa_key</public-key>
+          </host-key>
+        </host-keys>
+      </ssh>
+    </endpoint>
+  </listen>
+</netconf-server>
diff --git a/ntsimulator/scripts/tls/ca.key b/ntsimulator/scripts/tls/ca.key
new file mode 100644 (file)
index 0000000..fb005ce
--- /dev/null
@@ -0,0 +1,27 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIIEogIBAAKCAQEArD3TDHPAMT2Z84orK4lMlarbgooIUCcRZyLe+QM+8KY8Hn+m
+GaxPEOTSL3ywszqefB/Utm2hPKLHX684iRC14ID9WDGHxPjvoPArhgFhfV+qnPfx
+KTgxZC12uOj4u1V9y+SkTCocFbRfXVBGpojrBuDHXkDMDEWNvr8/52YCv7bGaiBw
+UHolcLCUbmtKILCG0RNJyTaJpXQdAeq5Z1SJotpbfYFFtAXB32hVoLug1dzl2tjG
+9sb1wq3QaDExcbC5w6P65qOkNoyym9ne6QlQagCqVDyFn3vcqkRaTjvZmxauCeUx
+XgJoXkyWcm0lM1KMHdoTArmchw2Dz0yHHSyDAQIDAQABAoIBAFH65y3hFhQZxuHU
+3LFPG0WNWgdq3YQQ5EaboVcSRW3TIYA+r3c+vS9ESgpSJeRYvUBFAkCGM50huRWA
+177dVkPyASNuB7on5h5K0dxpYdaDpzgpBv7ggRm2TfC66lB343UdcVnTHSTzggRv
+BgGT35GZgSsKWlRo8otcifUAZ8SJWRv6UxmX0zuvqSj3Q49ucevb57/CmYdgGxCP
+5flP/fqAdKen8/A03KPaltMERdo5xXbs5f7iBjcCZM1427Ta5cjiBW1zDWU4zbzn
+9+unwWPEuuPaGGtS6500qBJy6mIgM/9nYP9LKz9sJMEVJJZLZc1/2pjbJSNEiNJV
+SlJrvbECgYEA2u+xyfMsc2iE+dC8913NvIJnK7v7ixh5eu86SjJoYvflBvnEpPoX
+XxWlWUkO5jR1Hk2v1Z4U4hD/OR1kUwAqbN3MdCDd00hkhgVns8AgZtH0aXmdz+xq
+M0CKGXU7L/XS5mpiI8g24im1+1/rQjLxxUQjv0nfMxixa/ENmmtuisUCgYEAyWZ2
+CzAROlhxjaCbe+WopjG0AevCcrAPAeRgqIOm9sJ51q0cg2B6E/Zn27CvzKxsFzgM
++Vu3MoC0vVMK+Dc3o7idaQ0ew7kY5KO6LY8wDu5s3EGiS0KGJum2iIStE3lee/dd
+TDcX6yE/3WYvvNf7w7uN7nme3s3EuSDDKpPFCw0CgYAaSnpxI/CMk1qUnUpz8iHI
+p2g4SkS0uWWtK5k2W8NJTzeDlO7WWOoBkxneFPXjEx2VXALnhio/04aylyL7DKQL
+mr74mxHIU4MuzOtdHI9HiaLuH5qh42QFb5Sl5fwLkFuZK+FJJrvggN3HqAcaVf/O
+jpY0XGyfODHmInZdutT1eQKBgBAVoMPP+PBB8/+tnf1NICT1vzyQCZ2DNg+en6GV
+shXu/jAI70gGwnkpqq2+9KtR8egAz/hyPLVJ1iVwpmWgc08eBWRIafaTp8tK0Cmn
+T91BaWxFyaJdE72z2KIahoARp1wbK1ZU6BIdO66A5LsePLsrFXDAQdHleRqX5T5X
+QttZAoGASjKxjcbfZN9Q4jfvof2tacpdKbof9K03tbcRRkcBBF/mtiK4ER+c7dPU
+YcGJwOCT9YofASM0Qnq3F118Ic7DJAB332R1/UMY1krkCLAGfjAndL5XguFLpDQx
+c3dqfZ38rGw4GIr/rGJsPInYzkLxTfoYit/9dZjLLoxxvwlLTLs=
+-----END RSA PRIVATE KEY-----
diff --git a/ntsimulator/scripts/tls/ca.pem b/ntsimulator/scripts/tls/ca.pem
new file mode 100644 (file)
index 0000000..62593ab
--- /dev/null
@@ -0,0 +1,24 @@
+-----BEGIN CERTIFICATE-----
+MIID7TCCAtWgAwIBAgIJAMtE1NGAR5KoMA0GCSqGSIb3DQEBBQUAMIGMMQswCQYD
+VQQGEwJDWjEWMBQGA1UECAwNU291dGggTW9yYXZpYTENMAsGA1UEBwwEQnJubzEP
+MA0GA1UECgwGQ0VTTkVUMQwwCgYDVQQLDANUTUMxEzARBgNVBAMMCmV4YW1wbGUg
+Q0ExIjAgBgkqhkiG9w0BCQEWE2V4YW1wbGVjYUBsb2NhbGhvc3QwHhcNMTQwNzI0
+MTQxOTAyWhcNMjQwNzIxMTQxOTAyWjCBjDELMAkGA1UEBhMCQ1oxFjAUBgNVBAgM
+DVNvdXRoIE1vcmF2aWExDTALBgNVBAcMBEJybm8xDzANBgNVBAoMBkNFU05FVDEM
+MAoGA1UECwwDVE1DMRMwEQYDVQQDDApleGFtcGxlIENBMSIwIAYJKoZIhvcNAQkB
+FhNleGFtcGxlY2FAbG9jYWxob3N0MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
+CgKCAQEArD3TDHPAMT2Z84orK4lMlarbgooIUCcRZyLe+QM+8KY8Hn+mGaxPEOTS
+L3ywszqefB/Utm2hPKLHX684iRC14ID9WDGHxPjvoPArhgFhfV+qnPfxKTgxZC12
+uOj4u1V9y+SkTCocFbRfXVBGpojrBuDHXkDMDEWNvr8/52YCv7bGaiBwUHolcLCU
+bmtKILCG0RNJyTaJpXQdAeq5Z1SJotpbfYFFtAXB32hVoLug1dzl2tjG9sb1wq3Q
+aDExcbC5w6P65qOkNoyym9ne6QlQagCqVDyFn3vcqkRaTjvZmxauCeUxXgJoXkyW
+cm0lM1KMHdoTArmchw2Dz0yHHSyDAQIDAQABo1AwTjAdBgNVHQ4EFgQUc1YQIqjZ
+sHVwlea0AB4N+ilNI2gwHwYDVR0jBBgwFoAUc1YQIqjZsHVwlea0AB4N+ilNI2gw
+DAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOCAQEAI/1KH60qnw9Xs2RGfi0/
+IKf5EynXt4bQX8EIyVKwSkYKe04zZxYfLIl/Q2HOPYoFmm3daj5ddr0ZS1i4p4fT
+UhstjsYWvXs3W/HhVmFUslakkn3PrswhP77fCk6eEJLxdfyJ1C7Uudq2m1isZbKi
+h+XF0mG1LxJaDMocSz4eAya7M5brwjy8DoOmA1TnLQFCVcpn+sCr7VC4wE/JqxyV
+hBCk/MuGqqM3B1j90bGFZ112ZOecyE0EDSr6IbiRBtmeNbEwOFjKXhNLYdxpBZ9D
+8A/368OckZkCrVLGuJNxK9UwCVTe8IhotHUqU9EqFDmxdV8oIdU/OzUwwNPA/Bd/
+9g==
+-----END CERTIFICATE-----
diff --git a/ntsimulator/scripts/tls/ca.srl b/ntsimulator/scripts/tls/ca.srl
new file mode 100644 (file)
index 0000000..c10d829
--- /dev/null
@@ -0,0 +1 @@
+91390D611074ACC8
diff --git a/ntsimulator/scripts/tls/client.crt b/ntsimulator/scripts/tls/client.crt
new file mode 100644 (file)
index 0000000..8e52dac
--- /dev/null
@@ -0,0 +1,24 @@
+-----BEGIN CERTIFICATE-----
+MIIECTCCAvGgAwIBAgIBBzANBgkqhkiG9w0BAQsFADCBjDELMAkGA1UEBhMCQ1ox
+FjAUBgNVBAgMDVNvdXRoIE1vcmF2aWExDTALBgNVBAcMBEJybm8xDzANBgNVBAoM
+BkNFU05FVDEMMAoGA1UECwwDVE1DMRMwEQYDVQQDDApleGFtcGxlIENBMSIwIAYJ
+KoZIhvcNAQkBFhNleGFtcGxlY2FAbG9jYWxob3N0MB4XDTE1MDczMDA3MjcxOFoX
+DTM1MDcyNTA3MjcxOFowgYUxCzAJBgNVBAYTAkNaMRYwFAYDVQQIDA1Tb3V0aCBN
+b3JhdmlhMQ8wDQYDVQQKDAZDRVNORVQxDDAKBgNVBAsMA1RNQzEXMBUGA1UEAwwO
+ZXhhbXBsZSBjbGllbnQxJjAkBgkqhkiG9w0BCQEWF2V4YW1wbGVjbGllbnRAbG9j
+YWxob3N0MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAueCQaNQWoNmF
+K6LKu1p8U8ZWdWg/PvDdLsJyzfzl/Qw4UA68SfFNaY06zZl8QB9W02nr5kWeeMY0
+VA3adrPgOlvfx3oWlFbkETnMaN4OT3WTQ0Wt6jAWZDzVfopwpJPAzRPxACDftIqF
+GagYcF32hZlVNqqnVdbXh0S0EViweqp/dbG4VDUHSNVbglc+u4UbEzNIFXMdEFsJ
+ZpkynOmSiTsIATqIhb+2srkVgLwhfkC2qkuHQwAHdubuB07ObM2z01UhyEdDvEYG
+HwtYAGDBL2TAcsI0oGeVkRyuOkV0QY0UN7UEFI1yTYw+xZ42HgFx3uGwApCImxhb
+j69GBYWFqwIDAQABo3sweTAJBgNVHRMEAjAAMCwGCWCGSAGG+EIBDQQfFh1PcGVu
+U1NMIEdlbmVyYXRlZCBDZXJ0aWZpY2F0ZTAdBgNVHQ4EFgQUXGpLeLnh2cSDARAV
+A7KrBxGYpo8wHwYDVR0jBBgwFoAUc1YQIqjZsHVwlea0AB4N+ilNI2gwDQYJKoZI
+hvcNAQELBQADggEBAJPV3RTXFRtNyOU4rjPpYeBAIAFp2aqGc4t2J1c7oPp/1n+l
+ZvjnwtlJpZHxMM783e2ryDQ6dkvXDf8kpwKlg3U3mkJ3xKkDdWrM4QwghXdCN519
+aa9qmu0zdFL+jUAaWlQ5tsceOrvbusCcbMqiFGk/QfpHqPv52SVWbYyUx7IX7DE+
+UjgsLHycfV/tlcx4ZE6soTzl9VdgSL/zmzG3rjsr58J80rXckLgBhvijgBlIAJvW
+fC7D0vaouvBInSFXymdPVoUDZ30cdGLf+hI/i/TfsEMOinLrXVdkSGNo6FXAHKSv
+XeB9oFKSzhQ7OPyRyqvEPycUSw/qD6FVr80oDDc=
+-----END CERTIFICATE-----
diff --git a/ntsimulator/scripts/tls/client.key b/ntsimulator/scripts/tls/client.key
new file mode 100644 (file)
index 0000000..7ccdab1
--- /dev/null
@@ -0,0 +1,27 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIIEpAIBAAKCAQEAueCQaNQWoNmFK6LKu1p8U8ZWdWg/PvDdLsJyzfzl/Qw4UA68
+SfFNaY06zZl8QB9W02nr5kWeeMY0VA3adrPgOlvfx3oWlFbkETnMaN4OT3WTQ0Wt
+6jAWZDzVfopwpJPAzRPxACDftIqFGagYcF32hZlVNqqnVdbXh0S0EViweqp/dbG4
+VDUHSNVbglc+u4UbEzNIFXMdEFsJZpkynOmSiTsIATqIhb+2srkVgLwhfkC2qkuH
+QwAHdubuB07ObM2z01UhyEdDvEYGHwtYAGDBL2TAcsI0oGeVkRyuOkV0QY0UN7UE
+FI1yTYw+xZ42HgFx3uGwApCImxhbj69GBYWFqwIDAQABAoIBAQCZN9kR8DGu6V7y
+t0Ax68asL8O5B/OKaHWKQ9LqpVrXmikZJOxkbzoGldow/CIFoU+q+Zbwu9aDa65a
+0wiP7Hoa4Py3q5XNNUrOQDyU/OYC7cI0I83WS0lJ2zOJGYj8wKae5Z81IeQFKGHK
+4lsy1OGPAvPRGh7RjUUgRavA2MCwe07rWRuDb/OJFe4Oh56UMEjwMiNBtMNtncog
+j1vr/qgRJdf9tf0zlJmLvUJ9+HSFFV9I/97LJyFhb95gAfHkjdVroLVgT3Cho+4P
+WtZaKCIGD0OwfOG2nLV4leXvRUk62/LMlB8NI9+JF7Xm+HCKbaWHNWC7mvWSLV58
+Zl4AbUWRAoGBANyJ6SFHFRHSPDY026SsdMzXR0eUxBAK7G70oSBKKhY+O1j0ocLE
+jI2krHJBhHbLlnvJVyMUaCUOTS5m0uDw9hgSsAqeSL3hL38kxVZw+KNG9Ouno1Fl
+KnE/xXHlPQyeGs/P8nAMzHZxQtEsQdQayJEhK2XXHTsy7Q3MxDisfVJ1AoGBANfD
+34gB+OMx6pwj7zk3qWbYXSX8xjCZMR0ciko+h4xeMP2N8B0oyoqC+v1ABMAtJ3wG
+sGZd0hV9gwM7OUM3SEwkn6oeg1GemWLcn4rlSmTnZc4aeVwrEWlnSNFX3s4g9l4u
+k8Ugu4MVJYqH8HuDQ5Ggl6/QAwPzMSEdCW0O+jOfAoGAIBRbegC5+t6m7Yegz4Ja
+dxV1g98K6f58x+MDsQu4tYWV4mmrQgaPH2dtwizvlMwmdpkh+LNWNtWuumowkJHc
+akIFo3XExQIFg6wYnGtQb4e5xrGa2xMpKlIJaXjb+YLiCYqJDG2ALFZrTrvuU2kV
+9a5qfqTc1qigvNolTM0iaaUCgYApmrZWhnLUdEKV2wP813PNxfioI4afxlpHD8LG
+sCn48gymR6E+Lihn7vuwq5B+8fYEH1ISWxLwW+RQUjIneNhy/jjfV8TgjyFqg7or
+0Sy4KjpiNI6kLBXOakELRNNMkeSPopGR2E7v5rr3bGD9oAD+aqX1G7oJH/KgPPYd
+Vl7+ZwKBgQDcHyWYrimjyUgKaQD2GmoO9wdcJYQ59ke9K+OuGlp4ti5arsi7N1tP
+B4f09aeELM2ASIuk8Q/Mx0jQFnm8lzRFXdewgvdPoZW/7VufM9O7dGPOc41cm2Dh
+yrTcXx/VmUBb+/fnXVEgCv7gylp/wtdTGHQBQJHR81jFBz0lnLj+gg==
+-----END RSA PRIVATE KEY-----
diff --git a/ntsimulator/scripts/tls/enable_ssh_key.sh b/ntsimulator/scripts/tls/enable_ssh_key.sh
new file mode 100755 (executable)
index 0000000..5ed2868
--- /dev/null
@@ -0,0 +1,16 @@
+#! /bin/bash
+
+sleep 5
+
+SSH_PUB_KEY="$(cat /home/netconf/.ssh/id_dsa.pub| awk '{print $2}')"
+
+echo '<system xmlns="urn:ietf:params:xml:ns:yang:ietf-system"><authentication><user><name>netconf</name><authorized-key><name>ssh_key</name><algorithm>ssh-dss</algorithm>' >> load_auth_pubkey.xml
+echo '<key-data>'"$SSH_PUB_KEY"'</key-data></authorized-key></user></authentication></system>' >> load_auth_pubkey.xml
+
+sysrepocfg --merge=load_auth_pubkey.xml --format=xml ietf-system
+rm load_auth_pubkey.xml
+
+ssh-keyscan -p 830 localhost >> ~/.ssh/known_hosts
+
+echo 'Done'
+exit 0
\ No newline at end of file
diff --git a/ntsimulator/scripts/tls/enable_tls.sh b/ntsimulator/scripts/tls/enable_tls.sh
new file mode 100755 (executable)
index 0000000..a6314bf
--- /dev/null
@@ -0,0 +1,46 @@
+#! /bin/bash
+
+sleep 5
+
+openssl genrsa -out melacon.server.key 2048
+
+openssl req -new -sha256 -key melacon.server.key -subj "/C=US/ST=CA/O=MeLaCon, Inc./CN=melacon.com" -out melacon.server.csr
+openssl x509 -req -in melacon.server.csr -CA ca.pem -CAkey ca.key -CAcreateserial -out melacon.server.crt -days 500 -sha256
+rm melacon.server.csr
+
+MELACON_SERVER_KEY="$(sed '1d;$d' melacon.server.key)"
+
+echo '<action xmlns="urn:ietf:params:xml:ns:yang:1"><keystore xmlns="urn:ietf:params:xml:ns:yang:ietf-keystore"><private-keys><load-private-key><name>melacon_server_key</name>' >> load_private_key.xml
+echo '<private-key>'"$MELACON_SERVER_KEY"'</private-key></load-private-key></private-keys></keystore></action>' >> load_private_key.xml
+
+netopeer2-cli <<END
+auth pref publickey 1000
+auth keys add /home/netconf/.ssh/id_dsa.pub /home/netconf/.ssh/id_dsa
+connect --login netconf
+user-rpc --content=load_private_key.xml
+disconnect
+END
+
+rm load_private_key.xml
+
+MELACON_CERT="$(sed '1d;$d' melacon.server.crt)"
+CA_CERT="$(sed '1d;$d' ca.pem)"
+
+echo '<keystore xmlns="urn:ietf:params:xml:ns:yang:ietf-keystore"><private-keys><private-key><name>melacon_server_key</name><certificate-chains><certificate-chain><name>melacon_server_cert</name>' >> load_server_certs.xml
+echo '<certificate>'"$MELACON_CERT"'</certificate></certificate-chain></certificate-chains></private-key></private-keys><trusted-certificates><name>trusted_ca_list</name><trusted-certificate><name>ca</name>' >> load_server_certs.xml
+echo '<certificate>'"$CA_CERT"'</certificate></trusted-certificate></trusted-certificates></keystore>' >> load_server_certs.xml
+
+sysrepocfg --merge=load_server_certs.xml --format=xml ietf-keystore
+rm load_server_certs.xml
+
+echo '<netconf-server xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-server"><listen>' >> tls_endpoints.xml
+echo '<endpoint><name>MNG_TLS_1</name><tls><address>0.0.0.0</address><port>837</port><certificates><certificate><name>melacon_server_cert</name></certificate></certificates><client-auth><trusted-ca-certs>trusted_ca_list</trusted-ca-certs><cert-maps><cert-to-name><id>1</id><fingerprint>02:E9:38:1F:F6:8B:62:DE:0A:0B:C5:03:81:A8:03:49:A0:00:7F:8B:F3</fingerprint><map-type xmlns:x509c2n="urn:ietf:params:xml:ns:yang:ietf-x509-cert-to-name">x509c2n:specified</map-type><name>netconf</name></cert-to-name></cert-maps></client-auth></tls></endpoint>' >> tls_endpoints.xml
+echo '<endpoint><name>MNG_TLS_2</name><tls><address>0.0.0.0</address><port>838</port><certificates><certificate><name>melacon_server_cert</name></certificate></certificates><client-auth><trusted-ca-certs>trusted_ca_list</trusted-ca-certs><cert-maps><cert-to-name><id>1</id><fingerprint>02:E9:38:1F:F6:8B:62:DE:0A:0B:C5:03:81:A8:03:49:A0:00:7F:8B:F3</fingerprint><map-type xmlns:x509c2n="urn:ietf:params:xml:ns:yang:ietf-x509-cert-to-name">x509c2n:specified</map-type><name>netconf</name></cert-to-name></cert-maps></client-auth></tls></endpoint>' >> tls_endpoints.xml
+echo '<endpoint><name>MNG_TLS_3</name><tls><address>0.0.0.0</address><port>839</port><certificates><certificate><name>melacon_server_cert</name></certificate></certificates><client-auth><trusted-ca-certs>trusted_ca_list</trusted-ca-certs><cert-maps><cert-to-name><id>1</id><fingerprint>02:E9:38:1F:F6:8B:62:DE:0A:0B:C5:03:81:A8:03:49:A0:00:7F:8B:F3</fingerprint><map-type xmlns:x509c2n="urn:ietf:params:xml:ns:yang:ietf-x509-cert-to-name">x509c2n:specified</map-type><name>netconf</name></cert-to-name></cert-maps></client-auth></tls></endpoint>' >> tls_endpoints.xml
+echo '</listen></netconf-server>' >> tls_endpoints.xml
+
+sysrepocfg --merge=tls_endpoints.xml --format=xml ietf-netconf-server
+rm tls_endpoints.xml
+
+echo 'Done'
+exit 0
\ No newline at end of file
diff --git a/ntsimulator/scripts/tls/netconf_browser.crt b/ntsimulator/scripts/tls/netconf_browser.crt
new file mode 100644 (file)
index 0000000..687579d
--- /dev/null
@@ -0,0 +1,19 @@
+-----BEGIN CERTIFICATE-----
+MIIDGDCCAgACCQCROQ1hEHSsyDANBgkqhkiG9w0BAQsFADCBjDELMAkGA1UEBhMC
+Q1oxFjAUBgNVBAgMDVNvdXRoIE1vcmF2aWExDTALBgNVBAcMBEJybm8xDzANBgNV
+BAoMBkNFU05FVDEMMAoGA1UECwwDVE1DMRMwEQYDVQQDDApleGFtcGxlIENBMSIw
+IAYJKoZIhvcNAQkBFhNleGFtcGxlY2FAbG9jYWxob3N0MB4XDTE5MDYxNzEyNDMy
+N1oXDTIwMTAyOTEyNDMyN1owDzENMAsGA1UEAwwEdGVzdDCCASIwDQYJKoZIhvcN
+AQEBBQADggEPADCCAQoCggEBAIKxdFmW7Cr4x7txXrHgaIZYpfsI9QwkwX+3q4h9
+kbY1QVaram/AlGWgXe/42q1z0UVRGGSsnwZvIv+daT4XE47Q/7JfUcYyo1EdGORc
+ym++D+gmIy37cUzB1oe9zZrxJ3zSZnwcQV13kZMwyOAs5DT1MpqPSypclv8t3c0Z
+H0mdzpcF4sJXBg14MoQqZSwSeZZrg9tAe36hhyrKhIVXReY+Lse0X72XS/qwCnA9
+26hjm//8d7j9nskzou9xOLeBh/umZUXHkUVmY1iGQ4jt7HAvg0yZ+2zg02YyZNfY
+Xb21jGB21qy1Jf2roFCn2+7bAjqpI8+Y4C8nm+fl/sScugUCAwEAATANBgkqhkiG
+9w0BAQsFAAOCAQEAX1Gf0xZDTrUVHITSc/sRC03e+Ju658p4fx9BlP2KqqnoZHdh
+zJhmps05FAnvHx/7c4tIABBt3puLl6CofznaE2+QAUxeCiTv2vm/4O3nLU4As5jP
+udfKU+XgVI5PTEorDgVsHnv3/JBmZUxuR4VM63hBJtBvSl4QvNXRtpXjjkljwPvJ
+r+Ea9z712F2dw48c/tzRLUIp7n/py0zhSLiBLBmwsT8fkr5hKmhenqqgY5Vkfa36
+UmfEeOVhhdy5tfs2jwxy9gNFNIryijbn4HMBJEy0zEfva8VEmrYqDJQ5AYX/xcwf
+8D0Sgg3582eQgbQR7eYl0DMlv2JUn5I4AjUutg==
+-----END CERTIFICATE-----
diff --git a/ntsimulator/scripts/tls/netconf_browser.csr b/ntsimulator/scripts/tls/netconf_browser.csr
new file mode 100644 (file)
index 0000000..61d8a4c
--- /dev/null
@@ -0,0 +1,15 @@
+-----BEGIN CERTIFICATE REQUEST-----
+MIICVDCCATwCAQAwDzENMAsGA1UEAwwEdGVzdDCCASIwDQYJKoZIhvcNAQEBBQAD
+ggEPADCCAQoCggEBAIKxdFmW7Cr4x7txXrHgaIZYpfsI9QwkwX+3q4h9kbY1QVar
+am/AlGWgXe/42q1z0UVRGGSsnwZvIv+daT4XE47Q/7JfUcYyo1EdGORcym++D+gm
+Iy37cUzB1oe9zZrxJ3zSZnwcQV13kZMwyOAs5DT1MpqPSypclv8t3c0ZH0mdzpcF
+4sJXBg14MoQqZSwSeZZrg9tAe36hhyrKhIVXReY+Lse0X72XS/qwCnA926hjm//8
+d7j9nskzou9xOLeBh/umZUXHkUVmY1iGQ4jt7HAvg0yZ+2zg02YyZNfYXb21jGB2
+1qy1Jf2roFCn2+7bAjqpI8+Y4C8nm+fl/sScugUCAwEAAaAAMA0GCSqGSIb3DQEB
+CwUAA4IBAQB4mtqz9WtRqU4IBn+FNFQGBuX6uDSfDhC2Qo6mQB1kdErEnbdL6TYn
+gkgZradYwMAaBPKDwAx74YpWs6C4HgkORP1KPweDIjZNcpEAY0HwtXdUQHzMWFOh
+gdCjVYd7WdWg7CFl01lAx1HHzakIvW6ZxjjKoPm4SaFSGvyKzj0CyH01BoSM7pgt
+ZBbQcFkV6ZYItXPZR6Bi5hJnUkNu/K8rPEQ2Fr/wXUUz3PZhO+ZGG+WZbMFuo64V
+QUMEBwWNNf1I6r9EsLiar6Y1q22P6tLmjcY9Nbca/pD+3pplZ+/j6wpnufLM8ati
+dvWZorvVAKwQim5RFnCZ7VSmqKIaywIO
+-----END CERTIFICATE REQUEST-----
diff --git a/ntsimulator/src/CMakeLists.txt b/ntsimulator/src/CMakeLists.txt
new file mode 100644 (file)
index 0000000..7623ab5
--- /dev/null
@@ -0,0 +1,20 @@
+set(UTILS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/utils")
+
+include_directories(
+    "${PROJECT_SOURCE_DIR}/inc/utils" 
+    "/usr/include"
+)
+
+add_subdirectory(ntsimulator-manager)
+add_subdirectory(o-ran-notifications)
+add_subdirectory(ves-messages)
+
+# sources
+set (UTILS_SOURCES
+    ${UTILS_DIR}/utils.c
+)
+
+add_library(utils STATIC ${UTILS_SOURCES})
+set_property(TARGET utils PROPERTY COMPILE_FLAGS "-fPIC")
+target_link_libraries(utils m)
+target_link_libraries(utils cjson)
\ No newline at end of file
diff --git a/ntsimulator/src/ntsimulator-manager/CMakeLists.txt b/ntsimulator/src/ntsimulator-manager/CMakeLists.txt
new file mode 100644 (file)
index 0000000..aacbcff
--- /dev/null
@@ -0,0 +1,17 @@
+set (NTSIMULATOR_SOURCES
+    ntsimulator-manager.c
+    simulator-operations.c
+)
+
+include_directories(
+    "/usr/include/x86_64-linux-gnu"
+    "/usr/local/include/cjson"
+)
+
+add_executable(ntsimulator-manager ${NTSIMULATOR_SOURCES})
+target_link_libraries(ntsimulator-manager utils)
+target_link_libraries(ntsimulator-manager curl)
+target_link_libraries(ntsimulator-manager cjson)
+target_link_libraries(ntsimulator-manager sysrepo)
+
+install(TARGETS ntsimulator-manager DESTINATION ${CMAKE_INSTALL_BINDIR})
\ No newline at end of file
diff --git a/ntsimulator/src/ntsimulator-manager/ntsimulator-manager.c b/ntsimulator/src/ntsimulator-manager/ntsimulator-manager.c
new file mode 100644 (file)
index 0000000..1e95497
--- /dev/null
@@ -0,0 +1,578 @@
+/*
+ * core-model.c
+ *
+ *  Created on: Feb 19, 2019
+ *      Author: parallels
+ */
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <signal.h>
+#include <inttypes.h>
+#include <limits.h>
+#include <string.h>
+
+#include "sysrepo.h"
+#include "sysrepo/values.h"
+
+#include "utils.h"
+#include "simulator-operations.h"
+
+volatile int exit_application = 0;
+
+volatile unsigned int simulated_devices_config = 0;
+volatile unsigned int mounted_devices_config = 0;
+
+
+static device_stack_t *device_list = NULL;
+
+controller_t controller_details;
+
+#define XPATH_MAX_LEN 500
+#define CONTROLLER_LIST_MAX_LEN 1
+
+static void
+print_current_config(sr_session_ctx_t *session, const char *module_name)
+{
+    sr_val_t *values = NULL;
+    size_t count = 0;
+    int rc = SR_ERR_OK;
+    char xpath[XPATH_MAX_LEN] = {0};
+    snprintf(xpath, XPATH_MAX_LEN, "/%s:*//.", module_name);
+
+    sr_val_t *odl_ip = NULL;
+    sr_val_t *odl_port = NULL;
+    sr_val_t *odl_username = NULL;
+    sr_val_t *odl_password = NULL;
+
+    rc = sr_get_items(session, xpath, &values, &count);
+    if (SR_ERR_OK != rc) {
+        printf("Error by sr_get_items: %s\n", sr_strerror(rc));
+        return;
+    }
+    for (size_t i = 0; i < count; i++){
+
+        sr_print_val(&values[i]);
+
+        if (sr_xpath_node_name_eq(values[i].xpath, "controller-ip"))
+        {
+               rc = sr_dup_val(&values[i], &odl_ip);
+        }
+        else if (sr_xpath_node_name_eq(values[i].xpath, "controller-port"))
+        {
+               rc = sr_dup_val(&values[i], &odl_port);
+        }
+        else if (sr_xpath_node_name_eq(values[i].xpath, "controller-username"))
+        {
+               rc = sr_dup_val(&values[i], &odl_username);
+        }
+        else if (sr_xpath_node_name_eq(values[i].xpath, "controller-password"))
+        {
+               rc = sr_dup_val(&values[i], &odl_password);
+        }
+    }
+
+    //URL used for mounting/unmounting a device; the device name needs to be appended
+   char url[URL_AND_CREDENTIALS_MAX_LEN];
+   sprintf(url, "http://%s:%d/restconf/config/network-topology:network-topology/topology/"
+                "topology-netconf/node/",
+                odl_ip->data.string_val, odl_port->data.uint32_val);
+
+   char credentials[URL_AND_CREDENTIALS_MAX_LEN];
+   sprintf(credentials, "%s:%s", odl_username->data.string_val, odl_password->data.string_val);
+
+   //URLs used for adding key pair to ODL, for TLS connections
+   char url_for_keystore_add[URL_AND_CREDENTIALS_MAX_LEN];
+   sprintf(url_for_keystore_add, "http://%s:%d/restconf/operations/netconf-keystore:add-keystore-entry",
+                        odl_ip->data.string_val, odl_port->data.uint32_val);
+
+   char url_for_private_key_add[URL_AND_CREDENTIALS_MAX_LEN];
+   sprintf(url_for_private_key_add, "http://%s:%d/restconf/operations/netconf-keystore:add-private-key",
+                        odl_ip->data.string_val, odl_port->data.uint32_val);
+
+   char url_for_trusted_ca_add[URL_AND_CREDENTIALS_MAX_LEN];
+   sprintf(url_for_trusted_ca_add, "http://%s:%d/restconf/operations/netconf-keystore:add-trusted-certificate",
+                        odl_ip->data.string_val, odl_port->data.uint32_val);
+
+   strcpy(controller_details.url, url);
+   strcpy(controller_details.credentials, credentials);
+   strcpy(controller_details.url_for_keystore_add, url_for_keystore_add);
+   strcpy(controller_details.url_for_private_key_add, url_for_private_key_add);
+   strcpy(controller_details.url_for_trusted_ca_add, url_for_trusted_ca_add);
+
+   sr_free_val(odl_ip);
+   sr_free_val(odl_port);
+   sr_free_val(odl_username);
+   sr_free_val(odl_password);
+
+    sr_free_values(values, count);
+}
+
+static void clean_current_docker_configuration(void);
+
+static int simulated_devices_changed(int new_value)
+{
+       int rc = SR_ERR_OK;
+
+    if (simulated_devices_config > new_value)
+    {
+       //we are configuring less elements that currently
+       for (int i = 0; i < simulated_devices_config - new_value; ++i)
+       {
+               rc = stop_device(device_list);
+       }
+    }
+    else if (simulated_devices_config < new_value)
+    {
+       //we are configuring more elements that currently
+       for (int i = 0; i < new_value - simulated_devices_config; ++i)
+       {
+               rc = start_device(device_list);
+       }
+    }
+
+    simulated_devices_config = new_value;
+
+    return rc;
+}
+
+int mounted_devices_changed(sr_session_ctx_t *session, int new_value)
+{
+       int rc = SR_ERR_OK;
+
+       if (mounted_devices_config > new_value)
+       {
+         //we need have less mounted elements
+         for (int i = 0; i < mounted_devices_config - new_value; ++i)
+         {
+                 printf("Sending unmount device...\n");
+                 rc = unmount_device(device_list, controller_details);
+         }
+       }
+       else if (mounted_devices_config < new_value)
+       {
+         //we are configuring more elements that currently
+         for (int i = 0; i < new_value - mounted_devices_config; ++i)
+         {
+                 printf("Sending mount device...\n");
+                 rc = mount_device(device_list, controller_details);
+         }
+       }
+
+       mounted_devices_config = new_value;
+
+    return rc;
+}
+
+static int
+simulator_config_change_cb(sr_session_ctx_t *session, const char *module_name, sr_notif_event_t event, void *private_ctx)
+{
+       int rc;
+
+    printf("\n\n ========== CONFIG HAS CHANGED, CURRENT RUNNING CONFIG %s: ==========\n\n", module_name);
+    print_current_config(session, module_name);
+
+    sr_val_t *val;
+
+    /* get the value from sysrepo, we do not care if the value did not change in our case */
+    rc = sr_get_item(session, "/network-topology-simulator:simulator-config/simulated-devices", &val);
+    if (rc != SR_ERR_OK) {
+        goto sr_error;
+    }
+
+    rc = simulated_devices_changed(val->data.uint32_val);
+    if (rc != SR_ERR_OK) {
+        goto sr_error;
+    }
+
+    sr_free_val(val);
+
+    /* get the value from sysrepo, we do not care if the value did not change in our case */
+    rc = sr_get_item(session, "/network-topology-simulator:simulator-config/mounted-devices", &val);
+    if (rc != SR_ERR_OK) {
+        goto sr_error;
+    }
+
+    if (mounted_devices_config != val->data.uint32_val)
+    {
+       if (val->data.uint32_val > simulated_devices_config)
+       {
+               printf("Cannot set mount value greater than number of simulated devices.\n");
+               sr_free_val(val);
+               return SR_ERR_OK;
+       }
+
+               rc = mounted_devices_changed(session, val->data.uint32_val);
+               if (rc != SR_ERR_OK) {
+                       goto sr_error;
+               }
+    }
+
+    sr_free_val(val);
+
+    /* get the value from sysrepo, we do not care if the value did not change in our case */
+    rc = sr_get_item(session, "/network-topology-simulator:simulator-config/notification-config/fault-notification-delay-period", &val);
+    if (rc != SR_ERR_OK) {
+        goto sr_error;
+    }
+
+    rc = notification_delay_period_changed(val->data.uint32_val);
+    if (rc != SR_ERR_OK) {
+        goto sr_error;
+    }
+
+    sr_free_val(val);
+
+    /* get the value from sysrepo, we do not care if the value did not change in our case */
+       rc = sr_get_item(session, "/network-topology-simulator:simulator-config/notification-config/ves-heartbeat-period", &val);
+       if (rc != SR_ERR_OK) {
+               goto sr_error;
+       }
+
+       rc = ves_heartbeat_period_changed(val->data.uint32_val);
+       if (rc != SR_ERR_OK) {
+               goto sr_error;
+       }
+
+       sr_free_val(val);
+
+       /* get the value from sysrepo, we do not care if the value did not change in our case */
+       rc = sr_get_item(session, "/network-topology-simulator:simulator-config/ves-endpoint-details/ves-endpoint-ip", &val);
+       if (rc != SR_ERR_OK) {
+               goto sr_error;
+       }
+
+       rc = ves_ip_changed(val->data.string_val);
+       if (rc != SR_ERR_OK) {
+               goto sr_error;
+       }
+
+       sr_free_val(val);
+
+       /* get the value from sysrepo, we do not care if the value did not change in our case */
+       rc = sr_get_item(session, "/network-topology-simulator:simulator-config/ves-endpoint-details/ves-endpoint-port", &val);
+       if (rc != SR_ERR_OK) {
+               goto sr_error;
+       }
+
+       rc = ves_port_changed(val->data.uint16_val);
+       if (rc != SR_ERR_OK) {
+               goto sr_error;
+       }
+
+       sr_free_val(val);
+
+       /* get the value from sysrepo, we do not care if the value did not change in our case */
+       rc = sr_get_item(session, "/network-topology-simulator:simulator-config/ves-endpoint-details/ves-registration", &val);
+       if (rc != SR_ERR_OK) {
+               goto sr_error;
+       }
+
+       rc = ves_registration_changed(val->data.bool_val);
+       if (rc != SR_ERR_OK) {
+               goto sr_error;
+       }
+
+       sr_free_val(val);
+
+       /* get the value from sysrepo, we do not care if the value did not change in our case */
+       rc = sr_get_item(session, "/network-topology-simulator:simulator-config/notification-config/is-netconf-available", &val);
+       if (rc != SR_ERR_OK) {
+               goto sr_error;
+       }
+
+       rc = is_netconf_available_changed(val->data.bool_val);
+       if (rc != SR_ERR_OK) {
+               goto sr_error;
+       }
+
+       sr_free_val(val);
+
+       /* get the value from sysrepo, we do not care if the value did not change in our case */
+       rc = sr_get_item(session, "/network-topology-simulator:simulator-config/notification-config/is-ves-available", &val);
+       if (rc != SR_ERR_OK) {
+               goto sr_error;
+       }
+
+       rc = is_ves_available_changed(val->data.bool_val);
+       if (rc != SR_ERR_OK) {
+               goto sr_error;
+       }
+
+       sr_free_val(val);
+
+    return SR_ERR_OK;
+
+sr_error:
+       printf("NTSimulator config change callback failed: %s.", sr_strerror(rc));
+       return rc;
+}
+
+static int
+simulator_status_cb(const char *xpath, sr_val_t **values, size_t *values_cnt,
+        uint64_t request_id, const char *original_xpath, void *private_ctx)
+{
+       int rc;
+
+       printf("\n\n ========== Called simulator_status_cb for xpath: %s ==========\n\n", xpath);
+
+       if (sr_xpath_node_name_eq(xpath, "simulated-devices-list")) {
+               sr_val_t *v;
+               size_t current_num_of_values= 0;
+
+               if (simulated_devices_config == 0) //nothing to return if no devices are running
+               {
+                       *values = NULL;
+                       *values_cnt = 0;
+
+                       return SR_ERR_OK;
+               }
+
+               rc = get_docker_containers_operational_state_curl(device_list);
+               if (rc != SR_ERR_OK)
+               {
+                       printf("Could not get the operational state for the devices simulated.\n");
+               }
+
+               device_t *current_device = device_list->head;
+
+               while (current_device != NULL)
+               {
+                       CREATE_NEW_VALUE(rc, v, current_num_of_values);
+
+                       sr_val_build_xpath(&v[current_num_of_values - 1], "%s[uuid='%s']/%s", xpath, current_device->device_id, "device-ip");
+                       v[current_num_of_values - 1].type = SR_STRING_T;
+                       v[current_num_of_values - 1].data.string_val = getenv("NTS_IP");
+
+                       for (int i = 0; i < NETCONF_CONNECTIONS_PER_DEVICE; ++i)
+                       {
+                               CREATE_NEW_VALUE(rc, v, current_num_of_values);
+
+                               sr_val_build_xpath(&v[current_num_of_values - 1], "%s[uuid='%s']/%s", xpath, current_device->device_id, "device-port");
+                               v[current_num_of_values - 1].type = SR_UINT32_T;
+                               v[current_num_of_values - 1].data.uint32_val = current_device->netconf_port + i;
+                       }
+
+                       CREATE_NEW_VALUE(rc, v, current_num_of_values);
+
+                       sr_val_build_xpath(&v[current_num_of_values - 1], "%s[uuid='%s']/%s", xpath, current_device->device_id, "is-mounted");
+                       v[current_num_of_values - 1].type = SR_BOOL_T;
+                       v[current_num_of_values - 1].data.bool_val = current_device->is_mounted;
+
+                       char *operational_state = get_docker_container_operational_state(device_list, current_device->device_id);
+
+                       CREATE_NEW_VALUE(rc, v, current_num_of_values);
+
+                       sr_val_build_xpath(&v[current_num_of_values - 1], "%s[uuid='%s']/%s", xpath, current_device->device_id, "operational-state");
+                       sr_val_build_str_data(&v[current_num_of_values - 1], SR_ENUM_T, "%s", operational_state);
+
+                       current_device = current_device->next;
+               }
+
+               //return the values that we have just created
+               *values = v;
+               *values_cnt = current_num_of_values;
+        }
+        else if (sr_xpath_node_name_eq(xpath, "simulation-usage-details"))
+        {
+               float cpu_usage = 0.0, mem_usage = 0.0;
+
+               char *resource_usage_from_script = get_docker_container_resource_stats();
+
+               if (resource_usage_from_script != NULL)
+               {
+                       printf("Received line: %s\n", resource_usage_from_script);
+                       sscanf(resource_usage_from_script, "CPU=%f%%;RAM=%fMiB", &cpu_usage, &mem_usage);
+                       printf("Read cpu=\"%f\" and mem=\"%f\"\n", cpu_usage, mem_usage);
+                       free(resource_usage_from_script);
+               }
+
+               sr_val_t *v;
+               /* convenient functions such as this can be found in sysrepo/values.h */
+               size_t current_num_of_values= 0;
+
+               CREATE_NEW_VALUE(rc, v, current_num_of_values);
+
+               sr_val_build_xpath(&v[current_num_of_values - 1], "%s/%s", xpath, "running-simulated-devices");
+               v[current_num_of_values - 1].type = SR_UINT32_T;
+               v[current_num_of_values - 1].data.uint32_val = get_current_number_of_devices(device_list);
+
+               CREATE_NEW_VALUE(rc, v, current_num_of_values);
+
+               sr_val_build_xpath(&v[current_num_of_values - 1], "%s/%s", xpath, "running-mounted-devices");
+               v[current_num_of_values - 1].type = SR_UINT32_T;
+               v[current_num_of_values - 1].data.uint32_val = get_current_number_of_mounted_devices(device_list);
+
+               CREATE_NEW_VALUE(rc, v, current_num_of_values);
+
+               sr_val_build_xpath(&v[current_num_of_values - 1], "%s/%s", xpath, "base-netconf-port");
+               v[current_num_of_values - 1].type = SR_UINT32_T;
+               v[current_num_of_values - 1].data.uint32_val = get_netconf_port_base();
+
+               CREATE_NEW_VALUE(rc, v, current_num_of_values);
+
+               sr_val_build_xpath(&v[current_num_of_values - 1], "%s/%s", xpath, "cpu-usage");
+               v[current_num_of_values - 1].type = SR_DECIMAL64_T;
+               v[current_num_of_values - 1].data.decimal64_val = cpu_usage;
+
+               CREATE_NEW_VALUE(rc, v, current_num_of_values);
+
+               sr_val_build_xpath(&v[current_num_of_values - 1], "%s/%s", xpath, "mem-usage");
+               v[current_num_of_values - 1].type = SR_UINT32_T;
+               v[current_num_of_values - 1].data.uint32_val = (int)mem_usage;
+
+               //return the values that we have just created
+               *values = v;
+               *values_cnt = current_num_of_values;
+        }
+
+    return SR_ERR_OK;
+}
+
+int odl_add_key_pair_cb(const char *xpath, const sr_val_t *input, const size_t input_cnt,
+               sr_val_t **output, size_t *output_cnt, void *private_ctx)
+{
+       int rc = SR_ERR_OK;
+    sr_session_ctx_t *session = (sr_session_ctx_t *)private_ctx;
+       controller_t controller_list[CONTROLLER_LIST_MAX_LEN];
+       int controller_list_size = 0;
+
+       controller_list[0] = controller_details;
+       controller_list_size++;
+
+       for (int i = 0; i < controller_list_size; ++i)
+       {
+               printf("%d iteration: Got back url=%s and credentials=%s\n", i, controller_list[i].url, controller_list[i].credentials);
+       }
+
+       rc = add_key_pair_to_odl(controller_list, controller_list_size);
+       if (rc != SR_ERR_OK)
+       {
+               printf("Failed to add key pair to ODL.\n");
+       }
+
+       return rc;
+}
+
+
+static void
+sigint_handler(int signum)
+{
+    exit_application = 1;
+}
+
+int
+main(int argc, char **argv)
+{
+    sr_conn_ctx_t *connection = NULL;
+    sr_session_ctx_t *session = NULL;
+    sr_subscription_ctx_t *subscription = NULL;
+    int rc = SR_ERR_OK;
+
+    setbuf(stdout, NULL);
+
+    device_list = new_device_stack();
+    rc = _init_curl();
+    if (rc != SR_ERR_OK)
+    {
+        fprintf(stderr, "Could not initialize cURL: %s\n", sr_strerror(rc));
+    }
+
+    /* connect to sysrepo */
+    rc = sr_connect("network-topology-simulator", SR_CONN_DEFAULT, &connection);
+    if (SR_ERR_OK != rc) {
+        fprintf(stderr, "Error by sr_connect: %s\n", sr_strerror(rc));
+        goto cleanup;
+    }
+
+    /* start session */
+    rc = sr_session_start(connection, SR_DS_STARTUP, SR_SESS_DEFAULT, &session);
+    if (SR_ERR_OK != rc) {
+        fprintf(stderr, "Error by sr_session_start: %s\n", sr_strerror(rc));
+        goto cleanup;
+    }
+
+       /* read startup config */
+       printf("\n\n ========== READING STARTUP CONFIG network-topology-simulator: ==========\n\n");
+       print_current_config(session, "network-topology-simulator");
+
+       /* subscribe for changes in running config */
+       rc = sr_module_change_subscribe(session, "network-topology-simulator", simulator_config_change_cb, NULL,
+                       0, SR_SUBSCR_DEFAULT | SR_SUBSCR_APPLY_ONLY, &subscription);
+       if (SR_ERR_OK != rc) {
+               fprintf(stderr, "Error by sr_module_change_subscribe: %s\n", sr_strerror(rc));
+               goto cleanup;
+       }
+
+    /* subscribe as state data provider for the ntsimulator state data */
+    rc = sr_dp_get_items_subscribe(session, "/network-topology-simulator:simulator-status", simulator_status_cb, NULL,
+               SR_SUBSCR_CTX_REUSE, &subscription);
+    if (rc != SR_ERR_OK) {
+        goto cleanup;
+    }
+
+    rc = notification_delay_period_changed(0);
+    if (rc != SR_ERR_OK) {
+       printf("Could not write the delay period to file!\n");
+        goto cleanup;
+    }
+
+    rc = _init_curl_odl();
+    if (rc != SR_ERR_OK)
+    {
+        fprintf(stderr, "Could not initialize cURL for ODL connection: %s\n", sr_strerror(rc));
+    }
+
+    rc = sr_rpc_subscribe(session, "/network-topology-simulator:add-key-pair-to-odl", odl_add_key_pair_cb, (void *)session,
+               SR_SUBSCR_CTX_REUSE, &subscription);
+
+       printf("\n\n ========== STARTUP CONFIG network-topology-simulator APPLIED AS RUNNING ==========\n\n");
+
+    /* loop until ctrl-c is pressed / SIGINT is received */
+    signal(SIGINT, sigint_handler);
+    signal(SIGTERM, sigint_handler);
+    signal(SIGPIPE, SIG_IGN);
+
+    while (!exit_application) {
+
+               sleep(1);  /* or do some more useful work... */
+    }
+
+    printf("Application exit requested, exiting.\n");
+
+cleanup:
+    if (NULL != subscription) {
+        sr_unsubscribe(session, subscription);
+    }
+    if (NULL != session) {
+        sr_session_stop(session);
+    }
+    if (NULL != connection) {
+        sr_disconnect(connection);
+    }
+
+    clean_current_docker_configuration();
+    rc = cleanup_curl();
+    rc = cleanup_curl_odl();
+
+    return rc;
+}
+
+static void clean_current_docker_configuration(void)
+{
+       printf("Cleaning docker containers...\n");
+
+       if (device_list == NULL)
+       {
+               return;
+       }
+
+       for (int i = 0; i < simulated_devices_config; ++i)
+       {
+               stop_device(device_list);
+       }
+
+       printf("Cleaning completed!\n");
+}
diff --git a/ntsimulator/src/ntsimulator-manager/simulator-operations.c b/ntsimulator/src/ntsimulator-manager/simulator-operations.c
new file mode 100644 (file)
index 0000000..872513a
--- /dev/null
@@ -0,0 +1,1613 @@
+/*
+ * simulator-operations.c
+ *
+ *  Created on: Mar 9, 2019
+ *      Author: parallels
+ */
+
+#include "simulator-operations.h"
+#include "sysrepo.h"
+#include "sysrepo/values.h"
+#include <string.h>
+#include <math.h>
+#include <linux/limits.h>
+
+#include "utils.h"
+
+#define LINE_BUFSIZE 128
+
+static         CURL *curl; //share the same curl connection for communicating with the Docker Engine API
+static         CURL *curl_odl; //share the same curl connection for mounting servers in ODL
+
+static size_t WriteMemoryCallback(void *contents, size_t size, size_t nmemb, void *userp)
+{
+  size_t realsize = size * nmemb;
+  struct MemoryStruct *mem = (struct MemoryStruct *)userp;
+
+  char *ptr = realloc(mem->memory, mem->size + realsize + 1);
+  if(ptr == NULL) {
+    /* out of memory! */
+    printf("not enough memory (realloc returned NULL)\n");
+    return 0;
+  }
+
+  mem->memory = ptr;
+  memcpy(&(mem->memory[mem->size]), contents, realsize);
+  mem->size += realsize;
+  mem->memory[mem->size] = 0;
+
+  return realsize;
+}
+
+static void set_curl_common_info()
+{
+       struct curl_slist *chunk = NULL;
+       chunk = curl_slist_append(chunk, "Content-Type: application/json");
+       chunk = curl_slist_append(chunk, "Accept: application/json");
+
+    curl_easy_setopt(curl, CURLOPT_HTTPHEADER, chunk);
+
+       curl_easy_setopt(curl, CURLOPT_UNIX_SOCKET_PATH, "/var/run/docker.sock");
+
+       curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteMemoryCallback);
+    curl_easy_setopt(curl_odl, CURLOPT_CONNECTTIMEOUT, 2L); // seconds timeout for a connection
+    curl_easy_setopt(curl_odl, CURLOPT_TIMEOUT, 5L); //seconds timeout for an operation
+
+    curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
+}
+
+static void set_curl_common_info_odl()
+{
+       struct curl_slist *chunk = NULL;
+       chunk = curl_slist_append(chunk, "Content-Type: application/xml");
+       chunk = curl_slist_append(chunk, "Accept: application/xml");
+
+    curl_easy_setopt(curl_odl, CURLOPT_HTTPHEADER, chunk);
+
+    curl_easy_setopt(curl_odl, CURLOPT_CONNECTTIMEOUT, 2L); // seconds timeout for a connection
+    curl_easy_setopt(curl_odl, CURLOPT_TIMEOUT, 5L); //seconds timeout for an operation
+
+    curl_easy_setopt(curl_odl, CURLOPT_VERBOSE, 1L);
+}
+
+static cJSON* get_docker_container_bindings(void)
+{
+       struct MemoryStruct curl_response_mem;
+
+       curl_response_mem.memory = malloc(1);  /* will be grown as needed by the realloc above */
+       curl_response_mem.size = 0;    /* no data at this point */
+
+       CURLcode res;
+
+       curl_easy_reset(curl);
+       set_curl_common_info();
+
+       char url[100];
+       sprintf(url, "http:/v%s/containers/NTS_Manager/json", getenv("DOCKER_ENGINE_VERSION"));
+
+       curl_easy_setopt(curl, CURLOPT_URL, url);
+
+    curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "");
+    curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "GET");
+
+       curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)&curl_response_mem);
+
+       res = curl_easy_perform(curl);
+
+       if (res != CURLE_OK)
+       {
+               return NULL;
+       }
+       else
+       {
+               cJSON *json_response = cJSON_Parse(curl_response_mem.memory);
+
+               printf("%lu bytes retrieved\n", (unsigned long)curl_response_mem.size);
+
+               if (json_response == NULL)
+               {
+                       printf("Could not parse JSON response for url=\"%s\"\n", url);
+                       return NULL;
+               }
+
+               cJSON *hostConfig = cJSON_GetObjectItemCaseSensitive(json_response, "HostConfig");
+
+               if (hostConfig == NULL)
+               {
+                       printf("Could not get HostConfig object\n");
+                       return NULL;
+               }
+
+               cJSON *binds = cJSON_GetObjectItemCaseSensitive(hostConfig, "Binds");
+
+               if (binds == NULL)
+               {
+                       printf("Could not get Binds object\n");
+                       return NULL;
+               }
+
+               cJSON *bindsCopy = cJSON_Duplicate(binds, 1);
+
+           cJSON_Delete(json_response);
+
+               return bindsCopy;
+       }
+
+       return NULL;
+}
+
+static char* create_docker_container_curl(int base_netconf_port, cJSON* managerBinds)
+{
+       if (managerBinds == NULL)
+       {
+               printf("Could not retrieve JSON object: Binds\n");
+               return NULL;
+       }
+       cJSON *binds = cJSON_Duplicate(managerBinds, 1);
+
+       struct MemoryStruct curl_response_mem;
+
+       curl_response_mem.memory = malloc(1);  /* will be grown as needed by the realloc above */
+       curl_response_mem.size = 0;    /* no data at this point */
+
+       CURLcode res;
+
+       curl_easy_reset(curl);
+       set_curl_common_info();
+
+       char url[100];
+       sprintf(url, "http:/v%s/containers/create", getenv("DOCKER_ENGINE_VERSION"));
+
+       // the docker image name to be used is defined in the Dockerfile of the NTS Manager,
+       // under the MODELS_IMAGE env variable
+       char models_var[50];
+       sprintf(models_var, "%s", getenv("MODELS_IMAGE"));
+
+       curl_easy_setopt(curl, CURLOPT_URL, url);
+
+    cJSON *postDataJson = cJSON_CreateObject();
+
+    if (cJSON_AddStringToObject(postDataJson, "Image", models_var) == NULL)
+       {
+       printf("Could not create JSON object: Image\n");
+               return NULL;
+       }
+
+    cJSON *hostConfig = cJSON_CreateObject();
+    if (hostConfig == NULL)
+       {
+       printf("Could not create JSON object: HostConfig\n");
+               return NULL;
+       }
+
+    cJSON_AddItemToObject(postDataJson, "HostConfig", hostConfig);
+
+    cJSON *portBindings = cJSON_CreateObject();
+    if (portBindings == NULL)
+       {
+       printf("Could not create JSON object: PortBindings\n");
+               return NULL;
+       }
+
+    cJSON_AddItemToObject(hostConfig, "PortBindings", portBindings);
+
+    for (int i = 0; i < NETCONF_CONNECTIONS_PER_DEVICE; ++i)
+    {
+       cJSON *port = cJSON_CreateArray();
+               if (port == NULL)
+               {
+               printf("Could not create JSON object: port\n");
+                       return NULL;
+               }
+
+               char dockerContainerPort[20];
+               sprintf(dockerContainerPort, "%d/tcp", 830 + i);
+
+           cJSON_AddItemToObject(portBindings, dockerContainerPort, port);
+
+           cJSON *hostPort = cJSON_CreateObject();
+           if (hostPort == NULL)
+               {
+               printf("Could not create JSON object: HostPort\n");
+                       return NULL;
+               }
+
+           char dockerHostPort[10];
+           sprintf(dockerHostPort, "%d", base_netconf_port + i);
+           if (cJSON_AddStringToObject(hostPort, "HostPort", dockerHostPort) == NULL)
+           {
+               printf("Could not create JSON object: HostPortString\n");
+               return NULL;
+           }
+           if (cJSON_AddStringToObject(hostPort, "HostIp", getenv("NTS_IP")) == NULL)
+           {
+               printf("Could not create JSON object: HostIpString\n");
+               return NULL;
+           }
+
+           cJSON_AddItemToArray(port, hostPort);
+    }
+
+    cJSON *labels = cJSON_CreateObject();
+    if (labels == NULL)
+       {
+       printf("Could not create JSON object: Labels\n");
+               return NULL;
+       }
+
+    cJSON_AddItemToObject(postDataJson, "Labels", labels);
+
+    if (cJSON_AddStringToObject(labels, "NTS", "") == NULL)
+    {
+       printf("Could not create JSON object: NTS\n");
+       return NULL;
+    }
+
+    cJSON *env_variables_array = cJSON_CreateArray();
+    if (env_variables_array == NULL)
+       {
+       printf("Could not create JSON object: Env array\n");
+               return NULL;
+       }
+
+    cJSON_AddItemToObject(postDataJson, "Env", env_variables_array);
+
+    char environment_var[50];
+    sprintf(environment_var, "NTS_IP=%s", getenv("NTS_IP"));
+
+    cJSON *env_var_obj = cJSON_CreateString(environment_var);
+    if (env_var_obj == NULL)
+       {
+       printf("Could not create JSON object: Env array object NTS_IP\n");
+               return NULL;
+       }
+    cJSON_AddItemToArray(env_variables_array, env_var_obj);
+
+    sprintf(environment_var, "NETCONF_BASE=%d", base_netconf_port);
+    cJSON *env_var_obj_2 = cJSON_CreateString(environment_var);
+    if (env_var_obj_2 == NULL)
+       {
+       printf("Could not create JSON object: Env array object NETCONF_BASE\n");
+               return NULL;
+       }
+    cJSON_AddItemToArray(env_variables_array, env_var_obj_2);
+
+       char scripts_dir[200];
+       sprintf(scripts_dir, "SCRIPTS_DIR=%s", getenv("SCRIPTS_DIR"));
+       cJSON *env_var_obj_3 = cJSON_CreateString(scripts_dir);
+       if (env_var_obj_3 == NULL)
+       {
+               printf("Could not create JSON object: Env array object SCRIPTS_DIR\n");
+               return NULL;
+       }
+       cJSON_AddItemToArray(env_variables_array, env_var_obj_3);
+
+    cJSON_AddItemToObject(hostConfig, "Binds", binds);
+
+    char *post_data_string = NULL;
+
+    post_data_string = cJSON_PrintUnformatted(postDataJson);
+
+    printf("Post data JSON:\n%s\n", post_data_string);
+
+    if (postDataJson != NULL)
+    {
+       cJSON_Delete(postDataJson);
+    }
+
+    curl_easy_setopt(curl, CURLOPT_POSTFIELDS, post_data_string);
+
+       curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)&curl_response_mem);
+
+       res = curl_easy_perform(curl);
+
+       if (res != CURLE_OK)
+       {
+               return NULL;
+       }
+       else
+       {
+               cJSON *json_response = cJSON_Parse(curl_response_mem.memory);
+               const cJSON *container_id = NULL;
+
+               printf("%lu bytes retrieved\n", (unsigned long)curl_response_mem.size);
+
+               container_id = cJSON_GetObjectItemCaseSensitive(json_response, "Id");
+
+               if (cJSON_IsString(container_id) && (container_id->valuestring != NULL))
+               {
+                       printf("Container id: \"%s\"\n", container_id->valuestring);
+
+                       char container_id_short[13];
+
+                       memset(container_id_short, '\0', sizeof(container_id_short));
+                       strncpy(container_id_short, container_id->valuestring, 12);
+
+                       printf("Container id short: \"%s\"\n", container_id_short);
+
+                   cJSON_Delete(json_response);
+                       return strdup(container_id_short);
+               }
+
+           cJSON_Delete(json_response);
+       }
+
+       return NULL;
+}
+
+static int start_docker_container_curl(char *container_id)
+{
+       struct MemoryStruct curl_response_mem;
+
+       curl_response_mem.memory = malloc(1);  /* will be grown as needed by the realloc above */
+       curl_response_mem.size = 0;    /* no data at this point */
+
+       CURLcode res;
+
+       curl_easy_reset(curl);
+       set_curl_common_info();
+
+       char url[100];
+       sprintf(url, "http:/v%s/containers/%s/start", getenv("DOCKER_ENGINE_VERSION"), container_id);
+
+       curl_easy_setopt(curl, CURLOPT_URL, url);
+
+    curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "");
+
+       curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)&curl_response_mem);
+
+       res = curl_easy_perform(curl);
+
+       if (res != CURLE_OK)
+       {
+               return SR_ERR_OPERATION_FAILED;
+       }
+       else
+       {
+               printf("Container %s started successfully!\n", container_id);
+       }
+
+       return SR_ERR_OK;
+}
+
+static int kill_and_remove_docker_container_curl(char *container_id)
+{
+       struct MemoryStruct curl_response_mem;
+
+       curl_response_mem.memory = malloc(1);  /* will be grown as needed by the realloc above */
+       curl_response_mem.size = 0;    /* no data at this point */
+
+       CURLcode res;
+
+       curl_easy_reset(curl);
+       set_curl_common_info();
+
+       char url[100];
+       sprintf(url, "http:/v%s/containers/%s?force=true", getenv("DOCKER_ENGINE_VERSION"), container_id);
+
+       curl_easy_setopt(curl, CURLOPT_URL, url);
+
+    curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "");
+    curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "DELETE");
+
+       curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)&curl_response_mem);
+
+       res = curl_easy_perform(curl);
+
+       if (res != CURLE_OK)
+       {
+               return SR_ERR_OPERATION_FAILED;
+       }
+       else
+       {
+               printf("Container %s removed successfully!\n", container_id);
+       }
+
+       return SR_ERR_OK;
+}
+
+static int send_mount_device_instance_ssh(char *url, char *credentials, char *device_name, int device_port)
+{
+       CURLcode res;
+
+       curl_easy_reset(curl_odl);
+       set_curl_common_info_odl();
+
+       char url_for_curl[200];
+       sprintf(url_for_curl, "%s%s_%d", url, device_name, device_port);
+
+       curl_easy_setopt(curl_odl, CURLOPT_URL, url_for_curl);
+
+       char post_data_xml[1000];
+
+       sprintf(post_data_xml,
+                       "<node xmlns=\"urn:TBD:params:xml:ns:yang:network-topology\">"
+                       "<node-id>%s_%d</node-id>"
+                       "<host xmlns=\"urn:opendaylight:netconf-node-topology\">%s</host>"
+                       "<port xmlns=\"urn:opendaylight:netconf-node-topology\">%d</port>"
+                       "<username xmlns=\"urn:opendaylight:netconf-node-topology\">%s</username>"
+                       "<password xmlns=\"urn:opendaylight:netconf-node-topology\">%s</password>"
+                       "<tcp-only xmlns=\"urn:opendaylight:netconf-node-topology\">false</tcp-only>"
+                       "<keepalive-delay xmlns=\"urn:opendaylight:netconf-node-topology\">120</keepalive-delay>"
+                       "</node>",
+                       device_name, device_port, getenv("NTS_IP"), device_port, "netconf", "netconf");
+
+       printf("Post data:\n%s\n", post_data_xml);
+
+       curl_easy_setopt(curl_odl, CURLOPT_POSTFIELDS, post_data_xml);
+    curl_easy_setopt(curl_odl, CURLOPT_CUSTOMREQUEST, "PUT");
+    curl_easy_setopt(curl_odl, CURLOPT_USERPWD, credentials);
+
+       res = curl_easy_perform(curl_odl);
+       if (res != CURLE_OK)
+       {
+               printf("cURL failed to url=%s\n", url_for_curl);
+       }
+
+       long http_response_code = 0;
+       curl_easy_getinfo (curl_odl, CURLINFO_RESPONSE_CODE, &http_response_code);
+       if (http_response_code >= 200 && http_response_code <= 226 && http_response_code != CURLE_ABORTED_BY_CALLBACK)
+       {
+               printf("cURL succeeded to url=%s\n", url_for_curl);
+       }
+       else
+       {
+           printf("cURL to url=%s failed with code=%ld\n", url_for_curl, http_response_code);
+               return SR_ERR_OPERATION_FAILED;
+       }
+
+       return SR_ERR_OK;
+}
+
+static int send_mount_device_instance_tls(char *url, char *credentials, char *device_name, int device_port)
+{
+       CURLcode res;
+
+       curl_easy_reset(curl_odl);
+       set_curl_common_info_odl();
+
+       char url_for_curl[200];
+       sprintf(url_for_curl, "%s%s_%d", url, device_name, device_port);
+
+       curl_easy_setopt(curl_odl, CURLOPT_URL, url_for_curl);
+
+       char post_data_xml[1000];
+
+       sprintf(post_data_xml,
+                       "<node xmlns=\"urn:TBD:params:xml:ns:yang:network-topology\">"
+                       "<protocol xmlns=\"urn:opendaylight:netconf-node-topology\">"
+                       "<name>TLS</name>"
+                       "</protocol>"
+                       "<node-id>%s_%d</node-id>"
+                       "<host xmlns=\"urn:opendaylight:netconf-node-topology\">%s</host>"
+                       "<key-based xmlns=\"urn:opendaylight:netconf-node-topology\">"
+                       "<username>%s</username>"
+                       "<key-id>device-key</key-id>"
+                       "</key-based>"
+                       "<port xmlns=\"urn:opendaylight:netconf-node-topology\">%d</port>"
+                       "<tcp-only xmlns=\"urn:opendaylight:netconf-node-topology\">false</tcp-only>"
+                       "<keepalive-delay xmlns=\"urn:opendaylight:netconf-node-topology\">120</keepalive-delay>"
+                       "</node>",
+                       device_name, device_port, getenv("NTS_IP"), "netconf", device_port);
+
+       printf("Post data:\n%s\n", post_data_xml);
+
+       curl_easy_setopt(curl_odl, CURLOPT_POSTFIELDS, post_data_xml);
+    curl_easy_setopt(curl_odl, CURLOPT_CUSTOMREQUEST, "PUT");
+    curl_easy_setopt(curl_odl, CURLOPT_USERPWD, credentials);
+
+       res = curl_easy_perform(curl_odl);
+       if (res != CURLE_OK)
+       {
+               printf("cURL failed to url=%s\n", url_for_curl);
+       }
+
+       long http_response_code = 0;
+       curl_easy_getinfo (curl_odl, CURLINFO_RESPONSE_CODE, &http_response_code);
+       if (http_response_code >= 200 && http_response_code <= 226 && http_response_code != CURLE_ABORTED_BY_CALLBACK)
+       {
+               printf("cURL succeeded to url=%s\n", url_for_curl);
+       }
+       else
+       {
+           printf("cURL to url=%s failed with code=%ld\n", url_for_curl, http_response_code);
+               return SR_ERR_OPERATION_FAILED;
+       }
+
+       return SR_ERR_OK;
+}
+
+static int send_unmount_device_instance(char *url, char *credentials, char *device_name, int device_port)
+{
+       CURLcode res;
+
+       curl_easy_reset(curl_odl);
+       set_curl_common_info_odl();
+
+       char url_for_curl[200];
+       sprintf(url_for_curl, "%s%s_%d", url, device_name, device_port);
+
+       curl_easy_setopt(curl_odl, CURLOPT_URL, url_for_curl);
+
+       curl_easy_setopt(curl_odl, CURLOPT_POSTFIELDS, "");
+       curl_easy_setopt(curl_odl, CURLOPT_CUSTOMREQUEST, "DELETE");
+       curl_easy_setopt(curl_odl, CURLOPT_USERPWD, credentials);
+
+       res = curl_easy_perform(curl_odl);
+       if (res != CURLE_OK)
+       {
+               printf("cURL failed to url=%s\n", url_for_curl);
+       }
+
+       long http_response_code = 0;
+       curl_easy_getinfo (curl_odl, CURLINFO_RESPONSE_CODE, &http_response_code);
+       if (http_response_code == 200 && http_response_code != CURLE_ABORTED_BY_CALLBACK)
+       {
+               printf("cURL succeeded to url=%s\n", url_for_curl);
+       }
+       else
+       {
+               printf("cURL to url=%s failed with code=%ld\n", url_for_curl, http_response_code);
+               return SR_ERR_OPERATION_FAILED;
+       }
+
+
+       return SR_ERR_OK;
+}
+
+
+static int send_mount_device(device_t *current_device, controller_t controller_details)
+{
+       int rc = SR_ERR_OK;
+       bool is_mounted = true;
+
+       //This is where we hardcoded: 7 devices will have SSH connections and 3 devices will have TLS connections
+       for (int port = 0; port < NETCONF_CONNECTIONS_PER_DEVICE - 3; ++port)
+       {
+               rc = send_mount_device_instance_ssh(controller_details.url, controller_details.credentials,
+                               current_device->device_id, current_device->netconf_port + port);
+               if (rc != SR_ERR_OK)
+               {
+                       is_mounted = false;
+               }
+       }
+       for (int port = NETCONF_CONNECTIONS_PER_DEVICE - 3; port < NETCONF_CONNECTIONS_PER_DEVICE; ++port)
+       {
+               rc = send_mount_device_instance_tls(controller_details.url, controller_details.credentials,
+                               current_device->device_id, current_device->netconf_port + port);
+               if (rc != SR_ERR_OK)
+               {
+                       is_mounted = false;
+               }
+       }
+
+       current_device->is_mounted = is_mounted;
+
+       return SR_ERR_OK;
+}
+
+static int send_unmount_device(device_t *current_device, controller_t controller_details)
+{
+       int rc = SR_ERR_OK;
+
+       for (int port = 0; port < NETCONF_CONNECTIONS_PER_DEVICE; ++port)
+       {
+               rc = send_unmount_device_instance(controller_details.url, controller_details.credentials,
+                               current_device->device_id, current_device->netconf_port + port);
+               if (rc != SR_ERR_OK)
+               {
+                       printf("Could not send unmount for ODL with url=\"%s\", for device=\"%s\" and port=%d\n",
+                                       controller_details.url, current_device->device_id, current_device->netconf_port);
+               }
+       }
+       current_device->is_mounted = false;
+
+       return SR_ERR_OK;
+}
+
+device_stack_t *new_device_stack(void)
+{
+       device_stack_t *stack = malloc(sizeof(*stack));
+
+       if (stack) {
+               stack->head = NULL;
+               stack->stack_size = 0;
+       }
+       return stack;
+}
+
+void push_device(device_stack_t *theStack, char *dev_id, int port)
+{
+       device_t *new_dev = malloc(sizeof(*new_dev));
+
+       if (new_dev) {
+               new_dev->device_id = strdup(dev_id);
+               new_dev->netconf_port = port;
+               new_dev->is_mounted = false;
+               new_dev->operational_state = strdup("not-specified");
+
+               new_dev->next = theStack->head;
+
+               theStack->head = new_dev;
+               theStack->stack_size++;
+       }
+}
+
+void pop_device(device_stack_t *theStack)
+{
+       if (theStack && theStack->head) {
+               device_t *temp = theStack->head;
+               theStack->head = theStack->head->next;
+
+               free(temp->device_id);
+               free(temp->operational_state);
+               free(temp);
+               theStack->stack_size--;
+       }
+}
+
+int get_netconf_port_next(device_stack_t *theStack)
+{
+       if (theStack && theStack->stack_size > 0) {
+               return theStack->head->netconf_port + NETCONF_CONNECTIONS_PER_DEVICE;
+       }
+
+       return get_netconf_port_base();
+}
+
+int get_netconf_port_base()
+{
+       int netconf_port_base = 0, rc;
+
+       char *netconf_base_string = getenv("NETCONF_BASE");
+
+       if (netconf_base_string != NULL)
+       {
+               rc = sscanf(netconf_base_string, "%d", &netconf_port_base);
+               if (rc != 1)
+               {
+                       printf("Could not get the NETCONF_BASE port! Using the default 30.000...\n");
+                       netconf_port_base = 30000;
+               }
+       }
+
+       return netconf_port_base;
+}
+
+
+char *get_id_last_device(device_stack_t *theStack)
+{
+       if (theStack && theStack->head) {
+               return theStack->head->device_id;
+       }
+       return NULL;
+}
+
+int get_current_number_of_mounted_devices(device_stack_t *theStack)
+{
+       int mounted_devices = 0;
+
+       if (theStack && theStack->head)
+       {
+               device_t *current_device = theStack->head;
+
+               while (current_device != NULL)
+               {
+                       if (current_device->is_mounted)
+                       {
+                               mounted_devices++;
+                       }
+                       current_device = current_device->next;
+               }
+       }
+
+       return mounted_devices;
+}
+
+int get_current_number_of_devices(device_stack_t *theStack)
+{
+       struct MemoryStruct curl_response_mem;
+
+       curl_response_mem.memory = malloc(1);  /* will be grown as needed by the realloc above */
+       curl_response_mem.size = 0;    /* no data at this point */
+
+       CURLcode res;
+
+       curl_easy_reset(curl);
+       set_curl_common_info();
+
+       char url[100];
+       sprintf(url, "http:/v%s/containers/json?all=true&filters={\"label\":[\"NTS\"],\"status\":[\"running\"]}",
+                       getenv("DOCKER_ENGINE_VERSION"));
+
+       curl_easy_setopt(curl, CURLOPT_URL, url);
+
+       curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "");
+       curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "GET");
+
+       curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)&curl_response_mem);
+
+       res = curl_easy_perform(curl);
+
+       if (res != CURLE_OK)
+       {
+               return SR_ERR_OPERATION_FAILED;
+       }
+       else
+       {
+               cJSON *json_response = cJSON_Parse(curl_response_mem.memory);
+
+               printf("%lu bytes retrieved\n", (unsigned long)curl_response_mem.size);
+
+               if (json_response == NULL || !cJSON_IsArray(json_response))
+               {
+                       printf("Could not parse JSON response for url=\"%s\"\n", url);
+                       return SR_ERR_OPERATION_FAILED;
+               }
+
+               int num_of_devices = cJSON_GetArraySize(json_response);
+               cJSON_Delete(json_response);
+
+               return num_of_devices;
+       }
+
+       return 0;
+}
+
+static int set_operational_state_of_device(device_stack_t *theStack, char *device_id, char *operational_state)
+{
+       if (theStack && theStack->head)
+       {
+               device_t *current_device = theStack->head;
+
+               while (current_device != NULL)
+               {
+                       if (strcmp(current_device->device_id, device_id) == 0)
+                       {
+                               free(current_device->operational_state);
+                               current_device->operational_state = strdup(operational_state);
+
+                               return SR_ERR_OK;
+                       }
+
+                       current_device = current_device->next;
+               }
+       }
+
+       printf("Could not find device with uuid=\"%s\"\n", device_id);
+       return SR_ERR_OPERATION_FAILED;
+}
+
+char* get_docker_container_operational_state(device_stack_t *theStack, char *container_id)
+{
+       if (theStack && theStack->head)
+       {
+               device_t *current_device = theStack->head;
+
+               while (current_device != NULL)
+               {
+                       if (strcmp(current_device->device_id, container_id) == 0)
+                       {
+                               return current_device->operational_state;
+                       }
+
+                       current_device = current_device->next;
+               }
+       }
+
+       return NULL;
+}
+
+int start_device(device_stack_t *theStack)
+{
+       int rc = SR_ERR_OK;
+       static cJSON* managerBindings = NULL;
+
+       if (managerBindings == NULL)
+       {
+               managerBindings = get_docker_container_bindings();
+       }
+
+       int netconf_base = get_netconf_port_next(theStack);
+
+       char *dev_id = create_docker_container_curl(netconf_base, managerBindings);
+
+       push_device(theStack, dev_id, netconf_base);
+
+       rc = start_docker_container_curl(dev_id);
+       if (rc != SR_ERR_OK)
+       {
+               printf("Could not start device with device_id=\"%s\"\n", dev_id);
+       }
+
+       if (dev_id) {
+               free(dev_id);
+       }
+
+       return SR_ERR_OK;
+}
+
+int _init_curl()
+{
+       curl = curl_easy_init();
+
+       if (curl == NULL) {
+               printf("cURL initialization error! Aborting call!\n");
+               return SR_ERR_OPERATION_FAILED;
+       }
+
+       return SR_ERR_OK;
+}
+
+int cleanup_curl()
+{
+       if (curl != NULL)
+       {
+               curl_easy_cleanup(curl);
+       }
+
+       return SR_ERR_OK;
+}
+
+int _init_curl_odl()
+{
+       curl_odl = curl_easy_init();
+
+       if (curl_odl == NULL) {
+               printf("cURL initialization error! Aborting call!\n");
+               return SR_ERR_OPERATION_FAILED;
+       }
+
+       return SR_ERR_OK;
+}
+
+int cleanup_curl_odl()
+{
+       if (curl_odl != NULL)
+       {
+               curl_easy_cleanup(curl_odl);
+       }
+
+       return SR_ERR_OK;
+}
+
+int stop_device(device_stack_t *theStack)
+{
+       int rc = SR_ERR_OK;
+       char *last_id = get_id_last_device(theStack);
+
+       rc = kill_and_remove_docker_container_curl(last_id);
+       if (rc != SR_ERR_OK)
+       {
+               printf("Could not kill and remove docker container with uuid=\"%s\"\n", last_id);
+       }
+
+       pop_device(theStack);
+
+       return SR_ERR_OK;
+}
+
+int mount_device(device_stack_t *theStack, controller_t controller_details)
+{
+       int rc;
+
+       if (theStack && theStack->head)
+       {
+               device_t *current_device = theStack->head;
+               while (current_device != NULL && current_device->is_mounted == true)
+               {
+                       printf("Device \"%s\" is already mounted, skipping...\n", current_device->device_id);
+                       current_device = current_device->next;
+               }
+
+               if (current_device != NULL)
+               {
+                       printf("Sending mount device for device \"%s\"...\n", current_device->device_id);
+                       rc = send_mount_device(current_device, controller_details);
+                       if (rc != SR_ERR_OK)
+                       {
+                               return SR_ERR_OPERATION_FAILED;
+                       }
+               }
+       }
+
+       return SR_ERR_OK;
+}
+
+int unmount_device(device_stack_t *theStack, controller_t controller_list)
+{
+       int rc;
+
+       if (theStack && theStack->head)
+       {
+               device_t *current_device = theStack->head;
+               while (current_device != NULL && current_device->is_mounted == false)
+               {
+                       printf("Device \"%s\" is already unmounted, skipping...\n", current_device->device_id);
+                       current_device = current_device->next;
+               }
+
+               if (current_device != NULL)
+               {
+                       printf("Sending unmount device for device \"%s\"...\n", current_device->device_id);
+                       rc = send_unmount_device(current_device, controller_list);
+                       if (rc != SR_ERR_OK)
+                       {
+                               return SR_ERR_OPERATION_FAILED;
+                       }
+               }
+       }
+
+       return SR_ERR_OK;
+}
+
+int get_docker_containers_operational_state_curl(device_stack_t *theStack)
+{
+       int rc = SR_ERR_OK;
+       struct MemoryStruct curl_response_mem;
+
+       curl_response_mem.memory = malloc(1);  /* will be grown as needed by the realloc above */
+       curl_response_mem.size = 0;    /* no data at this point */
+
+       CURLcode res;
+
+       curl_easy_reset(curl);
+       set_curl_common_info();
+
+       char url[100];
+       sprintf(url, "http:/v%s/containers/json?all=true&filters={\"label\":[\"NTS\"]}", getenv("DOCKER_ENGINE_VERSION"));
+
+       curl_easy_setopt(curl, CURLOPT_URL, url);
+
+    curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "");
+    curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "GET");
+
+       curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)&curl_response_mem);
+
+       res = curl_easy_perform(curl);
+
+       if (res != CURLE_OK)
+       {
+               return SR_ERR_OPERATION_FAILED;
+       }
+       else
+       {
+               cJSON *json_response = cJSON_Parse(curl_response_mem.memory);
+               const cJSON *container = NULL;
+
+               printf("%lu bytes retrieved\n", (unsigned long)curl_response_mem.size);
+
+               if (json_response == NULL || !cJSON_IsArray(json_response))
+               {
+                       printf("Could not parse JSON response for url=\"%s\"\n", url);
+                       return SR_ERR_OPERATION_FAILED;
+               }
+
+           cJSON_ArrayForEach(container, json_response)
+           {
+               cJSON *container_id_long = cJSON_GetObjectItemCaseSensitive(container, "Id");
+               cJSON *state = cJSON_GetObjectItemCaseSensitive(container, "State");
+
+                       if (cJSON_IsString(container_id_long) && (container_id_long->valuestring != NULL))
+                       {
+                               char container_id_short[13];
+
+                               memset(container_id_short, '\0', sizeof(container_id_short));
+                               strncpy(container_id_short, container_id_long->valuestring, 12);
+
+                               if (cJSON_IsString(state) && (state->valuestring != NULL))
+                               {
+                                       rc = set_operational_state_of_device(theStack, container_id_short, state->valuestring);
+                                       if (rc != SR_ERR_OK)
+                                       {
+                                               printf("Could not set the operational state for the device with uuid=\"%s\"\n", container_id_short);
+                                       }
+                               }
+                       }
+           }
+
+           cJSON_Delete(json_response);
+       }
+
+       return SR_ERR_OK;
+}
+
+char* get_docker_container_resource_stats(device_stack_t *theStack)
+{
+       char line[LINE_BUFSIZE];
+       int linenr;
+       FILE *pipe;
+
+       /* Get a pipe where the output from the scripts comes in */
+       char script[200];
+       sprintf(script, "%s/docker_stats.sh", getenv("SCRIPTS_DIR"));
+
+       pipe = popen(script, "r");
+       if (pipe == NULL) {  /* check for errors */
+               printf("Could not open script.\n");
+               return NULL;        /* return with exit code indicating error */
+       }
+
+       /* Read script output from the pipe line by line */
+       linenr = 1;
+       while (fgets(line, LINE_BUFSIZE, pipe) != NULL) {
+               printf("Script output line %d: %s", linenr, line);
+               ++linenr;
+
+               pclose(pipe); /* Close the pipe */
+               return strdup(line);
+       }
+
+       /* Once here, out of the loop, the script has ended. */
+       pclose(pipe); /* Close the pipe */
+       return NULL;     /* return with exit code indicating success. */
+}
+
+int notification_delay_period_changed(int period)
+{
+       char *stringConfiguration = readConfigFileInString();
+
+       if (stringConfiguration == NULL)
+       {
+               printf("Could not read configuration file!\n");
+               return SR_ERR_OPERATION_FAILED;
+       }
+
+       cJSON *jsonConfig = cJSON_Parse(stringConfiguration);
+       if (jsonConfig == NULL)
+       {
+               free(stringConfiguration);
+               const char *error_ptr = cJSON_GetErrorPtr();
+               if (error_ptr != NULL)
+               {
+                       fprintf(stderr, "Could not parse JSON configuration! Error before: %s\n", error_ptr);
+               }
+               return SR_ERR_OPERATION_FAILED;
+       }
+       //we don't need the string anymore
+       free(stringConfiguration);
+       stringConfiguration = NULL;
+
+       cJSON *notifConfig = cJSON_GetObjectItemCaseSensitive(jsonConfig, "notification-config");
+       if (!cJSON_IsObject(notifConfig))
+       {
+               printf("Configuration JSON is not as expected: notification-config is not an object");
+               free(jsonConfig);
+               return SR_ERR_OPERATION_FAILED;
+       }
+
+       cJSON *faultNotifDelay = cJSON_GetObjectItemCaseSensitive(notifConfig, "fault-notification-delay-period");
+       if (!cJSON_IsNumber(faultNotifDelay))
+       {
+               printf("Configuration JSON is not as expected: fault-notification-delay-period is not an object");
+               free(jsonConfig);
+               return SR_ERR_OPERATION_FAILED;
+       }
+
+       //we set the value of the fault-notification-delay-period object
+       cJSON_SetNumberValue(faultNotifDelay, period);
+
+       //writing the new JSON to the configuration file
+       stringConfiguration = cJSON_Print(jsonConfig);
+       writeConfigFile(stringConfiguration);
+
+       free(jsonConfig);
+
+       return SR_ERR_OK;
+}
+
+int ves_heartbeat_period_changed(int period)
+{
+       char *stringConfiguration = readConfigFileInString();
+
+       if (stringConfiguration == NULL)
+       {
+               printf("Could not read configuration file!\n");
+               return SR_ERR_OPERATION_FAILED;
+       }
+
+       cJSON *jsonConfig = cJSON_Parse(stringConfiguration);
+       if (jsonConfig == NULL)
+       {
+               free(stringConfiguration);
+               const char *error_ptr = cJSON_GetErrorPtr();
+               if (error_ptr != NULL)
+               {
+                       fprintf(stderr, "Could not parse JSON configuration! Error before: %s\n", error_ptr);
+               }
+               return SR_ERR_OPERATION_FAILED;
+       }
+       //we don't need the string anymore
+       free(stringConfiguration);
+       stringConfiguration = NULL;
+
+       cJSON *notifConfig = cJSON_GetObjectItemCaseSensitive(jsonConfig, "notification-config");
+       if (!cJSON_IsObject(notifConfig))
+       {
+               printf("Configuration JSON is not as expected: notification-config is not an object");
+               free(jsonConfig);
+               return SR_ERR_OPERATION_FAILED;
+       }
+
+       cJSON *vesHeartbeatPeriod = cJSON_GetObjectItemCaseSensitive(notifConfig, "ves-heartbeat-period");
+       if (!cJSON_IsNumber(vesHeartbeatPeriod))
+       {
+               printf("Configuration JSON is not as expected: ves-heartbeat-period is not an object");
+               free(jsonConfig);
+               return SR_ERR_OPERATION_FAILED;
+       }
+
+       //we set the value of the fault-notification-delay-period object
+       cJSON_SetNumberValue(vesHeartbeatPeriod, period);
+
+       //writing the new JSON to the configuration file
+       stringConfiguration = cJSON_Print(jsonConfig);
+       writeConfigFile(stringConfiguration);
+
+       free(jsonConfig);
+
+       return SR_ERR_OK;
+}
+
+static int add_keystore_entry_odl(char *url, char *credentials)
+{
+       CURLcode res;
+
+       curl_easy_reset(curl_odl);
+       set_curl_common_info_odl();
+
+       char url_for_curl[200];
+       sprintf(url_for_curl, "%s", url);
+
+       curl_easy_setopt(curl_odl, CURLOPT_URL, url_for_curl);
+
+       char post_data_xml[2000];
+
+       sprintf(post_data_xml,
+                       "<input xmlns=\"urn:opendaylight:netconf:keystore\">"
+                       "<key-credential>"
+                       "<key-id>device-key</key-id>"
+                       "<private-key>MIIEpAIBAAKCAQEAueCQaNQWoNmFK6LKu1p8U8ZWdWg/PvDdLsJyzfzl/Qw4UA68"
+                       "SfFNaY06zZl8QB9W02nr5kWeeMY0VA3adrPgOlvfx3oWlFbkETnMaN4OT3WTQ0Wt"
+                       "6jAWZDzVfopwpJPAzRPxACDftIqFGagYcF32hZlVNqqnVdbXh0S0EViweqp/dbG4"
+                       "VDUHSNVbglc+u4UbEzNIFXMdEFsJZpkynOmSiTsIATqIhb+2srkVgLwhfkC2qkuH"
+                       "QwAHdubuB07ObM2z01UhyEdDvEYGHwtYAGDBL2TAcsI0oGeVkRyuOkV0QY0UN7UE"
+                       "FI1yTYw+xZ42HgFx3uGwApCImxhbj69GBYWFqwIDAQABAoIBAQCZN9kR8DGu6V7y"
+                       "t0Ax68asL8O5B/OKaHWKQ9LqpVrXmikZJOxkbzoGldow/CIFoU+q+Zbwu9aDa65a"
+                       "0wiP7Hoa4Py3q5XNNUrOQDyU/OYC7cI0I83WS0lJ2zOJGYj8wKae5Z81IeQFKGHK"
+                       "4lsy1OGPAvPRGh7RjUUgRavA2MCwe07rWRuDb/OJFe4Oh56UMEjwMiNBtMNtncog"
+                       "j1vr/qgRJdf9tf0zlJmLvUJ9+HSFFV9I/97LJyFhb95gAfHkjdVroLVgT3Cho+4P"
+                       "WtZaKCIGD0OwfOG2nLV4leXvRUk62/LMlB8NI9+JF7Xm+HCKbaWHNWC7mvWSLV58"
+                       "Zl4AbUWRAoGBANyJ6SFHFRHSPDY026SsdMzXR0eUxBAK7G70oSBKKhY+O1j0ocLE"
+                       "jI2krHJBhHbLlnvJVyMUaCUOTS5m0uDw9hgSsAqeSL3hL38kxVZw+KNG9Ouno1Fl"
+                       "KnE/xXHlPQyeGs/P8nAMzHZxQtEsQdQayJEhK2XXHTsy7Q3MxDisfVJ1AoGBANfD"
+                       "34gB+OMx6pwj7zk3qWbYXSX8xjCZMR0ciko+h4xeMP2N8B0oyoqC+v1ABMAtJ3wG"
+                       "sGZd0hV9gwM7OUM3SEwkn6oeg1GemWLcn4rlSmTnZc4aeVwrEWlnSNFX3s4g9l4u"
+                       "k8Ugu4MVJYqH8HuDQ5Ggl6/QAwPzMSEdCW0O+jOfAoGAIBRbegC5+t6m7Yegz4Ja"
+                       "dxV1g98K6f58x+MDsQu4tYWV4mmrQgaPH2dtwizvlMwmdpkh+LNWNtWuumowkJHc"
+                       "akIFo3XExQIFg6wYnGtQb4e5xrGa2xMpKlIJaXjb+YLiCYqJDG2ALFZrTrvuU2kV"
+                       "9a5qfqTc1qigvNolTM0iaaUCgYApmrZWhnLUdEKV2wP813PNxfioI4afxlpHD8LG"
+                       "sCn48gymR6E+Lihn7vuwq5B+8fYEH1ISWxLwW+RQUjIneNhy/jjfV8TgjyFqg7or"
+                       "0Sy4KjpiNI6kLBXOakELRNNMkeSPopGR2E7v5rr3bGD9oAD+aqX1G7oJH/KgPPYd"
+                       "Vl7+ZwKBgQDcHyWYrimjyUgKaQD2GmoO9wdcJYQ59ke9K+OuGlp4ti5arsi7N1tP"
+                       "B4f09aeELM2ASIuk8Q/Mx0jQFnm8lzRFXdewgvdPoZW/7VufM9O7dGPOc41cm2Dh"
+                       "yrTcXx/VmUBb+/fnXVEgCv7gylp/wtdTGHQBQJHR81jFBz0lnLj+gg==</private-key>"
+                       "<passphrase></passphrase>"
+                       "</key-credential>"
+                       "</input>");
+
+       printf("Post data:\n%s\n", post_data_xml);
+
+       curl_easy_setopt(curl_odl, CURLOPT_POSTFIELDS, post_data_xml);
+       curl_easy_setopt(curl_odl, CURLOPT_CUSTOMREQUEST, "POST");
+       curl_easy_setopt(curl_odl, CURLOPT_USERPWD, credentials);
+
+       res = curl_easy_perform(curl_odl);
+       if (res != CURLE_OK)
+       {
+               printf("cURL failed to url=%s\n", url_for_curl);
+       }
+
+       long http_response_code = 0;
+       curl_easy_getinfo (curl_odl, CURLINFO_RESPONSE_CODE, &http_response_code);
+       if (http_response_code >= 200 && http_response_code <= 226 && http_response_code != CURLE_ABORTED_BY_CALLBACK)
+       {
+               printf("cURL succeeded to url=%s\n", url_for_curl);
+       }
+       else
+       {
+               printf("cURL to url=%s failed with code=%ld\n", url_for_curl, http_response_code);
+               return SR_ERR_OPERATION_FAILED;
+       }
+
+       return SR_ERR_OK;
+}
+
+static int add_private_key_odl(char *url, char *credentials)
+{
+       CURLcode res;
+
+       curl_easy_reset(curl_odl);
+       set_curl_common_info_odl();
+
+       char url_for_curl[200];
+       sprintf(url_for_curl, "%s", url);
+
+       curl_easy_setopt(curl_odl, CURLOPT_URL, url_for_curl);
+
+       char post_data_xml[4000];
+
+       sprintf(post_data_xml,
+                       "<input xmlns=\"urn:opendaylight:netconf:keystore\">"
+                       "<private-key>"
+                       "<name>device-key</name>"
+                       "<data>MIIEpAIBAAKCAQEAueCQaNQWoNmFK6LKu1p8U8ZWdWg/PvDdLsJyzfzl/Qw4UA68SfFNaY06zZl8QB9W02nr5kWeeMY0VA3adrPgOlvfx3oWlFbkETnMaN4OT3WTQ0Wt6jAWZDzVfopwpJPAzRPxACDftIqFGagYcF32hZlVNqqnVdbXh0S0EViweqp/dbG4VDUHSNVbglc+u4UbEzNIFXMdEFsJZpkynOmSiTsIATqIhb+2srkVgLwhfkC2qkuHQwAHdubuB07ObM2z01UhyEdDvEYGHwtYAGDBL2TAcsI0oGeVkRyuOkV0QY0UN7UEFI1yTYw+xZ42HgFx3uGwApCImxhbj69GBYWFqwIDAQABAoIBAQCZN9kR8DGu6V7yt0Ax68asL8O5B/OKaHWKQ9LqpVrXmikZJOxkbzoGldow/CIFoU+q+Zbwu9aDa65a0wiP7Hoa4Py3q5XNNUrOQDyU/OYC7cI0I83WS0lJ2zOJGYj8wKae5Z81IeQFKGHK4lsy1OGPAvPRGh7RjUUgRavA2MCwe07rWRuDb/OJFe4Oh56UMEjwMiNBtMNtncogj1vr/qgRJdf9tf0zlJmLvUJ9+HSFFV9I/97LJyFhb95gAfHkjdVroLVgT3Cho+4PWtZaKCIGD0OwfOG2nLV4leXvRUk62/LMlB8NI9+JF7Xm+HCKbaWHNWC7mvWSLV58Zl4AbUWRAoGBANyJ6SFHFRHSPDY026SsdMzXR0eUxBAK7G70oSBKKhY+O1j0ocLEjI2krHJBhHbLlnvJVyMUaCUOTS5m0uDw9hgSsAqeSL3hL38kxVZw+KNG9Ouno1FlKnE/xXHlPQyeGs/P8nAMzHZxQtEsQdQayJEhK2XXHTsy7Q3MxDisfVJ1AoGBANfD34gB+OMx6pwj7zk3qWbYXSX8xjCZMR0ciko+h4xeMP2N8B0oyoqC+v1ABMAtJ3wGsGZd0hV9gwM7OUM3SEwkn6oeg1GemWLcn4rlSmTnZc4aeVwrEWlnSNFX3s4g9l4uk8Ugu4MVJYqH8HuDQ5Ggl6/QAwPzMSEdCW0O+jOfAoGAIBRbegC5+t6m7Yegz4JadxV1g98K6f58x+MDsQu4tYWV4mmrQgaPH2dtwizvlMwmdpkh+LNWNtWuumowkJHcakIFo3XExQIFg6wYnGtQb4e5xrGa2xMpKlIJaXjb+YLiCYqJDG2ALFZrTrvuU2kV9a5qfqTc1qigvNolTM0iaaUCgYApmrZWhnLUdEKV2wP813PNxfioI4afxlpHD8LGsCn48gymR6E+Lihn7vuwq5B+8fYEH1ISWxLwW+RQUjIneNhy/jjfV8TgjyFqg7or0Sy4KjpiNI6kLBXOakELRNNMkeSPopGR2E7v5rr3bGD9oAD+aqX1G7oJH/KgPPYdVl7+ZwKBgQDcHyWYrimjyUgKaQD2GmoO9wdcJYQ59ke9K+OuGlp4ti5arsi7N1tPB4f09aeELM2ASIuk8Q/Mx0jQFnm8lzRFXdewgvdPoZW/7VufM9O7dGPOc41cm2DhyrTcXx/VmUBb+/fnXVEgCv7gylp/wtdTGHQBQJHR81jFBz0lnLj+gg==</data>"
+                       "<certificate-chain>MIIECTCCAvGgAwIBAgIBBzANBgkqhkiG9w0BAQsFADCBjDELMAkGA1UEBhMCQ1oxFjAUBgNVBAgMDVNvdXRoIE1vcmF2aWExDTALBgNVBAcMBEJybm8xDzANBgNVBAoMBkNFU05FVDEMMAoGA1UECwwDVE1DMRMwEQYDVQQDDApleGFtcGxlIENBMSIwIAYJKoZIhvcNAQkBFhNleGFtcGxlY2FAbG9jYWxob3N0MB4XDTE1MDczMDA3MjcxOFoXDTM1MDcyNTA3MjcxOFowgYUxCzAJBgNVBAYTAkNaMRYwFAYDVQQIDA1Tb3V0aCBNb3JhdmlhMQ8wDQYDVQQKDAZDRVNORVQxDDAKBgNVBAsMA1RNQzEXMBUGA1UEAwwOZXhhbXBsZSBjbGllbnQxJjAkBgkqhkiG9w0BCQEWF2V4YW1wbGVjbGllbnRAbG9jYWxob3N0MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAueCQaNQWoNmFK6LKu1p8U8ZWdWg/PvDdLsJyzfzl/Qw4UA68SfFNaY06zZl8QB9W02nr5kWeeMY0VA3adrPgOlvfx3oWlFbkETnMaN4OT3WTQ0Wt6jAWZDzVfopwpJPAzRPxACDftIqFGagYcF32hZlVNqqnVdbXh0S0EViweqp/dbG4VDUHSNVbglc+u4UbEzNIFXMdEFsJZpkynOmSiTsIATqIhb+2srkVgLwhfkC2qkuHQwAHdubuB07ObM2z01UhyEdDvEYGHwtYAGDBL2TAcsI0oGeVkRyuOkV0QY0UN7UEFI1yTYw+xZ42HgFx3uGwApCImxhbj69GBYWFqwIDAQABo3sweTAJBgNVHRMEAjAAMCwGCWCGSAGG+EIBDQQfFh1PcGVuU1NMIEdlbmVyYXRlZCBDZXJ0aWZpY2F0ZTAdBgNVHQ4EFgQUXGpLeLnh2cSDARAVA7KrBxGYpo8wHwYDVR0jBBgwFoAUc1YQIqjZsHVwlea0AB4N+ilNI2gwDQYJKoZIhvcNAQELBQADggEBAJPV3RTXFRtNyOU4rjPpYeBAIAFp2aqGc4t2J1c7oPp/1n+lZvjnwtlJpZHxMM783e2ryDQ6dkvXDf8kpwKlg3U3mkJ3xKkDdWrM4QwghXdCN519aa9qmu0zdFL+jUAaWlQ5tsceOrvbusCcbMqiFGk/QfpHqPv52SVWbYyUx7IX7DE+UjgsLHycfV/tlcx4ZE6soTzl9VdgSL/zmzG3rjsr58J80rXckLgBhvijgBlIAJvWfC7D0vaouvBInSFXymdPVoUDZ30cdGLf+hI/i/TfsEMOinLrXVdkSGNo6FXAHKSvXeB9oFKSzhQ7OPyRyqvEPycUSw/qD6FVr80oDDc=</certificate-chain>"
+                       "</private-key>"
+                       "</input>");
+
+       printf("Post data:\n%s\n", post_data_xml);
+
+       curl_easy_setopt(curl_odl, CURLOPT_POSTFIELDS, post_data_xml);
+       curl_easy_setopt(curl_odl, CURLOPT_CUSTOMREQUEST, "POST");
+       curl_easy_setopt(curl_odl, CURLOPT_USERPWD, credentials);
+
+       res = curl_easy_perform(curl_odl);
+       if (res != CURLE_OK)
+       {
+               printf("cURL failed to url=%s\n", url_for_curl);
+       }
+
+       long http_response_code = 0;
+       curl_easy_getinfo (curl_odl, CURLINFO_RESPONSE_CODE, &http_response_code);
+       if (http_response_code >= 200 && http_response_code <= 226 && http_response_code != CURLE_ABORTED_BY_CALLBACK)
+       {
+               printf("cURL succeeded to url=%s\n", url_for_curl);
+       }
+       else
+       {
+               printf("cURL to url=%s failed with code=%ld\n", url_for_curl, http_response_code);
+               return SR_ERR_OPERATION_FAILED;
+       }
+
+       return SR_ERR_OK;
+}
+
+static int add_trusted_ca_odl(char *url, char *credentials)
+{
+       CURLcode res;
+
+       curl_easy_reset(curl_odl);
+       set_curl_common_info_odl();
+
+       char url_for_curl[200];
+       sprintf(url_for_curl, "%s", url);
+
+       curl_easy_setopt(curl_odl, CURLOPT_URL, url_for_curl);
+
+       char post_data_xml[2000];
+
+       sprintf(post_data_xml,
+                       "<input xmlns=\"urn:opendaylight:netconf:keystore\">"
+                       "<trusted-certificate>"
+                       "<name>test_trusted_cert</name>"
+                       "<certificate>MIID7TCCAtWgAwIBAgIJAMtE1NGAR5KoMA0GCSqGSIb3DQEBBQUAMIGMMQswCQYDVQQGEwJDWjEWMBQGA1UECAwNU291dGggTW9yYXZpYTENMAsGA1UEBwwEQnJubzEPMA0GA1UECgwGQ0VTTkVUMQwwCgYDVQQLDANUTUMxEzARBgNVBAMMCmV4YW1wbGUgQ0ExIjAgBgkqhkiG9w0BCQEWE2V4YW1wbGVjYUBsb2NhbGhvc3QwHhcNMTQwNzI0MTQxOTAyWhcNMjQwNzIxMTQxOTAyWjCBjDELMAkGA1UEBhMCQ1oxFjAUBgNVBAgMDVNvdXRoIE1vcmF2aWExDTALBgNVBAcMBEJybm8xDzANBgNVBAoMBkNFU05FVDEMMAoGA1UECwwDVE1DMRMwEQYDVQQDDApleGFtcGxlIENBMSIwIAYJKoZIhvcNAQkBFhNleGFtcGxlY2FAbG9jYWxob3N0MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArD3TDHPAMT2Z84orK4lMlarbgooIUCcRZyLe+QM+8KY8Hn+mGaxPEOTSL3ywszqefB/Utm2hPKLHX684iRC14ID9WDGHxPjvoPArhgFhfV+qnPfxKTgxZC12uOj4u1V9y+SkTCocFbRfXVBGpojrBuDHXkDMDEWNvr8/52YCv7bGaiBwUHolcLCUbmtKILCG0RNJyTaJpXQdAeq5Z1SJotpbfYFFtAXB32hVoLug1dzl2tjG9sb1wq3QaDExcbC5w6P65qOkNoyym9ne6QlQagCqVDyFn3vcqkRaTjvZmxauCeUxXgJoXkyWcm0lM1KMHdoTArmchw2Dz0yHHSyDAQIDAQABo1AwTjAdBgNVHQ4EFgQUc1YQIqjZsHVwlea0AB4N+ilNI2gwHwYDVR0jBBgwFoAUc1YQIqjZsHVwlea0AB4N+ilNI2gwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOCAQEAI/1KH60qnw9Xs2RGfi0/IKf5EynXt4bQX8EIyVKwSkYKe04zZxYfLIl/Q2HOPYoFmm3daj5ddr0ZS1i4p4fTUhstjsYWvXs3W/HhVmFUslakkn3PrswhP77fCk6eEJLxdfyJ1C7Uudq2m1isZbKih+XF0mG1LxJaDMocSz4eAya7M5brwjy8DoOmA1TnLQFCVcpn+sCr7VC4wE/JqxyVhBCk/MuGqqM3B1j90bGFZ112ZOecyE0EDSr6IbiRBtmeNbEwOFjKXhNLYdxpBZ9D8A/368OckZkCrVLGuJNxK9UwCVTe8IhotHUqU9EqFDmxdV8oIdU/OzUwwNPA/Bd/9g==</certificate>"
+                       "</trusted-certificate>"
+                       "</input>");
+
+       printf("Post data:\n%s\n", post_data_xml);
+
+       curl_easy_setopt(curl_odl, CURLOPT_POSTFIELDS, post_data_xml);
+       curl_easy_setopt(curl_odl, CURLOPT_CUSTOMREQUEST, "POST");
+       curl_easy_setopt(curl_odl, CURLOPT_USERPWD, credentials);
+
+       res = curl_easy_perform(curl_odl);
+       if (res != CURLE_OK)
+       {
+               printf("cURL failed to url=%s\n", url_for_curl);
+       }
+
+       long http_response_code = 0;
+       curl_easy_getinfo (curl_odl, CURLINFO_RESPONSE_CODE, &http_response_code);
+       if (http_response_code >= 200 && http_response_code <= 226 && http_response_code != CURLE_ABORTED_BY_CALLBACK)
+       {
+               printf("cURL succeeded to url=%s\n", url_for_curl);
+       }
+       else
+       {
+               printf("cURL to url=%s failed with code=%ld\n", url_for_curl, http_response_code);
+               return SR_ERR_OPERATION_FAILED;
+       }
+
+       return SR_ERR_OK;
+}
+
+int add_key_pair_to_odl(controller_t *controller_list, int controller_list_size)
+{
+       int rc = SR_ERR_OK;
+
+       rc = add_keystore_entry_odl(controller_list[0].url_for_keystore_add, controller_list[0].credentials);
+       if (rc != SR_ERR_OK)
+       {
+               printf("Failed to add keystore entry to ODL.\n");
+       }
+
+       rc = add_private_key_odl(controller_list[0].url_for_private_key_add, controller_list[0].credentials);
+       if (rc != SR_ERR_OK)
+       {
+               printf("Failed to add private key entry to ODL.\n");
+       }
+
+       rc = add_trusted_ca_odl(controller_list[0].url_for_trusted_ca_add, controller_list[0].credentials);
+       if (rc != SR_ERR_OK)
+       {
+               printf("Failed to add trusted CA entry to ODL.\n");
+       }
+
+       return SR_ERR_OK;
+}
+
+int ves_ip_changed(char *new_ip)
+{
+       char *stringConfiguration = readConfigFileInString();
+
+       if (stringConfiguration == NULL)
+       {
+               printf("Could not read configuration file!\n");
+               return SR_ERR_OPERATION_FAILED;
+       }
+
+       cJSON *jsonConfig = cJSON_Parse(stringConfiguration);
+       if (jsonConfig == NULL)
+       {
+               free(stringConfiguration);
+               const char *error_ptr = cJSON_GetErrorPtr();
+               if (error_ptr != NULL)
+               {
+                       fprintf(stderr, "Could not parse JSON configuration! Error before: %s\n", error_ptr);
+               }
+               return SR_ERR_OPERATION_FAILED;
+       }
+       //we don't need the string anymore
+       free(stringConfiguration);
+       stringConfiguration = NULL;
+
+       cJSON *vesDetails = cJSON_GetObjectItemCaseSensitive(jsonConfig, "ves-endpoint-details");
+       if (!cJSON_IsObject(vesDetails))
+       {
+               printf("Configuration JSON is not as expected: ves-endpoint-details is not an object");
+               free(jsonConfig);
+               return SR_ERR_OPERATION_FAILED;
+       }
+
+       cJSON *vesIp = cJSON_GetObjectItemCaseSensitive(vesDetails, "ves-endpoint-ip");
+       if (!cJSON_IsString(vesIp))
+       {
+               printf("Configuration JSON is not as expected: ves-endpoint-ip is not a string");
+               free(jsonConfig);
+               return SR_ERR_OPERATION_FAILED;
+       }
+
+       //we set the value of the fault-notification-delay-period object
+       cJSON_ReplaceItemInObject(vesDetails, "ves-endpoint-ip", cJSON_CreateString(new_ip));
+
+       //writing the new JSON to the configuration file
+       stringConfiguration = cJSON_Print(jsonConfig);
+       writeConfigFile(stringConfiguration);
+
+       free(jsonConfig);
+
+       return SR_ERR_OK;
+}
+
+int ves_port_changed(int new_port)
+{
+       char *stringConfiguration = readConfigFileInString();
+
+       if (stringConfiguration == NULL)
+       {
+               printf("Could not read configuration file!\n");
+               return SR_ERR_OPERATION_FAILED;
+       }
+
+       cJSON *jsonConfig = cJSON_Parse(stringConfiguration);
+       if (jsonConfig == NULL)
+       {
+               free(stringConfiguration);
+               const char *error_ptr = cJSON_GetErrorPtr();
+               if (error_ptr != NULL)
+               {
+                       fprintf(stderr, "Could not parse JSON configuration! Error before: %s\n", error_ptr);
+               }
+               return SR_ERR_OPERATION_FAILED;
+       }
+       //we don't need the string anymore
+       free(stringConfiguration);
+       stringConfiguration = NULL;
+
+       cJSON *vesDetails = cJSON_GetObjectItemCaseSensitive(jsonConfig, "ves-endpoint-details");
+       if (!cJSON_IsObject(vesDetails))
+       {
+               printf("Configuration JSON is not as expected: ves-endpoint-details is not an object");
+               free(jsonConfig);
+               return SR_ERR_OPERATION_FAILED;
+       }
+
+       cJSON *vesPort = cJSON_GetObjectItemCaseSensitive(vesDetails, "ves-endpoint-port");
+       if (!cJSON_IsNumber(vesPort))
+       {
+               printf("Configuration JSON is not as expected: ves-endpoint-port is not a number.");
+               free(jsonConfig);
+               return SR_ERR_OPERATION_FAILED;
+       }
+
+       //we set the value of the fault-notification-delay-period object
+       cJSON_SetNumberValue(vesPort, new_port);
+
+       //writing the new JSON to the configuration file
+       stringConfiguration = cJSON_Print(jsonConfig);
+       writeConfigFile(stringConfiguration);
+
+       free(jsonConfig);
+
+       return SR_ERR_OK;
+}
+
+int ves_registration_changed(cJSON_bool new_bool)
+{
+       char *stringConfiguration = readConfigFileInString();
+
+       if (stringConfiguration == NULL)
+       {
+               printf("Could not read configuration file!\n");
+               return SR_ERR_OPERATION_FAILED;
+       }
+
+       cJSON *jsonConfig = cJSON_Parse(stringConfiguration);
+       if (jsonConfig == NULL)
+       {
+               free(stringConfiguration);
+               const char *error_ptr = cJSON_GetErrorPtr();
+               if (error_ptr != NULL)
+               {
+                       fprintf(stderr, "Could not parse JSON configuration! Error before: %s\n", error_ptr);
+               }
+               return SR_ERR_OPERATION_FAILED;
+       }
+       //we don't need the string anymore
+       free(stringConfiguration);
+       stringConfiguration = NULL;
+
+       cJSON *vesDetails = cJSON_GetObjectItemCaseSensitive(jsonConfig, "ves-endpoint-details");
+       if (!cJSON_IsObject(vesDetails))
+       {
+               printf("Configuration JSON is not as expected: ves-endpoint-details is not an object");
+               free(jsonConfig);
+               return SR_ERR_OPERATION_FAILED;
+       }
+
+       cJSON *vesRegistration = cJSON_GetObjectItemCaseSensitive(vesDetails, "ves-registration");
+       if (!cJSON_IsBool(vesRegistration))
+       {
+               printf("Configuration JSON is not as expected: ves-registration is not a bool.");
+               free(jsonConfig);
+               return SR_ERR_OPERATION_FAILED;
+       }
+
+       //we set the value of the ves-registration object
+       cJSON_ReplaceItemInObject(vesDetails, "ves-registration", cJSON_CreateBool(new_bool));
+
+       //writing the new JSON to the configuration file
+       stringConfiguration = cJSON_Print(jsonConfig);
+       writeConfigFile(stringConfiguration);
+
+       free(jsonConfig);
+
+       return SR_ERR_OK;
+}
+
+int is_netconf_available_changed(cJSON_bool new_bool)
+{
+       char *stringConfiguration = readConfigFileInString();
+
+       if (stringConfiguration == NULL)
+       {
+               printf("Could not read configuration file!\n");
+               return SR_ERR_OPERATION_FAILED;
+       }
+
+       cJSON *jsonConfig = cJSON_Parse(stringConfiguration);
+       if (jsonConfig == NULL)
+       {
+               free(stringConfiguration);
+               const char *error_ptr = cJSON_GetErrorPtr();
+               if (error_ptr != NULL)
+               {
+                       fprintf(stderr, "Could not parse JSON configuration! Error before: %s\n", error_ptr);
+               }
+               return SR_ERR_OPERATION_FAILED;
+       }
+       //we don't need the string anymore
+       free(stringConfiguration);
+       stringConfiguration = NULL;
+
+       cJSON *notifConfig = cJSON_GetObjectItemCaseSensitive(jsonConfig, "notification-config");
+       if (!cJSON_IsObject(notifConfig))
+       {
+               printf("Configuration JSON is not as expected: notification-config is not an object");
+               free(jsonConfig);
+               return SR_ERR_OPERATION_FAILED;
+       }
+
+       cJSON *isNetconfAvailable = cJSON_GetObjectItemCaseSensitive(notifConfig, "is-netconf-available");
+       if (!cJSON_IsBool(isNetconfAvailable))
+       {
+               printf("Configuration JSON is not as expected: is-netconf-available is not a bool.");
+               free(jsonConfig);
+               return SR_ERR_OPERATION_FAILED;
+       }
+
+       //we set the value of the ves-registration object
+       cJSON_ReplaceItemInObject(notifConfig, "is-netconf-available", cJSON_CreateBool(new_bool));
+
+       //writing the new JSON to the configuration file
+       stringConfiguration = cJSON_Print(jsonConfig);
+       writeConfigFile(stringConfiguration);
+
+       free(jsonConfig);
+
+       return SR_ERR_OK;
+}
+
+int is_ves_available_changed(cJSON_bool new_bool)
+{
+       char *stringConfiguration = readConfigFileInString();
+
+       if (stringConfiguration == NULL)
+       {
+               printf("Could not read configuration file!\n");
+               return SR_ERR_OPERATION_FAILED;
+       }
+
+       cJSON *jsonConfig = cJSON_Parse(stringConfiguration);
+       if (jsonConfig == NULL)
+       {
+               free(stringConfiguration);
+               const char *error_ptr = cJSON_GetErrorPtr();
+               if (error_ptr != NULL)
+               {
+                       fprintf(stderr, "Could not parse JSON configuration! Error before: %s\n", error_ptr);
+               }
+               return SR_ERR_OPERATION_FAILED;
+       }
+       //we don't need the string anymore
+       free(stringConfiguration);
+       stringConfiguration = NULL;
+
+       cJSON *notifConfig = cJSON_GetObjectItemCaseSensitive(jsonConfig, "notification-config");
+       if (!cJSON_IsObject(notifConfig))
+       {
+               printf("Configuration JSON is not as expected: notification-config is not an object");
+               free(jsonConfig);
+               return SR_ERR_OPERATION_FAILED;
+       }
+
+       cJSON *isVesAvailable = cJSON_GetObjectItemCaseSensitive(notifConfig, "is-ves-available");
+       if (!cJSON_IsBool(isVesAvailable))
+       {
+               printf("Configuration JSON is not as expected: is-ves-available is not a bool.");
+               free(jsonConfig);
+               return SR_ERR_OPERATION_FAILED;
+       }
+
+       //we set the value of the ves-registration object
+       cJSON_ReplaceItemInObject(notifConfig, "is-ves-available", cJSON_CreateBool(new_bool));
+
+       //writing the new JSON to the configuration file
+       stringConfiguration = cJSON_Print(jsonConfig);
+       writeConfigFile(stringConfiguration);
+
+       free(jsonConfig);
+
+       return SR_ERR_OK;
+}
diff --git a/ntsimulator/src/ntsimulator-manager/simulator-operations.h b/ntsimulator/src/ntsimulator-manager/simulator-operations.h
new file mode 100644 (file)
index 0000000..f61784e
--- /dev/null
@@ -0,0 +1,102 @@
+/*
+ * simulator-operations.h
+ *
+ *  Created on: Mar 9, 2019
+ *      Author: parallels
+ */
+
+#ifndef SRC_NTSIMULATOR_MANAGER_SIMULATOR_OPERATIONS_H_
+#define SRC_NTSIMULATOR_MANAGER_SIMULATOR_OPERATIONS_H_
+
+#include <curl/curl.h>
+#include <stdlib.h>
+#include <stdbool.h>
+#include <stdio.h>
+
+#include "sysrepo.h"
+#include "sysrepo/values.h"
+
+#include <cjson/cJSON.h>
+
+#define CURL_MEM_SIZE 2048
+
+
+/**
+ * Storing the device information
+*/
+
+typedef struct device {
+       char *device_id;
+       int netconf_port;
+       bool is_mounted;
+       char *operational_state;
+       struct device *next;
+} device_t;
+
+typedef struct device_stack {
+       device_t *head;
+       size_t stack_size;
+} device_stack_t;
+
+#define URL_AND_CREDENTIALS_MAX_LEN 400
+
+typedef struct controller
+{
+       char url[URL_AND_CREDENTIALS_MAX_LEN];
+       char credentials[URL_AND_CREDENTIALS_MAX_LEN];
+       char url_for_keystore_add[URL_AND_CREDENTIALS_MAX_LEN];
+       char url_for_private_key_add[URL_AND_CREDENTIALS_MAX_LEN];
+       char url_for_trusted_ca_add[URL_AND_CREDENTIALS_MAX_LEN];
+} controller_t;
+
+
+device_stack_t *new_device_stack(void);
+void push_device(device_stack_t *theStack, char *dev_id, int port);
+void pop_device(device_stack_t *theStack);
+int get_netconf_port_next(device_stack_t *theStack);
+int get_netconf_port_base(void);
+char *get_id_last_device(device_stack_t *theStack);
+int get_current_number_of_devices(device_stack_t *theStack);
+int get_current_number_of_mounted_devices(device_stack_t *theStack);
+
+
+/**
+ * cURL utilities
+*/
+
+struct MemoryStruct {
+  char *memory;
+  size_t size;
+};
+
+int _init_curl(void);
+int cleanup_curl(void);
+
+int _init_curl_odl(void);
+int cleanup_curl_odl(void);
+
+int start_device(device_stack_t *theStack);
+int stop_device(device_stack_t *theStack);
+
+int mount_device(device_stack_t *theStack, controller_t controller_details);
+int unmount_device(device_stack_t *theStack, controller_t controller_details);
+
+char* get_docker_container_operational_state(device_stack_t *theStack, char *container_id);
+int get_docker_containers_operational_state_curl(device_stack_t *theStack);
+
+char* get_docker_container_resource_stats();
+
+int notification_delay_period_changed(int period);
+int ves_heartbeat_period_changed(int period);
+int ves_ip_changed(char *new_ip);
+int ves_port_changed(int new_port);
+int ves_registration_changed(cJSON_bool new_bool);
+int is_netconf_available_changed(cJSON_bool new_bool);
+int is_ves_available_changed(cJSON_bool new_bool);
+
+
+
+int add_key_pair_to_odl(controller_t *controller_list, int controller_list_size);
+
+
+#endif /* SRC_NTSIMULATOR_MANAGER_SIMULATOR_OPERATIONS_H_ */
diff --git a/ntsimulator/src/o-ran-notifications/CMakeLists.txt b/ntsimulator/src/o-ran-notifications/CMakeLists.txt
new file mode 100644 (file)
index 0000000..d915ca2
--- /dev/null
@@ -0,0 +1,17 @@
+set (NOTIFICATIONS_SOURCES
+    o-ran-notifications.c
+)
+
+include_directories(
+    "/usr/include/x86_64-linux-gnu"
+    "/usr/local/include/cjson"
+)
+
+add_executable(o-ran-notifications ${NOTIFICATIONS_SOURCES})
+target_link_libraries(o-ran-notifications utils)
+target_link_libraries(o-ran-notifications sysrepo)
+target_link_libraries(o-ran-notifications m)
+target_link_libraries(o-ran-notifications curl)
+target_link_libraries(o-ran-notifications cjson)
+
+install(TARGETS o-ran-notifications DESTINATION ${CMAKE_INSTALL_BINDIR})
\ No newline at end of file
diff --git a/ntsimulator/src/o-ran-notifications/o-ran-notifications.c b/ntsimulator/src/o-ran-notifications/o-ran-notifications.c
new file mode 100644 (file)
index 0000000..49a6931
--- /dev/null
@@ -0,0 +1,361 @@
+/*
+ * o-ran-notifications.c
+ *
+ *  Created on: Oct 23, 2019
+ *      Author: parallels
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <signal.h>
+#include <inttypes.h>
+#include <time.h>
+#include <math.h>
+#include <sys/time.h>
+
+#include "sysrepo.h"
+#include "sysrepo/values.h"
+
+#include "utils.h"
+
+#define LINE_BUFSIZE 128
+#define ORAN_FAULT_ALARMS_NUMBER 10
+#define AFFECTED_OBJECTS_MAX_NUMBER 100
+
+volatile int exit_application = 0;
+
+struct faultAlarms
+{
+       int             faultId;
+       char*           faultSource;
+       int             cleared;
+       char*           faultSeverity;
+       char*           faultText;
+       char*           affectedObjects[AFFECTED_OBJECTS_MAX_NUMBER];
+};
+struct faultAlarms oran_fault_alarms[ORAN_FAULT_ALARMS_NUMBER] = {
+               {.faultId = 1, .faultSource = "jknsdfnui", .affectedObjects = {"akddconoj", "asodmnjvf", "roiemfkmods"}, .cleared = 1, .faultSeverity = "MAJOR", .faultText = "sdnjosopnojnsd"},
+               {.faultId = 2, .faultSource = "onascokjnasc", .affectedObjects = {"sdouvncsjdfv13", "asjdn13ejlncd4"}, .cleared = 1, .faultSeverity = "WARNING", .faultText = "4pionfcsofn42on"},
+               {.faultId = 3, .faultSource = "asonxpkn", .affectedObjects = {"0j4fiwef320fd", "sdlvkmsdv-9023"}, .cleared = 1, .faultSeverity = "CRITICAL", .faultText = "sdjnonj32onjsa23"},
+               {.faultId = 4, .faultSource = "asnjcpkd", .affectedObjects = {"0j4fiwef320fd", "sdlvkmsdv-9023", "laksmdklmdas21"}, .cleared = 1, .faultSeverity = "MINOR", .faultText = "asdjln12osa453"},
+               {.faultId = 5, .faultSource = "dskmfl", .affectedObjects = {"sdkm31wdlk"}, .cleared = 1, .faultSeverity = "MAJOR", .faultText = "dknovrf34ekl"},
+               {.faultId = 6, .faultSource = "dsllkje232kl", .affectedObjects = {"sFKOM24KLMerw"}, .cleared = 1, .faultSeverity = "MAJOR", .faultText = "frpkm24k lsd  kmewfpm"},
+               {.faultId = 7, .faultSource = "fvkdlsfjnwej23kloe", .affectedObjects = {"fvkm24km", "sdfk23d", "kmdfkmo32", "wekl2332"}, .cleared = 1, .faultSeverity = "WARNING", .faultText = "dsm 2d 32j sdfmr32"},
+               {.faultId = 8, .faultSource = "dkom32", .affectedObjects = {"kmsdfkpm23ds", "sdmkp32"}, .cleared = 1, .faultSeverity = "CRITICAL", .faultText = "dsonj32 don32 mdson32pk654"},
+               {.faultId = 9, .faultSource = "weflm3", .affectedObjects = {"klklm32kl3", "dsfln234poewj23-", "spmd32k"}, .cleared = 1, .faultSeverity = "MINOR", .faultText = "dsflknjwej32"},
+               {.faultId = 10, .faultSource = "fweiunvfrem32", .affectedObjects = {"sfkm23klsdf2343"}, .cleared = 1, .faultSeverity = "MAJOR", .faultText = "dfskjnl4j dsfknl2 fodn54 65k"}
+};
+
+static         CURL *curl;
+
+static int _init_curl()
+{
+       curl = curl_easy_init();
+
+       if (curl == NULL) {
+               printf("cURL initialization error! Aborting call!\n");
+               return SR_ERR_OPERATION_FAILED;
+       }
+
+       return SR_ERR_OK;
+}
+
+static int cleanup_curl()
+{
+       if (curl != NULL)
+       {
+               curl_easy_cleanup(curl);
+       }
+
+       return SR_ERR_OK;
+}
+
+static int send_fault_ves_message(char *alarm_condition, char *alarm_object, char *severity, char *date_time, char *specific_problem)
+{
+       CURLcode res;
+       static sequence_id = 0;
+
+       prepare_ves_message_curl(curl);
+
+       cJSON *postDataJson = cJSON_CreateObject();
+
+       cJSON *event = cJSON_CreateObject();
+       if (event == NULL)
+       {
+               printf("Could not create JSON object: event\n");
+               return 1;
+       }
+       cJSON_AddItemToObject(postDataJson, "event", event);
+
+       char *hostname = getenv("HOSTNAME");
+
+       cJSON *commonEventHeader = vesCreateCommonEventHeader("fault", "O_RAN_COMPONENT_Alarms", hostname, sequence_id++);
+       if (commonEventHeader == NULL)
+       {
+               printf("Could not create JSON object: commonEventHeader\n");
+               return 1;
+       }
+       cJSON_AddItemToObject(event, "commonEventHeader", commonEventHeader);
+
+       cJSON *faultFields = vesCreateFaultFields(alarm_condition, alarm_object, severity, date_time, specific_problem);
+       if (faultFields == NULL)
+       {
+               printf("Could not create JSON object: faultFields\n");
+               return 1;
+       }
+       cJSON_AddItemToObject(event, "faultFields", faultFields);
+
+    char *post_data_string = NULL;
+
+       post_data_string = cJSON_PrintUnformatted(postDataJson);
+
+       printf("Post data JSON:\n%s\n", post_data_string);
+
+       if (postDataJson != NULL)
+       {
+               cJSON_Delete(postDataJson);
+       }
+
+       curl_easy_setopt(curl, CURLOPT_POSTFIELDS, post_data_string);
+
+       res = curl_easy_perform(curl);
+
+       if (res != CURLE_OK)
+       {
+               printf("Failed to send cURL...\n");
+               return SR_ERR_OPERATION_FAILED;
+       }
+
+       return SR_ERR_OK;
+}
+
+static int send_dummy_notif_file_mgmt(sr_session_ctx_t *sess)
+{
+       int rc;
+
+       sr_val_t *vnotif;
+       size_t current_num_of_values= 0;
+
+       CREATE_NEW_VALUE(rc, vnotif, current_num_of_values);
+
+       sr_val_build_xpath(&vnotif[current_num_of_values - 1], "%s", "/o-ran-file-management:file-upload-notification/local-logical-file-path");
+       sr_val_set_str_data(&vnotif[current_num_of_values - 1], SR_STRING_T, "odsanzucjsdoj");
+
+       CREATE_NEW_VALUE(rc, vnotif, current_num_of_values);
+
+       sr_val_build_xpath(&vnotif[current_num_of_values - 1], "%s", "/o-ran-file-management:file-upload-notification/remote-file-path");
+       sr_val_set_str_data(&vnotif[current_num_of_values - 1], SR_STRING_T, "jsdknvjnkfd");
+
+       CREATE_NEW_VALUE(rc, vnotif, current_num_of_values);
+
+       sr_val_build_xpath(&vnotif[current_num_of_values - 1], "%s", "/o-ran-file-management:file-upload-notification/status");
+       sr_val_set_str_data(&vnotif[current_num_of_values - 1], SR_ENUM_T, "SUCCESS");
+
+       rc = sr_event_notif_send(sess, "/o-ran-file-management:file-upload-notification", vnotif, current_num_of_values, SR_EV_NOTIF_DEFAULT);
+       if (rc != SR_ERR_OK) {
+               printf("Failed to send notification send_dummy_notif_file_mgmt\n");
+               return SR_ERR_OPERATION_FAILED;
+       }
+
+       printf("Successfully sent notification...\n");
+
+       sr_free_values(vnotif, current_num_of_values);
+
+       return SR_ERR_OK;
+}
+
+static int send_dummy_notif(sr_session_ctx_t *sess)
+{
+       int rc;
+
+    char dateAndTime[256];
+    time_t t = time(NULL);
+    struct tm tm = *localtime(&t);
+    struct timeval tv;
+    int millisec;
+
+    gettimeofday(&tv, NULL);
+    millisec = lrint(tv.tv_usec/1000.0); // Round to nearest millisec
+    if (millisec>=1000)
+    { // Allow for rounding up to nearest second
+        millisec -=1000;
+        tv.tv_sec++;
+        millisec /= 100;
+    }
+    sprintf(dateAndTime, "%04d-%02d-%02dT%02d:%02d:%02d.%01dZ",
+    tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
+    tm.tm_hour, tm.tm_min, tm.tm_sec, millisec/100);
+
+    int ran = (int) random_at_most(ORAN_FAULT_ALARMS_NUMBER - 1);
+
+    if (oran_fault_alarms[ran].cleared == 1)
+    {
+       oran_fault_alarms[ran].cleared = 0;
+    }
+    else
+    {
+       oran_fault_alarms[ran].cleared = 1;
+    }
+
+       sr_val_t *vnotif;
+       size_t current_num_of_values= 0;
+
+       CREATE_NEW_VALUE(rc, vnotif, current_num_of_values);
+
+       sr_val_build_xpath(&vnotif[current_num_of_values - 1], "%s", "/o-ran-fm:alarm-notif/fault-id");
+       vnotif[current_num_of_values - 1].type = SR_UINT16_T;
+       vnotif[current_num_of_values - 1].data.uint16_val = oran_fault_alarms[ran].faultId;
+
+       CREATE_NEW_VALUE(rc, vnotif, current_num_of_values);
+
+       sr_val_build_xpath(&vnotif[current_num_of_values - 1], "%s", "/o-ran-fm:alarm-notif/fault-source");
+       sr_val_set_str_data(&vnotif[current_num_of_values - 1], SR_STRING_T, oran_fault_alarms[ran].faultSource);
+
+       CREATE_NEW_VALUE(rc, vnotif, current_num_of_values);
+
+       sr_val_build_xpath(&vnotif[current_num_of_values - 1], "%s", "/o-ran-fm:alarm-notif/fault-severity");
+       sr_val_set_str_data(&vnotif[current_num_of_values - 1], SR_ENUM_T, oran_fault_alarms[ran].faultSeverity);
+
+       CREATE_NEW_VALUE(rc, vnotif, current_num_of_values);
+
+       sr_val_build_xpath(&vnotif[current_num_of_values - 1], "%s", "/o-ran-fm:alarm-notif/is-cleared");
+       vnotif[current_num_of_values - 1].type = SR_BOOL_T;
+       vnotif[current_num_of_values - 1].data.bool_val = oran_fault_alarms[ran].cleared;
+
+       CREATE_NEW_VALUE(rc, vnotif, current_num_of_values);
+
+       sr_val_build_xpath(&vnotif[current_num_of_values - 1], "%s", "/o-ran-fm:alarm-notif/fault-text");
+       sr_val_set_str_data(&vnotif[current_num_of_values - 1], SR_STRING_T, oran_fault_alarms[ran].faultText);
+
+       CREATE_NEW_VALUE(rc, vnotif, current_num_of_values);
+
+       sr_val_build_xpath(&vnotif[current_num_of_values - 1], "%s", "/o-ran-fm:alarm-notif/event-time");
+       sr_val_build_str_data(&vnotif[current_num_of_values - 1], SR_STRING_T, "%s", dateAndTime);
+
+       for (int  i = 0; i < AFFECTED_OBJECTS_MAX_NUMBER; ++i)
+       {
+               char path[400];
+               if (oran_fault_alarms[ran].affectedObjects[i] == NULL)
+               {
+                       break;
+               }
+
+               sprintf(path, "/o-ran-fm:alarm-notif/affected-objects[name='%s']", oran_fault_alarms[ran].affectedObjects[i]);
+
+               CREATE_NEW_VALUE(rc, vnotif, current_num_of_values);
+
+               sr_val_build_xpath(&vnotif[current_num_of_values - 1], "%s", path);
+               vnotif[current_num_of_values - 1].type = SR_LIST_T;
+       }
+
+       int isNetconfAvailable = getNetconfAvailableFromConfigJson();
+       int isVesAvailable = getVesAvailableFromConfigJson();
+
+       if (isNetconfAvailable)
+       {
+               rc = sr_event_notif_send(sess, "/o-ran-fm:alarm-notif", vnotif, current_num_of_values, SR_EV_NOTIF_DEFAULT);
+               if (rc != SR_ERR_OK)
+               {
+                       printf("Failed to send notification send_dummy_notif\n");
+                       return SR_ERR_OPERATION_FAILED;
+               }
+               printf("Successfully sent notification with timestamp=\"%s\"\n", dateAndTime);
+       }
+       if (isVesAvailable)
+       {
+               char faultId[10];
+               sprintf(faultId, "%d", oran_fault_alarms[ran].faultId);
+               rc = send_fault_ves_message(faultId, oran_fault_alarms[ran].faultSource,
+                               (oran_fault_alarms[ran].cleared) ? "NORMAL" : oran_fault_alarms[ran].faultSeverity, dateAndTime, oran_fault_alarms[ran].faultText);
+               if (rc != SR_ERR_OK)
+               {
+                       printf("Could not send Fault VES message\n");
+               }
+       }
+
+       sr_free_values(vnotif, current_num_of_values);
+
+       return SR_ERR_OK;
+}
+
+static void
+sigint_handler(int signum)
+{
+    exit_application = 1;
+}
+
+int
+main(int argc, char **argv)
+{
+    sr_conn_ctx_t *connection = NULL;
+    sr_session_ctx_t *session = NULL;
+    sr_subscription_ctx_t *subscription = NULL;
+    int rc = SR_ERR_OK;
+    int notification_delay_period = 0; //seconds
+
+    setbuf(stdout, NULL);
+
+    /* connect to sysrepo */
+    rc = sr_connect("oran_notifications", SR_CONN_DEFAULT, &connection);
+    if (SR_ERR_OK != rc) {
+        fprintf(stderr, "Error by sr_connect: %s\n", sr_strerror(rc));
+        goto cleanup;
+    }
+
+    /* start session */
+    rc = sr_session_start(connection, SR_DS_RUNNING, SR_SESS_DEFAULT, &session);
+    if (SR_ERR_OK != rc) {
+        fprintf(stderr, "Error by sr_session_start: %s\n", sr_strerror(rc));
+        goto cleanup;
+    }
+
+    rc = _init_curl();
+    if (rc != SR_ERR_OK)
+    {
+        fprintf(stderr, "Could not initialize cURL: %s\n", sr_strerror(rc));
+        goto cleanup;
+    }
+
+    /* loop until ctrl-c is pressed / SIGINT is received */
+    signal(SIGINT, sigint_handler);
+    signal(SIGPIPE, SIG_IGN);
+
+
+    while (!exit_application) {
+        notification_delay_period = getFaultNotificationDelayPeriodFromConfigJson();
+
+        if (notification_delay_period > 0)
+        {
+               send_dummy_notif(session);
+//             send_dummy_notif_file_mgmt(session);
+
+            sleep(notification_delay_period);
+        }
+        else
+        {
+               sleep(1);
+        }
+
+    }
+
+    printf("Application exit requested, exiting.\n");
+
+cleanup:
+    if (NULL != subscription) {
+        sr_unsubscribe(session, subscription);
+    }
+    if (NULL != session) {
+        sr_session_stop(session);
+    }
+    if (NULL != connection) {
+        sr_disconnect(connection);
+    }
+    cleanup_curl();
+    printf("Error encountered. Exiting...");
+    return rc;
+}
+
+
+
+
diff --git a/ntsimulator/src/utils/utils.c b/ntsimulator/src/utils/utils.c
new file mode 100644 (file)
index 0000000..745718b
--- /dev/null
@@ -0,0 +1,1076 @@
+/*
+ * utils.c
+ *
+ *  Created on: Feb 19, 2019
+ *      Author: parallels
+ */
+
+#include "utils.h"
+
+#include <math.h>
+#include <time.h>
+#include <sys/time.h>
+#include <stdio.h>
+
+void set_curl_common_info_ves(CURL *curl)
+{
+       struct curl_slist *chunk = NULL;
+       chunk = curl_slist_append(chunk, "Content-Type: application/json");
+       chunk = curl_slist_append(chunk, "Accept: application/json");
+
+    curl_easy_setopt(curl, CURLOPT_HTTPHEADER, chunk);
+
+    curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, 2L); // seconds timeout for a connection
+    curl_easy_setopt(curl, CURLOPT_TIMEOUT, 5L); //seconds timeout for an operation
+
+    curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
+}
+
+void getCurrentDateAndTime(char *date_and_time)
+{
+       time_t t = time(NULL);
+       struct tm tm = *localtime(&t);
+       struct timeval tv;
+       int millisec;
+
+       gettimeofday(&tv, NULL);
+       millisec = lrint(tv.tv_usec/1000.0); // Round to nearest millisec
+       if (millisec>=1000)
+       { // Allow for rounding up to nearest second
+               millisec -=1000;
+               tv.tv_sec++;
+               millisec /= 100;
+       }
+       sprintf(date_and_time, "%04d-%02d-%02dT%02d:%02d:%02d.%01dZ",
+       tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
+       tm.tm_hour, tm.tm_min, tm.tm_sec, millisec/100);
+
+       return;
+}
+
+void   generateRandomMacAddress(char *mac_address)
+{
+       long rand1, rand2, rand3, rand4, rand5, rand6;
+       rand1 = random_at_most(255);
+       rand2 = random_at_most(255);
+       rand3 = random_at_most(255);
+       rand4 = random_at_most(255);
+       rand5 = random_at_most(255);
+       rand6 = random_at_most(255);
+
+       sprintf(mac_address, "%02X:%02X:%02X:%02X:%02X:%02X", rand1, rand2, rand3, rand4, rand5, rand6);
+
+       return;
+}
+
+long random_at_most(long max) {
+  unsigned long
+    // max <= RAND_MAX < ULONG_MAX, so this is okay.
+    num_bins = (unsigned long) max + 1,
+    num_rand = (unsigned long) RAND_MAX + 1,
+    bin_size = num_rand / num_bins,
+    defect   = num_rand % num_bins;
+
+  long x;
+  do {
+   x = random();
+  }
+  // This is carefully written not to overflow
+  while (num_rand - defect <= (unsigned long)x);
+
+  // Truncated division is intentional
+  return x/bin_size;
+}
+
+int getSecondsFromLastQuarterInterval(void)
+{
+       time_t t = time(NULL);
+       time_t t_past = time(NULL);
+       struct tm tm = *localtime(&t);
+       struct tm tm_15_min_ago = tm;
+
+       //round to the last quarter hour
+       tm_15_min_ago.tm_min -= (tm_15_min_ago.tm_min % 15);
+       tm_15_min_ago.tm_sec = 0;
+
+       t=mktime(&tm_15_min_ago);
+       t_past=mktime(&tm);
+
+       double seconds = difftime(t_past, t);
+
+       return (int)seconds;
+}
+
+int getSecondsFromLastDayInterval(void)
+{
+       time_t t = time(NULL);
+       time_t t_past = time(NULL);
+       struct tm tm = *localtime(&t);
+       struct tm tm_day_ago = tm;
+
+       //round to the last quarter hour
+       tm_day_ago.tm_hour = 0;
+       tm_day_ago.tm_min = 0;
+       tm_day_ago.tm_sec = 0;
+
+       t=mktime(&tm_day_ago);
+       t_past=mktime(&tm);
+
+       double seconds = difftime(t_past, t);
+
+       return (int)seconds;
+}
+
+void getPreviousQuarterInterval(int number_of_intervals, char *date_and_time)
+{
+       time_t t = time(NULL);
+       t -= 15 * 60 * number_of_intervals;
+       struct tm tm = *localtime(&t);
+
+       tm.tm_min -= (tm.tm_min % 15);
+       tm.tm_sec = 0;
+
+       sprintf(date_and_time, "%04d-%02d-%02dT%02d:%02d:%02d.0Z",
+       tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
+       tm.tm_hour, tm.tm_min, tm.tm_sec);
+
+       return;
+}
+
+void getPreviousDayPmTimestamp(int number_of_intervals, char *date_and_time)
+{
+       time_t t = time(NULL);
+       t -= 24 * 60 * 60 * number_of_intervals;
+       struct tm tm = *localtime(&t);
+
+       tm.tm_hour = 0;
+       tm.tm_min = 0;
+       tm.tm_sec = 0;
+
+       sprintf(date_and_time, "%04d-%02d-%02dT%02d:%02d:%02d.0Z",
+       tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
+       tm.tm_hour, tm.tm_min, tm.tm_sec);
+
+       return;
+}
+
+long int getMicrosecondsSinceEpoch(void)
+{
+       time_t t = time(NULL);
+       struct tm tm = *localtime(&t);
+       struct timeval tv;
+       long int useconds;
+
+       gettimeofday(&tv, NULL);
+       useconds = t*1000 + tv.tv_usec; //add the microseconds to the seconds
+
+       return useconds;
+}
+
+//TODO need to implement other authentication methods as well, not only no-auth
+void prepare_ves_message_curl(CURL *curl)
+{
+       curl_easy_reset(curl);
+       set_curl_common_info_ves(curl);
+
+       char *ves_ip = getVesIpFromConfigJson();
+       int ves_port = getVesPortFromConfigJson();
+
+       char url[100];
+       sprintf(url, "http://%s:%d/eventListener/v7", ves_ip, ves_port);
+       curl_easy_setopt(curl, CURLOPT_URL, url);
+
+       free(ves_ip);
+
+//     curl_easy_setopt(curl, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
+
+       return;
+}
+
+cJSON* vesCreateCommonEventHeader(char *domain, char *event_type, char *source_name, int seq_id)
+{
+       char dateAndTime[50];
+       getCurrentDateAndTime(dateAndTime);
+
+    char hostname[100];
+    sprintf(hostname, "%s", getenv("HOSTNAME"));
+
+       long int useconds = getMicrosecondsSinceEpoch;
+
+       cJSON *commonEventHeader = cJSON_CreateObject();
+       if (commonEventHeader == NULL)
+       {
+               printf("Could not create JSON object: commonEventHeader\n");
+               return NULL;
+       }
+
+       if (cJSON_AddStringToObject(commonEventHeader, "domain", domain) == NULL)
+       {
+               printf("Could not create JSON object: domain\n");
+               return NULL;
+       }
+
+       char eventId[200];
+       sprintf(eventId, "%s_%s", hostname, dateAndTime);
+
+       if (cJSON_AddStringToObject(commonEventHeader, "eventId", eventId) == NULL)
+       {
+               printf("Could not create JSON object: eventId\n");
+               return NULL;
+       }
+
+       char event_name[200];
+       sprintf(event_name, "%s_%s", domain, event_type);
+
+       if (cJSON_AddStringToObject(commonEventHeader, "eventName", event_name) == NULL)
+       {
+               printf("Could not create JSON object: eventName\n");
+               return NULL;
+       }
+
+       if (cJSON_AddStringToObject(commonEventHeader, "eventType", event_type) == NULL)
+       {
+               printf("Could not create JSON object: eventType\n");
+               return NULL;
+       }
+
+       if (cJSON_AddNumberToObject(commonEventHeader, "sequence", (double)(seq_id)) == NULL)
+       {
+               printf("Could not create JSON object: sequence\n");
+               return NULL;
+       }
+
+       if (cJSON_AddStringToObject(commonEventHeader, "priority", "Low") == NULL)
+       {
+               printf("Could not create JSON object: priority\n");
+               return NULL;
+       }
+
+       if (cJSON_AddStringToObject(commonEventHeader, "reportingEntityId", "") == NULL)
+       {
+               printf("Could not create JSON object: reportingEntityId\n");
+               return NULL;
+       }
+
+       if (cJSON_AddStringToObject(commonEventHeader, "reportingEntityName", hostname) == NULL)
+       {
+               printf("Could not create JSON object: reportingEntityName\n");
+               return NULL;
+       }
+
+       if (cJSON_AddStringToObject(commonEventHeader, "sourceId", "") == NULL)
+       {
+               printf("Could not create JSON object: sourceId\n");
+               return NULL;
+       }
+
+       if (cJSON_AddStringToObject(commonEventHeader, "sourceName", source_name) == NULL)
+       {
+               printf("Could not create JSON object: sourceName\n");
+               return NULL;
+       }
+
+       if (cJSON_AddNumberToObject(commonEventHeader, "startEpochMicrosec", (double)(useconds)) == NULL)
+       {
+               printf("Could not create JSON object: startEpochMicrosec\n");
+               return NULL;
+       }
+
+       if (cJSON_AddNumberToObject(commonEventHeader, "lastEpochMicrosec", (double)(useconds)) == NULL)
+       {
+               printf("Could not create JSON object: lastEpochMicrosec\n");
+               return NULL;
+       }
+
+       if (cJSON_AddStringToObject(commonEventHeader, "nfNamingCode", "sdn controller") == NULL)
+       {
+               printf("Could not create JSON object: nfNamingCode\n");
+               return NULL;
+       }
+
+       if (cJSON_AddStringToObject(commonEventHeader, "nfVendorName", "sdn") == NULL)
+       {
+               printf("Could not create JSON object: nfVendorName\n");
+               return NULL;
+       }
+
+       if (cJSON_AddStringToObject(commonEventHeader, "timeZoneOffset", "+00:00") == NULL)
+       {
+               printf("Could not create JSON object: timeZoneOffset\n");
+               return NULL;
+       }
+
+       if (cJSON_AddStringToObject(commonEventHeader, "version", "4.0.1") == NULL)
+       {
+               printf("Could not create JSON object: version\n");
+               return NULL;
+       }
+
+       if (cJSON_AddStringToObject(commonEventHeader, "vesEventListenerVersion", "7.0.1") == NULL)
+       {
+               printf("Could not create JSON object: vesEventListenerVersion\n");
+               return NULL;
+       }
+
+       return commonEventHeader;
+}
+
+cJSON* vesCreateHeartbeatFields(int heartbeat_interval)
+{
+       char dateAndTime[50];
+       getCurrentDateAndTime(dateAndTime);
+
+       cJSON *heartbeatFields = cJSON_CreateObject();
+       if (heartbeatFields == NULL)
+       {
+               printf("Could not create JSON object: heartbeatFields\n");
+               return NULL;
+       }
+
+       if (cJSON_AddStringToObject(heartbeatFields, "heartbeatFieldsVersion", "3.0") == NULL)
+       {
+               printf("Could not create JSON object: heartbeatFieldsVersion\n");
+               return NULL;
+       }
+
+       if (cJSON_AddNumberToObject(heartbeatFields, "heartbeatInterval", (double)(heartbeat_interval)) == NULL)
+       {
+               printf("Could not create JSON object: heartbeatInterval\n");
+               return NULL;
+       }
+
+       cJSON *additionalFields = cJSON_CreateObject();
+       if (additionalFields == NULL)
+       {
+               printf("Could not create JSON object: additionalFields\n");
+               return NULL;
+       }
+       cJSON_AddItemToObject(heartbeatFields, "additionalFields", additionalFields);
+
+       if (cJSON_AddStringToObject(additionalFields, "eventTime", dateAndTime) == NULL)
+       {
+               printf("Could not create JSON object: eventTime\n");
+               return NULL;
+       }
+
+       return heartbeatFields;
+}
+
+char*  readConfigFileInString(void)
+{
+       char * buffer = 0;
+       long length;
+       char config_file[200];
+       sprintf(config_file, "%s/configuration.json", getenv("SCRIPTS_DIR"));
+       FILE * f = fopen (config_file, "rb");
+
+       if (f)
+       {
+         fseek (f, 0, SEEK_END);
+         length = ftell (f);
+         fseek (f, 0, SEEK_SET);
+         buffer = malloc (length + 1);
+         if (buffer)
+         {
+           fread (buffer, 1, length, f);
+         }
+         fclose (f);
+         buffer[length] = '\0';
+       }
+
+       if (buffer)
+       {
+         return buffer;
+       }
+
+       return NULL;
+}
+
+void   writeConfigFile(char *config)
+{
+       char * buffer = 0;
+       long length;
+       char config_file[200];
+       sprintf(config_file, "%s/configuration.json", getenv("SCRIPTS_DIR"));
+       FILE * f = fopen (config_file, "w");
+
+       if (f)
+       {
+               fputs(config, f);
+               fclose(f);
+       }
+       else
+       {
+               printf("Could not write configuration file");
+       }
+}
+
+int    getFaultNotificationDelayPeriodFromConfigJson(void)
+{
+       char *stringConfig = readConfigFileInString();
+       int notificationDelay = 0;
+
+       if (stringConfig == NULL)
+       {
+               printf("Could not read JSON configuration file in string.");
+               return 0;
+       }
+
+       cJSON *jsonConfig = cJSON_Parse(stringConfig);
+       if (jsonConfig == NULL)
+       {
+               free(stringConfig);
+               const char *error_ptr = cJSON_GetErrorPtr();
+               if (error_ptr != NULL)
+               {
+                       fprintf(stderr, "Could not parse JSON configuration! Error before: %s\n", error_ptr);
+               }
+               return SR_ERR_OPERATION_FAILED;
+       }
+       //we don't need the string anymore
+       free(stringConfig);
+
+       cJSON *notifConfig = cJSON_GetObjectItemCaseSensitive(jsonConfig, "notification-config");
+       if (!cJSON_IsObject(notifConfig))
+       {
+               printf("Configuration JSON is not as expected: notification-config is not an object");
+               free(jsonConfig);
+               return SR_ERR_OPERATION_FAILED;
+       }
+
+       cJSON *faultNotifDelay = cJSON_GetObjectItemCaseSensitive(notifConfig, "fault-notification-delay-period");
+       if (!cJSON_IsNumber(faultNotifDelay))
+       {
+               printf("Configuration JSON is not as expected: fault-notification-delay-period is not a number");
+               free(jsonConfig);
+               return SR_ERR_OPERATION_FAILED;
+       }
+
+       notificationDelay = (int)(faultNotifDelay->valuedouble);
+
+       free(jsonConfig);
+
+       return notificationDelay;
+}
+
+int    getVesHeartbeatPeriodFromConfigJson(void)
+{
+       char *stringConfig = readConfigFileInString();
+       int vesHeartbeat = 0;
+
+       if (stringConfig == NULL)
+       {
+               printf("Could not read JSON configuration file in string.");
+               return 0;
+       }
+
+       cJSON *jsonConfig = cJSON_Parse(stringConfig);
+       if (jsonConfig == NULL)
+       {
+               free(stringConfig);
+               const char *error_ptr = cJSON_GetErrorPtr();
+               if (error_ptr != NULL)
+               {
+                       fprintf(stderr, "Could not parse JSON configuration! Error before: %s\n", error_ptr);
+               }
+               return SR_ERR_OPERATION_FAILED;
+       }
+       //we don't need the string anymore
+       free(stringConfig);
+
+       cJSON *notifConfig = cJSON_GetObjectItemCaseSensitive(jsonConfig, "notification-config");
+       if (!cJSON_IsObject(notifConfig))
+       {
+               printf("Configuration JSON is not as expected: notification-config is not an object");
+               free(jsonConfig);
+               return SR_ERR_OPERATION_FAILED;
+       }
+
+       cJSON *vesHeartbeatPeriod = cJSON_GetObjectItemCaseSensitive(notifConfig, "ves-heartbeat-period");
+       if (!cJSON_IsNumber(vesHeartbeatPeriod))
+       {
+               printf("Configuration JSON is not as expected: ves-heartbeat-period is not a number");
+               free(jsonConfig);
+               return SR_ERR_OPERATION_FAILED;
+       }
+
+       vesHeartbeat = (int)(vesHeartbeatPeriod->valuedouble);
+
+       free(jsonConfig);
+
+       return vesHeartbeat;
+}
+
+
+/*
+ * Dynamically allocated memory;
+ * Caller needs to free the memory after it uses the value.
+ *
+*/
+char*  getVesAuthMethodFromConfigJson(void)
+{
+       char *stringConfig = readConfigFileInString();
+
+       if (stringConfig == NULL)
+       {
+               printf("Could not read JSON configuration file in string.");
+               return 0;
+       }
+
+       cJSON *jsonConfig = cJSON_Parse(stringConfig);
+       if (jsonConfig == NULL)
+       {
+               free(stringConfig);
+               const char *error_ptr = cJSON_GetErrorPtr();
+               if (error_ptr != NULL)
+               {
+                       fprintf(stderr, "Could not parse JSON configuration! Error before: %s\n", error_ptr);
+               }
+               return SR_ERR_OPERATION_FAILED;
+       }
+       //we don't need the string anymore
+       free(stringConfig);
+
+       cJSON *vesDetails = cJSON_GetObjectItemCaseSensitive(jsonConfig, "ves-endpoint-details");
+       if (!cJSON_IsObject(vesDetails))
+       {
+               printf("Configuration JSON is not as expected: ves-endpoint-details is not an object");
+               free(jsonConfig);
+               return SR_ERR_OPERATION_FAILED;
+       }
+
+       cJSON *vesAuthMethod = cJSON_GetObjectItemCaseSensitive(vesDetails, "ves-endpoint-auth-method");
+       if (!cJSON_IsString(vesAuthMethod))
+       {
+               printf("Configuration JSON is not as expected: ves-endpoint-auth-method is not an object");
+               free(jsonConfig);
+               return SR_ERR_OPERATION_FAILED;
+       }
+
+       char *auth_method_string = strdup(cJSON_GetStringValue(vesAuthMethod));
+
+       free(jsonConfig);
+
+       return auth_method_string;
+}
+
+/*
+ * Dynamically allocated memory;
+ * Caller needs to free the memory after it uses the value.
+ *
+*/
+char*  getVesIpFromConfigJson(void)
+{
+       char *stringConfig = readConfigFileInString();
+
+       if (stringConfig == NULL)
+       {
+               printf("Could not read JSON configuration file in string.");
+               return 0;
+       }
+
+       cJSON *jsonConfig = cJSON_Parse(stringConfig);
+       if (jsonConfig == NULL)
+       {
+               free(stringConfig);
+               const char *error_ptr = cJSON_GetErrorPtr();
+               if (error_ptr != NULL)
+               {
+                       fprintf(stderr, "Could not parse JSON configuration! Error before: %s\n", error_ptr);
+               }
+               return SR_ERR_OPERATION_FAILED;
+       }
+       //we don't need the string anymore
+       free(stringConfig);
+
+       cJSON *vesDetails = cJSON_GetObjectItemCaseSensitive(jsonConfig, "ves-endpoint-details");
+       if (!cJSON_IsObject(vesDetails))
+       {
+               printf("Configuration JSON is not as expected: ves-endpoint-details is not an object");
+               free(jsonConfig);
+               return SR_ERR_OPERATION_FAILED;
+       }
+
+       cJSON *vesIp = cJSON_GetObjectItemCaseSensitive(vesDetails, "ves-endpoint-ip");
+       if (!cJSON_IsString(vesIp))
+       {
+               printf("Configuration JSON is not as expected: ves-endpoint-ip is not an object");
+               free(jsonConfig);
+               return SR_ERR_OPERATION_FAILED;
+       }
+
+       char *ves_ip = strdup(cJSON_GetStringValue(vesIp));
+
+       free(jsonConfig);
+
+       return ves_ip;
+}
+
+int    getVesPortFromConfigJson(void)
+{
+       char *stringConfig = readConfigFileInString();
+
+       if (stringConfig == NULL)
+       {
+               printf("Could not read JSON configuration file in string.");
+               return 0;
+       }
+
+       cJSON *jsonConfig = cJSON_Parse(stringConfig);
+       if (jsonConfig == NULL)
+       {
+               free(stringConfig);
+               const char *error_ptr = cJSON_GetErrorPtr();
+               if (error_ptr != NULL)
+               {
+                       fprintf(stderr, "Could not parse JSON configuration! Error before: %s\n", error_ptr);
+               }
+               return SR_ERR_OPERATION_FAILED;
+       }
+       //we don't need the string anymore
+       free(stringConfig);
+
+       cJSON *vesDetails = cJSON_GetObjectItemCaseSensitive(jsonConfig, "ves-endpoint-details");
+       if (!cJSON_IsObject(vesDetails))
+       {
+               printf("Configuration JSON is not as expected: ves-endpoint-details is not an object");
+               free(jsonConfig);
+               return SR_ERR_OPERATION_FAILED;
+       }
+
+       cJSON *vesPort = cJSON_GetObjectItemCaseSensitive(vesDetails, "ves-endpoint-port");
+       if (!cJSON_IsNumber(vesPort))
+       {
+               printf("Configuration JSON is not as expected: ves-endpoint-port is not an object");
+               free(jsonConfig);
+               return SR_ERR_OPERATION_FAILED;
+       }
+
+       int port = (int)(vesPort->valuedouble);
+
+       free(jsonConfig);
+
+       return port;
+}
+
+int    getVesRegistrationFromConfigJson(void)
+{
+       char *stringConfig = readConfigFileInString();
+
+       if (stringConfig == NULL)
+       {
+               printf("Could not read JSON configuration file in string.");
+               return 0;
+       }
+
+       cJSON *jsonConfig = cJSON_Parse(stringConfig);
+       if (jsonConfig == NULL)
+       {
+               free(stringConfig);
+               const char *error_ptr = cJSON_GetErrorPtr();
+               if (error_ptr != NULL)
+               {
+                       fprintf(stderr, "Could not parse JSON configuration! Error before: %s\n", error_ptr);
+               }
+               return SR_ERR_OPERATION_FAILED;
+       }
+       //we don't need the string anymore
+       free(stringConfig);
+
+       cJSON *vesDetails = cJSON_GetObjectItemCaseSensitive(jsonConfig, "ves-endpoint-details");
+       if (!cJSON_IsObject(vesDetails))
+       {
+               printf("Configuration JSON is not as expected: ves-endpoint-details is not an object");
+               free(jsonConfig);
+               return SR_ERR_OPERATION_FAILED;
+       }
+
+       cJSON *vesReg = cJSON_GetObjectItemCaseSensitive(vesDetails, "ves-registration");
+       if (!cJSON_IsBool(vesReg))
+       {
+               printf("Configuration JSON is not as expected: ves-registration is not an object");
+               free(jsonConfig);
+               return SR_ERR_OPERATION_FAILED;
+       }
+
+       int is_ves_reg = (cJSON_IsTrue(vesReg)) ? TRUE : FALSE;
+
+       free(jsonConfig);
+
+       return is_ves_reg;
+}
+
+cJSON* vesCreatePnfRegistrationFields(int port, bool is_tls)
+{
+       cJSON *pnfRegistrationFields = cJSON_CreateObject();
+       if (pnfRegistrationFields == NULL)
+       {
+               printf("Could not create JSON object: pnfRegistrationFields\n");
+               return NULL;
+       }
+
+       if (cJSON_AddStringToObject(pnfRegistrationFields, "pnfRegistrationFieldsVersion", "2.0") == NULL)
+       {
+               printf("Could not create JSON object: pnfRegistrationFieldsVersion\n");
+               return NULL;
+       }
+
+       if (cJSON_AddStringToObject(pnfRegistrationFields, "lastServiceDate", "2019-08-16") == NULL)
+       {
+               printf("Could not create JSON object: lastServiceDate\n");
+               return NULL;
+       }
+
+       char mac_addr[40];
+       generateRandomMacAddress(mac_addr);
+
+       if (cJSON_AddStringToObject(pnfRegistrationFields, "macAddress", mac_addr) == NULL)
+       {
+               printf("Could not create JSON object: macAddress\n");
+               return NULL;
+       }
+
+       if (cJSON_AddStringToObject(pnfRegistrationFields, "manufactureDate", "2019-08-16") == NULL)
+       {
+               printf("Could not create JSON object: manufactureDate\n");
+               return NULL;
+       }
+
+       if (cJSON_AddStringToObject(pnfRegistrationFields, "modelNumber", "Simulated Device Melacon") == NULL)
+       {
+               printf("Could not create JSON object: manufactureDate\n");
+               return NULL;
+       }
+
+       if (cJSON_AddStringToObject(pnfRegistrationFields, "oamV4IpAddress", getenv("NTS_IP")) == NULL)
+       {
+               printf("Could not create JSON object: oamV4IpAddress\n");
+               return NULL;
+       }
+
+       if (cJSON_AddStringToObject(pnfRegistrationFields, "oamV6IpAddress", "0:0:0:0:0:ffff:a0a:011") == NULL)
+       {
+               printf("Could not create JSON object: oamV6IpAddress\n");
+               return NULL;
+       }
+
+       char serial_number[100];
+       sprintf(serial_number, "%s-%s-%d-Simulated Device Melacon", getenv("HOSTNAME"), getenv("NTS_IP"), port);
+
+       if (cJSON_AddStringToObject(pnfRegistrationFields, "serialNumber", serial_number) == NULL)
+       {
+               printf("Could not create JSON object: serialNumber\n");
+               return NULL;
+       }
+
+       if (cJSON_AddStringToObject(pnfRegistrationFields, "softwareVersion", "2.3.5") == NULL)
+       {
+               printf("Could not create JSON object: softwareVersion\n");
+               return NULL;
+       }
+
+       if (cJSON_AddStringToObject(pnfRegistrationFields, "unitFamily", "Simulated Device") == NULL)
+       {
+               printf("Could not create JSON object: unitFamily\n");
+               return NULL;
+       }
+
+       if (cJSON_AddStringToObject(pnfRegistrationFields, "unitType", "O-RAN-sim") == NULL)
+       {
+               printf("Could not create JSON object: unitType\n");
+               return NULL;
+       }
+
+       if (cJSON_AddStringToObject(pnfRegistrationFields, "vendorName", "Melacon") == NULL)
+       {
+               printf("Could not create JSON object: vendorName\n");
+               return NULL;
+       }
+
+       cJSON *additionalFields = cJSON_CreateObject();
+       if (additionalFields == NULL)
+       {
+               printf("Could not create JSON object: additionalFields\n");
+               return NULL;
+       }
+       cJSON_AddItemToObject(pnfRegistrationFields, "additionalFields", additionalFields);
+
+       char portString[10];
+       sprintf(portString, "%d", port);
+
+       if (cJSON_AddStringToObject(additionalFields, "oamPort", portString) == NULL)
+       {
+               printf("Could not create JSON object: oamPort\n");
+               return NULL;
+       }
+
+       if (is_tls)
+       {
+               //TLS specific configuration
+               if (cJSON_AddStringToObject(additionalFields, "protocol", "TLS") == NULL)
+               {
+                       printf("Could not create JSON object: protocol\n");
+                       return NULL;
+               }
+
+               //TODO here we have the username from the docker container hardcoded: netconf
+               if (cJSON_AddStringToObject(additionalFields, "username", "netconf") == NULL)
+               {
+                       printf("Could not create JSON object: username\n");
+                       return NULL;
+               }
+
+               if (cJSON_AddStringToObject(additionalFields, "keyId", "device-key") == NULL)
+               {
+                       printf("Could not create JSON object: keyId\n");
+                       return NULL;
+               }
+       }
+       else
+       {
+               //SSH specific configuration
+               if (cJSON_AddStringToObject(additionalFields, "protocol", "SSH") == NULL)
+               {
+                       printf("Could not create JSON object: protocol\n");
+                       return NULL;
+               }
+
+               //TODO here we have the username from the docker container hardcoded: netconf
+               if (cJSON_AddStringToObject(additionalFields, "username", "netconf") == NULL)
+               {
+                       printf("Could not create JSON object: username\n");
+                       return NULL;
+               }
+
+               //TODO here we have the password from the docker container hardcoded: netconf
+               if (cJSON_AddStringToObject(additionalFields, "password", "netconf") == NULL)
+               {
+                       printf("Could not create JSON object: password\n");
+                       return NULL;
+               }
+       }
+
+       if (cJSON_AddStringToObject(additionalFields, "reconnectOnChangedSchema", "false") == NULL)
+       {
+               printf("Could not create JSON object: reconnectOnChangedSchema\n");
+               return NULL;
+       }
+
+       if (cJSON_AddStringToObject(additionalFields, "sleep-factor", "1.5") == NULL)
+       {
+               printf("Could not create JSON object: sleep-factor\n");
+               return NULL;
+       }
+
+       if (cJSON_AddStringToObject(additionalFields, "tcpOnly", "false") == NULL)
+       {
+               printf("Could not create JSON object: tcpOnly\n");
+               return NULL;
+       }
+
+       if (cJSON_AddStringToObject(additionalFields, "connectionTimeout", "20000") == NULL)
+       {
+               printf("Could not create JSON object: connectionTimeout\n");
+               return NULL;
+       }
+
+       if (cJSON_AddStringToObject(additionalFields, "maxConnectionAttempts", "100") == NULL)
+       {
+               printf("Could not create JSON object: maxConnectionAttempts\n");
+               return NULL;
+       }
+
+       if (cJSON_AddStringToObject(additionalFields, "betweenAttemptsTimeout", "2000") == NULL)
+       {
+               printf("Could not create JSON object: betweenAttemptsTimeout\n");
+               return NULL;
+       }
+
+       if (cJSON_AddStringToObject(additionalFields, "keepaliveDelay", "120") == NULL)
+       {
+               printf("Could not create JSON object: keepaliveDelay\n");
+               return NULL;
+       }
+
+       return pnfRegistrationFields;
+}
+
+int    getNetconfAvailableFromConfigJson(void)
+{
+       char *stringConfig = readConfigFileInString();
+
+       if (stringConfig == NULL)
+       {
+               printf("Could not read JSON configuration file in string.");
+               return 0;
+       }
+
+       cJSON *jsonConfig = cJSON_Parse(stringConfig);
+       if (jsonConfig == NULL)
+       {
+               free(stringConfig);
+               const char *error_ptr = cJSON_GetErrorPtr();
+               if (error_ptr != NULL)
+               {
+                       fprintf(stderr, "Could not parse JSON configuration! Error before: %s\n", error_ptr);
+               }
+               return SR_ERR_OPERATION_FAILED;
+       }
+       //we don't need the string anymore
+       free(stringConfig);
+
+       cJSON *notifDetails = cJSON_GetObjectItemCaseSensitive(jsonConfig, "notification-config");
+       if (!cJSON_IsObject(notifDetails))
+       {
+               printf("Configuration JSON is not as expected: notification-config is not an object");
+               free(jsonConfig);
+               return SR_ERR_OPERATION_FAILED;
+       }
+
+       cJSON *isNetconfAvailable = cJSON_GetObjectItemCaseSensitive(notifDetails, "is-netconf-available");
+       if (!cJSON_IsBool(isNetconfAvailable))
+       {
+               printf("Configuration JSON is not as expected: is-netconf-available is not an object");
+               free(jsonConfig);
+               return SR_ERR_OPERATION_FAILED;
+       }
+
+       int is_netconf_available = (cJSON_IsTrue(isNetconfAvailable)) ? TRUE : FALSE;
+
+       free(jsonConfig);
+
+       return is_netconf_available;
+}
+
+int    getVesAvailableFromConfigJson(void)
+{
+       char *stringConfig = readConfigFileInString();
+
+       if (stringConfig == NULL)
+       {
+               printf("Could not read JSON configuration file in string.");
+               return 0;
+       }
+
+       cJSON *jsonConfig = cJSON_Parse(stringConfig);
+       if (jsonConfig == NULL)
+       {
+               free(stringConfig);
+               const char *error_ptr = cJSON_GetErrorPtr();
+               if (error_ptr != NULL)
+               {
+                       fprintf(stderr, "Could not parse JSON configuration! Error before: %s\n", error_ptr);
+               }
+               return SR_ERR_OPERATION_FAILED;
+       }
+       //we don't need the string anymore
+       free(stringConfig);
+
+       cJSON *notifDetails = cJSON_GetObjectItemCaseSensitive(jsonConfig, "notification-config");
+       if (!cJSON_IsObject(notifDetails))
+       {
+               printf("Configuration JSON is not as expected: notification-config is not an object");
+               free(jsonConfig);
+               return SR_ERR_OPERATION_FAILED;
+       }
+
+       cJSON *isVesAvailable = cJSON_GetObjectItemCaseSensitive(notifDetails, "is-ves-available");
+       if (!cJSON_IsBool(isVesAvailable))
+       {
+               printf("Configuration JSON is not as expected: is-ves-available is not an object");
+               free(jsonConfig);
+               return SR_ERR_OPERATION_FAILED;
+       }
+
+       int is_netconf_available = (cJSON_IsTrue(isVesAvailable)) ? TRUE : FALSE;
+
+       free(jsonConfig);
+
+       return is_netconf_available;
+}
+
+cJSON* vesCreateFaultFields(char *alarm_condition, char *alarm_object, char *severity, char *date_time, char *specific_problem)
+{
+       cJSON *faultFields = cJSON_CreateObject();
+       if (faultFields == NULL)
+       {
+               printf("Could not create JSON object: faultFields\n");
+               return NULL;
+       }
+
+       if (cJSON_AddStringToObject(faultFields, "faultFieldsVersion", "4.0") == NULL)
+       {
+               printf("Could not create JSON object: faultFieldsVersion\n");
+               return NULL;
+       }
+
+       if (cJSON_AddStringToObject(faultFields, "alarmCondition", alarm_condition) == NULL)
+       {
+               printf("Could not create JSON object: alarmCondition\n");
+               return NULL;
+       }
+
+       if (cJSON_AddStringToObject(faultFields, "alarmInterfaceA", alarm_object) == NULL)
+       {
+               printf("Could not create JSON object: alarmInterfaceA\n");
+               return NULL;
+       }
+
+       if (cJSON_AddStringToObject(faultFields, "eventSourceType", "O_RAN_COMPONENT") == NULL)
+       {
+               printf("Could not create JSON object: eventSourceType\n");
+               return NULL;
+       }
+
+       if (cJSON_AddStringToObject(faultFields, "specificProblem", specific_problem) == NULL)
+       {
+               printf("Could not create JSON object: specificProblem\n");
+               return NULL;
+       }
+
+       if (cJSON_AddStringToObject(faultFields, "eventSeverity", severity) == NULL)
+       {
+               printf("Could not create JSON object: eventSeverity\n");
+               return NULL;
+       }
+
+       if (cJSON_AddStringToObject(faultFields, "vfStatus", "Active") == NULL)
+       {
+               printf("Could not create JSON object: vfStatus\n");
+               return NULL;
+       }
+
+       cJSON *alarmAdditionalInformation = cJSON_CreateObject();
+       if (alarmAdditionalInformation == NULL)
+       {
+               printf("Could not create JSON object: alarmAdditionalInformation\n");
+               return NULL;
+       }
+       cJSON_AddItemToObject(faultFields, "alarmAdditionalInformation", alarmAdditionalInformation);
+
+       if (cJSON_AddStringToObject(alarmAdditionalInformation, "eventTime", date_time) == NULL)
+       {
+               printf("Could not create JSON object: eventTime\n");
+               return NULL;
+       }
+
+       if (cJSON_AddStringToObject(alarmAdditionalInformation, "equipType", "O-RAN-sim") == NULL)
+       {
+               printf("Could not create JSON object: equipType\n");
+               return NULL;
+       }
+
+       if (cJSON_AddStringToObject(alarmAdditionalInformation, "vendor", "Melacon") == NULL)
+       {
+               printf("Could not create JSON object: vendor\n");
+               return NULL;
+       }
+
+       if (cJSON_AddStringToObject(alarmAdditionalInformation, "model", "Simulated Device") == NULL)
+       {
+               printf("Could not create JSON object: model\n");
+               return NULL;
+       }
+
+       return faultFields;
+}
diff --git a/ntsimulator/src/ves-messages/CMakeLists.txt b/ntsimulator/src/ves-messages/CMakeLists.txt
new file mode 100644 (file)
index 0000000..d761802
--- /dev/null
@@ -0,0 +1,18 @@
+set (VES_MESSAGES_SOURCES
+    heartbeat.c
+)
+
+include_directories(
+    "/usr/include/x86_64-linux-gnu"
+    "/usr/local/include/cjson"
+    "${PROJECT_SOURCE_DIR}/inc/utils"
+)
+
+add_executable(ves-heartbeat ${VES_MESSAGES_SOURCES})
+target_link_libraries(ves-heartbeat utils)
+target_link_libraries(ves-heartbeat sysrepo)
+target_link_libraries(ves-heartbeat curl)
+target_link_libraries(ves-heartbeat cjson)
+target_link_libraries(ves-heartbeat pthread)
+
+install(TARGETS ves-heartbeat DESTINATION ${CMAKE_INSTALL_BINDIR})
\ No newline at end of file
diff --git a/ntsimulator/src/ves-messages/heartbeat.c b/ntsimulator/src/ves-messages/heartbeat.c
new file mode 100644 (file)
index 0000000..fce544c
--- /dev/null
@@ -0,0 +1,351 @@
+/*
+ * heartbeat.c
+ *
+ *  Created on: Oct 24, 2019
+ *      Author: parallels
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <signal.h>
+#include <inttypes.h>
+#include <limits.h>
+#include <string.h>
+#include <time.h>
+#include <math.h>
+#include <sys/time.h>
+
+#include <pthread.h>
+
+#include "heartbeat.h"
+#include "sysrepo.h"
+#include "sysrepo/values.h"
+
+#include "utils.h"
+
+#define LINE_BUFSIZE 128
+#define SLEEP_BEFORE_PNF_AUTOREG 60
+
+volatile int exit_application = 0;
+
+pthread_mutex_t lock;
+
+static         CURL *curl;
+
+int _init_curl()
+{
+       curl = curl_easy_init();
+
+       if (curl == NULL) {
+               printf("cURL initialization error! Aborting call!\n");
+               return SR_ERR_OPERATION_FAILED;
+       }
+
+       return SR_ERR_OK;
+}
+
+int cleanup_curl()
+{
+       if (curl != NULL)
+       {
+               curl_easy_cleanup(curl);
+       }
+
+       return SR_ERR_OK;
+}
+
+//static void prepare_ves_message_curl(void)
+//{
+//     curl_easy_reset(curl);
+//     set_curl_common_info();
+//
+//     char *ves_ip = getVesIpFromConfigJson();
+//     int ves_port = getVesPortFromConfigJson();
+//
+//     char url[100];
+//     sprintf(url, "http://%s:%d/eventListener/v7", ves_ip, ves_port);
+//     curl_easy_setopt(curl, CURLOPT_URL, url);
+//
+//     free(ves_ip);
+//
+////   curl_easy_setopt(curl, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
+//
+//     return;
+//}
+/*
+ * Heartbeat payload example
+ *
+ * {
+  "event": {
+    "commonEventHeader": {
+      "domain": "heartbeat",
+      "eventId": "parallels-Parallels-Virtual-Platform_2019-10-24T10:25:25.514Z",
+      "eventName": "heartbeat_Controller",
+      "eventType": "Controller",
+      "sequence": 0,
+      "priority": "Low",
+      "reportingEntityId": "",
+      "reportingEntityName": "parallels-Parallels-Virtual-Platform",
+      "sourceId": "",
+      "sourceName": "parallels-Parallels-Virtual-Platform",
+      "startEpochMicrosec": 1571912725514,
+      "lastEpochMicrosec": 1571912725514,
+      "nfNamingCode": "sdn controller",
+      "nfVendorName": "sdn",
+      "timeZoneOffset": "+00:00",
+      "version": "4.0.1",
+      "vesEventListenerVersion":"7.0.1"
+    },
+    "heartbeatFields": {
+      "heartbeatFieldsVersion": "3.0",
+      "heartbeatInterval": 20,
+      "additionalFields": {
+        "eventTime": "2019-10-24T10:25:25.514Z"
+      }
+    }
+  }
+}
+*
+* */
+
+static int send_heartbeat(int heartbeat_interval)
+{
+       CURLcode res;
+       static int sequence_number = 0;
+
+       prepare_ves_message_curl(curl);
+
+       cJSON *postDataJson = cJSON_CreateObject();
+
+       cJSON *event = cJSON_CreateObject();
+       if (event == NULL)
+       {
+               printf("Could not create JSON object: event\n");
+               return 1;
+       }
+       cJSON_AddItemToObject(postDataJson, "event", event);
+
+       char hostname[100];
+       sprintf(hostname, "%s", getenv("HOSTNAME"));
+
+       cJSON *commonEventHeader = vesCreateCommonEventHeader("heartbeat", "Controller", hostname, sequence_number++);
+       if (commonEventHeader == NULL)
+       {
+               printf("Could not create JSON object: commonEventHeader\n");
+               return 1;
+       }
+       cJSON_AddItemToObject(event, "commonEventHeader", commonEventHeader);
+
+       cJSON *heartbeatFields = vesCreateHeartbeatFields(heartbeat_interval);
+       if (heartbeatFields == NULL)
+       {
+               printf("Could not create JSON object: heartbeatFields\n");
+               return 1;
+       }
+       cJSON_AddItemToObject(event, "heartbeatFields", heartbeatFields);
+
+    char *post_data_string = NULL;
+
+       post_data_string = cJSON_PrintUnformatted(postDataJson);
+
+       printf("Post data JSON:\n%s\n", post_data_string);
+
+       if (postDataJson != NULL)
+       {
+               cJSON_Delete(postDataJson);
+       }
+
+       curl_easy_setopt(curl, CURLOPT_POSTFIELDS, post_data_string);
+
+       res = curl_easy_perform(curl);
+
+       if (res != CURLE_OK)
+       {
+               printf("Failed to send cURL...\n");
+               return SR_ERR_OPERATION_FAILED;
+       }
+
+       return SR_ERR_OK;
+}
+
+static void
+sigint_handler(int signum)
+{
+    exit_application = 1;
+}
+
+static int send_pnf_registration_instance(char *hostname, int port, bool is_tls)
+{
+       CURLcode res;
+       static int sequence_number = 0;
+
+       prepare_ves_message_curl(curl);
+
+       cJSON *postDataJson = cJSON_CreateObject();
+
+       cJSON *event = cJSON_CreateObject();
+       if (event == NULL)
+       {
+               printf("Could not create JSON object: event\n");
+               return 1;
+       }
+       cJSON_AddItemToObject(postDataJson, "event", event);
+
+       char source_name[100];
+       sprintf(source_name, "%s_%d", hostname, port);
+
+       cJSON *commonEventHeader = vesCreateCommonEventHeader("pnfRegistration", "EventType5G", source_name, sequence_number++);
+       if (commonEventHeader == NULL)
+       {
+               printf("Could not create JSON object: commonEventHeader\n");
+               return 1;
+       }
+       cJSON_AddItemToObject(event, "commonEventHeader", commonEventHeader);
+
+       cJSON *pnfRegistrationFields = vesCreatePnfRegistrationFields(port, is_tls);
+       if (pnfRegistrationFields == NULL)
+       {
+               printf("Could not create JSON object: pnfRegistrationFields\n");
+               return 1;
+       }
+       cJSON_AddItemToObject(event, "pnfRegistrationFields", pnfRegistrationFields);
+
+    char *post_data_string = NULL;
+
+       post_data_string = cJSON_PrintUnformatted(postDataJson);
+
+       printf("Post data JSON:\n%s\n", post_data_string);
+
+       if (postDataJson != NULL)
+       {
+               cJSON_Delete(postDataJson);
+       }
+
+       curl_easy_setopt(curl, CURLOPT_POSTFIELDS, post_data_string);
+
+       res = curl_easy_perform(curl);
+
+       if (res != CURLE_OK)
+       {
+               printf("Failed to send cURL...\n");
+               return SR_ERR_OPERATION_FAILED;
+       }
+
+       return SR_ERR_OK;
+}
+
+static void pnf_registration(void)
+{
+       // delay the PNF Registration VES message, until anything else is initialized
+       printf("delay the PNF Registration VES message, until anything else is initialized");
+       sleep(SLEEP_BEFORE_PNF_AUTOREG);
+
+       int is_reg = getVesRegistrationFromConfigJson();
+
+       if (!is_reg)
+       {
+               //ves-registration object is set to False, we do not make an automatic PNF registration
+               printf("ves-registration object is set to False, we do not make an automatic PNF registration");
+               return;
+       }
+
+       int rc = SR_ERR_OK, netconf_port_base = 0;
+       char *netconf_base_string = getenv("NETCONF_BASE");
+       char *hostname_string = getenv("HOSTNAME");
+
+       if (netconf_base_string != NULL)
+       {
+               rc = sscanf(netconf_base_string, "%d", &netconf_port_base);
+               if (rc != 1)
+               {
+                       printf("Could not find the NETCONF base port, aborting the PNF registration...\n");
+                       return;
+               }
+       }
+
+       //TODO This is where we hardcoded: 7 devices will have SSH connections and 3 devices will have TLS connections
+       for (int port = 0; port < NETCONF_CONNECTIONS_PER_DEVICE - 3; ++port)
+       {
+               pthread_mutex_lock(&lock);
+               rc = send_pnf_registration_instance(hostname_string, netconf_port_base + port, FALSE);
+               if (rc != SR_ERR_OK)
+               {
+                       printf("Could not send PNF Registration SSH message...\n");
+               }
+               pthread_mutex_unlock(&lock);
+       }
+       for (int port = NETCONF_CONNECTIONS_PER_DEVICE - 3; port < NETCONF_CONNECTIONS_PER_DEVICE; ++port)
+       {
+               pthread_mutex_lock(&lock);
+               rc = send_pnf_registration_instance(hostname_string, netconf_port_base + port, TRUE);
+               pthread_mutex_unlock(&lock);
+               if (rc != SR_ERR_OK)
+               {
+                       printf("Could not send PNF Registration TLS message...\n");
+               }
+       }
+
+       return;
+}
+
+int
+main(int argc, char **argv)
+{
+    int rc = SR_ERR_OK;
+
+    int heartbeat_interval = 120; //seconds
+
+    setbuf(stdout, NULL);
+
+    if (pthread_mutex_init(&lock, NULL) != 0)
+       {
+               printf("Mutex init failed...\n");
+               goto cleanup;
+       }
+
+    pthread_t pnf_autoregistration_thread;
+       if(pthread_create(&pnf_autoregistration_thread, NULL, pnf_registration, NULL))
+       {
+               fprintf(stderr, "Could not create thread for pnf auto registration\n");
+               goto cleanup;
+       }
+
+    rc = _init_curl();
+    if (rc != SR_ERR_OK)
+    {
+        fprintf(stderr, "Could not initialize cURL: %s\n", sr_strerror(rc));
+        goto cleanup;
+    }
+
+    /* loop until ctrl-c is pressed / SIGINT is received */
+    signal(SIGINT, sigint_handler);
+    signal(SIGTERM, sigint_handler);
+    signal(SIGPIPE, SIG_IGN);
+
+    while (!exit_application)
+    {
+       heartbeat_interval = getVesHeartbeatPeriodFromConfigJson();
+
+       if (heartbeat_interval > 0)
+       {
+               pthread_mutex_lock(&lock);
+                       send_heartbeat(heartbeat_interval);
+                       pthread_mutex_unlock(&lock);
+                       sleep(heartbeat_interval);
+       }
+       else
+       {
+               sleep(1);
+       }
+    }
+
+    printf("Application exit requested, exiting.\n");
+
+cleanup:
+
+    rc = cleanup_curl();
+
+    return rc;
+}
+
diff --git a/ntsimulator/src/ves-messages/heartbeat.h b/ntsimulator/src/ves-messages/heartbeat.h
new file mode 100644 (file)
index 0000000..570e0dc
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+ * heartbeat.h
+ *
+ *  Created on: Oct 24, 2019
+ *      Author: parallels
+ */
+
+#ifndef SRC_VES_MESSAGES_HEARTBEAT_H_
+#define SRC_VES_MESSAGES_HEARTBEAT_H_
+
+#include <curl/curl.h>
+#include <stdlib.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <cjson/cJSON.h>
+
+#define CURL_MEM_SIZE 2048
+
+/**
+ * cURL utilities
+*/
+
+struct MemoryStruct {
+  char *memory;
+  size_t size;
+};
+
+int _init_curl(void);
+int cleanup_curl(void);
+
+#endif /* SRC_VES_MESSAGES_HEARTBEAT_H_ */
diff --git a/ntsimulator/yang/auto-load-yangs.sh b/ntsimulator/yang/auto-load-yangs.sh
new file mode 100755 (executable)
index 0000000..1bf2594
--- /dev/null
@@ -0,0 +1,80 @@
+#!/bin/bash
+
+echo "Installing YANG models..."
+
+set -eu -o pipefail
+
+shopt -s failglob
+
+: ${SYSREPOCTL:=sysrepoctl}
+: ${SYSREPOCFG:=sysrepocfg}
+: ${SYSREPOAPPSTART:=/opt/dev/sysrepo/build/examples/application_example}
+
+declare -a excludedModules=()
+
+sleep 5
+
+pyang -f clearmust *.yang
+
+mapfile -t modelList < <(pyang -f depend --depend-recurse *.yang)
+
+for model in *.yang
+do
+  echo "Removing config false from $model..."
+  sed -i '/config false;/d' $model
+  echo "Removing mandatory true from $model..."
+  sed -i '/mandatory true;/d' $model
+done
+
+if [ ${#modelList[@]} -eq 0 ]; then
+  echo "No models present, nothing to do..."
+  exit 0
+else
+  for model in ${modelList[@]}
+  do
+    modelName=${model%".yang"}
+    
+    skip_model=false
+    
+    for excluded in ${excludedModules[@]}; do
+      if [ "$excluded" == "$modelName" ]; then
+        skip_model=true
+      fi
+    done
+    
+    if [ "$skip_model" = true ]; then
+      echo "Skipping installation of excluded model $modelName..."
+      continue
+    fi
+    
+    echo "Installing model: $model"
+    $SYSREPOCTL --install --yang=$model --owner=root:root --permissions=666
+    
+       mapfile -t featureList < <(pyang -f listfeature $model)
+  
+    if [ ${#featureList[@]} -eq 0 ]; then
+      echo "No features, nothing to do here..."
+    else
+      for feature in ${featureList[@]}
+      do
+        $SYSREPOCTL --feature-enable=$feature --module=$modelName
+      done
+    fi
+    
+    #if the YANG model contains only typedefs, we do not need to subscribe for datastore changes
+    isTypeOnly=$(pyang -f listfeature --is-type-only $model)
+    
+    if [ "$isTypeOnly" == "False" ]; then
+      printf "\n[program:$modelName]\ncommand=/opt/dev/sysrepo/build/examples/application_example $modelName\nautorestart=false\nredirect_stderr=true\nstartretries=1\npriority=4\n" >> /etc/supervisord.conf  
+    fi
+    
+  done
+fi
+
+# Fix for the NETCONF notifications
+echo "Fixing the NETCONF notifications..."
+mkdir -p /var/run/sysrepo-subscriptions/ietf-crypto-types
+
+echo "YANG models installation done!"
+
+exit 0
\ No newline at end of file
diff --git a/ntsimulator/yang/iana-hardware.yang b/ntsimulator/yang/iana-hardware.yang
new file mode 100755 (executable)
index 0000000..52bcaf3
--- /dev/null
@@ -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/ntsimulator/yang/iana-if-type.yang b/ntsimulator/yang/iana-if-type.yang
new file mode 100644 (file)
index 0000000..24d04e6
--- /dev/null
@@ -0,0 +1,1611 @@
+module iana-if-type {
+  namespace "urn:ietf:params:xml:ns:yang:iana-if-type";
+  prefix ianaift;
+
+  import ietf-interfaces {
+    prefix if;
+  }
+
+  organization "IANA";
+  contact
+    "        Internet Assigned Numbers Authority
+     Postal: ICANN
+             12025 Waterfront Drive, Suite 300
+             Los Angeles, CA 90094-2536
+             United States
+     Tel:    +1 310 301 5800
+     <mailto:iana&iana.org>";
+  description
+    "This YANG module defines YANG identities for IANA-registered
+     interface types.
+     This YANG module is maintained by IANA and reflects the
+     'ifType definitions' registry.
+     The latest revision of this YANG module can be obtained from
+     the IANA web site.
+     Requests for new values should be made to IANA via
+     email (iana&iana.org).
+     Copyright (c) 2014 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
+     (http://trustee.ietf.org/license-info).
+     The initial version of this YANG module is part of RFC 7224;
+     see the RFC itself for full legal notices.";
+  reference
+    "IANA 'ifType definitions' registry.
+     <http://www.iana.org/assignments/smi-numbers>";
+
+  revision 2017-01-19 {
+    description
+      "Registered ifType 289.";
+  }
+
+  revision 2016-11-23 {
+    description
+      "Registered ifTypes 283-288.";
+  }
+
+  revision 2016-06-09 {
+    description
+      "Registered ifType 282.";
+  }
+  revision 2016-05-03 {
+    description
+      "Registered ifType 281.";
+  }
+  revision 2015-06-12 {
+    description
+      "Corrected formatting issue.";
+  }
+  revision 2014-09-24 {
+    description
+      "Registered ifType 280.";
+  }
+  revision 2014-09-19 {
+    description
+      "Registered ifType 279.";
+  }
+  revision 2014-07-03 {
+    description
+      "Registered ifTypes 277-278.";
+  }
+  revision 2014-05-19 {
+    description
+      "Updated the contact address.";
+  }
+  revision 2014-05-08 {
+    description
+      "Initial revision.";
+    reference
+      "RFC 7224: IANA Interface Type YANG Module";
+  }
+
+  identity iana-interface-type {
+    base if:interface-type;
+    description
+      "This identity is used as a base for all interface types
+       defined in the 'ifType definitions' registry.";
+  }
+
+  identity other {
+    base iana-interface-type;
+  }
+  identity regular1822 {
+    base iana-interface-type;
+  }
+  identity hdh1822 {
+    base iana-interface-type;
+  }
+  identity ddnX25 {
+    base iana-interface-type;
+  }
+  identity rfc877x25 {
+    base iana-interface-type;
+    reference
+      "RFC 1382 - SNMP MIB Extension for the X.25 Packet Layer";
+  }
+  identity ethernetCsmacd {
+    base iana-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 iso88023Csmacd {
+    base iana-interface-type;
+    status deprecated;
+    description
+      "Deprecated via RFC 3635.
+       Use ethernetCsmacd(6) instead.";
+    reference
+      "RFC 3635 - Definitions of Managed Objects for the
+                  Ethernet-like Interface Types";
+  }
+  identity iso88024TokenBus {
+    base iana-interface-type;
+  }
+  identity iso88025TokenRing {
+    base iana-interface-type;
+  }
+  identity iso88026Man {
+    base iana-interface-type;
+  }
+  identity starLan {
+    base iana-interface-type;
+    status deprecated;
+    description
+      "Deprecated via RFC 3635.
+       Use ethernetCsmacd(6) instead.";
+    reference
+      "RFC 3635 - Definitions of Managed Objects for the
+                  Ethernet-like Interface Types";
+  }
+  identity proteon10Mbit {
+    base iana-interface-type;
+  }
+  identity proteon80Mbit {
+    base iana-interface-type;
+  }
+  identity hyperchannel {
+    base iana-interface-type;
+  }
+  identity fddi {
+    base iana-interface-type;
+    reference
+      "RFC 1512 - FDDI Management Information Base";
+  }
+  identity lapb {
+    base iana-interface-type;
+    reference
+      "RFC 1381 - SNMP MIB Extension for X.25 LAPB";
+  }
+  identity sdlc {
+    base iana-interface-type;
+  }
+  identity ds1 {
+    base iana-interface-type;
+    description
+      "DS1-MIB.";
+    reference
+      "RFC 4805 - Definitions of Managed Objects for the
+                  DS1, J1, E1, DS2, and E2 Interface Types";
+  }
+  identity e1 {
+    base iana-interface-type;
+    status obsolete;
+    description
+      "Obsolete; see DS1-MIB.";
+    reference
+      "RFC 4805 - Definitions of Managed Objects for the
+                  DS1, J1, E1, DS2, and E2 Interface Types";
+  }
+  identity basicISDN {
+    base iana-interface-type;
+    description
+      "No longer used.  See also RFC 2127.";
+  }
+  identity primaryISDN {
+    base iana-interface-type;
+    description
+      "No longer used.  See also RFC 2127.";
+  }
+  identity propPointToPointSerial {
+    base iana-interface-type;
+    description
+      "Proprietary serial.";
+  }
+  identity ppp {
+    base iana-interface-type;
+  }
+  identity softwareLoopback {
+    base iana-interface-type;
+  }
+  identity eon {
+    base iana-interface-type;
+    description
+      "CLNP over IP.";
+  }
+  identity ethernet3Mbit {
+    base iana-interface-type;
+  }
+  identity nsip {
+    base iana-interface-type;
+    description
+      "XNS over IP.";
+  }
+  identity slip {
+    base iana-interface-type;
+    description
+      "Generic SLIP.";
+  }
+  identity ultra {
+    base iana-interface-type;
+    description
+      "Ultra Technologies.";
+  }
+  identity ds3 {
+    base iana-interface-type;
+    description
+      "DS3-MIB.";
+    reference
+      "RFC 3896 - Definitions of Managed Objects for the
+                  DS3/E3 Interface Type";
+  }
+  identity sip {
+    base iana-interface-type;
+    description
+      "SMDS, coffee.";
+    reference
+      "RFC 1694 - Definitions of Managed Objects for SMDS
+                  Interfaces using SMIv2";
+  }
+  identity frameRelay {
+    base iana-interface-type;
+    description
+      "DTE only.";
+    reference
+      "RFC 2115 - Management Information Base for Frame Relay
+                  DTEs Using SMIv2";
+  }
+  identity rs232 {
+    base iana-interface-type;
+    reference
+      "RFC 1659 - Definitions of Managed Objects for RS-232-like
+                  Hardware Devices using SMIv2";
+  }
+  identity para {
+    base iana-interface-type;
+    description
+      "Parallel-port.";
+    reference
+      "RFC 1660 - Definitions of Managed Objects for
+                  Parallel-printer-like Hardware Devices using
+                  SMIv2";
+  }
+  identity arcnet {
+    base iana-interface-type;
+    description
+      "ARCnet.";
+  }
+  identity arcnetPlus {
+    base iana-interface-type;
+    description
+      "ARCnet Plus.";
+  }
+  identity atm {
+    base iana-interface-type;
+    description
+      "ATM cells.";
+  }
+  identity miox25 {
+    base iana-interface-type;
+    reference
+      "RFC 1461 - SNMP MIB extension for Multiprotocol
+                  Interconnect over X.25";
+  }
+  identity sonet {
+    base iana-interface-type;
+    description
+      "SONET or SDH.";
+  }
+  identity x25ple {
+    base iana-interface-type;
+    reference
+      "RFC 2127 - ISDN Management Information Base using SMIv2";
+  }
+  identity iso88022llc {
+    base iana-interface-type;
+  }
+  identity localTalk {
+    base iana-interface-type;
+  }
+  identity smdsDxi {
+    base iana-interface-type;
+  }
+  identity frameRelayService {
+    base iana-interface-type;
+    description
+      "FRNETSERV-MIB.";
+    reference
+      "RFC 2954 - Definitions of Managed Objects for Frame
+                  Relay Service";
+  }
+  identity v35 {
+    base iana-interface-type;
+  }
+  identity hssi {
+    base iana-interface-type;
+  }
+  identity hippi {
+    base iana-interface-type;
+  }
+  identity modem {
+    base iana-interface-type;
+    description
+      "Generic modem.";
+  }
+  identity aal5 {
+    base iana-interface-type;
+    description
+      "AAL5 over ATM.";
+  }
+  identity sonetPath {
+    base iana-interface-type;
+  }
+  identity sonetVT {
+    base iana-interface-type;
+  }
+  identity smdsIcip {
+    base iana-interface-type;
+    description
+      "SMDS InterCarrier Interface.";
+  }
+  identity propVirtual {
+    base iana-interface-type;
+    description
+      "Proprietary virtual/internal.";
+    reference
+      "RFC 2863 - The Interfaces Group MIB";
+  }
+  identity propMultiplexor {
+    base iana-interface-type;
+    description
+      "Proprietary multiplexing.";
+    reference
+      "RFC 2863 - The Interfaces Group MIB";
+  }
+  identity ieee80212 {
+    base iana-interface-type;
+    description
+      "100BaseVG.";
+  }
+  identity fibreChannel {
+    base iana-interface-type;
+    description
+      "Fibre Channel.";
+  }
+  identity hippiInterface {
+    base iana-interface-type;
+    description
+      "HIPPI interfaces.";
+  }
+  identity frameRelayInterconnect {
+    base iana-interface-type;
+    status obsolete;
+    description
+      "Obsolete; use either
+       frameRelay(32) or frameRelayService(44).";
+  }
+  identity aflane8023 {
+    base iana-interface-type;
+    description
+      "ATM Emulated LAN for 802.3.";
+  }
+  identity aflane8025 {
+    base iana-interface-type;
+    description
+      "ATM Emulated LAN for 802.5.";
+  }
+  identity cctEmul {
+    base iana-interface-type;
+    description
+      "ATM Emulated circuit.";
+  }
+  identity fastEther {
+    base iana-interface-type;
+    status deprecated;
+    description
+      "Obsoleted via RFC 3635.
+       ethernetCsmacd(6) should be used instead.";
+    reference
+      "RFC 3635 - Definitions of Managed Objects for the
+                  Ethernet-like Interface Types";
+  }
+  identity isdn {
+    base iana-interface-type;
+    description
+      "ISDN and X.25.";
+    reference
+      "RFC 1356 - Multiprotocol Interconnect on X.25 and ISDN
+                  in the Packet Mode";
+  }
+  identity v11 {
+    base iana-interface-type;
+    description
+      "CCITT V.11/X.21.";
+  }
+  identity v36 {
+    base iana-interface-type;
+    description
+      "CCITT V.36.";
+  }
+  identity g703at64k {
+    base iana-interface-type;
+    description
+      "CCITT G703 at 64Kbps.";
+  }
+  identity g703at2mb {
+    base iana-interface-type;
+    status obsolete;
+    description
+      "Obsolete; see DS1-MIB.";
+  }
+  identity qllc {
+    base iana-interface-type;
+    description
+      "SNA QLLC.";
+  }
+  identity fastEtherFX {
+    base iana-interface-type;
+    status deprecated;
+    description
+      "Obsoleted via RFC 3635.
+       ethernetCsmacd(6) should be used instead.";
+    reference
+      "RFC 3635 - Definitions of Managed Objects for the
+                  Ethernet-like Interface Types";
+  }
+  identity channel {
+    base iana-interface-type;
+    description
+      "Channel.";
+  }
+  identity ieee80211 {
+    base iana-interface-type;
+    description
+      "Radio spread spectrum.";
+  }
+  identity ibm370parChan {
+    base iana-interface-type;
+    description
+      "IBM System 360/370 OEMI Channel.";
+  }
+  identity escon {
+    base iana-interface-type;
+    description
+      "IBM Enterprise Systems Connection.";
+  }
+  identity dlsw {
+    base iana-interface-type;
+    description
+      "Data Link Switching.";
+  }
+  identity isdns {
+    base iana-interface-type;
+    description
+      "ISDN S/T interface.";
+  }
+  identity isdnu {
+    base iana-interface-type;
+    description
+      "ISDN U interface.";
+  }
+  identity lapd {
+    base iana-interface-type;
+    description
+      "Link Access Protocol D.";
+  }
+  identity ipSwitch {
+    base iana-interface-type;
+    description
+      "IP Switching Objects.";
+  }
+  identity rsrb {
+    base iana-interface-type;
+    description
+      "Remote Source Route Bridging.";
+  }
+  identity atmLogical {
+    base iana-interface-type;
+    description
+      "ATM Logical Port.";
+    reference
+      "RFC 3606 - Definitions of Supplemental Managed Objects
+                  for ATM Interface";
+  }
+  identity ds0 {
+    base iana-interface-type;
+    description
+      "Digital Signal Level 0.";
+    reference
+      "RFC 2494 - Definitions of Managed Objects for the DS0
+                  and DS0 Bundle Interface Type";
+  }
+  identity ds0Bundle {
+    base iana-interface-type;
+    description
+      "Group of ds0s on the same ds1.";
+    reference
+      "RFC 2494 - Definitions of Managed Objects for the DS0
+                  and DS0 Bundle Interface Type";
+  }
+  identity bsc {
+    base iana-interface-type;
+    description
+      "Bisynchronous Protocol.";
+  }
+  identity async {
+    base iana-interface-type;
+    description
+      "Asynchronous Protocol.";
+  }
+  identity cnr {
+    base iana-interface-type;
+    description
+      "Combat Net Radio.";
+  }
+  identity iso88025Dtr {
+    base iana-interface-type;
+    description
+      "ISO 802.5r DTR.";
+  }
+  identity eplrs {
+    base iana-interface-type;
+    description
+      "Ext Pos Loc Report Sys.";
+  }
+  identity arap {
+    base iana-interface-type;
+    description
+      "Appletalk Remote Access Protocol.";
+  }
+  identity propCnls {
+    base iana-interface-type;
+    description
+      "Proprietary Connectionless Protocol.";
+  }
+  identity hostPad {
+    base iana-interface-type;
+    description
+      "CCITT-ITU X.29 PAD Protocol.";
+  }
+  identity termPad {
+    base iana-interface-type;
+    description
+      "CCITT-ITU X.3 PAD Facility.";
+  }
+  identity frameRelayMPI {
+    base iana-interface-type;
+    description
+      "Multiproto Interconnect over FR.";
+  }
+  identity x213 {
+    base iana-interface-type;
+    description
+      "CCITT-ITU X213.";
+  }
+  identity adsl {
+    base iana-interface-type;
+    description
+      "Asymmetric Digital Subscriber Loop.";
+  }
+  identity radsl {
+    base iana-interface-type;
+    description
+      "Rate-Adapt. Digital Subscriber Loop.";
+  }
+  identity sdsl {
+    base iana-interface-type;
+    description
+      "Symmetric Digital Subscriber Loop.";
+  }
+  identity vdsl {
+    base iana-interface-type;
+    description
+      "Very H-Speed Digital Subscrib. Loop.";
+  }
+  identity iso88025CRFPInt {
+    base iana-interface-type;
+    description
+      "ISO 802.5 CRFP.";
+  }
+  identity myrinet {
+    base iana-interface-type;
+    description
+      "Myricom Myrinet.";
+  }
+  identity voiceEM {
+    base iana-interface-type;
+    description
+      "Voice recEive and transMit.";
+  }
+  identity voiceFXO {
+    base iana-interface-type;
+    description
+      "Voice Foreign Exchange Office.";
+  }
+  identity voiceFXS {
+    base iana-interface-type;
+    description
+      "Voice Foreign Exchange Station.";
+  }
+  identity voiceEncap {
+    base iana-interface-type;
+    description
+      "Voice encapsulation.";
+  }
+  identity voiceOverIp {
+    base iana-interface-type;
+    description
+      "Voice over IP encapsulation.";
+  }
+  identity atmDxi {
+    base iana-interface-type;
+    description
+      "ATM DXI.";
+  }
+  identity atmFuni {
+    base iana-interface-type;
+    description
+      "ATM FUNI.";
+  }
+  identity atmIma {
+    base iana-interface-type;
+    description
+      "ATM IMA.";
+  }
+  identity pppMultilinkBundle {
+    base iana-interface-type;
+    description
+      "PPP Multilink Bundle.";
+  }
+  identity ipOverCdlc {
+    base iana-interface-type;
+    description
+      "IBM ipOverCdlc.";
+  }
+  identity ipOverClaw {
+    base iana-interface-type;
+    description
+      "IBM Common Link Access to Workstn.";
+  }
+  identity stackToStack {
+    base iana-interface-type;
+    description
+      "IBM stackToStack.";
+  }
+  identity virtualIpAddress {
+    base iana-interface-type;
+    description
+      "IBM VIPA.";
+  }
+  identity mpc {
+    base iana-interface-type;
+    description
+      "IBM multi-protocol channel support.";
+  }
+  identity ipOverAtm {
+    base iana-interface-type;
+    description
+      "IBM ipOverAtm.";
+    reference
+      "RFC 2320 - Definitions of Managed Objects for Classical IP
+                  and ARP Over ATM Using SMIv2 (IPOA-MIB)";
+  }
+  identity iso88025Fiber {
+    base iana-interface-type;
+    description
+      "ISO 802.5j Fiber Token Ring.";
+  }
+  identity tdlc {
+    base iana-interface-type;
+    description
+      "IBM twinaxial data link control.";
+  }
+  identity gigabitEthernet {
+    base iana-interface-type;
+    status deprecated;
+    description
+      "Obsoleted via RFC 3635.
+       ethernetCsmacd(6) should be used instead.";
+    reference
+      "RFC 3635 - Definitions of Managed Objects for the
+                  Ethernet-like Interface Types";
+  }
+  identity hdlc {
+    base iana-interface-type;
+    description
+      "HDLC.";
+  }
+  identity lapf {
+    base iana-interface-type;
+    description
+      "LAP F.";
+  }
+  identity v37 {
+    base iana-interface-type;
+    description
+      "V.37.";
+  }
+  identity x25mlp {
+    base iana-interface-type;
+    description
+      "Multi-Link Protocol.";
+  }
+  identity x25huntGroup {
+    base iana-interface-type;
+    description
+      "X25 Hunt Group.";
+  }
+  identity transpHdlc {
+    base iana-interface-type;
+    description
+      "Transp HDLC.";
+  }
+  identity interleave {
+    base iana-interface-type;
+    description
+      "Interleave channel.";
+  }
+  identity fast {
+    base iana-interface-type;
+    description
+      "Fast channel.";
+  }
+  identity ip {
+    base iana-interface-type;
+    description
+      "IP (for APPN HPR in IP networks).";
+  }
+  identity docsCableMaclayer {
+    base iana-interface-type;
+    description
+      "CATV Mac Layer.";
+  }
+  identity docsCableDownstream {
+    base iana-interface-type;
+    description
+      "CATV Downstream interface.";
+  }
+  identity docsCableUpstream {
+    base iana-interface-type;
+    description
+      "CATV Upstream interface.";
+  }
+  identity a12MppSwitch {
+    base iana-interface-type;
+    description
+      "Avalon Parallel Processor.";
+  }
+  identity tunnel {
+    base iana-interface-type;
+    description
+      "Encapsulation interface.";
+  }
+  identity coffee {
+    base iana-interface-type;
+    description
+      "Coffee pot.";
+    reference
+      "RFC 2325 - Coffee MIB";
+  }
+  identity ces {
+    base iana-interface-type;
+    description
+      "Circuit Emulation Service.";
+  }
+  identity atmSubInterface {
+    base iana-interface-type;
+    description
+      "ATM Sub Interface.";
+  }
+  identity l2vlan {
+    base iana-interface-type;
+    description
+      "Layer 2 Virtual LAN using 802.1Q.";
+  }
+  identity l3ipvlan {
+    base iana-interface-type;
+    description
+      "Layer 3 Virtual LAN using IP.";
+  }
+  identity l3ipxvlan {
+    base iana-interface-type;
+    description
+      "Layer 3 Virtual LAN using IPX.";
+  }
+  identity digitalPowerline {
+    base iana-interface-type;
+    description
+      "IP over Power Lines.";
+  }
+  identity mediaMailOverIp {
+    base iana-interface-type;
+    description
+      "Multimedia Mail over IP.";
+  }
+  identity dtm {
+    base iana-interface-type;
+    description
+      "Dynamic synchronous Transfer Mode.";
+  }
+  identity dcn {
+    base iana-interface-type;
+    description
+      "Data Communications Network.";
+  }
+  identity ipForward {
+    base iana-interface-type;
+    description
+      "IP Forwarding Interface.";
+  }
+  identity msdsl {
+    base iana-interface-type;
+    description
+      "Multi-rate Symmetric DSL.";
+  }
+  identity ieee1394 {
+    base iana-interface-type;
+
+    description
+      "IEEE1394 High Performance Serial Bus.";
+  }
+  identity if-gsn {
+    base iana-interface-type;
+    description
+      "HIPPI-6400.";
+  }
+  identity dvbRccMacLayer {
+    base iana-interface-type;
+    description
+      "DVB-RCC MAC Layer.";
+  }
+  identity dvbRccDownstream {
+    base iana-interface-type;
+    description
+      "DVB-RCC Downstream Channel.";
+  }
+  identity dvbRccUpstream {
+    base iana-interface-type;
+    description
+      "DVB-RCC Upstream Channel.";
+  }
+  identity atmVirtual {
+    base iana-interface-type;
+    description
+      "ATM Virtual Interface.";
+  }
+  identity mplsTunnel {
+    base iana-interface-type;
+    description
+      "MPLS Tunnel Virtual Interface.";
+  }
+  identity srp {
+    base iana-interface-type;
+    description
+      "Spatial Reuse Protocol.";
+  }
+  identity voiceOverAtm {
+    base iana-interface-type;
+    description
+      "Voice over ATM.";
+  }
+  identity voiceOverFrameRelay {
+    base iana-interface-type;
+    description
+      "Voice Over Frame Relay.";
+  }
+  identity idsl {
+    base iana-interface-type;
+    description
+      "Digital Subscriber Loop over ISDN.";
+  }
+  identity compositeLink {
+    base iana-interface-type;
+    description
+      "Avici Composite Link Interface.";
+  }
+  identity ss7SigLink {
+    base iana-interface-type;
+    description
+      "SS7 Signaling Link.";
+  }
+  identity propWirelessP2P {
+    base iana-interface-type;
+    description
+      "Prop. P2P wireless interface.";
+  }
+  identity frForward {
+    base iana-interface-type;
+    description
+      "Frame Forward Interface.";
+  }
+  identity rfc1483 {
+    base iana-interface-type;
+    description
+      "Multiprotocol over ATM AAL5.";
+    reference
+      "RFC 1483 - Multiprotocol Encapsulation over ATM
+                  Adaptation Layer 5";
+  }
+  identity usb {
+    base iana-interface-type;
+    description
+      "USB Interface.";
+  }
+  identity ieee8023adLag {
+    base iana-interface-type;
+    description
+      "IEEE 802.3ad Link Aggregate.";
+  }
+  identity bgppolicyaccounting {
+    base iana-interface-type;
+    description
+      "BGP Policy Accounting.";
+  }
+  identity frf16MfrBundle {
+    base iana-interface-type;
+    description
+      "FRF.16 Multilink Frame Relay.";
+  }
+  identity h323Gatekeeper {
+    base iana-interface-type;
+    description
+      "H323 Gatekeeper.";
+  }
+  identity h323Proxy {
+    base iana-interface-type;
+    description
+      "H323 Voice and Video Proxy.";
+  }
+  identity mpls {
+    base iana-interface-type;
+    description
+      "MPLS.";
+  }
+  identity mfSigLink {
+    base iana-interface-type;
+    description
+      "Multi-frequency signaling link.";
+  }
+  identity hdsl2 {
+    base iana-interface-type;
+    description
+      "High Bit-Rate DSL - 2nd generation.";
+  }
+  identity shdsl {
+    base iana-interface-type;
+    description
+      "Multirate HDSL2.";
+  }
+  identity ds1FDL {
+    base iana-interface-type;
+    description
+      "Facility Data Link (4Kbps) on a DS1.";
+  }
+  identity pos {
+    base iana-interface-type;
+    description
+      "Packet over SONET/SDH Interface.";
+  }
+  identity dvbAsiIn {
+    base iana-interface-type;
+    description
+      "DVB-ASI Input.";
+  }
+  identity dvbAsiOut {
+    base iana-interface-type;
+    description
+      "DVB-ASI Output.";
+  }
+  identity plc {
+    base iana-interface-type;
+    description
+      "Power Line Communications.";
+  }
+  identity nfas {
+    base iana-interface-type;
+    description
+      "Non-Facility Associated Signaling.";
+  }
+  identity tr008 {
+    base iana-interface-type;
+    description
+      "TR008.";
+  }
+  identity gr303RDT {
+    base iana-interface-type;
+    description
+      "Remote Digital Terminal.";
+  }
+  identity gr303IDT {
+    base iana-interface-type;
+    description
+      "Integrated Digital Terminal.";
+  }
+  identity isup {
+    base iana-interface-type;
+    description
+      "ISUP.";
+  }
+  identity propDocsWirelessMaclayer {
+    base iana-interface-type;
+    description
+      "Cisco proprietary Maclayer.";
+  }
+  identity propDocsWirelessDownstream {
+    base iana-interface-type;
+    description
+      "Cisco proprietary Downstream.";
+  }
+  identity propDocsWirelessUpstream {
+    base iana-interface-type;
+    description
+      "Cisco proprietary Upstream.";
+  }
+  identity hiperlan2 {
+    base iana-interface-type;
+    description
+      "HIPERLAN Type 2 Radio Interface.";
+  }
+  identity propBWAp2Mp {
+    base iana-interface-type;
+    description
+      "PropBroadbandWirelessAccesspt2Multipt (use of this value
+       for IEEE 802.16 WMAN interfaces as per IEEE Std 802.16f
+       is deprecated, and ieee80216WMAN(237) should be used
+       instead).";
+  }
+  identity sonetOverheadChannel {
+    base iana-interface-type;
+    description
+      "SONET Overhead Channel.";
+  }
+  identity digitalWrapperOverheadChannel {
+    base iana-interface-type;
+    description
+      "Digital Wrapper.";
+  }
+  identity aal2 {
+    base iana-interface-type;
+    description
+      "ATM adaptation layer 2.";
+  }
+  identity radioMAC {
+    base iana-interface-type;
+    description
+      "MAC layer over radio links.";
+  }
+  identity atmRadio {
+    base iana-interface-type;
+    description
+      "ATM over radio links.";
+  }
+  identity imt {
+    base iana-interface-type;
+    description
+      "Inter-Machine Trunks.";
+  }
+  identity mvl {
+    base iana-interface-type;
+    description
+      "Multiple Virtual Lines DSL.";
+  }
+  identity reachDSL {
+    base iana-interface-type;
+    description
+      "Long Reach DSL.";
+  }
+  identity frDlciEndPt {
+    base iana-interface-type;
+    description
+      "Frame Relay DLCI End Point.";
+  }
+  identity atmVciEndPt {
+    base iana-interface-type;
+    description
+      "ATM VCI End Point.";
+  }
+  identity opticalChannel {
+    base iana-interface-type;
+    description
+      "Optical Channel.";
+  }
+  identity opticalTransport {
+    base iana-interface-type;
+    description
+      "Optical Transport.";
+  }
+  identity propAtm {
+    base iana-interface-type;
+    description
+      "Proprietary ATM.";
+  }
+  identity voiceOverCable {
+    base iana-interface-type;
+    description
+      "Voice Over Cable Interface.";
+  }
+  identity infiniband {
+    base iana-interface-type;
+    description
+      "Infiniband.";
+  }
+  identity teLink {
+    base iana-interface-type;
+    description
+      "TE Link.";
+  }
+  identity q2931 {
+    base iana-interface-type;
+    description
+      "Q.2931.";
+  }
+  identity virtualTg {
+    base iana-interface-type;
+    description
+      "Virtual Trunk Group.";
+  }
+  identity sipTg {
+    base iana-interface-type;
+    description
+      "SIP Trunk Group.";
+  }
+  identity sipSig {
+    base iana-interface-type;
+    description
+      "SIP Signaling.";
+  }
+  identity docsCableUpstreamChannel {
+    base iana-interface-type;
+    description
+      "CATV Upstream Channel.";
+  }
+  identity econet {
+    base iana-interface-type;
+    description
+      "Acorn Econet.";
+  }
+  identity pon155 {
+    base iana-interface-type;
+    description
+      "FSAN 155Mb Symetrical PON interface.";
+  }
+  identity pon622 {
+    base iana-interface-type;
+    description
+      "FSAN 622Mb Symetrical PON interface.";
+  }
+  identity bridge {
+    base iana-interface-type;
+    description
+      "Transparent bridge interface.";
+  }
+  identity linegroup {
+    base iana-interface-type;
+    description
+      "Interface common to multiple lines.";
+  }
+  identity voiceEMFGD {
+    base iana-interface-type;
+    description
+      "Voice E&M Feature Group D.";
+  }
+  identity voiceFGDEANA {
+    base iana-interface-type;
+    description
+      "Voice FGD Exchange Access North American.";
+  }
+  identity voiceDID {
+    base iana-interface-type;
+    description
+      "Voice Direct Inward Dialing.";
+  }
+  identity mpegTransport {
+    base iana-interface-type;
+    description
+      "MPEG transport interface.";
+  }
+  identity sixToFour {
+    base iana-interface-type;
+    status deprecated;
+    description
+      "6to4 interface (DEPRECATED).";
+    reference
+      "RFC 4087 - IP Tunnel MIB";
+  }
+  identity gtp {
+    base iana-interface-type;
+    description
+      "GTP (GPRS Tunneling Protocol).";
+  }
+  identity pdnEtherLoop1 {
+    base iana-interface-type;
+    description
+      "Paradyne EtherLoop 1.";
+  }
+  identity pdnEtherLoop2 {
+    base iana-interface-type;
+    description
+      "Paradyne EtherLoop 2.";
+  }
+  identity opticalChannelGroup {
+    base iana-interface-type;
+    description
+      "Optical Channel Group.";
+  }
+  identity homepna {
+    base iana-interface-type;
+    description
+      "HomePNA ITU-T G.989.";
+  }
+  identity gfp {
+    base iana-interface-type;
+    description
+      "Generic Framing Procedure (GFP).";
+  }
+  identity ciscoISLvlan {
+    base iana-interface-type;
+    description
+      "Layer 2 Virtual LAN using Cisco ISL.";
+  }
+  identity actelisMetaLOOP {
+    base iana-interface-type;
+    description
+      "Acteleis proprietary MetaLOOP High Speed Link.";
+  }
+  identity fcipLink {
+    base iana-interface-type;
+    description
+      "FCIP Link.";
+  }
+  identity rpr {
+    base iana-interface-type;
+    description
+      "Resilient Packet Ring Interface Type.";
+  }
+  identity qam {
+    base iana-interface-type;
+    description
+      "RF Qam Interface.";
+  }
+  identity lmp {
+    base iana-interface-type;
+    description
+      "Link Management Protocol.";
+    reference
+      "RFC 4327 - Link Management Protocol (LMP) Management
+                  Information Base (MIB)";
+  }
+  identity cblVectaStar {
+    base iana-interface-type;
+    description
+      "Cambridge Broadband Networks Limited VectaStar.";
+  }
+  identity docsCableMCmtsDownstream {
+    base iana-interface-type;
+    description
+      "CATV Modular CMTS Downstream Interface.";
+  }
+  identity adsl2 {
+    base iana-interface-type;
+    status deprecated;
+    description
+      "Asymmetric Digital Subscriber Loop Version 2
+       (DEPRECATED/OBSOLETED - please use adsl2plus(238)
+       instead).";
+    reference
+      "RFC 4706 - Definitions of Managed Objects for Asymmetric
+                  Digital Subscriber Line 2 (ADSL2)";
+  }
+  identity macSecControlledIF {
+    base iana-interface-type;
+    description
+      "MACSecControlled.";
+  }
+  identity macSecUncontrolledIF {
+    base iana-interface-type;
+    description
+      "MACSecUncontrolled.";
+  }
+  identity aviciOpticalEther {
+    base iana-interface-type;
+    description
+      "Avici Optical Ethernet Aggregate.";
+  }
+  identity atmbond {
+    base iana-interface-type;
+    description
+      "atmbond.";
+  }
+  identity voiceFGDOS {
+    base iana-interface-type;
+    description
+      "Voice FGD Operator Services.";
+  }
+  identity mocaVersion1 {
+    base iana-interface-type;
+    description
+      "MultiMedia over Coax Alliance (MoCA) Interface
+       as documented in information provided privately to IANA.";
+  }
+  identity ieee80216WMAN {
+    base iana-interface-type;
+    description
+      "IEEE 802.16 WMAN interface.";
+  }
+  identity adsl2plus {
+    base iana-interface-type;
+    description
+      "Asymmetric Digital Subscriber Loop Version 2 -
+       Version 2 Plus and all variants.";
+  }
+  identity dvbRcsMacLayer {
+    base iana-interface-type;
+    description
+      "DVB-RCS MAC Layer.";
+    reference
+      "RFC 5728 - The SatLabs Group DVB-RCS MIB";
+  }
+  identity dvbTdm {
+    base iana-interface-type;
+    description
+      "DVB Satellite TDM.";
+    reference
+      "RFC 5728 - The SatLabs Group DVB-RCS MIB";
+  }
+  identity dvbRcsTdma {
+    base iana-interface-type;
+    description
+      "DVB-RCS TDMA.";
+    reference
+      "RFC 5728 - The SatLabs Group DVB-RCS MIB";
+  }
+  identity x86Laps {
+    base iana-interface-type;
+    description
+      "LAPS based on ITU-T X.86/Y.1323.";
+  }
+  identity wwanPP {
+    base iana-interface-type;
+    description
+      "3GPP WWAN.";
+  }
+  identity wwanPP2 {
+    base iana-interface-type;
+    description
+      "3GPP2 WWAN.";
+  }
+  identity voiceEBS {
+    base iana-interface-type;
+    description
+      "Voice P-phone EBS physical interface.";
+  }
+  identity ifPwType {
+    base iana-interface-type;
+    description
+      "Pseudowire interface type.";
+    reference
+      "RFC 5601 - Pseudowire (PW) Management Information Base (MIB)";
+  }
+  identity ilan {
+    base iana-interface-type;
+    description
+      "Internal LAN on a bridge per IEEE 802.1ap.";
+  }
+  identity pip {
+    base iana-interface-type;
+    description
+      "Provider Instance Port on a bridge per IEEE 802.1ah PBB.";
+  }
+  identity aluELP {
+    base iana-interface-type;
+    description
+      "Alcatel-Lucent Ethernet Link Protection.";
+  }
+  identity gpon {
+    base iana-interface-type;
+    description
+      "Gigabit-capable passive optical networks (G-PON) as per
+       ITU-T G.948.";
+  }
+  identity vdsl2 {
+    base iana-interface-type;
+    description
+      "Very high speed digital subscriber line Version 2
+       (as per ITU-T Recommendation G.993.2).";
+    reference
+      "RFC 5650 - Definitions of Managed Objects for Very High
+                  Speed Digital Subscriber Line 2 (VDSL2)";
+  }
+  identity capwapDot11Profile {
+    base iana-interface-type;
+    description
+      "WLAN Profile Interface.";
+    reference
+      "RFC 5834 - Control and Provisioning of Wireless Access
+                  Points (CAPWAP) Protocol Binding MIB for
+                  IEEE 802.11";
+  }
+  identity capwapDot11Bss {
+    base iana-interface-type;
+    description
+      "WLAN BSS Interface.";
+    reference
+      "RFC 5834 - Control and Provisioning of Wireless Access
+                  Points (CAPWAP) Protocol Binding MIB for
+                  IEEE 802.11";
+  }
+  identity capwapWtpVirtualRadio {
+    base iana-interface-type;
+    description
+      "WTP Virtual Radio Interface.";
+    reference
+      "RFC 5833 - Control and Provisioning of Wireless Access
+                  Points (CAPWAP) Protocol Base MIB";
+  }
+  identity bits {
+    base iana-interface-type;
+    description
+      "bitsport.";
+  }
+  identity docsCableUpstreamRfPort {
+    base iana-interface-type;
+    description
+      "DOCSIS CATV Upstream RF Port.";
+  }
+  identity cableDownstreamRfPort {
+    base iana-interface-type;
+    description
+      "CATV downstream RF Port.";
+  }
+  identity vmwareVirtualNic {
+    base iana-interface-type;
+    description
+      "VMware Virtual Network Interface.";
+  }
+  identity ieee802154 {
+    base iana-interface-type;
+    description
+      "IEEE 802.15.4 WPAN interface.";
+    reference
+      "IEEE 802.15.4-2006";
+  }
+  identity otnOdu {
+    base iana-interface-type;
+    description
+      "OTN Optical Data Unit.";
+  }
+  identity otnOtu {
+    base iana-interface-type;
+    description
+      "OTN Optical channel Transport Unit.";
+  }
+  identity ifVfiType {
+    base iana-interface-type;
+    description
+      "VPLS Forwarding Instance Interface Type.";
+  }
+  identity g9981 {
+    base iana-interface-type;
+    description
+      "G.998.1 bonded interface.";
+  }
+  identity g9982 {
+    base iana-interface-type;
+    description
+      "G.998.2 bonded interface.";
+  }
+  identity g9983 {
+    base iana-interface-type;
+    description
+      "G.998.3 bonded interface.";
+  }
+
+  identity aluEpon {
+    base iana-interface-type;
+    description
+      "Ethernet Passive Optical Networks (E-PON).";
+  }
+  identity aluEponOnu {
+    base iana-interface-type;
+    description
+      "EPON Optical Network Unit.";
+  }
+  identity aluEponPhysicalUni {
+    base iana-interface-type;
+    description
+      "EPON physical User to Network interface.";
+  }
+  identity aluEponLogicalLink {
+    base iana-interface-type;
+    description
+      "The emulation of a point-to-point link over the EPON
+       layer.";
+  }
+  identity aluGponOnu {
+    base iana-interface-type;
+    description
+      "GPON Optical Network Unit.";
+    reference
+      "ITU-T G.984.2";
+  }
+  identity aluGponPhysicalUni {
+    base iana-interface-type;
+    description
+      "GPON physical User to Network interface.";
+    reference
+      "ITU-T G.984.2";
+  }
+  identity vmwareNicTeam {
+    base iana-interface-type;
+    description
+      "VMware NIC Team.";
+  }
+  identity docsOfdmDownstream {
+    base iana-interface-type;
+    description
+      "CATV Downstream OFDM interface.";
+  }
+  identity docsOfdmaUpstream {
+    base iana-interface-type;
+    description
+      "CATV Upstream OFDMA interface.";
+  }
+  identity gfast {
+    base iana-interface-type;
+    description
+      "G.fast port.";
+    reference
+      "ITU-T G.9701";
+  }
+  identity sdci {
+    base iana-interface-type;
+    description
+      "SDCI (IO-Link).";
+    reference
+      "IEC 61131-9 Edition 1.0 2013-09";
+  }
+  identity xboxWireless {
+    base iana-interface-type;
+    description
+      "Xbox wireless.";
+  }
+  identity fastdsl {
+    base iana-interface-type;
+    description
+      "FastDSL.";
+    reference
+      "BBF TR-355";
+  }
+  identity docsCableScte55d1FwdOob {
+    base iana-interface-type;
+    description
+      "Cable SCTE 55-1 OOB Forward Channel.";
+  }
+  identity docsCableScte55d1RetOob {
+    base iana-interface-type;
+    description
+      "Cable SCTE 55-1 OOB Return Channel.";
+  }
+  identity docsCableScte55d2DsOob {
+    base iana-interface-type;
+    description
+      "Cable SCTE 55-2 OOB Downstream Channel.";
+  }
+  identity docsCableScte55d2UsOob {
+    base iana-interface-type;
+    description
+      "Cable SCTE 55-2 OOB Upstream Channel.";
+  }
+  identity docsCableNdf {
+    base iana-interface-type;
+    description
+      "Cable Narrowband Digital Forward.";
+  }
+  identity docsCableNdr {
+    base iana-interface-type;
+    description
+      "Cable Narrowband Digital Return.";
+  }
+  identity ptm {
+    base iana-interface-type;
+    description
+      "Packet Transfer Mode.";
+  }
+}
diff --git a/ntsimulator/yang/ietf-crypto-types.yang b/ntsimulator/yang/ietf-crypto-types.yang
new file mode 100644 (file)
index 0000000..c620734
--- /dev/null
@@ -0,0 +1,2173 @@
+module ietf-crypto-types {
+  yang-version 1.1;
+  namespace "urn:ietf:params:xml:ns:yang:ietf-crypto-types";
+  prefix ct;
+
+  import ietf-yang-types {
+    prefix yang;
+    reference
+      "RFC 6991: Common YANG Data Types";
+  }
+
+  import ietf-netconf-acm {
+    prefix nacm;
+    reference
+      "RFC 8341: Network Configuration Access Control Model";
+  }
+
+  organization
+    "IETF NETCONF (Network Configuration) Working Group";
+  contact
+    "WG Web:   <http://datatracker.ietf.org/wg/netconf/>
+     WG List:  <mailto:netconf@ietf.org>
+     Author:   Kent Watsen <mailto:kent+ietf@watsen.net>
+     Author:   Wang Haiguang <wang.haiguang.shieldlab@huawei.com>";
+
+  description
+    "This module defines common YANG types for cryptographic
+     applications.
+
+     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 XXXX
+     (https://www.rfc-editor.org/info/rfcXXXX); see the RFC
+     itself for full legal notices.;
+
+     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.";
+
+  revision 2019-10-18 {
+    description
+      "Initial version";
+    reference
+      "RFC XXXX: Common YANG Data Types for Cryptography";
+  }
+
+  /**************************************/
+  /*   Identities for Hash Algorithms   */
+  /**************************************/
+
+  typedef hash-algorithm-t {
+    type union {
+      type uint16;
+      type enumeration {
+        enum NONE {
+          value 0;
+          description
+            "Hash algorithm is NULL.";
+        }
+        enum sha1 {
+          value 1;
+          status obsolete;
+          description
+            "The SHA1 algorithm.";
+          reference
+            "RFC 3174: US Secure Hash Algorithms 1 (SHA1).";
+        }
+        enum sha-224 {
+          value 2;
+          description
+            "The SHA-224 algorithm.";
+          reference
+            "RFC 6234: US Secure Hash Algorithms.";
+        }
+        enum sha-256 {
+          value 3;
+          description
+            "The SHA-256 algorithm.";
+          reference
+            "RFC 6234: US Secure Hash Algorithms.";
+        }
+        enum sha-384 {
+          value 4;
+          description
+            "The SHA-384 algorithm.";
+          reference
+            "RFC 6234: US Secure Hash Algorithms.";
+        }
+        enum sha-512 {
+          value 5;
+          description
+            "The SHA-512 algorithm.";
+          reference
+            "RFC 6234: US Secure Hash Algorithms.";
+        }
+        enum shake-128 {
+          value 6;
+          description
+            "The SHA3 algorithm with 128-bits output.";
+          reference
+            "National Institute of Standards and Technology,
+            SHA-3 Standard: Permutation-Based Hash and
+            Extendable-Output Functions, FIPS PUB 202, DOI
+            10.6028/NIST.FIPS.202, August 2015.";
+        }
+        enum shake-224 {
+          value 7;
+          description
+            "The SHA3 algorithm with 224-bits output.";
+          reference
+            "National Institute of Standards and Technology,
+            SHA-3 Standard: Permutation-Based Hash and
+            Extendable-Output Functions, FIPS PUB 202, DOI
+            10.6028/NIST.FIPS.202, August 2015.";
+        }
+        enum shake-256 {
+          value 8;
+          description
+            "The SHA3 algorithm with 256-bits output.";
+          reference
+            "National Institute of Standards and Technology,
+            SHA-3 Standard: Permutation-Based Hash and
+            Extendable-Output Functions, FIPS PUB 202, DOI
+            10.6028/NIST.FIPS.202, August 2015.";
+        }
+        enum shake-384 {
+          value 9;
+          description
+            "The SHA3 algorithm with 384-bits output.";
+          reference
+            "National Institute of Standards and Technology,
+            SHA-3 Standard: Permutation-Based Hash and
+            Extendable-Output Functions, FIPS PUB 202, DOI
+            10.6028/NIST.FIPS.202, August 2015.";
+        }
+        enum shake-512 {
+          value 10;
+          description
+            "The SHA3 algorithm with 384-bits output.";
+          reference
+            "National Institute of Standards and Technology,
+            SHA-3 Standard: Permutation-Based Hash and
+            Extendable-Output Functions, FIPS PUB 202, DOI
+            10.6028/NIST.FIPS.202, August 2015.";
+        }
+      }
+    }
+    default "0";
+    description
+      "The uint16 filed shall be set by individual protocol families
+       according to the hash algorithm value assigned by IANA. The
+       setting is optional and by default is 0.  The enumeration
+       filed is set to the selected hash algorithm.";
+  }
+
+  /***********************************************/
+  /*  Identities for Asymmetric Key Algorithms   */
+  /***********************************************/
+
+  typedef asymmetric-key-algorithm-t {
+    type union {
+      type uint16;
+      type enumeration {
+        enum NONE {
+          value 0;
+          description
+            "Asymetric key algorithm is NULL.";
+        }
+        enum rsa1024 {
+          value 1;
+          description
+            "The RSA algorithm using a 1024-bit key.";
+          reference
+            "RFC 8017: PKCS #1: RSA Cryptography
+             Specifications Version 2.2.";
+        }
+        enum rsa2048 {
+          value 2;
+          description
+            "The RSA algorithm using a 2048-bit key.";
+          reference
+            "RFC 8017:
+             PKCS #1: RSA Cryptography Specifications Version 2.2.";
+        }
+        enum rsa3072 {
+          value 3;
+          description
+            "The RSA algorithm using a 3072-bit key.";
+          reference
+            "RFC 8017:
+             PKCS #1: RSA Cryptography Specifications Version 2.2.";
+        }
+        enum rsa4096 {
+          value 4;
+          description
+            "The RSA algorithm using a 4096-bit key.";
+          reference
+            "RFC 8017:
+             PKCS #1: RSA Cryptography Specifications Version 2.2.";
+        }
+        enum rsa7680 {
+          value 5;
+          description
+            "The RSA algorithm using a 7680-bit key.";
+          reference
+            "RFC 8017:
+             PKCS #1: RSA Cryptography Specifications Version 2.2.";
+        }
+        enum rsa15360 {
+          value 6;
+          description
+            "The RSA algorithm using a 15360-bit key.";
+          reference
+            "RFC 8017:
+             PKCS #1: RSA Cryptography Specifications Version 2.2.";
+        }
+        enum secp192r1 {
+          value 7;
+          description
+            "The asymmetric algorithm using a NIST P192 Curve.";
+          reference
+            "RFC 6090:
+               Fundamental Elliptic Curve Cryptography Algorithms.
+             RFC 5480:
+                Elliptic Curve Cryptography Subject Public Key
+                Information.";
+        }
+        enum secp224r1 {
+          value 8;
+          description
+            "The asymmetric algorithm using a NIST P224 Curve.";
+          reference
+            "RFC 6090:
+               Fundamental Elliptic Curve Cryptography Algorithms.
+             RFC 5480:
+               Elliptic Curve Cryptography Subject Public Key
+               Information.";
+        }
+        enum secp256r1 {
+          value 9;
+          description
+            "The asymmetric algorithm using a NIST P256 Curve.";
+          reference
+            "RFC 6090:
+               Fundamental Elliptic Curve Cryptography Algorithms.
+             RFC 5480:
+               Elliptic Curve Cryptography Subject Public Key
+               Information.";
+        }
+        enum secp384r1 {
+          value 10;
+          description
+            "The asymmetric algorithm using a NIST P384 Curve.";
+          reference
+            "RFC 6090:
+               Fundamental Elliptic Curve Cryptography Algorithms.
+             RFC 5480:
+               Elliptic Curve Cryptography Subject Public Key
+               Information.";
+        }
+        enum secp521r1 {
+          value 11;
+          description
+            "The asymmetric algorithm using a NIST P521 Curve.";
+          reference
+            "RFC 6090:
+               Fundamental Elliptic Curve Cryptography Algorithms.
+             RFC 5480:
+               Elliptic Curve Cryptography Subject Public Key
+               Information.";
+        }
+        enum x25519 {
+          value 12;
+          description
+            "The asymmetric algorithm using a x.25519 Curve.";
+          reference
+            "RFC 7748:
+               Elliptic Curves for Security.";
+        }
+        enum x448 {
+          value 13;
+          description
+            "The asymmetric algorithm using a x.448 Curve.";
+          reference
+            "RFC 7748:
+               Elliptic Curves for Security.";
+        }
+      }
+    }
+    default "0";
+    description
+      "The uint16 filed shall be set by individual protocol
+       families according to the asymmetric key algorithm value
+       assigned by IANA. The setting is optional and by default
+       is 0.  The enumeration filed is set to the selected
+       asymmetric key algorithm.";
+  }
+
+  /*************************************/
+  /*   Identities for MAC Algorithms   */
+  /*************************************/
+
+  typedef mac-algorithm-t {
+    type union {
+      type uint16;
+      type enumeration {
+        enum NONE {
+          value 0;
+          description
+            "mac algorithm is NULL.";
+        }
+        enum hmac-sha1 {
+          value 1;
+          description
+            "Generating MAC using SHA1 hash function";
+          reference
+            "RFC 3174: US Secure Hash Algorithm 1 (SHA1)";
+        }
+        enum hmac-sha1-96 {
+          value 2;
+          description
+            "Generating MAC using SHA1 hash function";
+          reference
+            "RFC 2404: The Use of HMAC-SHA-1-96 within ESP and AH";
+        }
+        enum hmac-sha2-224 {
+          value 3;
+          description
+            "Generating MAC using SHA2 hash function";
+          reference
+            "RFC 6234: US Secure Hash Algorithms
+             (SHA and SHA-based HMAC and HKDF)";
+        }
+        enum hmac-sha2-256 {
+          value 4;
+          description
+            "Generating MAC using SHA2 hash function";
+          reference
+            "RFC 6234: US Secure Hash Algorithms
+             (SHA and SHA-based HMAC and HKDF)";
+        }
+        enum hmac-sha2-256-128 {
+          value 5;
+          description
+            "Generating a 256 bits MAC using SHA2 hash function and
+             truncate it to 128 bits";
+          reference
+            "RFC 4868: Using HMAC-SHA-256, HMAC-SHA-384,
+             and HMAC-SHA-512 with IPsec";
+        }
+        enum hmac-sha2-384 {
+          value 6;
+          description
+            "Generating a 384 bits MAC using SHA2 hash function";
+          reference
+            "RFC 6234: US Secure Hash Algorithms
+             (SHA and SHA-based HMAC and HKDF)";
+        }
+        enum hmac-sha2-384-192 {
+          value 7;
+          description
+            "Generating a 384 bits MAC using SHA2 hash function and
+             truncate it to 192 bits";
+          reference
+            "RFC 4868: Using HMAC-SHA-256, HMAC-SHA-384,
+             and HMAC-SHA-512 with IPsec";
+        }
+        enum hmac-sha2-512 {
+          value 8;
+          description
+            "Generating a 512 bits MAC using SHA2 hash function";
+          reference
+            "RFC 6234: US Secure Hash Algorithms
+             (SHA and SHA-based HMAC and HKDF)";
+        }
+        enum hmac-sha2-512-256 {
+          value 9;
+          description
+            "Generating a 512 bits MAC using SHA2 hash function and
+             truncate it to 256 bits";
+          reference
+            "RFC 4868: Using HMAC-SHA-256, HMAC-SHA-384,
+             and HMAC-SHA-512 with IPsec";
+        }
+        enum aes-128-gmac {
+          value 10;
+          description
+            "Generating 128-bit MAC using the Advanced Encryption
+             Standard (AES) Galois Message Authentication Code
+             (GMAC) as a mechanism to provide data origin
+             authentication.";
+          reference
+            "RFC 4543:
+               The Use of Galois Message Authentication Code (GMAC)
+               in IPsec ESP and AH";
+        }
+        enum aes-192-gmac {
+          value 11;
+          description
+            "Generating 192-bit MAC using the Advanced Encryption
+             Standard (AES) Galois Message Authentication Code
+             (GMAC) as a mechanism to provide data origin
+             authentication.";
+          reference
+            "RFC 4543:
+               The Use of Galois Message Authentication Code (GMAC)
+               in IPsec ESP and AH";
+        }
+        enum aes-256-gmac {
+          value 12;
+          description
+            "Generating 256-bit MAC using the Advanced Encryption
+             Standard (AES) Galois Message Authentication Code
+             (GMAC) as a mechanism to provide data origin
+             authentication.";
+          reference
+            "RFC 4543:
+               The Use of Galois Message Authentication Code (GMAC)
+               in IPsec ESP and AH";
+        }
+        enum aes-cmac-96 {
+          value 13;
+          description
+            "Generating 96-bit MAC using Advanced Encryption
+             Standard (AES) Cipher-based Message Authentication
+             Code (CMAC)";
+          reference
+            "RFC 4494:
+               The AES-CMAC Algorithm and its Use with IPsec";
+        }
+        enum aes-cmac-128 {
+          value 14;
+          description
+            "Generating 128-bit MAC using Advanced Encryption
+             Standard (AES) Cipher-based Message Authentication
+             Code (CMAC)";
+          reference
+            "RFC 4494:
+               The AES-CMAC Algorithm and its Use with IPsec";
+        }
+        enum sha1-des3-kd {
+          value 15;
+          description
+            "Generating MAC using triple DES encryption function";
+          reference
+            "RFC 3961:
+               Encryption and Checksum Specifications for Kerberos
+               5";
+        }
+      }
+    }
+    default "0";
+    description
+      "The uint16 filed shall be set by individual protocol
+       families according to the mac algorithm value assigned by
+       IANA. The setting is optional and by default is 0.  The
+       enumeration filed is set to the selected mac algorithm.";
+  }
+
+  /********************************************/
+  /*   Identities for Encryption Algorithms   */
+  /********************************************/
+
+  typedef encryption-algorithm-t {
+    type union {
+      type uint16;
+      type enumeration {
+        enum NONE {
+          value 0;
+          description
+            "Encryption algorithm is NULL.";
+        }
+        enum aes-128-cbc {
+          value 1;
+          description
+            "Encrypt message with AES algorithm in CBC mode with
+             a key length of 128 bits.";
+          reference
+            "RFC 3565: Use of the Advanced Encryption Standard (AES)
+             Encryption Algorithm in Cryptographic Message Syntax
+             (CMS)";
+        }
+        enum aes-192-cbc {
+          value 2;
+          description
+            "Encrypt message with AES algorithm in CBC mode with
+             a key length of 192 bits";
+          reference
+            "RFC 3565: Use of the Advanced Encryption Standard (AES)
+             Encryption Algorithm in Cryptographic Message Syntax
+             (CMS)";
+        }
+        enum aes-256-cbc {
+          value 3;
+          description
+            "Encrypt message with AES algorithm in CBC mode with
+             a key length of 256 bits";
+          reference
+            "RFC 3565: Use of the Advanced Encryption Standard (AES)
+             Encryption Algorithm in Cryptographic Message Syntax
+             (CMS)";
+        }
+        enum aes-128-ctr {
+          value 4;
+          description
+            "Encrypt message with AES algorithm in CTR mode with
+             a key length of 128 bits";
+          reference
+            "RFC 3686:
+               Using Advanced Encryption Standard (AES) Counter
+               Mode with IPsec Encapsulating Security Payload
+               (ESP)";
+        }
+        enum aes-192-ctr {
+          value 5;
+          description
+            "Encrypt message with AES algorithm in CTR mode with
+             a key length of 192 bits";
+          reference
+            "RFC 3686:
+               Using Advanced Encryption Standard (AES) Counter
+               Mode with IPsec Encapsulating Security Payload
+               (ESP)";
+        }
+        enum aes-256-ctr {
+          value 6;
+          description
+            "Encrypt message with AES algorithm in CTR mode with
+             a key length of 256 bits";
+          reference
+            "RFC 3686:
+               Using Advanced Encryption Standard (AES) Counter
+               Mode with IPsec Encapsulating Security Payload
+               (ESP)";
+        }
+        enum des3-cbc-sha1-kd {
+          value 7;
+          description
+            "Encrypt message with 3DES algorithm in CBC mode
+             with sha1 function for key derivation";
+          reference
+            "RFC 3961:
+               Encryption and Checksum Specifications for
+               Kerberos 5";
+        }
+        enum rc4-hmac {
+          value 8;
+          description
+            "Encrypt message with rc4 algorithm";
+          reference
+            "RFC 4757:
+               The RC4-HMAC Kerberos Encryption Types Used by
+               Microsoft Windows";
+        }
+        enum rc4-hmac-exp {
+          value 9;
+          description
+            "Encrypt message with rc4 algorithm that is exportable";
+          reference
+            "RFC 4757:
+               The RC4-HMAC Kerberos Encryption Types Used by
+               Microsoft Windows";
+        }
+      }
+    }
+    default "0";
+    description
+      "The uint16 filed shall be set by individual protocol
+       families according to the encryption algorithm value
+       assigned by IANA. The setting is optional and by default
+       is 0.  The enumeration filed is set to the selected
+       encryption algorithm.";
+  }
+
+  /****************************************************/
+  /*   Identities for Encryption and MAC Algorithms   */
+  /****************************************************/
+
+  typedef encryption-and-mac-algorithm-t {
+    type union {
+      type uint16;
+      type enumeration {
+        enum NONE {
+          value 0;
+          description
+            "Encryption and MAC algorithm is NULL.";
+          reference
+            "None";
+        }
+        enum aes-128-ccm {
+          value 1;
+          description
+            "Encrypt message with AES algorithm in CCM
+             mode with a key length of 128 bits; it can
+             also be used for generating MAC";
+          reference
+            "RFC 4309: Using Advanced Encryption Standard
+             (AES) CCM Mode with IPsec Encapsulating Security
+             Payload (ESP)";
+        }
+        enum aes-192-ccm {
+          value 2;
+          description
+            "Encrypt message with AES algorithm in CCM
+             mode with a key length of 192 bits; it can
+             also be used for generating MAC";
+          reference
+            "RFC 4309: Using Advanced Encryption Standard
+             (AES) CCM Mode with IPsec Encapsulating Security
+             Payload (ESP)";
+        }
+        enum aes-256-ccm {
+          value 3;
+          description
+            "Encrypt message with AES algorithm in CCM
+             mode with a key length of 256 bits; it can
+             also be used for generating MAC";
+          reference
+            "RFC 4309: Using Advanced Encryption Standard
+             (AES) CCM Mode with IPsec Encapsulating Security
+             Payload (ESP)";
+        }
+        enum aes-128-gcm {
+          value 4;
+          description
+            "Encrypt message with AES algorithm in GCM
+             mode with a key length of 128 bits; it can
+             also be used for generating MAC";
+          reference
+            "RFC 4106: The Use of Galois/Counter Mode (GCM)
+             in IPsec Encapsulating Security Payload (ESP)";
+        }
+        enum aes-192-gcm {
+          value 5;
+          description
+            "Encrypt message with AES algorithm in GCM
+             mode with a key length of 192 bits; it can
+             also be used for generating MAC";
+          reference
+            "RFC 4106: The Use of Galois/Counter Mode (GCM)
+             in IPsec Encapsulating Security Payload (ESP)";
+        }
+        enum aes-256-gcm {
+          value 6;
+          description
+            "Encrypt message with AES algorithm in GCM
+             mode with a key length of 256 bits; it can
+             also be used for generating MAC";
+          reference
+            "RFC 4106: The Use of Galois/Counter Mode (GCM)
+             in IPsec Encapsulating Security Payload (ESP)";
+        }
+        enum chacha20-poly1305 {
+          value 7;
+          description
+            "Encrypt message with chacha20 algorithm and generate
+             MAC with POLY1305; it can also be used for generating
+             MAC";
+          reference
+            "RFC 8439: ChaCha20 and Poly1305 for IETF Protocols";
+        }
+      }
+    }
+    default "0";
+    description
+      "The uint16 filed shall be set by individual protocol
+       families according to the encryption and mac algorithm value
+       assigned by IANA. The setting is optional and by default is
+       0.  The enumeration filed is set to the selected encryption
+       and mac algorithm.";
+  }
+
+  /******************************************/
+  /*   Identities for signature algorithm   */
+  /******************************************/
+
+  typedef signature-algorithm-t {
+    type union {
+      type uint16;
+      type enumeration {
+        enum NONE {
+          value 0;
+          description
+            "Signature algorithm is NULL";
+        }
+        enum dsa-sha1 {
+          value 1;
+          description
+            "The signature algorithm using DSA algorithm with SHA1
+             hash algorithm";
+          reference
+            "RFC 4253:
+               The Secure Shell (SSH) Transport Layer Protocol";
+        }
+        enum rsassa-pkcs1-sha1 {
+          value 2;
+          description
+            "The signature algorithm using RSASSA-PKCS1-v1_5 with
+             the SHA1 hash algorithm.";
+          reference
+            "RFC 4253:
+               The Secure Shell (SSH) Transport Layer Protocol";
+        }
+        enum rsassa-pkcs1-sha256 {
+          value 3;
+          description
+            "The signature algorithm using RSASSA-PKCS1-v1_5 with
+             the SHA256 hash algorithm.";
+          reference
+            "RFC 8332:
+               Use of RSA Keys with SHA-256 and SHA-512 in the
+               Secure Shell (SSH) Protocol
+             RFC 8446:
+               The Transport Layer Security (TLS) Protocol
+               Version 1.3";
+        }
+        enum rsassa-pkcs1-sha384 {
+          value 4;
+          description
+            "The signature algorithm using RSASSA-PKCS1-v1_5 with
+             the SHA384 hash algorithm.";
+          reference
+            "RFC 8446:
+               The Transport Layer Security (TLS) Protocol
+               Version 1.3";
+        }
+        enum rsassa-pkcs1-sha512 {
+          value 5;
+          description
+            "The signature algorithm using RSASSA-PKCS1-v1_5 with
+             the SHA512 hash algorithm.";
+          reference
+            "RFC 8332:
+               Use of RSA Keys with SHA-256 and SHA-512 in the
+               Secure Shell (SSH) Protocol
+             RFC 8446:
+               The Transport Layer Security (TLS) Protocol
+               Version 1.3";
+        }
+        enum rsassa-pss-rsae-sha256 {
+          value 6;
+          description
+            "The signature algorithm using RSASSA-PSS with mask
+             generation function 1 and SHA256 hash algorithm. If
+             the public key is carried in an X.509 certificate,
+             it MUST use the rsaEncryption OID";
+          reference
+            "RFC 8446:
+               The Transport Layer Security (TLS) Protocol
+               Version 1.3";
+        }
+        enum rsassa-pss-rsae-sha384 {
+          value 7;
+          description
+            "The signature algorithm using RSASSA-PSS with mask
+             generation function 1 and SHA384 hash algorithm. If
+             the public key is carried in an X.509 certificate,
+             it MUST use the rsaEncryption OID";
+          reference
+            "RFC 8446:
+               The Transport Layer Security (TLS) Protocol
+               Version 1.3";
+        }
+        enum rsassa-pss-rsae-sha512 {
+          value 8;
+          description
+            "The signature algorithm using RSASSA-PSS with mask
+             generation function 1 and SHA512 hash algorithm. If
+             the public key is carried in an X.509 certificate,
+             it MUST use the rsaEncryption OID";
+          reference
+            "RFC 8446:
+               The Transport Layer Security (TLS) Protocol
+               Version 1.3";
+        }
+        enum rsassa-pss-pss-sha256 {
+          value 9;
+          description
+            "The signature algorithm using RSASSA-PSS with mask
+             generation function 1 and SHA256 hash algorithm. If
+             the public key is carried in an X.509 certificate,
+             it MUST use the rsaEncryption OID";
+          reference
+            "RFC 8446:
+               The Transport Layer Security (TLS) Protocol
+               Version 1.3";
+        }
+        enum rsassa-pss-pss-sha384 {
+          value 10;
+          description
+            "The signature algorithm using RSASSA-PSS with mask
+             generation function 1 and SHA384 hash algorithm. If
+             the public key is carried in an X.509 certificate,
+             it MUST use the rsaEncryption OID";
+          reference
+            "RFC 8446:
+               The Transport Layer Security (TLS) Protocol
+               Version 1.3";
+        }
+        enum rsassa-pss-pss-sha512 {
+          value 11;
+          description
+            "The signature algorithm using RSASSA-PSS with mask
+             generation function 1 and SHA512 hash algorithm. If
+             the public key is carried in an X.509 certificate,
+             it MUST use the rsaEncryption OID";
+          reference
+            "RFC 8446:
+               The Transport Layer Security (TLS) Protocol
+               Version 1.3";
+        }
+        enum ecdsa-secp256r1-sha256 {
+          value 12;
+          description
+            "The signature algorithm using ECDSA with curve name
+             secp256r1 and SHA256 hash algorithm.";
+          reference
+            "RFC 5656:
+               Elliptic Curve Algorithm Integration in the Secure
+               Shell Transport Layer
+             RFC 8446:
+               The Transport Layer Security (TLS) Protocol
+               Version 1.3";
+        }
+        enum ecdsa-secp384r1-sha384 {
+          value 13;
+          description
+            "The signature algorithm using ECDSA with curve name
+             secp384r1 and SHA384 hash algorithm.";
+          reference
+            "RFC 5656:
+               Elliptic Curve Algorithm Integration in the Secure
+               Shell Transport Layer
+             RFC 8446:
+               The Transport Layer Security (TLS) Protocol
+               Version 1.3";
+        }
+        enum ecdsa-secp521r1-sha512 {
+          value 14;
+          description
+            "The signature algorithm using ECDSA with curve name
+             secp521r1 and SHA512 hash algorithm.";
+          reference
+            "RFC 5656:
+               Elliptic Curve Algorithm Integration in the Secure
+               Shell Transport Layer
+             RFC 8446:
+               The Transport Layer Security (TLS) Protocol
+               Version 1.3";
+        }
+        enum ed25519 {
+          value 15;
+          description
+            "The signature algorithm using EdDSA with curve x25519";
+          reference
+            "RFC 8032:
+               Edwards-Curve Digital Signature Algorithm (EdDSA)";
+        }
+        enum ed25519-cts {
+          value 16;
+          description
+            "The signature algorithm using EdDSA with curve x25519
+             with phflag = 0";
+          reference
+            "RFC 8032:
+               Edwards-Curve Digital Signature Algorithm (EdDSA)";
+        }
+        enum ed25519-ph {
+          value 17;
+          description
+            "The signature algorithm using EdDSA with curve x25519
+             with phflag = 1";
+          reference
+            "RFC 8032:
+               Edwards-Curve Digital Signature Algorithm (EdDSA)";
+        }
+        enum ed25519-sha512 {
+          value 18;
+          description
+            "The signature algorithm using EdDSA with curve x25519
+            and SHA-512 function";
+          reference
+            "RFC 8419:
+               Use of Edwards-Curve Digital Signature Algorithm
+               (EdDSA) Signatures in the Cryptographic Message
+               Syntax (CMS)";
+        }
+        enum ed448 {
+          value 19;
+          description
+            "The signature algorithm using EdDSA with curve x448";
+          reference
+            "RFC 8032:
+               Edwards-Curve Digital Signature Algorithm (EdDSA)";
+        }
+        enum ed448-ph {
+          value 20;
+          description
+            "The signature algorithm using EdDSA with curve x448
+             and with PH being SHAKE256(x, 64) and phflag being 1";
+          reference
+            "RFC 8032:
+               Edwards-Curve Digital Signature Algorithm (EdDSA)";
+        }
+        enum ed448-shake256 {
+          value 21;
+          description
+            "The signature algorithm using EdDSA with curve x448
+            and SHAKE-256 function";
+          reference
+            "RFC 8419:
+               Use of Edwards-Curve Digital Signature Algorithm
+               (EdDSA) Signatures in the Cryptographic Message
+               Syntax (CMS)";
+        }
+        enum ed448-shake256-len {
+          value 22;
+          description
+            "The signature algorithm using EdDSA with curve x448
+            and SHAKE-256 function and a customized hash output";
+          reference
+            "RFC 8419:
+               Use of Edwards-Curve Digital Signature Algorithm
+               (EdDSA) Signatures in the Cryptographic Message
+               Syntax (CMS)";
+        }
+        enum rsa-sha2-256 {
+          value 23;
+          description
+            "The signature algorithm using RSA with SHA2 function
+             for SSH protocol";
+          reference
+            "RFC 8332:
+             Use of RSA Keys with SHA-256 and SHA-512
+             in the Secure Shell (SSH) Protocol";
+        }
+        enum rsa-sha2-512 {
+          value 24;
+          description
+            "The signature algorithm using RSA with SHA2 function
+             for SSH protocol";
+          reference
+            "RFC 8332:
+             Use of RSA Keys with SHA-256 and SHA-512
+             in the Secure Shell (SSH) Protocol";
+        }
+        enum eccsi {
+          value 25;
+          description
+            "The signature algorithm using ECCSI signature as
+             defined in RFC 6507.";
+          reference
+            "RFC 6507:
+               Elliptic Curve-Based Certificateless Signatures
+               for Identity-based Encryption (ECCSI)";
+        }
+      }
+    }
+    default "0";
+    description
+      "The uint16 filed shall be set by individual protocol
+       families according to the signature algorithm value
+       assigned by IANA. The setting is optional and by default
+       is 0.  The enumeration filed is set to the selected
+       signature algorithm.";
+  }
+
+  /**********************************************/
+  /*   Identities for key exchange algorithms   */
+  /**********************************************/
+
+  typedef key-exchange-algorithm-t {
+    type union {
+      type uint16;
+      type enumeration {
+        enum NONE {
+          value 0;
+          description
+            "Key exchange algorithm is NULL.";
+        }
+        enum psk-only {
+          value 1;
+          description
+            "Using Pre-shared key for authentication and key
+             exchange";
+          reference
+            "RFC 4279:
+               Pre-Shared Key cipher suites for Transport Layer
+               Security (TLS)";
+        }
+        enum dhe-ffdhe2048 {
+          value 2;
+          description
+            "Ephemeral Diffie Hellman key exchange with 2048 bit
+             finite field";
+          reference
+            "RFC 7919:
+               Negotiated Finite Field Diffie-Hellman Ephemeral
+               Parameters for Transport Layer Security (TLS)";
+        }
+        enum dhe-ffdhe3072 {
+          value 3;
+          description
+            "Ephemeral Diffie Hellman key exchange with 3072 bit
+             finite field";
+          reference
+            "RFC 7919:
+               Negotiated Finite Field Diffie-Hellman Ephemeral
+               Parameters for Transport Layer Security (TLS)";
+        }
+        enum dhe-ffdhe4096 {
+          value 4;
+          description
+            "Ephemeral Diffie Hellman key exchange with 4096 bit
+             finite field";
+          reference
+            "RFC 7919:
+               Negotiated Finite Field Diffie-Hellman Ephemeral
+               Parameters for Transport Layer Security (TLS)";
+        }
+        enum dhe-ffdhe6144 {
+          value 5;
+          description
+            "Ephemeral Diffie Hellman key exchange with 6144 bit
+             finite field";
+          reference
+            "RFC 7919:
+               Negotiated Finite Field Diffie-Hellman Ephemeral
+               Parameters for Transport Layer Security (TLS)";
+        }
+        enum dhe-ffdhe8192 {
+          value 6;
+          description
+            "Ephemeral Diffie Hellman key exchange with 8192 bit
+             finite field";
+          reference
+            "RFC 7919:
+               Negotiated Finite Field Diffie-Hellman Ephemeral
+               Parameters for Transport Layer Security (TLS)";
+        }
+        enum psk-dhe-ffdhe2048 {
+          value 7;
+          description
+            "Key exchange using pre-shared key with Diffie-Hellman
+             key generation mechanism, where the DH group is
+             FFDHE2048";
+          reference
+            "RFC 8446:
+               The Transport Layer Security (TLS) Protocol
+               Version 1.3";
+        }
+        enum psk-dhe-ffdhe3072 {
+          value 8;
+          description
+            "Key exchange using pre-shared key with Diffie-Hellman
+             key generation mechanism, where the DH group is
+             FFDHE3072";
+          reference
+            "RFC 8446:
+               The Transport Layer Security (TLS) Protocol
+               Version 1.3";
+        }
+        enum psk-dhe-ffdhe4096 {
+          value 9;
+          description
+            "Key exchange using pre-shared key with Diffie-Hellman
+             key generation mechanism, where the DH group is
+             FFDHE4096";
+          reference
+            "RFC 8446:
+               The Transport Layer Security (TLS) Protocol
+               Version 1.3";
+        }
+        enum psk-dhe-ffdhe6144 {
+          value 10;
+          description
+            "Key exchange using pre-shared key with Diffie-Hellman
+             key generation mechanism, where the DH group is
+             FFDHE6144";
+          reference
+            "RFC 8446:
+               The Transport Layer Security (TLS) Protocol
+               Version 1.3";
+        }
+        enum psk-dhe-ffdhe8192 {
+          value 11;
+          description
+            "Key exchange using pre-shared key with Diffie-Hellman
+             key generation mechanism, where the DH group is
+             FFDHE8192";
+          reference
+            "RFC 8446:
+               The Transport Layer Security (TLS) Protocol
+               Version 1.3";
+        }
+        enum ecdhe-secp256r1 {
+          value 12;
+          description
+            "Ephemeral Diffie Hellman key exchange with elliptic
+             group over curve secp256r1";
+          reference
+            "RFC 8422:
+               Elliptic Curve Cryptography (ECC) Cipher Suites
+               for Transport Layer Security (TLS) Versions 1.2
+               and Earlier";
+        }
+        enum ecdhe-secp384r1 {
+          value 13;
+          description
+            "Ephemeral Diffie Hellman key exchange with elliptic
+             group over curve secp384r1";
+          reference
+            "RFC 8422:
+               Elliptic Curve Cryptography (ECC) Cipher Suites
+               for Transport Layer Security (TLS) Versions 1.2
+               and Earlier";
+        }
+        enum ecdhe-secp521r1 {
+          value 14;
+          description
+            "Ephemeral Diffie Hellman key exchange with elliptic
+             group over curve secp521r1";
+          reference
+            "RFC 8422:
+               Elliptic Curve Cryptography (ECC) Cipher Suites
+               for Transport Layer Security (TLS) Versions 1.2
+               and Earlier";
+        }
+        enum ecdhe-x25519 {
+          value 15;
+          description
+            "Ephemeral Diffie Hellman key exchange with elliptic
+             group over curve x25519";
+          reference
+            "RFC 8422:
+               Elliptic Curve Cryptography (ECC) Cipher Suites
+               for Transport Layer Security (TLS) Versions 1.2
+               and Earlier";
+        }
+        enum ecdhe-x448 {
+          value 16;
+          description
+            "Ephemeral Diffie Hellman key exchange with elliptic
+             group over curve x448";
+          reference
+            "RFC 8422:
+               Elliptic Curve Cryptography (ECC) Cipher Suites
+               for Transport Layer Security (TLS) Versions 1.2
+               and Earlier";
+        }
+        enum psk-ecdhe-secp256r1 {
+          value 17;
+          description
+            "Key exchange using pre-shared key with elliptic
+             group-based Ephemeral Diffie Hellman key exchange
+             over curve secp256r1";
+          reference
+            "RFC 8446:
+               The Transport Layer Security (TLS) Protocol
+               Version 1.3";
+        }
+        enum psk-ecdhe-secp384r1 {
+          value 18;
+          description
+            "Key exchange using pre-shared key with elliptic
+             group-based Ephemeral Diffie Hellman key exchange
+             over curve secp384r1";
+          reference
+            "RFC 8446:
+               The Transport Layer Security (TLS) Protocol
+               Version 1.3";
+        }
+        enum psk-ecdhe-secp521r1 {
+          value 19;
+          description
+            "Key exchange using pre-shared key with elliptic
+             group-based Ephemeral Diffie Hellman key exchange
+             over curve secp521r1";
+          reference
+            "RFC 8446:
+               The Transport Layer Security (TLS) Protocol
+               Version 1.3";
+        }
+        enum psk-ecdhe-x25519 {
+          value 20;
+          description
+            "Key exchange using pre-shared key with elliptic
+             group-based Ephemeral Diffie Hellman key exchange
+             over curve x25519";
+          reference
+            "RFC 8446:
+               The Transport Layer Security (TLS) Protocol
+               Version 1.3";
+        }
+        enum psk-ecdhe-x448 {
+          value 21;
+          description
+            "Key exchange using pre-shared key with elliptic
+             group-based Ephemeral Diffie Hellman key exchange
+             over curve x448";
+          reference
+            "RFC 8446:
+               The Transport Layer Security (TLS) Protocol
+               Version 1.3";
+        }
+        enum diffie-hellman-group14-sha1 {
+          value 22;
+          description
+            "Using DH group14 and SHA1 for key exchange";
+          reference
+            "RFC 4253:
+               The Secure Shell (SSH) Transport Layer Protocol";
+        }
+        enum diffie-hellman-group14-sha256 {
+          value 23;
+          description
+            "Using DH group14 and SHA-256 for key exchange";
+          reference
+            "RFC 8268:
+              More Modular Exponentiation (MODP) Diffie-Hellman (DH)
+              Key Exchange (KEX) Groups for Secure Shell (SSH)";
+        }
+        enum diffie-hellman-group15-sha512 {
+          value 24;
+          description
+            "Using DH group15 and SHA-512 for key exchange";
+          reference
+            "RFC 8268:
+              More Modular Exponentiation (MODP) Diffie-Hellman (DH)
+              Key Exchange (KEX) Groups for Secure Shell (SSH)";
+        }
+        enum diffie-hellman-group16-sha512 {
+          value 25;
+          description
+            "Using DH group16 and SHA-512 for key exchange";
+          reference
+            "RFC 8268:
+              More Modular Exponentiation (MODP) Diffie-Hellman (DH)
+              Key Exchange (KEX) Groups for Secure Shell (SSH)";
+        }
+        enum diffie-hellman-group17-sha512 {
+          value 26;
+          description
+            "Using DH group17 and SHA-512 for key exchange";
+          reference
+            "RFC 8268:
+              More Modular Exponentiation (MODP) Diffie-Hellman (DH)
+              Key Exchange (KEX) Groups for Secure Shell (SSH)";
+        }
+        enum diffie-hellman-group18-sha512 {
+          value 27;
+          description
+            "Using DH group18 and SHA-512 for key exchange";
+          reference
+            "RFC 8268:
+              More Modular Exponentiation (MODP) Diffie-Hellman (DH)
+              Key Exchange (KEX) Groups for Secure Shell (SSH)";
+        }
+        enum ecdh-sha2-secp256r1 {
+          value 28;
+          description
+            "Elliptic curve-based Diffie Hellman key exchange over
+             curve ecp256r1 and using SHA2 for MAC generation";
+          reference
+            "RFC 6239:
+               Suite B Cryptographic Suites for Secure Shell (SSH)";
+        }
+        enum ecdh-sha2-secp384r1 {
+          value 29;
+          description
+            "Elliptic curve-based Diffie Hellman key exchange over
+             curve ecp384r1 and using SHA2 for MAC generation";
+          reference
+            "RFC 6239:
+               Suite B Cryptographic Suites for Secure Shell (SSH)";
+        }
+        enum ecdh-x25519-x9.63-sha256 {
+          value 30;
+          description
+            "Elliptic curve-based Diffie Hellman key exchange over
+             curve x.25519 and using ANSI x9.63 with SHA256 as KDF";
+          reference
+            "RFC 8418:
+               Use of the Elliptic Curve Diffie-Hellman Key Agreement
+               Algorithm with X25519 and X448 in the Cryptographic
+               Message Syntax (CMS)";
+        }
+        enum ecdh-x25519-x9.63-sha384 {
+          value 31;
+          description
+            "Elliptic curve-based Diffie Hellman key exchange over
+             curve x.25519 and using ANSI x9.63 with SHA384 as KDF";
+          reference
+            "RFC 8418:
+               Use of the Elliptic Curve Diffie-Hellman Key Agreement
+               Algorithm with X25519 and X448 in the Cryptographic
+               Message Syntax (CMS)";
+        }
+        enum ecdh-x25519-x9.63-sha512 {
+          value 32;
+          description
+            "Elliptic curve-based Diffie Hellman key exchange over
+             curve x.25519 and using ANSI x9.63 with SHA512 as KDF";
+          reference
+            "RFC 8418:
+               Use of the Elliptic Curve Diffie-Hellman Key Agreement
+               Algorithm with X25519 and X448 in the Cryptographic
+               Message Syntax (CMS)";
+        }
+        enum ecdh-x25519-hkdf-sha256 {
+          value 33;
+          description
+            "Elliptic curve-based Diffie Hellman key exchange over
+             curve x.25519 and using HKDF with SHA256 as KDF";
+          reference
+            "RFC 8418:
+               Use of the Elliptic Curve Diffie-Hellman Key Agreement
+               Algorithm with X25519 and X448 in the Cryptographic
+               Message Syntax (CMS)";
+        }
+        enum ecdh-x25519-hkdf-sha384 {
+          value 34;
+          description
+            "Elliptic curve-based Diffie Hellman key exchange over
+             curve x.25519 and using HKDF with SHA384 as KDF";
+          reference
+            "RFC 8418:
+               Use of the Elliptic Curve Diffie-Hellman Key Agreement
+               Algorithm with X25519 and X448 in the Cryptographic
+               Message Syntax (CMS)";
+        }
+        enum ecdh-x25519-hkdf-sha512 {
+          value 35;
+          description
+            "Elliptic curve-based Diffie Hellman key exchange over
+             curve x.25519 and using HKDF with SHA512 as KDF";
+          reference
+            "RFC 8418:
+               Use of the Elliptic Curve Diffie-Hellman Key Agreement
+               Algorithm with X25519 and X448 in the Cryptographic
+               Message Syntax (CMS)";
+        }
+        enum ecdh-x448-x9.63-sha256 {
+          value 36;
+          description
+            "Elliptic curve-based Diffie Hellman key exchange over
+             curve x.448 and using ANSI x9.63 with SHA256 as KDF";
+          reference
+            "RFC 8418:
+               Use of the Elliptic Curve Diffie-Hellman Key Agreement
+               Algorithm with X25519 and X448 in the Cryptographic
+               Message Syntax (CMS)";
+        }
+        enum ecdh-x448-x9.63-sha384 {
+          value 37;
+          description
+            "Elliptic curve-based Diffie Hellman key exchange over
+             curve x.448 and using ANSI x9.63 with SHA384 as KDF";
+          reference
+            "RFC 8418:
+               Use of the Elliptic Curve Diffie-Hellman Key Agreement
+               Algorithm with X25519 and X448 in the Cryptographic
+               Message Syntax (CMS)";
+        }
+        enum ecdh-x448-x9.63-sha512 {
+          value 38;
+          description
+            "Elliptic curve-based Diffie Hellman key exchange over
+             curve x.448 and using ANSI x9.63 with SHA512 as KDF";
+          reference
+            "RFC 8418:
+               Use of the Elliptic Curve Diffie-Hellman Key Agreement
+               Algorithm with X25519 and X448 in the Cryptographic
+               Message Syntax (CMS)";
+        }
+        enum ecdh-x448-hkdf-sha256 {
+          value 39;
+          description
+            "Elliptic curve-based Diffie Hellman key exchange over
+             curve x.448 and using HKDF with SHA256 as KDF";
+          reference
+            "RFC 8418:
+               Use of the Elliptic Curve Diffie-Hellman Key Agreement
+               Algorithm with X25519 and X448 in the Cryptographic
+               Message Syntax (CMS)";
+        }
+        enum ecdh-x448-hkdf-sha384 {
+          value 40;
+          description
+            "Elliptic curve-based Diffie Hellman key exchange over
+             curve x.448 and using HKDF with SHA384 as KDF";
+          reference
+            "RFC 8418:
+               Use of the Elliptic Curve Diffie-Hellman Key Agreement
+               Algorithm with X25519 and X448 in the Cryptographic
+               Message Syntax (CMS)";
+        }
+        enum ecdh-x448-hkdf-sha512 {
+          value 41;
+          description
+            "Elliptic curve-based Diffie Hellman key exchange over
+             curve x.448 and using HKDF with SHA512 as KDF";
+          reference
+            "RFC 8418:
+               Use of the Elliptic Curve Diffie-Hellman Key Agreement
+               Algorithm with X25519 and X448 in the Cryptographic
+               Message Syntax (CMS)";
+        }
+
+        enum rsaes-oaep {
+          value 42;
+          description
+            "RSAES-OAEP combines the RSAEP and RSADP primitives with
+             the EME-OAEP encoding method";
+          reference
+            "RFC 8017:
+               PKCS #1:
+                 RSA Cryptography Specifications Version 2.2.";
+        }
+        enum rsaes-pkcs1-v1_5 {
+          value 43;
+          description
+            "RSAES-PKCS1-v1_5 combines the RSAEP and RSADP
+             primitives with the EME-PKCS1-v1_5 encoding method";
+          reference
+            "RFC 8017:
+               PKCS #1:
+                 RSA Cryptography Specifications Version 2.2.";
+        }
+      }
+    }
+    default "0";
+    description
+      "The uint16 filed shall be set by individual protocol
+       families according to the key exchange algorithm value
+       assigned by IANA. The setting is optional and by default
+       is 0.  The enumeration filed is set to the selected key
+       exchange algorithm.";
+  }
+
+  /********************************************/
+  /*   Identities for Key Format Structures   */
+  /********************************************/
+
+  /*** all key format types ****/
+
+  identity key-format-base {
+    description "Base key-format identity for all keys.";
+  }
+
+  identity public-key-format {
+    base "key-format-base";
+    description "Base key-format identity for public keys.";
+  }
+
+  identity private-key-format {
+    base "key-format-base";
+    description "Base key-format identity for private keys.";
+  }
+
+  identity symmetric-key-format {
+    base "key-format-base";
+    description "Base key-format identity for symmetric keys.";
+  }
+
+  /**** for private keys ****/
+
+  identity rsa-private-key-format {
+      base "private-key-format";
+      description "An RSAPrivateKey (from RFC 3447).";
+  }
+
+  identity ec-private-key-format {
+      base "private-key-format";
+      description "An ECPrivateKey (from RFC 5915)";
+  }
+
+  identity one-asymmetric-key-format {
+      base "private-key-format";
+      description "A OneAsymmetricKey (from RFC 5958).";
+  }
+
+  identity encrypted-private-key-format {
+      base "private-key-format";
+      description
+        "A CMS EncryptedData structure (RFC 5652)
+         containing a OneAsymmetricKey (RFC 5958).";
+   }
+
+  /**** for public keys ****/
+
+  identity ssh-public-key-format {
+      base "public-key-format";
+      description
+        "The public key format described by RFC 4716.";
+  }
+
+  identity subject-public-key-info-format {
+      base "public-key-format";
+      description
+        "A SubjectPublicKeyInfo (from RFC 5280).";
+  }
+
+  /**** for symmetric keys ****/
+
+  identity octet-string-key-format {
+      base "symmetric-key-format";
+      description "An OctetString from ASN.1.";
+        /*
+        // Knowing that it is an "OctetString" isn't really helpful.
+        // Knowing the length of the octet string would be helpful,
+        // as it relates to the algorithm's block size.  We may want
+        // to only (for now) use "one-symmetric-key-format" for
+        // symmetric keys...were the usability issues Juergen
+        // mentioned before only apply to asymmetric keys?
+        */
+  }
+
+  identity one-symmetric-key-format {
+      base "symmetric-key-format";
+      description "A OneSymmetricKey (from RFC6031).";
+  }
+
+  identity encrypted-symmetric-key-format {
+      base "symmetric-key-format";
+      description
+        "A CMS EncryptedData structure (RFC 5652)
+         containing a OneSymmetricKey (RFC 6031).";
+  }
+
+  /***************************************************/
+  /*   Typedefs for ASN.1 structures from RFC 5280   */
+  /***************************************************/
+
+  typedef x509 {
+    type binary;
+    description
+      "A Certificate structure, as specified in RFC 5280,
+       encoded using ASN.1 distinguished encoding rules (DER),
+       as specified in ITU-T X.690.";
+    reference
+      "RFC 5280:
+         Internet X.509 Public Key Infrastructure Certificate
+         and Certificate Revocation List (CRL) Profile
+       ITU-T X.690:
+         Information technology - ASN.1 encoding rules:
+         Specification of Basic Encoding Rules (BER),
+         Canonical Encoding Rules (CER) and Distinguished
+         Encoding Rules (DER).";
+  }
+
+  typedef crl {
+    type binary;
+    description
+      "A CertificateList structure, as specified in RFC 5280,
+       encoded using ASN.1 distinguished encoding rules (DER),
+       as specified in ITU-T X.690.";
+    reference
+      "RFC 5280:
+         Internet X.509 Public Key Infrastructure Certificate
+         and Certificate Revocation List (CRL) Profile
+       ITU-T X.690:
+         Information technology - ASN.1 encoding rules:
+         Specification of Basic Encoding Rules (BER),
+         Canonical Encoding Rules (CER) and Distinguished
+         Encoding Rules (DER).";
+  }
+
+  /***********************************************/
+  /*   Typedefs for ASN.1 structures from 5652   */
+  /***********************************************/
+
+  typedef cms {
+    type binary;
+    description
+      "A ContentInfo structure, as specified in RFC 5652,
+       encoded using ASN.1 distinguished encoding rules (DER),
+       as specified in ITU-T X.690.";
+    reference
+      "RFC 5652:
+         Cryptographic Message Syntax (CMS)
+       ITU-T X.690:
+         Information technology - ASN.1 encoding rules:
+         Specification of Basic Encoding Rules (BER),
+         Canonical Encoding Rules (CER) and Distinguished
+         Encoding Rules (DER).";
+  }
+  typedef data-content-cms {
+    type cms;
+    description
+      "A CMS structure whose top-most content type MUST be the
+       data content type, as described by Section 4 in RFC 5652.";
+    reference
+      "RFC 5652: Cryptographic Message Syntax (CMS)";
+  }
+
+  typedef signed-data-cms {
+    type cms;
+    description
+      "A CMS structure whose top-most content type MUST be the
+       signed-data content type, as described by Section 5 in
+       RFC 5652.";
+    reference
+      "RFC 5652: Cryptographic Message Syntax (CMS)";
+  }
+
+  typedef enveloped-data-cms {
+    type cms;
+    description
+      "A CMS structure whose top-most content type MUST be the
+       enveloped-data content type, as described by Section 6
+       in RFC 5652.";
+    reference
+      "RFC 5652: Cryptographic Message Syntax (CMS)";
+  }
+
+  typedef digested-data-cms {
+    type cms;
+    description
+      "A CMS structure whose top-most content type MUST be the
+       digested-data content type, as described by Section 7
+       in RFC 5652.";
+    reference
+      "RFC 5652: Cryptographic Message Syntax (CMS)";
+  }
+
+  typedef encrypted-data-cms {
+    type cms;
+    description
+      "A CMS structure whose top-most content type MUST be the
+       encrypted-data content type, as described by Section 8
+       in RFC 5652.";
+    reference
+      "RFC 5652: Cryptographic Message Syntax (CMS)";
+  }
+  typedef authenticated-data-cms {
+    type cms;
+    description
+      "A CMS structure whose top-most content type MUST be the
+       authenticated-data content type, as described by Section 9
+       in RFC 5652.";
+    reference
+      "RFC 5652: Cryptographic Message Syntax (CMS)";
+  }
+
+  /***************************************************/
+  /*   Typedefs for structures related to RFC 4253   */
+  /***************************************************/
+
+  typedef ssh-host-key {
+    type binary;
+    description
+      "The binary public key data for this SSH key, as
+       specified by RFC 4253, Section 6.6, i.e.:
+
+         string    certificate or public key format
+                   identifier
+         byte[n]   key/certificate data.";
+    reference
+      "RFC 4253: The Secure Shell (SSH) Transport Layer
+                 Protocol";
+  }
+
+  /*********************************************************/
+  /*   Typedefs for ASN.1 structures related to RFC 5280   */
+  /*********************************************************/
+
+  typedef trust-anchor-cert-x509 {
+    type x509;
+    description
+      "A Certificate structure that MUST encode a self-signed
+       root certificate.";
+  }
+
+  typedef end-entity-cert-x509 {
+    type x509;
+    description
+      "A Certificate structure that MUST encode a certificate
+       that is neither self-signed nor having Basic constraint
+       CA true.";
+  }
+
+  /*********************************************************/
+  /*   Typedefs for ASN.1 structures related to RFC 5652   */
+  /*********************************************************/
+
+  typedef trust-anchor-cert-cms {
+    type signed-data-cms;
+    description
+      "A CMS SignedData structure that MUST contain the chain of
+       X.509 certificates needed to authenticate the certificate
+       presented by a client or end-entity.
+
+       The CMS MUST contain only a single chain of certificates.
+       The client or end-entity certificate MUST only authenticate
+       to last intermediate CA certificate listed in the chain.
+
+       In all cases, the chain MUST include a self-signed root
+       certificate.  In the case where the root certificate is
+       itself the issuer of the client or end-entity certificate,
+       only one certificate is present.
+
+       This CMS structure MAY (as applicable where this type is
+       used) also contain suitably fresh (as defined by local
+       policy) revocation objects with which the device can
+       verify the revocation status of the certificates.
+
+       This CMS encodes the degenerate form of the SignedData
+       structure that is commonly used to disseminate X.509
+       certificates and revocation objects (RFC 5280).";
+    reference
+      "RFC 5280:
+         Internet X.509 Public Key Infrastructure Certificate
+         and Certificate Revocation List (CRL) Profile.";
+  }
+
+  typedef end-entity-cert-cms {
+    type signed-data-cms;
+    description
+      "A CMS SignedData structure that MUST contain the end
+       entity certificate itself, and MAY contain any number
+       of intermediate certificates leading up to a trust
+       anchor certificate.  The trust anchor certificate
+       MAY be included as well.
+
+       The CMS MUST contain a single end entity certificate.
+       The CMS MUST NOT contain any spurious certificates.
+
+       This CMS structure MAY (as applicable where this type is
+       used) also contain suitably fresh (as defined by local
+       policy) revocation objects with which the device can
+       verify the revocation status of the certificates.
+
+       This CMS encodes the degenerate form of the SignedData
+       structure that is commonly used to disseminate X.509
+       certificates and revocation objects (RFC 5280).";
+    reference
+      "RFC 5280:
+         Internet X.509 Public Key Infrastructure Certificate
+         and Certificate Revocation List (CRL) Profile.";
+  }
+
+  typedef ssh-public-key-type {  // DELETE?
+     type binary;
+     description
+       "The binary public key data for this SSH key, as
+        specified by RFC 4253, Section 6.6, i.e.:
+
+          string    certificate or public key format
+                    identifier
+          byte[n]   key/certificate data.";
+     reference
+       "RFC 4253: The Secure Shell (SSH) Transport
+                  Layer Protocol";
+  }
+
+  /**********************************************/
+  /*   Groupings for keys and/or certificates   */
+  /**********************************************/
+
+  grouping symmetric-key-grouping {
+    description
+      "A symmetric key and algorithm.";
+    leaf algorithm {
+      type encryption-algorithm-t;
+      mandatory true;
+      description
+        "The algorithm to be used when generating the key.";
+      reference
+        "RFC CCCC: Common YANG Data Types for Cryptography";
+    }
+    leaf key-format {
+      nacm:default-deny-write;
+      when "../key";
+      type identityref {
+        base symmetric-key-format;
+      }
+      description "Identifies the symmetric key's format.";
+    }
+    choice key-type {
+      mandatory true;
+      description
+        "Choice between key types.";
+      leaf key {
+        nacm:default-deny-all;
+        type binary;
+        //must "../key-format";  FIXME: remove comment if approach ok
+        description
+          "The binary value of the key.  The interpretation of
+           the value is defined by 'key-format'.  For example,
+           FIXME.";
+        reference
+          "RFC XXXX: FIXME";
+      }
+      leaf hidden-key {
+        nacm:default-deny-write;
+        type empty;
+        description
+          "A permanently hidden key.  How such keys are created
+           is outside the scope of this module.";
+      }
+    }
+  }
+
+  grouping public-key-grouping {
+    description
+      "A public key and its associated algorithm.";
+    leaf algorithm {
+      nacm:default-deny-write;
+      type asymmetric-key-algorithm-t;
+      mandatory true;
+      description
+        "Identifies the key's algorithm.";
+      reference
+        "RFC CCCC: Common YANG Data Types for Cryptography";
+    }
+    leaf public-key-format {
+      nacm:default-deny-write;
+      when "../public-key";
+      type identityref {
+        base public-key-format;
+      }
+      description "Identifies the key's format.";
+    }
+    leaf public-key {
+      nacm:default-deny-write;
+      type binary;
+      //must "../public-key-format"; FIXME: rm comment if approach ok
+      mandatory true;
+      description
+        "The binary value of the public key.  The interpretation
+         of the value is defined by 'public-key-format' field.";
+    }
+  }
+
+  grouping asymmetric-key-pair-grouping {
+    description
+      "A private key and its associated public key and algorithm.";
+    uses public-key-grouping;
+    leaf private-key-format {
+      nacm:default-deny-write;
+      when "../private-key";
+      type identityref {
+        base private-key-format;
+      }
+      description "Identifies the key's format.";
+    }
+    choice private-key-type {
+      mandatory true;
+      description
+        "Choice between key types.";
+      leaf private-key {
+        nacm:default-deny-all;
+        type binary;
+        //must "../private-key-format"; FIXME: rm comment if ok
+        description
+          "The value of the binary key.  The key's value is
+           interpreted by the 'private-key-format' field.";
+      }
+      leaf hidden-private-key {
+        nacm:default-deny-write;
+        type empty;
+        description
+          "A permanently hidden key.  How such keys are created
+           is outside the scope of this module.";
+      }
+    }
+  }
+
+  grouping trust-anchor-cert-grouping {
+    description
+      "A trust anchor certificate, and a notification for when
+       it is about to (or already has) expire.";
+    leaf cert {
+      nacm:default-deny-write;
+      type trust-anchor-cert-cms;
+      description
+        "The binary certificate data for this certificate.";
+      reference
+        "RFC YYYY: Common YANG Data Types for Cryptography";
+    }
+    notification certificate-expiration {
+      description
+        "A notification indicating that the configured certificate
+         is either about to expire or has already expired.  When to
+         send notifications is an implementation specific decision,
+         but it is RECOMMENDED that a notification be sent once a
+         month for 3 months, then once a week for four weeks, and
+         then once a day thereafter until the issue is resolved.";
+      leaf expiration-date {
+        type yang:date-and-time;
+        mandatory true;
+        description
+          "Identifies the expiration date on the certificate.";
+      }
+    }
+  }
+
+  grouping trust-anchor-certs-grouping {
+    description
+      "A list of trust anchor certificates, and a notification
+       for when one is about to (or already has) expire.";
+    leaf-list cert {
+      nacm:default-deny-write;
+      type trust-anchor-cert-cms;
+      description
+        "The binary certificate data for this certificate.";
+      reference
+        "RFC YYYY: Common YANG Data Types for Cryptography";
+    }
+    notification certificate-expiration {
+      description
+        "A notification indicating that the configured certificate
+         is either about to expire or has already expired.  When to
+         send notifications is an implementation specific decision,
+         but it is RECOMMENDED that a notification be sent once a
+         month for 3 months, then once a week for four weeks, and
+         then once a day thereafter until the issue is resolved.";
+      leaf expiration-date {
+        type yang:date-and-time;
+        mandatory true;
+        description
+          "Identifies the expiration date on the certificate.";
+      }
+    }
+  }
+
+  grouping end-entity-cert-grouping {
+    description
+      "An end entity certificate, and a notification for when
+       it is about to (or already has) expire.  Implementations
+       SHOULD assert that, where used, the end entity certificate
+       contains the expected public key.";
+    leaf cert {
+      nacm:default-deny-write;
+      type end-entity-cert-cms;
+      description
+        "The binary certificate data for this certificate.";
+      reference
+        "RFC YYYY: Common YANG Data Types for Cryptography";
+    }
+    notification certificate-expiration {
+      description
+        "A notification indicating that the configured certificate
+         is either about to expire or has already expired.  When to
+         send notifications is an implementation specific decision,
+         but it is RECOMMENDED that a notification be sent once a
+         month for 3 months, then once a week for four weeks, and
+         then once a day thereafter until the issue is resolved.";
+      leaf expiration-date {
+        type yang:date-and-time;
+        mandatory true;
+        description
+          "Identifies the expiration date on the certificate.";
+      }
+    }
+  }
+
+  grouping end-entity-certs-grouping {
+    description
+      "A list of end entity certificates, and a notification for
+       when one is about to (or already has) expire.";
+    leaf-list cert {
+      nacm:default-deny-write;
+      type end-entity-cert-cms;
+      description
+        "The binary certificate data for this certificate.";
+      reference
+        "RFC YYYY: Common YANG Data Types for Cryptography";
+    }
+    notification certificate-expiration {
+      description
+        "A notification indicating that the configured certificate
+         is either about to expire or has already expired.  When to
+         send notifications is an implementation specific decision,
+         but it is RECOMMENDED that a notification be sent once a
+         month for 3 months, then once a week for four weeks, and
+         then once a day thereafter until the issue is resolved.";
+      leaf expiration-date {
+        type yang:date-and-time;
+        mandatory true;
+        description
+          "Identifies the expiration date on the certificate.";
+      }
+    }
+  }
+
+  grouping asymmetric-key-pair-with-cert-grouping {
+    description
+      "A private/public key pair and an associated certificate.
+       Implementations SHOULD assert that certificates contain
+       the matching public key.";
+    uses asymmetric-key-pair-grouping;
+    uses end-entity-cert-grouping;
+    action generate-certificate-signing-request {
+      nacm:default-deny-all;
+      description
+        "Generates a certificate signing request structure for
+         the associated asymmetric key using the passed subject
+         and attribute values.  The specified assertions need
+         to be appropriate for the certificate's use.  For
+         example, an entity certificate for a TLS server
+         SHOULD have values that enable clients to satisfy
+         RFC 6125 processing.";
+      input {
+        leaf subject {
+          type binary;
+          mandatory true;
+          description
+            "The 'subject' field per the CertificationRequestInfo
+              structure as specified by RFC 2986, Section 4.1
+              encoded using the ASN.1 distinguished encoding
+              rules (DER), as specified in ITU-T X.690.";
+          reference
+            "RFC 2986:
+               PKCS #10: Certification Request Syntax
+                         Specification Version 1.7.
+             ITU-T X.690:
+               Information technology - ASN.1 encoding rules:
+               Specification of Basic Encoding Rules (BER),
+               Canonical Encoding Rules (CER) and Distinguished
+               Encoding Rules (DER).";
+        }
+        leaf attributes {
+          type binary; // FIXME: does this need to be mandatory?
+          description
+            "The 'attributes' field from the structure
+             CertificationRequestInfo as specified by RFC 2986,
+             Section 4.1 encoded using the ASN.1 distinguished
+             encoding rules (DER), as specified in ITU-T X.690.";
+          reference
+            "RFC 2986:
+               PKCS #10: Certification Request Syntax
+                         Specification Version 1.7.
+             ITU-T X.690:
+               Information technology - ASN.1 encoding rules:
+               Specification of Basic Encoding Rules (BER),
+               Canonical Encoding Rules (CER) and Distinguished
+               Encoding Rules (DER).";
+        }
+      }
+      output {
+        leaf certificate-signing-request {
+          type binary;
+          mandatory true;
+          description
+            "A CertificationRequest structure as specified by
+             RFC 2986, Section 4.2 encoded using the ASN.1
+             distinguished encoding rules (DER), as specified
+             in ITU-T X.690.";
+          reference
+            "RFC 2986:
+               PKCS #10: Certification Request Syntax
+                         Specification Version 1.7.
+             ITU-T X.690:
+               Information technology - ASN.1 encoding rules:
+               Specification of Basic Encoding Rules (BER),
+               Canonical Encoding Rules (CER) and Distinguished
+               Encoding Rules (DER).";
+        }
+      }
+    } // generate-certificate-signing-request
+  } // asymmetric-key-pair-with-cert-grouping
+
+  grouping asymmetric-key-pair-with-certs-grouping {
+    description
+      "A private/public key pair and associated certificates.
+       Implementations SHOULD assert that certificates contain
+       the matching public key.";
+    uses asymmetric-key-pair-grouping;
+    container certificates {
+      nacm:default-deny-write;
+      description
+        "Certificates associated with this asymmetric key.
+         More than one certificate supports, for instance,
+         a TPM-protected asymmetric key that has both IDevID
+         and LDevID certificates associated.";
+      list certificate {
+        key "name";
+        description
+          "A certificate for this asymmetric key.";
+        leaf name {
+          type string;
+          description
+            "An arbitrary name for the certificate.  If the name
+             matches the name of a certificate that exists
+             independently in <operational> (i.e., an IDevID),
+             then the 'cert' node MUST NOT be configured.";
+        }
+        uses end-entity-cert-grouping;
+      }
+    } // certificates
+    action generate-certificate-signing-request {
+      nacm:default-deny-all;
+      description
+        "Generates a certificate signing request structure for
+         the associated asymmetric key using the passed subject
+         and attribute values.  The specified assertions need
+         to be appropriate for the certificate's use.  For
+         example, an entity certificate for a TLS server
+         SHOULD have values that enable clients to satisfy
+         RFC 6125 processing.";
+      input {
+        leaf subject {
+          type binary;
+          mandatory true;
+          description
+            "The 'subject' field per the CertificationRequestInfo
+              structure as specified by RFC 2986, Section 4.1
+              encoded using the ASN.1 distinguished encoding
+              rules (DER), as specified in ITU-T X.690.";
+          reference
+            "RFC 2986:
+               PKCS #10: Certification Request Syntax
+                         Specification Version 1.7.
+             ITU-T X.690:
+               Information technology - ASN.1 encoding rules:
+               Specification of Basic Encoding Rules (BER),
+               Canonical Encoding Rules (CER) and Distinguished
+               Encoding Rules (DER).";
+        }
+        leaf attributes {
+          type binary; // FIXME: does this need to be mandatory?
+          description
+            "The 'attributes' field from the structure
+             CertificationRequestInfo as specified by RFC 2986,
+             Section 4.1 encoded using the ASN.1 distinguished
+             encoding rules (DER), as specified in ITU-T X.690.";
+          reference
+            "RFC 2986:
+               PKCS #10: Certification Request Syntax
+                         Specification Version 1.7.
+             ITU-T X.690:
+               Information technology - ASN.1 encoding rules:
+               Specification of Basic Encoding Rules (BER),
+               Canonical Encoding Rules (CER) and Distinguished
+               Encoding Rules (DER).";
+        }
+      }
+      output {
+        leaf certificate-signing-request {
+          type binary;
+          mandatory true;
+          description
+            "A CertificationRequest structure as specified by
+             RFC 2986, Section 4.2 encoded using the ASN.1
+             distinguished encoding rules (DER), as specified
+             in ITU-T X.690.";
+          reference
+            "RFC 2986:
+               PKCS #10: Certification Request Syntax
+                         Specification Version 1.7.
+             ITU-T X.690:
+               Information technology - ASN.1 encoding rules:
+               Specification of Basic Encoding Rules (BER),
+               Canonical Encoding Rules (CER) and Distinguished
+               Encoding Rules (DER).";
+        }
+      }
+    } // generate-certificate-signing-request
+  } // asymmetric-key-pair-with-certs-grouping
+}
\ No newline at end of file
diff --git a/ntsimulator/yang/ietf-dhcpv6-types.yang b/ntsimulator/yang/ietf-dhcpv6-types.yang
new file mode 100644 (file)
index 0000000..c0d7193
--- /dev/null
@@ -0,0 +1,207 @@
+module ietf-dhcpv6-types {
+       yang-version 1.1;
+  namespace "urn:ietf:params:xml:ns:yang:ietf-dhcpv6-types";
+  prefix "dhcpv6-types";
+
+  import ietf-inet-types {
+               prefix inet;
+  }
+       import ietf-yang-types {
+               prefix yang;
+       }
+
+  organization "DHC WG";
+       contact
+   "cuiyong@tsinghua.edu.cn
+    lh.sunlinh@gmail.com
+    ian.farrer@telekom.de
+    sladjana.zechlin@telekom.de
+    hezihao9512@gmail.com";
+
+  description "This model defines a YANG data model that can be
+    used to define some commonly used DHCPv6 types";
+
+  revision 2018-01-30 {
+    description "Initial revision";
+    reference "I-D: draft-ietf-dhc-dhcpv6-yang";
+  }
+
+  /*
+       * Grouping
+       */
+       grouping vendor-infor {
+       description "Vendor information.";
+               container vendor-info {
+                       description "";
+               leaf ent-num {
+               type uint32;
+               mandatory true;
+               description "enterprise number";
+               }
+               leaf-list data {
+               type string;
+               description "specific vendor info";
+               }
+       }
+  }
+
+       grouping duid {
+    description
+      "Each server and client has only one DUID (DHCP Unique Identifier).
+      The DUID here identifies a unique DHCPv6 server for clients. DUID
+      consists of a two-octet type field and an arbitrary length (no more
+      than 128 bytes) content field. Currently there are four defined types
+      of DUIDs in RFC3315 and RFC6355 - DUID-LLT, DUID-EN, DUID-LL and
+      DUID-UUID. DUID-Uknown represents those unconventional DUIDs.";
+    reference "RFC3315: Section 9 and RFC6355: Section 4";
+    leaf type-code {
+               type uint16;
+               default 65535;
+               description "Type code of this DUID";
+       }
+    choice duid-type {
+               default duid-unknown;
+      description "Selects the format for the DUID.";
+       case duid-llt {
+       description "DUID Based on Link-layer Address Plus Time
+               (Type 1 - DUID-LLT)";
+               reference "RFC3315 Section 9.2";
+       leaf duid-llt-hardware-type {
+               type uint16;
+               description "Hardware type as assigned by IANA (RFC826).";
+       }
+       leaf duid-llt-time {
+               type yang:timeticks;
+               description "The time value is the time that the DUID is
+               generated represented in seconds since midnight (UTC),
+               January 1, 2000, modulo 2^32.";
+       }
+       leaf duid-llt-link-layer-addr {
+                       type yang:mac-address;
+               description "Link-layer address as described in RFC2464";
+               }
+               }
+       case duid-en {
+       description "DUID Assigned by Vendor Based on Enterprise Number
+               (Type 2 - DUID-EN)";
+                       reference "RFC3315 Section 9.3";
+               leaf duid-en-enterprise-number {
+                       type uint32;
+                       description "Vendor's registered Private Enterprise Number as
+                       maintained by IANA";
+               }
+       leaf duid-en-identifier {
+               type string;
+               description "Indentifier, unique to the device that is
+               using it";
+       }
+               }
+       case duid-ll {
+               description "DUID Based on Link-layer Address (Type 3 - DUID-LL)";
+               reference "RFC3315 Section 9.4";
+               leaf duid-ll-hardware-type {
+                       type uint16;
+               description "Hardware type as assigned by IANA (RFC826).";
+               }
+               leaf duid-ll-link-layer-addr {
+                       type yang:mac-address;
+                       description "Link-layer address as described in RFC2464";
+               }
+       }
+       case duid-uuid {
+               description "DUID Based on Universally Unique Identifier
+                       (Type 4 - DUID-UUID)";
+               reference "RFC6335 Defination of the UUID-Based Unique Identifier";
+               leaf uuid {
+                       type yang:uuid;
+                       description "A Universally Unique IDentifier in the string
+                               representation defined in RFC 4122. The canonical
+                               representation uses lowercase characters";
+               }
+       }
+       case duid-unknown {
+                       description "DUID based on free raw bytes";
+                       leaf data {
+                               type binary;
+                               description "The bits to be used as the identifier";
+                       }
+       }
+    }
+       }
+
+  grouping portset-para {
+    description "portset parameters";
+    container port-parameter {
+      description "port parameter";
+      leaf offset {
+        type uint8;
+        mandatory true;
+        description "offset in a port set";
+      }
+      leaf psid-len {
+        type uint8;
+        mandatory true;
+        description "length of a psid";
+      }
+      leaf psid {
+        type uint16;
+        mandatory true;
+        description "psid value";
+      }
+    }
+  }
+
+  grouping iaid {
+         description "IA is a construct through which a server and a
+             client can identify, group, and manage a set of related IPv6
+             addresses. The key of the list is a 4-byte number IAID defined
+             in [RFC3315].";
+    list identity-association {
+      config "false";
+      description "IA";
+      leaf iaid {
+        type uint32;
+        mandatory true;
+        description "IAID";
+      }
+      leaf ia-type {
+        type string;
+        mandatory true;
+        description "IA type";
+      }
+      leaf-list ipv6-addr {
+        type inet:ipv6-address;
+        description "ipv6 address";
+      }
+      leaf-list ipv6-prefix {
+        type inet:ipv6-prefix;
+        description "ipv6 prefix";
+      }
+      leaf-list prefix-length {
+        type uint8;
+        description "ipv6 prefix length";
+      }
+      leaf t1-time {
+        type yang:timeticks;
+        mandatory true;
+        description "t1 time";
+      }
+      leaf t2-time {
+        type yang:timeticks;
+        mandatory true;
+        description "t2 time";
+      }
+      leaf preferred-lifetime {
+        type yang:timeticks;
+        mandatory true;
+        description "preferred lifetime";
+      }
+      leaf valid-lifetime {
+        type yang:timeticks;
+        mandatory true;
+        description "valid lifetime";
+      }
+    }
+  }
+
+}
diff --git a/ntsimulator/yang/ietf-hardware.yang b/ntsimulator/yang/ietf-hardware.yang
new file mode 100755 (executable)
index 0000000..f444e26
--- /dev/null
@@ -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/ntsimulator/yang/ietf-inet-types.yang b/ntsimulator/yang/ietf-inet-types.yang
new file mode 100755 (executable)
index 0000000..4b0db8e
--- /dev/null
@@ -0,0 +1,429 @@
+module ietf-inet-types {
+
+namespace "urn:ietf:params:xml:ns:yang:ietf-inet-types";
+prefix "inet";
+
+organization
+ "IETF NETMOD (NETCONF Data Modeling Language) Working Group";
+
+contact
+ "WG Web:   <http://tools.ietf.org/wg/netmod/>
+  WG List:  <mailto:netmod@ietf.org>
+  WG Chair: David Kessens
+            <mailto:david.kessens@nsn.com>
+  WG Chair: Juergen Schoenwaelder
+            <mailto:j.schoenwaelder@jacobs-university.de>
+  Editor:   Juergen Schoenwaelder
+            <mailto:j.schoenwaelder@jacobs-university.de>";
+
+description
+ "This module contains a collection of generally useful derived
+  YANG data types for Internet addresses and related things.
+  Copyright (c) 2013 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
+  (http://trustee.ietf.org/license-info).
+  This version of this YANG module is part of RFC 6991; see
+  the RFC itself for full legal notices.";
+
+revision 2013-07-15 {
+  description
+   "This revision adds the following new data types:
+    - ip-address-no-zone
+    - ipv4-address-no-zone
+    - ipv6-address-no-zone";
+  reference
+   "RFC 6991: Common YANG Data Types";
+}
+
+revision 2010-09-24 {
+  description
+   "Initial revision.";
+  reference
+   "RFC 6021: Common YANG Data Types";
+}
+
+/*** collection of types related to protocol fields ***/
+
+typedef ip-version {
+  type enumeration {
+    enum unknown {
+      value "0";
+      description
+       "An unknown or unspecified version of the Internet
+        protocol.";
+    }
+    enum ipv4 {
+      value "1";
+      description
+       "The IPv4 protocol as defined in RFC 791.";
+    }
+    enum ipv6 {
+      value "2";
+      description
+       "The IPv6 protocol as defined in RFC 2460.";
+    }
+  }
+  description
+   "This value represents the version of the IP protocol.
+    In the value set and its semantics, this type is equivalent
+    to the InetVersion textual convention of the SMIv2.";
+  reference
+   "RFC  791: Internet Protocol
+    RFC 2460: Internet Protocol, Version 6 (IPv6) Specification
+    RFC 4001: Textual Conventions for Internet Network Addresses";
+}
+
+typedef dscp {
+  type uint8 {
+    range "0..63";
+  }
+  description
+   "The dscp type represents a Differentiated Services Code Point
+    that may be used for marking packets in a traffic stream.
+    In the value set and its semantics, this type is equivalent
+    to the Dscp textual convention of the SMIv2.";
+  reference
+   "RFC 3289: Management Information Base for the Differentiated
+              Services Architecture
+    RFC 2474: Definition of the Differentiated Services Field
+              (DS Field) in the IPv4 and IPv6 Headers
+    RFC 2780: IANA Allocation Guidelines For Values In
+              the Internet Protocol and Related Headers";
+}
+
+typedef ipv6-flow-label {
+  type uint32 {
+    range "0..1048575";
+  }
+  description
+   "The ipv6-flow-label type represents the flow identifier or Flow
+    Label in an IPv6 packet header that may be used to
+    discriminate traffic flows.
+    In the value set and its semantics, this type is equivalent
+    to the IPv6FlowLabel textual convention of the SMIv2.";
+  reference
+   "RFC 3595: Textual Conventions for IPv6 Flow Label
+    RFC 2460: Internet Protocol, Version 6 (IPv6) Specification";
+}
+
+typedef port-number {
+  type uint16 {
+    range "0..65535";
+  }
+  description
+   "The port-number type represents a 16-bit port number of an
+    Internet transport-layer protocol such as UDP, TCP, DCCP, or
+    SCTP.  Port numbers are assigned by IANA.  A current list of
+    all assignments is available from <http://www.iana.org/>.
+    Note that the port number value zero is reserved by IANA.  In
+    situations where the value zero does not make sense, it can
+    be excluded by subtyping the port-number type.
+    In the value set and its semantics, this type is equivalent
+    to the InetPortNumber textual convention of the SMIv2.";
+  reference
+   "RFC  768: User Datagram Protocol
+    RFC  793: Transmission Control Protocol
+    RFC 4960: Stream Control Transmission Protocol
+    RFC 4340: Datagram Congestion Control Protocol (DCCP)
+    RFC 4001: Textual Conventions for Internet Network Addresses";
+}
+
+/*** collection of types related to autonomous systems ***/
+
+typedef as-number {
+  type uint32;
+  description
+   "The as-number type represents autonomous system numbers
+    which identify an Autonomous System (AS).  An AS is a set
+    of routers under a single technical administration, using
+    an interior gateway protocol and common metrics to route
+    packets within the AS, and using an exterior gateway
+    protocol to route packets to other ASes.  IANA maintains
+    the AS number space and has delegated large parts to the
+    regional registries.
+    Autonomous system numbers were originally limited to 16
+    bits.  BGP extensions have enlarged the autonomous system
+    number space to 32 bits.  This type therefore uses an uint32
+    base type without a range restriction in order to support
+    a larger autonomous system number space.
+    In the value set and its semantics, this type is equivalent
+    to the InetAutonomousSystemNumber textual convention of
+    the SMIv2.";
+  reference
+   "RFC 1930: Guidelines for creation, selection, and registration
+              of an Autonomous System (AS)
+    RFC 4271: A Border Gateway Protocol 4 (BGP-4)
+    RFC 4001: Textual Conventions for Internet Network Addresses
+    RFC 6793: BGP Support for Four-Octet Autonomous System (AS)
+              Number Space";
+}
+
+/*** collection of types related to IP addresses and hostnames ***/
+
+typedef ip-address {
+  type union {
+    type inet:ipv4-address;
+    type inet:ipv6-address;
+  }
+  description
+   "The ip-address type represents an IP address and is IP
+    version neutral.  The format of the textual representation
+    implies the IP version.  This type supports scoped addresses
+    by allowing zone identifiers in the address format.";
+  reference
+   "RFC 4007: IPv6 Scoped Address Architecture";
+}
+
+typedef ipv4-address {
+  type string {
+    pattern
+      '(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}'
+    +  '([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])'
+    + '(%[\p{N}\p{L}]+)?';
+  }
+  description
+    "The ipv4-address type represents an IPv4 address in
+     dotted-quad notation.  The IPv4 address may include a zone
+     index, separated by a % sign.
+     The zone index is used to disambiguate identical address
+     values.  For link-local addresses, the zone index will
+     typically be the interface index number or the name of an
+     interface.  If the zone index is not present, the default
+     zone of the device will be used.
+     The canonical format for the zone index is the numerical
+     format";
+}
+
+typedef ipv6-address {
+  type string {
+    pattern '((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}'
+          + '((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|'
+          + '(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.){3}'
+          + '(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))'
+          + '(%[\p{N}\p{L}]+)?';
+    pattern '(([^:]+:){6}(([^:]+:[^:]+)|(.*\..*)))|'
+          + '((([^:]+:)*[^:]+)?::(([^:]+:)*[^:]+)?)'
+          + '(%.+)?';
+  }
+  description
+   "The ipv6-address type represents an IPv6 address in full,
+    mixed, shortened, and shortened-mixed notation.  The IPv6
+    address may include a zone index, separated by a % sign.
+    The zone index is used to disambiguate identical address
+    values.  For link-local addresses, the zone index will
+    typically be the interface index number or the name of an
+    interface.  If the zone index is not present, the default
+    zone of the device will be used.
+    The canonical format of IPv6 addresses uses the textual
+    representation defined in Section 4 of RFC 5952.  The
+    canonical format for the zone index is the numerical
+    format as described in Section 11.2 of RFC 4007.";
+  reference
+   "RFC 4291: IP Version 6 Addressing Architecture
+    RFC 4007: IPv6 Scoped Address Architecture
+    RFC 5952: A Recommendation for IPv6 Address Text
+              Representation";
+}
+
+typedef ip-address-no-zone {
+  type union {
+    type inet:ipv4-address-no-zone;
+    type inet:ipv6-address-no-zone;
+  }
+  description
+   "The ip-address-no-zone type represents an IP address and is
+    IP version neutral.  The format of the textual representation
+    implies the IP version.  This type does not support scoped
+    addresses since it does not allow zone identifiers in the
+    address format.";
+  reference
+   "RFC 4007: IPv6 Scoped Address Architecture";
+}
+
+typedef ipv4-address-no-zone {
+  type inet:ipv4-address {
+    pattern '[0-9\.]*';
+  }
+  description
+    "An IPv4 address without a zone index.  This type, derived from
+     ipv4-address, may be used in situations where the zone is
+     known from the context and hence no zone index is needed.";
+}
+
+typedef ipv6-address-no-zone {
+  type inet:ipv6-address {
+    pattern '[0-9a-fA-F:\.]*';
+  }
+  description
+    "An IPv6 address without a zone index.  This type, derived from
+     ipv6-address, may be used in situations where the zone is
+     known from the context and hence no zone index is needed.";
+  reference
+   "RFC 4291: IP Version 6 Addressing Architecture
+    RFC 4007: IPv6 Scoped Address Architecture
+    RFC 5952: A Recommendation for IPv6 Address Text
+              Representation";
+}
+
+typedef ip-prefix {
+  type union {
+    type inet:ipv4-prefix;
+    type inet:ipv6-prefix;
+  }
+  description
+   "The ip-prefix type represents an IP prefix and is IP
+    version neutral.  The format of the textual representations
+    implies the IP version.";
+}
+
+typedef ipv4-prefix {
+  type string {
+    pattern
+       '(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}'
+     +  '([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])'
+     + '/(([0-9])|([1-2][0-9])|(3[0-2]))';
+  }
+  description
+   "The ipv4-prefix type represents an IPv4 address prefix.
+    The prefix length is given by the number following the
+    slash character and must be less than or equal to 32.
+    A prefix length value of n corresponds to an IP address
+    mask that has n contiguous 1-bits from the most
+    significant bit (MSB) and all other bits set to 0.
+    The canonical format of an IPv4 prefix has all bits of
+    the IPv4 address set to zero that are not part of the
+    IPv4 prefix.";
+}
+
+typedef ipv6-prefix {
+  type string {
+    pattern '((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}'
+          + '((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|'
+          + '(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.){3}'
+          + '(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))'
+          + '(/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))';
+    pattern '(([^:]+:){6}(([^:]+:[^:]+)|(.*\..*)))|'
+          + '((([^:]+:)*[^:]+)?::(([^:]+:)*[^:]+)?)'
+          + '(/.+)';
+  }
+
+  description
+   "The ipv6-prefix type represents an IPv6 address prefix.
+    The prefix length is given by the number following the
+    slash character and must be less than or equal to 128.
+    A prefix length value of n corresponds to an IP address
+    mask that has n contiguous 1-bits from the most
+    significant bit (MSB) and all other bits set to 0.
+    The IPv6 address should have all bits that do not belong
+    to the prefix set to zero.
+    The canonical format of an IPv6 prefix has all bits of
+    the IPv6 address set to zero that are not part of the
+    IPv6 prefix.  Furthermore, the IPv6 address is represented
+    as defined in Section 4 of RFC 5952.";
+  reference
+   "RFC 5952: A Recommendation for IPv6 Address Text
+              Representation";
+}
+
+/*** collection of domain name and URI types ***/
+
+typedef domain-name {
+  type string {
+    pattern
+      '((([a-zA-Z0-9_]([a-zA-Z0-9\-_]){0,61})?[a-zA-Z0-9]\.)*'
+    + '([a-zA-Z0-9_]([a-zA-Z0-9\-_]){0,61})?[a-zA-Z0-9]\.?)'
+    + '|\.';
+    length "1..253";
+  }
+  description
+   "The domain-name type represents a DNS domain name.  The
+    name SHOULD be fully qualified whenever possible.
+    Internet domain names are only loosely specified.  Section
+    3.5 of RFC 1034 recommends a syntax (modified in Section
+    2.1 of RFC 1123).  The pattern above is intended to allow
+    for current practice in domain name use, and some possible
+    future expansion.  It is designed to hold various types of
+    domain names, including names used for A or AAAA records
+    (host names) and other records, such as SRV records.  Note
+    that Internet host names have a stricter syntax (described
+    in RFC 952) than the DNS recommendations in RFCs 1034 and
+    1123, and that systems that want to store host names in
+    schema nodes using the domain-name type are recommended to
+    adhere to this stricter standard to ensure interoperability.
+    The encoding of DNS names in the DNS protocol is limited
+    to 255 characters.  Since the encoding consists of labels
+    prefixed by a length bytes and there is a trailing NULL
+    byte, only 253 characters can appear in the textual dotted
+    notation.
+    The description clause of schema nodes using the domain-name
+    type MUST describe when and how these names are resolved to
+    IP addresses.  Note that the resolution of a domain-name value
+    may require to query multiple DNS records (e.g., A for IPv4
+    and AAAA for IPv6).  The order of the resolution process and
+    which DNS record takes precedence can either be defined
+    explicitly or may depend on the configuration of the
+    resolver.
+    Domain-name values use the US-ASCII encoding.  Their canonical
+    format uses lowercase US-ASCII characters.  Internationalized
+    domain names MUST be A-labels as per RFC 5890.";
+  reference
+   "RFC  952: DoD Internet Host Table Specification
+    RFC 1034: Domain Names - Concepts and Facilities
+    RFC 1123: Requirements for Internet Hosts -- Application
+              and Support
+    RFC 2782: A DNS RR for specifying the location of services
+              (DNS SRV)
+    RFC 5890: Internationalized Domain Names in Applications
+              (IDNA): Definitions and Document Framework";
+}
+
+typedef host {
+  type union {
+    type inet:ip-address;
+    type inet:domain-name;
+  }
+  description
+   "The host type represents either an IP address or a DNS
+    domain name.";
+}
+
+typedef uri {
+  type string;
+  description
+   "The uri type represents a Uniform Resource Identifier
+    (URI) as defined by STD 66.
+    Objects using the uri type MUST be in US-ASCII encoding,
+    and MUST be normalized as described by RFC 3986 Sections
+    6.2.1, 6.2.2.1, and 6.2.2.2.  All unnecessary
+    percent-encoding is removed, and all case-insensitive
+    characters are set to lowercase except for hexadecimal
+    digits, which are normalized to uppercase as described in
+    Section 6.2.2.1.
+    The purpose of this normalization is to help provide
+    unique URIs.  Note that this normalization is not
+    sufficient to provide uniqueness.  Two URIs that are
+    textually distinct after this normalization may still be
+    equivalent.
+    Objects using the uri type may restrict the schemes that
+    they permit.  For example, 'data:' and 'urn:' schemes
+    might not be appropriate.
+    A zero-length URI is not a valid URI.  This can be used to
+    express 'URI absent' where required.
+    In the value set and its semantics, this type is equivalent
+    to the Uri SMIv2 textual convention defined in RFC 5017.";
+  reference
+   "RFC 3986: Uniform Resource Identifier (URI): Generic Syntax
+    RFC 3305: Report from the Joint W3C/IETF URI Planning Interest
+              Group: Uniform Resource Identifiers (URIs), URLs,
+              and Uniform Resource Names (URNs): Clarifications
+              and Recommendations
+    RFC 5017: MIB Textual Conventions for Uniform Resource
+              Identifiers (URIs)";
+}
+
+}
diff --git a/ntsimulator/yang/ietf-interfaces.yang b/ntsimulator/yang/ietf-interfaces.yang
new file mode 100644 (file)
index 0000000..8dae9d3
--- /dev/null
@@ -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/ntsimulator/yang/ietf-ip.yang b/ntsimulator/yang/ietf-ip.yang
new file mode 100644 (file)
index 0000000..449081b
--- /dev/null
@@ -0,0 +1,860 @@
+module ietf-ip {
+  yang-version 1.1;
+  namespace "urn:ietf:params:xml:ns:yang:ietf-ip";
+  prefix ip;
+
+  import ietf-interfaces {
+    prefix if;
+  }
+  import ietf-inet-types {
+    prefix inet;
+  }
+  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 IP implementations.
+     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 8344; see
+     the RFC itself for full legal notices.";
+
+  revision 2018-02-22 {
+    description
+      "Updated to support NMDA.";
+    reference
+      "RFC 8344: A YANG Data Model for IP Management";
+  }
+
+  revision 2014-06-16 {
+    description
+      "Initial revision.";
+    reference
+      "RFC 7277: A YANG Data Model for IP Management";
+  }
+
+  /*
+   * Features
+   */
+
+  feature ipv4-non-contiguous-netmasks {
+    description
+      "Indicates support for configuring non-contiguous
+       subnet masks.";
+  }
+
+  feature ipv6-privacy-autoconf {
+    description
+      "Indicates support for privacy extensions for stateless address
+       autoconfiguration in IPv6.";
+    reference
+      "RFC 4941: Privacy Extensions for Stateless Address
+                 Autoconfiguration in IPv6";
+  }
+
+  /*
+   * Typedefs
+   */
+
+  typedef ip-address-origin {
+    type enumeration {
+      enum other {
+        description
+          "None of the following.";
+      }
+
+      enum static {
+        description
+          "Indicates that the address has been statically
+           configured -- for example, using the Network Configuration
+           Protocol (NETCONF) or a command line interface.";
+      }
+      enum dhcp {
+        description
+          "Indicates an address that has been assigned to this
+           system by a DHCP server.";
+      }
+      enum link-layer {
+        description
+          "Indicates an address created by IPv6 stateless
+           autoconfiguration that embeds a link-layer address in its
+           interface identifier.";
+      }
+      enum random {
+        description
+          "Indicates an address chosen by the system at
+           random, e.g., an IPv4 address within 169.254/16, a
+           temporary address as described in RFC 4941, or a
+           semantically opaque address as described in RFC 7217.";
+        reference
+          "RFC 4941: Privacy Extensions for Stateless Address
+                     Autoconfiguration in IPv6
+           RFC 7217: A Method for Generating Semantically Opaque
+                     Interface Identifiers with IPv6 Stateless
+                     Address Autoconfiguration (SLAAC)";
+      }
+    }
+    description
+      "The origin of an address.";
+  }
+
+  typedef neighbor-origin {
+    type enumeration {
+      enum other {
+        description
+          "None of the following.";
+      }
+      enum static {
+        description
+          "Indicates that the mapping has been statically
+           configured -- for example, using NETCONF or a command line
+           interface.";
+      }
+
+      enum dynamic {
+        description
+          "Indicates that the mapping has been dynamically resolved
+           using, for example, IPv4 ARP or the IPv6 Neighbor
+           Discovery protocol.";
+      }
+    }
+    description
+      "The origin of a neighbor entry.";
+  }
+
+  /*
+   * Data nodes
+   */
+
+  augment "/if:interfaces/if:interface" {
+    description
+      "IP parameters on interfaces.
+       If an interface is not capable of running IP, the server
+       must not allow the client to configure these parameters.";
+
+    container ipv4 {
+      presence
+        "Enables IPv4 unless the 'enabled' leaf
+         (which defaults to 'true') is set to 'false'";
+      description
+        "Parameters for the IPv4 address family.";
+
+      leaf enabled {
+        type boolean;
+        default true;
+        description
+          "Controls whether IPv4 is enabled or disabled on this
+           interface.  When IPv4 is enabled, this interface is
+           connected to an IPv4 stack, and the interface can send
+           and receive IPv4 packets.";
+      }
+      leaf forwarding {
+        type boolean;
+        default false;
+        description
+          "Controls IPv4 packet forwarding of datagrams received by,
+           but not addressed to, this interface.  IPv4 routers
+           forward datagrams.  IPv4 hosts do not (except those
+           source-routed via the host).";
+      }
+
+      leaf mtu {
+        type uint16 {
+          range "68..max";
+        }
+        units "octets";
+        description
+          "The size, in octets, of the largest IPv4 packet that the
+           interface will send and receive.
+           The server may restrict the allowed values for this leaf,
+           depending on the interface's type.
+           If this leaf is not configured, the operationally used MTU
+           depends on the interface's type.";
+        reference
+          "RFC 791: Internet Protocol";
+      }
+      list address {
+        key "ip";
+        description
+          "The list of IPv4 addresses on the interface.";
+
+        leaf ip {
+          type inet:ipv4-address-no-zone;
+          description
+            "The IPv4 address on the interface.";
+        }
+        choice subnet {
+          mandatory true;
+          description
+            "The subnet can be specified as a prefix length or,
+             if the server supports non-contiguous netmasks, as
+             a netmask.";
+          leaf prefix-length {
+            type uint8 {
+              range "0..32";
+            }
+            description
+              "The length of the subnet prefix.";
+          }
+          leaf netmask {
+            if-feature ipv4-non-contiguous-netmasks;
+            type yang:dotted-quad;
+            description
+              "The subnet specified as a netmask.";
+          }
+        }
+
+        leaf origin {
+          type ip-address-origin;
+          config false;
+          description
+            "The origin of this address.";
+        }
+      }
+      list neighbor {
+        key "ip";
+        description
+          "A list of mappings from IPv4 addresses to
+           link-layer addresses.
+           Entries in this list in the intended configuration are
+           used as static entries in the ARP Cache.
+           In the operational state, this list represents the ARP
+           Cache.";
+        reference
+          "RFC 826: An Ethernet Address Resolution Protocol";
+
+        leaf ip {
+          type inet:ipv4-address-no-zone;
+          description
+            "The IPv4 address of the neighbor node.";
+        }
+        leaf link-layer-address {
+          type yang:phys-address;
+          mandatory true;
+          description
+            "The link-layer address of the neighbor node.";
+        }
+        leaf origin {
+          type neighbor-origin;
+          config false;
+          description
+            "The origin of this neighbor entry.";
+        }
+      }
+    }
+
+    container ipv6 {
+      presence
+        "Enables IPv6 unless the 'enabled' leaf
+         (which defaults to 'true') is set to 'false'";
+      description
+        "Parameters for the IPv6 address family.";
+
+      leaf enabled {
+        type boolean;
+        default true;
+        description
+          "Controls whether IPv6 is enabled or disabled on this
+           interface.  When IPv6 is enabled, this interface is
+           connected to an IPv6 stack, and the interface can send
+           and receive IPv6 packets.";
+      }
+      leaf forwarding {
+        type boolean;
+        default false;
+        description
+          "Controls IPv6 packet forwarding of datagrams received by,
+           but not addressed to, this interface.  IPv6 routers
+           forward datagrams.  IPv6 hosts do not (except those
+           source-routed via the host).";
+        reference
+          "RFC 4861: Neighbor Discovery for IP version 6 (IPv6)
+                     Section 6.2.1, IsRouter";
+      }
+      leaf mtu {
+        type uint32 {
+          range "1280..max";
+        }
+        units "octets";
+        description
+          "The size, in octets, of the largest IPv6 packet that the
+           interface will send and receive.
+           The server may restrict the allowed values for this leaf,
+           depending on the interface's type.
+           If this leaf is not configured, the operationally used MTU
+           depends on the interface's type.";
+        reference
+          "RFC 8200: Internet Protocol, Version 6 (IPv6)
+                     Specification
+                     Section 5";
+      }
+
+      list address {
+        key "ip";
+        description
+          "The list of IPv6 addresses on the interface.";
+
+        leaf ip {
+          type inet:ipv6-address-no-zone;
+          description
+            "The IPv6 address on the interface.";
+        }
+        leaf prefix-length {
+          type uint8 {
+            range "0..128";
+          }
+          mandatory true;
+          description
+            "The length of the subnet prefix.";
+        }
+        leaf origin {
+          type ip-address-origin;
+          config false;
+          description
+            "The origin of this address.";
+        }
+        leaf status {
+          type enumeration {
+            enum preferred {
+              description
+                "This is a valid address that can appear as the
+                 destination or source address of a packet.";
+            }
+            enum deprecated {
+              description
+                "This is a valid but deprecated address that should
+                 no longer be used as a source address in new
+                 communications, but packets addressed to such an
+                 address are processed as expected.";
+            }
+            enum invalid {
+              description
+                "This isn't a valid address, and it shouldn't appear
+                 as the destination or source address of a packet.";
+            }
+
+            enum inaccessible {
+              description
+                "The address is not accessible because the interface
+                 to which this address is assigned is not
+                 operational.";
+            }
+            enum unknown {
+              description
+                "The status cannot be determined for some reason.";
+            }
+            enum tentative {
+              description
+                "The uniqueness of the address on the link is being
+                 verified.  Addresses in this state should not be
+                 used for general communication and should only be
+                 used to determine the uniqueness of the address.";
+            }
+            enum duplicate {
+              description
+                "The address has been determined to be non-unique on
+                 the link and so must not be used.";
+            }
+            enum optimistic {
+              description
+                "The address is available for use, subject to
+                 restrictions, while its uniqueness on a link is
+                 being verified.";
+            }
+          }
+          config false;
+          description
+            "The status of an address.  Most of the states correspond
+             to states from the IPv6 Stateless Address
+             Autoconfiguration protocol.";
+          reference
+            "RFC 4293: Management Information Base for the
+                       Internet Protocol (IP)
+                       - IpAddressStatusTC
+             RFC 4862: IPv6 Stateless Address Autoconfiguration";
+        }
+      }
+
+      list neighbor {
+        key "ip";
+        description
+          "A list of mappings from IPv6 addresses to
+           link-layer addresses.
+           Entries in this list in the intended configuration are
+           used as static entries in the Neighbor Cache.
+           In the operational state, this list represents the
+           Neighbor Cache.";
+        reference
+          "RFC 4861: Neighbor Discovery for IP version 6 (IPv6)";
+
+        leaf ip {
+          type inet:ipv6-address-no-zone;
+          description
+            "The IPv6 address of the neighbor node.";
+        }
+        leaf link-layer-address {
+          type yang:phys-address;
+          mandatory true;
+          description
+            "The link-layer address of the neighbor node.
+             In the operational state, if the neighbor's 'state' leaf
+             is 'incomplete', this leaf is not instantiated.";
+        }
+        leaf origin {
+          type neighbor-origin;
+          config false;
+          description
+            "The origin of this neighbor entry.";
+        }
+        leaf is-router {
+          type empty;
+          config false;
+          description
+            "Indicates that the neighbor node acts as a router.";
+        }
+
+        leaf state {
+          type enumeration {
+            enum incomplete {
+              description
+                "Address resolution is in progress, and the
+                 link-layer address of the neighbor has not yet been
+                 determined.";
+            }
+            enum reachable {
+              description
+                "Roughly speaking, the neighbor is known to have been
+                 reachable recently (within tens of seconds ago).";
+            }
+            enum stale {
+              description
+                "The neighbor is no longer known to be reachable, but
+                 until traffic is sent to the neighbor no attempt
+                 should be made to verify its reachability.";
+            }
+            enum delay {
+              description
+                "The neighbor is no longer known to be reachable, and
+                 traffic has recently been sent to the neighbor.
+                 Rather than probe the neighbor immediately, however,
+                 delay sending probes for a short while in order to
+                 give upper-layer protocols a chance to provide
+                 reachability confirmation.";
+            }
+            enum probe {
+              description
+                "The neighbor is no longer known to be reachable, and
+                 unicast Neighbor Solicitation probes are being sent
+                 to verify reachability.";
+            }
+          }
+          config false;
+          description
+            "The Neighbor Unreachability Detection state of this
+             entry.";
+          reference
+            "RFC 4861: Neighbor Discovery for IP version 6 (IPv6)
+                       Section 7.3.2";
+        }
+      }
+
+      leaf dup-addr-detect-transmits {
+        type uint32;
+        default 1;
+        description
+          "The number of consecutive Neighbor Solicitation messages
+           sent while performing Duplicate Address Detection on a
+           tentative address.  A value of zero indicates that
+           Duplicate Address Detection is not performed on
+           tentative addresses.  A value of one indicates a single
+           transmission with no follow-up retransmissions.";
+        reference
+          "RFC 4862: IPv6 Stateless Address Autoconfiguration";
+      }
+      container autoconf {
+        description
+          "Parameters to control the autoconfiguration of IPv6
+           addresses, as described in RFC 4862.";
+        reference
+          "RFC 4862: IPv6 Stateless Address Autoconfiguration";
+
+        leaf create-global-addresses {
+          type boolean;
+          default true;
+          description
+            "If enabled, the host creates global addresses as
+             described in RFC 4862.";
+          reference
+            "RFC 4862: IPv6 Stateless Address Autoconfiguration
+                       Section 5.5";
+        }
+        leaf create-temporary-addresses {
+          if-feature ipv6-privacy-autoconf;
+          type boolean;
+          default false;
+          description
+            "If enabled, the host creates temporary addresses as
+             described in RFC 4941.";
+          reference
+            "RFC 4941: Privacy Extensions for Stateless Address
+                       Autoconfiguration in IPv6";
+        }
+
+        leaf temporary-valid-lifetime {
+          if-feature ipv6-privacy-autoconf;
+          type uint32;
+          units "seconds";
+          default 604800;
+          description
+            "The time period during which the temporary address
+             is valid.";
+          reference
+            "RFC 4941: Privacy Extensions for Stateless Address
+                       Autoconfiguration in IPv6
+                       - TEMP_VALID_LIFETIME";
+        }
+        leaf temporary-preferred-lifetime {
+          if-feature ipv6-privacy-autoconf;
+          type uint32;
+          units "seconds";
+          default 86400;
+          description
+            "The time period during which the temporary address is
+             preferred.";
+          reference
+            "RFC 4941: Privacy Extensions for Stateless Address
+                       Autoconfiguration in IPv6
+                       - TEMP_PREFERRED_LIFETIME";
+        }
+      }
+    }
+  }
+
+  /*
+   * Legacy operational state data nodes
+   */
+
+  augment "/if:interfaces-state/if:interface" {
+    status deprecated;
+    description
+      "Data nodes for the operational state of IP on interfaces.";
+
+    container ipv4 {
+      presence
+        "Present if IPv4 is enabled on this interface";
+      config false;
+      status deprecated;
+      description
+        "Interface-specific parameters for the IPv4 address family.";
+
+      leaf forwarding {
+        type boolean;
+        status deprecated;
+        description
+          "Indicates whether IPv4 packet forwarding is enabled or
+           disabled on this interface.";
+      }
+      leaf mtu {
+        type uint16 {
+          range "68..max";
+        }
+        units "octets";
+        status deprecated;
+        description
+          "The size, in octets, of the largest IPv4 packet that the
+           interface will send and receive.";
+        reference
+          "RFC 791: Internet Protocol";
+      }
+      list address {
+        key "ip";
+        status deprecated;
+        description
+          "The list of IPv4 addresses on the interface.";
+
+        leaf ip {
+          type inet:ipv4-address-no-zone;
+          status deprecated;
+          description
+            "The IPv4 address on the interface.";
+        }
+        choice subnet {
+          status deprecated;
+          description
+            "The subnet can be specified as a prefix length or,
+             if the server supports non-contiguous netmasks, as
+             a netmask.";
+          leaf prefix-length {
+            type uint8 {
+              range "0..32";
+            }
+            status deprecated;
+            description
+              "The length of the subnet prefix.";
+          }
+          leaf netmask {
+            if-feature ipv4-non-contiguous-netmasks;
+            type yang:dotted-quad;
+            status deprecated;
+            description
+              "The subnet specified as a netmask.";
+          }
+        }
+        leaf origin {
+          type ip-address-origin;
+          status deprecated;
+          description
+            "The origin of this address.";
+        }
+      }
+      list neighbor {
+        key "ip";
+        status deprecated;
+        description
+          "A list of mappings from IPv4 addresses to
+           link-layer addresses.
+           This list represents the ARP Cache.";
+        reference
+          "RFC 826: An Ethernet Address Resolution Protocol";
+
+        leaf ip {
+          type inet:ipv4-address-no-zone;
+          status deprecated;
+          description
+            "The IPv4 address of the neighbor node.";
+        }
+
+        leaf link-layer-address {
+          type yang:phys-address;
+          status deprecated;
+          description
+            "The link-layer address of the neighbor node.";
+        }
+        leaf origin {
+          type neighbor-origin;
+          status deprecated;
+          description
+            "The origin of this neighbor entry.";
+        }
+      }
+    }
+
+    container ipv6 {
+      presence
+        "Present if IPv6 is enabled on this interface";
+      config false;
+      status deprecated;
+      description
+        "Parameters for the IPv6 address family.";
+
+      leaf forwarding {
+        type boolean;
+        default false;
+        status deprecated;
+        description
+          "Indicates whether IPv6 packet forwarding is enabled or
+           disabled on this interface.";
+        reference
+          "RFC 4861: Neighbor Discovery for IP version 6 (IPv6)
+                     Section 6.2.1, IsRouter";
+      }
+      leaf mtu {
+        type uint32 {
+          range "1280..max";
+        }
+        units "octets";
+        status deprecated;
+        description
+          "The size, in octets, of the largest IPv6 packet that the
+           interface will send and receive.";
+        reference
+          "RFC 8200: Internet Protocol, Version 6 (IPv6)
+                     Specification
+                     Section 5";
+      }
+      list address {
+        key "ip";
+        status deprecated;
+        description
+          "The list of IPv6 addresses on the interface.";
+
+        leaf ip {
+          type inet:ipv6-address-no-zone;
+          status deprecated;
+          description
+            "The IPv6 address on the interface.";
+        }
+        leaf prefix-length {
+          type uint8 {
+            range "0..128";
+          }
+          mandatory true;
+          status deprecated;
+          description
+            "The length of the subnet prefix.";
+        }
+        leaf origin {
+          type ip-address-origin;
+          status deprecated;
+          description
+            "The origin of this address.";
+        }
+        leaf status {
+          type enumeration {
+            enum preferred {
+              description
+                "This is a valid address that can appear as the
+                 destination or source address of a packet.";
+            }
+            enum deprecated {
+              description
+                "This is a valid but deprecated address that should
+                 no longer be used as a source address in new
+                 communications, but packets addressed to such an
+                 address are processed as expected.";
+            }
+            enum invalid {
+              description
+                "This isn't a valid address, and it shouldn't appear
+                 as the destination or source address of a packet.";
+            }
+
+            enum inaccessible {
+              description
+                "The address is not accessible because the interface
+                 to which this address is assigned is not
+                 operational.";
+            }
+            enum unknown {
+              description
+                "The status cannot be determined for some reason.";
+            }
+            enum tentative {
+              description
+                "The uniqueness of the address on the link is being
+                 verified.  Addresses in this state should not be
+                 used for general communication and should only be
+                 used to determine the uniqueness of the address.";
+            }
+            enum duplicate {
+              description
+                "The address has been determined to be non-unique on
+                 the link and so must not be used.";
+            }
+            enum optimistic {
+              description
+                "The address is available for use, subject to
+                 restrictions, while its uniqueness on a link is
+                 being verified.";
+            }
+          }
+          status deprecated;
+          description
+            "The status of an address.  Most of the states correspond
+             to states from the IPv6 Stateless Address
+             Autoconfiguration protocol.";
+          reference
+            "RFC 4293: Management Information Base for the
+                       Internet Protocol (IP)
+                       - IpAddressStatusTC
+             RFC 4862: IPv6 Stateless Address Autoconfiguration";
+        }
+      }
+
+      list neighbor {
+        key "ip";
+        status deprecated;
+        description
+          "A list of mappings from IPv6 addresses to
+           link-layer addresses.
+           This list represents the Neighbor Cache.";
+        reference
+          "RFC 4861: Neighbor Discovery for IP version 6 (IPv6)";
+
+        leaf ip {
+          type inet:ipv6-address-no-zone;
+          status deprecated;
+          description
+            "The IPv6 address of the neighbor node.";
+        }
+        leaf link-layer-address {
+          type yang:phys-address;
+          status deprecated;
+          description
+            "The link-layer address of the neighbor node.";
+        }
+        leaf origin {
+          type neighbor-origin;
+          status deprecated;
+          description
+            "The origin of this neighbor entry.";
+        }
+        leaf is-router {
+          type empty;
+          status deprecated;
+          description
+            "Indicates that the neighbor node acts as a router.";
+        }
+        leaf state {
+          type enumeration {
+            enum incomplete {
+              description
+                "Address resolution is in progress, and the
+                 link-layer address of the neighbor has not yet been
+                 determined.";
+            }
+            enum reachable {
+              description
+                "Roughly speaking, the neighbor is known to have been
+                 reachable recently (within tens of seconds ago).";
+            }
+            enum stale {
+              description
+                "The neighbor is no longer known to be reachable, but
+                 until traffic is sent to the neighbor no attempt
+                 should be made to verify its reachability.";
+            }
+            enum delay {
+              description
+                "The neighbor is no longer known to be reachable, and
+                 traffic has recently been sent to the neighbor.
+                 Rather than probe the neighbor immediately, however,
+                 delay sending probes for a short while in order to
+                 give upper-layer protocols a chance to provide
+                 reachability confirmation.";
+            }
+            enum probe {
+              description
+                "The neighbor is no longer known to be reachable, and
+                 unicast Neighbor Solicitation probes are being sent
+                 to verify reachability.";
+            }
+          }
+          status deprecated;
+          description
+            "The Neighbor Unreachability Detection state of this
+             entry.";
+          reference
+            "RFC 4861: Neighbor Discovery for IP version 6 (IPv6)
+                       Section 7.3.2";
+        }
+      }
+    }
+  }
+}
diff --git a/ntsimulator/yang/ietf-netconf-acm.yang b/ntsimulator/yang/ietf-netconf-acm.yang
new file mode 100644 (file)
index 0000000..ec9687a
--- /dev/null
@@ -0,0 +1,440 @@
+module ietf-netconf-acm {
+
+  namespace "urn:ietf:params:xml:ns:yang:ietf-netconf-acm";
+
+  prefix nacm;
+
+  import ietf-yang-types {
+    prefix yang;
+  }
+
+  organization
+    "IETF NETCONF (Network Configuration) Working Group";
+
+  contact
+    "WG Web:   <https://datatracker.ietf.org/wg/netconf/>
+     WG List:  <mailto:netconf@ietf.org>
+     Author:   Andy Bierman
+               <mailto:andy@yumaworks.com>
+     Author:   Martin Bjorklund
+               <mailto:mbj@tail-f.com>";
+
+  description
+    "Network Configuration Access Control Model.
+     Copyright (c) 2012 - 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 8341; see
+     the RFC itself for full legal notices.";
+
+  revision "2018-02-14" {
+    description
+      "Added support for YANG 1.1 actions and notifications tied to
+       data nodes.  Clarified how NACM extensions can be used by
+       other data models.";
+    reference
+      "RFC 8341: Network Configuration Access Control Model";
+  }
+
+  revision "2012-02-22" {
+    description
+      "Initial version.";
+    reference
+      "RFC 6536: Network Configuration Protocol (NETCONF)
+                 Access Control Model";
+  }
+
+  /*
+   * Extension statements
+   */
+
+  extension default-deny-write {
+    description
+      "Used to indicate that the data model node
+       represents a sensitive security system parameter.
+       If present, the NETCONF server will only allow the designated
+       'recovery session' to have write access to the node.  An
+       explicit access control rule is required for all other users.
+       If the NACM module is used, then it must be enabled (i.e.,
+       /nacm/enable-nacm object equals 'true'), or this extension
+       is ignored.
+       The 'default-deny-write' extension MAY appear within a data
+       definition statement.  It is ignored otherwise.";
+  }
+
+  extension default-deny-all {
+    description
+      "Used to indicate that the data model node
+       controls a very sensitive security system parameter.
+       If present, the NETCONF server will only allow the designated
+       'recovery session' to have read, write, or execute access to
+       the node.  An explicit access control rule is required for all
+       other users.
+       If the NACM module is used, then it must be enabled (i.e.,
+       /nacm/enable-nacm object equals 'true'), or this extension
+       is ignored.
+       The 'default-deny-all' extension MAY appear within a data
+       definition statement, 'rpc' statement, or 'notification'
+       statement.  It is ignored otherwise.";
+  }
+
+  /*
+   * Derived types
+   */
+
+  typedef user-name-type {
+    type string {
+      length "1..max";
+    }
+    description
+      "General-purpose username string.";
+  }
+
+  typedef matchall-string-type {
+    type string {
+      pattern '\*';
+    }
+    description
+      "The string containing a single asterisk '*' is used
+       to conceptually represent all possible values
+       for the particular leaf using this data type.";
+  }
+
+  typedef access-operations-type {
+    type bits {
+      bit create {
+        description
+          "Any protocol operation that creates a
+           new data node.";
+      }
+      bit read {
+        description
+          "Any protocol operation or notification that
+           returns the value of a data node.";
+      }
+      bit update {
+        description
+          "Any protocol operation that alters an existing
+           data node.";
+      }
+      bit delete {
+        description
+          "Any protocol operation that removes a data node.";
+      }
+      bit exec {
+        description
+          "Execution access to the specified protocol operation.";
+      }
+    }
+    description
+      "Access operation.";
+  }
+
+  typedef group-name-type {
+    type string {
+      length "1..max";
+      pattern '[^\*].*';
+    }
+    description
+      "Name of administrative group to which
+       users can be assigned.";
+  }
+
+  typedef action-type {
+    type enumeration {
+      enum permit {
+        description
+          "Requested action is permitted.";
+      }
+      enum deny {
+        description
+          "Requested action is denied.";
+      }
+    }
+    description
+      "Action taken by the server when a particular
+       rule matches.";
+  }
+
+  typedef node-instance-identifier {
+    type yang:xpath1.0;
+    description
+      "Path expression used to represent a special
+       data node, action, or notification instance-identifier
+       string.
+       A node-instance-identifier value is an
+       unrestricted YANG instance-identifier expression.
+       All the same rules as an instance-identifier apply,
+       except that predicates for keys are optional.  If a key
+       predicate is missing, then the node-instance-identifier
+       represents all possible server instances for that key.
+       This XML Path Language (XPath) expression is evaluated in the
+       following context:
+          o  The set of namespace declarations are those in scope on
+             the leaf element where this type is used.
+          o  The set of variable bindings contains one variable,
+             'USER', which contains the name of the user of the
+             current session.
+          o  The function library is the core function library, but
+             note that due to the syntax restrictions of an
+             instance-identifier, no functions are allowed.
+          o  The context node is the root node in the data tree.
+       The accessible tree includes actions and notifications tied
+       to data nodes.";
+  }
+
+  /*
+   * Data definition statements
+   */
+
+  container nacm {
+    nacm:default-deny-all;
+
+    description
+      "Parameters for NETCONF access control model.";
+
+    leaf enable-nacm {
+      type boolean;
+      default "true";
+      description
+        "Enables or disables all NETCONF access control
+         enforcement.  If 'true', then enforcement
+         is enabled.  If 'false', then enforcement
+         is disabled.";
+    }
+
+    leaf read-default {
+      type action-type;
+      default "permit";
+      description
+        "Controls whether read access is granted if
+         no appropriate rule is found for a
+         particular read request.";
+    }
+
+    leaf write-default {
+      type action-type;
+      default "deny";
+      description
+        "Controls whether create, update, or delete access
+         is granted if no appropriate rule is found for a
+         particular write request.";
+    }
+
+    leaf exec-default {
+      type action-type;
+      default "permit";
+      description
+        "Controls whether exec access is granted if no appropriate
+         rule is found for a particular protocol operation request.";
+    }
+
+    leaf enable-external-groups {
+      type boolean;
+      default "true";
+      description
+        "Controls whether the server uses the groups reported by the
+         NETCONF transport layer when it assigns the user to a set of
+         NACM groups.  If this leaf has the value 'false', any group
+         names reported by the transport layer are ignored by the
+         server.";
+    }
+
+    leaf denied-operations {
+      type yang:zero-based-counter32;
+      config false;
+      mandatory true;
+      description
+        "Number of times since the server last restarted that a
+         protocol operation request was denied.";
+    }
+
+    leaf denied-data-writes {
+      type yang:zero-based-counter32;
+      config false;
+      mandatory true;
+      description
+        "Number of times since the server last restarted that a
+         protocol operation request to alter
+         a configuration datastore was denied.";
+    }
+
+    leaf denied-notifications {
+      type yang:zero-based-counter32;
+      config false;
+      mandatory true;
+      description
+        "Number of times since the server last restarted that
+         a notification was dropped for a subscription because
+         access to the event type was denied.";
+    }
+
+    container groups {
+      description
+        "NETCONF access control groups.";
+
+      list group {
+        key name;
+
+        description
+          "One NACM group entry.  This list will only contain
+           configured entries, not any entries learned from
+           any transport protocols.";
+
+        leaf name {
+          type group-name-type;
+          description
+            "Group name associated with this entry.";
+        }
+
+        leaf-list user-name {
+          type user-name-type;
+          description
+            "Each entry identifies the username of
+             a member of the group associated with
+             this entry.";
+        }
+      }
+    }
+
+    list rule-list {
+      key name;
+      ordered-by user;
+      description
+        "An ordered collection of access control rules.";
+
+      leaf name {
+        type string {
+          length "1..max";
+        }
+        description
+          "Arbitrary name assigned to the rule-list.";
+      }
+      leaf-list group {
+        type union {
+          type matchall-string-type;
+          type group-name-type;
+        }
+        description
+          "List of administrative groups that will be
+           assigned the associated access rights
+           defined by the 'rule' list.
+           The string '*' indicates that all groups apply to the
+           entry.";
+      }
+
+      list rule {
+        key name;
+        ordered-by user;
+        description
+          "One access control rule.
+           Rules are processed in user-defined order until a match is
+           found.  A rule matches if 'module-name', 'rule-type', and
+           'access-operations' match the request.  If a rule
+           matches, the 'action' leaf determines whether or not
+           access is granted.";
+
+        leaf name {
+          type string {
+            length "1..max";
+          }
+          description
+            "Arbitrary name assigned to the rule.";
+        }
+
+        leaf module-name {
+          type union {
+            type matchall-string-type;
+            type string;
+          }
+          default "*";
+          description
+            "Name of the module associated with this rule.
+             This leaf matches if it has the value '*' or if the
+             object being accessed is defined in the module with the
+             specified module name.";
+        }
+        choice rule-type {
+          description
+            "This choice matches if all leafs present in the rule
+             match the request.  If no leafs are present, the
+             choice matches all requests.";
+          case protocol-operation {
+            leaf rpc-name {
+              type union {
+                type matchall-string-type;
+                type string;
+              }
+              description
+                "This leaf matches if it has the value '*' or if
+                 its value equals the requested protocol operation
+                 name.";
+            }
+          }
+          case notification {
+            leaf notification-name {
+              type union {
+                type matchall-string-type;
+                type string;
+              }
+              description
+                "This leaf matches if it has the value '*' or if its
+                 value equals the requested notification name.";
+            }
+          }
+
+          case data-node {
+            leaf path {
+              type node-instance-identifier;
+              mandatory true;
+              description
+                "Data node instance-identifier associated with the
+                 data node, action, or notification controlled by
+                 this rule.
+                 Configuration data or state data
+                 instance-identifiers start with a top-level
+                 data node.  A complete instance-identifier is
+                 required for this type of path value.
+                 The special value '/' refers to all possible
+                 datastore contents.";
+            }
+          }
+        }
+
+        leaf access-operations {
+          type union {
+            type matchall-string-type;
+            type access-operations-type;
+          }
+          default "*";
+          description
+            "Access operations associated with this rule.
+             This leaf matches if it has the value '*' or if the
+             bit corresponding to the requested operation is set.";
+        }
+
+        leaf action {
+          type action-type;
+          mandatory true;
+          description
+            "The access control action associated with the
+             rule.  If a rule has been determined to match a
+             particular request, then this object is used
+             to determine whether to permit or deny the
+             request.";
+        }
+
+        leaf comment {
+          type string;
+          description
+            "A textual description of the access rule.";
+        }
+      }
+    }
+  }
+}
diff --git a/ntsimulator/yang/ietf-netconf-monitoring.yang b/ntsimulator/yang/ietf-netconf-monitoring.yang
new file mode 100644 (file)
index 0000000..3995988
--- /dev/null
@@ -0,0 +1,542 @@
+module ietf-netconf-monitoring {
+
+  namespace "urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring";
+  prefix "ncm";
+
+  import ietf-yang-types { prefix yang; }
+  import ietf-inet-types { prefix inet; }
+
+  organization
+    "IETF NETCONF (Network Configuration) Working Group";
+
+  contact
+    "WG Web:   <http://tools.ietf.org/wg/netconf/>
+     WG List:  <mailto:netconf@ietf.org>
+     WG Chair: Mehmet Ersue
+               <mailto:mehmet.ersue@nsn.com>
+     WG Chair: Bert Wijnen
+               <mailto:bertietf@bwijnen.net>
+     Editor:   Mark Scott
+               <mailto:mark.scott@ericsson.com>
+     Editor:   Martin Bjorklund
+               <mailto:mbj@tail-f.com>";
+
+  description
+    "NETCONF Monitoring Module.
+     All elements in this module are read-only.
+     Copyright (c) 2010 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
+     (http://trustee.ietf.org/license-info).
+     This version of this YANG module is part of RFC 6022; see
+     the RFC itself for full legal notices.";
+
+  revision 2010-10-04 {
+    description
+      "Initial revision.";
+    reference
+      "RFC 6022: YANG Module for NETCONF Monitoring";
+  }
+
+  typedef netconf-datastore-type {
+    type enumeration {
+      enum running;
+      enum candidate;
+      enum startup;
+    }
+    description
+      "Enumeration of possible NETCONF datastore types.";
+    reference
+      "RFC 4741: NETCONF Configuration Protocol";
+  }
+
+  identity transport {
+    description
+      "Base identity for NETCONF transport types.";
+  }
+
+  identity netconf-ssh {
+    base transport;
+    description
+      "NETCONF over Secure Shell (SSH).";
+    reference
+      "RFC 4742: Using the NETCONF Configuration Protocol
+                 over Secure SHell (SSH)";
+  }
+
+  identity netconf-soap-over-beep {
+    base transport;
+    description
+      "NETCONF over Simple Object Access Protocol (SOAP) over
+       Blocks Extensible Exchange Protocol (BEEP).";
+
+    reference
+      "RFC 4743: Using NETCONF over the Simple Object
+                 Access Protocol (SOAP)";
+  }
+
+  identity netconf-soap-over-https {
+    base transport;
+    description
+      "NETCONF over Simple Object Access Protocol (SOAP)
+      over Hypertext Transfer Protocol Secure (HTTPS).";
+    reference
+      "RFC 4743: Using NETCONF over the Simple Object
+                 Access Protocol (SOAP)";
+  }
+
+  identity netconf-beep {
+    base transport;
+    description
+      "NETCONF over Blocks Extensible Exchange Protocol (BEEP).";
+    reference
+      "RFC 4744: Using the NETCONF Protocol over the
+                 Blocks Extensible Exchange Protocol (BEEP)";
+  }
+
+  identity netconf-tls {
+    base transport;
+    description
+      "NETCONF over Transport Layer Security (TLS).";
+    reference
+      "RFC 5539: NETCONF over Transport Layer Security (TLS)";
+  }
+
+  identity schema-format {
+    description
+      "Base identity for data model schema languages.";
+  }
+
+  identity xsd {
+    base schema-format;
+    description
+      "W3C XML Schema Definition.";
+    reference
+      "W3C REC REC-xmlschema-1-20041028:
+         XML Schema Part 1: Structures";
+  }
+
+  identity yang {
+    base schema-format;
+    description
+      "The YANG data modeling language for NETCONF.";
+    reference
+      "RFC 6020:  YANG - A Data Modeling Language for the
+                  Network Configuration Protocol (NETCONF)";
+  }
+
+  identity yin {
+    base schema-format;
+    description
+      "The YIN syntax for YANG.";
+    reference
+      "RFC 6020:  YANG - A Data Modeling Language for the
+                  Network Configuration Protocol (NETCONF)";
+  }
+
+  identity rng {
+    base schema-format;
+    description
+      "Regular Language for XML Next Generation (RELAX NG).";
+    reference
+      "ISO/IEC 19757-2:2008: RELAX NG";
+  }
+
+  identity rnc {
+    base schema-format;
+    description
+      "Relax NG Compact Syntax";
+    reference
+      "ISO/IEC 19757-2:2008: RELAX NG";
+  }
+
+  grouping common-counters {
+    description
+      "Counters that exist both per session, and also globally,
+       accumulated from all sessions.";
+
+    leaf in-rpcs {
+      type yang:zero-based-counter32;
+      description
+        "Number of correct <rpc> messages received.";
+    }
+    leaf in-bad-rpcs {
+      type yang:zero-based-counter32;
+
+      description
+        "Number of messages received when an <rpc> message was expected,
+         that were not correct <rpc> messages.  This includes XML parse
+         errors and errors on the rpc layer.";
+    }
+    leaf out-rpc-errors {
+      type yang:zero-based-counter32;
+      description
+        "Number of <rpc-reply> messages sent that contained an
+         <rpc-error> element.";
+    }
+    leaf out-notifications {
+      type yang:zero-based-counter32;
+      description
+        "Number of <notification> messages sent.";
+    }
+  }
+
+  container netconf-state {
+    config false;
+    description
+      "The netconf-state container is the root of the monitoring
+       data model.";
+
+    container capabilities {
+      description
+        "Contains the list of NETCONF capabilities supported by the
+         server.";
+
+      leaf-list capability {
+        type inet:uri;
+        description
+          "List of NETCONF capabilities supported by the server.";
+      }
+    }
+
+    container datastores {
+      description
+        "Contains the list of NETCONF configuration datastores.";
+
+      list datastore {
+        key name;
+        description
+          "List of NETCONF configuration datastores supported by
+           the NETCONF server and related information.";
+
+        leaf name {
+          type netconf-datastore-type;
+          description
+            "Name of the datastore associated with this list entry.";
+        }
+        container locks {
+          presence
+            "This container is present only if the datastore
+             is locked.";
+          description
+            "The NETCONF <lock> and <partial-lock> operations allow
+             a client to lock specific resources in a datastore.  The
+             NETCONF server will prevent changes to the locked
+             resources by all sessions except the one that acquired
+             the lock(s).
+             Monitoring information is provided for each datastore
+             entry including details such as the session that acquired
+             the lock, the type of lock (global or partial) and the
+             list of locked resources.  Multiple locks per datastore
+             are supported.";
+
+          grouping lock-info {
+            description
+              "Lock related parameters, common to both global and
+               partial locks.";
+
+            leaf locked-by-session {
+              type uint32;
+              mandatory true;
+              description
+                "The session ID of the session that has locked
+                 this resource.  Both a global lock and a partial
+                 lock MUST contain the NETCONF session-id.
+                 If the lock is held by a session that is not managed
+                 by the NETCONF server (e.g., a CLI session), a session
+                 id of 0 (zero) is reported.";
+              reference
+                "RFC 4741: NETCONF Configuration Protocol";
+            }
+            leaf locked-time {
+              type yang:date-and-time;
+              mandatory true;
+              description
+                "The date and time of when the resource was
+                 locked.";
+            }
+          }
+
+          choice lock-type {
+            description
+              "Indicates if a global lock or a set of partial locks
+               are set.";
+
+            container global-lock {
+              description
+                "Present if the global lock is set.";
+              uses lock-info;
+            }
+
+            list partial-lock {
+              key lock-id;
+              description
+                "List of partial locks.";
+              reference
+                "RFC 5717: Partial Lock Remote Procedure Call (RPC) for
+                           NETCONF";
+
+              leaf lock-id {
+                type uint32;
+                description
+                  "This is the lock id returned in the <partial-lock>
+                   response.";
+              }
+              uses lock-info;
+              leaf-list select {
+                type yang:xpath1.0;
+                min-elements 1;
+                description
+                  "The xpath expression that was used to request
+                   the lock.  The select expression indicates the
+                   original intended scope of the lock.";
+              }
+              leaf-list locked-node {
+                type instance-identifier;
+                description
+                  "The list of instance-identifiers (i.e., the
+                   locked nodes).
+                   The scope of the partial lock is defined by the list
+                   of locked nodes.";
+              }
+            }
+          }
+        }
+      }
+    }
+    container schemas {
+      description
+        "Contains the list of data model schemas supported by the
+         server.";
+
+      list schema {
+        key "identifier version format";
+
+        description
+          "List of data model schemas supported by the server.";
+
+        leaf identifier {
+          type string;
+          description
+            "Identifier to uniquely reference the schema.  The
+             identifier is used in the <get-schema> operation and may
+             be used for other purposes such as file retrieval.
+             For modeling languages that support or require a data
+             model name (e.g., YANG module name) the identifier MUST
+             match that name.  For YANG data models, the identifier is
+             the name of the module or submodule.  In other cases, an
+             identifier such as a filename MAY be used instead.";
+        }
+        leaf version {
+          type string;
+          description
+            "Version of the schema supported.  Multiple versions MAY be
+             supported simultaneously by a NETCONF server.  Each
+             version MUST be reported individually in the schema list,
+             i.e., with same identifier, possibly different location,
+             but different version.
+             For YANG data models, version is the value of the most
+             recent YANG 'revision' statement in the module or
+             submodule, or the empty string if no 'revision' statement
+             is present.";
+        }
+        leaf format {
+          type identityref {
+            base schema-format;
+          }
+          description
+            "The data modeling language the schema is written
+             in (currently xsd, yang, yin, rng, or rnc).
+             For YANG data models, 'yang' format MUST be supported and
+             'yin' format MAY also be provided.";
+        }
+        leaf namespace {
+          type inet:uri;
+          mandatory true;
+          description
+            "The XML namespace defined by the data model.
+             For YANG data models, this is the module's namespace.
+             If the list entry describes a submodule, this field
+             contains the namespace of the module to which the
+             submodule belongs.";
+        }
+        leaf-list location {
+          type union {
+            type enumeration {
+              enum "NETCONF";
+            }
+            type inet:uri;
+          }
+          description
+            "One or more locations from which the schema can be
+             retrieved.  This list SHOULD contain at least one
+             entry per schema.
+             A schema entry may be located on a remote file system
+             (e.g., reference to file system for ftp retrieval) or
+             retrieved directly from a server supporting the
+             <get-schema> operation (denoted by the value 'NETCONF').";
+        }
+      }
+    }
+
+    container sessions {
+      description
+        "The sessions container includes session-specific data for
+         NETCONF management sessions.  The session list MUST include
+         all currently active NETCONF sessions.";
+
+      list session {
+        key session-id;
+        description
+          "All NETCONF sessions managed by the NETCONF server
+           MUST be reported in this list.";
+
+        leaf session-id {
+          type uint32 {
+            range "1..max";
+          }
+          description
+            "Unique identifier for the session.  This value is the
+             NETCONF session identifier, as defined in RFC 4741.";
+          reference
+            "RFC 4741: NETCONF Configuration Protocol";
+        }
+        leaf transport {
+          type identityref {
+            base transport;
+          }
+          mandatory true;
+          description
+            "Identifies the transport for each session, e.g.,
+            'netconf-ssh', 'netconf-soap', etc.";
+        }
+        leaf username  {
+          type string;
+          mandatory true;
+          description
+            "The username is the client identity that was authenticated
+            by the NETCONF transport protocol.  The algorithm used to
+            derive the username is NETCONF transport protocol specific
+            and in addition specific to the authentication mechanism
+            used by the NETCONF transport protocol.";
+        }
+        leaf source-host {
+          type inet:host;
+          description
+            "Host identifier of the NETCONF client.  The value
+             returned is implementation specific (e.g., hostname,
+             IPv4 address, IPv6 address)";
+        }
+        leaf login-time {
+          type yang:date-and-time;
+          mandatory true;
+          description
+            "Time at the server at which the session was established.";
+        }
+        uses common-counters {
+          description
+            "Per-session counters.  Zero based with following reset
+             behaviour:
+               - at start of a session
+               - when max value is reached";
+        }
+      }
+    }
+
+    container statistics {
+      description
+        "Statistical data pertaining to the NETCONF server.";
+
+      leaf netconf-start-time {
+        type yang:date-and-time;
+        description
+          "Date and time at which the management subsystem was
+           started.";
+      }
+      leaf in-bad-hellos {
+        type yang:zero-based-counter32;
+        description
+          "Number of sessions silently dropped because an
+          invalid <hello> message was received.  This includes <hello>
+          messages with a 'session-id' attribute, bad namespace, and
+          bad capability declarations.";
+      }
+      leaf in-sessions {
+        type yang:zero-based-counter32;
+        description
+          "Number of sessions started.  This counter is incremented
+           when a <hello> message with a <session-id> is sent.
+          'in-sessions' - 'in-bad-hellos' =
+              'number of correctly started netconf sessions'";
+      }
+      leaf dropped-sessions {
+        type yang:zero-based-counter32;
+
+        description
+          "Number of sessions that were abnormally terminated, e.g.,
+           due to idle timeout or transport close.  This counter is not
+           incremented when a session is properly closed by a
+           <close-session> operation, or killed by a <kill-session>
+           operation.";
+      }
+      uses common-counters {
+        description
+          "Global counters, accumulated from all sessions.
+           Zero based with following reset behaviour:
+             - re-initialization of NETCONF server
+             - when max value is reached";
+      }
+    }
+  }
+
+  rpc get-schema {
+    description
+      "This operation is used to retrieve a schema from the
+       NETCONF server.
+       Positive Response:
+         The NETCONF server returns the requested schema.
+       Negative Response:
+         If requested schema does not exist, the <error-tag> is
+         'invalid-value'.
+         If more than one schema matches the requested parameters, the
+         <error-tag> is 'operation-failed', and <error-app-tag> is
+         'data-not-unique'.";
+
+    input {
+      leaf identifier {
+        type string;
+        mandatory true;
+        description
+          "Identifier for the schema list entry.";
+      }
+      leaf version {
+        type string;
+        description
+          "Version of the schema requested.  If this parameter is not
+           present, and more than one version of the schema exists on
+           the server, a 'data-not-unique' error is returned, as
+           described above.";
+      }
+      leaf format {
+        type identityref {
+          base schema-format;
+        }
+        description
+           "The data modeling language of the schema.  If this
+            parameter is not present, and more than one formats of
+            the schema exists on the server, a 'data-not-unique' error
+            is returned, as described above.";
+      }
+    }
+    output {
+        anyxml data {
+          description
+            "Contains the schema content.";
+      }
+    }
+  }
+}
diff --git a/ntsimulator/yang/ietf-yang-types.yang b/ntsimulator/yang/ietf-yang-types.yang
new file mode 100755 (executable)
index 0000000..45b8c55
--- /dev/null
@@ -0,0 +1,435 @@
+module ietf-yang-types {
+
+namespace "urn:ietf:params:xml:ns:yang:ietf-yang-types";
+prefix "yang";
+
+organization
+ "IETF NETMOD (NETCONF Data Modeling Language) Working Group";
+
+contact
+ "WG Web:   <http://tools.ietf.org/wg/netmod/>
+  WG List:  <mailto:netmod@ietf.org>
+  WG Chair: David Kessens
+            <mailto:david.kessens@nsn.com>
+  WG Chair: Juergen Schoenwaelder
+            <mailto:j.schoenwaelder@jacobs-university.de>
+  Editor:   Juergen Schoenwaelder
+            <mailto:j.schoenwaelder@jacobs-university.de>";
+
+description
+ "This module contains a collection of generally useful derived
+  YANG data types.
+  Copyright (c) 2013 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
+  (http://trustee.ietf.org/license-info).
+  This version of this YANG module is part of RFC 6991; see
+  the RFC itself for full legal notices.";
+
+revision 2013-07-15 {
+  description
+   "This revision adds the following new data types:
+    - yang-identifier
+    - hex-string
+    - uuid
+    - dotted-quad";
+  reference
+   "RFC 6991: Common YANG Data Types";
+}
+
+revision 2010-09-24 {
+  description
+   "Initial revision.";
+  reference
+   "RFC 6021: Common YANG Data Types";
+}
+
+/*** collection of counter and gauge types ***/
+
+typedef counter32 {
+  type uint32;
+  description
+   "The counter32 type represents a non-negative integer
+    that monotonically increases until it reaches a
+    maximum value of 2^32-1 (4294967295 decimal), when it
+    wraps around and starts increasing again from zero.
+    Counters have no defined 'initial' value, and thus, a
+    single value of a counter has (in general) no information
+    content.  Discontinuities in the monotonically increasing
+    value normally occur at re-initialization of the
+    management system, and at other times as specified in the
+    description of a schema node using this type.  If such
+    other times can occur, for example, the creation of
+    a schema node of type counter32 at times other than
+    re-initialization, then a corresponding schema node
+    should be defined, with an appropriate type, to indicate
+    the last discontinuity.
+    The counter32 type should not be used for configuration
+    schema nodes.  A default statement SHOULD NOT be used in
+    combination with the type counter32.
+    In the value set and its semantics, this type is equivalent
+    to the Counter32 type of the SMIv2.";
+  reference
+   "RFC 2578: Structure of Management Information Version 2
+              (SMIv2)";
+}
+
+typedef zero-based-counter32 {
+  type yang:counter32;
+  default "0";
+  description
+   "The zero-based-counter32 type represents a counter32
+    that has the defined 'initial' value zero.
+    A schema node of this type will be set to zero (0) on creation
+    and will thereafter increase monotonically until it reaches
+    a maximum value of 2^32-1 (4294967295 decimal), when it
+    wraps around and starts increasing again from zero.
+    Provided that an application discovers a new schema node
+    of this type within the minimum time to wrap, it can use the
+    'initial' value as a delta.  It is important for a management
+    station to be aware of this minimum time and the actual time
+    between polls, and to discard data if the actual time is too
+    long or there is no defined minimum time.
+    In the value set and its semantics, this type is equivalent
+    to the ZeroBasedCounter32 textual convention of the SMIv2.";
+  reference
+    "RFC 4502: Remote Network Monitoring Management Information
+               Base Version 2";
+}
+
+typedef counter64 {
+  type uint64;
+  description
+   "The counter64 type represents a non-negative integer
+    that monotonically increases until it reaches a
+    maximum value of 2^64-1 (18446744073709551615 decimal),
+    when it wraps around and starts increasing again from zero.
+    Counters have no defined 'initial' value, and thus, a
+    single value of a counter has (in general) no information
+    content.  Discontinuities in the monotonically increasing
+    value normally occur at re-initialization of the
+    management system, and at other times as specified in the
+    description of a schema node using this type.  If such
+    other times can occur, for example, the creation of
+    a schema node of type counter64 at times other than
+    re-initialization, then a corresponding schema node
+    should be defined, with an appropriate type, to indicate
+    the last discontinuity.
+    The counter64 type should not be used for configuration
+    schema nodes.  A default statement SHOULD NOT be used in
+    combination with the type counter64.
+    In the value set and its semantics, this type is equivalent
+    to the Counter64 type of the SMIv2.";
+  reference
+   "RFC 2578: Structure of Management Information Version 2
+              (SMIv2)";
+}
+
+typedef zero-based-counter64 {
+  type yang:counter64;
+  default "0";
+  description
+   "The zero-based-counter64 type represents a counter64 that
+    has the defined 'initial' value zero.
+    A schema node of this type will be set to zero (0) on creation
+    and will thereafter increase monotonically until it reaches
+    a maximum value of 2^64-1 (18446744073709551615 decimal),
+    when it wraps around and starts increasing again from zero.
+    Provided that an application discovers a new schema node
+    of this type within the minimum time to wrap, it can use the
+    'initial' value as a delta.  It is important for a management
+    station to be aware of this minimum time and the actual time
+    between polls, and to discard data if the actual time is too
+    long or there is no defined minimum time.
+    In the value set and its semantics, this type is equivalent
+    to the ZeroBasedCounter64 textual convention of the SMIv2.";
+  reference
+   "RFC 2856: Textual Conventions for Additional High Capacity
+              Data Types";
+}
+
+typedef gauge32 {
+  type uint32;
+  description
+   "The gauge32 type represents a non-negative integer, which
+    may increase or decrease, but shall never exceed a maximum
+    value, nor fall below a minimum value.  The maximum value
+    cannot be greater than 2^32-1 (4294967295 decimal), and
+    the minimum value cannot be smaller than 0.  The value of
+    a gauge32 has its maximum value whenever the information
+    being modeled is greater than or equal to its maximum
+    value, and has its minimum value whenever the information
+    being modeled is smaller than or equal to its minimum value.
+    If the information being modeled subsequently decreases
+    below (increases above) the maximum (minimum) value, the
+    gauge32 also decreases (increases).
+    In the value set and its semantics, this type is equivalent
+    to the Gauge32 type of the SMIv2.";
+  reference
+   "RFC 2578: Structure of Management Information Version 2
+              (SMIv2)";
+}
+
+typedef gauge64 {
+  type uint64;
+  description
+   "The gauge64 type represents a non-negative integer, which
+    may increase or decrease, but shall never exceed a maximum
+    value, nor fall below a minimum value.  The maximum value
+    cannot be greater than 2^64-1 (18446744073709551615), and
+    the minimum value cannot be smaller than 0.  The value of
+    a gauge64 has its maximum value whenever the information
+    being modeled is greater than or equal to its maximum
+    value, and has its minimum value whenever the information
+    being modeled is smaller than or equal to its minimum value.
+    If the information being modeled subsequently decreases
+    below (increases above) the maximum (minimum) value, the
+    gauge64 also decreases (increases).
+    In the value set and its semantics, this type is equivalent
+    to the CounterBasedGauge64 SMIv2 textual convention defined
+    in RFC 2856";
+  reference
+   "RFC 2856: Textual Conventions for Additional High Capacity
+              Data Types";
+}
+
+/*** collection of identifier-related types ***/
+
+typedef object-identifier {
+  type string {
+    pattern '(([0-1](\.[1-3]?[0-9]))|(2\.(0|([1-9]\d*))))'
+          + '(\.(0|([1-9]\d*)))*';
+  }
+  description
+   "The object-identifier type represents administratively
+    assigned names in a registration-hierarchical-name tree.
+    Values of this type are denoted as a sequence of numerical
+    non-negative sub-identifier values.  Each sub-identifier
+    value MUST NOT exceed 2^32-1 (4294967295).  Sub-identifiers
+    are separated by single dots and without any intermediate
+    whitespace.
+    The ASN.1 standard restricts the value space of the first
+    sub-identifier to 0, 1, or 2.  Furthermore, the value space
+    of the second sub-identifier is restricted to the range
+    0 to 39 if the first sub-identifier is 0 or 1.  Finally,
+    the ASN.1 standard requires that an object identifier
+    has always at least two sub-identifiers.  The pattern
+    captures these restrictions.
+    Although the number of sub-identifiers is not limited,
+    module designers should realize that there may be
+    implementations that stick with the SMIv2 limit of 128
+    sub-identifiers.
+    This type is a superset of the SMIv2 OBJECT IDENTIFIER type
+    since it is not restricted to 128 sub-identifiers.  Hence,
+    this type SHOULD NOT be used to represent the SMIv2 OBJECT
+    IDENTIFIER type; the object-identifier-128 type SHOULD be
+    used instead.";
+  reference
+   "ISO9834-1: Information technology -- Open Systems
+    Interconnection -- Procedures for the operation of OSI
+    Registration Authorities: General procedures and top
+    arcs of the ASN.1 Object Identifier tree";
+}
+
+typedef object-identifier-128 {
+  type object-identifier {
+    pattern '\d*(\.\d*){1,127}';
+  }
+  description
+   "This type represents object-identifiers restricted to 128
+    sub-identifiers.
+    In the value set and its semantics, this type is equivalent
+    to the OBJECT IDENTIFIER type of the SMIv2.";
+  reference
+   "RFC 2578: Structure of Management Information Version 2
+              (SMIv2)";
+}
+
+typedef yang-identifier {
+  type string {
+    length "1..max";
+    pattern '[a-zA-Z_][a-zA-Z0-9\-_.]*';
+    pattern '.|..|[^xX].*|.[^mM].*|..[^lL].*';
+  }
+  description
+    "A YANG identifier string as defined by the 'identifier'
+     rule in Section 12 of RFC 6020.  An identifier must
+     start with an alphabetic character or an underscore
+     followed by an arbitrary sequence of alphabetic or
+     numeric characters, underscores, hyphens, or dots.
+     A YANG identifier MUST NOT start with any possible
+     combination of the lowercase or uppercase character
+     sequence 'xml'.";
+  reference
+    "RFC 6020: YANG - A Data Modeling Language for the Network
+               Configuration Protocol (NETCONF)";
+}
+
+/*** collection of types related to date and time***/
+
+typedef date-and-time {
+  type string {
+    pattern '\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?'
+          + '(Z|[\+\-]\d{2}:\d{2})';
+  }
+  description
+   "The date-and-time type is a profile of the ISO 8601
+    standard for representation of dates and times using the
+    Gregorian calendar.  The profile is defined by the
+    date-time production in Section 5.6 of RFC 3339.
+    The date-and-time type is compatible with the dateTime XML
+    schema type with the following notable exceptions:
+    (a) The date-and-time type does not allow negative years.
+    (b) The date-and-time time-offset -00:00 indicates an unknown
+        time zone (see RFC 3339) while -00:00 and +00:00 and Z
+        all represent the same time zone in dateTime.
+    (c) The canonical format (see below) of data-and-time values
+        differs from the canonical format used by the dateTime XML
+        schema type, which requires all times to be in UTC using
+        the time-offset 'Z'.
+    This type is not equivalent to the DateAndTime textual
+    convention of the SMIv2 since RFC 3339 uses a different
+    separator between full-date and full-time and provides
+    higher resolution of time-secfrac.
+    The canonical format for date-and-time values with a known time
+    zone uses a numeric time zone offset that is calculated using
+    the device's configured known offset to UTC time.  A change of
+    the device's offset to UTC time will cause date-and-time values
+    to change accordingly.  Such changes might happen periodically
+    in case a server follows automatically daylight saving time
+    (DST) time zone offset changes.  The canonical format for
+    date-and-time values with an unknown time zone (usually
+    referring to the notion of local time) uses the time-offset
+    -00:00.";
+  reference
+   "RFC 3339: Date and Time on the Internet: Timestamps
+    RFC 2579: Textual Conventions for SMIv2
+    XSD-TYPES: XML Schema Part 2: Datatypes Second Edition";
+}
+
+typedef timeticks {
+  type uint32;
+  description
+   "The timeticks type represents a non-negative integer that
+    represents the time, modulo 2^32 (4294967296 decimal), in
+    hundredths of a second between two epochs.  When a schema
+    node is defined that uses this type, the description of
+    the schema node identifies both of the reference epochs.
+    In the value set and its semantics, this type is equivalent
+    to the TimeTicks type of the SMIv2.";
+  reference
+   "RFC 2578: Structure of Management Information Version 2
+              (SMIv2)";
+}
+
+typedef timestamp {
+  type yang:timeticks;
+  description
+   "The timestamp type represents the value of an associated
+    timeticks schema node at which a specific occurrence
+    happened.  The specific occurrence must be defined in the
+    description of any schema node defined using this type.  When
+    the specific occurrence occurred prior to the last time the
+    associated timeticks attribute was zero, then the timestamp
+    value is zero.  Note that this requires all timestamp values
+    to be reset to zero when the value of the associated timeticks
+    attribute reaches 497+ days and wraps around to zero.
+    The associated timeticks schema node must be specified
+    in the description of any schema node using this type.
+    In the value set and its semantics, this type is equivalent
+    to the TimeStamp textual convention of the SMIv2.";
+  reference
+   "RFC 2579: Textual Conventions for SMIv2";
+}
+
+/*** collection of generic address types ***/
+
+typedef phys-address {
+  type string {
+    pattern '([0-9a-fA-F]{2}(:[0-9a-fA-F]{2})*)?';
+  }
+
+  description
+   "Represents media- or physical-level addresses represented
+    as a sequence octets, each octet represented by two hexadecimal
+    numbers.  Octets are separated by colons.  The canonical
+    representation uses lowercase characters.
+    In the value set and its semantics, this type is equivalent
+    to the PhysAddress textual convention of the SMIv2.";
+  reference
+   "RFC 2579: Textual Conventions for SMIv2";
+}
+
+typedef mac-address {
+  type string {
+    pattern '[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}';
+  }
+  description
+   "The mac-address type represents an IEEE 802 MAC address.
+    The canonical representation uses lowercase characters.
+    In the value set and its semantics, this type is equivalent
+    to the MacAddress textual convention of the SMIv2.";
+  reference
+   "IEEE 802: IEEE Standard for Local and Metropolitan Area
+              Networks: Overview and Architecture
+    RFC 2579: Textual Conventions for SMIv2";
+}
+
+/*** collection of XML-specific types ***/
+
+typedef xpath1.0 {
+  type string;
+  description
+   "This type represents an XPATH 1.0 expression.
+    When a schema node is defined that uses this type, the
+    description of the schema node MUST specify the XPath
+    context in which the XPath expression is evaluated.";
+  reference
+   "XPATH: XML Path Language (XPath) Version 1.0";
+}
+
+/*** collection of string types ***/
+
+typedef hex-string {
+  type string {
+    pattern '([0-9a-fA-F]{2}(:[0-9a-fA-F]{2})*)?';
+  }
+  description
+   "A hexadecimal string with octets represented as hex digits
+    separated by colons.  The canonical representation uses
+    lowercase characters.";
+}
+
+typedef uuid {
+  type string {
+    pattern '[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-'
+          + '[0-9a-fA-F]{4}-[0-9a-fA-F]{12}';
+  }
+  description
+   "A Universally Unique IDentifier in the string representation
+    defined in RFC 4122.  The canonical representation uses
+    lowercase characters.
+    The following is an example of a UUID in string representation:
+    f81d4fae-7dec-11d0-a765-00a0c91e6bf6
+    ";
+  reference
+   "RFC 4122: A Universally Unique IDentifier (UUID) URN
+              Namespace";
+}
+
+typedef dotted-quad {
+  type string {
+    pattern
+      '(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}'
+    + '([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])';
+  }
+  description
+    "An unsigned 32-bit number expressed in the dotted-quad
+     notation, i.e., four octets written as decimal numbers
+     and separated with the '.' (full stop) character.";
+}
+}
diff --git a/ntsimulator/yang/manager/network-topology-simulator.xml b/ntsimulator/yang/manager/network-topology-simulator.xml
new file mode 100644 (file)
index 0000000..5f1b481
--- /dev/null
@@ -0,0 +1,22 @@
+<simulator-config xmlns="urn:onf:params:xml:ns:yang:network-topology-simulator">
+       <simulated-devices>0</simulated-devices>
+       <mounted-devices>0</mounted-devices>
+       <notification-config>
+               <fault-notification-delay-period>0</fault-notification-delay-period>
+               <ves-heartbeat-period>0</ves-heartbeat-period>
+               <is-netconf-available>true</is-netconf-available>
+               <is-ves-available>true</is-ves-available>
+       </notification-config>
+       <controller-details>
+               <controller-ip>172.17.0.1</controller-ip>
+               <controller-port>8181</controller-port>
+               <controller-username>admin</controller-username>
+               <controller-password>admin</controller-password>
+       </controller-details>
+       <ves-endpoint-details>
+               <ves-endpoint-ip>172.17.0.1</ves-endpoint-ip>
+               <ves-endpoint-port>30007</ves-endpoint-port>
+               <ves-endpoint-auth-method>no-auth</ves-endpoint-auth-method>
+               <ves-registration>false</ves-registration>
+       </ves-endpoint-details>
+</simulator-config>
\ No newline at end of file
diff --git a/ntsimulator/yang/manager/network-topology-simulator.yang b/ntsimulator/yang/manager/network-topology-simulator.yang
new file mode 100644 (file)
index 0000000..ac2cf8d
--- /dev/null
@@ -0,0 +1,297 @@
+module network-topology-simulator {
+  yang-version 1.1;
+  namespace "urn:onf:params:xml:ns:yang:network-topology-simulator";
+  prefix network-topology-simulator;
+
+  import ietf-inet-types {
+    prefix inet;
+  }
+
+  organization
+    "Melacon";
+  contact
+    "Web: <https://github.com/Melacon>
+     Editors:  Alex Stancu
+               <mailto:stancu.liviualex@gmail.com>";
+  description
+    "This module contains a collection of YANG definitions for managing the Network Topology Simulator.";
+
+  revision 2019-10-25 {
+    description
+      "Modify notifications. Add VES message configuration options.";
+    reference
+      "O-RAN SC SIM project";
+  }
+  revision 2019-06-07 {
+    description
+      "Modify controller details.";
+    reference
+      "O-RAN SC SIM project";
+  }
+  revision 2019-03-07 {
+    description
+      "Initial version";
+    reference
+      "O-RAN SC SIM project";
+  }
+
+  typedef operational-state-type {
+    type enumeration {
+      enum not-specified {
+        description
+          "none";
+      }
+      enum running {
+        description
+          "none";
+      }
+      enum created {
+        description
+          "none";
+      }
+      enum exited {
+        description
+          "none";
+      }
+    }
+    description
+      "The operation state of the simulated device.";
+  }
+
+  typedef authentication-method-type {
+    type enumeration {
+      enum no-auth {
+        description
+          "no security (http)";
+      }
+      enum cert-only {
+        description
+          "auth by certificate (https)";
+      }
+      enum basic-auth {
+        description
+          "auth by basic auth username and password (https)";
+      }
+      enum cert-basic-auth {
+        description
+          "auth by certificate and basic auth username / password (https)";
+      }
+    }
+    description
+      "The authentication method for VES messaging.";
+  }
+
+  typedef percent {
+    type decimal64 {
+      fraction-digits 2;
+      range "0 .. 100";
+    }
+    description
+      "Percentage";
+  }
+
+  grouping controller-details-type-g {
+    leaf controller-ip {
+      type inet:ip-address;
+      description
+        "The IP Address of the SDN Controller.";
+    }
+    leaf controller-port {
+      type inet:port-number;
+      description
+        "The Port of the SDN Controller.";
+    }
+    leaf controller-username {
+      type string;
+      description
+        "The Username of the SDN Controller.";
+    }
+    leaf controller-password {
+      type string;
+      description
+        "The Password of the SDN Controller.";
+    }
+    description
+      "none";
+  }
+
+  grouping simulated-devices-type-g {
+    leaf uuid {
+      type string;
+      description
+        "The UUID of the simulated device.";
+    }
+    leaf device-ip {
+      type string;
+      description
+        "The IP Address of the simulated device.";
+    }
+    leaf-list device-port {
+      type uint32;
+      description
+        "A NETCONF endpoint (port) of the simulated device.";
+    }
+    leaf is-mounted {
+      type boolean;
+      description
+        "Specifies if the simulated device is mounted in the SDN Controller.";
+    }
+    leaf operational-state {
+      type operational-state-type;
+      description
+        "Specifies the operational state of the simulated device.";
+    }
+    description
+      "none";
+  }
+
+  container simulator-config {
+    description
+      "Configuration container of the simulator.";
+    leaf simulated-devices {
+      type uint32;
+      default "0";
+      description
+        "The number of devices to be simulated.";
+    }
+    leaf mounted-devices {
+      type uint32;
+      default "0";
+      description
+        "The number of devices to be mounted in ODL. The configured number should not exceed the number of mounted devices.";
+    }
+    container notification-config {
+      leaf fault-notification-delay-period {
+        type uint32;
+        default "0";
+        description
+          "Interval in seconds between two consecutive notifications. If the attribute is set to 0, nofitications are not generated.";
+      }
+      leaf ves-heartbeat-period {
+        type uint32;
+        default "0";
+        description
+          "Interval in seconds between two VES heartbeat messages. If the attribute is set to 0, heartbeat messages are not generated.";
+      }
+      leaf is-netconf-available {
+        type boolean;
+        default "true";
+        description
+          "If set to 'true', NETCONF notifications will be generated.";
+      }
+      leaf is-ves-available {
+        type boolean;
+        default "true";
+        description
+          "If set to 'true', VES messages will be generated.";
+      }
+      description
+        "none";
+    }
+    container controller-details {
+      uses controller-details-type-g;
+      description
+        "The connectivity details of the SDN Controller where we want to mount our simulated devices.";
+    }
+    container ves-endpoint-details {
+      must 'ves-registration = "false" or ../mounted-devices = 0' {
+        error-message "VES registration cannot be active while devices are still mounted to ODL not via VES.";
+      }
+      leaf ves-endpoint-ip {
+        type inet:ip-address;
+        description
+          "The IP Address of the VES Endpoint.";
+      }
+      leaf ves-endpoint-port {
+        type inet:port-number;
+        description
+          "The Port of the VES Endpoint.";
+      }
+      leaf ves-endpoint-auth-method {
+        type authentication-method-type;
+        default "no-auth";
+        description
+          "The type of the authentication to be used with the VES Endpoint.";
+      }
+      leaf ves-endpoint-username {
+        when "../ves-endpoint-auth-method = 'basic-auth' or ../ves-endpoint-auth-method = 'cert-basic-auth'";
+        type string;
+        description
+          "The Username to be used to authenticate to the VES Endpoint.";
+      }
+      leaf ves-endpoint-password {
+        when "../ves-endpoint-auth-method = 'basic-auth' or ../ves-endpoint-auth-method = 'cert-basic-auth'";
+        type string;
+        description
+          "The Password to be used to authenticate to the VES Endpoint.";
+      }
+      leaf ves-endpoint-certificate {
+        when "../ves-endpoint-auth-method = 'cert-only' or ../ves-endpoint-auth-method = 'cert-basic-auth'";
+        type string;
+        description
+          "The Certificate to be used to authenticate to the VES Endpoint.";
+      }
+      leaf ves-registration {
+        type boolean;
+        default "false";
+        description
+          "If this is set to 'True', the simulated devices will automatically send a pnfRegistration VES message when they start. This cannot be set to 'True' if we already have 'mounted-devices' greater that 0, because we already mounted the devices directly to ODL.";
+      }
+      description
+        "none";
+    }
+  }
+  container simulator-status {
+    config false;
+    container simulation-usage-details {
+      config false;
+      leaf running-simulated-devices {
+        type uint32;
+        description
+          "The current number of running simulated devices.";
+      }
+      leaf running-mounted-devices {
+        type uint32;
+        description
+          "The current number of running simulated devices that are mounted in ODL.";
+      }
+      leaf base-netconf-port {
+        type uint32;
+        default "30000";
+        description
+          "The starting port number for the NETCONF connections exposed.";
+      }
+      leaf cpu-usage {
+        type percent;
+        description
+          "Specifies the CPU load generated by this simulated device.";
+      }
+      leaf mem-usage {
+        type uint32;
+        description
+          "Specifies the RAM in MB used by this simulated device.";
+      }
+      description
+        "The details about the simulation, including resources consumed.";
+    }
+    list simulated-devices-list {
+      key "uuid";
+      config false;
+      uses simulated-devices-type-g;
+      description
+        "The list of the devices that are currently simulated.";
+    }
+    description
+      "State data container of the simulator.";
+  }
+
+  rpc restart-simulation {
+    description
+      "Operation to restart all the simulated devices with the new configuration of the simulator.";
+  }
+
+  rpc add-key-pair-to-odl {
+    description
+      "Operation to add a key pair signed by the NTS to OpenDaylight, such that it can connect to devices using TLS.";
+  }
+}
diff --git a/ntsimulator/yang/o-ran-alarm-id.yang b/ntsimulator/yang/o-ran-alarm-id.yang
new file mode 100644 (file)
index 0000000..efc033e
--- /dev/null
@@ -0,0 +1,184 @@
+module o-ran-alarm-id {
+  yang-version 1.1;
+  namespace "urn:o-ran:alarms:1.0";
+  prefix "o-ran-alarms";
+
+  organization "oO-RAN Alliance";
+
+  contact
+    "www.o-ran.org";
+
+  description
+    "This module defines the alarm identities for the oRAN Equipment.
+
+    Copyright 2019 the O-RAN Alliance.
+
+    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS '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 SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 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.
+
+    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 above disclaimer.
+    * Redistributions in binary form must reproduce the above copyright notice,
+    this list of conditions and the above disclaimer in the documentation
+    and/or other materials provided with the distribution.
+    * Neither the Members of the O-RAN Alliance nor the names of its
+    contributors may be used to endorse or promote products derived from
+    this software without specific prior written permission.";
+
+  revision "2019-02-04" {
+    description
+      "version 1.0.0
+
+      1) imported model from xRAN
+      2) changed namespace and reference from xran to o-ran";
+
+    reference "ORAN-WG4.M.0-v01.00";
+  }
+
+
+  typedef alarm-id {
+    type enumeration {
+      enum ORAN_HIGH_TEMP_ALARM {
+        value 1;
+        description "A temperature is higher than expected";
+      }
+      enum ORAN_OVERHEATING_ALARM {
+        value 2;
+        description "A temperature is dangerously high";
+      }
+      enum ORAN_AMBIENT_TEMP_ALARM {
+        value 3;
+        description "A temperature related alarm due to ambient temperature
+        value going outside the allowed ambient temperature range";
+      }
+      enum ORAN_TEMP_TOO_LOW_ALARM {
+        value 4;
+        description "A temperature related alarm due to the temperature inside
+        the unit being too low";
+      }
+      enum ORAN_BROKEN_FAN_ALARM {
+        value 5;
+        description "A broken fan";
+      }
+      enum ORAN_FAN_NOT_DETECTED_ALARM {
+        value 6;
+        description "A fan not detected";
+      }
+      enum ORAN_TUNING_ALARM {
+        value 7;
+        description "A tuning failure.";
+      }
+      enum ORAN_FILTER_ALARM {
+        value 8;
+        description "A faulty filter.";
+      }
+      enum ORAN_TX_QUALITY_ALARM {
+        value 9;
+        description "A transmission quality.";
+      }
+      enum ORAN_OVERVOLTAGE_ALARM {
+        value 10;
+        description "A RF  overvoltage protection.";
+      }
+      enum ORAN_CONFIG_ALARM {
+        value 11;
+        description "A configuration failed.";
+      }
+      enum ORAN_CRITICAL_FILE_ALARM {
+        value 12;
+        description "A Critical file not found.";
+      }
+      enum ORAN_FILE_ALARM {
+        value 13;
+        description "A non-critical file not found.";
+      }
+      enum ORAN_CORRUPT_FILE_ALARM {
+        value 14;
+        description "A corrupt configuration file.";
+      }
+      enum ORAN_OPERATION_ALARM {
+        value 15;
+        description "A unit out of order.";
+      }
+      enum ORAN_NO_IDENTITY_ALARM {
+        value 16;
+        description "A unit cannot be identified.";
+      }
+      enum ORAN_NO_EXT_SYNC_SOURCE {
+        value 17;
+        description "A unit has no external sync source.";
+      }
+      enum ORAN_SYNC_ALARM {
+        value 18;
+        description "A unit is out of synchronization.";
+      }
+      enum ORAN_TX_OUT_OF_ORDER_ALARM {
+        value 19;
+        description "A TX path is not usable.";
+      }
+      enum ORAN_RX_OUT_OF_ORDER_ALARM {
+        value 20;
+        description "A RX path is not usable.";
+      }
+      enum ORAN_OPTICAL_BER_ALARM {
+        value 21;
+        description "An increased bit error rate on the optical link";
+      }
+      enum ORAN_SELF_TEST_ALARM {
+        value 22;
+        description "A power-on self test";
+      }
+      enum ORAN_FPGA_UPDATE_ALARM {
+        value 23;
+        description "An FPGA software update";
+      }
+      enum ORAN_UNIT_BLOCKED_ALARM {
+        value 24;
+        description "A unit is blocked";
+      }
+      enum ORAN_RESET_REQUEST_ALARM {
+        value 25;
+        description "A unit requires a reset";
+      }
+      enum ORAN_POWER_SUPPLY_FAULTY {
+        value 26;
+        description "A power supply unit has a fault";
+      }
+      enum ORAN_POWER_AMPLIFIER_FAULTY {
+        value 27;
+        description "A power amplifier unit has a fault";
+      }
+      enum ORAN_C_U_PLANE_LOGICAL_CONNECTION_FAULTY {
+        value 28;
+        description "A C/U-plane logical connection has a fault";
+      }
+      enum ORAN_TRANSCEIVER_FAULT {
+        value 29;
+        description "A transceiver unit has a fault";
+      }
+      enum ORAN_INTERFACE_FAULT {
+        value 30;
+        description "An interface unit has a fault";
+      }
+      enum ORAN_UNEXPECTED_C_U_PLANE_MESSAGE_CONTENT_FAULT {
+        value 31;
+        description "C/U-plane message content was faulty for undetermined reason.";
+      }
+    }
+    description
+      "A typedef defining an enumerated list of O-RAN alarms which corresponds to
+      the fault-id in the o-ran management plane specification.";
+  }
+}
diff --git a/ntsimulator/yang/o-ran-ald-port.yang b/ntsimulator/yang/o-ran-ald-port.yang
new file mode 100644 (file)
index 0000000..366cba4
--- /dev/null
@@ -0,0 +1,238 @@
+module o-ran-ald-port {
+  yang-version 1.1;
+  namespace "urn:o-ran:ald-port:1.0";
+  prefix "o-ran-ald-port";
+
+  organization "O-RAN Alliance";
+
+  contact
+    "www.o-ran.org";
+
+  description
+    "This module defines the input state and output configuration for
+    the Antenna Line Device capability.
+
+    Copyright 2019 the O-RAN Alliance.
+
+    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS '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 SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 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.
+
+    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 above disclaimer.
+    * Redistributions in binary form must reproduce the above copyright notice,
+    this list of conditions and the above disclaimer in the documentation
+    and/or other materials provided with the distribution.
+    * Neither the Members of the O-RAN Alliance nor the names of its
+    contributors may be used to endorse or promote products derived from
+    this software without specific prior written permission.";
+
+  revision "2019-03-07" {
+    description
+      "version 1.0.1
+
+      1) backward compatible changes to introduce groupings.";
+
+    reference "ORAN-WG4.M.0-v01.00";
+  }
+
+  revision "2019-02-04" {
+    description
+      "version 1.0.0
+
+      1) imported model from xRAN
+      2) changed namespace and reference from xran to o-ran";
+
+    reference "ORAN-WG4.M.0-v01.00";
+  }
+
+
+  feature OVERCURRENT-SUPPORTED {
+    description
+      "This feature indicates that the equipment supports the over-current notification
+      capability.";
+  }
+
+// Groupings
+
+  grouping aldport-group {
+    leaf over-current-supported {
+      type boolean;
+      config false;
+      description
+        "Set to TRUE when the equipment supports over curent notifications";
+    }
+
+    list ald-port {
+      key "name";
+
+      config false;
+
+      description
+        "Leaf nodes describing ALD Port";
+      leaf name {
+        type string {
+          length "1..255";
+        }
+        description
+          "A name that is unique that identifies a ald port instance.
+          This name may be used in fault management to refer to a fault source
+          or affected object";
+      }
+
+      leaf port-id {
+        type uint8;
+            config false;
+            mandatory true;
+
+            description
+          "A number which identifies an ALD Port.
+          The number of the Physical ALD port connector in the module.
+          If the module supports 2 ALD Port connectors, use 0 and 1.";
+      }
+
+      leaf dc-control-support{
+        type boolean;
+        config false;
+            mandatory true;
+
+            description
+          "It is shown that on/off in the DC power supply is possible.
+          In case of False, power supply is always on.";
+      }
+
+      leaf dc-enabled-status {
+        when "../dc-control-support = 'true'";
+        type boolean;
+        default false;
+        description
+          "Status of DC voltage enabled on antenna line.
+          Valid only in case dc-control-support is true.";
+      }
+
+      leaf supported-connector{
+        type enumeration {
+              enum ANTENNA_CONNECTOR {
+                description
+                    "This ald port is related to antenna connector";
+              }
+              enum RS485_PORT {
+                description
+                    "This ald port is related to RS485 port";
+              }
+            }
+        config false;
+            mandatory true;
+
+            description
+          "Informs about the connectors of Module which ALDs are connected to.
+          This value is depending on HW design.";
+      }
+    }
+
+    list ald-port-dc-control {
+      key "name";
+
+      description
+        "Container needed to manage DC on ALD ports";
+
+      leaf name {
+        type leafref {
+          path "/ald-ports-io/ald-port/name";
+          require-instance false;
+        }
+        mandatory true;
+
+        description
+          "Name derived from unmodifiable list ald-port";
+      }
+
+      leaf dc-enabled{
+        type boolean;
+
+        description
+          "If dc-control-support is true case, this leaf is effective.
+          If dc-control-support is not true this leaf makes no action
+          In case of true, the power supply shall be turned on.";
+      }
+    }
+  }
+
+  grouping overcurrent-group {
+    container overload-condition {
+      description
+        "Container used in notification";
+
+      leaf-list overloaded-ports {
+        type leafref {
+          path "/ald-ports-io/ald-port/name";
+        }
+        description
+          "List of overloaded ports";
+      }
+    }
+  }
+
+  grouping dc-enabled-group {
+    list ald-port {
+      key name;
+      description
+        "list of ald-ports that has its dc-enabled-status changed";
+      leaf name{
+        type leafref {
+          path "/ald-ports-io/ald-port/name";
+        }
+        description "Name of port which has changed";
+      }
+      leaf dc-enabled-status{
+        type leafref {
+          path "/ald-ports-io/ald-port/dc-enabled-status";
+        }
+        description "New staus of dc-enabled-status";
+      }
+    }
+  }
+
+// Top Level Container
+
+  container ald-ports-io {
+    description
+      "ALD port information.
+       ALD port of the equipment that can be used to connect External Equipment (Antenna Line Devices).
+       Communication uses AISG over HDLC.
+       Physical connection depends on connector type offered by the port (RS-485 or antenna line)
+       Note: Single instance of ALD Port can point to more than one antenna line devices.";
+
+    uses aldport-group;
+  }
+
+  notification overcurrent-report {
+    if-feature OVERCURRENT-SUPPORTED;
+
+    description
+      "The equipment is able to report overcurrent condition about Port.
+      This function is depending on HW design.
+      The notification depend on power consumption which connected ALD devices and module.";
+
+    uses overcurrent-group;
+  }
+
+  notification dc-enabled-status-change {
+    description
+      "The equipment is able to report the change of 'dc-enabled-status' of the ald-port.
+      This is applicable when the leaf 'dc-control-support' of the ald-pot is 'TRUE'.";
+      
+    uses dc-enabled-group;
+  }
+}
diff --git a/ntsimulator/yang/o-ran-ald.yang b/ntsimulator/yang/o-ran-ald.yang
new file mode 100644 (file)
index 0000000..55461db
--- /dev/null
@@ -0,0 +1,161 @@
+module o-ran-ald {
+  yang-version 1.1;
+  namespace "urn:o-ran:ald:1.0";
+  prefix "o-ran-ald";
+
+  import o-ran-ald-port {
+    prefix "ap";
+  }
+
+  organization "O-RAN Alliance";
+
+  contact
+    "www.o-ran.org";
+
+  description
+    "This module defines the module for the ald communication.
+
+    Copyright 2019 the O-RAN Alliance.
+
+    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS '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 SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 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.
+
+    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 above disclaimer.
+    * Redistributions in binary form must reproduce the above copyright notice,
+    this list of conditions and the above disclaimer in the documentation
+    and/or other materials provided with the distribution.
+    * Neither the Members of the O-RAN Alliance nor the names of its
+    contributors may be used to endorse or promote products derived from
+    this software without specific prior written permission.";
+
+  revision "2019-03-07" {
+    description
+      "version 1.0.1
+
+      1) backward compatible changes to introduce groupings.";
+
+    reference "ORAN-WG4.M.0-v01.00";
+  }
+
+  revision "2019-02-04" {
+    description
+      "version 1.0.0
+
+      1) imported model from xRAN
+      2) changed namespace and reference from xran to o-ran";
+
+    reference "ORAN-WG4.M.0-v01.00";
+  }
+
+  grouping ald-input {
+    leaf port-id {
+      type leafref {
+        path "/ap:ald-ports-io/ap:ald-port/ap:port-id";
+      }
+      mandatory true;
+      description
+        "Unique ALD port identifier reported by radio";
+    }
+
+    leaf ald-req-msg {
+      type binary {
+        length "0..1200";
+      }
+
+      description
+        "Response message to be forwarded to ALD in type of binary-string";
+    }
+  }
+
+  grouping ald-output {
+    leaf port-id {
+      type leafref {
+        path "/ap:ald-ports-io/ap:ald-port/ap:port-id";
+      }
+      mandatory true;
+      description
+        "Unique ALD port identifier reported by radio";
+    }
+
+    leaf status {
+      type enumeration {
+        enum ACCEPTED {
+          description
+            "Operation was accepted, message was processed towards ALD and response is provided";
+        }
+        enum REJECTED {
+          description
+            "Operation was rejected by O-RU";
+        }
+      }
+      mandatory true;
+
+      description
+        "Status of RPC handling seen from equipment perspective";
+    }
+
+    leaf error-message {
+      when "../status='REJECTED'";
+      type string;
+
+      description
+        "Detailed error message when the status is rejected. E.g. wrong ALD port identifier was used in RPC received from Netconf Client";
+    }
+
+    leaf ald-resp-msg {
+      type binary {
+        length "0..1200";
+      }
+
+      description
+        "Response message forwarded from ALD in type of binary-string";
+    }
+
+    leaf frames-with-wrong-crc {
+      type uint32;
+
+      description
+        "Number of frames with incorrect CRC (FCS) received from ALD - running counter";
+    }
+
+    leaf frames-without-stop-flag {
+      type uint32;
+
+      description
+        "Number of frames without stop flag received from ALD - running counter";
+    }
+
+    leaf number-of-received-octets {
+      type uint32;
+
+      description
+        "Number of octets received from HDLC bus - running counter";
+    }
+  }
+  // rpc-statements
+  rpc ald-communication {
+    description
+      "Rpc to support communication between O-DU and Antenna Line Devices";
+
+    input {
+      uses ald-input;
+    }
+
+    output {
+      uses ald-output;
+    }
+  }
+}
diff --git a/ntsimulator/yang/o-ran-beamforming.yang b/ntsimulator/yang/o-ran-beamforming.yang
new file mode 100644 (file)
index 0000000..b733430
--- /dev/null
@@ -0,0 +1,502 @@
+module o-ran-beamforming {
+  yang-version 1.1;
+  namespace "urn:o-ran:beamforming:1.0";
+  prefix "o-ran-bf";
+
+  import o-ran-uplane-conf {
+    prefix "up";
+  }
+
+  import o-ran-module-cap {
+    prefix "mcap";
+  }
+
+  import o-ran-compression-factors {
+    prefix "cf";
+  }
+
+  organization "O-RAN Alliance";
+
+  contact
+    "www.o-ran.org";
+
+  description
+    "This module defines the beamforming capabilitites of an O-RU.
+    Only O-RUs that support beamforming shall support this module.
+
+    Copyright 2019 the O-RAN Alliance.
+
+    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS '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 SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 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.
+
+    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 above disclaimer.
+    * Redistributions in binary form must reproduce the above copyright notice,
+    this list of conditions and the above disclaimer in the documentation
+    and/or other materials provided with the distribution.
+    * Neither the Members of the O-RAN Alliance nor the names of its
+    contributors may be used to endorse or promote products derived from
+    this software without specific prior written permission.";
+
+  revision "2019-06-19" {
+    description
+      "version 1.1.1
+
+      1) adding possibilities to provide more compression types for beamforming";
+
+    reference "ORAN-WG4.M.0-v01.00";
+  }
+
+  revision "2019-04-01" {
+    description
+      "version 1.1.0
+
+      1) corrested xPATH boolean check from TRUE to true";
+
+    reference "ORAN-WG4.M.0-v01.00";
+  }
+
+  revision "2019-02-04" {
+    description
+      "version 1.0.0
+
+      1) imported model from xRAN
+      2) changed namespace and reference from xran to o-ran";
+
+    reference "ORAN-WG4.M.0-v01.00";
+  }
+
+
+  feature MODIFY-BF-CONFIG {
+    description
+      "This feature indicates that the O-RU supports an optional feature to
+      modify beamforming configuration information";
+  }
+
+  typedef beam-reference {
+    type leafref {
+      path "/o-ran-bf:beamforming-config/o-ran-bf:per-band-config/o-ran-bf:beam-information/o-ran-bf:beamforming-properties/o-ran-bf:beam-id";
+    }
+    description
+      "This type is used by data models that need to reference a beam.";
+  }
+
+
+  grouping beamforming-parameters {
+    leaf max-number-of-beam-ids {
+      type uint16;
+      mandatory true;
+      description
+        "Maximum number of supported Beam ID assigned to domain beamforming control";
+    }
+
+    leaf initial-beam-id {
+      type uint16;
+      mandatory true;
+      description
+        "First Beam ID that can be used for addressing of domain beams";
+    }
+
+    description "Group of common beamforming parameters";
+  }
+
+  grouping granularity-parameters {
+    leaf frequency-granularity {
+      type enumeration {
+        enum CC {
+          description
+            "Frequency granularity: per carrier component";
+        }
+
+        enum BAND {
+          description
+            "Frequency granularity: per band";
+        }
+      }
+      mandatory true;
+      description "Supported time granularity of time-domain beamforming.";
+    }
+
+    leaf time-granularity {
+      type enumeration {
+        enum SLOT {
+          description
+            "Time granularity: per slot";
+        }
+
+        enum SYMBOL {
+          description
+            "Time granularity: per symbol";
+        }
+      }
+      mandatory true;
+      description "Supported time granularity of time-domain beamforming.";
+    }
+    description "";
+  }
+
+  grouping array-lists {
+    description
+      "Grouping for array lists";
+
+    leaf-list tx-array {
+      type leafref {
+        path "/up:user-plane-configuration/up:tx-arrays/up:name";
+      }
+      description "tx arrays belonging to this band number";
+    }
+    leaf-list rx-array {
+      type leafref {
+        path "/up:user-plane-configuration/up:rx-arrays/up:name";
+      }
+      description "rx arrays belonging to this band number";
+    }
+  }
+
+  grouping static-properties {
+    description
+      "Grouping for static beamforming properties";
+
+    leaf rt-bf-weights-update-support {
+      type boolean;
+      description
+        "The parameter informs if O-RU supports real time beamforming weights update through C-Plane messaging";
+    }
+
+    choice beamforming-type {
+      case frequency {
+        container frequency-domain-beams {
+          when "../rt-bf-weights-update-support = 'true'";
+          uses beamforming-parameters;
+          uses cf:compression-details;
+
+          list additional-compression-method-supported {
+            key "iq-bitwidth compression-type";
+            uses cf:compression-details;
+
+            description
+              "List of additional supported compression methods by O-RU";
+          }
+
+          description "";
+        }
+        description "Set of parameters valid for O-RU, that supports beamforming in frequency domain.";
+      }
+
+      case time {
+        container time-domain-beams {
+          when "../rt-bf-weights-update-support = 'true'";
+          uses beamforming-parameters;
+          uses granularity-parameters;
+          uses cf:compression-details;
+
+          list additional-compression-method-supported {
+            key "iq-bitwidth compression-type";
+            uses cf:compression-details;
+
+            description
+              "List of additional supported compression methods by O-RU";
+          }
+
+          description "";
+        }
+        description "Set of parameters valid for O-RU, that supports beamforming in time domain.";
+      }
+
+      case hybrid {
+        container hybrid-beams {
+          when "../rt-bf-weights-update-support = 'true'";
+          uses beamforming-parameters;
+          uses granularity-parameters;
+          uses cf:compression-details;
+
+          list additional-compression-method-supported {
+            key "iq-bitwidth compression-type";
+            uses cf:compression-details;
+
+            description
+              "List of additional supported compression methods by O-RU";
+          }
+
+          description "";
+        }
+        description "Set of parameters valid for O-RU, that supports hybrid beamforming - in both time and frequency domain.";
+      }
+      description
+        "This value indicates beamforming type supported by O-RU";
+    }
+
+    leaf number-of-beams {
+      type uint16;
+      description
+        "This value indicates the max number of beam patterns O-RU can generate
+        and apply to the signal of each O-RU port (both DL and UL).
+        This value is equivalent to the maximum number of used beam IDs.";
+    }
+  }
+
+  grouping beamforming-property {
+    description
+      "Grouping for beamforming property";
+
+    leaf beam-type {
+      type enumeration {
+        enum COARSE {
+          description "the beam-id corresponds to a coarse beam";
+        }
+        enum FINE {
+          description "the beam-id corresponds to a fine beam";
+        }
+      }
+      description
+        "This value indicates the beam resolution.";
+    }
+
+    leaf beam-group-id {
+      type uint16;
+      description
+        "Beams with same beamGroupsID can be transmitted simultaneously.";
+    }
+
+    leaf-list coarse-fine-beam-relation {
+      type beam-reference;
+      description
+        "List of related coarse/fine beam.";
+    }
+
+    leaf-list neighbour-beams {
+      type beam-reference;
+      description
+        "A list of neighbor beams which might restrict co-scheduling due
+        to interference.";
+    }
+  }
+
+  grouping beamforming-properties-element {
+    description
+      "Grouping for beamforming-properties element";
+
+    leaf beam-id {
+      type uint16;
+      description
+        "This value indicates the beam ID whose beamforming properties are
+        described in the container.";
+    }
+
+    container beamforming-property {
+      description
+        "Structure containing single set of beamforming properties.";
+
+      uses beamforming-property;
+    }
+  }
+
+  grouping band-num {
+    description
+      "Band information for the beamforming
+       related to the band number from module capabilities";
+
+    leaf band-number {
+      type leafref {
+        path "/mcap:module-capability/mcap:band-capabilities/mcap:band-number";
+      }
+      description
+        "band information for the beamforming information
+         related to the band number of module capabilities";
+    }
+  }
+
+  grouping per-band-config-element {
+    description
+      "Grouping for per band config element";
+
+    uses band-num;
+    uses array-lists;
+
+    container static-properties {
+      description
+        "the static beamforming related information";
+
+      uses static-properties;
+    }
+
+    container beam-information {
+      description
+        "Beam information which exposes beamforming related O-RU capabilities.";
+      leaf number-of-beamforming-properties {
+        type uint16;
+        description
+          "This parameter indicates the number of beamFormingProperties entries.";
+      }
+
+      list beamforming-properties {
+        key beam-id;
+        description
+          "Array for the beamforming properties at O-RU.
+          These parameters can be used by the beamforming control by the NETCONF client.
+          'numberOfBeamformingProperties' indicaets the size of the array.";
+
+        uses beamforming-properties-element;
+      }
+    }
+  }
+
+  grouping operational-properties {
+    description
+      "Grouping for operational properties";
+
+    leaf number-of-writeable-beamforming-files {
+      type uint8  {
+        range "1 .. max";
+      }
+      mandatory true;
+      description
+        "This leaf indicates the maximum number of writeable beamforming files
+        containing beamweights and/or attributes that the O-RU can store, taking
+        into account the maximum number of beam-IDs as defined by 3GPP
+        TS38.214 v15.x.x";
+    }
+
+    leaf update-bf-non-delete {
+      type boolean;
+      default false;
+      description
+        "When set to TRUE, indicates that an O-RU supports the capability
+        to apply the modified beamforming weight information by using rpc
+        activate-beamforming-weight without deletion of tx-array-carriers and
+        rx-array-carriers in advance, i.e., to a deactivated carrier";
+    }
+
+    leaf persistent-bf-files {
+      type boolean;
+      default false;
+      description
+        "When set to TRUE, indicates that the O-RU supports the capability
+         to store the modified beamforming weight information file in the
+         reset persistent memory";
+    }
+  }
+
+  grouping beamforming-supported-type {
+    description
+      "Grouping for type of beamforming supported";
+
+    leaf beamforming-trough-attributes-supported {
+      type boolean;
+      description
+        "Informs if beamforming can be controlled providing attributes to O-RU
+          (like angles, beamwidth).";
+    }
+
+    leaf beamforming-trough-ue-channel-info-supported {
+      type boolean;
+      description
+        "Informs if beamforming can be controlled by UE information.";
+    }
+  }
+
+  grouping beamforming-config {
+    description
+      "Grouping for beamforming configuration";
+
+    list per-band-config {
+      key band-number;
+      description "beamforming information per band";
+
+      uses per-band-config-element;
+    }
+
+    container ue-specific-beamforming {
+      presence
+        "Indicates that the O-RU supports optional Section Type '6' Fields
+        (used for sending channel information for a specific UE)";
+      config false;
+      description
+        "Information related to supput by the O-RU of Section Type 6 for
+        signalling UE-specific channel information to the O-RU";
+      leaf max-number-of-ues {
+        type uint8;
+        description
+          "Indicates tha maximum number of UE -specific channel information
+          data sets supported by the O-RU";
+      }
+    }
+    container operational-properties {
+      if-feature MODIFY-BF-CONFIG;
+      description "properties for dynamic beam weight/attribute support";
+
+      uses operational-properties;
+    }
+  }
+
+  container beamforming-config {
+    config false;
+    description
+      "A set of configuration data for the O-RU's beam forming functionality";
+
+    uses beamforming-config;
+    uses beamforming-supported-type;
+  }
+
+
+  rpc activate-beamforming-config {
+    if-feature MODIFY-BF-CONFIG;
+    description
+      "rpc to activate beamforming config information by indicating the file
+      stored in the folder O-RAN/beam-weights in advance";
+    input {
+      leaf beamforming-config-file {
+        type string;
+        mandatory true;
+        description
+          "file name stored in O-RAN/beamforming/ folder is indicated";
+      }
+
+      uses band-num;
+    }
+    output {
+      leaf status {
+        type enumeration {
+          enum ACCEPTED {
+            description "O-RU has accepted the beamforming weight/attribute file";
+          }
+          enum REJECTED {
+            description
+              "O-RU has rejected the beamforming weight/attribute file. The O-RU
+              should then use the default beamforming file.";
+          }
+        }
+        mandatory true;
+        description "Status of activation of beamforming config information";
+      }
+      leaf error-message {
+        when "../status='REJECTED'";
+        type string;
+        description
+          "Detailed error Message when the status is rejected, e.g.,
+           because new beam forming file is attempted to be applied to a
+           carrier which is still active, or the beam-id does not exist.";
+      }
+    }
+  }
+
+
+  //notification statement
+  notification beamforming-information-update {
+    uses band-num;
+    description
+      "this notification indicates that the beamforming properties are updated for particular band";
+  }
+}
diff --git a/ntsimulator/yang/o-ran-compression-factors.yang b/ntsimulator/yang/o-ran-compression-factors.yang
new file mode 100644 (file)
index 0000000..d974e88
--- /dev/null
@@ -0,0 +1,176 @@
+module o-ran-compression-factors {
+  yang-version 1.1;
+  namespace "urn:o-ran:compression-factors:1.0";
+  prefix "o-ran-compression-factors";
+
+
+  organization "O-RAN Alliance";
+
+  contact
+    "www.o-ran.org";
+
+  description
+    "This module defines the module capabilities for
+    the O-RAN Radio Unit U-Plane configuration.
+
+    Copyright 2019 the O-RAN Alliance.
+
+    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS '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 SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 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.
+
+    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 above disclaimer.
+    * Redistributions in binary form must reproduce the above copyright notice,
+    this list of conditions and the above disclaimer in the documentation
+    and/or other materials provided with the distribution.
+    * Neither the Members of the O-RAN Alliance nor the names of its
+    contributors may be used to endorse or promote products derived from
+    this software without specific prior written permission.";
+
+  revision "2019-06-19" {
+    description
+      "version 1.0.1
+
+      1) changes related to compression bitwidth presentation";
+
+    reference "ORAN-WG4.M.0-v01.00";
+  }
+
+  revision "2019-02-04" {
+    description
+      "version 1.0.0
+
+      1) imported model from xRAN
+      2) changed namespace and reference from xran to o-ran";
+
+    reference "ORAN-WG4.M.0-v01.00";
+  }
+
+  grouping compression-params {
+    leaf compression-type {
+      type enumeration {
+        enum STATIC {
+          description
+            "Indicates that static compression method will be used (both compression and IQ bitwidth)";
+        }
+        enum DYNAMIC {
+          description
+            "Indicates that dynamic compression method will be used";
+        }
+      }
+      mandatory true;
+      description
+        "Compression type that O-DU wants to be supported";
+    }
+
+// *********** TO BE REMOVED ***********
+    leaf bitwidth {
+      when "../compression-type = 'STATIC'";
+      type uint8;
+      status deprecated;
+      description
+        "Bitwidth to be used in compression";
+    }
+// *************************************
+
+    choice compression-format {
+      description
+        "Choice of compression format for particular element";
+
+      case no-compresison {
+        description "Compression for beam weights is not supported.";
+      }
+      case block-floating-point {
+        description "Block floating point compression and decompression is supported.";
+
+        leaf exponent {
+          type uint8 {
+            range "4";
+          }
+          description "Exponent bit width size in number of bits used when encoding in udCompParam.";
+        }
+      }
+
+      case block-scaling {
+        description "Block scaling compression and decompresion is supported.";
+        leaf block-scalar {
+          type uint8;
+            description
+              "Common scaler for compressed PRB";
+        }
+      }
+
+      case u-law {
+        description "u-Law compression and decompresion method is supported.";
+        leaf comp-bit-width {
+          type uint8 {
+            range "0..15";
+          }
+          description "Bit with for u-law compression";
+        }
+        leaf comp-shift {
+          type uint8 {
+            range "0..15";
+          }
+          description
+            "the shift applied to the entire PRB";
+        }
+      }
+
+      case beam-space-compression {
+        description "Beamspace compression and decompression is supported. Applies to beamforming weights only.";
+        leaf-list active-beam-space-coeficient-mask {
+          type uint8;
+          description
+            "active beamspace coefficient indices associated with the compressed beamforming vector";
+        }
+        leaf block-scaler {
+          type uint8;
+          description
+            "Common scaler for compressed beamforming coefficients";
+        }
+      }
+
+      case modulation-compression {
+        description "Modulation compression and decompression is supported.";
+        leaf csf {
+          type uint8 {
+            range "0..1";
+          }
+          description "Constallation shift flag";
+        }
+
+        leaf mod-comp-scaler {
+          type uint16 {
+            range "0..32767";
+          }
+          description "Modulation compression scaler value.";
+        }
+      }
+    }
+  }
+
+  grouping compression-details {
+    description "";
+
+    leaf iq-bitwidth {
+      type uint8;
+      description
+        "Bitwidth to be used in compression";
+    }
+
+    uses compression-params;
+  }
+}
diff --git a/ntsimulator/yang/o-ran-delay-management.yang b/ntsimulator/yang/o-ran-delay-management.yang
new file mode 100644 (file)
index 0000000..7a22dc3
--- /dev/null
@@ -0,0 +1,345 @@
+module o-ran-delay-management {
+  yang-version 1.1;
+  namespace "urn:o-ran:delay:1.0";
+  prefix "o-ran-delay";
+
+  organization "O-RAN Alliance";
+
+  contact
+    "www.o-ran.org";
+
+  description
+    "This module covers off aspects of O-DU to O-RU delay management,
+    including config data related to O-RU transmission and reception
+    windows.
+
+    Copyright 2019 the O-RAN Alliance.
+
+    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS '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 SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 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.
+
+    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 above disclaimer.
+    * Redistributions in binary form must reproduce the above copyright notice,
+    this list of conditions and the above disclaimer in the documentation
+    and/or other materials provided with the distribution.
+    * Neither the Members of the O-RAN Alliance nor the names of its
+    contributors may be used to endorse or promote products derived from
+    this software without specific prior written permission.";
+
+  revision "2019-06-03" {
+    description
+      "version 1.0.2
+
+      1) fixing descriptions of ta3-min and ta3-max.";
+
+    reference "ORAN-WG4.M.0-v01.00";
+  }
+  
+  revision "2019-04-12" {
+    description
+      "version 1.0.1
+
+      1) introducing grouping/uses to enable model re-use by WG5";
+
+    reference "ORAN-WG4.M.0-v01.00";
+  }
+
+  revision "2019-02-04" {
+    description
+      "version 1.0.0
+
+      1) imported model from xRAN
+      2) changed namespace and reference from xran to o-ran";
+
+    reference "ORAN-WG4.M.0-v01.00";
+  }
+
+
+  feature ADAPTIVE-RU-PROFILE {
+    description
+      "This feature indicates that the O-RU supports adaptive O-RU delay profile
+      based on information provided by the NETCONF client.";
+  }
+
+  typedef bandwidth {
+    type uint32 {
+      range "200 | 1400 | 3000 | 5000 | 10000 | 15000 | 20000 | 25000 |
+            30000 | 40000 | 50000 | 60000 | 70000 | 80000 | 90000 | 100000
+            | 200000 | 400000" ;
+    }
+    units kilohertz;
+    description
+      "transmission bandwidth configuration in units of kHz -
+      covering NBIoT through to New Radio - see 38.104";
+  }
+
+  grouping bandwidth-configuration {
+    description
+      "Grouping for bandwidth and scs configuration";
+
+    leaf bandwidth {
+      type bandwidth;
+      description
+        "transmission bandwidth configuration in units of kHz -
+        covering NBIoT through to New Radio - see 38.104";
+    }
+    leaf subcarrier-spacing {
+      type uint32 {
+        range "0 .. 240000 ";
+      }
+      units Hertz;
+      description "subcarrier spacing in Hz";
+    }
+  }
+
+  grouping t2a-up {
+    description
+      "configuration of t2a for uplink";
+
+    leaf t2a-min-up {
+      type uint32;
+      units nanoseconds;
+      mandatory true;
+      description
+        "the minimum O-RU data processing delay between receiving IQ data
+        message over the fronthaul interface and transmitting
+        the corresponding first IQ sample at the antenna";
+    }
+    leaf t2a-max-up {
+      type uint32;
+      units nanoseconds;
+      mandatory true;
+      description
+        "the earliest allowable time when a data packet is received before
+        the corresponding first IQ sample is transmitted at the antenna";
+    }
+  }
+
+  grouping t2a-cp-dl {
+    description
+      "Grouping for t2a CP for downlink";
+
+    leaf t2a-min-cp-dl {
+      type uint32;
+      units nanoseconds;
+      mandatory true;
+      description
+        "the minimum O-RU data processing delay between receiving downlink
+        real time control plane message over the fronthaul interface and
+        transmitting the corresponding first IQ sample at the antenna";
+    }
+    leaf t2a-max-cp-dl {
+      type uint32;
+      units nanoseconds;
+      mandatory true;
+      description
+        "the earliest allowable time when a downlink real time control message
+        is received before the corresponding first IQ sample is transmitted at
+        the antenna";
+    }
+  }
+
+  grouping ta3 {
+    description
+      "Grouping for ta3 configuration";
+
+    leaf ta3-min {
+      type uint32;
+      units nanoseconds;
+      mandatory true;
+      description
+        "the minimum O-RU data processing delay between receiving an IQ sample
+        at the antenna and transmitting the first data sample over the
+        fronthaul interface";
+    }
+    leaf ta3-max {
+      type uint32;
+      units nanoseconds;
+      mandatory true;
+      description
+        "the maximum O-RU data processing delay between receiving an IQ sample
+        at the antenna and transmitting the last data sample over the
+        fronthaul interface";
+    }
+  }
+
+  grouping t2a-cp-ul {
+    description
+      "Grouping for t2a CP uplink";
+
+    leaf t2a-min-cp-ul {
+      type uint32;
+      units nanoseconds;
+      mandatory true;
+      description
+        "the minimum O-RU data processing delay between receiving real time
+        up-link control plane message over the fronthaul interface and
+        recieving the first IQ sample at the antenna";
+    }
+    leaf t2a-max-cp-ul {
+      type uint32;
+      units nanoseconds;
+      mandatory true;
+      description
+        "the earliest allowable time when a real time up-link control message
+        is received before the corresponding first IQ sample is received  at
+        the antenna";
+    }
+  }
+
+  grouping ru-delay-profile {
+    description
+      "Grouping for ru delay profile";
+
+    uses t2a-up;
+    uses t2a-cp-dl;
+
+    leaf tcp-adv-dl {
+      type uint32;
+      units nanoseconds;
+      mandatory true;
+      description
+        "the time difference (advance) between the reception window for
+        downlink real time Control messages and reception window for the
+        corresponding IQ data messages.";
+    }
+
+    uses ta3;
+    uses t2a-cp-ul;
+  }
+
+  grouping o-du-delay-profile {
+    description
+      "Grouping for O-DU delay profile";
+
+    leaf t1a-max-up {
+      type uint32;
+      units nanoseconds;
+      description
+        "the earliest possible time which the O-DU can support transmiting
+        an IQ data message prior to transmission of the corresponding IQ
+        samples at the antenna";
+    }
+    leaf tx-max {
+      type uint32;
+      units nanoseconds;
+      description
+        "The maximum amount of time which the O-DU requires to transmit
+        all downlink user plane IQ data message for a symbol";
+    }
+    leaf ta4-max {
+      type uint32;
+      units nanoseconds;
+      description
+        "the latest possible time which the O-DU can support receiving the
+        last uplink user plane IQ data message for a symbol.";
+    }
+    leaf rx-max {
+      type uint32;
+      units nanoseconds;
+      description
+        "The maximum time difference the O-DU can support between
+        receiving the first user plane IQ data message for a symbol and
+        receiving the last user plane IQ data message for the same symbol";
+    }
+  }
+
+  grouping t12 {
+    description
+      "Grouping for t12";
+
+    leaf t12-min {
+      type uint32;
+      units nanoseconds;
+      description
+        "the minimum measured delay between DU port-ID and O-RU port-ID";
+    }
+// additional leaf added by Samsung
+    leaf t12-max {
+      type uint32;
+      units nanoseconds;
+      description
+        "the maximum measured delay between CU port-ID and O-RU port-ID";
+    }
+  }
+
+  grouping t34 {
+    description
+      "Grouping for t34";
+
+    leaf t34-min {
+      type uint32;
+      units nanoseconds;
+      description
+        "the minimum measured delay between O-RU port-ID and CU port-ID";
+    }
+// additional leaf added by Samsung
+    leaf t34-max {
+      type uint32;
+      units nanoseconds;
+      description
+        "the maximum measured delay between O-RU port-ID and CU port-ID";
+    }
+  }
+
+  grouping delay-management-group {
+    list bandwidth-scs-delay-state {
+      key "bandwidth subcarrier-spacing";
+      description
+        "Array of structures containing sets of parameters for delay management.";
+
+      uses bandwidth-configuration;
+
+      container ru-delay-profile {
+        config false;
+        description "container for O-RU delay parameters";
+
+        uses ru-delay-profile;
+      }
+    }
+
+    container adaptive-delay-configuration {
+      if-feature ADAPTIVE-RU-PROFILE;
+      description "container for adaptive delay parameters";
+      list bandwidth-scs-delay-state {
+        key "bandwidth subcarrier-spacing";
+        description
+          "Array of structures containing sets of parameters for delay management.";
+
+        uses bandwidth-configuration;
+
+        container o-du-delay-profile {
+          description
+            "O-DU provided delay profile for adaptive delay configuration";
+
+          uses o-du-delay-profile;
+        }
+      }
+
+      container transport-delay {
+        description
+          "O-DU provided transport-delay parameters";
+        uses t12;
+        uses t34;
+      }
+    }
+  }
+  container delay-management {
+    description "top level tree covering off O-DU to O-RU delay management";
+
+    uses delay-management-group;
+  }
+}
diff --git a/ntsimulator/yang/o-ran-dhcp.yang b/ntsimulator/yang/o-ran-dhcp.yang
new file mode 100644 (file)
index 0000000..7a0ca47
--- /dev/null
@@ -0,0 +1,281 @@
+module o-ran-dhcp {
+  yang-version 1.1;
+  namespace "urn:o-ran:dhcp:1.0";
+  prefix "o-ran-dhcp";
+
+  import ietf-interfaces {
+    prefix "if";
+  }
+
+  import ietf-inet-types {
+    prefix "inet";
+  }
+
+  import ietf-dhcpv6-types {
+    prefix dhcpv6-type;
+    revision-date 2018-01-30;
+  }
+
+  organization "O-RAN Alliance";
+
+  contact
+    "www.o-ran.org";
+
+  description
+    "This module defines the YANG definitions for managng the DHCP client.
+
+    Copyright 2019 the O-RAN alliance.
+
+    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS '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 SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 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.
+
+    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 above disclaimer.
+    * Redistributions in binary form must reproduce the above copyright notice,
+    this list of conditions and the above disclaimer in the documentation
+    and/or other materials provided with the distribution.
+    * Neither the Members of the O-RAN Alliance nor the names of its
+    contributors may be used to endorse or promote products derived from
+    this software without specific prior written permission.";
+
+  revision "2019-05-25" {
+    description
+      "version 1.1.0
+
+      1) backward compatible changes to introduce reporting of 3GPP
+      discovered MV-PnP information, including CA/RA Servers and SeGW ";
+
+    reference "ORAN-WG4.M.0-v01.00";
+  }
+
+  revision "2019-03-07" {
+    description
+      "version 1.0.1
+
+      1) backward compatible changes to introduce groupings.";
+
+    reference "ORAN-WG4.M.0-v01.00";
+  }
+
+  revision "2019-02-04" {
+    description
+      "version 1.0.0
+
+      1) imported model from xRAN
+      2) changed namespace and reference from xran to o-ran";
+
+    reference "ORAN-WG4.M.0-v01.00";
+  }
+
+  typedef netconf-client-id {
+    type union {
+      type inet:ip-address;
+      type inet:uri;
+    }
+    description "A NETCONF client identifier";
+  }
+
+  typedef ca-ra-server-id {
+    type union {
+      type inet:ip-address;
+      type inet:uri;
+    }
+    description "A CA/RA Server identifier";
+  }
+
+  typedef segw-id {
+    type union {
+      type inet:ip-address;
+      type inet:uri;
+    }
+    description "A SeGW identifier";
+  }
+
+  grouping ca-ra-servers {
+    description
+      "The CA/RA servers discovered using DHCP, discovered using the 3GPP
+      defined options in 3GPP 32.509 in vendor specific option 43/17";
+    list ca-ra-servers {
+      key servers;
+      description "A list of IP addresses or URIs for CA/RA Servers";
+
+      leaf servers{
+        type ca-ra-server-id;
+        description "the server identifier";
+      }
+      leaf port-number {
+        type inet:port-number;
+        description "an optional (non-default) port";
+      }
+      leaf ca-ra-path {
+        type string;
+        description
+          "ASCII string representing the path to the CMP server directory.
+          A CMP server may be located in an arbitrary path other than root.";
+      }
+      leaf subject-name {
+        type string;
+        description
+          "ASCII string representing the subject name of the CA/RA. ";
+      }
+      leaf protocol {
+        type enumeration {
+          enum HTTP;
+          enum HTTPS;
+        }
+      }
+    }
+  }
+
+  grouping security-gateways {
+    description
+      "The security gateways discovered using DHCP, discovered using the 3GPP
+      defined options in 3GPP 32.509 in vendor specific option 43/17";
+    list segw {
+      key gateways;
+      description "A list of IP addresses or URIs for SeGW";
+
+      leaf gateways{
+        type segw-id;
+        description "the SeGW identifier";
+      }
+    }
+
+  }
+
+  grouping netconf-clients {
+    description
+      "The netconf clients discovered using DHCP, discovered using the IANA
+      defined options or O-RAN defined syntax for encoding IP adresses or FQDNs
+      in vendor specific option 43/17";
+    list netconf-clients{
+      key client;
+      description "A list of IP addresses or URIs for NETCONF clients";
+      leaf client{
+        type netconf-client-id;
+        description "the client identifier";
+      }
+      leaf optional-port {
+        type inet:port-number;
+        description "an optional (non-default) port";
+      }
+    }
+  }
+
+  grouping dhcpv4-option {
+    description "DHCPv4 Configuration options";
+
+    leaf dhcp-server-identifier {
+      type  inet:ip-address;
+      description "DHCP server identifier";
+    }
+    leaf domain-name {
+      type  string;
+      description "Name of the domain";
+    }
+    leaf-list domain-name-servers {
+      type  inet:ip-address;
+      description "A list of DNS servers";
+    }
+    leaf interface-mtu {
+      type  uint32 {
+        range "0..65535";
+      }
+      description "Minimum Transmission Unit (MTU) of the interface";
+    }
+    leaf-list default-gateways{
+      type inet:ip-address;
+      description "the list of default gateways on the O-RUs subnet";
+    }
+    uses netconf-clients;
+    uses ca-ra-servers;
+    uses security-gateways;
+  }
+
+  grouping dhcpv6-option {
+    description "DHCPv6 Configuration options";
+
+    container dhcp-server-identifier{
+      description "dhcpv6 server identifief";
+      uses dhcpv6-type:duid;
+    }
+    leaf domain-name {
+      type  string;
+      description "Name of the domain";
+    }
+    leaf-list domain-name-servers {
+      type  inet:ip-address;
+      description "A list of DNS servers";
+    }
+    uses netconf-clients;
+    uses ca-ra-servers;
+    uses security-gateways;
+  }
+
+  grouping dhcp-group {
+    list interfaces {
+      key "interface";
+      description "Interface configuration";
+
+      leaf interface {
+        type if:interface-ref;
+        description "Name of the interface";
+      }
+
+      container dhcpv4 {
+        description "DHCPv4 information";
+        leaf client-id {
+          type string;
+          description "DHCP client identifier";
+        }
+        uses dhcpv4-option;
+      }
+      container dhcpv6 {
+        description "DHCPv6 information";
+        container dhcp-client-identifier{
+          description "dhcpv6 client identifief";
+          uses dhcpv6-type:duid;
+        }
+        uses dhcpv6-option;
+      }
+    }
+
+    container m-plane-dhcp {
+      description "leafs covering off DHCP aspects of m-plane operations";
+      leaf private-enterprise-number {
+        type uint16;
+        default 53148;
+        description "the private enteprise number allocated to O-RAN Alliance";
+      }
+      leaf vendor-class-data {
+        type string;
+        description
+          "The string used in DHCPv4 option 60 or DHCPv4 option 124 and
+          DHCPv6 option 16";
+      }
+    }
+  }
+
+
+  // Top Level Container
+
+  container dhcp {
+    config false;
+    description
+      "DHCP client configuration";
+
+    uses dhcp-group;
+  }
+}
diff --git a/ntsimulator/yang/o-ran-ecpri-delay.yang b/ntsimulator/yang/o-ran-ecpri-delay.yang
new file mode 100644 (file)
index 0000000..88f1678
--- /dev/null
@@ -0,0 +1,135 @@
+module o-ran-ecpri-delay {
+  yang-version 1.1;
+  namespace "urn:o-ran:message5:1.0";
+  prefix "o-ran-msg5";
+
+  import o-ran-processing-element {
+    prefix "element";
+  }
+
+  organization "O-RAN Alliance";
+
+  contact
+    "www.o-ran.org";
+
+  description
+    "This module is an optional module for supporting eCPRI message 5 handling
+    used for eCPRI based delay measurements.
+
+    Copyright 2019 the O-RAN Alliance.
+
+    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS '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 SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 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.
+
+    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 above disclaimer.
+    * Redistributions in binary form must reproduce the above copyright notice,
+    this list of conditions and the above disclaimer in the documentation
+    and/or other materials provided with the distribution.
+    * Neither the Members of the O-RAN Alliance nor the names of its
+    contributors may be used to endorse or promote products derived from
+    this software without specific prior written permission.";
+
+  revision "2019-02-04" {
+    description
+      "version 1.0.0
+
+      1) imported model from xRAN
+      2) changed namespace and reference from xran to o-ran";
+
+    reference "ORAN-WG4.M.0-v01.00";
+  }
+
+// groupings
+
+  grouping msg5-group {
+
+    container ru-compensation {
+      config false;
+      description
+        "leafs for ru timing compensation based on message 5 handling";
+      leaf tcv2 {
+        type uint32;
+        units nanoseconds;
+        description
+          "a compensation value to account for expected delay from packet
+          receipt at R2 to timestamping in the O-RU";
+      }
+      leaf tcv1 {
+        type uint32;
+        units nanoseconds;
+        description
+          "a compensation value to account for expected processing time from
+          timestamping in the O-RU until actual packet transmission at R3";
+      }
+    }
+
+    leaf enable-message5 {
+      type boolean;
+      default false;
+      description
+        "whether O-RU's eCPRI message 5 handling is enabled.";
+    }
+
+    container message5-sessions {
+      description "session information for eCPRI message 5";
+
+      list session-parameters {
+        key "session-id";
+        description "list of MSG5 session information";
+        leaf session-id {
+          type uint32;
+          description "Session ID for MSG5 responder";
+        }
+        leaf processing-element-name {
+          type leafref {
+            path "/element:processing-elements/element:ru-elements/element:name";
+          }
+          description "the name of the processing element used for MSG5";
+        }
+        container flow-state {
+          config false;
+          description "MSG5 flow state";
+          leaf responses-transmitted {
+            type uint32;
+            description
+              "The total number of eCPRI mesage 5 response messages transmitted by
+              the O-RU.";
+          }
+          leaf requests-transmitted {
+            type uint32;
+            description
+              "The total number of eCPRI mesage 5 request messages transmitted by
+              the O-RU.";
+          }
+          leaf followups-transmitted {
+            type uint32;
+            description
+              "The total number of eCPRI mesage 5 follow up messages transmitted by
+              the O-RU.";
+          }
+        }
+      }
+    }
+  }
+
+// top level container
+
+  container ecpri-delay-message {
+    description "top level tree covering off O-DU to O-RU msg5 delay measurement";
+
+    uses msg5-group;
+  }
+}
diff --git a/ntsimulator/yang/o-ran-externalio.yang b/ntsimulator/yang/o-ran-externalio.yang
new file mode 100644 (file)
index 0000000..9e44fdb
--- /dev/null
@@ -0,0 +1,183 @@
+module o-ran-externalio {
+  yang-version 1.1;
+  namespace "urn:o-ran:external-io:1.0";
+  prefix "o-ran-io";
+
+  organization "O-RAN Alliance";
+
+  contact
+    "www.o-ran.org";
+
+  description
+    "This module defines the input state and output configuration for
+    external IO.
+
+    Copyright 2019 the O-RAN Alliance.
+
+    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS '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 SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 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.
+
+    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 above disclaimer.
+    * Redistributions in binary form must reproduce the above copyright notice,
+    this list of conditions and the above disclaimer in the documentation
+    and/or other materials provided with the distribution.
+    * Neither the Members of the O-RAN Alliance nor the names of its
+    contributors may be used to endorse or promote products derived from
+    this software without specific prior written permission.";
+
+  revision "2019-03-07" {
+    description
+      "version 1.0.1
+
+      1) backward compatible changes to introduce groupings.";
+
+    reference "ORAN-WG4.M.0-v01.00";
+  }
+
+  revision "2019-02-04" {
+    description
+      "version 1.0.0
+
+      1) imported model from xRAN
+      2) changed namespace and reference from xran to o-ran";
+
+    reference "ORAN-WG4.M.0-v01.00";
+  }
+
+  grouping external-io-group {
+    list input {
+      key "name";
+      config false;
+      description
+        "Leaf nodes describing external line inputs";
+      leaf name {
+        type string {
+          length "1..255";
+        }
+        description
+        "A unique name that identifies an input port instance.
+        This name may be used in fault management to refer to a fault source
+        or affected object";
+      }
+      leaf port-in {
+        type uint8;
+        description
+          "A number which identifies an external input port.";
+      }
+
+      leaf line-in {
+        type boolean;
+        default true;
+        description
+          "Value TRUE indicates that circuit is open.
+           Value FALSE indicates that circuit is closed.
+
+           Usually when nothing is connected to the line the value is TRUE.
+           The details of external line-in implementation are HW specific.";
+      }
+    }
+
+    list output {
+      key "name";
+      config false;
+      description
+        "Leaf nodes describing external line outputs";
+      leaf name {
+        type string {
+          length "1..255";
+        }
+        description
+          "A name that is unique that identifies an output port instance.
+          This name may be used in fault management to refer to a fault source
+          or affected object";
+      }
+      leaf port-out {
+        type uint8;
+        mandatory true;
+        description
+          "A number which identifies an external output port.";
+      }
+    }
+
+    list output-setting {
+      key "name";
+
+      description
+        "List allowing to set output line state";
+
+      leaf name {
+        type leafref {
+          path "/external-io/output/name";
+          require-instance false;
+        }
+        mandatory true;
+
+        description
+          "Name derived from unmodifiable list external-io";
+      }
+
+      leaf line-out {
+        type boolean;
+        default true;
+        description
+          "Value TRUE indicates that circuit is in its natural state.
+           Value FALSE indicates that circuit is not in its natural state.";
+      }
+    }
+  }
+
+  grouping notification-group {
+    container current-input-notification {
+      description "a container for the state of the input ports";
+      list external-input {
+        key "name";
+        description "a list of the input ports and their state";
+        leaf name{
+          type leafref{
+            path "/external-io/input/name";
+          }
+          description "the name of the ald-port";
+        }
+        leaf io-port {
+          type leafref{
+            path  "/external-io/input/port-in";
+          }
+          description "the external input port";
+        }
+        leaf line-in {
+          type leafref{
+            path  "/external-io/input/line-in";
+          }
+          description "the state of the external input port";
+        }
+      }
+    }
+  }
+
+// Top Level Container
+
+  container external-io {
+    description
+      "External IO information.";
+    uses external-io-group;
+  }
+
+  notification external-input-change {
+    description
+      "Notification used to indicate that external line input has changed state";
+    uses notification-group;
+  }
+}
diff --git a/ntsimulator/yang/o-ran-fan.yang b/ntsimulator/yang/o-ran-fan.yang
new file mode 100644 (file)
index 0000000..6354302
--- /dev/null
@@ -0,0 +1,125 @@
+module o-ran-fan {
+  yang-version 1.1;
+  namespace "urn:o-ran:fan:1.0";
+  prefix "o-ran-fan";
+
+
+  organization "O-RAN Alliance";
+
+  contact
+    "www.o-ran.org";
+
+  description
+    "This module defines the state of the O-RAN equipment's fans.
+
+    Copyright 2019 the O-RAN Alliance.
+
+    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS '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 SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 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.
+
+    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 above disclaimer.
+    * Redistributions in binary form must reproduce the above copyright notice,
+    this list of conditions and the above disclaimer in the documentation
+    and/or other materials provided with the distribution.
+    * Neither the Members of the O-RAN Alliance nor the names of its
+    contributors may be used to endorse or promote products derived from
+    this software without specific prior written permission.";
+
+  revision "2019-03-06" {
+    description
+      "version 1.0.1
+
+      1) backward compatible changes to introduce groupings.";
+
+    reference "ORAN-WG4.M.0-v01.00";
+  }
+
+  revision "2019-02-04" {
+    description
+      "version 1.0.0
+
+      1) imported model from xRAN
+      2) changed namespace and reference from xran to o-ran";
+
+    reference "ORAN-WG4.M.0-v01.00";
+  }
+
+  typedef percent {
+   type uint16 {
+     range "0 .. 100";
+   }
+   description "Percentage";
+  }
+
+  grouping fan-grouping {
+    list fan-state {
+      key name;
+      description "a list of the fans based on their unique names";
+      leaf name {
+        type string {
+          length "1..255";
+        }
+        description
+          "A name that is unique that identifies a fan instance.
+          This name may be used in fault management to refer to a fault source
+          or affected object";
+      }
+      leaf fan-location {
+        type uint8;
+        description "A number indicating the location of the FAN in the fan tray";
+      }
+      leaf present-and-operating {
+        type boolean;
+        mandatory true;
+        description
+          "Indicates if a fan is present and operating in the location";
+      }
+      leaf vendor-code {
+        when "../present-and-operating = 'true'";
+        type uint8 {
+          range "0..7";
+        }
+        description
+          "Indicates fan vendor code. Fan vendors are detected with ID pins
+          using 3 bits digital inputs.
+
+          Optional node included when the NETCONF Server has determined
+          the fan vendor code.";
+      }
+      leaf fan-speed {
+        when "../present-and-operating = 'true'";
+        type percent;
+        description
+          "Measured fan speed. Expressed as percentage of max fan speed.
+
+          Optional node included when the fan speed can be measured.";
+      }
+      leaf target-speed {
+        when "../present-and-operating = 'true'";
+        type uint16;
+        units rpm;
+        description "the target speed of the fan";
+      }
+    }
+  }
+
+  container fan-tray {
+    config false;
+    description "top level tree covering off operational state of the fans";
+
+    uses fan-grouping;
+  }
+}
diff --git a/ntsimulator/yang/o-ran-file-management.yang b/ntsimulator/yang/o-ran-file-management.yang
new file mode 100644 (file)
index 0000000..f7611be
--- /dev/null
@@ -0,0 +1,221 @@
+module o-ran-file-management {
+  yang-version 1.1;
+  namespace "urn:o-ran:file-management:1.0";
+  prefix "o-ran-file-mgmt";
+
+  import ietf-crypto-types {
+    prefix "ct";
+  }
+
+
+  organization "O-RAN Alliance";
+
+  contact
+    "www.o-ran.org";
+
+  description
+    "This module defines the configuration and operations for handling upload.
+
+    Copyright 2019 the O-RAN Alliance.
+
+    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS '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 SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 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.
+
+    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 above disclaimer.
+    * Redistributions in binary form must reproduce the above copyright notice,
+    this list of conditions and the above disclaimer in the documentation
+    and/or other materials provided with the distribution.
+    * Neither the Members of the O-RAN Alliance nor the names of its
+    contributors may be used to endorse or promote products derived from
+    this software without specific prior written permission.";
+
+  revision "2019-06-05" {
+    description
+      "version 1.0.2
+
+      1) backward compatible changes according to NOK-0002 sFTP Server Authentication Correction.
+      2) minor fixes according to lack of descriptions";
+
+    reference "ORAN-WG4.M.0-v01.00";
+  }
+
+  revision "2019-03-07" {
+    description
+      "version 1.0.1
+
+      1) backward compatible changes to introduce groupings.";
+
+    reference "ORAN-WG4.M.0-v01.00";
+  }
+
+  revision "2019-02-04" {
+    description
+      "version 1.0.0
+
+      1) imported model from xRAN
+      2) changed namespace and reference from xran to o-ran";
+
+    reference "ORAN-WG4.M.0-v01.00";
+  }
+
+  grouping file-path-grouping {
+    description "Complete logical path of the file to upload/download
+    (no wildcard is allowed) ex : /o-RAN/log/syslog.1";
+
+    leaf local-logical-file-path {
+      type string;
+      mandatory true;
+      description "Local logical file path";
+    }
+
+    leaf remote-file-path {
+      type string;
+      mandatory true;
+      description "URI specifying the remote-file-path on O-DU/NMS.
+      Format:sftp://<username>@<host>[:port]/path";
+    }
+  }
+
+  grouping output-status-grouping {
+    description "Status grouping";
+
+    leaf status {
+      type enumeration {
+        enum SUCCESS {
+            description "";}
+        enum FAILURE {
+            description "";}
+      }
+      description "Operation status";
+      }
+
+    leaf reject-reason {
+      when "../status = 'FAILURE'";
+      type string;
+      description "";
+    }
+  }
+
+  grouping credential-information {
+    description "Type of authentication to use for SFTP upload or download.";
+    choice credentials {
+      case password {
+        container password {
+          presence true;
+          leaf password {
+            type string;
+            mandatory true;
+            description
+              "password needed for O-RU authentication.";
+          }
+          description
+            "password for O-RU authentication method in use";
+        }
+        container server {
+          list keys {
+            key algorithm;
+            ordered-by user;
+            uses ct:public-key-grouping;
+            description
+              "List of allowed algorithms with its keys";
+          }
+          description
+            "Key for sFTP server authentication";
+        }
+      }
+      case certificate {
+        container certificate {
+          presence true;
+          description
+            "certificate authentication method in use";
+        }
+      }
+     description "";
+    }
+  }
+
+  grouping retrieve-input {
+    description "Grouping for information retrieval RPC input";
+    leaf logical-path {
+      type string;
+      mandatory true;
+      description "O-RAN unit of which the files are to be listed.
+      ex :  O-RAN/log, o-RAN/PM, O-RAN/transceiver";
+    }
+    leaf file-name-filter {
+      type string;
+      description "Filter which are to be applied on the result list of file names (* is allowed as wild-card).";
+    }
+  }
+
+  grouping retrieve-output {
+    description "Grouping for information retrieval RPC output";
+    uses output-status-grouping;
+    leaf-list file-list {
+      when "../status = 'SUCCESS'";
+      type string;
+      description "List of files in the unit with the filter applied.";
+    }
+  }
+
+// RPCs
+
+  rpc file-upload {
+    description "File upload over SFTP from equipment to NETCONF client";
+    input {
+      uses file-path-grouping;
+      uses credential-information;
+    }
+    output {
+      uses output-status-grouping;
+    }
+  }
+
+  rpc retrieve-file-list {
+    description "List all the files in the logical O-RAN unit (* is allowed as wild-card).";
+    input {
+      uses retrieve-input;
+
+    }
+    output {
+      uses retrieve-output;
+    }
+  }
+
+  notification file-upload-notification {
+    uses file-path-grouping;
+    uses output-status-grouping;
+    description "";
+  }
+
+  rpc file-download {
+    description
+      "Management plane triggered to generate the download file of O-RU.";
+    input {
+      uses file-path-grouping;
+      uses credential-information;
+    }
+    output {
+      uses output-status-grouping;
+    }
+  }
+
+  notification file-download-event {
+    uses file-path-grouping;
+    uses output-status-grouping;
+    description "";
+  }
+}
diff --git a/ntsimulator/yang/o-ran-fm.yang b/ntsimulator/yang/o-ran-fm.yang
new file mode 100644 (file)
index 0000000..92238aa
--- /dev/null
@@ -0,0 +1,168 @@
+module o-ran-fm {
+  yang-version 1.1;
+  namespace "urn:o-ran:fm:1.0";
+  prefix "o-ran-fm";
+
+  import ietf-yang-types {
+    prefix yang;
+    revision-date 2013-07-15;
+  }
+
+  organization "O-RAN Alliance";
+
+  contact
+    "www.o-ran.org";
+
+  description
+    "This module defines alarm reporting mechanism.
+
+    Copyright 2019 the O-RAN Alliance.
+
+    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS '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 SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 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.
+
+    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 above disclaimer.
+    * Redistributions in binary form must reproduce the above copyright notice,
+    this list of conditions and the above disclaimer in the documentation
+    and/or other materials provided with the distribution.
+    * Neither the Members of the O-RAN Alliance nor the names of its
+    contributors may be used to endorse or promote products derived from
+    this software without specific prior written permission.";
+
+  revision "2019-02-04" {
+    description
+      "version 1.0.0
+
+      1) imported model from xRAN
+      2) changed namespace and reference from xran to o-ran";
+
+    reference "ORAN-WG4.M.0-v01.00";
+  }
+
+  grouping alarm {
+    description
+      "Gropuping which can uniquely identify alarm";
+
+    leaf fault-id {
+      type uint16;
+      mandatory true;
+
+      description
+        "Fault specific Id that identifies the fault.";
+    }
+
+    leaf fault-source {
+      type string {
+        length "1..255";
+      }
+      mandatory true;
+
+      description
+        "Represents the Object or source that is suspected to be faulty.";
+    }
+
+    list affected-objects {
+      key name;
+      leaf name {
+        type string {
+          length "1..255";
+        }
+        mandatory true;
+
+        description
+          "Represents the Object or source that is suspected to be affected by this fault";
+      }
+      min-elements 1;
+      max-elements 100;
+
+      description
+        "List of affected-objects";
+    }
+
+    leaf fault-severity {
+      type enumeration {
+        enum CRITICAL {
+          description
+            "Critical alarm means that this device is not able to perform any further service";
+        }
+        enum MAJOR {
+          description
+            "Major alarm appeared on the device";
+        }
+        enum MINOR {
+          description
+            "Minor alarm appeared on the device";
+        }
+        enum WARNING {
+          description
+            "Warning is being reported by the device";
+        }
+      }
+      mandatory true;
+
+      description
+        "Fault severity defines the severity level of the fault. A notification, whose fault severity has the value 'warning',
+        is a special type of an alarm notification. For these alarm notifications,
+        the Master Agent does not expect to receive a clear alarm notification.";
+    }
+
+    leaf is-cleared {
+      type boolean;
+      mandatory true;
+
+      description
+        "Fault state determines the type of the event. Not used if faultSeverity is WARNING.";
+    }
+
+    leaf fault-text {
+      type string {
+        length "0..255";
+      }
+
+      description
+        "Textual description of the fault.";
+    }
+
+    leaf event-time {
+      type yang:date-and-time;
+      mandatory true;
+
+      description
+        "Timestamp to indicate the time when the fault is detected/cleared.";
+    }
+  }
+
+  container active-alarm-list {
+    list active-alarms {
+      key fault-id;
+      uses alarm;
+
+      description
+        "List of currenty active alarms";
+    }
+    config false;
+
+    description
+      "List of currently active alarms. An alarm is removed from this table when the state transitions to clear.";
+  }
+
+  notification alarm-notif {
+    uses alarm;
+
+    description
+      "Notification sent on initial alarm creation, as well as any time the alarm changes state, including clear";
+  }
+}
diff --git a/ntsimulator/yang/o-ran-hardware.yang b/ntsimulator/yang/o-ran-hardware.yang
new file mode 100644 (file)
index 0000000..34cdada
--- /dev/null
@@ -0,0 +1,271 @@
+module o-ran-hardware {
+  yang-version 1.1;
+  namespace "urn:o-ran:hardware:1.0";
+  prefix "o-ran-hw";
+
+  import ietf-hardware {
+    prefix hw;
+  }
+  import iana-hardware {
+    prefix ianahw;
+  }
+
+  organization "O-RAN Alliance";
+
+  contact
+    "www.o-ran.org";
+
+  description
+    "This module defines the YANG definitions for managng the O-RAN hardware.
+
+     Copyright 2019 the O-RAN Alliance.
+
+     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS '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 SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 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.
+
+     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 above disclaimer.
+     * Redistributions in binary form must reproduce the above copyright notice,
+     this list of conditions and the above disclaimer in the documentation
+     and/or other materials provided with the distribution.
+     * Neither the Members of the O-RAN Alliance nor the names of its
+     contributors may be used to endorse or promote products derived from
+     this software without specific prior written permission.";
+
+   revision "2019-03-28" {
+    description
+      "version 1.0.1
+
+      1) added new identities to accommodate cross working group use of
+      o-ran-hardware and assoicated set of augmentations that are backwards
+      compatible to version 1.0.0";
+
+    reference "ORAN-WG4.M.0-v01.00";
+   }
+
+  revision "2019-02-04" {
+   description
+     "version 1.0.0
+
+     1) imported model from xRAN
+     2) changed namespace and reference from xran to o-ran";
+
+   reference "ORAN-WG4.M.0-v01.00";
+  }
+
+  feature ENERGYSAVING {
+    description
+      "Indicates that the Radio Unit supports energy saving state.";
+  }
+
+  // identity statements
+  identity O-RAN-RADIO {
+    base ianahw:module;
+    description
+      "Module used as it represents a self-contained sub-system
+      used in /hw:/hardware/hw:component/hw:class to represent
+      an O-RAN RU";
+  }
+
+  identity O-RAN-HW-COMPONENT {
+    base ianahw:module;
+    description
+      "Module used as it represents a self-contained sub-system
+      used in /hw:/hardware/hw:component/hw:class to represent
+      any O-RAN hardware component";
+  }
+
+  identity O-DU-COMPONENT {
+    base O-RAN-HW-COMPONENT;
+    description
+      "Used in /hw:/hardware/hw:component/hw:class to represent
+      any O-RAN defined O-DU hardware component";
+  }
+
+  identity O-RU-COMPONENT {
+    base O-RAN-HW-COMPONENT;
+    description
+      "Used in /hw:/hardware/hw:component/hw:class to represent
+      any O-RAN defined O-RU hardware component, including a stand-alone
+      O-RU or an O-RU component integrated into a multi-module system.";
+  }
+
+  // typedef statements
+  typedef energysaving-state {
+    type enumeration {
+      enum UNKNOWN {
+        description "The Radio Unit is unable to report energy saving state.";
+      }
+      enum SLEEPING {
+        description
+          "The Radio Unit is in a sleep state. The NETCONF management plane
+           connection is functioning. Other functions and hardware which are
+           not needed for management plane may be in energy saving mode.";
+      }
+      enum AWAKE {
+        description
+          "The Radio Unit is not in an energy saving state.";
+      }
+    }
+    description
+      "new typedef since ietf-hardware only covers pwer-state
+      for redundancy purposes and not power saving operations.";
+  }
+
+  typedef availability-type {
+    type enumeration {
+      enum UNKNOWN {
+        description "The Radio Unit is unable to report its availability state.";
+      }
+      enum NORMAL {
+        description
+          "The equipment is functioning correctly.";
+      }
+      enum DEGRADED {
+        description
+          "The equipment may be reporting a major alarm or may be reporting a critical
+           alarm that is only impacting one or more subcomponent, but where the
+           equipment's implementation permit it to continue operation (server traffic)
+           in a degraded state.
+
+           Used for example, when the equipment has M identical sub-components and
+           when a critical alarm is imapcting only N subcomponents, where N<M.";
+      }
+      enum FAULTY {
+        description
+          "The (sub-)components impacted by the critical alarm(s) impact the
+          ability of the equipment to continue operation (serve traffic).";
+      }
+    }
+    description
+      "Equipment's availability-state is derived by matching active faults
+       and their impact to module's operation and enables an equipment to indicate
+       that even though it may have one or more critical alarms, it can continue
+       to serve traffic.";
+  }
+
+  // common WG4 and croos-WG augmentations using O-RAN-RADIO identity
+
+  augment "/hw:hardware/hw:component" {
+    when "(derived-from-or-self(hw:class, 'o-ran-hw:O-RAN-RADIO')) or
+    (derived-from-or-self(hw:class, 'o-ran-hw:O-RAN-HW-COMPONENT'))";
+    description "New O-RAN parameters for o-ran hardware";
+
+    container label-content {
+      config false;
+      description
+        "Which set of attributes are printed on the Radio Unit's label";
+      leaf model-name {
+        type boolean;
+        description
+          "indicates whether model-name is included on the equipment's label";
+      }
+      leaf serial-number {
+        type boolean;
+        description
+          "indicates whether serial number is included on the equipment's label";
+      }
+    }
+    leaf product-code {
+      type string;
+      config false;
+      mandatory true;
+      description
+        "O-RAN term that is distinct from model-name in ietf-hardware.";
+    }
+    leaf energy-saving-enabled {
+      if-feature "ENERGYSAVING";
+      type boolean;
+      config true;
+      default false;
+      description
+        "This parameter can enable O-RAN unit to be switched to energy
+         saving mode.
+         TRUE indicates to switch the energy saving mode.
+         FALSE indicates to cancel the energy saving mode.
+         At the energy saving mode, all power of whole O-RAN unit becomes
+         lowest level whereas M-plane is still available";
+    }
+  }
+
+  augment "/hw:hardware/hw:component" {
+    when "(derived-from-or-self(hw:class, 'o-ran-hw:O-RAN-RADIO')) or
+    (derived-from-or-self(hw:class, 'ianahw:port')) or
+    (derived-from-or-self(hw:class, 'o-ran-hw:O-RAN-HW-COMPONENT'))";
+    description "New O-RAN parameters for o-ran naming";
+    leaf o-ran-name {
+      type leafref {
+        path "/hw:hardware/hw:component/hw:name";
+      }
+      must "re-match(current(),'[a-zA-Z0-9][a-zA-Z0-9\\.\\-_]{0,253}[a-zA-Z0-9]')" {
+        error-message "Name must match pattern and length.";
+      }
+      mandatory true;
+      description
+        "O-RAN name needed to bind and match with the name of hw element,
+        to be compliant with O-RAN naming convention.";
+    }
+  }
+
+  augment "/hw:hardware/hw:component/hw:state"  {
+    when "(derived-from-or-self(../hw:class, 'o-ran-hw:O-RAN-RADIO')) or
+    (derived-from-or-self(../hw:class, 'o-ran-hw:O-RAN-HW-COMPONENT'))";
+    description
+      "new O-RAN defined state";
+    leaf power-state {
+      if-feature "ENERGYSAVING";
+      type energysaving-state;
+      config false;
+      description
+        "The current power saving state for this component.
+        Note - hw:/hardware/compnent/state/standby-state defined in RFC 4268 is
+        used for redundancy purposes and not power saving operations.";
+    }
+    leaf availability-state {
+      type availability-type;
+      config false;
+      description
+        "Equipment's availability-state is derived by matching active faults
+         and their impact to module's operation and enables an equipment to indicate
+         that even though it may have one or more critical alarms, it can continue
+         to serve traffic.";
+    }
+  }
+
+
+// augmentations to Notifications
+
+  augment "/hw:hardware-state-oper-enabled"  {
+    description "new availability state";
+    leaf availability-state {
+      type leafref {
+        path "/hw:hardware/hw:component/hw:state/o-ran-hw:availability-state";
+      }
+      description
+        "The availability-state of the O-RU.";
+    }
+  }
+
+  augment "/hw:hardware-state-oper-disabled"  {
+    description "new availability state";
+    leaf availability-state {
+      type leafref {
+        path "/hw:hardware/hw:component/hw:state/o-ran-hw:availability-state";
+      }
+      description
+        "The availability-state of the O-RU.";
+    }
+  }
+}
diff --git a/ntsimulator/yang/o-ran-interfaces.yang b/ntsimulator/yang/o-ran-interfaces.yang
new file mode 100644 (file)
index 0000000..70a6d39
--- /dev/null
@@ -0,0 +1,397 @@
+module o-ran-interfaces {
+  yang-version 1.1;
+  namespace "urn:o-ran:interfaces:1.0";
+  prefix "o-ran-int";
+
+
+  import ietf-inet-types {
+    prefix "inet";
+  }
+
+  import iana-if-type {
+    prefix "ianaift";
+  }
+
+  import ietf-interfaces {
+    prefix "if";
+  }
+
+  import ietf-ip {
+    prefix "ip";
+  }
+
+  import ietf-hardware {
+    prefix "hw";
+  }
+
+  import ietf-yang-types {
+    prefix "yang";
+  }
+
+  import iana-hardware {
+    prefix "ianahw";
+  }
+
+  organization "O-RAN Alliance";
+
+  contact
+    "www.o-ran.org";
+
+  description
+    "This module defines the YANG definitions for managng the O-RAN
+     interfaces.
+
+    Copyright 2019 the O-RAN Alliance.
+
+    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS '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 SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 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.
+
+    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 above disclaimer.
+    * Redistributions in binary form must reproduce the above copyright notice,
+    this list of conditions and the above disclaimer in the documentation
+    and/or other materials provided with the distribution.
+    * Neither the Members of the O-RAN Alliance nor the names of its
+    contributors may be used to endorse or promote products derived from
+    this software without specific prior written permission.";
+
+  revision "2019-03-28" {
+    description
+      "version 1.0.1
+
+      1) increasing max elements for user plane DSCP markings to 64
+      2) re-organizing layout to facilitate cross-WG adoption, whilst ensuring
+      nodes are syntactically and semantically equivalent";
+
+    reference "ORAN-WG4.M.0-v01.00";
+  }
+
+  revision "2019-02-04" {
+    description
+      "version 1.0.0
+
+      1) imported model from xRAN
+      2) changed namespace and reference from xran to o-ran";
+
+    reference "ORAN-WG4.M.0-v01.00";
+  }
+
+  feature UDPIP-BASED-CU-PLANE {
+    description
+      "This feature indicates that the RU supports the UDP/IP based transport
+      for the CU plane.";
+  }
+
+  feature ALIASMAC-BASED-CU-PLANE {
+    description
+      "This feature indicates that the RU supports the alias MAC address
+       based transport for the CU plane.";
+  }
+
+
+  typedef pcp {
+    type uint8 {
+      range "0..7";
+    }
+    description
+      "Priority Code Point. PCP is a 3-bit field that refers to the
+      class of service applied to a VLAN tagged frame.  The
+      field specifies a priority value between 0 and 7, these values
+      can be used by quality of service (QoS) to prioritize
+      different classes of traffic.";
+    reference
+     "IEEE 802.1Q-2014: Virtual Bridged Local Area Networks";
+  }
+
+  grouping cos-marking {
+    description
+      "Configuration data for CU Plane ethernet CoS marking";
+    container class-of-service {
+      description
+        "CoS Configuration";
+      leaf u-plane-marking {
+        type pcp;
+        default 7;
+        description
+          "Marking used for default u-plane flows.
+          7 represents highest priority for u-plane marking";
+      }
+      leaf c-plane-marking {
+        type pcp;
+        default 7;
+        description "7 represents highest priority for c-plane marking";
+      }
+      leaf m-plane-marking {
+        type pcp;
+        default 2;
+        description "2 represents highest excellent effort for m-plane marking";
+      }
+      leaf s-plane-marking {
+        type pcp;
+        default 7;
+        description "7 represents highest priority for s-plane marking";
+      }
+      leaf other-marking {
+        type pcp;
+        default 1;
+        description "1 represents best effort for other marking";
+      }
+      list enhanced-uplane-markings{
+        key "up-marking-name";
+        max-elements 4;
+        description
+          "list of mappings for enhanced (non-default) u-plane markings";
+        leaf up-marking-name {
+          type string;
+          description "The name of the marking";
+        }
+        leaf enhanced-marking {
+          type pcp;
+          description "the enhanced u-plane marking";
+        }
+      }
+    }
+  }
+
+  grouping dscp-marking {
+    description
+      "Configuration data for CU Plane DSCP marking";
+    container diffserv-markings {
+      description
+        "DSCP Configuration";
+      leaf u-plane-marking {
+        type inet:dscp;
+        default 46;
+        description
+          "Marking used for default u-plane flows.
+          46 represents expedited forwarding";
+      }
+      leaf c-plane-marking {
+        type inet:dscp;
+        default 46;
+        description "46 represents expedited forwarding";
+      }
+      leaf s-plane-marking {
+        type inet:dscp;
+        default 46;
+        description "46 represents expedited forwarding";
+      }
+      leaf other-marking {
+        type inet:dscp;
+        default 0;
+        description "0 represents best effort forwarding";
+      }
+      list enhanced-uplane-markings{
+        key up-marking-name;
+        max-elements 64;
+        description
+          "list of mappings for enhanced (non-default) u-plane markings";
+        leaf up-marking-name {
+          type string;
+          description "The name of the marking";
+        }
+        leaf enhanced-marking {
+          type inet:dscp;
+          description "the enhanced u-plane marking";
+        }
+      }
+    }
+  }
+
+// Cross Working Group Augmentations Follow
+
+// Cross Working Group augmentations for basic Ethernet leafs
+
+  augment "/if:interfaces/if:interface" {
+    when "if:type = 'ianaift:ethernetCsmacd'" {
+      description "Applies to Ethernet interfaces";
+    }
+    description
+      "Augment the interface model with parameters for
+      base Ethernet interface";
+
+    leaf l2-mtu {
+      type uint16 {
+        range "64 .. 65535";
+      }
+      units bytes;
+      default 1500;
+      description
+        "The maximum size of layer 2 frames that may be transmitted
+        or received on the interface (excluding any FCS overhead).
+        For Ethernet interfaces it also excludes the
+        4-8 byte overhead of any known (i.e. explicitly matched by
+        a child sub-interface) 801.1Q VLAN tags.";
+    }
+    leaf vlan-tagging {
+      type boolean;
+      default true;
+      description
+        "Indicates if VLAN tagging is used.
+        Default true is used to enable equipment to auonomously discover that it is
+        connected to a trunk port.";
+    }
+    uses cos-marking;
+  }
+
+// Cross Working Group augmentation for l2vlan interfaces for VLAN definition
+
+  augment "/if:interfaces/if:interface" {
+    when "if:type = 'ianaift:l2vlan'";
+    description "augments for VLAN definition";
+    leaf base-interface {
+      type if:interface-ref;
+      must "/if:interfaces/if:interface[if:name = current()]"
+            + "/o-ran-int:vlan-tagging = 'true'" {
+        description
+          "The base interface must have VLAN tagging enabled.";
+      }
+      description
+        "The base interface for the VLAN sub-interafce.";
+    }
+    leaf vlan-id {
+      type uint16 {
+        range "1..4094";
+      }
+      description
+        "The VLAN-ID.";
+    }
+  }
+
+// Cross Working Group augmention for both ethernetCsmacd and l2vlan interfaces
+
+  augment "/if:interfaces/if:interface" {
+    when "(if:type = 'ianaift:ethernetCsmacd') or
+          (if:type = 'ianaift:l2vlan')" {
+      description "Applies to ethernetCsmacd and l2vlan interfaces";
+    }
+    description
+      "Augment the interface model with parameters for all
+      both ethernetCsmacd and l2vlan interfaces.";
+    leaf last-cleared {
+      type yang:date-and-time;
+      config false;
+      description
+        "Timestamp of the last time the interface counters were
+        cleared.";
+    }
+  }
+
+// Cross Working Group augmention to ietf-ip covering DSCP for M-Plane
+
+augment "/if:interfaces/if:interface/ip:ipv4" {
+  description "augments for IPv4 based M-Plane transport";
+  leaf m-plane-marking {
+    type inet:dscp;
+    default 18;
+    description "18 represents AF21 or 'immediate traffic'";
+  }
+}
+augment "/if:interfaces/if:interface/ip:ipv6" {
+  description "augments for IPv6 based M-Plane transport";
+  leaf m-plane-marking {
+    type inet:dscp;
+    default 18;
+    description "18 represents AF21 or 'immediate traffic'";
+  }
+}
+
+// WG4 Specific Augmentations Follow
+
+// WG4 Augmentation for basic Ethernet leafs
+
+  augment "/if:interfaces/if:interface" {
+    if-feature ALIASMAC-BASED-CU-PLANE;
+    when "if:type = 'ianaift:ethernetCsmacd'" {
+      description
+        "Applies to WG4 Ethernet interfaces for alias MAC based CU-Plane";
+    }
+    description
+      "Augment the interface model with parameters for
+      base Ethernet interface";
+
+    leaf-list alias-macs {
+      type yang:mac-address;
+      description
+        "Augments interfaces with range of alias MAC addresses.";
+    }
+  }
+
+// WG4 Augmention for both ethernetCsmacd and l2vlan interfaces
+
+  augment "/if:interfaces/if:interface" {
+    when "(if:type = 'ianaift:ethernetCsmacd') or
+          (if:type = 'ianaift:l2vlan')" {
+      description "Applies to ethernetCsmacd and l2vlan interfaces";
+    }
+    description
+      "Augment the interface model with parameters for all
+      both ethernetCsmacd and l2vlan interfaces.";
+    leaf mac-address {
+      type yang:mac-address;
+      description
+        "The MAC address of the interface.";
+    }
+    container port-reference {
+      description
+        "a port reference used by other O-RAN modules";
+      leaf port-name {
+        type leafref {
+          path '/hw:hardware/hw:component/hw:name';
+        }
+        must "derived-from-or-self(deref(current())/../hw:class, 'ianahw:port')";
+// TAKE NOTE - depending on version of pyang, this may generate various
+// warnings, e.g., warning: XPath for "port-name" does not exist
+        description
+          "O-RAN interfaces use a reference to a physical port component.
+
+          In this case, the component name referenced must be of class type
+          port, i.e., when /hw:hardware/hw:component/hw:class is derived from
+          ianahw:port";
+      }
+      leaf port-number {
+        type uint8;
+        description
+          "A number allocated by the server which identifies a port.
+          Port number value is 0 to N-1 where N is number of ports
+          in the device.
+
+          This value is fixed for the lifetime of the equipment, i.e., cannot be
+          changed during equipment reboots.";
+      }
+    }
+  }
+
+// WG4 specific augmention to ietf-ip covering DSCP for CUS Plane
+
+  augment "/if:interfaces/if:interface/ip:ipv4" {
+    if-feature UDPIP-BASED-CU-PLANE;
+    description "augments for IPv4 based CUS transport";
+    uses dscp-marking;
+  }
+  augment "/if:interfaces/if:interface/ip:ipv6" {
+    if-feature UDPIP-BASED-CU-PLANE;
+    description "augments for IPv6 based CUS transport";
+    uses dscp-marking;
+  }
+
+// Other Working Group Specific Augmentations Follow Here
+
+
+  rpc reset-interface-counters {
+    description
+      "Management plane triggered restart of the interface counters.";
+  }
+}
diff --git a/ntsimulator/yang/o-ran-laa-operations.yang b/ntsimulator/yang/o-ran-laa-operations.yang
new file mode 100644 (file)
index 0000000..dce0e31
--- /dev/null
@@ -0,0 +1,253 @@
+module o-ran-laa-operations {
+  yang-version 1.1;
+  namespace "urn:o-ran:laa-operations:1.0";
+  prefix "o-ran-laa-operations";
+
+  import o-ran-module-cap {
+    prefix "mcap";
+  }
+
+  organization "O-RAN Alliance";
+
+  contact
+    "www.o-ran.org";
+
+  description
+    "This module defines the operations for DFS measurement.
+
+    Copyright 2019 the O-RAN Alliance.
+
+    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS '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 SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 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.
+
+    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 above disclaimer.
+    * Redistributions in binary form must reproduce the above copyright notice,
+    this list of conditions and the above disclaimer in the documentation
+    and/or other materials provided with the distribution.
+    * Neither the Members of the O-RAN Alliance nor the names of its
+    contributors may be used to endorse or promote products derived from
+    this software without specific prior written permission.";
+
+  revision "2019-04-01" {
+    description
+      "version 1.1.0
+
+      1) corrected error in module reference for LAA feature";
+
+    reference "ORAN-WG4.M.0-v01.00";
+  }
+
+  revision "2019-02-04" {
+    description
+      "version 1.0.0
+
+      1) imported model from xRAN
+      2) changed namespace and reference from xran to o-ran";
+
+    reference "ORAN-WG4.M.0-v01.00";
+  }
+
+  typedef band-num {
+    type enumeration {
+      enum BAND_46_SUBBAND_A {
+        description
+          "46a: 5150 MHz       -       5250 MHz";
+      }
+      enum BAND_46_SUBBAND_B {
+        description
+          "46b: 5250 MHz       -       5350 MHz";
+      }
+      enum BAND_46_SUBBAND_C {
+        description
+          "46c: 5470 MHz       -       5725 MHz";
+      }
+      enum BAND_46_SUBBAND_D1 {
+        description
+          "46d1: 5725 MHz      -       5850 MHz";
+      }
+      enum BAND_46_SUBBAND_D2 {
+        description
+          "46d2: 5850 MHz      -       5925 MHz";
+      }
+    }
+    description
+      "This value indicates the list of bands supported as per the document,
+      3GPP TS 36.104 V14.2.0 (2016-12), 'Section 5.5 Operation bands'.";
+  }
+
+  grouping band-configuration {
+    description
+      "Grouping for band configuration";
+
+    leaf band-number {
+      type band-num;
+      description
+        "This value indicates the list of bands supported as per the document,
+        3GPP TS 36.104 V14.2.0 (2016-12), 'Section 5.5 Operation bands'.";
+    }
+    leaf-list channel-center-frequency {
+      type uint16;
+      units kilohertz;
+      description
+        "This value indicates carrier center frequency in KHz";
+    }
+  }
+
+  grouping measurement-parameters {
+    description
+      "Grouping for measurement parameters";
+
+    leaf duration-per-channel {
+      type uint16;
+      units milliseconds;
+      description
+        "This value indicates measurement duration per channel in milliseconds.";
+    }
+
+    leaf maximum-response-time {
+      type uint16;
+      units seconds;
+      description
+        "This value indicates maximum response time (i.e., timer) in seconds.";
+    }
+  }
+
+  grouping channel-result-element {
+    description
+      "Grouping for channel result element";
+
+    leaf measured-channel {
+      type uint16;
+      units kilohertz;
+      description
+        "This value indicates carrier center frequency for which the result is computed in KHz.";
+    }
+
+    leaf occupancy-ratio {
+      type uint8;
+      units percent;
+      description
+        "This value indicates occupancy ratio in percentage.";
+    }
+
+    leaf average-rssi {
+      type int8;
+      units dBm;
+      description
+        "This value indicates average RSSI in dBm";
+    }
+  }
+
+  grouping band-result-element {
+    description
+      "Grouping for band result element";
+
+    leaf band-number {
+      type band-num;
+      description
+        "This value indicates the band for which the result is computed.";
+    }
+
+    leaf measurement-success {
+      type boolean;
+      description
+        "This value indicates whether the measurement is successful for the given band.";
+    }
+    leaf failure-message {
+      when "../measurement-success='false'";
+      type enumeration {
+        enum TIMEOUT {
+          description "Timed out waiting for measurement completion.";
+        }
+      }
+      description "This value indicates the detailed error message for failure of the measurement at O-RU.";
+    }
+
+    list channel-result {
+      when "../measurement-success='true'";
+      key "measured-channel";
+      description "Results for a particular channel";
+
+      uses channel-result-element;
+    }
+  }
+
+  //rpc definitions
+  rpc start-measurements {
+    if-feature mcap:LAA;
+    description "Measurements for Carrier-Selection and Dynamic Frequency Selection (DFS)";
+    input {
+      list band-config {
+        key "band-number";
+        description "Per band configuration for measurements.";
+
+        uses band-configuration;
+      }
+
+      uses measurement-parameters;
+    }
+
+    output {
+      list band-config {
+        key "band-number";
+        description "Output list for all the bands requested for measurements.";
+
+        leaf band-number {
+          type band-num;
+          description
+            "This value indicates the list of bands supported as per the document,
+            3GPP TS 36.104 V14.2.0 (2016-12), 'Section 5.5 Operation bands'.";
+        }
+        leaf-list carrier-center-frequency {
+          type uint16;
+          units kilohertz;
+          description
+            "This value indicates carrier center frequency in KHz";
+        }
+        leaf status {
+          type enumeration {
+            enum ACCEPTED {
+              description "This indicates the measurements for particular sub band is accepted at O-RU.";
+            }
+            enum REJECTED {
+              description "This indicates the measurements for particular sub band is rejected at O-RU.";
+            }
+          }
+          description "This value indicates the status of the measurement acceptance at O-RU.";
+        }
+
+        leaf error-message {
+          when "../status='REJECTED'";
+          type string;
+          description
+            "This value indicates the detailed error message for the measurement being rejected at O-RU.";
+        }
+      }
+    }
+  }
+
+  // notifications
+  notification measurement-result {
+    if-feature mcap:LAA;
+    description "Notification to provide the results of carrier selection and DFS.";
+    list band-result {
+      key "band-number";
+      description "Results for a particular sub band under band 46.";
+
+      uses band-result-element;
+    }
+  }
+}
diff --git a/ntsimulator/yang/o-ran-laa.yang b/ntsimulator/yang/o-ran-laa.yang
new file mode 100644 (file)
index 0000000..c2c3f25
--- /dev/null
@@ -0,0 +1,110 @@
+module o-ran-laa {
+  yang-version 1.1;
+  namespace "urn:o-ran:laa:1.0";
+  prefix "o-ran-laa";
+
+  import o-ran-module-cap {
+    prefix "mcap";
+  }
+
+  organization "O-RAN Alliance";
+
+  contact
+    "www.o-ran.org";
+
+  description
+    "This module defines the configuration for Carrier-selection and dynamic frequency selection (DFS).
+    Also this module defines operations for DFS measurement.
+
+    Copyright 2019 the O-RAN Alliance.
+
+    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS '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 SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 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.
+
+    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 above disclaimer.
+    * Redistributions in binary form must reproduce the above copyright notice,
+    this list of conditions and the above disclaimer in the documentation
+    and/or other materials provided with the distribution.
+    * Neither the Members of the O-RAN Alliance nor the names of its
+    contributors may be used to endorse or promote products derived from
+    this software without specific prior written permission.";
+
+  revision "2019-02-04" {
+    description
+      "version 1.0.0
+
+      1) imported model from xRAN
+      2) changed namespace and reference from xran to o-ran";
+
+    reference "ORAN-WG4.M.0-v01.00";
+  }
+  
+  grouping laa-configuration {
+    description
+      "Grouping for LAA configuration";
+      
+    leaf number-of-laa-scarriers {
+      type uint8;
+      description "Number of LAA secondary carriers to be supported at O-RU.";
+    }
+
+    leaf multi-carrier-type {
+      type enumeration {
+        enum A1;
+        enum A2;
+        enum B1;
+        enum B2;
+      }
+      description
+        "This value indicates the list of multi carrier types which as per the document,
+        3GPP TS 36.213 V13.6.0 (2017-06) 15.1.5 Channel access procedure for transmission(s) on multiple carriers.";
+    }
+
+    leaf multi-carrier-tx {
+      type boolean;
+      description
+        "This value indicates whether self-deferral is activated or not.";
+    }
+
+    leaf multi-carrier-freeze {
+      when "../multi-carrier-type='A1'";
+      type boolean;
+      description "This value indicates if the absence of other technology in the unlicensed band can be guaranteed.";
+    }
+
+    leaf laa-ending-dwpts-supported {
+      type boolean;
+      description
+        "This value indicates whether LAA ending in DwPTS is supported.";
+    }
+
+    leaf laa-starting-in-second-slot-supported {
+      type boolean;
+      description
+        "This value indicates whether LAA starting in second slot is supported";
+    }
+  }
+
+  container laa-config {
+    must "number-of-laa-scarriers <= /mcap:module-capability/mcap:band-capabilities[mcap:band-number = '46']/mcap:sub-band-info/mcap:number-of-laa-scarriers" {
+      error-message "number of laa secondary carriers must be less than supported number of laa scells.";
+    }
+    presence "indicates LAA configuration";
+    description "Container to specify all LAA specific configuration";
+
+    uses laa-configuration;
+  }
+}
diff --git a/ntsimulator/yang/o-ran-lbm.yang b/ntsimulator/yang/o-ran-lbm.yang
new file mode 100644 (file)
index 0000000..359257c
--- /dev/null
@@ -0,0 +1,308 @@
+module o-ran-lbm {
+  yang-version 1.1;
+  namespace "urn:o-ran:lbm:1.0";
+  prefix "o-ran-lbm";
+
+  import ietf-yang-types {
+    prefix yang;
+    revision-date 2013-07-15;
+  }
+
+  import ietf-interfaces {
+    prefix if;
+  }
+
+  import o-ran-interfaces {
+    prefix "o-ran-int";
+  }
+
+  organization "O-RAN Alliance";
+
+  contact
+    "www.o-ran.org";
+
+  description
+    "This module defines the module capabilities for
+    the O-RAN Radio loop-back protocol (IEEE 802.1ag).
+    It is derived from MEF-38 (Service OAM Fault Management YANG Modules, April 2012)
+
+    Copyright 2019 the O-RAN Alliance.
+
+    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS '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 SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 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.
+
+    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 above disclaimer.
+    * Redistributions in binary form must reproduce the above copyright notice,
+    this list of conditions and the above disclaimer in the documentation
+    and/or other materials provided with the distribution.
+    * Neither the Members of the O-RAN Alliance nor the names of its
+    contributors may be used to endorse or promote products derived from
+    this software without specific prior written permission.";
+
+  revision "2019-02-04" {
+    description
+      "version 1.0.0
+
+      1) imported model from xRAN
+      2) changed namespace and reference from xran to o-ran";
+
+    reference "ORAN-WG4.M.0-v01.00";
+  }
+
+  typedef priority-type {
+    type uint32 {
+      range "0..7";
+    }
+    description
+      "A 3 bit priority value to be used in the VLAN tag, if present
+       in the transmitted frame.";
+    reference "[802.1q] 12.14.7.3.2:e";
+  }
+
+  typedef mep-id-type {
+    type uint16 {
+      range "1..8191";
+    }
+    description
+      "Maintenance association End Point Identifier (MEPID): A small integer,
+       unique over a given Maintenance Association, identifying a
+       specific MEP.";
+    reference "[802.1q] 3.19 and 19.2.1";
+  }
+
+  typedef vlan-id-type {
+    type uint16 {
+      range "1..4094";
+    }
+    description
+      "The VLAN-ID that uniquely identifies a VLAN.  This is the 12-bit VLAN-ID
+       used in the VLAN Tag header.";
+    reference "[802.1q] 9.6";
+  }
+
+  typedef md-level-type {
+    type int32 {
+      range "0..7";
+    }
+    description
+      "Maintenance Domain Level (MD Level) identifier.  Higher numbers
+       correspond to higher Maintenance Domains, those with the greatest
+       physical reach, with the highest values for customers' CFM PDUs.
+       Lower numbers correspond to lower Maintenance Domains, those with
+       more limited physical reach, with the lowest values for CFM PDUs
+       protecting single bridges or physical links.";
+    reference "[802.1q] 18.3, 21.4.1, IEEE8021-CFM-MIB.Dot1agCfmMDLevel";
+  }
+
+  typedef lbm-transaction-id-type {
+    type uint32;
+    description
+      "A loopback transaction identifier";
+    reference "[802.1q] 21.7.3";
+  }
+
+// grouping
+
+  grouping md-group {
+    list maintenance-domain {
+      key "id";
+      description
+        "A Maintenance Domain managed object is required in order to create an MA
+         with a MAID that includes that Maintenance Domain's Name. From
+         this Maintenance Domain managed object, all Maintenance
+         Association managed objects associated with that Maintenance
+         Domain managed object can be accessed, and thus controlled.";
+      reference "[802.1q] 12.14.5";
+
+      leaf id {
+        type string;
+        description
+          "A unique identifier of a Maintenance Domain";
+        reference "[802.1q] 12.14.5";
+      }
+
+      leaf name {
+        type string;
+        description
+          "The value for the Maintenance Domain Name. Only the name-type
+          'character-string' is supported";
+        reference "[802.1q] 21.6.5.1 (Table 21-19), 12.14.5.3.2:a";
+      }
+
+      leaf md-level {
+        type md-level-type;
+        default 0;
+        description
+          "Integer identifying the Maintenance Domain Level (MD Level).  Higher
+           numbers correspond to higher Maintenance Domains, those with the
+           greatest physical reach, with the highest values for customers'
+           CFM PDUs.  Lower numbers correspond to lower Maintenance
+           Domains, those with more limited physical reach, with the lowest
+           values for CFM PDUs protecting single bridges or physical links.";
+        reference "[802.1q] 12.14.5.1.3:b";
+      }
+
+      list maintenance-association {
+        key "id";
+        description
+          "This list represents Maintenance Entity Groups (Y.1731) or
+           Maintenance Associations (802.1ag). MEGs/MAs are sets of
+           MEPs, each configured to the same service inside a common
+           OAM domain.";
+        leaf id {
+          type string;
+          description
+            "A unique identifier of a Maintenance Association";
+          reference "[802.1q] 12.14.6";
+        }
+        leaf name {
+          type string;
+
+          description
+            "The value for the Maintenance Association Name. Only the name-type
+            'character-string' is supported";
+          reference "[802.1q] 12.14.5.3.2:b, Table 21-20";
+        }
+
+        list component-list {
+          key "component-id";
+          description
+            "A list of components each of which can be managed in a manner
+             essentially equivalent to an 802.1Q bridge.";
+          reference "[802.1q] IEEE8021-CFM-V2-MIB.ieee8021CfmMaCompTable";
+
+          leaf component-id {
+            type uint32;
+            description
+              "The bridge component within the system to which the information
+               in this maintenance-association applies";
+            reference "[802.1q] IEEE8021-CFM-V2-MIB.ieee8021CfmMaComponentId";
+          }
+
+          leaf name {
+            type string;
+
+            description
+              "The value for the Maintenance Association Name. Only the name-type
+              'character-string' is supported";
+            reference "[802.1q] 12.14.5.3.2:b, Table 21-20";
+          }
+
+          leaf-list vid {
+            type leafref {
+              path "/if:interfaces/if:interface/o-ran-int:vlan-id";
+            }
+            min-elements 1;
+            ordered-by user;
+            description
+              "The VID(s) monitored by this MA, or 0, if the MA is not attached to any
+               VID. The first VID returned is the MA's Primary VID";
+            reference "[802.1q] 12.14.5.3.2:b";
+          }
+
+          leaf-list remote-meps {
+            type mep-id-type;
+            description
+              "A list of the MEPIDs of the MEPs in the MA.";
+            reference "[802.1q] 12.14.6.1.3:g";
+          }
+
+          list maintenance-association-end-point {
+            key "mep-identifier";
+            description
+              "The list of Maintenance association End Points in a specific Maintance
+              Association.";
+
+            leaf mep-identifier {
+              type mep-id-type;
+              description
+                "Integer that is unique among all the MEPs in the same MA. Other
+                definition is: a small integer, unique over a given
+                Maintenance Association, identifying a specific Maintenance
+                association End Point.";
+              reference "[802.1q] 12.14.6.3.2:b";
+            }
+
+            leaf interface {
+              type leafref {
+                path "/if:interfaces/if:interface/if:name";
+              }
+              mandatory true;
+              description
+              "An interface, either a Bridge Port or an aggregated IEEE 802.3 port
+               within a Bridge Port, to which the MEP is attached. Each interface in
+               the system is uniquely identified by an interface-name. The structure
+               and content of the name is outside the scope of this specification.";
+              reference "[802.1q] 12.14.7.1.3:b";
+            }
+
+            leaf primary-vid {
+              type leafref {
+                path "/if:interfaces/if:interface/o-ran-int:vlan-id";
+              }
+              mandatory true;
+              description
+              "The Primary VID of the MEP. The value 0 indicates that either the
+               Primary VID is that of the MEP's MA or that the MEP's MA is
+               associated with no VID";
+              reference "[802.1q] 12.14.7.1.3:d";
+            }
+
+            leaf administrative-state {
+              type boolean;
+              mandatory true;
+              description
+                "The administrative state of the MEP";
+              reference "[802.1q] 12.14.7.1.3:e";
+            }
+
+            leaf mac-address {
+              type leafref {
+                path "/if:interfaces/if:interface/o-ran-int:mac-address";
+              }
+              config false;
+              description
+                "The MAC address of the MEP";
+              reference "[802.1q] 12.14.7.1.3:i";
+            }
+
+            container loopback {
+              config false;
+              description
+                "Data definitions related to the Loopback function.";
+              leaf replies-transmitted {
+                type yang:counter32;
+                config false;
+                mandatory true;
+                description
+                  "The total number of LBRs transmitted.";
+                reference "[802.1q] 12.14.7.1.3:ad";
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+
+// top level container
+  container md-data-definitions {
+    description
+      "Data definitions related to the maineance domains used for supporting
+      Ethernet loopback connectivity checks";
+    uses md-group;
+  }
+}
diff --git a/ntsimulator/yang/o-ran-module-cap.yang b/ntsimulator/yang/o-ran-module-cap.yang
new file mode 100644 (file)
index 0000000..de5ec05
--- /dev/null
@@ -0,0 +1,579 @@
+module o-ran-module-cap {
+  yang-version 1.1;
+  namespace "urn:o-ran:module-cap:1.0";
+  prefix "o-ran-module-cap";
+
+  import o-ran-compression-factors {
+    prefix "cf";
+  }
+
+  organization "O-RAN Alliance";
+
+  contact
+    "www.o-ran.org";
+
+  description
+    "This module defines the module capabilities for
+    the O-RAN Radio Unit.
+
+    Copyright 2019 the O-RAN Alliance.
+
+    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS '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 SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 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.
+
+    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 above disclaimer.
+    * Redistributions in binary form must reproduce the above copyright notice,
+    this list of conditions and the above disclaimer in the documentation
+    and/or other materials provided with the distribution.
+    * Neither the Members of the O-RAN Alliance nor the names of its
+    contributors may be used to endorse or promote products derived from
+    this software without specific prior written permission.";
+
+  revision "2019-02-04" {
+    description
+      "version 1.0.0
+
+      1) imported model from xRAN
+      2) changed namespace and reference from xran to o-ran";
+
+    reference "ORAN-WG4.M.0-v01.00";
+  }
+
+  feature LAA {
+    description
+      "Indicates that the Radio Unit supports LAA.";
+  }
+
+  feature TRANSPORT-FRAGMENTATION {
+    description
+      "This leaf is used to indicate whether the O-RU supports O-RAN Radio Transport Fragmentation";
+  }
+
+  typedef sub-band-string {
+    type string {
+      pattern [ABCD];
+    }
+    description "Sub bands definition";
+  }
+
+  typedef scs-config-type {
+    type enumeration {
+      enum KHZ_15 {
+        value 0;
+        description
+          "15kHz sub carrier spacing";
+      }
+      enum KHZ_30 {
+        value 1;
+        description
+          "30kHz sub carrier spacing";
+      }
+      enum KHZ_60 {
+        value 2;
+        description
+          "60kHz sub carrier spacing";
+      }
+      enum KHZ_120 {
+        value 3;
+        description
+          "120kHz sub carrier spacing";
+      }
+      enum KHZ_240 {
+        value 4;
+        description
+          "240kHz sub carrier spacing";
+      }
+      enum KHZ_1_25 {
+        value 12;
+        description
+          "1,25kHz sub carrier spacing";
+      }
+      enum KHZ_3_75 {
+        value 13;
+        description
+          "3.75kHz sub carrier spacing";
+      }
+      enum KHZ_5 {
+        value 14;
+        description
+          "5kHz sub carrier spacing";
+      }
+      enum KHZ_7_5 {
+        value 15;
+        description
+          "7.5kHz sub carrier spacing";
+      }
+    }
+
+    description
+      "Scs configuration type definition";
+  }
+
+  grouping compression-method-grouping {
+    description
+      "Grouping for compression method.";
+
+    leaf compression-method {
+      type enumeration {
+        enum BLOCK_FLOATING_POINT {
+          description
+            "Block floating point compression and decompression will be used";
+        }
+
+        enum BLOCK_SCALING {
+          description
+            "Block scaling compression and decompresion will be used";
+        }
+
+        enum U_LAW {
+          description
+            "u-Law compression and decompresion method will be used";
+        }
+
+        enum BEAMSPACE {
+          description
+            "Beamspace compression and decompression will be used";
+        }
+
+        enum MODULATION {
+          description
+            "Modulation compression and decompression will be used";
+        }
+      }
+      description
+        "Compresion method which can be supported by the O-RU";
+    }
+  }
+
+  grouping sub-band-max-min-ul-dl-frequency {
+    description
+    "Grouping for defining max and min supported frequency - dl and ul.";
+
+    leaf max-supported-frequency-dl {
+      type uint64;
+      description
+        "This value indicates Maximum supported downlink frequency in the
+        LAA subband. Value unit is Hz.";
+    }
+
+    leaf min-supported-frequency-dl {
+      type uint64;
+      description
+        "This value indicates Minimum supported downlink frequency in the
+        LAA subband. Value unit is Hz.";
+    }
+  }
+
+  grouping format-of-iq-sample {
+    description
+      "Indicates module capabilities about IQ samples";
+
+    leaf dynamic-compression-supported {
+      type boolean;
+
+      description
+        "Informs if radio supports dynamic compression method";
+    }
+
+    leaf realtime-variable-bit-width-supported {
+      type boolean;
+
+      description
+        "Informs if O-RU supports realtime variable bit with";
+    }
+
+    list compression-method-supported {
+      key "iq-bitwidth compression-type";
+      uses cf:compression-details;
+
+      description
+        "List of supported compression methods by O-RU";
+    }
+
+    leaf variable-bit-width-per-channel-supported {
+      when "/module-capability/ru-capabilities/format-of-iq-sample/realtime-variable-bit-width-supported = 'true'";
+      type boolean;
+
+      description
+        "Informs if variable bit width per channel is supported or not";
+    }
+
+    leaf syminc-supported {
+      type boolean;
+
+      description
+        "Informs if symbol number increment command in a C-Plane is
+         supported or not";
+    }
+  }
+
+  grouping scs-a-b {
+    description
+      "Grouping for scs-a and scs-b";
+    leaf scs-a{
+      type scs-config-type;
+      description
+        "Sub-carrier spacing configuration";
+    }
+    leaf scs-b{
+      type scs-config-type;
+      description
+        "Sub-carrier spacing configuration";
+    }
+  }
+
+  grouping ul-mixed-num-required-guard-rbs {
+    description
+      "Required number of guard resource blocks for the combination of
+      subcarrier spacing values for uplink";
+    uses scs-a-b;
+    leaf number-of-guard-rbs-ul{
+      type uint8;
+      description
+        "This value indicates the required number of guard resource blocks
+         between the mixed numerologies, the RB using scs-a and the RB
+         using scs-b. It's number is based on scs-a";
+    }
+  }
+
+  grouping dl-mixed-num-required-guard-rbs {
+    description
+      "Required number of guard resource blocks for the combination of
+      subcarrier spacing values for uplink";
+    uses scs-a-b;
+    leaf number-of-guard-rbs-dl{
+      type uint8;
+      description
+        "This value indicates the required number of guard resource blocks
+         between the mixed numerologies, the RB using scs-a and the RB
+         using scs-b. It's number is based on scs-a";
+    }
+  }
+
+  grouping ru-capabilities {
+    description
+      "Structure representing set of capabilities.";
+
+    leaf ru-supported-category {
+      type enumeration {
+        enum CAT_A {
+          description
+            "Informs that precoding is not supported in O-RU";
+        }
+        enum CAT_B {
+          description
+            "Informs that precoding is supported in O-RU";
+        }
+      }
+
+      description
+        "Informs about which category O-RU supports";
+    }
+
+    leaf number-of-ru-ports {
+      type uint8;
+      description
+        "Assuming all endpoints support time-managed traffic AND non-time-managed traffic (choice is as per configuration)
+         - the number of O-RU ports is the product of number of spatial streams (leaf number-of-spatial-streams) and number of numerologies O-RU supports.
+         For example, if the number of spatial streams is 4 then the number of O-RU ports is 8 when PUSCH and PRACH are processed in the different endpoints.
+         In case there are specific endpoints that support non-time-managed traffic only
+         - the number of O-RU ports calculated with above mentioned equation is extended by number of endpoints supporting only non-time-managed traffic.";
+    }
+
+    leaf number-of-spatial-streams {
+      type uint8;
+      description
+        "This value indicates the number of spatial streams supported at O-RU for DL and UL.
+         For DL, it is same as the number of antenna ports specified in 3GPP TS38.214, Section 5.2 and 3GPP TS36.213, Section 5.2.";
+    }
+
+    leaf max-power-per-pa-antenna {
+      type decimal64{
+        fraction-digits 4;
+      }
+      description
+        "This value indicates Maximum Power per PA per antenna. Value unit is dBm.";
+    }
+
+    leaf min-power-per-pa-antenna {
+      type decimal64{
+        fraction-digits 4;
+      }
+      description
+        "This value indicates Minimum Power per PA per antenna. Value unit is dBm.";
+    }
+
+    leaf fronthaul-split-option {
+      type uint8 {
+        range "7";
+      }
+      description
+        "This value indicates the Fronthaul Split Option, i.e., 2 or 7 in this release.";
+    }
+
+    container format-of-iq-sample {
+      description
+        "Indicates module capabilities about IQ samples";
+
+      uses format-of-iq-sample;
+    }
+
+    list ul-mixed-num-required-guard-rbs {
+      key "scs-a scs-b";
+
+      uses ul-mixed-num-required-guard-rbs;
+    }
+    list dl-mixed-num-required-guard-rbs {
+      key "scs-a scs-b";
+
+      uses dl-mixed-num-required-guard-rbs;
+    }
+
+    leaf energy-saving-by-transmission-blanks {
+      type boolean;
+      mandatory true;
+      description
+        "Parameter informs if unit supports energy saving by transmission blanking";
+    }
+
+    leaf dynamic-transport-delay-management-supported {
+      type boolean;
+      mandatory true;
+      description
+        "Parameter informs if unit supports dynamic transport delay management through eCPRI Msg 5";
+    }
+  }
+
+  grouping sub-band-info {
+    description "container for collection of leafs for LAA subband 46";
+    list sub-band-frequency-ranges {
+      key sub-band;
+      description "frequency information on a per sub-band basis";
+      leaf sub-band {
+        type sub-band-string;
+        description "Sub band when band 46";
+      }
+      uses sub-band-max-min-ul-dl-frequency;
+    }
+    leaf number-of-laa-scarriers {
+      type uint8;
+      description
+        "This value indicates the number of LAA secondary carriers supported at O-RU.";
+    }
+
+    leaf maximum-laa-buffer-size {
+      type uint16;
+      description
+        "Maximum O-RU buffer size in Kilobytes (KB) per CC. This parameter is
+         needed at the O-DU to know how much data can be sent in advance
+         and stored at the O-RU to address the LBT uncertainity.";
+    }
+
+    leaf maximum-processing-time {
+      type uint16;
+      units microseconds;
+      description
+        "Maximum O-RU Processing time in microseconds at the O-RU to handle the
+         received/transmitted packets from/to the O-DU. This parameter is
+         needed at the O-DU to determine the time where it needs to send
+         the data to the O-RU.";
+    }
+
+    leaf self-configure {
+      type boolean;
+      description "This value indicates that the O-RU can manage the contention window locally. ";
+    }
+  }
+
+  grouping support-for-dl {
+    description
+      "Grouping for DL specific parameters";
+
+    leaf max-supported-frequency-dl {
+      type uint64;
+      description
+        "This value indicates Maximum supported downlink frequency. Value unit is Hz.";
+    }
+
+    leaf min-supported-frequency-dl {
+      type uint64;
+      description
+        "This value indicates Minimum supported downlink frequency. Value unit is Hz.";
+    }
+
+    leaf max-supported-bandwidth-dl {
+      type uint64;
+      description
+        "This value indicates Maximum total downlink bandwidth in module. Value unit is Hz.";
+    }
+
+    leaf max-num-carriers-dl {
+      type uint32;
+      description
+        "This value indicates Maximum number of downlink carriers in module.";
+    }
+
+    leaf max-carrier-bandwidth-dl {
+      type uint64;
+      description
+        "This value indicates Maximum bandwidth per downlink carrier. Value unit is Hz.";
+    }
+
+    leaf min-carrier-bandwidth-dl {
+      type uint64;
+      description
+        "This value indicates Minimum bandwidth per downlink carrier. Value unit is Hz.";
+    }
+  }
+
+  grouping support-for-ul {
+    description
+      "Grouping for UL specific parameters";
+
+    leaf max-supported-frequency-ul {
+      when "../band-number != '46'";
+      type uint64;
+      description
+        "This value indicates Maximum supported uplink frequency. Value unit is Hz.";
+    }
+
+    leaf min-supported-frequency-ul {
+      when "../band-number != '46'";
+      type uint64;
+      description
+        "This value indicates Minimum supported uplink frequency. Value unit is Hz.";
+    }
+
+    leaf max-supported-bandwidth-ul {
+      when "../band-number != '46'";
+      type uint64;
+      description
+        "This value indicates Maximum total uplink bandwidth in module. Value unit is Hz.";
+    }
+
+    leaf max-num-carriers-ul {
+      when "../band-number != '46'";
+      type uint32;
+      description
+        "This value indicates Maximum number of uplink carriers in module.";
+    }
+
+    leaf max-carrier-bandwidth-ul {
+      when "../band-number != '46'";
+      type uint64;
+      description
+        "This value indicates Maximum bandwidth per uplink carrier. Value unit is Hz.";
+    }
+
+    leaf min-carrier-bandwidth-ul {
+      when "../band-number != '46'";
+      type uint64;
+      description
+        "This value indicates Minimum bandwidth per uplink carrier. Value unit is Hz.";
+    }
+  }
+
+  grouping band-capabilities {
+    description
+      "Capabilities that are needed to be defined per each band";
+
+    leaf band-number {
+      type uint16;
+      description
+        "Band number";
+    }
+
+    container sub-band-info {
+      when "../band-number = '46'";
+      if-feature "o-ran-module-cap:LAA";
+      description "container for collection of leafs for LAA subband 46";
+      uses sub-band-info;
+    }
+
+    uses support-for-dl;
+    uses support-for-ul;
+
+    leaf max-num-component-carriers {
+      type uint8;
+      description "maximum number of component carriers supported by the O-RU";
+    }
+
+    leaf max-num-bands {
+      type uint16;
+      description "maximum number of bands supported by the O-RU";
+    }
+
+    leaf max-num-sectors {
+      type uint8;
+      description "maximum number of sectors supported by the O-RU";
+    }
+
+    leaf max-power-per-antenna {
+      type decimal64{
+        fraction-digits 4;
+      }
+      description
+        "This value indicates Maximum Power per band per antenna. Value unit is dBm.";
+    }
+
+    leaf min-power-per-antenna {
+      type decimal64{
+        fraction-digits 4;
+      }
+      description
+        "This value indicates Minimum Power per band per antenna. Value unit is dBm.";
+    }
+
+    leaf codebook-configuration_ng {
+        type uint8;
+        description
+          "This parameter informs the precoder codebook_ng that are used for precoding";
+      }
+
+    leaf codebook-configuration_n1 {
+        type uint8;
+        description
+          "This parameter informs the precoder codebook_n1 that are used for precoding";
+      }
+
+    leaf codebook-configuration_n2 {
+        type uint8;
+        description
+          "This parameter informs the precoder codebook_n2 that are used for precoding";
+    }
+  }
+
+  container module-capability {
+    config false;
+    description
+      "module capability object responsible for providing module capability.";
+
+    container ru-capabilities {
+      description
+        "Structure representing set of capabilities.";
+
+      uses ru-capabilities;
+    }
+
+    list band-capabilities {
+      key band-number;
+      description
+        "Capabilities that are needed to be defined per each band";
+
+      uses band-capabilities;
+    }
+  }
+}
diff --git a/ntsimulator/yang/o-ran-mplane-int.yang b/ntsimulator/yang/o-ran-mplane-int.yang
new file mode 100644 (file)
index 0000000..80e1cab
--- /dev/null
@@ -0,0 +1,240 @@
+module o-ran-mplane-int {
+  yang-version 1.1;
+  namespace "urn:o-ran:mplane-interfaces:1.0";
+  prefix "o-ran-mplane-int";
+
+  import ietf-inet-types {
+    prefix "inet";
+  }
+
+  import ietf-interfaces {
+    prefix "if";
+  }
+
+  import o-ran-interfaces {
+    prefix "o-ran-int";
+  }
+
+  organization "O-RAN Alliance";
+
+  contact
+    "www.o-ran.org";
+
+  description
+    "This module defines the YANG definitions for managng the O-RAN Radio Unit
+     management plane interface.
+
+     Copyright 2019 the O-RAN Alliance.
+
+     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS '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 SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 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.
+
+     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 above disclaimer.
+     * Redistributions in binary form must reproduce the above copyright notice,
+     this list of conditions and the above disclaimer in the documentation
+     and/or other materials provided with the distribution.
+     * Neither the Members of the O-RAN Alliance nor the names of its
+     contributors may be used to endorse or promote products derived from
+     this software without specific prior written permission.";
+
+  revision "2019-04-11" {
+       description
+         "version 1.0.2
+
+         1) Changes for ERI-001 - enabling NETCONF clients to be configured.
+         2) shifting new container to correct position.";
+
+       reference "ORAN-WG4.M.0-v01.00";
+  }
+
+  revision "2019-03-07" {
+    description
+      "version 1.0.1
+
+      1) backward compatible changes to introduce groupings.";
+
+    reference "ORAN-WG4.M.0-v01.00";
+  }
+
+  revision "2019-02-04" {
+    description
+      "version 1.0.0
+
+      1) imported model from xRAN
+      2) changed namespace and reference from xran to o-ran";
+
+    reference "ORAN-WG4.M.0-v01.00";
+  }
+
+
+  typedef vlan-id {
+    type uint16 {
+      range 1..4094;
+    }
+    description
+      "Type definition representing a single-tagged VLAN";
+  }
+
+  // Groupings
+
+  grouping mplane-group {
+    container searchable-mplane-access-vlans-info {
+      description
+        "These parameters shall be stored by the equipment in reset persistant memory
+        to enable it to be re-used to optimize VALN discovery procerdures.";
+      leaf-list searchable-access-vlans {
+        type vlan-id;
+        description
+          "A list of access VLANs that may be operational on the transport
+          network. Can be used by the equipment to optimize its VLAN searching - for
+          M-plane operations.";
+      }
+      container vlan-range {
+        description "the range of VLAN IDs that may be configured for M-Plane";
+        leaf lowest-vlan-id {
+          type vlan-id;
+          description
+            "Value of this parameter informs equipment about lowest VID to be used
+            in VLAN scan procedure";
+        }
+        leaf highest-vlan-id {
+          type vlan-id;
+          description
+            "Value of this parameter informs about highest VID to be used
+            in VLAN scan procedure";
+        }
+      }
+    }
+
+    container m-plane-interfaces {
+      description "information concerning m-plane interfaces";
+      list m-plane-sub-interfaces {
+        key "interface-name sub-interface";
+        description "list of m-plane information";
+        leaf interface-name {
+          type leafref {
+            path "/if:interfaces/if:interface/if:name";
+          }
+          description "the name of the interface";
+        }
+        leaf sub-interface {
+          type leafref {
+            path "/if:interfaces/if:interface[if:name = current()/../interface-name]/o-ran-int:vlan-id";
+          }
+          description
+            "vlans used to communicate with management plane servers.";
+        }
+        container client-info {
+          config false;
+          description
+            "the NETCONF client information, discovered by DHCP or manually
+             configured during installation.";
+          list mplane-ipv4-info {
+            key mplane-ipv4;
+            description "list of IPv4 NETCONF clients";
+            leaf mplane-ipv4 {
+              type inet:ipv4-address;
+              description "The IPv4 address of M-Plane client discovered by the O-RU
+              or manually configured.";
+            }
+            leaf port {
+              type inet:port-number;
+              description
+                "The call home port number discovered or manually configured.";
+            }
+          }
+          list mplane-ipv6-info {
+            key mplane-ipv6;
+            description "list of IPv6 NETCONF clients";
+            leaf mplane-ipv6 {
+              type inet:ipv6-address;
+              description "The IPv6 address of M-Plane client discovered by the O-RU
+              or manually configured.";
+            }
+            leaf port {
+              type inet:port-number;
+              description
+                "The call home port number discovered or manually configured.";
+            }
+          }
+          leaf-list mplane-fqdn {
+            type inet:domain-name;
+            description "The discovered FQDN(s) of M-Plane client(s).";
+          }
+        }
+      }
+
+      container m-plane-ssh-ports {
+        description "leafs for managing SSH ports";
+        leaf call-home-ssh-port {
+          type inet:port-number;
+          default 4334;
+          description "The configured call home server port number";
+        }
+        leaf server-ssh-port {
+          type inet:port-number;
+          default 830;
+          description "The configured SSH server port number";
+        }
+      }
+    }
+    container configured-client-info {
+      description
+        "the NETCONF client information that may be configured by another
+        NETCONF client. These clients are reported independently from clients
+        manually configured or discovered using DHCP.";
+      list mplane-ipv4-info {
+        key mplane-ipv4;
+        description "list of IPv4 NETCONF clients";
+        leaf mplane-ipv4 {
+          type inet:ipv4-address;
+          description "The IPv4 address of configured M-Plane client.";
+        }
+        leaf port {
+          type inet:port-number;
+          description
+            "The configured call home port number.";
+        }
+      }
+      list mplane-ipv6-info {
+        key mplane-ipv6;
+        description "list of IPv6 NETCONF clients";
+        leaf mplane-ipv6 {
+          type inet:ipv6-address;
+          description "The IPv6 address of configured M-Plane client..";
+        }
+        leaf port {
+          type inet:port-number;
+          description
+            "The configured call home port number.";
+        }
+      }
+      leaf-list mplane-fqdn {
+        type inet:domain-name;
+        description "The configured FQDN(s) of M-Plane client(s).";
+      }
+    }
+  }
+
+
+  // Top Level Container
+
+  container mplane-info {
+    description "top level container for management plane information";
+
+    uses mplane-group;
+  }
+}
diff --git a/ntsimulator/yang/o-ran-operations.yang b/ntsimulator/yang/o-ran-operations.yang
new file mode 100644 (file)
index 0000000..19cfdbc
--- /dev/null
@@ -0,0 +1,254 @@
+module o-ran-operations {
+  yang-version 1.1;
+  namespace "urn:o-ran:operations:1.0";
+  prefix "o-ran-ops";
+
+  import ietf-yang-types {
+    prefix yang;
+  }
+
+  import ietf-netconf-acm {
+    prefix nacm;
+    reference
+      "RFC 8341: Network Configuration Access Control Model";
+  }
+
+  import ietf-hardware {
+    prefix hw;
+  }
+
+  organization "O-RAN Alliance";
+
+  contact
+    "www.o-ran.org";
+
+  description
+    "This module defines the YANG model used for O-RAN operations.
+
+    Copyright 2019 the O-RAN Alliance.
+
+    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS '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 SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 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.
+
+    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 above disclaimer.
+    * Redistributions in binary form must reproduce the above copyright notice,
+    this list of conditions and the above disclaimer in the documentation
+    and/or other materials provided with the distribution.
+    * Neither the Members of the O-RAN Alliance nor the names of its
+    contributors may be used to endorse or promote products derived from
+    this software without specific prior written permission.";
+
+  revision "2019-04-08" {
+    description
+      "version 1.0.2
+
+      1) added ru-instance-id ";
+
+    reference "ORAN-WG4.M.0-v01.00";
+  }
+
+  revision "2019-03-07" {
+    description
+      "version 1.0.1
+
+      1) backward compatible changes to introduce groupings.";
+
+    reference "ORAN-WG4.M.0-v01.00";
+  }
+
+  revision "2019-02-04" {
+    description
+      "version 1.0.0
+
+      1) imported model from xRAN
+      2) changed namespace and reference from xran to o-ran";
+
+    reference "ORAN-WG4.M.0-v01.00";
+  }
+
+  typedef version {
+    type string {
+      pattern '[0-9]+(\.[0-9]+){1,2}';
+    }
+    description
+      "this type definition is used to represent the version of the WG4
+      fronthaul interface.";
+  }
+
+  grouping operational-group {
+
+// Container used for WG4 specific declarations
+    container declarations {
+      //FIXME - determine whether it is acceptable to WG4 to change this to a presence
+      //container, where the presence indicates the NETCONF server supports WG4
+      //defined functionality
+      config false;
+      description "WG4 Specific Declarations of supported version of standards";
+
+      leaf ru-instance-id {
+        type string;
+        must "re-match(current(), concat(concat(/hw:hardware/hw:component/hw:mfg-name,
+          '_', /hw:hardware/hw:component/hw:model-name), '_',
+          /hw:hardware/hw:component/hw:serial-num))";
+        description
+          "a unique instance identifier that may be used to identify a
+          particular hardware instance, e.g., when used performing hierarchical
+          management via the O-DU.";
+      }
+
+      leaf supported-mplane-version {
+        type version;
+        default "1.0.0";
+        description "Parameter provides highest M-Plane specification version device is compliant with.";
+      }
+
+      leaf supported-cusplane-version {
+        type version;
+        default "1.0.0";
+        description "Parameter provides highest CUS-Plane specification version device is compliant with.";
+      }
+
+      list supported-header-mechanism {
+        description "list provides information regarding type and version of headers.";
+        key protocol;
+
+        leaf protocol {
+          type enumeration {
+            enum ECPRI {
+              description
+                "Indicates that an O-RU supports the ecpri header format
+                for the C/U plane";
+            }
+            enum IEEE-1914-3 {
+              description
+                "Indicates that an O-RU supports the 1914.3 header format
+                for the C/U plane";
+            }
+          }
+          description "Transport protocol type.";
+        }
+
+        leaf ecpri-concatenation-support {
+          when "../protocol = 'ECPRI'";
+          type boolean;
+          default false;
+          description
+            "This leaf is used to indicate whether the O-RU supports the optional
+            eCPRI concatenation capability";
+        }
+
+        leaf protocol-version {
+          type version;
+          default "1.0";
+          description "Header protocol version.";
+        }
+      }
+    }
+
+    container operational-state {
+      config false;
+      description
+        "Operational state for the O-RAN network element";
+      leaf restart-cause {
+        type enumeration {
+          enum POWER-ON {
+            description
+              "Equipment restarted because it was powered on";
+          }
+          enum SUPERVISION-WATCHDOG {
+            description
+              "Equipment restarted because it's supervision wathcdog timer wasn't reset
+              by a NETCONF client (inferring loss of NETCONF connectivity)";
+          }
+          enum MPLANE-TRIGGERED-RESTART {
+            description
+              "Equipment restarted because of an M-plane issued  rpc";
+          }
+          enum SOFTWARE-FAILURE {
+            description
+              "Equipment restarted because of software failure";
+          }
+          enum OTHER-WATCHDOG-TIMER {
+            description
+              "Equipment restarted because of some other non NETCONF watchdog timer";
+          }
+          enum UNKNOWN {
+            description
+              "The restart reason for the Equipment is unknown";
+          }
+        }
+        description "the cause for the last restart of the O-RAN Network Element";
+      }
+      leaf restart-datetime {
+        type yang:date-and-time;
+        description
+          "The system date and time when the system last restarted.";
+      }
+    }
+
+
+// Common cross-WG container used for configuring clock and call home timers
+    container clock {
+      description
+        "System date and time properties used by all working groups.";
+
+      leaf timezone-utc-offset {
+        type int16 {
+          range "-720 .. 840";
+        }
+        units "minutes";
+        default 0;
+        description
+          "The number of minutes to add to UTC time to
+          identify the time zone for this system.  For example,
+          'UTC - 8:00 hours' would be represented as '-480'.";
+      }
+    }
+
+    leaf re-call-home-no-ssh-timer {
+      type uint16;
+      units seconds;
+      default 60;
+      description
+        "A common timer used by the O-RAN equipment to trigger the repeated call 
+        home procedure to all identified call home servers to which the O-RAN
+        equipment has not already an established SSH connection.
+
+        A value of 0 means that the O-RAN equipment shall disable operation
+        of the timer triggered NETCONF call home procedure.";
+    }
+  }
+
+// Top level container
+
+  container operational-info{
+    description
+      "a collection of operational infor for the O-RU";
+    uses operational-group;
+
+  }
+
+// RPCs
+
+  rpc reset {
+    nacm:default-deny-all;
+    description
+      "Management plane triggered restart of the radio unit.
+       A server SHOULD send an rpc reply to the client before
+       restarting the system.";
+
+  }
+}
diff --git a/ntsimulator/yang/o-ran-performance-management.yang b/ntsimulator/yang/o-ran-performance-management.yang
new file mode 100644 (file)
index 0000000..86e1d10
--- /dev/null
@@ -0,0 +1,718 @@
+module o-ran-performance-management {
+  yang-version 1.1;
+  namespace "urn:o-ran:performance-management:1.0";
+  prefix "o-ran-pm";
+
+  import ietf-yang-types {
+    prefix "yang-types";
+    revision-date 2013-07-15;
+  }
+
+  // import idetifier for O-RU
+  import ietf-hardware {
+    prefix "hw";
+  }
+
+  // import ietf-interface
+  import ietf-interfaces {
+    prefix "if";
+  }
+
+  // import ietf-inet-type
+  import ietf-inet-types {
+    prefix "inet";
+  }
+
+  // import port-number
+  import o-ran-interfaces {
+    prefix "o-ran-int";
+  }
+
+  // import ru-mac-address, o-du-mac-address and vlan-id
+  import o-ran-processing-element {
+    prefix "o-ran-elements";
+  }
+
+  import o-ran-file-management {
+    prefix "o-ran-fm";
+  }
+
+  organization "O-RAN Alliance";
+
+  contact
+    "www.o-ran.org";
+
+  description
+    "This module defines the configuration for performance measurement for
+    transceiver and rx-window measurement objects.
+
+    Copyright 2019 the O-RAN Alliance.
+
+    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS '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 SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 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.
+
+    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 above disclaimer.
+    * Redistributions in binary form must reproduce the above copyright notice,
+    this list of conditions and the above disclaimer in the documentation
+    and/or other materials provided with the distribution.
+    * Neither the Members of the O-RAN Alliance nor the names of its
+    contributors may be used to endorse or promote products derived from
+    this software without specific prior written permission.";
+
+  revision "2019-06-05" {
+    description
+      "version 1.0.2
+
+      1) backward compatible changes according to NOK-0002 sFTP Server Authentication Correction.
+      2) simplifying file management and authentication to reuse from o-ran-file-management module
+      3) minor fixes according to lack of descriptions and reference";
+
+    reference "ORAN-WG4.M.0-v01.00";
+  }
+
+  revision "2019-03-28" {
+    description
+      "version 1.0.2
+
+      1) added to descriptions to indicate applicability of leafs and Containers
+      to separate O-RAN use cases";
+
+    reference "ORAN-WG4.M.0-v01.00";
+  }
+
+  revision "2019-03-07" {
+    description
+      "version 1.0.1
+
+      1) backward compatible changes to introduce groupings.";
+
+    reference "ORAN-WG4.M.0-v01.00";
+  }
+
+  revision "2019-02-04" {
+    description
+      "version 1.0.0
+
+      1) imported model from xRAN
+      2) changed namespace and reference from xran to o-ran";
+
+    reference "ORAN-WG4.M.0-v01.00";
+  }
+
+
+  feature GRANULARITY-TRANSPORT-MEASUREMENT {
+    description
+      "This feature indicates that the O-RU supports an optional object-unit TRANSPORT in rx-window-measurement.";
+  }
+
+  feature GRANULARITY-EAXC-ID-MEASUREMENT {
+    description
+      "This feature indicates that the O-RU supports an optional object-unit EAXC_ID in rx-window-measurement.";
+  }
+
+  grouping start-and-end-time {
+    description
+      "Definition for start and end time for an event";
+
+    leaf start-time {
+      type yang-types:date-and-time;
+      description
+        "Start time for measurement of object stats";
+    }
+    leaf end-time {
+      type yang-types:date-and-time;
+      description
+        "End time for measurement of object stats";
+    }
+  }
+
+  grouping transceiver-measurement-result-grouping {
+    description
+      "transceiver-measurement-result are listed per port-number";
+
+    list transceiver-measurement-result {
+      key "object-unit-id";
+      config false;
+      leaf object-unit-id {
+        type leafref {
+          path "/if:interfaces/if:interface/o-ran-int:port-reference/o-ran-int:port-number";
+        }
+
+        description
+          "port-number is used for the object-unit-id for the
+           transceiver-measurement-result, for which object-unit is
+           PORT_NUMBER only";
+      }
+      container min {
+        description
+          "minimum value with recorded time are included for the
+           measurement-object";
+
+        leaf value {
+          type decimal64 {
+            fraction-digits 4;
+          }
+
+          description
+            "minimum value for the measurment-object";
+        }
+        leaf time {
+          type yang-types:date-and-time;
+
+          description
+            "recorded time for the minimum value";
+        }
+      }
+      container max {
+        description
+        "maximum value with recorded time are included for the
+         measurement-object";
+
+        leaf value {
+          type decimal64 {
+            fraction-digits 4;
+          }
+
+          description
+            "maximum value for the measurment-object";
+        }
+        leaf time {
+          type yang-types:date-and-time;
+
+          description
+            "recorded time for the maximum value";
+        }
+      }
+      container first {
+        description
+          "first value with the recorded time are included for the
+           measurement-object";
+
+        leaf value {
+          type decimal64 {
+            fraction-digits 4;
+          }
+
+          description
+            "first value of the measurement-object";
+        }
+        leaf time {
+          type yang-types:date-and-time;
+
+          description
+            "recorded time for the first value";
+        }
+      }
+      container latest {
+        description
+          "latest value with the recorded time are included for the
+           measurement-object";
+
+        leaf value {
+          type decimal64 {
+            fraction-digits 4;
+          }
+
+          description
+            "latest value of the measurement-object";
+        }
+        leaf time {
+          type yang-types:date-and-time;
+
+          description
+            "recorded time for the latest value";
+        }
+      }
+      leaf-list frequeny-table {
+        type uint32;
+
+        description
+          "frequency-table for the measurment-object are included per bin.
+           The configuration parameters for this frequency-table are defined
+           by bin-count, lower-bound and upper-bound";
+      }
+
+      description
+        "List of transceiver measurement results";
+    }
+  }
+
+  grouping rx-window-measurement-result-grouping{
+    description
+      "Group of measurement reasults for rx window measurements";
+
+    choice object-unit-id {
+      config false;
+      case RU {
+        leaf name{
+          type leafref {
+            path "/hw:hardware/hw:component/hw:name";
+          }
+
+          description
+            "the name of O-RU module or one of its child ports
+            in ietf-hardware/component is used when O-RU is selected as
+            object-unit for the reception window stats.";
+        }
+        leaf count {
+          type uint64;
+          mandatory true;
+
+          description
+            "the number of data packet are counted for the reception
+             window stats per O-RU.";
+        }
+      }
+
+      case TRANSPORT {
+        list tr-measured-result{
+          key name;
+          leaf name{
+            type leafref{
+              path "/o-ran-elements:processing-elements/o-ran-elements:ru-elements/o-ran-elements:name";
+            }
+
+            description
+              "the name of ru-elements in o-ran-processing-elements
+               when TRANSPORT is selected as object-unit for the reception
+               window stats.";
+          }
+          leaf count {
+            type uint64;
+            mandatory true;
+
+            description
+              "the number of data packet are counted for the reception
+               window stats.";
+          }
+
+          description
+            "the number of data packet are counted for the reception
+             window stats per TRANSPORT.";
+        }
+      }
+
+      case EAXC_ID {
+        list eaxc-measured-result {
+          key eaxc-id;
+          leaf eaxc-id{
+            type uint16;
+
+            description
+              "eaxc-id is used
+               when EAXC_ID is selected as object-unit for the reception
+               window stats.
+               EAXC_ID consists of DU-Port-Id, Band-Selector, CC-id and
+               RU-Port-Id to be used in header of C/U-plane data packet.";
+          }
+          leaf count {
+            type uint64;
+            mandatory true;
+
+            description
+              "the number of data packet are counted for the reception
+               window stats.";
+          }
+          leaf transport-name {
+            type leafref{
+              path "/o-ran-elements:processing-elements/o-ran-elements:ru-elements/o-ran-elements:name";
+            }
+
+            description
+              "the name of ru-elements in o-ran-processing-elements for the
+               transport information corresponding to this eaxc-id";
+          }
+
+          description
+            "the number of data packet are counted for the reception
+             window stats per EAXC-ID.";
+        }
+      }
+
+      description
+        "measurement-result for the reception window stats depends on the
+         configured object-unit, RU, TRANSPORT or EAXC_ID";
+    }
+  }
+
+  grouping measurement-group {
+    description
+      "Group of measurement results";
+
+    leaf enable-SFTP-upload {
+      type boolean;
+      default false;
+      description
+        "Flag to enable upload of performance measurement result files.";
+    }
+
+    leaf enable-random-file-upload {
+      type boolean;
+      default false;
+      description
+        "Flag to enable upload of performance measurement result files at
+         random within file-upload-interval.";
+    }
+
+    list remote-SFTP-uploads {
+      key remote-SFTP-upload-path;
+      description
+        "SFTP upload can be done to one or more than one SFTP servers";
+
+      leaf remote-SFTP-upload-path {
+        type inet:uri;
+        description
+          "URI specifying the remote location where the files are to uploaded.
+          The following format is possible:
+          sftp://<username>@<host>[:<port>]/path";
+      }
+
+      uses o-ran-fm:credential-information;
+    }
+
+// transceiver measurements applicable to all O-RAN HW functions
+
+    leaf transceiver-measurement-interval {
+      type uint16;
+      units seconds;
+      description
+        "measurement interval to measure the performance of transceiver
+         measurement objects periodically.";
+    }
+
+// RX Window measurements applicable to O-RAN WG4 defined functions
+
+    leaf rx-window-measurement-interval {
+      type uint16;
+      units seconds;
+      description
+        "measurement interval to measure the performance of reception
+         window measurement objects periodically.";
+    }
+
+    leaf notification-interval {
+      type uint16;
+      units seconds;
+      description
+        "notification interval for the measurement result to be notified
+         periodically.";
+    }
+
+    leaf file-upload-interval {
+      type uint16;
+      units seconds;
+      description
+        "file upload interval for the measurement result file to be
+         uploaded periodically.";
+    }
+
+    leaf max-bin-count{
+      type uint16;
+      config false;
+      mandatory true;
+      description
+        "indicates the maximum value of configurable bin-count for frequency
+         table in transceiver-measurement-objects as one of module
+         capabilities.";
+    }
+
+    list transceiver-measurement-objects {
+      key "measurement-object";
+      description
+        "optional list used to report transceiver measurements
+        applicable to any O-RAN defined hardware function";
+      leaf measurement-object {
+        type enumeration {
+          enum RX_POWER {
+            description
+              "Measured Rx input power in mW";
+          }
+          enum TX_POPWER {
+            description
+              "Measured Tx input power in mW.";
+          }
+          enum TX_BIAS_COUNT {
+            description
+              "Internally measured Tx Bias Current in mA";
+          }
+          enum VOLTAGE {
+            description
+              "Internally measured transceiver supply voltage in mV";
+          }
+          enum TEMPERATURE {
+            description
+              "Internally measured optional laser temperature in degrees Celsius.";
+          }
+        }
+        description "Target metric to measure the performance";
+      }
+
+      leaf active {
+        type boolean;
+        default false;
+        description
+          "Enable/disable the performance measurement per Object";
+      }
+
+      leaf-list report-info {
+        type enumeration {
+          enum MAXIMUM {
+            description
+              "to report maximum value and its recorded time within the
+               measurement-interval for the measurement-object.";
+          }
+          enum MINIMUM {
+            description
+              "to report minimum value and its recorded time within the
+               measurement-interval for the measurement-object.";
+          }
+          enum FIRST {
+            description
+              "to report first value and its recorded time within the
+               measurement-interval for the measurement-object.";
+          }
+          enum LATEST {
+            description
+              "to report latest value and its recorded time within the
+               measurement-interval for the measurement-object.";
+          }
+          enum FREQUENCY_TABLE {
+            description
+              "to report frequency bin table within the
+               measurement-interval for the measurement-object.";
+          }
+        }
+        description "The reporting info to the measurement object.";
+      }
+
+      leaf object-unit {
+        type enumeration {
+          enum PORT_NUMBER {
+            description
+              "unit to measure the performance per object-id";
+          }
+        }
+        mandatory true;
+        description "unit to measure the performance per object-id.";
+      }
+
+      leaf function {
+        type enumeration {
+          enum RAW {
+            description
+              "the value is expressed by real value.";
+          }
+          enum LOG_10 {
+            description
+              "the value is expressed by logarithm with base 10.";
+          }
+        }
+
+        description
+          "the value to be recorded for transceiver-measurement
+           by real value or log 10.";
+      }
+
+      leaf bin-count {
+        type uint16;
+
+        description
+          "the number of bin for the frequency table.
+           This value shall be less than max-bin-count";
+      }
+
+      leaf lower-bound {
+        type decimal64 {
+          fraction-digits 4;
+        }
+
+        description
+          "the lower value of the first bin of frequency table.";
+      }
+
+      leaf upper-bound {
+        type decimal64 {
+          fraction-digits 4;
+        }
+
+        description
+          "the upper value of the last bin of frequency table.";
+      }
+      uses transceiver-measurement-result-grouping;
+// configuration and measurement result for the transceiver-measurement
+
+    }
+
+    list rx-window-measurement-objects {
+      key "measurement-object";
+      description
+        "optional list used to report RX Window measurements
+        applicable to O-RAN WG4 define O-RU functions";
+      leaf measurement-object {
+        type enumeration {
+          enum RX_ON_TIME {
+            description
+              "the number of data packets, received on time within
+               the reception window.";
+          }
+          enum RX_EARLY {
+            description
+              "the number of data packets, received before
+               the reception window.";
+          }
+          enum RX_LATE {
+            description
+              "the number of data packets, received after
+               the reception window.";
+          }
+          enum RX_CORRUPT {
+            description
+              "the number of data packets, which are corrupt or whose header
+               is incorrect.";
+          }
+          enum RX_DUPL {
+            description
+              "the number of data packets, which is duplicated with other packets,
+               received within the measurement period.";
+          }
+          enum RX_TOTAL {
+            description
+              "the total number of received data packets.";
+          }
+        }
+        description
+          "target reception window metric to measure the performance.";
+      }
+
+      leaf active {
+        type boolean;
+        default false;
+        description
+          "Enable/disable the performance measurement per reception window
+           measurement object.";
+      }
+
+      leaf object-unit {
+        type enumeration {
+          enum RU {
+            description
+              "the reception window stats are counted per hardware component.
+              This may be the parent 'module' or child 'port' component.";
+          }
+          enum TRANSPORT {
+            if-feature GRANULARITY-TRANSPORT-MEASUREMENT;
+            description
+              "the reception window stats are counted per transport flow.
+              When there are multiple transport flows between O-DU and O-RU,
+               e.g. multiple sets of o-du mac address, ru mac address and
+                    vlan-id, the reception window stats per transport flow
+                    are counted in this case.
+              This configuration is allowed only when O-RU supports
+              a feature GRANULARITY-TRANSPORT-MEASUREMENT.";
+          }
+          enum EAXC_ID {
+            if-feature GRANULARITY-EAXC-ID-MEASUREMENT;
+
+            description
+              "the reception window stats are counted per eAxC ID, which is
+               used in the header of receivd data packet.
+              This configuration is allowed only when O-RU supports
+              a feature GRANULARITY-EAXC-ID-MEASUREMENT.";
+          }
+        }
+        description
+          "unit to measure the performance per object-id.";
+      }
+
+      leaf report-info {
+        type enumeration {
+          enum COUNT {
+            description
+              "the number of data packet are counted for the reception
+               window stats.";
+          }
+        }
+        description
+          "The reporting info to the measurement object.";
+      }
+
+      uses rx-window-measurement-result-grouping;
+// configuration and measurement result for the reception window stats
+
+    }
+  }
+
+  grouping measurement-notification {
+    list transceiver-stats {
+      key "measurement-object";
+      leaf measurement-object {
+        type leafref {
+          path "/performance-measurement-objects/transceiver-measurement-objects/measurement-object";
+        }
+
+        description
+          "measurement-object for the transceiver-measurement";
+      }
+
+      uses start-and-end-time;
+      uses transceiver-measurement-result-grouping;
+
+      description
+        "measurement result of transceiver-measurement per measurement-object";
+    }
+
+    list rx-window-stats {
+      key "measurement-object";
+      leaf measurement-object {
+        type leafref {
+          path "/performance-measurement-objects/rx-window-measurement-objects/measurement-object";
+        }
+
+        description
+          "measurement-object for the reception window measurement";
+      }
+      uses start-and-end-time;
+      uses rx-window-measurement-result-grouping;
+
+      description
+        "measurement result for the reception window measurement per
+         measurement-object";
+
+    }
+
+    description
+      "notification may contain measurement result for transceiver-stats
+       and/or rx-window-stats";
+  }
+
+  // Top level container
+
+  container performance-measurement-objects {
+    description
+      "configuration for performance management and measurement-result are
+       included";
+    uses measurement-group;
+  }
+
+// Notifications
+
+  notification measurement-result-stats {
+    description
+      "Notification may contain measurement results for transceiver-stats
+       and/or rx-window-stats";
+    uses measurement-notification;
+  }
+}
diff --git a/ntsimulator/yang/o-ran-processing-element.yang b/ntsimulator/yang/o-ran-processing-element.yang
new file mode 100644 (file)
index 0000000..be4dfbd
--- /dev/null
@@ -0,0 +1,272 @@
+module o-ran-processing-element {
+  yang-version 1.1;
+  namespace "urn:o-ran:processing-element:1.0";
+  prefix "o-ran-elements";
+
+  import ietf-yang-types {
+    prefix yang;
+  }
+
+  import ietf-inet-types {
+    prefix "inet";
+  }
+
+  import ietf-interfaces {
+    prefix "if";
+  }
+
+  import ietf-ip {
+    prefix "ip";
+  }
+
+  import o-ran-interfaces {
+    prefix "o-ran-int";
+  }
+
+  organization "O-RAN Alliance";
+
+  contact
+    "www.o-ran.org";
+
+  description
+    "This module defines the YANG definitions for mapping of transport flows to
+    processing elements. Three options are supported:
+    i) virtual MAC based mapping
+    ii) MAC addrress + VLAN-ID based mapping
+    iii) UDP/IP based mapping
+
+    Copyright 2019 the O-RAN Alliance.
+
+    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS '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 SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 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.
+
+    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 above disclaimer.
+    * Redistributions in binary form must reproduce the above copyright notice,
+    this list of conditions and the above disclaimer in the documentation
+    and/or other materials provided with the distribution.
+    * Neither the Members of the O-RAN Alliance nor the names of its
+    contributors may be used to endorse or promote products derived from
+    this software without specific prior written permission.";
+
+  revision "2019-02-04" {
+    description
+      "version 1.0.0
+
+      1) imported model from xRAN
+      2) changed namespace and reference from xran to o-ran";
+
+    reference "ORAN-WG4.M.0-v01.00";
+  }
+
+// groupings
+
+  grouping pe-group {
+    leaf transport-session-type {
+      type enumeration {
+        enum ETH-INTERFACE {
+          description "VLAN based CUS Transport ";
+        }
+        enum UDPIP-INTERFACE {
+          description "UDP/IP based CUS Transport ";
+        }
+        enum ALIASMAC-INTERFACE{
+          description "Alias MAC address based CUS Transport ";
+        }
+      }
+      default ETH-INTERFACE;
+      description
+        "the type of transport session used for identifying different processing
+        elements";
+    }
+    container enhanced-uplane-mapping {
+      presence "indicates that enhanced uplane mapping is used";
+      description "a mapping table for enhanced user plane marking";
+      list uplane-mapping {
+        key "up-marking-name";
+        description
+          "a mapping between up-link name and o-ran-interfaces:up-marking-name";
+        leaf up-marking-name {
+          type string;
+          description "a unique up marking name that is used for enhanced up marking";
+        }
+        choice up-markings {
+          description
+            "U-Plane markings";
+          case ethernet {
+            when "(../../transport-session-type = 'ALIASMAC-INTERFACE') or
+            (../../transport-session-type = 'ETH-INTERFACE')";
+            leaf up-cos-name {
+              type leafref {
+                path "/if:interfaces/if:interface/o-ran-int:class-of-service/o-ran-int:enhanced-uplane-markings/o-ran-int:up-marking-name";
+              }
+              description "the Ethernet U-plane transport marking as defined in o-ran-interfaces";
+            }
+          }
+          case ipv4 {
+            when "(../../transport-session-type = 'UDPIP-INTERFACE')";
+            leaf upv4-dscp-name {
+              type leafref {
+                path "/if:interfaces/if:interface/ip:ipv4/o-ran-int:diffserv-markings/o-ran-int:enhanced-uplane-markings/o-ran-int:up-marking-name";
+              }
+              description "the IPv4 U-plane transport marking as defined in o-ran-interfaces";
+            }
+          }
+          case ipv6 {
+            when "(../../transport-session-type = 'UDPIP-INTERFACE')";
+            leaf upv6-dscp-name {
+              type leafref {
+                path "/if:interfaces/if:interface/ip:ipv6/o-ran-int:diffserv-markings/o-ran-int:enhanced-uplane-markings/o-ran-int:up-marking-name";
+              }
+              description "the IPv6 U-plane transport marking as defined in o-ran-interfaces";
+            }
+          }
+        }
+      }
+    }
+    list ru-elements {
+      key "name";
+      description
+        "the list of transport definitions for each processing element";
+      leaf name {
+        type string {
+          length "1..255";
+        }
+        description
+          "A name that is unique across the O-RU that identifies a processing
+          element instance.
+
+          This name may be used in fault management to refer to a fault source
+          or affected object";
+      }
+      container transport-flow {
+        description
+          "container for the transport-flow used for CU plane";
+        leaf interface-name {
+          type leafref {
+            path "/if:interfaces/if:interface/if:name";
+          }
+          description "the interface name ";
+        }
+        container aliasmac-flow {
+          when "../../../transport-session-type = 'ALIASMAC-INTERFACE'";
+          if-feature o-ran-int:ALIASMAC-BASED-CU-PLANE;
+          description "leafs for virtual mac type data flows";
+          leaf ru-aliasmac-address {
+            type leafref {
+              path "/if:interfaces/if:interface[if:name = current()/../../interface-name]/o-ran-int:alias-macs";
+            }
+            mandatory true;
+            description
+              "O-RU's alias MAC address used for alias MAC based flow";
+          }
+          leaf vlan-id {
+            type leafref {
+              path "/if:interfaces/if:interface[if:name = current()/../../interface-name]/o-ran-int:vlan-id";
+            }
+            description
+              "O-RU's VLAN-ID used for alias MAC based flow";
+          }
+          leaf o-du-mac-address {
+            type yang:mac-address;
+            mandatory true;
+            description
+              "O-DU's MAC address used for alias MAC based flow";
+          }
+        }
+        container eth-flow {
+          when "../../../transport-session-type = 'ETH-INTERFACE'";
+          description "leafs for mac + vlan-id type data flows";
+          leaf ru-mac-address {
+            type leafref {
+              path "/if:interfaces/if:interface[if:name = current()/../../interface-name]/o-ran-int:mac-address";
+            }
+            mandatory true;
+            description
+              "O-RU's MAC address used for Ethernet based flow";
+          }
+          leaf vlan-id {
+            type leafref {
+              path "/if:interfaces/if:interface[if:name = current()/../../interface-name]/o-ran-int:vlan-id";
+            }
+            mandatory true;
+            description
+              "O-RU's VLAN-ID used for Ethernet based flow";
+          }
+          leaf o-du-mac-address {
+            type yang:mac-address;
+            mandatory true;
+            description
+              "O-DU's MAC address used for Ethernet based flow";
+          }
+        }
+        container udpip-flow {
+          when "../../../transport-session-type = 'UDPIP-INTERFACE'";
+          description "leafs for UDP/IP type data flows";
+          choice address {
+            leaf ru-ipv4-address {
+              type leafref {
+                path "/if:interfaces/if:interface[if:name = current()/../../interface-name]/ip:ipv4/ip:address/ip:ip";
+              }
+              description "O-RU's IPv4 address";
+            }
+            leaf ru-ipv6-address {
+              type leafref {
+                path "/if:interfaces/if:interface[if:name = current()/../../interface-name]/ip:ipv6/ip:address/ip:ip";
+              }
+              description "O-RU's IPv6 address";
+            }
+            mandatory true;
+            description "choice of O-RU IPv4 or IPv6 address";
+          }
+          leaf o-du-ip-address {
+            type inet:ip-address;
+            mandatory true;
+            description "O-DU's IPv address";
+          }
+          leaf ru-ephemeral-udp-port {
+            type inet:port-number;
+            mandatory true;
+            description
+              "ephemeral port used by O-RU";
+          }
+          leaf o-du-ephemeral-udp-port {
+            type inet:port-number;
+            mandatory true;
+            description
+              "ephemeral port used by O-DU";
+          }
+          leaf ecpri-destination-udp {
+            type inet:port-number;
+            mandatory true;
+            description "the well known UDP port number used by eCPRI";
+            // fixme - add in a default when allocated by IANA
+          }
+        }
+      }
+    }
+  }
+
+// top level container
+
+  container processing-elements {
+    description
+      "a model defining the mapping between transport flows and arbitrary
+      O-RAN processing elements. A processing element may be then defined for
+      handling connectivity or delay procedures, or defined with a corresponding
+      eaxcid for CU plane operations";
+    uses pe-group;
+  }
+}
diff --git a/ntsimulator/yang/o-ran-software-management.yang b/ntsimulator/yang/o-ran-software-management.yang
new file mode 100644 (file)
index 0000000..b48a4c5
--- /dev/null
@@ -0,0 +1,603 @@
+module o-ran-software-management {
+  yang-version 1.1;
+  namespace "urn:o-ran:software-management:1.0";
+  prefix o-ran-swm;
+
+  import ietf-inet-types {
+    prefix "inet";
+    revision-date 2013-07-15;
+  }
+
+  import ietf-hardware {
+    prefix "hw";
+  }
+
+  import o-ran-hardware {
+    prefix "o-ran-hw";
+  }
+
+  import o-ran-file-management {
+    prefix "o-ran-fm";
+  }
+
+  organization "O-RAN Alliance";
+
+  contact
+    "www.o-ran.org";
+
+  description
+    "This module defines operations and configuration for the management of software packages.
+    This module is derived out of opencpe-firmware-mgmt@2014-02-06.yang
+
+    Copyright 2019 the O-RAN Alliance.
+
+    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS '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 SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 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.
+
+    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 above disclaimer.
+    * Redistributions in binary form must reproduce the above copyright notice,
+    this list of conditions and the above disclaimer in the documentation
+    and/or other materials provided with the distribution.
+    * Neither the Members of the O-RAN Alliance nor the names of its
+    contributors may be used to endorse or promote products derived from
+    this software without specific prior written permission.";
+
+  revision "2019-06-05" {
+    description
+      "version 1.0.2
+
+      1) backward compatible changes according to NOK-0002 sFTP Server Authentication Correction.
+      2) simplifying file management and authentication to reuse from o-ran-file-management module
+      3) minor fixes according to lack of descriptions
+      4) removal of not used grouping";
+
+    reference "ORAN-WG4.M.0-v01.00";
+  }
+
+  revision "2019-03-07" {
+    description
+      "version 1.0.1
+
+      1) backward compatible changes to introduce groupings.";
+
+    reference "ORAN-WG4.M.0-v01.00";
+  }
+
+  revision "2019-02-04" {
+    description
+      "version 1.0.0
+
+      1) imported model from xRAN
+      2) changed namespace and reference from xran to o-ran";
+
+    reference "ORAN-WG4.M.0-v01.00";
+  }
+
+  // groupings
+
+  grouping slot-group {
+    description
+      "Contains information about each software slot and its content.";
+    list software-slot {
+      key name;
+      min-elements 2;
+
+      description
+        "Information about available software-slots and their software.";
+
+      leaf name {
+        type string;
+
+        description
+          "Name of the software package. This shall be unique to identify the software-slot.";
+      }
+
+      leaf status {
+        type enumeration {
+          enum VALID {
+            description
+              "Slot Contains software build considered as proven valid";
+          }
+          enum INVALID {
+            description
+              "software build is not currently used by O-RU. The software is considered by O-RU as damaged (e.g. wrong CRC)";
+          }
+          enum EMPTY {
+            description
+              "W slot does not contain software package.";
+          }
+        }
+        config false;
+        mandatory true;
+
+        description "Indicates the status of the software slot";
+      }
+
+      leaf active {
+          type boolean;
+      must "../status = 'VALID'";
+        config false;
+          description
+            "informs if software stored in particular slot is activated at the moment";
+      }
+
+      leaf running {
+          type boolean;
+      must "../status = 'VALID'";
+        config false;
+          description
+            "informs if software stored in particular slot is used at the moment";
+      }
+
+      leaf access {
+        type enumeration {
+          enum READ_ONLY {
+            description
+              "slot intended only for factory software,
+              activation of such software slot means getting back to factory defaults";
+          }
+          enum READ_WRITE {
+            description
+              "slot used for updating software";
+          }
+        }
+        default READ_WRITE;
+        config false;
+
+        description
+          "Indicates the writability of the slot.
+          A Read-Only software slot is one which has a factory installed software-slot";
+      }
+
+      leaf product-code {
+        type leafref {
+        path "/hw:hardware/hw:component/o-ran-hw:product-code";
+        }
+        config false;
+
+        description "product code provided by the vendor, specific to the product. This is derived from manifest file.";
+      }
+
+      leaf vendor-code {
+        type string {
+          length 1..2;
+        }
+        config false;
+
+        description
+          "Unique code of the vendor. This is derived from manifest file.";
+      }
+
+      leaf build-id {
+        type string;
+        config false;
+
+        description
+          "Identity associated with the software build. This is derived from manifest file.";
+      }
+
+      leaf build-name {
+        type string;
+        config false;
+
+        description
+          "Name of the build. This is derived from manifest file.";
+      }
+
+      leaf build-version {
+        type string;
+        description "The vendor-specific version string of the software build.";
+      }
+
+      list files {
+        key "name";
+        config false;
+
+        description "List of all the files present in the software package.";
+
+        leaf name {
+          type string;
+
+          description
+            "Name of the file installed in the slot.";
+        }
+
+        leaf version {
+          type string;
+
+          description
+            "Version of the file installed in the slot";
+        }
+        leaf local-path {
+          type string;
+          mandatory true;
+
+          description
+            "Complete path of the file stored locally";
+        }
+
+        leaf integrity {
+          type enumeration {
+            enum OK {
+              description "OK - indicates that file integrity is correct";
+            }
+            enum NOK {
+              description "NOK - indicates corrupted file";
+            }
+          }
+          config false;
+
+          description
+            "Result of the file integrity check (checksum calculation) during installation.";
+        }
+      }
+    }
+  }
+
+  grouping download-input {
+    description
+      "Grouping for sw download rpc input";
+    leaf remote-file-path {
+      type inet:uri;
+      mandatory true;
+      description
+        "URI of the software image including username.
+        The following format is possible:
+        sftp://<username>@<host>[:<port>]/path";
+    }
+
+    uses o-ran-fm:credential-information;
+  }
+
+  grouping download-output {
+    description
+      "Grouping for sw download rpc output";
+    leaf status {
+      type enumeration {
+        enum STARTED {
+          description
+            "Operation has been started without error.";
+        }
+        enum FAILED {
+          description
+            "Operation cannot be started because of error, more detailed information can be found in error-message.";
+        }
+      }
+      mandatory true;
+
+      description
+        "Status of the software files download";
+    }
+    leaf error-message {
+      when "../status = 'FAILED'";
+      type string;
+
+      description
+        "Detailed error Message when the status is failed.";
+    }
+
+    leaf notification-timeout {
+      type int32;
+      units seconds;
+      default 30;
+
+      description
+        "Notification timeout is the time NETCONF client shall
+        wait for a 'download-event' notification from O-RU. If there is no
+        'download-event' notification received within notification-timeout,
+        NETCONF client shall assume the download timeout/failure, and follow necessary steps.";
+    }
+  }
+
+  grouping install-input {
+    description
+      "Grouping for sw installation rpc input";
+    leaf slot-name {
+      type leafref {
+        path "/software-inventory/software-slot/name";
+        }
+      must "/software-inventory/software-slot[name = current()][active = 'false' and running = 'false']" {
+        error-message "software-install may be requested only against active::false and running::false slot!";
+      }
+      mandatory true;
+
+      description
+        "software-slot to which the software shall be installed to.";
+    }
+
+    leaf-list file-names {
+      type string;
+
+      description
+        "Names of the files within software package to be installed";
+    }
+  }
+
+  grouping install-output {
+    description
+      "Grouping for sw installation rpc output";
+    leaf status {
+      type enumeration {
+        enum STARTED {
+          description
+            "Operation has been started without error.";
+        }
+        enum FAILED {
+          description
+            "Operation cannot be started because of error, more detailed information can be found in error-message.";
+        }
+      }
+      mandatory true;
+
+      description
+        "Status of the software package install.";
+    }
+    leaf error-message {
+      when "../status = 'FAILED'";
+      type string;
+
+      description
+        "Detailed error Message when the status is failed.";
+    }
+  }
+
+  grouping activate-input {
+    description
+      "Grouping for sw activation rpc input";
+    leaf slot-name {
+      type leafref {
+        path "/software-inventory/software-slot/name";
+      }
+      must "/software-inventory/software-slot[name = current()][status = 'VALID']" {
+        error-message "software activation may be requested only on VALID slot!";
+      }
+      mandatory true;
+
+      description
+        "Slot name on which software has to be activated.";
+    }
+  }
+
+  grouping activate-output {
+    description
+      "Grouping for sw activation rpc output";
+    leaf status {
+      type enumeration {
+        enum STARTED {
+          description
+            "Operation has been started without error.";
+        }
+        enum FAILED {
+          description
+            "Operation cannot be started because of error, more detailed information can be found in error-message.";
+        }
+      }
+      mandatory true;
+
+      description
+        "Status of the software files activation";
+    }
+    leaf error-message {
+      when "../status = 'FAILED'";
+      type string;
+
+      description
+        "Detailed error Message when the status is failed.";
+    }
+
+    leaf notification-timeout {
+      type int32;
+      units seconds;
+      default 30;
+
+      description
+        "Timeout on client waiting for the activate event";
+    }
+  }
+
+  grouping download-notification {
+    description
+      "Grouping for notification event structure for download completion";
+    leaf file-name {
+      type string;
+      mandatory true;
+
+      description
+        "File name of downloaded software package";
+    }
+
+    leaf status {
+      type enumeration {
+        enum COMPLETED {
+          description
+            "Operation completed succesfully";
+        }
+        enum AUTHENTICATION_ERROR {
+          description "source available, wrong credentials";
+        }
+        enum PROTOCOL_ERROR {
+          description "SFTP errors";
+        }
+        enum FILE_NOT_FOUND {
+          description "source not available.";
+        }
+        enum APPLICATION_ERROR {
+          description "Application related errors";
+        }
+        enum TIMEOUT {
+          description "Timeout waiting for download";
+        }
+      }
+
+      description
+        "Status of finished operation execution";
+    }
+    leaf error-message {
+      when "../status != 'COMPLETED'";
+      type string;
+
+      description
+        "Detailed description of faulty situation";
+    }
+  }
+
+  grouping install-notification {
+    description
+      "Grouping for notification event structure for installation completion";
+    leaf slot-name {
+      type leafref {
+        path "/software-inventory/software-slot/name";
+      }
+
+      description
+        "Name of the slot to which software was installed.";
+    }
+    leaf status {
+      type enumeration {
+        enum COMPLETED {
+          description
+            "Operation completed succesfully";
+        }
+        enum FILE_ERROR {
+          description "operation on the file resulted in in error, disk failure, not enough disk space,
+                      incompatible file format";
+        }
+        enum INTEGRITY_ERROR {
+          description "file is corrupted";
+        }
+        enum APPLICATION_ERROR {
+          description "operation failed due to internal reason";
+        }
+      }
+
+      description
+        "Status of finished operation execution";
+    }
+    leaf error-message {
+      when "../status != 'COMPLETED'";
+      type string;
+
+      description
+        "Detailed description of faulty situation";
+    }
+  }
+
+  grouping activation-notification {
+    description
+      "Grouping for notification event structure for activation completion";
+    leaf slot-name {
+      type leafref {
+        path "/software-inventory/software-slot/name";
+      }
+
+      description
+        "Name of the slot which was activated";
+    }
+
+    leaf status {
+      type enumeration {
+        enum COMPLETED {
+          description
+            "Operation completed succesfully";
+        }
+        enum APPLICATION_ERROR {
+          description
+            "Operation finished with error, more details can by found in error-message";
+        }
+      }
+
+      description
+        "Status of finished operation execution";
+    }
+    leaf return-code {
+      type uint8;
+
+      description
+        "status code return when the software is tried to activate";
+    }
+    leaf error-message {
+      when "../status != 'COMPLETED'";
+      type string;
+
+      description
+        "Detailed description of faulty situation";
+    }
+  }
+
+  // top level container
+
+  container software-inventory {
+    config false;
+    description
+      "Contains information about each software slot and its content.";
+
+    uses slot-group;
+
+  }
+    // rpc statements
+
+  rpc software-download {
+    description
+      "Rpc needed to perform software download operation.";
+
+    input {
+      uses download-input;
+    }
+    output {
+      uses download-output;
+    }
+  }
+
+  rpc software-install {
+    description
+      "Install a previously downloaded software package.";
+
+    input {
+      uses install-input;
+    }
+    output {
+      uses install-output;
+    }
+  }
+
+  rpc software-activate {
+    description
+      "Activate a previously installed software.";
+    input {
+      uses activate-input;
+    }
+    output {
+      uses activate-output;
+    }
+  }
+
+    // notification definitions
+  notification download-event {
+    description "Notification event structure for download completion";
+    uses download-notification;
+
+  }
+
+  notification install-event {
+    description "Notification event structure for installation completion";
+    uses install-notification;
+  }
+
+  notification activation-event {
+    description "Notification event structure for activation completion";
+    uses activation-notification;
+  }
+}
diff --git a/ntsimulator/yang/o-ran-supervision.yang b/ntsimulator/yang/o-ran-supervision.yang
new file mode 100644 (file)
index 0000000..0491e90
--- /dev/null
@@ -0,0 +1,174 @@
+module o-ran-supervision {
+  yang-version 1.1;
+  namespace "urn:o-ran:supervision:1.0";
+  prefix "o-ran-supervision";
+
+  import ietf-yang-types {
+    prefix yang;
+  }
+
+  organization "O-RAN Alliance";
+
+  contact
+    "www.o-ran.org";
+
+  description
+    "This module defines the configuration data and supervision RPCs that are
+    used to detect loss M-Plane and CU-Plane connectivity.
+
+    Copyright 2019 the O-RAN Alliance.
+
+    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS '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 SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 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.
+
+    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 above disclaimer.
+    * Redistributions in binary form must reproduce the above copyright notice,
+    this list of conditions and the above disclaimer in the documentation
+    and/or other materials provided with the distribution.
+    * Neither the Members of the O-RAN Alliance nor the names of its
+    contributors may be used to endorse or promote products derived from
+    this software without specific prior written permission.";
+
+  revision "2019-04-11" {
+    description
+      "version 1.0.2
+
+      1) added leafs for CU plane monitoring as a companion change to
+      Change Request CIS-0001";
+
+    reference "ORAN-WG4.M.0-v01.00";
+  }
+
+  revision "2019-03-06" {
+    description
+      "version 1.0.1
+
+      1) backward compatible changes to introduce groupings.";
+
+    reference "ORAN-WG4.M.0-v01.00";
+  }
+
+  revision "2019-02-04" {
+    description
+      "version 1.0.0
+
+      1) imported model from xRAN
+      2) changed namespace and reference from xran to o-ran";
+
+    reference "ORAN-WG4.M.0-v01.00";
+  }
+
+  grouping watchdog-input {
+    leaf supervision-notification-interval {
+      type uint16;
+      units seconds;
+      default 60;
+      description
+        "The interval in seconds at which supervision notifications are sent.
+        If not specified the default value of 60 seconds shall apply.";
+    }
+    leaf guard-timer-overhead {
+      type uint16;
+      units seconds;
+      default 10;
+      description
+        "This is overhead added to the supervision timer used to calculate the
+         supervision wathcdog timer. i.e.,
+
+         supervision timer = notification timer + guard-timer-overhead
+
+         If not specified the default value of 10 seconds shall apply.
+
+         Failure to send this rpc again within the timeout sets the radio into
+         'loss of supervision' state.
+
+         NOTE - The supervision timer MUST not be less that the confimed
+         timeout timer (when the feature is supported).
+
+         This type of constraint (using an RPCs input) cannot be formally
+         expressed in YANG.";
+    }
+  }
+
+  grouping watchdog-output {
+    leaf next-update-at {
+      type yang:date-and-time;
+      description
+        "Indicates the time when the next supervision notification is expected.";
+    }
+  }
+  
+  grouping supervision-group {
+    container cu-plane-monitoring {
+      description "container describing operation of CU plane monitoring";
+      presence
+        "Indicates O-RU supports timer based cu-plane monitoring interval. If
+        this container is NOT present, the opertaion of the O-RU is undefined.";
+
+      leaf configured-cu-monitoring-interval {
+        type uint8 {
+          range "0..160";
+        }
+        default 160;
+        units milliseconds;
+        description
+          "This value corresponds to the configured value of the timer used by
+          the O-RU to monitor the C/U plane connection.
+
+          A value of 0 means that the O-RU's shall disable its CU plane
+          monitoring.
+
+          A NETCONF client should configure the value according to the
+          configuration of the PHY layer and/or C/U plane section types
+          supported and/or any fault tolerant operation. For example,
+
+          i) when opertaing with an O-DU supporting non-LAA LTE, this value can
+          be configured to a value according to the repetition time of
+          transmitted reference symbols across the fronthaul interface
+          ii) when opertaing with an O-DU supporting C-Plane Section Type 0,
+          this value can configured to a value according to the minimum
+          repetition interval of section type 0.
+          iii) when operating with an O-DU supporting fault tolerant operation,
+          this value can be configured according to the fault tolerant heartbeat
+          interval ";
+      }
+    }
+  }
+
+  container supervision {
+    uses supervision-group;
+    // other WG specific monitoring containers follow here
+  }
+
+  rpc supervision-watchdog-reset {
+    description
+      "rpc to reset the watchdog timer";
+    input {
+      uses watchdog-input;
+    }
+
+         output {
+      uses watchdog-output;
+         }
+  }
+
+  notification supervision-notification {
+    description
+      "Notification to indicate that NETCONF management interface is up
+      and also indicate the values of the timers for this NETCONF session";
+
+  }
+}
diff --git a/ntsimulator/yang/o-ran-sync.yang b/ntsimulator/yang/o-ran-sync.yang
new file mode 100644 (file)
index 0000000..95906a7
--- /dev/null
@@ -0,0 +1,916 @@
+module o-ran-sync {
+  yang-version 1.1;
+  namespace "urn:o-ran:sync:1.0";
+  prefix "o-ran-sync";
+
+  import ietf-interfaces {
+    prefix "if";
+  }
+
+  import o-ran-interfaces {
+    prefix "o-ran-int";
+  }
+
+  organization "O-RAN Alliance";
+
+  contact
+    "www.o-ran.org";
+
+  description
+    "This module defines synchronization mechanism for the O-RAN Equipment.
+
+    Copyright 2019 the O-RAN Alliance.
+
+    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS '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 SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 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.
+
+    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 above disclaimer.
+    * Redistributions in binary form must reproduce the above copyright notice,
+    this list of conditions and the above disclaimer in the documentation
+    and/or other materials provided with the distribution.
+    * Neither the Members of the O-RAN Alliance nor the names of its
+    contributors may be used to endorse or promote products derived from
+    this software without specific prior written permission.";
+
+  revision "2019-03-06" {
+    description
+      "version 1.0.1
+
+      1) backward compatible changes to introduce groupings.";
+
+    reference "ORAN-WG4.M.0-v01.00";
+  }
+
+  revision "2019-02-04" {
+    description
+      "version 1.0.0
+
+      1) imported model from xRAN
+      2) changed namespace and reference from xran to o-ran";
+
+    reference "ORAN-WG4.M.0-v01.00";
+  }
+
+  typedef geographic-coordinate-degree {
+           type decimal64 {
+             fraction-digits 8;
+           }
+           description
+             "Decimal degree (DD) used to express latitude and longitude
+              geographic coordinates.";
+       }
+
+  feature GNSS {
+    description
+      "This feature indicates that the equipment supports integrated GNSS functionality.";
+  }
+
+  feature ANTI-JAM {
+    description
+      "This feature indicates that the equipment supports Anti-jam fuctionality";
+  }
+
+  grouping sync-group {
+    container sync-status {
+      config false;
+
+      description
+        "Object of this class provides synchronization state of the module.";
+
+      leaf sync-state {
+        type enumeration {
+          enum LOCKED {
+            description
+              "equipment is in the locked mode, as defined in ITU-T G.810";
+          }
+          enum HOLDOVER {
+            description
+              "equipment clock is in holdover mode";
+          }
+          enum FREERUN {
+            description
+              "equipment clock isn't locked to an input reference, and is not in the holdover mode";
+          }
+        }
+        mandatory true;
+        description
+          "State of DU synchronization";
+      }
+
+      list supported-reference-types {
+        key item;
+        min-elements 1;
+        description
+          "Type of a synchronization supported source.";
+        leaf item {
+          type enumeration {
+            enum GNSS {
+              description
+                "GPS can be taken as a synchronization source";
+            }
+            enum PTP {
+              description
+                "Precision Time Protocol can be taken as a synchronization source";
+            }
+            enum SYNCE {
+              description
+                "Synchronous Ethernet can be taken as a synchronization source";
+            }
+          }
+          mandatory true;
+
+          description
+            "supported reference-type";
+        }
+      }
+    }
+
+    container sync-capability {
+      config false;
+
+      description
+        "Object of this class provides synchronization capabilities of the module.";
+
+      leaf sync-t-tsc {
+        type enumeration {
+          enum CLASS_B {
+            description
+              "Standard class B accuracy for synchronization is supported by the device";
+          }
+          enum ENCHANCED {
+            description
+              "Enchanced accuracy for synchronization is supported by the device";
+          }
+        }
+        mandatory true;
+        description
+          "This will provide information about T-TSC capability";
+
+        reference "IEEE 802.1CM";
+      }
+    }
+
+    container ptp-config {
+      description
+        "This MO defines configuration of Precise Time Protocol.";
+      leaf domain-number {
+        type uint8;
+        default 24;
+        description
+          "This parameter indicates Domain Number for PTP announce messages.";
+      }
+
+      list accepted-clock-classes {
+        key clock-classes;
+        leaf clock-classes {
+          type uint8;
+          description
+            "PTP Clock Class accepted by the O-RU";
+        }
+        description
+          "Contains list of PTP acceptable Clock Classes, sorted in the descending order.";
+      }
+
+      leaf ptp-profile {
+        type enumeration {
+          enum G_8275_1 {
+            description
+              "Usage of multicast over ethernet";
+          }
+
+          enum G_8275_2 {
+            description
+              "Usage of unicast over IP";
+          }
+        }
+        default "G_8275_1";
+        description
+          "Type of profile to be used in ptp setting";
+      }
+
+       container g-8275-1-config {
+         when "../ptp-profile='G_8275_1'";
+
+         description
+           "Container allowing for configuration of G8275.1";
+
+          leaf multicast-mac-address {
+            type enumeration {
+              enum FORWARDABLE {
+                description
+                  "means, that PTP shall use 01-1B-19-00-00-00 destination MAC address";
+              }
+              enum NONFORWARDABLE {
+                description
+                  "means, that PTP shall use 01-80-C2-00-00-0E destination MAC address";
+              }
+            }
+            default FORWARDABLE;
+            description
+              "The parameter defines destination MAC address, used by the DU in the egress PTP messages.";
+          }
+
+          leaf delay-asymmetry {
+            type int16 {
+              range -10000..10000;
+            }
+            default 0;
+            description
+              "Defines static phase error in the recovered PTP timing signal to be compensated at the O-RU.
+              The error is defined in units of nanoseconds in the range ±10 000 ns.";
+          }
+       }
+
+      container g-8275-2-config {
+        when "../ptp-profile='G_8275_2'";
+
+        description
+          "Container used for configuration of G8275.2 profile";
+
+        leaf local-ip-port {
+          type leafref {
+            path "/if:interfaces/if:interface/if:name";
+          }
+          description
+            "Reference to interface name corresponding to IP interface
+            used for G.8275.2";
+        }
+
+        list master-ip-configuration {
+          key local-priority;
+          description
+            "The parameter defines list of ip configuration of devices acting as ptp signal source.";
+          leaf local-priority {
+            type uint8;
+            description
+              "The parameter defines local priority or underlying master IP address.";
+          }
+
+          leaf ip-address {
+            type string;
+            description
+              "the parameter defines master IP address.";
+          }
+        }
+
+        leaf log-inter-sync-period {
+          type int8 {
+            range "-7..0";
+          }
+
+          description
+            "The parameter defines number of sync message during 1 second";
+        }
+
+        leaf log-inter-announce-period {
+          type int8 {
+            range "-3..0";
+          }
+
+          description
+            "The parameter defines number of announce message during 1 second";
+        }
+      }
+    }
+
+    container ptp-status {
+      description
+        "ptp status container";
+      leaf reporting-period {
+        type uint8;
+        default 10;
+        description
+          "This parameter defines minimum period in seconds between reports,
+          sent by the NETCONF Client, for parameters in this container.";
+      }
+      leaf lock-state {
+        type enumeration {
+          enum LOCKED {
+            description
+              "The integrated ordinary clock is synchronizing to the reference, recovered from PTP flow";
+          }
+          enum UNLOCKED {
+            description
+              "The integrated ordinary clock is not synchronizing to the reference, recovered from PTP flow";
+          }
+        }
+        config false;
+        description
+          "This parameter indicates, whether the integrated ordinary clock is
+          synchronizing to the reference, recovered from PTP signal.
+          The exact definition when to indicate locked or unlocked is up to specific
+          implementation.";
+      }
+
+      leaf clock-class {
+        type uint8;
+        config false;
+        description
+          "This parameter contains the clock class of the clock, controlled by the O-RU";
+      }
+
+      leaf clock-identity {
+        type string {
+          length 18;
+          pattern "0[xX][0-9a-fA-F]{16}";
+        }
+        config false;
+        description
+          "This parameter contains identity of the clock,
+            according to IEEE 1588-2008 defintion, controlled by the O-RU.
+          The string shall be formatted as an 8-octet hex value with the '0x' prefix.";
+      }
+
+      leaf partial-timing-supported {
+        type boolean;
+        config false;
+        description
+          "Provides information wheter G.8275.2 (partial timing support from network) is supported.";
+      }
+
+      list sources {
+        key local-port-number;
+        config false;
+
+        description
+          "Synchronisation sources";
+
+        leaf local-port-number {
+          type leafref {
+            path "/if:interfaces/if:interface/o-ran-int:port-reference/o-ran-int:port-number";
+          }
+          description
+            "This is reference to portNumber of ExternalEthernetPort to identify the port,
+            where the PTP signal is located.";
+        }
+
+        leaf state {
+          type enumeration {
+            enum PARENT {
+              description
+                "Indicates that this source is the current master clock, i.e. the clock,
+                which the clock, controlled by the Netconf Server, is synchronized to";
+            }
+            enum OK {
+              description
+                "Indicates that this source is an alternate master, which the clock,
+                controlled by the Netconf Server, can potentially synchronize to,
+                i.e. clock class and priority, announced by the master clock is lower,
+                compared to those of the clock, controlled by the Netconf Server,
+                and and the clock class is accepted";
+            }
+            enum NOK {
+              description
+                "Indicates that this source is an alternate master, which the clock,
+                controlled by the Netconf Server, has an operational connection to,
+                but the class or priority of the master clock is higher or equal
+                to those of the clock, controlled by the Netconf Server,
+                or the clock class is not accepted";
+            }
+            enum DISABLED {
+              description
+                "Indicates that this source is an alternate master, which the clock,
+                controlled by the Netconf Server, has no operational connection to";
+            }
+          }
+          description
+            "This parameter indicates status of the PTP source";
+        }
+
+        leaf two-step-flag {
+          type boolean;
+          description
+            "This parameter reflects status of the twoStepFlag attribute in Sync messages,
+            received from the PTP source.";
+        }
+
+        leaf leap61 {
+          type boolean;
+          description
+            "This parameter reflects status of the leap61 flag in Announce messages,
+            received from the PTP source.
+            When true, the last minute of the current UTC day contains 61 seconds.";
+        }
+
+        leaf leap59 {
+          type boolean;
+          description
+            "This parameter reflects status of the leap59 flag in Announce messages,
+            received from the PTP source.
+            When true, the last minute of the current UTC day contains 59 seconds.";
+        }
+
+        leaf current-utc-offset-valid {
+          type boolean;
+          description
+            "This parameter reflects status of the currentUtcOffsetValid flag in
+            Announce messages, received from the PTP source.
+            When true, the current UTC offset is valid.";
+        }
+
+        leaf ptp-timescale {
+          type boolean;
+          description
+            "This parameter reflects status of the ptpTimescale flag in Announce
+            messages, received from the PTP source.
+
+            When set, the clock timescale of the grandmaster clock is PTP;
+            otherwise, the timescale is ARB (arbitrary)";
+        }
+
+        leaf time-traceable {
+          type boolean;
+          description
+            "This parameter reflects status of the timeTraceable flag in Announce
+            messages, received from the PTP source.
+
+            When true, the timescale and the currentUtcOffset are traceable to a
+            primary reference";
+        }
+
+        leaf frequency-traceable {
+          type boolean;
+          description
+            "This parameter reflects status of the frequencyTraceable flag in
+            Announce messages, received from the PTP source.
+
+            When true, the frequency determining the timescale is traceable to a
+            primary reference";
+        }
+
+        leaf source-clock-identity {
+          type string {
+            length 18;
+            pattern "0[xX][0-9a-fA-F]{16}";
+          }
+          description
+            "This parameter reflects value of the sourceClockIdentity attribute in
+            Announce messages, received from the PTP source.
+
+            The string shall be formatted as an 8-octet hex value with the '0x'
+            prefix.";
+        }
+
+        leaf source-port-number {
+          type uint16;
+          description
+            "This parameter reflects value of the sourcePortNumber attribute in
+            Announce messages, received from the PTP source.";
+        }
+
+        leaf current-utc-offset {
+          type int16;
+          description
+            "The offset between TAI and UTC when the epoch of the PTP system is
+            the PTP epoch, i.e., when ptp-timescale is TRUE; otherwise, the value
+            has no meaning";
+        }
+
+        leaf priority1 {
+          type uint8;
+          description
+            "This parameter reflects value of the priority1 attribute in Announce
+            messages, received from the PTP source.";
+        }
+
+        leaf clock-class {
+          type uint8;
+          description
+            "This parameter reflects value of the clockClass attribute in
+            Announce messages, received from the PTP source.";
+        }
+
+        leaf clock-accuracy {
+          type uint8;
+          description
+            "This parameter reflects value of the clockAccuracy attribute in
+            Announce messages, received from the PTP source.";
+        }
+
+        leaf offset-scaled-log-variance {
+          type uint16;
+          description
+            "This parameter reflects value of the offsetScaledLogVariance
+            attribute in Announce messages, received from the PTP source.";
+        }
+
+        leaf priority2 {
+          type uint8;
+          description
+            "This parameter reflects value of the priority2 attribute in Announce
+            messages, received from the PTP source.";
+        }
+
+        leaf grandmaster-clock-identity {
+          type string {
+            length 18;
+            pattern "0[xX][0-9a-fA-F]{16}";
+          }
+          description
+            "This parameter reflects value of the grandmasterClockIdentity
+            attribute in Announce messages, received from the PTP source.
+
+            The string shall be formatted as an 8-octet hex value with the '0x'
+            prefix.";
+        }
+
+        leaf steps-removed {
+          type uint16;
+          description
+            "This parameter reflects value of the stepsRemoved attribute in
+            Announce messages, received from the PTP source.
+
+            It indicates the number of communication paths traversed
+            between the local clock and the grandmaster clock.";
+        }
+
+        leaf time-source {
+          type uint8;
+          description
+            "This parameter reflects value of the timeSource attribute in
+            Announce messages, received from the PTP source.";
+        }
+      }
+    }
+
+    container synce-config {
+      description
+        "This container defines the configuration of SyncE";
+
+      leaf-list acceptance-list-of-ssm {
+        type enumeration {
+          enum PRC {
+            description
+              "PRC";
+          }
+          enum PRS {
+            description
+              "PRS";
+          }
+          enum SSU_A {
+            description
+              "SSU_A";
+          }
+          enum SSU_B {
+            description
+              "SSU_B";
+          }
+          enum ST2 {
+            description
+              "ST2";
+          }
+          enum ST3 {
+            description
+              "ST3";
+          }
+          enum ST3E {
+            description
+              "ST3E";
+          }
+          enum EEC1 {
+            description
+              "EEC1";
+          }
+          enum EEC2 {
+            description
+              "EEC2";
+          }
+          enum DNU {
+            description
+              "DNU";
+          }
+          enum NONE {
+            description
+              "NONE";
+          }
+        }
+
+        default "PRC";
+
+        description
+          "The parameter contains the list of SyncE acceptable SSMs.";
+      }
+
+      leaf ssm-timeout {
+        type uint16;
+
+        description
+          "The parameter contains the value of maximum duration in seconds for which the actual SSM value may be different than configured values.";
+      }
+    }
+
+    container synce-status {
+      description
+        "SyncE status container";
+
+      leaf reporting-period {
+          type uint8;
+          default 10;
+          description
+            "This parameter defines minimum period in seconds between reports,
+             sent by the NETCONF client, for parameters in this container.";
+      }
+
+      leaf lock-state {
+        type enumeration {
+          enum LOCKED {
+            description
+              "The integrated ordinary clock is synchronizing to the reference, recovered from SyncE signal";
+          }
+          enum UNLOCKED {
+            description
+              "The integrated ordinary clock is not synchronizing to the reference, recovered from SyncE signal";
+          }
+        }
+        config false;
+        description
+          "This parameter indicates, whether the integrated ordinary clock is
+          synchronizing to the reference, recovered from SyncE signal.
+
+          The exact definition when to indicate locked or unlocked is up to
+          specific implementation.";
+      }
+
+      list sources {
+        key local-port-number;
+        config false;
+        leaf local-port-number {
+          type leafref {
+            path "/if:interfaces/if:interface/o-ran-int:port-reference/o-ran-int:port-number";
+          }
+          description
+            "This is reference to portNumber of ExternalEthernetPort to identify
+            the port, where the SyncE signal is located.";
+        }
+
+        leaf state {
+          type enumeration {
+            enum PARENT {
+              description
+                "Indicates that this source is the current master clock, i.e. the clock,
+                which the clock, controlled by the Netconf Server, is synchronized to";
+            }
+            enum OK {
+              description
+                "Indicates that this source is an alternate master, which the clock,
+                controlled by the Netconf Server, can potentially synchronize to,
+                i.e. clock class and priority, announced by the master clock is lower,
+                compared to those of the clock, controlled by the Netconf Server,
+                and and the clock class is accepted";
+            }
+            enum NOK {
+              description
+                "Indicates that this source is an alternate master, which the clock,
+                controlled by the Netconf Server, has an operational connection to,
+                but the class or priority of the master clock is higher or equal
+                to those of the clock, controlled by the Netconf Server,
+                or the clock class is not accepted";
+            }
+            enum DISABLED {
+              description
+                "Indicates that this source is an alternate master, which the clock,
+                controlled by the Netconf Server, has no operational connection to";
+            }
+          }
+          description
+            "This parameter indicates status of the SyncE source";
+        }
+
+        leaf quality-level {
+          type uint8 {
+            range 0..15;
+          }
+          description
+            "This parameter contains value of the SSM clock quality level,
+            received in SSM messages from the SyncE source.";
+        }
+        min-elements 1;
+        description
+          "This parameter contains characteristics of SyncE sources of the clock, controlled by the O-RU.";
+      }
+    }
+
+    container gnss-config {
+      if-feature GNSS;
+      description
+        "This container defines the configuration of Global Navigation Satellite System (GNSS).";
+
+      leaf enable {
+        type boolean;
+
+        description
+          "This parameter defines if GNSS receiver shall be enabled or not.";
+      }
+
+      leaf-list satellite-constelation-list {
+        type enumeration {
+          enum GPS {
+            description
+              "GPS";
+          }
+          enum GLONASS {
+            description
+              "GLONASS should not be used alone but always along with GPS or BEIDOU because of missing leap second information";
+          }
+          enum GALILEO {
+            description
+              "GALILEO";
+          }
+          enum BEIDOU {
+            description
+              "BEIDOU";
+          }
+        }
+
+        description
+          "This parameter defines list of constellations to be used to acquire synchronization.";
+      }
+
+      leaf polarity {
+        type enumeration {
+          enum POSITIVE {
+            description
+              "POSITIVE";
+          }
+          enum NEGATIVE {
+            description
+              "NEGATIVE";
+          }
+        }
+        default POSITIVE;
+
+        description
+          "This parameter defines pulse polarity";
+      }
+
+      leaf cable-delay {
+        type uint16 {
+          range "0..1000";
+        }
+        default 5;
+
+        description
+          "This parameter is used to compensate cable delay.";
+      }
+
+      leaf anti-jam-enable {
+        if-feature ANTI-JAM;
+        type boolean;
+        default false;
+        description
+          "This parameter is used to enable or disable anti-jamming.";
+      }
+    }
+
+    container gnss-status {
+      if-feature GNSS;
+      description
+        "Provides information about state of gps receiver";
+      leaf reporting-period {
+        type uint8;
+        default 10;
+        description
+          "This parameter defines minimum period in seconds between reports,
+          sent by the NETCONF Client, for parameters in this container.";
+      }
+      leaf name {
+        type string {
+          length "1..255";
+        }
+        config false;
+        description
+        "A name that is unique that identifies a GNSS instance.
+        This name may be used in fault management to refer to a
+        fault source or affected object";
+      }
+      leaf gnss-sync-status {
+        type enumeration {
+          enum SYNCHRONIZED {
+            description "GNSS functionality is synchronized";
+          }
+          enum ACQUIRING-SYNC {
+            description "GNSS functionality is acquiring sync";
+          }
+          enum ANTENNA-DISCONNECTED {
+            description "GNSS functionality has its antenna disconnected";
+          }
+          enum BOOTING {
+            description "GNSS functionality is booting";
+          }
+          enum ANTENNA-SHORT-CIRCUIT {
+            description "GNSS functionality has an antenna short circuit";
+          }
+        }
+        config false;
+        description "when available, indicates the status of the gnss receiver.";
+      }
+      container gnss-data {
+        when "../gnss-sync-status='SYNCHRONIZED'";
+        config false;
+        description
+          "GPS data contained";
+        leaf satellites-tracked {
+          type uint8;
+          description "Number of satellites tracked";
+        }
+        container location {
+          description
+            "Containes information about geo location";
+          leaf altitude {
+            type int64;
+            units millimeter;
+            description
+              "Distance above the sea level.";
+          }
+          leaf latitude {
+            type geographic-coordinate-degree {
+              range "-90..90";
+            }
+            description
+              "Relative position north or south on the Earth's surface.";
+          }
+          leaf longitude {
+            type geographic-coordinate-degree {
+              range "-180..180";
+            }
+            description
+              "Angular distance east or west on the Earth's surface.";
+          }
+        }
+      }
+    }
+  }
+
+  container sync {
+    description
+      "Main containter for sync related parameters";
+
+    uses sync-group;
+  }
+
+  //notification statement
+  notification synchronization-state-change {
+    description
+      "Notification used to inform about synchronization state change";
+
+    leaf sync-state {
+      type leafref {
+        path "/sync/sync-status/sync-state";
+      }
+      description
+        "State of equipment synchronization is notified at state change";
+    }
+  }
+
+  notification ptp-state-change {
+    description
+      "Notification used to inform about ptp synchronization state change";
+
+    leaf ptp-state{
+      type leafref{
+        path "/sync/ptp-status/lock-state";
+      }
+      description
+        "ptp-state-change notification is signalled from equipment at state change";
+    }
+  }
+  notification synce-state-change {
+    description
+      "Notification used to inform about synce synchronization state change";
+
+    leaf synce-state{
+      type leafref{
+        path "/sync/synce-status/lock-state";
+      }
+      description
+        "synce-state change notification is signalled from equipment at state change";
+    }
+  }
+  notification gnss-state-change {
+    if-feature GNSS;
+    description
+      "Notification used to inform about gnss synchronization state change";
+
+    leaf gnss-state{
+      type leafref{
+        path "/sync/gnss-status/gnss-sync-status";
+      }
+      description
+        "gnss-state-change notification is signalled from equipment at state change";
+    }
+  }
+
+}
diff --git a/ntsimulator/yang/o-ran-trace.yang b/ntsimulator/yang/o-ran-trace.yang
new file mode 100644 (file)
index 0000000..7571aaa
--- /dev/null
@@ -0,0 +1,101 @@
+module o-ran-trace {
+  yang-version 1.1;
+  namespace "urn:o-ran:trace:1.0";
+  prefix "o-ran-trace";
+
+  organization "O-RAN Alliance";
+
+  contact
+    "www.o-ran.org";
+
+  description
+    "This module defines the operations for the trace logs.
+
+    Copyright 2019 the O-RAN Alliance.
+
+    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS '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 SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 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.
+
+    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 above disclaimer.
+    * Redistributions in binary form must reproduce the above copyright notice,
+    this list of conditions and the above disclaimer in the documentation
+    and/or other materials provided with the distribution.
+    * Neither the Members of the O-RAN Alliance nor the names of its
+    contributors may be used to endorse or promote products derived from
+    this software without specific prior written permission.";
+
+  revision "2019-02-21" {
+    description
+      "version 1.0.0
+      Initial module definition.";
+
+    reference "ORAN-WG4.M.0-v01.00";
+  }
+
+
+  grouping trace-status-grouping {
+    description "grouping used for trace RPCs";
+    leaf status {
+      type enumeration {
+        enum SUCCESS {
+          description "rpc completed correctly";
+        }
+        enum FAILURE {
+          description "rpc failed";
+        }
+      }
+      description "result of rpc operation";
+    }
+    leaf failure-reason {
+      when "../status = 'FAILURE'";
+      type string;
+      description "free form text description why error occurred";
+    }
+  }
+
+  rpc start-trace-logs {
+    description
+      "Management plane triggered to start collecting the trace logs files of O-RU.";
+      output {
+        uses trace-status-grouping;
+      }
+  }
+
+  rpc stop-trace-logs {
+    description
+      "Management plane triggered to stop collecting the trace logs files of O-RU.";
+      output {
+        uses trace-status-grouping;
+      }
+  }
+
+  notification trace-log-generated {
+    description
+      "When new log file generated, send this notification.";
+    leaf-list log-file-name {
+      type string;
+      description
+        "The list of trace log file names on the O-RU.";
+    }
+    
+    leaf is-notification-last {
+      type boolean;
+      default false;
+      description
+        "Informs if notification is last - the one after receiving stop-trace-logs rpc.";
+    }
+  }
+}
diff --git a/ntsimulator/yang/o-ran-transceiver.yang b/ntsimulator/yang/o-ran-transceiver.yang
new file mode 100644 (file)
index 0000000..312b11e
--- /dev/null
@@ -0,0 +1,396 @@
+module o-ran-transceiver {
+  yang-version 1.1;
+  namespace "urn:o-ran:transceiver:1.0";
+  prefix "o-ran-transceiver";
+
+  import o-ran-interfaces {
+    prefix "o-ran-int";
+  }
+
+  import ietf-interfaces {
+    prefix "if";
+  }
+
+  organization "O-RAN Alliance";
+
+  contact
+    "www.o-ran.org";
+
+  description
+    "This module defines the operational state data for SFP transceivers used in
+    an O-RAN Radio Unit.
+
+    Copyright 2019 the O-RAN Alliance.
+
+    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS '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 SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 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.
+
+    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 above disclaimer.
+    * Redistributions in binary form must reproduce the above copyright notice,
+    this list of conditions and the above disclaimer in the documentation
+    and/or other materials provided with the distribution.
+    * Neither the Members of the O-RAN Alliance nor the names of its
+    contributors may be used to endorse or promote products derived from
+    this software without specific prior written permission.";
+
+  revision "2019-03-07" {
+    description
+      "version 1.0.1
+
+      1) backward compatible changes to introduce groupings.";
+
+    reference "ORAN-WG4.M.0-v01.00";
+  }
+
+  revision "2019-02-04" {
+    description
+      "version 1.0.0
+
+      1) imported model from xRAN
+      2) changed namespace and reference from xran to o-ran";
+
+    reference "ORAN-WG4.M.0-v01.00";
+  }
+
+  // Groupings
+
+  grouping transceiver-group {
+    list port-transceiver-data {
+      key "interface-name port-number";
+      description "data recovered from port transceivers";
+      leaf interface-name {
+        type leafref {
+          path "/if:interfaces/if:interface/if:name";
+        }
+        description "Name of interface";
+      }
+      leaf port-number {
+        type leafref {
+          path "/if:interfaces/if:interface[if:name = current()/../interface-name]" + "/o-ran-int:port-reference/o-ran-int:port-number";
+        }
+        description
+        "A number which identifies a port. In case of SFP/SFP+
+        port, port number value is 0 to N-1 where N is number of ports
+        in the device. Numbers 0 to N-1 are assigned to ports in order
+        following order of labels on the device (labels for ports are
+        not necessarily numbers starting from zero)";
+      }
+
+      leaf name {
+        type string {
+          length "1..255";
+        }
+        description
+          "A name that is unique across the O-RU that identifies a transceiver instance.
+          This name may be used in fault management to refer to a fault source
+          or affected object";
+      }
+
+      leaf present {
+        type boolean;
+        config false;
+        mandatory true;
+        description
+          "Indicates if pluggable transceiver module is present.";
+      }
+
+      leaf vendor-id {
+        type string {
+          length 1..16;
+        }
+        config false;
+        description
+          "Name of the transciever vendor Full name of transceiver vendor,
+          that contains ASCII characters, left-aligned with
+          any padding on the right with ASCII spaces (20h), or ASCII nul
+          (00h) removed, and ASCII less-than (3Ch) replaced with ASCII
+          open-brace (7Bh) and ASCII more-than (3Eh) replaced with ASCII
+          close-brace (7Dh).
+
+          Optional node included when the NETCONF Server has determined
+          the vendor ID.";
+      }
+
+      leaf vendor-part {
+        type string {
+          length 1..16;
+        }
+        config false;
+        description
+          "Transceiver vendors part number, that contains ASCII characters,
+          left-aligned with any padding on the right with ASCII spaces
+          (20h), or ASCII nul (00h) removed, and ASCII less-than (3Ch)
+          replaced with ASCII open-brace (7Bh) and ASCII more-than (3Eh)
+          replaced with ASCII close-brace (7Dh).
+
+          Optional node included when the NETCONF Server has determined
+          the vendor part number.";
+      }
+
+      leaf vendor-rev {
+        type string {
+          length 1..2;
+        }
+        config false;
+        description
+          "Transceiver vendors revision number. 2-octet field that
+          contains ASCII characters.
+
+          Optional node included when the NETCONF Server has determined
+          the vendor revision number";
+      }
+
+      leaf serial-no {
+        type string {
+          length 1..16;
+        }
+        config false;
+        description
+          "Transceiver serial number encoded using ASCII characters,
+          left-aligned with any padding on the right with ASCII spaces
+          (20h), or ASCII nul (00h) removed, and ASCII less-than (3Ch)
+          replaced with ASCII open-brace (7Bh) and ASCII more-than (3Eh)
+          replaced with ASCII close-brace (7Dh).
+
+          Optional node included when the NETCONF Server has determined
+          the serial number.";
+      }
+
+      leaf SFF8472-compliance-code {
+        type enumeration {
+          enum diagnostics-undefined {
+            description "undefined compliance code";
+          }
+          enum rev9.3-diagnostics {
+            description "diagnostics published 08-01-02";
+          }
+          enum rev9.5-diagnostics{
+            description "diagnostics published 06-01-04";
+          }
+          enum rev10.2-diagnostics{
+            description "diagnostics published 06-01-07";
+          }
+          enum rev11.0-diagnostics{
+            description "diagnostics published 05-21-10";
+          }
+          enum rev11.3-diagnostics{
+            description "diagnostics published 06-11-13";
+          }
+          enum rev11.4-diagnostics{
+            description "diagnostics published 07-24-14";
+          }
+          enum rev12.0-diagnostics{
+            description "diagnostics published 08-28-14";
+          }
+        }
+        config false;
+        description
+          "Indication of which feature set(s) are
+          implemented in the transceiver from Byte 94 of address A0h
+          https://ta.snia.org/higherlogic/ws/public/download/294/SFF-8472.PDF
+
+          Optional node included when the NETCONF Server has determined
+          the compliance code.";
+
+        reference "https://ta.snia.org/higherlogic/ws/public/download/294/SFF-8472.PDF";
+      }
+
+       leaf connector-type {
+        type enumeration {
+          enum unknown {
+            description "encoded as 00h in Table 4-3 of SFF-8024";
+          }
+          enum subscrber-connector {
+            description "encoded as 01h in Table 4-3 of SFF-8024";
+          }
+          enum fiber-jack {
+            description "encoded as 06h in Table 4-3 of SFF-8024";
+          }
+          enum lucent-connector {
+            description "encoded as 07h in Table 4-3 of SFF-8024";
+          }
+          enum mt-rj {
+            description "encoded as 08h in Table 4-3 of SFF-8024";
+          }
+          enum multiple-optical {
+            description "encoded as 09h in Table 4-3 of SFF-8024";
+          }
+          enum sg {
+            description "encoded as 0Ah in Table 4-3 of SFF-8024";
+          }
+          enum optical-pigtail {
+            description "encoded as 0Bh in Table 4-3 of SFF-8024";
+          }
+          enum multi-fiber-parralel-optic-1x12 {
+            description "encoded as 0Ch in Table 4-3 of SFF-8024";
+          }
+          enum multi-fiber-parralel-optic-2x16 {
+            description "encoded as 0Dh in Table 4-3 of SFF-8024";
+          }
+          enum hssdc_2{
+            description "encoded as 20h in Table 4-3 of SFF-8024";
+          }
+          enum copper-pigtail{
+            description "encoded as 21h in Table 4-3 of SFF-8024";
+          }
+          enum rj45{
+            description "encoded as 22h in Table 4-3 of SFF-8024";
+          }
+          enum no-separable-connector{
+            description "encoded as 23h in Table 4-3 of SFF-8024";
+          }
+          enum mxc-2x16{
+            description "encoded as 24h in Table 4-3 of SFF-8024";
+          }
+        }
+        config false;
+        // TOCHECK: Remove any enumerations which are not applicable
+        description
+          "Connector-type indicates the external optical or electrical cable
+          connector provided as the media interface as defined in the connector
+          types derived from table 4-3 in SFF-8024.
+
+          Optional node included when the NETCONF Server has determined
+          the connector type.";
+        reference "https://ta.snia.org/higherlogic/ws/public/document?document_id=944";
+      }
+
+      leaf nominal-bitrate {
+        type uint32;
+        config false;
+        description
+          "Nominal bitrate in Mb/s (10^6 bits per second).
+          If needed actual value is rounded to nearest integer.
+
+          Optional node included when the NETCONF Server has determined
+          the nominal bit rate.";
+      }
+
+      leaf low-bitrate-margin {
+        type uint8;
+        config false;
+        description
+          "Minimum supported bitrate as percentage of nominal bitrate
+          below nominal bitrate.
+
+          Optional node included when the NETCONF Server has determined
+          the low bit rate margin";
+      }
+
+      leaf high-bitrate-margin {
+        type uint8;
+        config false;
+        description
+          "Maximum supported bitrate as percentage of nominal bitrate
+          above nominal bitrate.
+
+          Optional node included when the NETCONF Server has determined
+          the high bitrate margin.";
+      }
+
+      leaf rx-power-type {
+        type enumeration {
+          enum oma {
+            description "oma = optical modulation amplitude";
+          }
+          enum avp{
+            description "avp = average power";
+          }
+        }
+        config false;
+        description
+          "Receieved power measurement type
+          oma = optical modulation amplitude
+          avp = average power
+
+          Optional node included when the NETCONF Server has determined
+          the rx power type.";
+      }
+
+      leaf rx-power {
+        type decimal64{
+          fraction-digits 4;
+        }
+        config false;
+        description
+          "Measured RX input power in mW.
+
+          Optional node included when the NETCONF Server has determined
+          the measured RX power.";
+      }
+
+      leaf tx-power {
+        type decimal64{
+          fraction-digits 4;
+        }
+        config false;
+        description
+          "Measured coupled TX output power in mW.
+
+          Optional node included when the NETCONF Server has determined
+          the measured coupled TX power.";
+      }
+
+      leaf tx-bias-current {
+        type decimal64{
+          fraction-digits 4;
+        }
+        config false;
+        description
+          "Measured transmitter laser bias current in mA.
+
+          Optional node included when the NETCONF Server has determined
+          the tx bias current.";
+      }
+
+      leaf voltage {
+        type decimal64{
+          fraction-digits 4;
+        }
+        config false;
+        description
+          "Internally measured supply voltage in mV.
+
+          Optional node included when the NETCONF Server has determined
+          the internally measured voltage.";
+      }
+
+      leaf temperature {
+        type decimal64 {
+          fraction-digits 4;
+        }
+        config false;
+        description
+          "Internally measured module temperature in degrees Celcius.
+
+          Optional node included when the NETCONF Server has determined
+          the temperature.";
+      }
+    }
+  }
+
+  // Top Level Container
+
+  container port-transceivers {
+    description
+      "Container for Port transceiver information.
+      Leaf nodes providing  parameters status and diagnostic
+      information for pluggable transceiver module (like SFP,
+      SFP+, SFP28)";
+
+    uses transceiver-group;
+  }
+}
diff --git a/ntsimulator/yang/o-ran-troubleshooting.yang b/ntsimulator/yang/o-ran-troubleshooting.yang
new file mode 100644 (file)
index 0000000..ae09f8c
--- /dev/null
@@ -0,0 +1,96 @@
+module o-ran-troubleshooting {
+  yang-version 1.1;
+  namespace "urn:o-ran:troubleshooting:1.0";
+  prefix "o-ran-trblsht";
+
+  organization "O-RAN Alliance";
+
+  contact
+    "www.o-ran.org";
+
+  description
+    "This module defines the operations for the troubleshooting logs.
+
+    Copyright 2019 the O-RAN Alliance.
+
+    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS '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 SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 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.
+
+    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 above disclaimer.
+    * Redistributions in binary form must reproduce the above copyright notice,
+    this list of conditions and the above disclaimer in the documentation
+    and/or other materials provided with the distribution.
+    * Neither the Members of the O-RAN Alliance nor the names of its
+    contributors may be used to endorse or promote products derived from
+    this software without specific prior written permission.";
+
+  revision "2019-02-04" {
+    description
+      "version 1.0.0
+
+      1) imported model from xRAN
+      2) changed namespace and reference from xran to o-ran";
+
+    reference "ORAN-WG4.M.0-v01.00";
+  }
+
+
+  grouping troubleshooting-status-grouping {
+    description "grouping used for troubleshooting RPCs";
+    leaf status {
+      type enumeration {
+        enum SUCCESS {
+          description "rpc completed correctly";
+        }
+        enum FAILURE {
+          description "rpc failed";
+        }
+      }
+      description "result of rpc operation";
+    }
+    leaf failure-reason {
+      when "../status = 'FAILURE'";
+      type string;
+      description "free form text description why error occurred";
+    }
+  }
+
+  rpc start-troubleshooting-logs {
+    description
+      "Management plane triggered to start collecting the troubleshooting logs files of O-RU.";
+      output {
+        uses troubleshooting-status-grouping;
+      }
+  }
+
+  rpc stop-troubleshooting-logs {
+    description
+      "Management plane triggered to stop collecting the troubleshooting logs files of O-RU.";
+      output {
+        uses troubleshooting-status-grouping;
+      }
+  }
+
+  notification troubleshooting-log-generated {
+    description
+      "When new log file generated, send this notification.";
+    leaf-list log-file-name {
+      type string;
+      description
+        "The list of troubleshooting log file names on the O-RU.";
+    }
+  }
+}
diff --git a/ntsimulator/yang/o-ran-udp-echo.yang b/ntsimulator/yang/o-ran-udp-echo.yang
new file mode 100644 (file)
index 0000000..b65c453
--- /dev/null
@@ -0,0 +1,95 @@
+module o-ran-udp-echo {
+  yang-version 1.1;
+  namespace "urn:o-ran:udpecho:1.0";
+  prefix "o-ran-echo";
+
+  import o-ran-interfaces {
+    prefix "o-ran-int";
+  }
+
+  organization "O-RAN Alliance";
+
+  contact
+    "www.o-ran.org";
+
+  description
+    "This module covers off aspects of interface transport
+    verification for UDP/IP based C/U plane connections based on UDP Echo.
+
+    Copyright 2019 the O-RAN Alliance.
+
+    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS '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 SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 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.
+
+    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 above disclaimer.
+    * Redistributions in binary form must reproduce the above copyright notice,
+    this list of conditions and the above disclaimer in the documentation
+    and/or other materials provided with the distribution.
+    * Neither the Members of the O-RAN Alliance nor the names of its
+    contributors may be used to endorse or promote products derived from
+    this software without specific prior written permission.";
+
+  revision "2019-02-04" {
+    description
+      "version 1.0.0
+
+      1) imported model from xRAN
+      2) changed namespace and reference from xran to o-ran";
+
+    reference "ORAN-WG4.M.0-v01.00";
+  }
+
+// groupings
+
+  grouping udp-echo-group {
+    leaf enable-udp-echo {
+      type boolean;
+      default false;
+      description
+        "whether O-RU's UDP ech server is enabled";
+    }
+
+    leaf dscp-config {
+      type enumeration {
+        enum REFLECTIVE {
+          description
+            "DSCP in echoed datagrams is copied from received datagram";
+        }
+        enum EF {
+          description
+            "DSCP in echoed datagrams is always be set to expeditied
+            forwarding Per Hop Behaviour.";
+        }
+      }
+      default EF;
+      description "configuration of UDP echo DSCP";
+    }
+
+    leaf echo-replies-transmitted {
+      type uint32;
+      config false;
+      description
+        "The total number of UDP echo replies transmitted by the O-RU.";
+    }
+  }
+
+  container udp-echo {
+    if-feature o-ran-int:UDPIP-BASED-CU-PLANE;
+    description "container for udp echo";
+
+    uses udp-echo-group;
+  }
+}
diff --git a/ntsimulator/yang/o-ran-uplane-conf.yang b/ntsimulator/yang/o-ran-uplane-conf.yang
new file mode 100644 (file)
index 0000000..a51933a
--- /dev/null
@@ -0,0 +1,1485 @@
+module o-ran-uplane-conf {
+  yang-version 1.1;
+  namespace "urn:o-ran:uplane-conf:1.0";
+  prefix "o-ran-uplane-conf";
+
+  import o-ran-processing-element {
+    prefix "o-ran-pe";
+  }
+
+  import ietf-interfaces {
+    prefix "if";
+  }
+
+  import o-ran-module-cap {
+    prefix "mcap";
+  }
+
+  import o-ran-compression-factors {
+    prefix "cf";
+  }
+
+  organization "O-RAN Alliance";
+
+  contact
+    "www.o-ran.org";
+
+  description
+    "This module defines the module capabilities for
+    the O-RAN Radio Unit U-Plane configuration.
+
+    Copyright 2019 the O-RAN Alliance.
+
+    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS '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 SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 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.
+
+    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 above disclaimer.
+    * Redistributions in binary form must reproduce the above copyright notice,
+    this list of conditions and the above disclaimer in the documentation
+    and/or other materials provided with the distribution.
+    * Neither the Members of the O-RAN Alliance nor the names of its
+    contributors may be used to endorse or promote products derived from
+    this software without specific prior written permission.";
+
+  revision "2019-04-01" {
+    description
+      "version 1.1.0
+
+      1) removed redundant LAA import";
+
+    reference "ORAN-WG4.M.0-v01.00";
+  }
+
+  revision "2019-02-04" {
+    description
+      "version 1.0.0
+
+      1) imported model from xRAN
+      2) changed namespace and reference from xran to o-ran";
+
+    reference "ORAN-WG4.M.0-v01.00";
+  }
+
+  typedef polarisation_type {
+    type enumeration {
+      enum MINUS_45 {
+        description "MINUS_45";
+      }
+      enum ZERO {
+        description "ZERO";
+      }
+      enum PLUS_45 {
+        description "PLUS_45";
+      }
+      enum PLUS_90 {
+        description "PLUS_90";
+      }
+    }
+    description "Type definition for polarisations";
+  }
+
+  grouping laa-carrier-config {
+    description "Carrier Configuration for support of LAA. ";
+    leaf ed-threshold-pdsch {
+      type int8;
+      units dBm;
+      description
+        "This value indicates Energy Detection(ED) threshold for LBT for PDSCH and for measurements in dBm.";
+    }
+
+    leaf ed-threshold-drs {
+      type int8;
+      units dBm;
+      description
+        "This value indicates Energy Detection(ED) threshold for LBT for DRS in dBm.";
+    }
+
+    leaf tx-antenna-ports {
+      type uint8;
+      description
+        "This value indicates Tx antenna ports for DRS (1, 2, 4)";
+    }
+
+    leaf transmission-power-for-drs {
+      type int8;
+      units decibels;
+      description
+        "This value indicates offset of Cell specific reference Signal(CRS) power to reference signal power (dB).
+        DRS signal consists of CRS, PSS, SSS, and optionally CSI-RS.";
+    }
+
+    leaf dmtc-period {
+      type enumeration {
+        enum FORTY {
+          description
+            "40 ms";
+        }
+        enum EIGHTY {
+          description
+            "80 ms";
+        }
+        enum ONE-HUNDRED-SIXTY {
+          description
+            "160 ms";
+        }
+      }
+      units milliseconds;
+      description
+        "This value indicates DRS measurement timing configuration (DMTC) period in ms";
+    }
+
+    leaf dmtc-offset {
+      type uint8;
+      units subframes;
+      description
+        "This value indicates dmtc offset in Subframes.";
+    }
+
+    leaf lbt-timer {
+      type uint16;
+      units milliseconds;
+      description
+        "This value indicates LBT Timer in milliseconds.";
+    }
+
+    list max-cw-usage-counter {
+      when "/mcap:module-capability/mcap:band-capabilities[mcap:band-number = '46']/mcap:sub-band-info/mcap:self-configure = 'true'";
+      key "priority";
+      description "";
+      leaf priority {
+        type enumeration {
+          enum P1 {
+            description "priority 1";
+          }
+          enum P2 {
+            description "priority 2";
+          }
+          enum P3 {
+            description "priority 3";
+          }
+          enum P4 {
+            description "priority 4";
+          }
+        }
+        description "This value provides the priority class traffic for which the counter is calculated.";
+      }
+
+        leaf counter-value {
+          type uint8 {
+            range "1..8";
+          }
+          description "This value indicates the maximum value of counter
+          which shows how many max congestion window value is used for backoff
+          number of priority class traffic. This value is defined at 3GPP 36.213
+          section 15.1.3 as K.";
+        }
+      }
+  }
+
+  grouping  eaxc {
+    description
+      "One eAxC identifier (eAxC ID) comprises a band and sector
+      identifier (BandSector_ID), a component-carrier identifier (CC_ID) and a
+      spatial stream identifier (RU_Port_ID).
+
+      In this version of the specification, one eAxC contains only one spatial
+      stream (i.e. one beam per subcarrier) at a time.
+
+      Bit allocation is subdivided as follows:
+      *    O_DU_Port_ID: Used to differentiate processing units at O-DU
+      *    BandSector_ID: Aggregated cell identifier
+      *    CC_ID: distinguishes Carrier Components
+      *    RU_Port_ID: Used to differentiate spatial streams or beams on the O-RU
+
+      The bitwidth of each of the above fields is variable this model is supposed to check
+        if we are occpying bits continuously but we do not have to occupy all 16 bits";
+
+
+    leaf o-du-port-bitmask {
+      type uint16;
+      mandatory true;
+      description
+        "mask for eaxc-id bits used to encode O-DU Port ID";
+    }
+
+    leaf band-sector-bitmask {
+      type uint16;
+      mandatory true;
+      description
+        "mask for eaxc-id bits used to encode the band sector ID";
+    }
+
+    leaf ccid-bitmask {
+      type uint16;
+      mandatory true;
+      description
+        "mask for eaxc-id bits used to encode the component carrier id";
+    }
+
+    leaf ru-port-bitmask {
+      type uint16;
+      mandatory true;
+      description
+        "mask for eaxc-id bits used to encode the O-RU Port ID";
+    }
+
+    leaf eaxc-id {
+      type uint16;
+      mandatory true;
+      description
+        "encoded value of eaxcid to be read by CU-Plane";
+    }
+  }
+
+  grouping parameters {
+    description
+      "Grouping of all parameters common between UL and DL";
+
+    leaf name {
+      type string;
+      mandatory true;
+      description "Unique name of array antenna";
+    }
+
+    leaf number-of-rows {
+      type uint16;
+      mandatory true;
+      description "Number of rows array elements are shaped into - M";
+    }
+
+    leaf number-of-columns {
+      type uint16;
+      mandatory true;
+      description "Number of columns array elements are shaped into - N";
+    }
+
+    leaf number-of-array-layers {
+      type uint8;
+      mandatory true;
+      description "Number of array layers array elements are shaped into - Q";
+    }
+
+    leaf horizontal-spacing {
+      type decimal64 {
+            fraction-digits 5;
+        }
+      units Meter;
+
+      description "Average distance between centers of nearby AE in horizontal direction (in array coordinates system)";
+    }
+
+    leaf vertical-spacing{
+      type decimal64 {
+            fraction-digits 5;
+        }
+      units Meter;
+
+      description "Average distance between centers of nearby AE in vertical direction (in array coordinates system)";
+    }
+
+    container normal-vector-direction {
+      description
+        "Counter-clockwise rotation around z and y axis.";
+
+      leaf azimuth-angle{
+        type decimal64 {
+          fraction-digits 4;
+          }
+        units Degrees;
+
+        description "Azimuth angle, counter-clockwise rotation around z-axis. Value 'zero' points to broad-side, value '90' points to y-axis";
+      }
+       leaf zenith-angle{
+         type decimal64 {
+          fraction-digits 4;
+          }
+        units Degrees;
+
+        description "Zenith angle, counter-clockwise rotation around y-axis. Value 'zero' points to zenith, value '90' points to horizon";
+       }
+    }
+
+    container leftmost-bottom-array-element-position {
+      description "Structure describing position of leftmost, bottom array element.";
+      leaf x {
+        type decimal64 {
+          fraction-digits 4;
+          }
+        units Meter;
+
+        description "X dimension of position of leftmost, bottom array element";
+      }
+
+      leaf y {
+        type decimal64 {
+          fraction-digits 4;
+          }
+        units Meter;
+
+        description "Y dimension of position of leftmost, bottom array element";
+      }
+
+      leaf z {
+        type decimal64 {
+          fraction-digits 4;
+          }
+        units Meter;
+
+        description "Z dimension of position of leftmost, bottom array element";
+      }
+    }
+    list polarisations {
+      key "p";
+      min-elements 1;
+      max-elements 2;
+
+      description
+        "List of supported polarisations.";
+
+      leaf p {
+      type uint8;
+      mandatory true;
+      description
+        "Polarisation index. See CUS-plane";
+      }
+
+      leaf polarisation {
+        type polarisation_type;
+        mandatory true;
+        description "Type of polarisation supported by array.";
+      }
+    }
+    leaf band-number {
+      type leafref {
+        path "/mcap:module-capability/mcap:band-capabilities/mcap:band-number";
+      }
+      mandatory true;
+      description
+        "This parameter informing which frequency band particular antenna
+         array is serving for.
+         Intended use is to deal with multiband solutions.";
+    }
+  }
+
+  grouping array-choice {
+    choice antenna-type {
+      case tx {
+        leaf tx-array-name {
+          type leafref {
+            path "/o-ran-uplane-conf:user-plane-configuration/o-ran-uplane-conf:tx-arrays/o-ran-uplane-conf:name";
+          }
+
+          description
+            "Leafref to tx array if such is choosen";
+        }
+      }
+      case rx {
+        leaf rx-array-name {
+          type leafref {
+            path "/o-ran-uplane-conf:user-plane-configuration/o-ran-uplane-conf:rx-arrays/o-ran-uplane-conf:name";
+          }
+
+          description
+            "Leafref to rx array if such is choosen";
+        }
+      }
+      description
+        "Choice for antenna type";
+    }
+    description
+      "Elements which groups choice for antenna type";
+  }
+
+  grouping scs-config {
+    description
+      "It groups all parameters related to SCS configuration";
+
+    leaf frame-structure {
+      type uint8;
+
+      description
+        "This parameter defines the frame structure. The first 4 bits define the FFT/iFFT size
+        being used for all IQ data processing related to this message.
+        The second 4 bits define the sub carrier spacing as well as the number of slots per 1ms sub-frame
+        according to 3GPP TS 38.211, taking for completeness also 3GPP TS 36.211 into account";
+    }
+
+    leaf cp-type {
+      type enumeration {
+        enum NORMAL {
+          description
+            "Normal cyclic prefix";
+        }
+
+        enum EXTENDED {
+          description
+            "Extended cyclic prefix";
+        }
+      }
+
+      description
+        "Provides type of CP (cyclic prefix) if section type 3 is not used or type of CP cannot be determined from cpLength.";
+    }
+
+    leaf cp-length {
+      type uint16;
+      units Ts;
+      mandatory true;
+      description
+        "Used for symbol 0 for NR & LTE, and symbol 7*2u for NR.
+        See CUS-plane";
+    }
+
+    leaf cp-length-other {
+      type uint16;
+      units Ts;
+      mandatory true;
+      description
+        "Used for other symbols than by cp-length above";
+    }
+
+    leaf offset-to-absolute-frequency-center {
+      type int32;
+      mandatory true;
+      description
+        "This provides value of freqOffset to be used if section type 3 is not used. See freqOffset in CUS-plane.";
+    }
+
+    list number-of-prb-per-scs {
+      key scs;
+      description
+        "List of configured for each SCS that will be used.";
+
+      leaf scs {
+        type mcap:scs-config-type;
+        description
+          "Value corresponds to SCS values defined for frameStructure in C-plane.
+          Note: set of allowed values is restricted by SCS derived from values in supported-frame-structures.";
+      }
+
+      leaf number-of-prb {
+        type uint16;
+        mandatory true;
+        description
+          "Determines max number of PRBs that will be used in all sections per one symbol.
+          This is affecting allocation of resources to endpoint. Value shall not exceed constrains
+          defined by max-prb-per-symbol of endpoint type. In addition sum (over all used epoints
+          within a group of endpoints sharing resources) of number-of-prb rounded up to
+          nearest value from prb-capacity-allocation-granularity shall not exceed max-prb-per-symbol of the group.";
+      }
+    }
+  }
+
+  grouping common-array-carrier-elements {
+    description
+      "This grouping containes all common parameters for tx-array-carriers and rx-array-carriers";
+
+    leaf absolute-frequency-center {
+      type uint32;
+      mandatory true;
+      description
+        "Absolute Radio Frequency Channel Number - indirectly indicates RF center carrier frequency of signal.
+        Reflected in arfcn.";
+    }
+
+    leaf center-of-channel-bandwidth {
+      type uint64;
+          units Hz;
+      mandatory true;
+      description
+        "Center frequency of channel bandwidth in Hz. Common for all numerologies.";
+    }
+
+    leaf channel-bandwidth {
+      type uint64;
+      units Hz;
+      mandatory true;
+
+      description
+        "Width of carrier given in Hertz";
+    }
+
+    leaf active {
+      type enumeration {
+        enum INACTIVE {
+              description
+                "carrier does not provide signal - transmission is disabled";
+            }
+        enum SLEEP{
+              description
+                "carrier is fully configured and was active but is energy saving mode";
+            }
+        enum ACTIVE{
+              description
+                "carrier is fully configured and properly providing the signal";
+            }
+      }
+      default INACTIVE;
+
+      description
+        "Indicates if transmission is enabled for this array carriers. Note that Netconf server uses state parameter
+        to indicate actual state of array carriers operation. When array carriers is in sleep status,
+        Netconf server rejects all other operation request to tx-array-carriers object except either request to change from sleep
+        to active status or delete MO operation (see 4.8) to the object.";
+    }
+
+    leaf state {
+      type enumeration {
+        enum DISABLED {
+          description
+            "array carrier is not active - transmission of signal is disabled.";
+        }
+        enum BUSY {
+          description
+            "array carrier is processing an operation requested by change of active parameter.
+            When array carriers is BUSY the transmission of signal is not guaranteed.";
+        }
+        enum READY {
+          description
+            "array carrier had completed activation operation - is active and transmission of signal is ongoing.";
+        }
+      }
+      config false;
+      mandatory true;
+      description
+        "Indicates state of array carriers activation operation";
+    }
+
+    leaf type {
+      type enumeration {
+        enum NR {
+              description
+                "5G technology";
+            }
+        enum LTE {
+              description
+                "LTE technology";
+        }
+      }
+      config false;
+      mandatory true;
+      description
+        "Type of carrier. Indicates array-carrier technology.";
+    }
+    leaf duplex-scheme {
+      type enumeration {
+        enum TDD {
+              description
+                "TDD scheme";
+            }
+        enum FDD {
+              description
+                "FDD scheme";
+        }
+      }
+      config false;
+
+      description
+        "Type of duplex scheme O-RU supports.";
+
+    }
+  }
+
+  grouping endpoint-section-capacity {
+    leaf max-control-sections-per-data-section {
+      type uint8 {
+        range "1..12";
+      }
+      description
+        "Max number of C-plane sections (C-plane section is part of C-plane message that carries “section fields”)
+        referring to same U-plane section (U-plane section is part of U-plane message that carries
+        “section header fields” and “PRB fields”) that is supported by endpoint.
+        Note that additional limitations specific for each section type apply on top of this number.";
+    }
+    leaf max-sections-per-symbol {
+      type uint16;
+      description
+        "Max number of sections within one symbol that can be processed by endpoint
+        or processed collectively by group of endpoints sharing capacity";
+    }
+    leaf max-sections-per-slot {
+      type uint16;
+      description
+        "Max number of sections within one slot that can be processed by endpoint
+        or processed collectively by group of endpoints sharing capacity.";
+    }
+
+    description
+      "Parameters describing section capacity where section is undestood as number of different sectionId values";
+  }
+
+  grouping endpoint-beam-capacity {
+    leaf max-beams-per-symbol {
+      type uint16;
+      description
+        "Max number of beams within one symbol that can be processed by endpoint
+        or processed collectively by group of endpoints sharing capacity";
+    }
+    leaf max-beams-per-slot {
+      type uint16;
+      description
+        "Max number of beams within one slot that can be processed by endpoint
+        or processed collectively by group of endpoints sharing capacity";
+    }
+
+    description
+      "Parameters describing beam capacity where number of beams is understood as number of different beamId values";
+  }
+
+  grouping endpoint-prb-capacity {
+    leaf max-prb-per-symbol {
+      type uint16;
+      description
+        "Max number of prbs within one symbol that can be processed by endpoint
+        or processed collectively by group of endpoints sharing capacity";
+    }
+
+    description
+      "Attributes presenting processing capacity related to PRB.";
+  }
+
+  grouping endpoint-numerology-capacity {
+    leaf max-numerologies-per-symbol {
+      type uint16;
+      description
+        "Max number of numerologies within one symbol that can be processed by endpoint
+        or processed collectively by group of endpoints sharing capacity";
+    }
+
+    description
+      "Attributes presenting processing capacity related to numerology.";
+  }
+
+  grouping uplane-conf-group {
+    list low-level-tx-links {
+      key name;
+      description
+        "Object model for low-level-tx-link configuration";
+
+      leaf name {
+        type string;
+        description
+          "Unique name of low-level-tx-link object.";
+      }
+
+      leaf processing-element {
+        type leafref {
+          path "/o-ran-pe:processing-elements/o-ran-pe:ru-elements/o-ran-pe:name";
+        }
+        mandatory true;
+        description
+          "Contains name of processing-element to be used as transport by low-level-tx-link";
+      }
+
+      leaf tx-array-carrier {
+        type leafref {
+          path "/user-plane-configuration/tx-array-carriers/name";
+        }
+        mandatory true;
+        description
+          "Contains name of tx-array-carriers MO to be used as transport by low-level-tx-link";
+      }
+
+      leaf low-level-tx-endpoint {
+        type leafref {
+          path "/user-plane-configuration/low-level-tx-endpoints/name";
+        }
+        mandatory true;
+        description
+          "Contains name of low-level-tx-endpoints MO to be used as transport by low-level-tx-link";
+      }
+    }
+
+    list low-level-rx-links {
+      key name;
+      description
+        "Object model for low-level-rx-links configuration";
+
+      leaf name {
+        type string;
+
+        description
+          "Unique name of low-level-rx-links object.";
+      }
+
+      leaf processing-element {
+        type leafref {
+          path "/o-ran-pe:processing-elements/o-ran-pe:ru-elements/o-ran-pe:name";
+        }
+        mandatory true;
+        description
+          "Contains name of processing-element to be used as transport by LowLevelTxLink";
+      }
+
+      leaf rx-array-carrier {
+        type leafref {
+          path "/user-plane-configuration/rx-array-carriers/name";
+        }
+        mandatory true;
+
+        description
+          "Contains name of rx-array-carriers MO to be used as transport by low-level-rx-links";
+      }
+
+      leaf low-level-rx-endpoint {
+        type leafref {
+          path "/user-plane-configuration/low-level-rx-endpoints/name";
+        }
+        mandatory true;
+
+        description
+          "Contains name of low-level-rx-endpoints MO to be used as transport by low-level-rx-links";
+      }
+
+      leaf user-plane-uplink-marking {
+        type leafref {
+          path "/o-ran-pe:processing-elements/o-ran-pe:enhanced-uplane-mapping/o-ran-pe:uplane-mapping/o-ran-pe:up-marking-name";
+        }
+        description
+          "Parameter to set the non-default marking for user-plane";
+      }
+    }
+
+    list endpoint-types {
+      key "id";
+      config false;
+      description
+        "Properties of endpoint that are common to multiple endpoints if such are identified";
+
+      leaf id {
+        type uint16;
+        description
+          "Identifies type of endpoints sharing same properties. Values shall start with 0 and shall be allocated without gaps.";
+      }
+
+      list supported-section-types {
+        key "section-type";
+        description
+          "Indicates section types and extensions endpoints of this type support";
+
+        leaf section-type {
+          type uint8;
+
+          description
+            "This parameter determines the characteristics of U-plane data to be transferred or received from a beam with one pattern id.";
+        }
+
+        leaf-list supported-section-extensions {
+          type uint8;
+
+          description
+            "This parameter provides the extension types supported by the O-RU
+            which provides additional parameters specific to the subject data extension";
+        }
+      }
+
+      leaf-list supported-frame-structures {
+        type uint8;
+
+        description
+          "List of supported values of frame structure";
+      }
+
+      leaf managed-delay-support {
+        type enumeration {
+          enum MANAGED {
+            description
+              "Time managed delays are supported";
+          }
+
+          enum NON_MANAGED {
+            description
+              "Non time managed delays are not supported";
+          }
+
+          enum BOTH {
+            description
+              "Both time managed and non time managed delays are supported";
+          }
+        }
+
+        description
+          "Type of delay supported by the endpoint";
+      }
+
+      leaf max-numerology-change-duration {
+        type uint16 {
+          range "0..10000";
+        }
+
+        units Ts;
+        description
+          "Maximum gap of endpoint operation that will be caused by changing of numerology.
+          This time is required for reconfiguration and flushing of pipes.";
+      }
+
+      uses endpoint-section-capacity;
+      uses endpoint-beam-capacity;
+      uses endpoint-prb-capacity;
+
+      leaf-list prb-capacity-allocation-granularity {
+        type uint16;
+
+        description
+          "List of capacity allocation steps. O-RU allocates PRB capacity rounding it up to nearest value N
+          from prb-capacity-allocation-granularity such that M >= number-of-prb-per-scs.
+          See also number-of-prb-per-scs/number-of-prb.";
+      }
+
+      uses endpoint-numerology-capacity;
+    }
+
+    list endpoint-capacity-sharing-groups {
+      key "id";
+      config false;
+      description
+        "Represents groups of endpoints that share capacity. Depending on O-RU implementation,
+        processing resources that handle CU-plane (e.g. memory to keep sections and beams)
+        could be allocated per endpoint or shared between several endpoints.
+        To address this O-RU shall reports own capability per endpoint (see endpoint-types)
+        and per group of endpoints sharing capacity.
+        If endpoint is in multiple groups then resulting constraint is minimum over all groups.
+        Note: values of parameters representing capacity that is not shared between endpoints in a group shall be set to max value of specific parameter; this effectively removes related constraint.
+";
+
+      leaf id {
+        type uint16;
+        description
+          "Identifies group of endpoints sharing resources.
+          Values shall start with 0 and shall be allocated without gaps.";
+      }
+      uses endpoint-section-capacity;
+      uses endpoint-beam-capacity;
+      uses endpoint-prb-capacity;
+      uses endpoint-numerology-capacity;
+
+      leaf max-endpoints {
+        type uint16;
+        description
+          "Indicates how many endpoints in the group can be used4 simultaneously";
+      }
+      leaf max-managed-delay-endpoints {
+        type uint16;
+        description
+          "Number of endpoints supporting managed delay that can be used (configured for use) at a time";
+      }
+      leaf max-non-managed-delay-endpoints {
+        type uint16;
+        description
+          "Number of endpoints supporting non-managed delay that can be used (configured for use) at a time";
+      }
+    }
+
+    list static-low-level-tx-endpoints {
+      key name;
+      config false;
+      description
+        "Object model for static-low-level-tx-endpoints configuration";
+
+      leaf name {
+        type string;
+
+        description
+          "Unique name of static-low-level-tx-endpoints object.";
+      }
+
+      leaf-list restricted-interfaces {
+        type leafref {
+          path "/if:interfaces/if:interface/if:name";
+        }
+        description
+          "Optionally used to indicate that a low-level link is constrained to operate only via a subset of the available interfaces.";
+      }
+
+      leaf array {
+        type leafref {
+          path "/user-plane-configuration/tx-arrays/name";
+        }
+        mandatory true;
+        description
+          "Contains distname of tx-arrays, particular low-level-tx-endpoints is in hardware dependency with.
+          Note: single instance of tx-arrays can be referenced by many instances of low-level-tx-endpoints
+          (e.g. to allow DU to handle multiple fronthauls and multiple component carriers).";
+      }
+
+      leaf endpoint-type {
+        type leafref {
+          path "../../endpoint-types/id";
+        }
+
+        description
+          "Reference to endpoint type capabilities list element supported by this endpoint";
+      }
+
+      leaf-list capacity-sharing-groups {
+        type leafref {
+          path "../../endpoint-capacity-sharing-groups/id";
+        }
+
+        description
+          "Reference to capacities of sharing-groups supported by this endpoint";
+      }
+    }
+
+    list static-low-level-rx-endpoints {
+      key name;
+      config false;
+      description
+        "Object model for static-low-level-rx-endpoints configuration";
+
+      leaf name {
+        type string;
+
+        description
+          "Unique name of static-low-level-rx-endpoints object.";
+      }
+
+      leaf-list restricted-interfaces {
+        type leafref {
+          path "/if:interfaces/if:interface/if:name";
+        }
+        description
+          "Optionally used to indicate that a low-level link is constrained to operate only via a subset of the available interfaces.";
+      }
+
+      leaf array {
+        type leafref {
+          path "/user-plane-configuration/rx-arrays/name";
+        }
+        mandatory true;
+        description
+          "Contains distname of rx-arrays, particular low-level-rx-endpoints is in hardware dependency with.
+          Note: single instance of rx-arrays can be referenced by many instances of low-level-rx-endpoints
+          (e.g. to allow DU to handle multiple fronthauls and multiple component carriers).";
+      }
+
+      leaf endpoint-type {
+        type leafref {
+          path "../../endpoint-types/id";
+        }
+
+        description
+          "Reference to endpoint type capabilities list element supported by this endpoint";
+      }
+
+      leaf-list capacity-sharing-groups {
+        type leafref {
+          path "../../endpoint-capacity-sharing-groups/id";
+        }
+
+        description
+          "Reference to capacities of sharing-groups supported by this endpoint";
+      }
+    }
+
+    list low-level-tx-endpoints {
+      key "name";
+
+      description
+        "Object model for low-level-tx-endpoints configuration - augmented static-low-level-tx-endpoints by local-address
+        which cannot be added to static low-level-tx-endpoints as we cannot have modificable element in static object";
+
+      leaf name {
+        type leafref {
+          path "/user-plane-configuration/static-low-level-tx-endpoints/name";
+          require-instance false;
+        }
+        mandatory true;
+
+        description
+          "Unique name of low-level-tx-endpoint object. Reference to static object";
+      }
+
+      container compression {
+        presence
+          "This container shall exists to avoid missaligned compression
+          methods between devices";
+
+        description
+          "Container which consists of global configurable parameters for compression";
+
+        uses cf:compression-details;
+      }
+
+      uses scs-config;
+
+      container e-axcid {
+        uses eaxc;
+
+        description
+          "Contains local address of low level TX endpoint offered by Netconf server.";
+      }
+
+
+
+    }
+
+    list low-level-rx-endpoints {
+      key name;
+
+      description
+        "Object model for low-level-rx-endpoint configuration - augmented static-low-level-rx-endpoints by local-address
+        which cannot be added to static low-level-rx-endpoints as we cannot have modificable element in static object";
+
+      leaf name {
+        type leafref {
+          path "/user-plane-configuration/static-low-level-rx-endpoints/name";
+          require-instance false;
+        }
+        mandatory true;
+
+        description
+          "Unique name of low-level-rx-endpoint object. Reference to static object";
+      }
+
+      container compression {
+        description
+          "Container which consists of global configurable parameters for compression";
+
+        uses cf:compression-details;
+      }
+
+      uses scs-config;
+
+      list ul-fft-sampling-offsets {
+        key scs;
+        description
+          "List of FFT sampling offsets configured for each SCS that will be used.
+          Client shall configure one element for each SCS that will be used.";
+
+        leaf scs {
+          type mcap:scs-config-type;
+          description
+            "Value corresponds to SCS values defined for frameStructure in C-plane
+            Note: set of allowed values is restricted by SCS derived from values in supported-frame-structures.";
+        }
+
+        leaf ul-fft-sampling-offset {
+          type uint16;
+
+          units Ts;
+          description
+            "Determines time advance of capture window for FFT.
+            Value represents time advance of capture window start in relation to the end of CP. Unit is Ts.
+            Note: value of this parameter is usually set to '0' (zero) for PRACH channels.
+            Any phase offset resulting from the non-zero value of this parameter is handled in O-DU.";
+        }
+      }
+
+      container e-axcid {
+        uses eaxc;
+
+        description
+          "Contains local address of low level RX endpoint offered by Netconf server.";
+      }
+
+      leaf non-time-managed-delay-enabled {
+        type boolean;
+        default false;
+        description
+          "Tells if non time managed delay shall be enabled";
+      }
+    }
+
+    list tx-array-carriers {
+      key name;
+      description
+        "Object model for tx-array-carriers configuration";
+
+      leaf name {
+        type string;
+
+        description
+          "Unique name of tx-array-carriers object.";
+      }
+
+      uses common-array-carrier-elements;
+
+      leaf band-number {
+        if-feature mcap:LAA;
+        type leafref {
+          path "/mcap:module-capability/mcap:band-capabilities/mcap:band-number";
+          require-instance false;
+        }
+        description
+          "This parameter informing which frequency band particular antenna
+           array is serving for.
+           Intended use is to deal with multiband solutions.";
+      }
+
+      container lte-tdd-frame {
+        when "(/user-plane-configuration/rx-array-carriers/type = 'LTE') and  (/user-plane-configuration/rx-array-carriers/duplex-scheme = 'TDD')";
+        description
+          "Container which consists of global configurable parameters for tdd Frame";
+
+        leaf subframe-assignment {
+          type enumeration {
+            enum SAO {
+              description "subframe assignment configuration 0";
+            }
+            enum SA1 {
+              description "subframe assignment configuration 1";
+            }
+            enum SA2 {
+              description "subframe assignment configuration 2";
+            }
+            enum SA3 {
+              description "subframe assignment configuration 3";
+            }
+            enum SA4 {
+              description "subframe assignment configuration 4";
+            }
+            enum SA5 {
+              description "subframe assignment configuration 5";
+            }
+              enum SA6 {
+                description "subframe assignment configuration 6";
+            }
+          }
+          mandatory true;
+          description
+            "Indicates DL/UL subframe configuration as specified in
+            3GPP TS 36.211 [v15.3.0, table 4.2-2]";
+        }
+        leaf special-subframe-pattern {
+          type enumeration {
+            enum SPP0 {
+              description "special subframe pattern configuration 0";
+            }
+            enum SPP1 {
+              description "special subframe pattern configuration 1";
+            }
+            enum SPP2 {
+              description "special subframe pattern configuration 2";
+            }
+            enum SPP3 {
+              description "special subframe pattern configuration 3";
+            }
+            enum SPP4 {
+              description "special subframe pattern configuration 4";
+            }
+            enum SPP5 {
+              description "special subframe pattern configuration 5";
+            }
+            enum SPP6 {
+              description "special subframe pattern configuration 6";
+            }
+            enum SPP7 {
+              description "special subframe pattern configuration 7";
+            }
+            enum SPP8 {
+              description "special subframe pattern configuration 8";
+            }
+            enum SPP9 {
+              description "special subframe pattern configuration 9";
+            }
+            enum SPP10 {
+              description "special subframe pattern configuration 10";
+            }
+          }
+          mandatory true;
+          description
+            "Indicates TDD special subframe configuration as in TS 36.211
+             [v15.3.0, table 4.2-1] ";
+        }
+      }
+
+      container laa-carrier-configuration {
+        when "./../band-number = 46";
+        if-feature mcap:LAA;
+        description "Container to specify LAA feature related carrier configuration.";
+        uses laa-carrier-config;
+      }
+
+      leaf gain {
+        type decimal64 {
+          fraction-digits 4;
+        }
+        units dB;
+        mandatory true;
+
+        description
+          "Transmission gain in dB. Value applicable to each array element carrier belonging to array carrier.";
+      }
+
+      leaf downlink-radio-frame-offset {
+        type uint32 {
+          range 0..12288000;
+        }
+        mandatory true;
+
+        description
+          "This parameter is used for offsetting the starting position of 10ms radio frame.
+          Note: The value should have same value within DU to all tx-array-carrierss that have same frequency and bandwidth.
+          Note2: Unit is 1/1.2288e9 Hz and accuracy is 1/4 Tc. Then, its range is calculated 0..12288000.";
+      }
+
+      leaf downlink-sfn-offset {
+        type int16 {
+          range -32768..32767;
+        }
+        mandatory true;
+
+        description
+          "This parameter is used for offsetting SFN value.
+          Unit is in 10ms.
+          Note: The value should have same value within DU to all tx-array-carrierss that have same frequency and bandwidth.";
+      }
+    }
+
+    list rx-array-carriers {
+      key name;
+      description
+        "Object model for rx-array-carriers configuration";
+
+          leaf name {
+            type string;
+            description
+            "Unique name of rx-array-carriers object.";
+      }
+
+      uses common-array-carrier-elements;
+
+      leaf downlink-radio-frame-offset {
+        type uint32 {
+          range 0..12288000;
+        }
+        mandatory true;
+
+        description
+          "This parameter is used for offsetting the starting position of 10ms radio frame.
+          Note: The value should have same value within DU to all tx-array-carrierss that have same frequency and bandwidth.
+          Note2: Unit is 1/1.2288e9 Hz and accuracy is 1/4 Tc. Then, its range is calculated 0..12288000.";
+      }
+
+      leaf downlink-sfn-offset {
+        type int16 {
+          range -32768..32767;
+        }
+        mandatory true;
+
+        description
+          "This parameter is used for offsetting SFN value.
+          Unit is in 10ms.
+          Note: The value should have same value within DU to all tx-array-carrierss that have same frequency and bandwidth.";
+      }
+
+      leaf gain-correction {
+        type decimal64 {
+          fraction-digits 4;
+
+        }
+        units dB;
+        mandatory true;
+        description
+          "Gain correction of RF path linked with array element or array layers";
+      }
+
+      leaf n-ta-offset {
+        type uint32;
+        units Tc;
+        mandatory true;
+        description
+          "Value of configurable N-TA offset
+          units are Tc=~0.5ns=1/1.96608GHz";
+      }
+    }
+
+    list tx-arrays {
+      key "name";
+      config false;
+      description
+        "Structure describing TX array parameters";
+
+      uses parameters;
+
+      leaf max-gain {
+        type decimal64 {
+          fraction-digits 4;
+
+        }
+        units dB;
+        mandatory true;
+        description
+          "Max gain of RF path linked with array element (minimum over elements of array) or array layers";
+      }
+
+      leaf independent-power-budget {
+        type boolean;
+        mandatory true;
+        description
+          "If true then every element of array has own, power budget independent from power budget of other elements.
+          Else all elements of array that are at same row and column and have same polarization share power budget";
+      }
+    }
+
+    list rx-arrays {
+      key "name";
+      config false;
+      description "Structure describing RX array parameters";
+
+      uses parameters;
+      container gain-correction-range {
+           leaf max {
+          type decimal64 {
+            fraction-digits 4;
+          }
+          units dB;
+          mandatory true;
+          description "Array gain correction factor - maximum allowed value";
+               }
+               leaf min {
+          type decimal64 {
+            fraction-digits 4;
+          }
+          units dB;
+          mandatory true;
+          description "Array gain correction factor - minimum allowed value";
+               }
+
+        description
+          "Array gain correction factor";
+      }
+    }
+
+    list relations {
+      key "entity";
+      config false;
+      description "Structure describing relations between array elements";
+
+      leaf entity {
+        type uint16;
+
+        description
+          "Relation entity. Used as a key for list of relations.";
+      }
+
+      container array1 {
+        uses array-choice;
+
+        description
+          "Defnes name for first array";
+      }
+      container array2 {
+        uses array-choice;
+
+        description
+          "Defnes name for second array";
+      }
+      list types {
+        key "relation-type";
+        description
+          "Defines relation type and pairs for array elements for given arrays";
+
+        leaf relation-type {
+          type enumeration {
+            enum SHARED {
+              description "SHARED";
+            }
+            enum COALOCATED {
+              description "COALOCATED";
+            }
+          }
+          description "Type of relation between array elements";
+        }
+        list pairs {
+          key "element-array1";
+          description
+            "defines related array elements";
+
+          leaf element-array1 {
+            type uint16;
+
+               description
+                 "Tells about id of element from array1";
+          }
+          leaf element-array2 {
+            type uint16;
+
+               description
+                 "Tells about id of element from array2";
+          }
+        }
+      }
+    }
+  }
+
+  grouping tx-array-notification-group {
+    list tx-array-carriers{
+      key name;
+      description "notification of state change for tx-array-carriers";
+
+      leaf name{
+        type leafref{
+          path "/user-plane-configuration/tx-array-carriers/name";
+        }
+        description
+          "name of tx-array-carriers is notified at state change";
+      }
+      leaf state{
+        type leafref{
+          path "/user-plane-configuration/tx-array-carriers/state";
+        }
+      description
+        "state of tx-array-carriers is notified at state change";
+      }
+    }
+  }
+
+  grouping rx-array-notification-group {
+    list rx-array-carriers{
+      key name;
+      description
+        "Notification used to inform about state change of rx-array-carriers";
+      leaf name{
+        type leafref{
+          path "/user-plane-configuration/rx-array-carriers/name";
+        }
+        description
+          "name of rx-array-carriers is notified at state change";
+      }
+      leaf state{
+        type leafref{
+          path "/user-plane-configuration/rx-array-carriers/state";
+        }
+        description
+          "state of rx-array-carriers is notified at state change";
+      }
+    }
+  }
+
+// top level container
+
+  container user-plane-configuration {
+    description "top level container for user plane configuration";
+
+    uses uplane-conf-group;
+
+  }
+
+  //notification statement
+  notification tx-array-carriers-state-change {
+    description
+      "Notification used to inform about state change of tx-array-carriers";
+    uses tx-array-notification-group;
+  }
+  notification rx-array-carriers-state-change {
+    description
+    "Notification used to inform about state change of tx-array-carriers";
+
+    uses rx-array-notification-group;
+  }
+}
diff --git a/ntsimulator/yang/o-ran-usermgmt.yang b/ntsimulator/yang/o-ran-usermgmt.yang
new file mode 100644 (file)
index 0000000..7da3b96
--- /dev/null
@@ -0,0 +1,188 @@
+module o-ran-usermgmt {
+  yang-version 1.1;
+  namespace "urn:o-ran:user-mgmt:1.0";
+  prefix "o-ran-usermgmt";
+
+  import ietf-netconf-acm {
+    prefix nacm;
+    reference
+      "RFC 8341: Network Configuration Access Control Model";
+  }
+
+  organization "O-RAN Alliance";
+
+  contact
+    "www.o-ran.org";
+
+  description
+    "This module defines the user management model for the O-RAN Equipment.
+
+    Copyright 2019 the O-RAN Alliance.
+
+    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS '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 SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 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.
+
+    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 above disclaimer.
+    * Redistributions in binary form must reproduce the above copyright notice,
+    this list of conditions and the above disclaimer in the documentation
+    and/or other materials provided with the distribution.
+    * Neither the Members of the O-RAN Alliance nor the names of its
+    contributors may be used to endorse or promote products derived from
+    this software without specific prior written permission.";
+
+  revision "2019-04-25" {
+    description
+      "version 1.0.1
+
+      1) change name leaf to type nacm:user-name-type
+      2) added account-type to qualify when password is required ";
+
+    reference "ORAN-WG4.M.0-v01.00";
+  }
+
+  revision "2019-02-04" {
+    description
+      "version 1.0.0
+
+      1) imported model from xRAN
+      2) changed namespace and reference from xran to o-ran";
+
+    reference "ORAN-WG4.M.0-v01.00";
+  }
+
+  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-list {
+    list user {
+      key "name";
+      description
+        "The list of local users configured on this device.";
+      leaf name {
+        type nacm:user-name-type;
+        description
+          "The user name string identifying this entry.
+
+          NOTE: o-ran-usermgmt:user-profile/user/name is
+          identical to nacm:nacm/groups/group/user-name
+          but the current schema is preserved for backwards
+          compatibility.";
+      }
+      leaf account-type {
+        type enumeration {
+          enum PASSWORD {
+            description "the user-name is for password based authentication";
+          }
+          enum CERTIFICATE {
+            description "the user-name is for certificate based authentciation";
+          }
+        }
+        default "PASSWORD";
+      }
+
+      leaf password {
+        nacm:default-deny-all;
+        type password-type;
+        description
+          "The password for this entry.
+
+          This field is only valid when account-type is NOT set to CERTIFICATE,
+          i.e., when account-type is NOT present or present and set to
+          PASSWORD.";
+      }
+      leaf enabled {
+        type boolean;
+        description
+          "Indicates whether an account is enabled or disabled.";
+      }
+    }
+  }
+
+  container users {
+    must "user/enabled='true'" {
+      error-message "At least one account needs to be enabled.";
+    }
+    //TAKE NOTE - any configuration with zero enabled users is invalid.
+    //This will typically be the case when using a simulated NETCONF Server
+    //and so this constraint should be removed when operating in those scenarios
+
+    //The config data base of the O-RAN equipment should ensure that the user
+    //default account is enabled on factory restart
+
+    description "list of user accounts";
+    uses user-list;
+  }
+
+  rpc chg-password {
+    nacm:default-deny-all;
+    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/ntsimulator/yang/sysrepo-configuration-load.sh b/ntsimulator/yang/sysrepo-configuration-load.sh
new file mode 100755 (executable)
index 0000000..bf8f93b
--- /dev/null
@@ -0,0 +1,41 @@
+#!/bin/bash
+
+sleep 5
+
+echo "Loading data into sysrepo..."
+
+SSH_PUB_KEY="$(cat /home/netconf/.ssh/id_dsa.pub| awk '{print $2}')"
+
+echo '<system xmlns="urn:ietf:params:xml:ns:yang:ietf-system"><authentication><user><name>netconf</name><authorized-key><name>ssh_key</name><algorithm>ssh-dss</algorithm>' >> load_auth_pubkey.xml
+echo '<key-data>'"$SSH_PUB_KEY"'</key-data></authorized-key></user></authentication></system>' >> load_auth_pubkey.xml
+
+sysrepocfg --merge=load_auth_pubkey.xml --format=xml ietf-system
+rm load_auth_pubkey.xml
+
+ssh-keyscan -p 830 localhost >> ~/.ssh/known_hosts
+
+pyang -f sample-xml-skeleton --sample-xml-list-entries 3 *.yang
+
+result=$(netopeer2-cli <<-END
+       auth pref publickey 1000
+       auth keys add /home/netconf/.ssh/id_dsa.pub /home/netconf/.ssh/id_dsa
+       connect --login netconf
+       user-rpc --content=/opt/dev/yang/edit_config_operation.xml
+       disconnect
+END
+)
+
+while [[ "$result" != "OK" ]]
+do
+  pyang -f sample-xml-skeleton --sample-xml-list-entries 2 *.yang
+  
+  result=$(netopeer2-cli <<-END
+       connect --login netconf
+       user-rpc --content=edit_config_operation.xml
+       disconnect
+END
+)
+done
+echo "Finished loading data into sysrepo..."
+
+exit 0
\ No newline at end of file