TSC-181: ITM Yang Models Cleanup
[genius.git] / itm / itm-api / src / main / yang / itm-state.yang
index 153ce4bdeed68e842a490eeb9c266743c3452811..a924b742a3438bb23b5867cc34c0196dabea1879 100644 (file)
@@ -19,7 +19,7 @@ module itm-state {
       import odl-interface {
           prefix odlif; revision-date "2016-04-06";
       }
-    
+
 
       description "This YANG module defines operation part of the model.";
 
@@ -28,196 +28,285 @@ module itm-state {
         /* Operational state */
 
       identity tep-type-base {
-              description "Base TEP device type";
-          }
+          description "Base TEP device type";
+      }
 
-          identity tep-type-internal {
-              base tep-type-base;
-              description "TEP type internal e.g. Compute OVS";
-          }
+      identity tep-type-internal {
+          base tep-type-base;
+          description "TEP type internal e.g. Compute OVS";
+      }
 
-          identity tep-type-external {
-              base tep-type-base;
-              description "TEP type external e.g. DC Gateway";
-          }
+      identity tep-type-external {
+          base tep-type-base;
+          description "TEP type external e.g. DC Gateway";
+      }
 
-          identity tep-type-hwvtep {
+      identity tep-type-hwvtep {
+          base tep-type-base;
+          description "TEP type Hwvtep e.g. TOR devices";
+      }
+
+      typedef tep-type {
+          type identityref {
               base tep-type-base;
-              description "TEP type Hwvtep e.g. TOR devices";
           }
+          description "This type is used to refer to an TEP Device Type.";
+      }
 
-          typedef tep-type {
+      grouping tep-info-attributes {
+          leaf tep-device-type {
               type identityref {
                   base tep-type-base;
               }
-              description "This type is used to refer to an TEP Device Type.";
           }
+          leaf tep-device-id {
+              type string; //dpnid or node-id
+          }
+          leaf tep-ip {
+              type inet:ip-address; //dpnid or node-id
+          }
+      }
 
-            container dpn-endpoints {
-
-              list DPN-TEPs-info {
+      typedef tunnel-oper-status {
+          type enumeration {
+               enum up;
+               enum down;
+               enum unknown;
+               enum ignore;
+           }
+      }
 
-                key "DPN-ID";
+      container dpn-endpoints {
+          list DPN-TEPs-info {
+          key "DPN-ID";
 
-                leaf DPN-ID {
-                         type uint64;
-                }
-                leaf up {
-                   type boolean;
-                   config false;
-                }
+          leaf DPN-ID {
+              type uint64;
+          }
 
-                /* Minimum 1 port. We may for now support only two ports */
-                list tunnel-end-points {
-                      ordered-by user;
-                     key "portname VLAN-ID ip-address tunnel-type"; /* Multiple tunnels on the same physical port but on different VLAN can be supported */
-
-                       leaf portname {
-                           type string;
-                           }
-                       leaf VLAN-ID {
-                           type uint16;
-                           }
-                       leaf ip-address {
-                           type inet:ip-address;
-                       }
-                       leaf subnet-mask {
-                           type inet:ip-prefix;
-                       }
-                       leaf gw-ip-address {
-                                type inet:ip-address;
-                       }
-                       leaf transport-zone {
-                                type string;
-                       }
-                       leaf interface-name {
-                                type string;
-                       }
-                       leaf tunnel-type {
-                            type identityref {
-                                base odlif:tunnel-type-base;
-                            }
-                       }
-                       leaf option-of-tunnel {
-                           description "Use flow based tunnels for remote-ip";
-                           type boolean;
-                           default false;
-                       }
-                 }
+          leaf dst-id {
+              description "Identifier to get to a this DPN, which will be used in programming Egress flows ";
+              type int32 {
+                  range "1..2147483647";
+              }
+          }
 
-               }
-            }
+          leaf up {
+              status deprecated;
+              type boolean;
+              config false;
+          }
 
+          /* Minimum 1 port. We may for now support only two ports */
+          list tunnel-end-points {
+              ordered-by user;
+              key "ip-address tunnel-type"; /* Multiple tunnels on the same physical port but on different VLAN can be supported */
 
-            container tunnel-list {
-                   list internal-tunnel {
+              leaf ip-address {
+                  type inet:ip-address;
+              }
+              list tz-membership {
+                  key "zone-name";
+                  leaf zone-name {
+                      type string;
+                  }
+              }
+              leaf interface-name {
+                  type string;
+              }
+              leaf tunnel-type {
+                  type identityref {
+                      base odlif:tunnel-type-base;
+                  }
+              }
+              leaf option-of-tunnel {
+                  description "Use flow based tunnels for remote-ip";
+                  type boolean;
+                  default false;
+              }
+              leaf option-tunnel-tos {
+                  description "Value of ToS bits to be set on the encapsulating
+                      packet. The value of 'inherit' will copy the DSCP value
+                      from inner IPv4 or IPv6 packets.  When ToS is given as
+                      a numberic value, the least significant two bits will
+                      be ignored.";
+                  type string {
+                      length "1..8";
+                  }
+              }
+          }
+       }
+    }
 
-                     key  "source-DPN destination-DPN transport-type";
 
-                     leaf source-DPN {
-                         type uint64;
-                     }
+    container tunnel-list {
+        list internal-tunnel {
 
-                     leaf destination-DPN {
-                         type uint64;
-                     }
+            key  "source-DPN destination-DPN transport-type";
 
-                     leaf transport-type {
-                          type identityref {
-                              base odlif:tunnel-type-base;
-                          }
-                     }
+            leaf source-DPN {
+                type uint64;
+            }
 
-                     /* logical-group interface id */
+            leaf destination-DPN {
+                type uint64;
+            }
 
-                     leaf tunnel-interface-name {
-                          type string;
-                     }
-                   }
+            leaf transport-type {
+                type identityref {
+                    base odlif:tunnel-type-base;
                 }
+            }
 
-            container external-tunnel-list {
-                   list external-tunnel {
+            /* logical-group interface id */
 
-                     key  "source-device destination-device transport-type";
+            leaf-list tunnel-interface-names {
+                type string;
+            }
+        }
+    }
 
-                     leaf source-device {
-                         type string; //dpnid or node-id
-                     }
+    container external-tunnel-list {
+        list external-tunnel {
+            key  "source-device destination-device transport-type";
 
-                     leaf destination-device {
-                         type string; //dpn-id or node-id or ip
-                     }
+            leaf source-device {
+                type string; //dpnid or node-id
+            }
 
-                     leaf transport-type {
-                          type identityref {
-                              base odlif:tunnel-type-base;
-                          }
-                     }
+            leaf destination-device {
+                type string; //dpn-id or node-id or ip
+            }
 
-                     /* logical-group interface id */
+            leaf transport-type {
+                 type identityref {
+                     base odlif:tunnel-type-base;
+                 }
+            }
 
-                     leaf tunnel-interface-name {
-                          type string;
-                     }
+            /* logical-group interface id */
 
-                   }
-                }
-
-              grouping tep-info-attributes {
-                  leaf tep-device-type {
-                      type identityref {
-                          base tep-type-base;
-                      }
-                  }
-                  leaf tep-device-id {
-                      type string; //dpnid or node-id
-                  }
-                  leaf tep-ip {
-                      type inet:ip-address; //dpnid or node-id
-                  }
-              }
+            leaf tunnel-interface-name {
+                 type string;
+            }
 
-        typedef tunnel-oper-status {
-            type enumeration {
-                 enum up;
-                 enum down;
-                 enum unknown;
-                 enum ignore;
-             }
         }
+    }
 
-      container tunnels_state {
+    container tunnels_state {
+        config false;
         list state-tunnel-list {
             key  "tunnel-interface-name";
 
-                  leaf tunnel-interface-name {
-                      type string;
-                  }
+            leaf tunnel-interface-name {
+                type string;
+            }
+
             leaf tunnel-state {
-                                  type boolean;
-                                  config false;
-                                  status deprecated;
-                              }
+                type boolean;
+                config false;
+                status deprecated;
+            }
+
             leaf oper-state { type tunnel-oper-status; }
+
             container src-info {
                 uses tep-info-attributes;
             }
 
-                  container dst-info {
-                      uses tep-info-attributes;
-                  }
+            container dst-info {
+                uses tep-info-attributes;
+            }
 
-                  leaf transport-type {
-                      type identityref {
-                          base odlif:tunnel-type-base;
-                      }
-                  }
+            leaf transport-type {
+                type identityref {
+                    base odlif:tunnel-type-base;
+                }
+            }
 
-              }
+            leaf port-number {
+                type string;
             }
 
-            notification itm-tunnel-build-complete{
+            leaf if-index {
+                type uint16;
+            }
+        }
+    }
+
+    container dpn-teps-state {
+        list dpns-teps {
+            key "source-dpn-id";
+            leaf source-dpn-id {
+                type uint64;
+                mandatory true;
             }
 
-      }
+            leaf ip-address {
+                type inet:ip-address;
+            }
+
+            leaf tunnel-type {
+                type identityref {
+                    base odlif:tunnel-type-base;
+                }
+                mandatory true;
+            }
+
+            leaf of-tunnel {
+                description "Specifies OFTunnel port name when OFTunnel is enabled on ITM Direct Tunnels";
+                type string;
+            }
+
+            /* Remote DPNs to which this DPN-Tep has a tunnel */
+            list remote-dpns {
+                key "destination-dpn-id";
+                leaf destination-dpn-id {
+                    type uint64;
+                    mandatory true;
+                }
+
+                leaf tunnel-name {
+                    type string;
+                    mandatory true;
+                }
+
+                /* This will later be changed to monitor profile id */
+                /* The monitor profile will contain monitoring related params */
+                leaf monitoring-enabled {
+                    type boolean;
+                }
+
+                leaf monitoring-interval {
+                    type uint16 {
+                        range "1000..30000";
+                    }
+                }
+
+                leaf internal {
+                    type boolean;
+                    mandatory true;
+                    description "represents whether this is an internal or external tunnel.";
+                }
+            }
+        }
+    }
+
+    container monitoring-ref-count {
+        config false;
+        description "The container for maintaing the reference count for monitoring requests
+                      between a src and dst DPN pair.";
+        list monitored-tunnels {
+            key "source-dpn destination-dpn";
+            leaf source-dpn {
+                type uint64;
+            }
+            leaf destination-dpn {
+                type uint64;
+            }
+            leaf reference-count {
+                type uint16;
+            }
+        }
+    }
+}