Distinguish internal vs external tunnels
[vpnservice.git] / interfacemgr / interfacemgr-api / src / main / yang / odl-interface.yang
index 591f31fc184bbf51456fb103d5c5f929dedfd1e3..828ede50d72c9528ce64b386a32c30428fa4af6a 100644 (file)
-
 module odl-interface {
-       namespace "urn:opendaylight:vpnservice:interfacemgr";
+    namespace "urn:opendaylight:vpnservice:interfacemgr";
+
+    prefix "odlif";
+
+    import ietf-interfaces {
+        prefix if;
+    }
+
+    import yang-ext {
+        prefix ext;
+    }
 
-       prefix "odlif";
+    import iana-if-type {
+        prefix ianaift;
+    }
 
-       import ietf-interfaces {
-               prefix if;
-       }
-       import iana-if-type {
-               prefix ianaift;
-       }
+    import ietf-inet-types {
+        prefix inet;
+    }
+
+    import opendaylight-inventory {
+        prefix inv; revision-date 2013-08-19;
+    }
 
-       import ietf-inet-types {
-               prefix inet;
-       }
-       revision "2015-03-31" {
+    import opendaylight-l2-types { prefix ethertype; revision-date "2013-08-27";}
+
+    import config {
+        prefix config; revision-date 2013-04-05;
+    }
+
+    revision "2015-03-31" {
         description "ODL Interface Manager Module";
     }
 
-       identity stacked-vlan {
-               base if:interface-type;
-               reference
-               "Q-in-Q interface";
-       }
-       
-       identity l3tunnel {
-               base if:interface-type;
-               reference
-               "l3 tunnel interface";
-       }
-
-       identity mpls {
-               base if:interface-type;
-               reference
-               "MPLS interface";
-       }
-
-       /* l3Tunnel (GRE, VxLAN) logical port */
-       identity tunnel-type-base {
-               description "Base identity for all tunnel-types";
-       }
-
-       identity tunnel-type-vxlan {
-               description "Tunnel type for vxlan tunnels";
-               base tunnel-type-base;
-       }
-
-       identity tunnel-type-gre {
-               description "Tunnel type for gre tunnels";
-               base tunnel-type-base;
-       }
-
-       /* base/common properties */
-       augment "/if:interfaces/if:interface" {
-               leaf of-port-id { 
-                       type string; 
-                       description "can be a physical switch port or virtual switch port e.g. neutron port";
-               } 
-               leaf tenant-id { 
-                       type string; 
-                       description "Tenant that owns particular interface";
-               } /* optional */
-               leaf base-interface { 
-                       type if:interface-ref; 
-                       description "some interfaces need a reference to parent interface ";
-               } 
-       }
-       
-       /* interface type specific properties */
-       
-       /* VLAN logical port */
-       augment "/if:interfaces/if:interface" {
-               when "if:type = 'ianaift:l2vlan'";
-               leaf vlan-id {
-                       type uint16 {
-                               range "1..4094";
-                       }
-                       must "../base-interface" {
-                               description
-                               "If a vlan-id is defined, a base-interface must
-                               be specified.";
-                       }
-               }
-       }
-       
-       /* Q-in-Q logical port */
-       augment "/if:interfaces/if:interface" {
-               when "if:type = 'stacked_vlan'";
-               leaf stacked_vlan-id {
-                       type uint16 {
-                               range "1..4094";
-                       }
-                       must "../base-interface" {
-                               description
-                               "If a vlan-id is defined, a base-interface must
-                               be specified.";
-                       }
-               }
-       }
-
-       augment "/if:interfaces/if:interface" {
-               when "if:type = 'ianaift:l3tunnel'";
-
-               leaf tunnel-type {
+    identity odl-interface {
+        status deprecated;
+        base "config:service-type";
+        config:java-class "org.opendaylight.vpnservice.interfacemgr.interfaces.IInterfaceManager";
+    }
+
+    identity stacked-vlan {
+        base if:interface-type;
+        reference "Q-in-Q interface";
+    }
+
+    identity mpls {
+        base if:interface-type;
+        reference "MPLS interface";
+    }
+
+    /* Tunnel (GRE, VxLAN) logical port */
+    identity l3tunnel {
+        status deprecated;
+        base if:interface-type;
+        reference "l3 tunnel interface";
+    }
+
+    identity tunnel-type-base {
+        description "Base identity for all tunnel-types";
+    }
+
+    identity tunnel-type-vxlan {
+        description "Tunnel type for vxlan tunnels";
+        base tunnel-type-base;
+    }
+
+    identity tunnel-type-gre {
+        description "Tunnel type for gre tunnels";
+        base tunnel-type-base;
+    }
+
+    identity tunnel-type-mpls-over-gre {
+        description "Tunnel type for mpls over gre tunnels";
+        base tunnel-type-base;
+    }
+
+    /* base/common properties */
+    augment "/if:interfaces/if:interface" {
+        status deprecated;
+        ext:augment-identifier "base-ids";
+        leaf of-port-id {
+            type inv:node-connector-id;
+            description "can be a physical switch port or virtual switch port e.g. neutron port";
+        }
+    }
+
+    augment "/if:interfaces/if:interface" {
+        ext:augment-identifier "parent-refs";
+        leaf datapath-node-identifier {
+            type uint64;
+            description "can be a physical switch identifier (optional)";
+        }
+
+        leaf parent-interface {
+            type string;
+            description "can be a physical switch port or virtual switch port e.g. neutron port";
+        }
+    }
+
+    /* interface type specific properties */
+
+    /* VLAN logical port */
+    augment "/if:interfaces/if:interface" {
+        ext:augment-identifier "if-l2vlan";
+        when "if:type = 'ianaift:l2vlan'";
+        leaf vlan-id {
+            type ethertype:vlan-id;
+        }
+
+        leaf l2vlan-mode {
+            description "The VLAN mode of the L2Vlan Interface.";
+            type enumeration {
+                enum "access" {
+                    value 1;
+                    description
+                        "The VLAN mode access.";
+                }
+                enum "native-tagged" {
+                    value 2;
+                    description
+                        "The VLAN mode native-tagged.";
+                }
+                enum "native-untagged" {
+                    value 3;
+                    description
+                        "The VLAN mode native-untagged.";
+                }
+                enum "trunk" {
+                    value 4;
+                    description
+                        "The VLAN mode trunk.";
+                }
+                enum "trunk-member" {
+                    value 5;
+                    description
+                        "The VLAN mode trunk-member.";
+                }
+                enum "transparent" {
+                    value 6;
+                    description
+                        "The VLAN mode transparent.";
+                }
+            }
+        }
+    }
+
+    /* Q-in-Q logical port */
+    augment "/if:interfaces/if:interface" {
+        ext:augment-identifier "if-stacked-vlan";
+        when "if:type = 'stacked-vlan'";
+        leaf stacked_vlan-id {
+            type uint16 {
+                range "1..4094";
+            }
+        }
+    }
+
+    augment "/if:interfaces/if:interface" {
+        ext:augment-identifier "if-tunnel";
+        when "if:type = 'ianaift:tunnel'";
+
+        leaf internal {
+            type boolean;
+            default "false";
+            description
+              "represents whether this is an internal or external tunnel.";
+        }
+        
+        leaf tunnel-interface-type {
             type identityref {
                 base tunnel-type-base;
             }
         }
-               leaf local-ip {
-                       type inet:ip-address;
-                       description "Local Endpoint IP address";
-               }
-               
-               leaf remote-ip {
-                       type inet:ip-address;
-                       description "Remote Endpoint IP address";
-               }
-               
-               leaf gateway-ip {
-                       type inet:ip-address;
-                       description "gateway IP address";
-               }
-                               
-       }
-
-               
-       /* MPLS logical port */
-       augment "/if:interfaces/if:interface" {
-               when "if:type = 'mpls'";
-               leaf-list labelStack {
-                       type uint32 {
-                               range "15..1048575";
-                       }
-               }
-               leaf numLabels{
-                       type uint8 {
-                               range "1..7";
-                       }
-               }               
-       }
-
-}
 
+        leaf tunnel-source {
+            type inet:ip-address;
+            description "Local Endpoint IP address";
+        }
+
+        leaf tunnel-destination {
+            type inet:ip-address;
+            description "Remote Endpoint IP address";
+        }
+
+        leaf tunnel-gateway {
+            type inet:ip-address;
+            description "gateway IP address";
+        }
+    }
+
+    augment "/if:interfaces/if:interface" {
+        status deprecated;
+        ext:augment-identifier "if-l3tunnel";
+        when "if:type = 'ianaift:l3tunnel'";
+
+        leaf tunnel-type {
+            type identityref {
+                base tunnel-type-base;
+            }
+        }
+
+        leaf local-ip {
+            type inet:ip-address;
+            description "Local Endpoint IP address";
+        }
+
+        leaf remote-ip {
+            type inet:ip-address;
+            description "Remote Endpoint IP address";
+        }
+
+        leaf gateway-ip {
+            type inet:ip-address;
+            description "gateway IP address";
+        }
+    }
+    /* MPLS logical port */
+    augment "/if:interfaces/if:interface" {
+        ext:augment-identifier "if-mpls";
+        when "if:type = 'mpls'";
+        leaf-list labelStack {
+            type uint32 {
+                range "15..1048575";
+            }
+        }
+        leaf numLabels{
+            type uint8 {
+                range "1..7";
+            }
+        }
+    }
+}
\ No newline at end of file