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 | } |
| 140 | |
| 141 | grouping tenant-root { |
Peter K. Lee | 0db45ac | 2016-09-13 00:30:37 -0700 | [diff] [blame] | 142 | uses base-common { |
Peter K. Lee | cb2eb92 | 2016-09-01 18:02:31 -0700 | [diff] [blame] | 143 | refine 'name' { |
| 144 | description "Specify name of the TenantRoot"; |
| 145 | } |
| 146 | } |
| 147 | description |
| 148 | "A Tenant Root is one of the things that can sit at the root of a chain |
| 149 | of tenancy. This object represents a node."; |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 150 | |
Peter K. Lee | af777da | 2016-08-17 04:33:00 -0700 | [diff] [blame] | 151 | list subscribed-tenant { |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 152 | config false; |
| 153 | // not exactly clear how this is populated |
| 154 | } |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 155 | } |
| 156 | |
| 157 | grouping subscriber { |
| 158 | uses tenant-root { |
| 159 | refine kind { default subscriber; } |
| 160 | } |
| 161 | // seems we should have interesting attributes specific to subscriber? |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 162 | } |
Peter K. Lee | cb2eb92 | 2016-09-01 18:02:31 -0700 | [diff] [blame] | 163 | |
| 164 | grouping provider { |
| 165 | uses tenant-root { |
| 166 | refine kind { default provider; } |
| 167 | } |
| 168 | // seems we should have interesting attributes specific to provider? |
| 169 | } |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 170 | |
Peter K. Lee | cb2eb92 | 2016-09-01 18:02:31 -0700 | [diff] [blame] | 171 | grouping service { |
Peter K. Lee | 0db45ac | 2016-09-13 00:30:37 -0700 | [diff] [blame] | 172 | uses base-common { |
Peter K. Lee | cb2eb92 | 2016-09-01 18:02:31 -0700 | [diff] [blame] | 173 | refine 'name' { |
| 174 | description "Name of the Service"; |
| 175 | } |
| 176 | } |
Peter K. Lee | 0db45ac | 2016-09-13 00:30:37 -0700 | [diff] [blame] | 177 | leaf kind { |
| 178 | type identityref { |
| 179 | base kind; |
| 180 | } |
| 181 | default generic; |
| 182 | } |
Peter K. Lee | cb2eb92 | 2016-09-01 18:02:31 -0700 | [diff] [blame] | 183 | leaf description { |
| 184 | type string { |
| 185 | length 0..254; |
| 186 | } |
| 187 | description "Description of the Service"; |
| 188 | } |
| 189 | leaf version { |
| 190 | type string { length 0..30; } |
| 191 | description "Version of Service Definition"; |
| 192 | } |
| 193 | |
| 194 | leaf enabled { type boolean; default true; } |
| 195 | leaf published { type boolean; default true; } |
| 196 | |
Peter K. Lee | 2da7863 | 2016-09-06 21:02:47 -0700 | [diff] [blame] | 197 | container links { |
Peter K. Lee | cb2eb92 | 2016-09-01 18:02:31 -0700 | [diff] [blame] | 198 | leaf view { type inet:uri; } |
| 199 | leaf icon { type inet:uri; } |
| 200 | } |
| 201 | |
| 202 | list keypair { |
| 203 | description "collection of public/private key pair(s)"; |
Peter K. Lee | 2da7863 | 2016-09-06 21:02:47 -0700 | [diff] [blame] | 204 | // should be a specific typedef for storing this content |
Peter K. Lee | cb2eb92 | 2016-09-01 18:02:31 -0700 | [diff] [blame] | 205 | leaf public { type string { length 0..1024; } } |
| 206 | leaf private { type string { length 0..1024; } } |
| 207 | } |
Peter K. Lee | 0db45ac | 2016-09-13 00:30:37 -0700 | [diff] [blame] | 208 | list provider { |
| 209 | description |
| 210 | "Each entry represents a provider of the service. Each unique service |
| 211 | should augment this block with service specific attributes."; |
| 212 | key id; |
| 213 | uses xos:provider; |
| 214 | } |
| 215 | list subscriber { |
| 216 | description |
| 217 | "Each entry represents a subscriber of the service. Each unique service |
| 218 | should augment this block with service specific attributes."; |
| 219 | key id; |
| 220 | uses xos:subscriber; |
| 221 | notification subscriber-added; |
| 222 | notification subscriber-deleted; |
| 223 | } |
Peter K. Lee | cb2eb92 | 2016-09-01 18:02:31 -0700 | [diff] [blame] | 224 | |
| 225 | // TOOD: need to better understand relationship between Service and Slice |
| 226 | action scale { |
| 227 | description "Adjust scale for slice(s)"; |
| 228 | } |
| 229 | |
| 230 | // TODO: need to better understand relationship between Service and VTN |
| 231 | } |
| 232 | |
| 233 | grouping tenancy { |
Peter K. Lee | 0db45ac | 2016-09-13 00:30:37 -0700 | [diff] [blame] | 234 | uses base-common; |
Peter K. Lee | cb2eb92 | 2016-09-01 18:02:31 -0700 | [diff] [blame] | 235 | |
| 236 | choice provider { |
| 237 | description "only one type of provider node is valid."; |
| 238 | case service { leaf provider-service { type instance-identifier; } } |
| 239 | } |
| 240 | |
| 241 | choice subscriber { |
| 242 | description "only one type of subscriber node is valid."; |
| 243 | case service { leaf subscriber-service { type instance-identifier; } } |
| 244 | case tenant { leaf subscriber-tenant { type instance-identifier; } } |
| 245 | case user { leaf subscriber-user { type instance-identifier; } } |
| 246 | case root { leaf subscriber-root { type instance-identifier; } } |
| 247 | case network { leaf subscriber-network { type instance-identifier; } } |
| 248 | } |
| 249 | |
| 250 | leaf connect-method { |
| 251 | //when "../kind == 'static-tenant'"; |
| 252 | |
| 253 | type enumeration { |
| 254 | enum public { description "Public"; } |
| 255 | enum private { description "Private"; } |
| 256 | enum private-unidirectional { description "Private Uni-directional"; } |
| 257 | enum na { description "Not Applicable"; } |
| 258 | } |
| 259 | default na; |
| 260 | } |
| 261 | |
| 262 | // TODO: should be able to deal with TenantWithContainer here |
| 263 | |
| 264 | } |
sb98052 | 9d242b1 | 2016-09-13 20:47:26 +0200 | [diff] [blame^] | 265 | |
| 266 | grouping slice { |
| 267 | description |
| 268 | "A slice is a logically centralized container for network and compute resources" |
| 269 | |
| 270 | uses base-common; |
| 271 | |
| 272 | leaf enabled { |
| 273 | type boolean; |
| 274 | default true; |
| 275 | } |
| 276 | |
| 277 | leaf omf-friendly { |
| 278 | type boolean; |
| 279 | default false; |
| 280 | status deprecated; |
| 281 | } |
| 282 | |
| 283 | leaf slice-url { |
| 284 | description "A URL describing the purpose of this slice"; |
| 285 | type xos.refs.url-field; |
| 286 | // blank true; |
| 287 | } |
| 288 | |
| 289 | leaf max-instances { |
| 290 | description "The maximum number of VMs that this slice is allowed to allocate"; |
| 291 | type uint32; |
| 292 | } |
| 293 | |
| 294 | leaf service { |
| 295 | description "The service that runs in this slice"; |
| 296 | type xos.refs.service; |
| 297 | } |
| 298 | |
| 299 | leaf network { |
| 300 | description "The network that the slice uses to connect to other slices and to the Internet."; |
| 301 | type string; |
| 302 | } |
| 303 | |
| 304 | leaf exposed-ports { |
| 305 | description "The ports to be exposed for other slices to connect to"; |
| 306 | type string; |
| 307 | } |
| 308 | |
| 309 | leaf service-class { |
| 310 | type xos.refs.service-class; |
| 311 | status deprecated; |
| 312 | } |
| 313 | |
| 314 | leaf creator { |
| 315 | type xos.refs.user; |
| 316 | } |
| 317 | |
| 318 | leaf default-flavor { |
| 319 | type xos.refs.flavor; |
| 320 | } |
| 321 | |
| 322 | leaf default-image { |
| 323 | type xos.refs.image; |
| 324 | } |
| 325 | |
| 326 | leaf default-node { |
| 327 | type xos.refs.node; |
| 328 | } |
| 329 | |
| 330 | leaf mount-data-sets { |
| 331 | type string; |
| 332 | default "GenBank"; |
| 333 | length 0..256; |
| 334 | } |
| 335 | |
| 336 | leaf default_isolation { |
| 337 | type string; |
| 338 | default "vm"; |
| 339 | length 0..30; |
| 340 | } |
| 341 | |
| 342 | leaf-list tags { |
| 343 | type leafref { |
| 344 | path "/tag[id = current()/../id]/id"; |
| 345 | } |
| 346 | } |
| 347 | } |
Peter K. Lee | cb2eb92 | 2016-09-01 18:02:31 -0700 | [diff] [blame] | 348 | |
Peter K. Lee | f4d38d3 | 2016-07-23 02:47:38 -0700 | [diff] [blame] | 349 | /*** main configuration tree for XOS ***/ |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 350 | |
| 351 | container api { |
Peter K. Lee | f4d38d3 | 2016-07-23 02:47:38 -0700 | [diff] [blame] | 352 | description |
| 353 | "The primary configuration interaction endpoint"; |
| 354 | |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 355 | container service { |
Peter K. Lee | f4d38d3 | 2016-07-23 02:47:38 -0700 | [diff] [blame] | 356 | description |
| 357 | "placeholder endpoint for services to augment"; |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 358 | } |
| 359 | container tenant { |
Peter K. Lee | f4d38d3 | 2016-07-23 02:47:38 -0700 | [diff] [blame] | 360 | description |
| 361 | "placeholder endpoint for tenants to augment"; |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 362 | } |
| 363 | } |
| 364 | |
| 365 | } |