Add simulator improvements.
[sim/o1-interface.git] / ntsimulator / yang / nts-manager / network-topology-simulator.yang
index 766a3ef..203c931 100644 (file)
@@ -16,6 +16,12 @@ module network-topology-simulator {
   description
     "This module contains a collection of YANG definitions for managing the Network Topology Simulator.";
 
+revision 2020-05-14 {
+    description
+      "New RPC for generic NETCONF notification generation.";
+    reference
+      "O-RAN SC SIM project";
+  }
   revision 2020-04-22 {
     description
       "Add configuration for number of SSH and TLS connections exposed by each simulated device.";
@@ -119,6 +125,11 @@ module network-topology-simulator {
       description
         "The Port of the SDN Controller.";
     }
+    leaf netconf-call-home-port {
+      type inet:port-number;
+      description
+        "The NETCONF Call Home Port of the SDN Controller.";      
+    }
     leaf controller-username {
       type string;
       description
@@ -194,10 +205,7 @@ module network-topology-simulator {
   }
 
   container simulator-config {
-    must "./ssh-connections + ./tls-connections <= 100" {
-      error-message "The total number of connections (SSH + TLS) needs to be less than or equal with 100.";
-    }
-    // presence "Enables NTS configuration.";
+    presence "Enables NTS configuration.";
     description
       "Configuration container of the simulator.";
     leaf simulated-devices {
@@ -215,25 +223,18 @@ module network-topology-simulator {
       description
         "The number of devices to be mounted in ODL. The configured number should not exceed the number of mounted devices.";
     }
-    leaf ssh-connections {
-      when "../simulated-devices = 0";
-      type uint32;
-      default "1";
-      description
-        "The number of SSH connections to be exposed by each simulated device.";
-    }
-    leaf tls-connections {
-    when "../simulated-devices = 0";
-      type uint32;
-      default "0";
-      description
-        "The number of TLS connections to be exposed by each simulated device.";
+    leaf netconf-call-home {
+        type boolean;
+        default "false";
+        description
+          "Configuration of NETCONF Call Home feature. If set to 'true', the device will use the SDN controller details and try to connect to it via Call Home.";
     }
     container notification-config {
       leaf-list fault-notification-delay-period {
         type uint32;
         min-elements 1;
         max-elements 99;
+        ordered-by user;
         description
           "Defines a pattern of generating notifications, represented by the amount of time between two generated fault notifications. The pattern is circular, it restarts at the beginning after all the leaf-list items are being used.
           E.g.: if the leaf-list contains three items: 4, 8 and 10, then a fault-notification will be generated, then after 4 seconds a new notification will be generaed, then after 8 seconds, then after 10 seconds, then again after 4 seconds etc.";
@@ -326,6 +327,16 @@ module network-topology-simulator {
         description
           "The current number of running simulated devices that are mounted in ODL.";
       }
+      leaf ssh-connections {
+        type uint32;
+        description
+          "The number of SSH connections that are exposed by each simulated device. This can be set through the ENV variable SshConnections when starting the NTS Manager.";
+      }
+      leaf tls-connections {
+        type uint32;
+        description
+          "The number of TLS connections that are exposed by each simulated device. This can be set through the ENV variable TlsConnections when starting the NTS Manager.";
+      }
       leaf base-netconf-port {
         type uint32;
         default "30000";
@@ -392,6 +403,29 @@ module network-topology-simulator {
       "State data container of the simulator.";
   }
 
+  grouping notification-job-g {
+      leaf device-id {
+        type string;
+        mandatory true;
+        description
+          "Device to invoke the NETCONF notification. If it is not present, all simulated devices would invoke the notification.";
+      }
+      leaf yang-module-name {
+        type string;
+        mandatory true;
+        description
+          "Name of the YANG module containing the notification to be invoked.";
+      }
+      leaf notification-object {
+          type string;
+          mandatory true;
+          description
+            "A JSON string containing the notification object to be sent by the device.";
+      }
+      description
+        "Notification job object class.";
+  }
+
   rpc restart-simulation {
     description
       "Operation to restart all the simulated devices with the new configuration of the simulator.";
@@ -401,4 +435,29 @@ module network-topology-simulator {
     description
       "Operation to add a key pair signed by the NTS to OpenDaylight, such that it can connect to devices using TLS.";
   }
+
+  rpc invoke-notification {
+    description
+      "Operation to generate a NETCONF notification from a device.";
+    input {
+      uses notification-job-g;
+    }
+    output {
+      leaf status {
+          type enumeration {
+            enum SUCCESS {
+            description
+                "This means that the RPC was successfully invoked.";
+            }
+            enum ERROR {
+            description
+                "This means that an error was encountered when invoking the notification.";
+            }
+          }
+        mandatory true;
+        description
+          "The status of the RPC.";
+      }
+    }
+  }
 }