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 | |
Peter K. Lee | 4d93689 | 2016-09-13 11:59:21 -0700 | [diff] [blame^] | 6 | import ietf-yang-types { prefix yang; } |
| 7 | import ietf-inet-types { prefix inet; } |
| 8 | import xos-types { prefix xtype; } |
| 9 | |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 10 | organization |
| 11 | "Open Networking Lab (XOS) / Corenova Technologies"; |
| 12 | |
| 13 | contact |
| 14 | "Larry Peterson <llp@onlab.us> |
| 15 | Peter K. Lee <peter@corenova.com>"; |
| 16 | |
Peter K. Lee | f4d38d3 | 2016-07-23 02:47:38 -0700 | [diff] [blame] | 17 | description |
| 18 | "This module contains a collection of core models for XOS. |
| 19 | |
| 20 | Copyright (c) 2016 ON.LAB and the persons identified as authors of |
| 21 | the code. All rights reserved. |
| 22 | |
| 23 | Redistribution and use in source and binary forms, with or without |
| 24 | modification, is permitted pursuant to, and subject to the license |
| 25 | terms of the Apache License, Version 2.0 which accompanies this |
| 26 | distribution, and is available at |
| 27 | (http://www.apache.org/licenses/LICENSE-2.0)."; |
| 28 | |
| 29 | revision 2016-07-14 { |
| 30 | description "Initial revision."; |
| 31 | } |
| 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 | |
Peter K. Lee | 0db45ac | 2016-09-13 00:30:37 -0700 | [diff] [blame] | 42 | grouping attribute-pair { |
Peter K. Lee | cb2eb92 | 2016-09-01 18:02:31 -0700 | [diff] [blame] | 43 | leaf name { type string { length 0..128; } } |
| 44 | leaf value { type string; } |
| 45 | // don't need pointer back to service |
| 46 | } |
Peter K. Lee | 2da7863 | 2016-09-06 21:02:47 -0700 | [diff] [blame] | 47 | |
Peter K. Lee | 0db45ac | 2016-09-13 00:30:37 -0700 | [diff] [blame] | 48 | grouping sync-record { |
Peter K. Lee | 2da7863 | 2016-09-06 21:02:47 -0700 | [diff] [blame] | 49 | description "Synchronizer-specific properties for model records"; |
| 50 | |
| 51 | leaf created { type yang:date-and-time; } |
| 52 | leaf updated { type yang:date-and-time; } |
| 53 | leaf enacted { type yang:date-and-time; } |
| 54 | leaf policed { type yang:date-and-time; } |
| 55 | |
| 56 | leaf writable { type boolean; default true; } |
| 57 | leaf locked { type boolean; default false; } |
| 58 | leaf deleted { type boolean; default false; } |
| 59 | |
| 60 | leaf dirty { |
| 61 | config false; |
| 62 | type boolean; |
| 63 | default false; |
| 64 | } |
| 65 | |
| 66 | container sync { |
| 67 | anydata register { |
| 68 | description "scratchpad used by the Observer"; |
| 69 | } |
| 70 | leaf progress { |
| 71 | type enumeration { |
| 72 | enum provisioning { |
| 73 | value 0; |
| 74 | description "Provisioning in progress"; |
| 75 | } |
| 76 | } |
| 77 | } |
| 78 | leaf disabled { type boolean; default false; } |
| 79 | leaf enforced { type boolean; default true; } |
| 80 | |
| 81 | list policy { |
| 82 | // TODO: how are policy defined/enforced? |
| 83 | } |
| 84 | } |
| 85 | |
| 86 | action diff { |
| 87 | when "../dirty == true"; |
| 88 | description "retrieve diff of model state if dirty"; |
| 89 | } |
| 90 | action save { |
| 91 | description "trigger save into data store via synchronizer"; |
| 92 | } |
| 93 | } |
Peter K. Lee | cb2eb92 | 2016-09-01 18:02:31 -0700 | [diff] [blame] | 94 | |
Peter K. Lee | 0db45ac | 2016-09-13 00:30:37 -0700 | [diff] [blame] | 95 | grouping base-common { |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 96 | leaf id { |
Peter K. Lee | 4d93689 | 2016-09-13 11:59:21 -0700 | [diff] [blame^] | 97 | type xtype:unique-identifier; |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 98 | mandatory true; |
| 99 | } |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 100 | leaf name { |
| 101 | type string { |
| 102 | length 0..255; |
| 103 | } |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 104 | } |
Peter K. Lee | 2da7863 | 2016-09-06 21:02:47 -0700 | [diff] [blame] | 105 | list attribute { |
Peter K. Lee | 0db45ac | 2016-09-13 00:30:37 -0700 | [diff] [blame] | 106 | uses attribute-pair; |
Peter K. Lee | 2da7863 | 2016-09-06 21:02:47 -0700 | [diff] [blame] | 107 | key name; |
| 108 | status deprecated; |
| 109 | reference "XOS: service-specific-attribute"; |
| 110 | description "backwards-compatible attribute association"; |
| 111 | } |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 112 | leaf service-specific-id { |
Peter K. Lee | 4d93689 | 2016-09-13 11:59:21 -0700 | [diff] [blame^] | 113 | type xtype:unique-identifier; |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 114 | mandatory true; |
Peter K. Lee | 2da7863 | 2016-09-06 21:02:47 -0700 | [diff] [blame] | 115 | status deprecated; |
| 116 | } |
Peter K. Lee | 2da7863 | 2016-09-06 21:02:47 -0700 | [diff] [blame] | 117 | container record { |
| 118 | if-feature synchronizer; |
Peter K. Lee | 0db45ac | 2016-09-13 00:30:37 -0700 | [diff] [blame] | 119 | uses sync-record; |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 120 | } |
Peter K. Lee | cb2eb92 | 2016-09-01 18:02:31 -0700 | [diff] [blame] | 121 | } |
Peter K. Lee | cb2eb92 | 2016-09-01 18:02:31 -0700 | [diff] [blame] | 122 | grouping tenant-root { |
Peter K. Lee | 0db45ac | 2016-09-13 00:30:37 -0700 | [diff] [blame] | 123 | uses base-common { |
Peter K. Lee | cb2eb92 | 2016-09-01 18:02:31 -0700 | [diff] [blame] | 124 | refine 'name' { |
| 125 | description "Specify name of the TenantRoot"; |
| 126 | } |
| 127 | } |
| 128 | description |
| 129 | "A Tenant Root is one of the things that can sit at the root of a chain |
| 130 | of tenancy. This object represents a node."; |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 131 | |
Peter K. Lee | af777da | 2016-08-17 04:33:00 -0700 | [diff] [blame] | 132 | list subscribed-tenant { |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 133 | config false; |
| 134 | // not exactly clear how this is populated |
| 135 | } |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 136 | } |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 137 | grouping subscriber { |
| 138 | uses tenant-root { |
| 139 | refine kind { default subscriber; } |
| 140 | } |
| 141 | // seems we should have interesting attributes specific to subscriber? |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 142 | } |
Peter K. Lee | cb2eb92 | 2016-09-01 18:02:31 -0700 | [diff] [blame] | 143 | grouping provider { |
| 144 | uses tenant-root { |
| 145 | refine kind { default provider; } |
| 146 | } |
| 147 | // seems we should have interesting attributes specific to provider? |
| 148 | } |
Peter K. Lee | cb2eb92 | 2016-09-01 18:02:31 -0700 | [diff] [blame] | 149 | grouping service { |
Peter K. Lee | 0db45ac | 2016-09-13 00:30:37 -0700 | [diff] [blame] | 150 | uses base-common { |
Peter K. Lee | cb2eb92 | 2016-09-01 18:02:31 -0700 | [diff] [blame] | 151 | refine 'name' { |
| 152 | description "Name of the Service"; |
| 153 | } |
| 154 | } |
Peter K. Lee | 0db45ac | 2016-09-13 00:30:37 -0700 | [diff] [blame] | 155 | leaf kind { |
| 156 | type identityref { |
| 157 | base kind; |
| 158 | } |
| 159 | default generic; |
| 160 | } |
Peter K. Lee | cb2eb92 | 2016-09-01 18:02:31 -0700 | [diff] [blame] | 161 | leaf description { |
| 162 | type string { |
| 163 | length 0..254; |
| 164 | } |
| 165 | description "Description of the Service"; |
| 166 | } |
| 167 | leaf version { |
| 168 | type string { length 0..30; } |
| 169 | description "Version of Service Definition"; |
| 170 | } |
| 171 | |
| 172 | leaf enabled { type boolean; default true; } |
| 173 | leaf published { type boolean; default true; } |
| 174 | |
Peter K. Lee | 2da7863 | 2016-09-06 21:02:47 -0700 | [diff] [blame] | 175 | container links { |
Peter K. Lee | cb2eb92 | 2016-09-01 18:02:31 -0700 | [diff] [blame] | 176 | leaf view { type inet:uri; } |
| 177 | leaf icon { type inet:uri; } |
| 178 | } |
| 179 | |
| 180 | list keypair { |
| 181 | description "collection of public/private key pair(s)"; |
Peter K. Lee | 2da7863 | 2016-09-06 21:02:47 -0700 | [diff] [blame] | 182 | // should be a specific typedef for storing this content |
Peter K. Lee | cb2eb92 | 2016-09-01 18:02:31 -0700 | [diff] [blame] | 183 | leaf public { type string { length 0..1024; } } |
| 184 | leaf private { type string { length 0..1024; } } |
| 185 | } |
Peter K. Lee | 0db45ac | 2016-09-13 00:30:37 -0700 | [diff] [blame] | 186 | list provider { |
| 187 | description |
| 188 | "Each entry represents a provider of the service. Each unique service |
| 189 | should augment this block with service specific attributes."; |
| 190 | key id; |
| 191 | uses xos:provider; |
| 192 | } |
| 193 | list subscriber { |
| 194 | description |
| 195 | "Each entry represents a subscriber of the service. Each unique service |
| 196 | should augment this block with service specific attributes."; |
| 197 | key id; |
| 198 | uses xos:subscriber; |
| 199 | notification subscriber-added; |
| 200 | notification subscriber-deleted; |
| 201 | } |
Peter K. Lee | c396050 | 2016-09-13 11:47:02 -0700 | [diff] [blame] | 202 | list slice { |
| 203 | uses xos:slice; |
| 204 | } |
Peter K. Lee | cb2eb92 | 2016-09-01 18:02:31 -0700 | [diff] [blame] | 205 | |
| 206 | // TOOD: need to better understand relationship between Service and Slice |
| 207 | action scale { |
| 208 | description "Adjust scale for slice(s)"; |
| 209 | } |
| 210 | |
| 211 | // TODO: need to better understand relationship between Service and VTN |
| 212 | } |
| 213 | |
| 214 | grouping tenancy { |
Peter K. Lee | 0db45ac | 2016-09-13 00:30:37 -0700 | [diff] [blame] | 215 | uses base-common; |
Peter K. Lee | cb2eb92 | 2016-09-01 18:02:31 -0700 | [diff] [blame] | 216 | |
| 217 | choice provider { |
| 218 | description "only one type of provider node is valid."; |
| 219 | case service { leaf provider-service { type instance-identifier; } } |
| 220 | } |
| 221 | |
| 222 | choice subscriber { |
| 223 | description "only one type of subscriber node is valid."; |
| 224 | case service { leaf subscriber-service { type instance-identifier; } } |
| 225 | case tenant { leaf subscriber-tenant { type instance-identifier; } } |
| 226 | case user { leaf subscriber-user { type instance-identifier; } } |
| 227 | case root { leaf subscriber-root { type instance-identifier; } } |
| 228 | case network { leaf subscriber-network { type instance-identifier; } } |
| 229 | } |
| 230 | |
| 231 | leaf connect-method { |
| 232 | //when "../kind == 'static-tenant'"; |
| 233 | |
| 234 | type enumeration { |
| 235 | enum public { description "Public"; } |
| 236 | enum private { description "Private"; } |
| 237 | enum private-unidirectional { description "Private Uni-directional"; } |
| 238 | enum na { description "Not Applicable"; } |
| 239 | } |
| 240 | default na; |
| 241 | } |
| 242 | |
| 243 | // TODO: should be able to deal with TenantWithContainer here |
| 244 | |
| 245 | } |
sb98052 | 9d242b1 | 2016-09-13 20:47:26 +0200 | [diff] [blame] | 246 | |
| 247 | grouping slice { |
| 248 | description |
| 249 | "A slice is a logically centralized container for network and compute resources" |
| 250 | |
| 251 | uses base-common; |
| 252 | |
| 253 | leaf enabled { |
| 254 | type boolean; |
| 255 | default true; |
| 256 | } |
| 257 | |
| 258 | leaf omf-friendly { |
| 259 | type boolean; |
| 260 | default false; |
| 261 | status deprecated; |
| 262 | } |
| 263 | |
| 264 | leaf slice-url { |
| 265 | description "A URL describing the purpose of this slice"; |
Peter K. Lee | 4d93689 | 2016-09-13 11:59:21 -0700 | [diff] [blame^] | 266 | type xtype:url-field; |
sb98052 | 9d242b1 | 2016-09-13 20:47:26 +0200 | [diff] [blame] | 267 | // blank true; |
| 268 | } |
| 269 | |
| 270 | leaf max-instances { |
| 271 | description "The maximum number of VMs that this slice is allowed to allocate"; |
| 272 | type uint32; |
| 273 | } |
| 274 | |
| 275 | leaf service { |
| 276 | description "The service that runs in this slice"; |
Peter K. Lee | 4d93689 | 2016-09-13 11:59:21 -0700 | [diff] [blame^] | 277 | type xtype:service; |
sb98052 | 9d242b1 | 2016-09-13 20:47:26 +0200 | [diff] [blame] | 278 | } |
| 279 | |
| 280 | leaf network { |
| 281 | description "The network that the slice uses to connect to other slices and to the Internet."; |
| 282 | type string; |
| 283 | } |
| 284 | |
| 285 | leaf exposed-ports { |
| 286 | description "The ports to be exposed for other slices to connect to"; |
| 287 | type string; |
| 288 | } |
| 289 | |
| 290 | leaf service-class { |
Peter K. Lee | 4d93689 | 2016-09-13 11:59:21 -0700 | [diff] [blame^] | 291 | type xtype:service-class; |
| 292 | status deprecated; |
sb98052 | 9d242b1 | 2016-09-13 20:47:26 +0200 | [diff] [blame] | 293 | } |
| 294 | |
| 295 | leaf creator { |
Peter K. Lee | 4d93689 | 2016-09-13 11:59:21 -0700 | [diff] [blame^] | 296 | type xtype:user; |
sb98052 | 9d242b1 | 2016-09-13 20:47:26 +0200 | [diff] [blame] | 297 | } |
| 298 | |
| 299 | leaf default-flavor { |
Peter K. Lee | 4d93689 | 2016-09-13 11:59:21 -0700 | [diff] [blame^] | 300 | type xtype:flavor; |
sb98052 | 9d242b1 | 2016-09-13 20:47:26 +0200 | [diff] [blame] | 301 | } |
| 302 | |
| 303 | leaf default-image { |
Peter K. Lee | 4d93689 | 2016-09-13 11:59:21 -0700 | [diff] [blame^] | 304 | type xtype:image; |
sb98052 | 9d242b1 | 2016-09-13 20:47:26 +0200 | [diff] [blame] | 305 | } |
| 306 | |
| 307 | leaf default-node { |
Peter K. Lee | 4d93689 | 2016-09-13 11:59:21 -0700 | [diff] [blame^] | 308 | type xtype:node; |
sb98052 | 9d242b1 | 2016-09-13 20:47:26 +0200 | [diff] [blame] | 309 | } |
| 310 | |
| 311 | leaf mount-data-sets { |
Peter K. Lee | 4d93689 | 2016-09-13 11:59:21 -0700 | [diff] [blame^] | 312 | type string { |
| 313 | length 0..256; |
| 314 | } |
| 315 | default "GenBank"; |
sb98052 | 9d242b1 | 2016-09-13 20:47:26 +0200 | [diff] [blame] | 316 | } |
| 317 | |
| 318 | leaf default_isolation { |
Peter K. Lee | 4d93689 | 2016-09-13 11:59:21 -0700 | [diff] [blame^] | 319 | type string { |
| 320 | length 0..30; |
| 321 | } |
| 322 | default "vm"; |
sb98052 | 9d242b1 | 2016-09-13 20:47:26 +0200 | [diff] [blame] | 323 | } |
| 324 | |
| 325 | leaf-list tags { |
Peter K. Lee | 4d93689 | 2016-09-13 11:59:21 -0700 | [diff] [blame^] | 326 | // below leafref is not valid since there is no /tag |
| 327 | type leafref { |
| 328 | path "/tag[id = current()/../id]/id"; |
| 329 | } |
sb98052 | 9d242b1 | 2016-09-13 20:47:26 +0200 | [diff] [blame] | 330 | } |
| 331 | } |
Peter K. Lee | cb2eb92 | 2016-09-01 18:02:31 -0700 | [diff] [blame] | 332 | |
Peter K. Lee | f4d38d3 | 2016-07-23 02:47:38 -0700 | [diff] [blame] | 333 | /*** main configuration tree for XOS ***/ |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 334 | |
| 335 | container api { |
Peter K. Lee | f4d38d3 | 2016-07-23 02:47:38 -0700 | [diff] [blame] | 336 | description |
| 337 | "The primary configuration interaction endpoint"; |
| 338 | |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 339 | container service { |
Peter K. Lee | f4d38d3 | 2016-07-23 02:47:38 -0700 | [diff] [blame] | 340 | description |
| 341 | "placeholder endpoint for services to augment"; |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 342 | } |
| 343 | container tenant { |
Peter K. Lee | f4d38d3 | 2016-07-23 02:47:38 -0700 | [diff] [blame] | 344 | description |
| 345 | "placeholder endpoint for tenants to augment"; |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 346 | } |
| 347 | } |
| 348 | |
| 349 | } |