Security group in VPP renderer
[groupbasedpolicy.git] / renderers / vpp / src / main / yang / vpp-renderer.yang
index e15b1d7a85bfe03ccb28bc208c776628a356c4dd..cb6ddcb5a19c37fffcc76429a9cbba9a3d6bd10c 100644 (file)
@@ -13,6 +13,11 @@ module vpp-renderer {
     prefix "vpp-renderer";
 
     import base-endpoint { prefix base-ep; revision-date 2016-04-27; }
+    import network-topology { prefix nt; revision-date 2013-10-21; }
+    import opendaylight-l2-types { prefix l2-types; revision-date "2013-08-27"; }
+    import ietf-yang-types { prefix yang-types; revision-date "2013-07-15"; }
+    import ietf-inet-types { prefix "inet-types"; }
+    import yang-ext {prefix ext; revision-date "2013-07-09";}
 
     description
         "This module is a baseline for the group-based policy vpp renderer model.";
@@ -22,35 +27,144 @@ module vpp-renderer {
             "Initial revision.";
     }
 
-    container config {
-        list vpp-endpoint {
-            description "Renderer creates/removes interface on VPP node based on given parameters.";
+    identity network-type-base {
+        description "Base for Network Types.";
+    }
 
-            key "context-type context-id address-type address";
-            uses base-ep:address-endpoint-key;
+    identity flat-network {
+        description "Flat Provider Network Type";
+        base network-type-base;
+    }
+
+    identity vlan-network {
+        description "VLAN Provider Network Type";
+        base network-type-base;
+    }
+
+    typedef network-type {
+        description "Type of Network.";
+        type identityref {
+            base network-type-base;
+        }
+    }
 
-            leaf vpp-node-path {
-                description "Path to a node representing mount-point to VPP instance.";
-                type instance-identifier;
+    grouping bridge-domain-base-attributes {
+        leaf id {
+            description "Same as in VBD.";
+            type string;
+        }
+        leaf description {
+           type string;
+        }
+        list physical-location-ref {
+            description
+                "Refers to physical interfaces on vpp nodes through which external
+                 nodes belonging to the same bridge-domain can be reached.";
+            key "node-id";
+            leaf node-id {
+                description "Refers to a VPP node.";
+                type nt:node-id;
             }
-            leaf vpp-interface-name {
-                description "Name of interface for the endpoint on VPP";
+            leaf-list interface {
+                description "Physical interface on the VPP node.";
                 type string;
             }
-            leaf description {
-                description "Additional description of the vpp-endpoint";
-                type string;
+        }
+    }
+
+    grouping interface-attributes {
+        uses interface-location;
+        leaf description {
+            description "Additional description of the vpp-endpoint";
+            type string;
+        }
+        choice interface-type-choice {
+            mandatory true;
+            case vhost-user-case {
+                leaf socket {
+                    description "Identifier of a vhost user";
+                    type string {
+                        length 1..255;
+                    }
+                }
             }
-            choice interface-type-choice {
-                case vhost-user-case {
-                    leaf socket {
-                        description "A unique ID for the neutron port";
-                        type string {
-                            length 1..255;
-                        }
+            case tap-case {
+                leaf name {
+                    description "Identifier of a tap port";
+                    mandatory true;
+                    type string {
+                        length 1..255;
                     }
                 }
+                leaf physical-address {
+                    description "MAC address of a tap port";
+                    type yang-types:phys-address;
+                }
+            }
+            case loopback-case {
+                leaf phys-address {
+                    description "MAC address of a loopback interface";
+                    type yang-types:phys-address;
+                }
+                leaf ip-address {
+                    description "Ip address of a loopback interface";
+                    type inet-types:ip-address;
+                }
+                leaf ip-prefix {
+                    description "Ip address prefix of a loopback interface";
+                    type inet-types:ip-prefix;
+                }
+                leaf bvi {
+                    description "Enable/disable BVI for loopback interface";
+                    type boolean;
+                }
+            }
+        }
+    }
+
+    grouping interface-location {
+        leaf vpp-node-id {
+            description "Id of a VPP node represented as a mount-point in netconf topology.";
+            mandatory true;
+            type nt:node-id;
+        }
+        leaf vpp-interface-name {
+            description "Name of interface for the endpoint on VPP";
+            mandatory true;
+            type string;
+        }
+    }
+
+    container config {
+        list vpp-endpoint {
+            description "Renderer creates/removes interface on VPP node based on given parameters.";
+
+            key "context-type context-id address-type address";
+            uses base-ep:address-endpoint-key;
+
+            uses interface-attributes;
+        }
+
+        list gbp-bridge-domain {
+            key "id";
+            uses bridge-domain-base-attributes;
+            leaf type {
+                mandatory true;
+                type network-type;
+            }
+            leaf vlan {
+                when "type = 'vlan-network'";
+                type l2-types:vlan-id;
             }
         }
     }
+
+    augment "/vpp-renderer:config/vpp-renderer:vpp-endpoint" {
+        ext:augment-identifier "exclude-from-policy";
+        leaf exclude-from-policy {
+            description "Device attached as an endpoint may act as network element,
+                         e.g. qrouter attached via tap interface.";
+            type empty;
+        }
+    }
 }