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; |
| 38 | identity generic { base kind; } |
| 39 | identity subscriber { base kind; } |
| 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 | } |
| 49 | |
Peter K. Lee | 2da7863 | 2016-09-06 21:02:47 -0700 | [diff] [blame^] | 50 | grouping xos-attribute { |
Peter K. Lee | cb2eb92 | 2016-09-01 18:02:31 -0700 | [diff] [blame] | 51 | leaf name { type string { length 0..128; } } |
| 52 | leaf value { type string; } |
| 53 | // don't need pointer back to service |
| 54 | } |
Peter K. Lee | 2da7863 | 2016-09-06 21:02:47 -0700 | [diff] [blame^] | 55 | |
| 56 | grouping xos-sync-record { |
| 57 | description "Synchronizer-specific properties for model records"; |
| 58 | |
| 59 | leaf created { type yang:date-and-time; } |
| 60 | leaf updated { type yang:date-and-time; } |
| 61 | leaf enacted { type yang:date-and-time; } |
| 62 | leaf policed { type yang:date-and-time; } |
| 63 | |
| 64 | leaf writable { type boolean; default true; } |
| 65 | leaf locked { type boolean; default false; } |
| 66 | leaf deleted { type boolean; default false; } |
| 67 | |
| 68 | leaf dirty { |
| 69 | config false; |
| 70 | type boolean; |
| 71 | default false; |
| 72 | } |
| 73 | |
| 74 | container sync { |
| 75 | anydata register { |
| 76 | description "scratchpad used by the Observer"; |
| 77 | } |
| 78 | leaf progress { |
| 79 | type enumeration { |
| 80 | enum provisioning { |
| 81 | value 0; |
| 82 | description "Provisioning in progress"; |
| 83 | } |
| 84 | } |
| 85 | } |
| 86 | leaf disabled { type boolean; default false; } |
| 87 | leaf enforced { type boolean; default true; } |
| 88 | |
| 89 | list policy { |
| 90 | // TODO: how are policy defined/enforced? |
| 91 | } |
| 92 | } |
| 93 | |
| 94 | action diff { |
| 95 | when "../dirty == true"; |
| 96 | description "retrieve diff of model state if dirty"; |
| 97 | } |
| 98 | action save { |
| 99 | description "trigger save into data store via synchronizer"; |
| 100 | } |
| 101 | } |
Peter K. Lee | cb2eb92 | 2016-09-01 18:02:31 -0700 | [diff] [blame] | 102 | |
| 103 | grouping xos-base { |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 104 | leaf id { |
| 105 | type unique-identifier; |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 106 | mandatory true; |
| 107 | } |
| 108 | leaf kind { |
| 109 | type identityref { |
| 110 | base kind; |
| 111 | } |
| 112 | default generic; |
| 113 | } |
| 114 | leaf name { |
| 115 | type string { |
| 116 | length 0..255; |
| 117 | } |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 118 | } |
Peter K. Lee | 2da7863 | 2016-09-06 21:02:47 -0700 | [diff] [blame^] | 119 | |
| 120 | list attribute { |
| 121 | uses xos-attribute; |
| 122 | key name; |
| 123 | status deprecated; |
| 124 | reference "XOS: service-specific-attribute"; |
| 125 | description "backwards-compatible attribute association"; |
| 126 | } |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 127 | leaf service-specific-id { |
| 128 | type unique-identifier; |
| 129 | mandatory true; |
Peter K. Lee | 2da7863 | 2016-09-06 21:02:47 -0700 | [diff] [blame^] | 130 | status deprecated; |
| 131 | } |
| 132 | |
| 133 | container record { |
| 134 | if-feature synchronizer; |
| 135 | uses xos-sync-record; |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 136 | } |
Peter K. Lee | cb2eb92 | 2016-09-01 18:02:31 -0700 | [diff] [blame] | 137 | } |
| 138 | |
| 139 | grouping tenant-root { |
| 140 | uses xos-base { |
| 141 | refine 'name' { |
| 142 | description "Specify name of the TenantRoot"; |
| 143 | } |
| 144 | } |
| 145 | description |
| 146 | "A Tenant Root is one of the things that can sit at the root of a chain |
| 147 | of tenancy. This object represents a node."; |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 148 | |
Peter K. Lee | af777da | 2016-08-17 04:33:00 -0700 | [diff] [blame] | 149 | list subscribed-tenant { |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 150 | config false; |
| 151 | // not exactly clear how this is populated |
| 152 | } |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 153 | } |
| 154 | |
| 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 | |
| 162 | grouping provider { |
| 163 | uses tenant-root { |
| 164 | refine kind { default provider; } |
| 165 | } |
| 166 | // seems we should have interesting attributes specific to provider? |
| 167 | } |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 168 | |
Peter K. Lee | cb2eb92 | 2016-09-01 18:02:31 -0700 | [diff] [blame] | 169 | grouping service { |
| 170 | uses xos-base { |
| 171 | refine 'name' { |
| 172 | description "Name of the Service"; |
| 173 | } |
| 174 | } |
| 175 | leaf description { |
| 176 | type string { |
| 177 | length 0..254; |
| 178 | } |
| 179 | description "Description of the Service"; |
| 180 | } |
| 181 | leaf version { |
| 182 | type string { length 0..30; } |
| 183 | description "Version of Service Definition"; |
| 184 | } |
| 185 | |
| 186 | leaf enabled { type boolean; default true; } |
| 187 | leaf published { type boolean; default true; } |
| 188 | |
Peter K. Lee | 2da7863 | 2016-09-06 21:02:47 -0700 | [diff] [blame^] | 189 | container links { |
Peter K. Lee | cb2eb92 | 2016-09-01 18:02:31 -0700 | [diff] [blame] | 190 | leaf view { type inet:uri; } |
| 191 | leaf icon { type inet:uri; } |
| 192 | } |
| 193 | |
| 194 | list keypair { |
| 195 | description "collection of public/private key pair(s)"; |
Peter K. Lee | 2da7863 | 2016-09-06 21:02:47 -0700 | [diff] [blame^] | 196 | // should be a specific typedef for storing this content |
Peter K. Lee | cb2eb92 | 2016-09-01 18:02:31 -0700 | [diff] [blame] | 197 | leaf public { type string { length 0..1024; } } |
| 198 | leaf private { type string { length 0..1024; } } |
| 199 | } |
| 200 | |
| 201 | // TOOD: need to better understand relationship between Service and Slice |
| 202 | action scale { |
| 203 | description "Adjust scale for slice(s)"; |
| 204 | } |
| 205 | |
| 206 | // TODO: need to better understand relationship between Service and VTN |
| 207 | } |
| 208 | |
| 209 | grouping tenancy { |
| 210 | uses xos-base; |
| 211 | |
| 212 | choice provider { |
| 213 | description "only one type of provider node is valid."; |
| 214 | case service { leaf provider-service { type instance-identifier; } } |
| 215 | } |
| 216 | |
| 217 | choice subscriber { |
| 218 | description "only one type of subscriber node is valid."; |
| 219 | case service { leaf subscriber-service { type instance-identifier; } } |
| 220 | case tenant { leaf subscriber-tenant { type instance-identifier; } } |
| 221 | case user { leaf subscriber-user { type instance-identifier; } } |
| 222 | case root { leaf subscriber-root { type instance-identifier; } } |
| 223 | case network { leaf subscriber-network { type instance-identifier; } } |
| 224 | } |
| 225 | |
| 226 | leaf connect-method { |
| 227 | //when "../kind == 'static-tenant'"; |
| 228 | |
| 229 | type enumeration { |
| 230 | enum public { description "Public"; } |
| 231 | enum private { description "Private"; } |
| 232 | enum private-unidirectional { description "Private Uni-directional"; } |
| 233 | enum na { description "Not Applicable"; } |
| 234 | } |
| 235 | default na; |
| 236 | } |
| 237 | |
| 238 | // TODO: should be able to deal with TenantWithContainer here |
| 239 | |
| 240 | } |
| 241 | |
Peter K. Lee | f4d38d3 | 2016-07-23 02:47:38 -0700 | [diff] [blame] | 242 | /*** main configuration tree for XOS ***/ |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 243 | |
| 244 | container api { |
Peter K. Lee | f4d38d3 | 2016-07-23 02:47:38 -0700 | [diff] [blame] | 245 | description |
| 246 | "The primary configuration interaction endpoint"; |
| 247 | |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 248 | container service { |
Peter K. Lee | f4d38d3 | 2016-07-23 02:47:38 -0700 | [diff] [blame] | 249 | description |
| 250 | "placeholder endpoint for services to augment"; |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 251 | } |
| 252 | container tenant { |
Peter K. Lee | f4d38d3 | 2016-07-23 02:47:38 -0700 | [diff] [blame] | 253 | description |
| 254 | "placeholder endpoint for tenants to augment"; |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 255 | } |
| 256 | } |
| 257 | |
| 258 | } |