HONEYCOMB-48: added VLAN support to v3po.yang 40/1140/4
authorMarek Gradzki <mgradzki@cisco.com>
Mon, 16 May 2016 12:54:27 +0000 (14:54 +0200)
committerMarek Gradzki <mgradzki@cisco.com>
Thu, 19 May 2016 11:22:50 +0000 (11:22 +0000)
Change-Id: Ic4ba5c4573e79bf406b85cac435ecee28d820cda
Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
v3po/api/src/main/yang/v3po.yang

index 7746d1a..3a71ffd 100644 (file)
@@ -42,6 +42,33 @@ module v3po {
       "This type is used by to reference a bridged virtual interface";
   }
 
+  typedef vlan-type {
+    type enumeration {
+      enum 802dot1q;
+      enum 802dot1ad;
+    }
+  }
+
+  typedef tag-rewrite-operation {
+    type enumeration {
+      enum disabled;
+      enum push-1;
+      enum push-2;
+      enum pop-1;
+      enum pop-2;
+      enum translate-1-to-1;
+      enum translate-1-to-2;
+      enum translate-2-to-1;
+      enum translate-2-to-2;
+    }
+  }
+
+  typedef vlan-tag {
+    type uint16 {
+      range "1..4094";
+    }
+  }
+
   identity vxlan-tunnel {
     base if:interface-type;
   }
@@ -54,6 +81,10 @@ module v3po {
     base if:interface-type;
   }
 
+  identity sub-interface {
+    base if:interface-type;
+  }
+
   typedef vxlan-vni {
     // FIXME: should be in a vxlan-specific model
     description "VNI used in a VXLAN tunnel";
@@ -98,6 +129,40 @@ module v3po {
     }
   }
 
+  grouping sub-interface-base-attributes {
+    leaf identifier {
+      type uint32;
+    }
+    leaf vlan-type {
+      type vlan-type;
+      default '802dot1q';
+    }
+    leaf number-of-tags {
+      type uint8 {
+        range "0..2";
+      }
+      default 1;
+    }
+    leaf outer-id {
+      type vlan-tag;
+    }
+    leaf inner-id {
+      type vlan-tag;
+    }
+    leaf match-any-outer-id {
+      type empty;
+    }
+    leaf match-any-inner-id {
+      type empty;
+    }
+    leaf exact-match {
+      type empty;
+    }
+    leaf default-subif {
+      type empty;
+    }
+  }
+
   grouping tap-interface-base-attributes {
     leaf tap-name {
       type string;
@@ -149,6 +214,23 @@ module v3po {
       }
   }
 
+  grouping vlan-tag-rewrite-attributes {
+    leaf rewrite-operation {
+      type tag-rewrite-operation;
+      default 'disabled';
+    }
+    leaf first-pushed {
+      type vlan-type;
+      default '802dot1q';
+    }
+    leaf tag1 {
+      type vlan-tag;
+    }
+    leaf tag2 {
+      type vlan-tag;
+    }
+  }
+
   augment /if:interfaces/if:interface {
     ext:augment-identifier "vpp-interface-augmentation";
 
@@ -156,6 +238,14 @@ module v3po {
     // 1. The link between interface type and this augmentation is unclear
     // 2. Only this augmentation with combination of ifc type is trigger to do something for vpp, what if user only configures base interface stuff ? + We need to get leaves defined by ietf-interfaces when we are processing this augment
 
+    container sub-interface {
+      when "../if:type = 'v3po:sub-interface'";
+      leaf super-interface {
+        type if:interface-ref;
+      }
+      uses sub-interface-base-attributes;
+    }
+
     container tap {
       when "../if:type = 'v3po:tap'";
       uses tap-interface-base-attributes;
@@ -251,6 +341,9 @@ module v3po {
           }
         }
       }
+      container vlan-tag-rewrite {
+        uses vlan-tag-rewrite-attributes;
+      }
     }
   }
 
@@ -298,6 +391,14 @@ module v3po {
       type string;
     }
 
+    container sub-interface {
+      when "../if:type = 'v3po:sub-interface'";
+      leaf super-interface {
+        type if:interface-state-ref;
+      }
+      uses sub-interface-base-attributes;
+    }
+
     container tap {
       when "../if:type = 'v3po:tap'";
       uses tap-interface-base-attributes {
@@ -370,6 +471,9 @@ module v3po {
           }
         }
       }
+      container vlan-tag-rewrite {
+        uses vlan-tag-rewrite-attributes;
+      }
     }
   }