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; } |
sb98052 | 9d242b1 | 2016-09-13 20:47:26 +0200 | [diff] [blame] | 31 | import xos-types { prefix xos; } |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 32 | |
Peter K. Lee | f4d38d3 | 2016-07-23 02:47:38 -0700 | [diff] [blame] | 33 | feature synchronizer { |
| 34 | description |
| 35 | "Enables configuration synchronization to the distributed store."; |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 36 | } |
| 37 | |
| 38 | identity kind; |
Peter K. Lee | 0db45ac | 2016-09-13 00:30:37 -0700 | [diff] [blame] | 39 | identity generic { base kind; } |
| 40 | identity service { base kind; } |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 41 | |
| 42 | typedef unique-identifier { |
| 43 | description "defines valid formats for external reference id"; |
| 44 | type union { |
Peter K. Lee | 4302f47 | 2016-07-28 03:51:39 -0700 | [diff] [blame] | 45 | type uint32 { range 1..max; } |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 46 | type yang:uuid; |
| 47 | type inet:uri; |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 48 | } |
| 49 | } |
Peter K. Lee | 0db45ac | 2016-09-13 00:30:37 -0700 | [diff] [blame] | 50 | typedef bandwidth { |
| 51 | type uint32 { |
| 52 | range 1000000..max; // should be at least 1 Mbps? |
| 53 | } |
| 54 | units 'bps'; |
| 55 | } |
| 56 | typedef vlan { |
| 57 | type uint16 { range 0..4095; } |
| 58 | } |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 59 | |
Peter K. Lee | 0db45ac | 2016-09-13 00:30:37 -0700 | [diff] [blame] | 60 | grouping attribute-pair { |
Peter K. Lee | cb2eb92 | 2016-09-01 18:02:31 -0700 | [diff] [blame] | 61 | leaf name { type string { length 0..128; } } |
| 62 | leaf value { type string; } |
| 63 | // don't need pointer back to service |
| 64 | } |
Peter K. Lee | 2da7863 | 2016-09-06 21:02:47 -0700 | [diff] [blame] | 65 | |
Peter K. Lee | 0db45ac | 2016-09-13 00:30:37 -0700 | [diff] [blame] | 66 | grouping sync-record { |
Peter K. Lee | 2da7863 | 2016-09-06 21:02:47 -0700 | [diff] [blame] | 67 | description "Synchronizer-specific properties for model records"; |
| 68 | |
| 69 | leaf created { type yang:date-and-time; } |
| 70 | leaf updated { type yang:date-and-time; } |
| 71 | leaf enacted { type yang:date-and-time; } |
| 72 | leaf policed { type yang:date-and-time; } |
| 73 | |
| 74 | leaf writable { type boolean; default true; } |
| 75 | leaf locked { type boolean; default false; } |
| 76 | leaf deleted { type boolean; default false; } |
| 77 | |
| 78 | leaf dirty { |
| 79 | config false; |
| 80 | type boolean; |
| 81 | default false; |
| 82 | } |
| 83 | |
| 84 | container sync { |
| 85 | anydata register { |
| 86 | description "scratchpad used by the Observer"; |
| 87 | } |
| 88 | leaf progress { |
| 89 | type enumeration { |
| 90 | enum provisioning { |
| 91 | value 0; |
| 92 | description "Provisioning in progress"; |
| 93 | } |
| 94 | } |
| 95 | } |
| 96 | leaf disabled { type boolean; default false; } |
| 97 | leaf enforced { type boolean; default true; } |
| 98 | |
| 99 | list policy { |
| 100 | // TODO: how are policy defined/enforced? |
| 101 | } |
| 102 | } |
| 103 | |
| 104 | action diff { |
| 105 | when "../dirty == true"; |
| 106 | description "retrieve diff of model state if dirty"; |
| 107 | } |
| 108 | action save { |
| 109 | description "trigger save into data store via synchronizer"; |
| 110 | } |
| 111 | } |
Peter K. Lee | cb2eb92 | 2016-09-01 18:02:31 -0700 | [diff] [blame] | 112 | |
Peter K. Lee | 0db45ac | 2016-09-13 00:30:37 -0700 | [diff] [blame] | 113 | grouping base-common { |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 114 | leaf id { |
| 115 | type unique-identifier; |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 116 | mandatory true; |
| 117 | } |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 118 | leaf name { |
| 119 | type string { |
| 120 | length 0..255; |
| 121 | } |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 122 | } |
Peter K. Lee | 2da7863 | 2016-09-06 21:02:47 -0700 | [diff] [blame] | 123 | list attribute { |
Peter K. Lee | 0db45ac | 2016-09-13 00:30:37 -0700 | [diff] [blame] | 124 | uses attribute-pair; |
Peter K. Lee | 2da7863 | 2016-09-06 21:02:47 -0700 | [diff] [blame] | 125 | key name; |
| 126 | status deprecated; |
| 127 | reference "XOS: service-specific-attribute"; |
| 128 | description "backwards-compatible attribute association"; |
| 129 | } |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 130 | leaf service-specific-id { |
| 131 | type unique-identifier; |
| 132 | mandatory true; |
Peter K. Lee | 2da7863 | 2016-09-06 21:02:47 -0700 | [diff] [blame] | 133 | status deprecated; |
| 134 | } |
Peter K. Lee | 2da7863 | 2016-09-06 21:02:47 -0700 | [diff] [blame] | 135 | container record { |
| 136 | if-feature synchronizer; |
Peter K. Lee | 0db45ac | 2016-09-13 00:30:37 -0700 | [diff] [blame] | 137 | uses sync-record; |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 138 | } |
Peter K. Lee | cb2eb92 | 2016-09-01 18:02:31 -0700 | [diff] [blame] | 139 | } |
Peter K. Lee | cb2eb92 | 2016-09-01 18:02:31 -0700 | [diff] [blame] | 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 | } |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 155 | grouping subscriber { |
| 156 | uses tenant-root { |
| 157 | refine kind { default subscriber; } |
| 158 | } |
| 159 | // seems we should have interesting attributes specific to subscriber? |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 160 | } |
Peter K. Lee | cb2eb92 | 2016-09-01 18:02:31 -0700 | [diff] [blame] | 161 | grouping provider { |
| 162 | uses tenant-root { |
| 163 | refine kind { default provider; } |
| 164 | } |
| 165 | // seems we should have interesting attributes specific to provider? |
| 166 | } |
Peter K. Lee | c396050 | 2016-09-13 11:47:02 -0700 | [diff] [blame] | 167 | grouping slice { |
| 168 | // TBD |
| 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 | c396050 | 2016-09-13 11:47:02 -0700 | [diff] [blame] | 223 | list slice { |
| 224 | uses xos:slice; |
| 225 | } |
Peter K. Lee | cb2eb92 | 2016-09-01 18:02:31 -0700 | [diff] [blame] | 226 | |
| 227 | // TOOD: need to better understand relationship between Service and Slice |
| 228 | action scale { |
| 229 | description "Adjust scale for slice(s)"; |
| 230 | } |
| 231 | |
| 232 | // TODO: need to better understand relationship between Service and VTN |
| 233 | } |
| 234 | |
| 235 | grouping tenancy { |
Peter K. Lee | 0db45ac | 2016-09-13 00:30:37 -0700 | [diff] [blame] | 236 | uses base-common; |
Peter K. Lee | cb2eb92 | 2016-09-01 18:02:31 -0700 | [diff] [blame] | 237 | |
| 238 | choice provider { |
| 239 | description "only one type of provider node is valid."; |
| 240 | case service { leaf provider-service { type instance-identifier; } } |
| 241 | } |
| 242 | |
| 243 | choice subscriber { |
| 244 | description "only one type of subscriber node is valid."; |
| 245 | case service { leaf subscriber-service { type instance-identifier; } } |
| 246 | case tenant { leaf subscriber-tenant { type instance-identifier; } } |
| 247 | case user { leaf subscriber-user { type instance-identifier; } } |
| 248 | case root { leaf subscriber-root { type instance-identifier; } } |
| 249 | case network { leaf subscriber-network { type instance-identifier; } } |
| 250 | } |
| 251 | |
| 252 | leaf connect-method { |
| 253 | //when "../kind == 'static-tenant'"; |
| 254 | |
| 255 | type enumeration { |
| 256 | enum public { description "Public"; } |
| 257 | enum private { description "Private"; } |
| 258 | enum private-unidirectional { description "Private Uni-directional"; } |
| 259 | enum na { description "Not Applicable"; } |
| 260 | } |
| 261 | default na; |
| 262 | } |
| 263 | |
| 264 | // TODO: should be able to deal with TenantWithContainer here |
| 265 | |
| 266 | } |
sb98052 | 9d242b1 | 2016-09-13 20:47:26 +0200 | [diff] [blame] | 267 | |
| 268 | grouping slice { |
| 269 | description |
| 270 | "A slice is a logically centralized container for network and compute resources" |
| 271 | |
| 272 | uses base-common; |
| 273 | |
| 274 | leaf enabled { |
| 275 | type boolean; |
| 276 | default true; |
| 277 | } |
| 278 | |
| 279 | leaf omf-friendly { |
| 280 | type boolean; |
| 281 | default false; |
| 282 | status deprecated; |
| 283 | } |
| 284 | |
| 285 | leaf slice-url { |
| 286 | description "A URL describing the purpose of this slice"; |
| 287 | type xos.refs.url-field; |
| 288 | // blank true; |
| 289 | } |
| 290 | |
| 291 | leaf max-instances { |
| 292 | description "The maximum number of VMs that this slice is allowed to allocate"; |
| 293 | type uint32; |
| 294 | } |
| 295 | |
| 296 | leaf service { |
| 297 | description "The service that runs in this slice"; |
| 298 | type xos.refs.service; |
| 299 | } |
| 300 | |
| 301 | leaf network { |
| 302 | description "The network that the slice uses to connect to other slices and to the Internet."; |
| 303 | type string; |
| 304 | } |
| 305 | |
| 306 | leaf exposed-ports { |
| 307 | description "The ports to be exposed for other slices to connect to"; |
| 308 | type string; |
| 309 | } |
| 310 | |
| 311 | leaf service-class { |
| 312 | type xos.refs.service-class; |
| 313 | status deprecated; |
| 314 | } |
| 315 | |
| 316 | leaf creator { |
| 317 | type xos.refs.user; |
| 318 | } |
| 319 | |
| 320 | leaf default-flavor { |
| 321 | type xos.refs.flavor; |
| 322 | } |
| 323 | |
| 324 | leaf default-image { |
| 325 | type xos.refs.image; |
| 326 | } |
| 327 | |
| 328 | leaf default-node { |
| 329 | type xos.refs.node; |
| 330 | } |
| 331 | |
| 332 | leaf mount-data-sets { |
| 333 | type string; |
| 334 | default "GenBank"; |
| 335 | length 0..256; |
| 336 | } |
| 337 | |
| 338 | leaf default_isolation { |
| 339 | type string; |
| 340 | default "vm"; |
| 341 | length 0..30; |
| 342 | } |
| 343 | |
| 344 | leaf-list tags { |
| 345 | type leafref { |
| 346 | path "/tag[id = current()/../id]/id"; |
| 347 | } |
| 348 | } |
| 349 | } |
Peter K. Lee | cb2eb92 | 2016-09-01 18:02:31 -0700 | [diff] [blame] | 350 | |
Peter K. Lee | f4d38d3 | 2016-07-23 02:47:38 -0700 | [diff] [blame] | 351 | /*** main configuration tree for XOS ***/ |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 352 | |
| 353 | container api { |
Peter K. Lee | f4d38d3 | 2016-07-23 02:47:38 -0700 | [diff] [blame] | 354 | description |
| 355 | "The primary configuration interaction endpoint"; |
| 356 | |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 357 | container service { |
Peter K. Lee | f4d38d3 | 2016-07-23 02:47:38 -0700 | [diff] [blame] | 358 | description |
| 359 | "placeholder endpoint for services to augment"; |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 360 | } |
| 361 | container tenant { |
Peter K. Lee | f4d38d3 | 2016-07-23 02:47:38 -0700 | [diff] [blame] | 362 | description |
| 363 | "placeholder endpoint for tenants to augment"; |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 364 | } |
| 365 | } |
| 366 | |
| 367 | } |