Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 1 | module xos-core { |
Peter K. Lee | 5539580 | 2016-07-15 18:25:40 -0700 | [diff] [blame] | 2 | namespace "urn:onlab:xos:core"; |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 3 | prefix xos; |
| 4 | yang-version 1.1; |
| 5 | |
| 6 | organization |
| 7 | "Open Networking Lab (XOS) / Corenova Technologies"; |
| 8 | |
| 9 | contact |
| 10 | "Larry Peterson <llp@onlab.us> |
| 11 | Peter K. Lee <peter@corenova.com>"; |
| 12 | |
Peter K. Lee | f4d38d3 | 2016-07-23 02:47:38 -0700 | [diff] [blame] | 13 | description |
| 14 | "This module contains a collection of core models for XOS. |
| 15 | |
| 16 | Copyright (c) 2016 ON.LAB and the persons identified as authors of |
| 17 | the code. All rights reserved. |
| 18 | |
| 19 | Redistribution and use in source and binary forms, with or without |
| 20 | modification, is permitted pursuant to, and subject to the license |
| 21 | terms of the Apache License, Version 2.0 which accompanies this |
| 22 | distribution, and is available at |
| 23 | (http://www.apache.org/licenses/LICENSE-2.0)."; |
| 24 | |
| 25 | revision 2016-07-14 { |
| 26 | description "Initial revision."; |
| 27 | } |
| 28 | |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 29 | import ietf-yang-types { prefix yang; } |
Peter K. Lee | 5539580 | 2016-07-15 18:25:40 -0700 | [diff] [blame] | 30 | import ietf-inet-types { prefix inet; } |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 31 | |
Peter K. Lee | f4d38d3 | 2016-07-23 02:47:38 -0700 | [diff] [blame] | 32 | feature synchronizer { |
| 33 | description |
| 34 | "Enables configuration synchronization to the distributed store."; |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 35 | } |
| 36 | |
| 37 | identity kind; |
Peter K. Lee | 0db45ac | 2016-09-13 00:30:37 -0700 | [diff] [blame^] | 38 | identity generic { base kind; } |
| 39 | identity service { base kind; } |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 40 | |
| 41 | typedef unique-identifier { |
| 42 | description "defines valid formats for external reference id"; |
| 43 | type union { |
Peter K. Lee | 4302f47 | 2016-07-28 03:51:39 -0700 | [diff] [blame] | 44 | type uint32 { range 1..max; } |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 45 | type yang:uuid; |
| 46 | type inet:uri; |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 47 | } |
| 48 | } |
Peter K. Lee | 0db45ac | 2016-09-13 00:30:37 -0700 | [diff] [blame^] | 49 | typedef bandwidth { |
| 50 | type uint32 { |
| 51 | range 1000000..max; // should be at least 1 Mbps? |
| 52 | } |
| 53 | units 'bps'; |
| 54 | } |
| 55 | typedef vlan { |
| 56 | type uint16 { range 0..4095; } |
| 57 | } |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 58 | |
Peter K. Lee | 0db45ac | 2016-09-13 00:30:37 -0700 | [diff] [blame^] | 59 | grouping attribute-pair { |
Peter K. Lee | cb2eb92 | 2016-09-01 18:02:31 -0700 | [diff] [blame] | 60 | leaf name { type string { length 0..128; } } |
| 61 | leaf value { type string; } |
| 62 | // don't need pointer back to service |
| 63 | } |
Peter K. Lee | 2da7863 | 2016-09-06 21:02:47 -0700 | [diff] [blame] | 64 | |
Peter K. Lee | 0db45ac | 2016-09-13 00:30:37 -0700 | [diff] [blame^] | 65 | grouping sync-record { |
Peter K. Lee | 2da7863 | 2016-09-06 21:02:47 -0700 | [diff] [blame] | 66 | description "Synchronizer-specific properties for model records"; |
| 67 | |
| 68 | leaf created { type yang:date-and-time; } |
| 69 | leaf updated { type yang:date-and-time; } |
| 70 | leaf enacted { type yang:date-and-time; } |
| 71 | leaf policed { type yang:date-and-time; } |
| 72 | |
| 73 | leaf writable { type boolean; default true; } |
| 74 | leaf locked { type boolean; default false; } |
| 75 | leaf deleted { type boolean; default false; } |
| 76 | |
| 77 | leaf dirty { |
| 78 | config false; |
| 79 | type boolean; |
| 80 | default false; |
| 81 | } |
| 82 | |
| 83 | container sync { |
| 84 | anydata register { |
| 85 | description "scratchpad used by the Observer"; |
| 86 | } |
| 87 | leaf progress { |
| 88 | type enumeration { |
| 89 | enum provisioning { |
| 90 | value 0; |
| 91 | description "Provisioning in progress"; |
| 92 | } |
| 93 | } |
| 94 | } |
| 95 | leaf disabled { type boolean; default false; } |
| 96 | leaf enforced { type boolean; default true; } |
| 97 | |
| 98 | list policy { |
| 99 | // TODO: how are policy defined/enforced? |
| 100 | } |
| 101 | } |
| 102 | |
| 103 | action diff { |
| 104 | when "../dirty == true"; |
| 105 | description "retrieve diff of model state if dirty"; |
| 106 | } |
| 107 | action save { |
| 108 | description "trigger save into data store via synchronizer"; |
| 109 | } |
| 110 | } |
Peter K. Lee | cb2eb92 | 2016-09-01 18:02:31 -0700 | [diff] [blame] | 111 | |
Peter K. Lee | 0db45ac | 2016-09-13 00:30:37 -0700 | [diff] [blame^] | 112 | grouping base-common { |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 113 | leaf id { |
| 114 | type unique-identifier; |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 115 | mandatory true; |
| 116 | } |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 117 | leaf name { |
| 118 | type string { |
| 119 | length 0..255; |
| 120 | } |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 121 | } |
Peter K. Lee | 2da7863 | 2016-09-06 21:02:47 -0700 | [diff] [blame] | 122 | list attribute { |
Peter K. Lee | 0db45ac | 2016-09-13 00:30:37 -0700 | [diff] [blame^] | 123 | uses attribute-pair; |
Peter K. Lee | 2da7863 | 2016-09-06 21:02:47 -0700 | [diff] [blame] | 124 | key name; |
| 125 | status deprecated; |
| 126 | reference "XOS: service-specific-attribute"; |
| 127 | description "backwards-compatible attribute association"; |
| 128 | } |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 129 | leaf service-specific-id { |
| 130 | type unique-identifier; |
| 131 | mandatory true; |
Peter K. Lee | 2da7863 | 2016-09-06 21:02:47 -0700 | [diff] [blame] | 132 | status deprecated; |
| 133 | } |
Peter K. Lee | 2da7863 | 2016-09-06 21:02:47 -0700 | [diff] [blame] | 134 | container record { |
| 135 | if-feature synchronizer; |
Peter K. Lee | 0db45ac | 2016-09-13 00:30:37 -0700 | [diff] [blame^] | 136 | uses sync-record; |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 137 | } |
Peter K. Lee | cb2eb92 | 2016-09-01 18:02:31 -0700 | [diff] [blame] | 138 | } |
| 139 | |
| 140 | grouping tenant-root { |
Peter K. Lee | 0db45ac | 2016-09-13 00:30:37 -0700 | [diff] [blame^] | 141 | uses base-common { |
Peter K. Lee | cb2eb92 | 2016-09-01 18:02:31 -0700 | [diff] [blame] | 142 | refine 'name' { |
| 143 | description "Specify name of the TenantRoot"; |
| 144 | } |
| 145 | } |
| 146 | description |
| 147 | "A Tenant Root is one of the things that can sit at the root of a chain |
| 148 | of tenancy. This object represents a node."; |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 149 | |
Peter K. Lee | af777da | 2016-08-17 04:33:00 -0700 | [diff] [blame] | 150 | list subscribed-tenant { |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 151 | config false; |
| 152 | // not exactly clear how this is populated |
| 153 | } |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 154 | } |
| 155 | |
| 156 | grouping subscriber { |
| 157 | uses tenant-root { |
| 158 | refine kind { default subscriber; } |
| 159 | } |
| 160 | // seems we should have interesting attributes specific to subscriber? |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 161 | } |
Peter K. Lee | cb2eb92 | 2016-09-01 18:02:31 -0700 | [diff] [blame] | 162 | |
| 163 | grouping provider { |
| 164 | uses tenant-root { |
| 165 | refine kind { default provider; } |
| 166 | } |
| 167 | // seems we should have interesting attributes specific to provider? |
| 168 | } |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 169 | |
Peter K. Lee | cb2eb92 | 2016-09-01 18:02:31 -0700 | [diff] [blame] | 170 | grouping service { |
Peter K. Lee | 0db45ac | 2016-09-13 00:30:37 -0700 | [diff] [blame^] | 171 | uses base-common { |
Peter K. Lee | cb2eb92 | 2016-09-01 18:02:31 -0700 | [diff] [blame] | 172 | refine 'name' { |
| 173 | description "Name of the Service"; |
| 174 | } |
| 175 | } |
Peter K. Lee | 0db45ac | 2016-09-13 00:30:37 -0700 | [diff] [blame^] | 176 | leaf kind { |
| 177 | type identityref { |
| 178 | base kind; |
| 179 | } |
| 180 | default generic; |
| 181 | } |
Peter K. Lee | cb2eb92 | 2016-09-01 18:02:31 -0700 | [diff] [blame] | 182 | leaf description { |
| 183 | type string { |
| 184 | length 0..254; |
| 185 | } |
| 186 | description "Description of the Service"; |
| 187 | } |
| 188 | leaf version { |
| 189 | type string { length 0..30; } |
| 190 | description "Version of Service Definition"; |
| 191 | } |
| 192 | |
| 193 | leaf enabled { type boolean; default true; } |
| 194 | leaf published { type boolean; default true; } |
| 195 | |
Peter K. Lee | 2da7863 | 2016-09-06 21:02:47 -0700 | [diff] [blame] | 196 | container links { |
Peter K. Lee | cb2eb92 | 2016-09-01 18:02:31 -0700 | [diff] [blame] | 197 | leaf view { type inet:uri; } |
| 198 | leaf icon { type inet:uri; } |
| 199 | } |
| 200 | |
| 201 | list keypair { |
| 202 | description "collection of public/private key pair(s)"; |
Peter K. Lee | 2da7863 | 2016-09-06 21:02:47 -0700 | [diff] [blame] | 203 | // should be a specific typedef for storing this content |
Peter K. Lee | cb2eb92 | 2016-09-01 18:02:31 -0700 | [diff] [blame] | 204 | leaf public { type string { length 0..1024; } } |
| 205 | leaf private { type string { length 0..1024; } } |
| 206 | } |
Peter K. Lee | 0db45ac | 2016-09-13 00:30:37 -0700 | [diff] [blame^] | 207 | list provider { |
| 208 | description |
| 209 | "Each entry represents a provider of the service. Each unique service |
| 210 | should augment this block with service specific attributes."; |
| 211 | key id; |
| 212 | uses xos:provider; |
| 213 | } |
| 214 | list subscriber { |
| 215 | description |
| 216 | "Each entry represents a subscriber of the service. Each unique service |
| 217 | should augment this block with service specific attributes."; |
| 218 | key id; |
| 219 | uses xos:subscriber; |
| 220 | notification subscriber-added; |
| 221 | notification subscriber-deleted; |
| 222 | } |
Peter K. Lee | cb2eb92 | 2016-09-01 18:02:31 -0700 | [diff] [blame] | 223 | |
| 224 | // TOOD: need to better understand relationship between Service and Slice |
| 225 | action scale { |
| 226 | description "Adjust scale for slice(s)"; |
| 227 | } |
| 228 | |
| 229 | // TODO: need to better understand relationship between Service and VTN |
| 230 | } |
| 231 | |
| 232 | grouping tenancy { |
Peter K. Lee | 0db45ac | 2016-09-13 00:30:37 -0700 | [diff] [blame^] | 233 | uses base-common; |
Peter K. Lee | cb2eb92 | 2016-09-01 18:02:31 -0700 | [diff] [blame] | 234 | |
| 235 | choice provider { |
| 236 | description "only one type of provider node is valid."; |
| 237 | case service { leaf provider-service { type instance-identifier; } } |
| 238 | } |
| 239 | |
| 240 | choice subscriber { |
| 241 | description "only one type of subscriber node is valid."; |
| 242 | case service { leaf subscriber-service { type instance-identifier; } } |
| 243 | case tenant { leaf subscriber-tenant { type instance-identifier; } } |
| 244 | case user { leaf subscriber-user { type instance-identifier; } } |
| 245 | case root { leaf subscriber-root { type instance-identifier; } } |
| 246 | case network { leaf subscriber-network { type instance-identifier; } } |
| 247 | } |
| 248 | |
| 249 | leaf connect-method { |
| 250 | //when "../kind == 'static-tenant'"; |
| 251 | |
| 252 | type enumeration { |
| 253 | enum public { description "Public"; } |
| 254 | enum private { description "Private"; } |
| 255 | enum private-unidirectional { description "Private Uni-directional"; } |
| 256 | enum na { description "Not Applicable"; } |
| 257 | } |
| 258 | default na; |
| 259 | } |
| 260 | |
| 261 | // TODO: should be able to deal with TenantWithContainer here |
| 262 | |
| 263 | } |
| 264 | |
Peter K. Lee | f4d38d3 | 2016-07-23 02:47:38 -0700 | [diff] [blame] | 265 | /*** main configuration tree for XOS ***/ |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 266 | |
| 267 | container api { |
Peter K. Lee | f4d38d3 | 2016-07-23 02:47:38 -0700 | [diff] [blame] | 268 | description |
| 269 | "The primary configuration interaction endpoint"; |
| 270 | |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 271 | container service { |
Peter K. Lee | f4d38d3 | 2016-07-23 02:47:38 -0700 | [diff] [blame] | 272 | description |
| 273 | "placeholder endpoint for services to augment"; |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 274 | } |
| 275 | container tenant { |
Peter K. Lee | f4d38d3 | 2016-07-23 02:47:38 -0700 | [diff] [blame] | 276 | description |
| 277 | "placeholder endpoint for tenants to augment"; |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 278 | } |
| 279 | } |
| 280 | |
| 281 | } |