Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 1 | module cord-subscriber { |
Peter K. Lee | 5539580 | 2016-07-15 18:25:40 -0700 | [diff] [blame] | 2 | namespace "urn:onlab:cord:subscriber"; |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 3 | prefix cord-sub; |
| 4 | yang-version 1.1; |
| 5 | |
| 6 | organization |
| 7 | "Open Networking Lab (CORD) / Corenova Technologies"; |
| 8 | |
| 9 | contact |
| 10 | "Larry Peterson <llp@onlab.us> |
| 11 | Peter K. Lee <peter@corenova.com>"; |
| 12 | |
| 13 | import xos-core { prefix xos; } |
| 14 | import cord-device { prefix dev; } |
| 15 | import ietf-yang-types { prefix yang; } |
Peter K. Lee | cfb1e6f | 2016-07-19 10:01:45 -0700 | [diff] [blame^] | 16 | //import yang-node-link { prefix node; } |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 17 | |
| 18 | revision 2016-07-14 { |
| 19 | description "Initial revision."; |
| 20 | } |
| 21 | |
| 22 | identity cord-subscriber { base xos:subscriber; } |
| 23 | |
| 24 | grouping subscriber { |
| 25 | uses xos:subscriber { |
| 26 | refine kind { default cord-subscriber; } |
| 27 | } |
| 28 | leaf status { |
| 29 | type enumeration { |
| 30 | enum "enabled" { |
| 31 | description "Enabled"; |
| 32 | value 1; |
| 33 | } |
| 34 | enum "suspended" { |
| 35 | description "Suspended"; |
| 36 | } |
| 37 | enum "delinquent" { |
| 38 | description "Delinquent"; |
| 39 | } |
| 40 | enum "violation" { |
| 41 | description "Copyright Violation"; |
| 42 | } |
| 43 | } |
| 44 | default enabled; |
| 45 | } |
| 46 | leaf demo { type boolean; default false; } |
| 47 | leaf uplink-speed { |
| 48 | type dev:bandwidth; |
| 49 | default 1000000000; |
| 50 | } |
| 51 | leaf downlink-speed { |
| 52 | type dev:bandwidth; |
| 53 | default 1000000000; |
| 54 | } |
| 55 | |
| 56 | container services { |
| 57 | description |
| 58 | "Contains various services available to the subscriber"; |
| 59 | |
| 60 | container cdn { |
| 61 | leaf enabled { type boolean; default false; } |
| 62 | } |
| 63 | container firewall { |
| 64 | leaf enabled { type boolean; default false; } |
| 65 | leaf-list rules { |
| 66 | // should qualify further |
| 67 | type string; |
| 68 | } |
| 69 | } |
| 70 | container url-filter { |
| 71 | leaf enabled { type boolean; default false; } |
| 72 | leaf level { |
| 73 | type enumeration { |
| 74 | enum "PG"; |
| 75 | // other types of level... |
| 76 | } |
| 77 | } |
| 78 | leaf-list rules { |
| 79 | // should qualify further |
| 80 | type string; |
| 81 | } |
| 82 | } |
| 83 | container uverse { |
| 84 | leaf enabled { type boolean; default false; } |
| 85 | } |
| 86 | } |
| 87 | |
| 88 | list devices { |
| 89 | uses dev:device; |
| 90 | key 'mac'; |
| 91 | |
| 92 | action create { |
| 93 | input { |
| 94 | leaf mac { |
| 95 | type yang:mac-address; |
| 96 | mandatory true; |
| 97 | } |
| 98 | // other acceptable attributes that can be used during create |
| 99 | } |
| 100 | } |
| 101 | action update { |
| 102 | input { |
| 103 | leaf mac { |
| 104 | type yang:mac-address; |
| 105 | //must "../.[mac = current()]"; |
| 106 | mandatory true; |
| 107 | } |
| 108 | // other acceptable attributes for updating |
| 109 | } |
| 110 | } |
| 111 | action delete { |
| 112 | input { |
| 113 | leaf mac { |
| 114 | type yang:mac-address; |
| 115 | //must "../.[mac = current()]"; |
| 116 | mandatory true; |
| 117 | } |
| 118 | // other acceptable attributes for updating |
| 119 | } |
| 120 | } |
| 121 | } |
Peter K. Lee | 3145d03 | 2016-07-14 17:24:57 -0700 | [diff] [blame] | 122 | |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 123 | action save { |
| 124 | description "when invoked, saves the model to a safe place"; |
| 125 | } |
| 126 | } |
| 127 | |
| 128 | grouping subscriber-controller { |
| 129 | uses subscriber; |
| 130 | |
| 131 | container features { |
Peter K. Lee | cfb1e6f | 2016-07-19 10:01:45 -0700 | [diff] [blame^] | 132 | leaf cdn { |
| 133 | //path "../../services/cdn/enabled"; |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 134 | } |
Peter K. Lee | cfb1e6f | 2016-07-19 10:01:45 -0700 | [diff] [blame^] | 135 | leaf uplink-speed { |
| 136 | //path "../../uplink-speed"; |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 137 | } |
Peter K. Lee | cfb1e6f | 2016-07-19 10:01:45 -0700 | [diff] [blame^] | 138 | leaf downlink-speed { |
| 139 | //path "../../downlink-speed"; |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 140 | } |
Peter K. Lee | cfb1e6f | 2016-07-19 10:01:45 -0700 | [diff] [blame^] | 141 | leaf uverse { |
| 142 | //path "../../services/uverse/enabled"; |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 143 | } |
Peter K. Lee | cfb1e6f | 2016-07-19 10:01:45 -0700 | [diff] [blame^] | 144 | leaf status { |
| 145 | //path "../../status"; |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 146 | } |
| 147 | action update { |
| 148 | description "when invoked, updates the features container (PUT)"; |
| 149 | } |
| 150 | } |
| 151 | |
| 152 | container identity { |
Peter K. Lee | cfb1e6f | 2016-07-19 10:01:45 -0700 | [diff] [blame^] | 153 | leaf account-num { |
| 154 | //path "../../service-specific-id"; |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 155 | } |
Peter K. Lee | cfb1e6f | 2016-07-19 10:01:45 -0700 | [diff] [blame^] | 156 | leaf name { |
| 157 | //path "../../name"; |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 158 | } |
| 159 | action update { |
| 160 | description "when invoked, updates the identity container (PUT)"; |
| 161 | } |
| 162 | } |
| 163 | |
| 164 | container related { |
| 165 | // placeholder where other services can augment for their info |
| 166 | } |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 167 | } |
| 168 | |
| 169 | // primary configuration tree for this module |
| 170 | list subscriber { |
| 171 | uses subscriber-controller; |
| 172 | key 'id'; |
| 173 | |
| 174 | description |
| 175 | "Authorative list of all subscriber instances"; |
| 176 | |
| 177 | leaf humanReadableName { |
| 178 | config false; |
| 179 | type string { |
| 180 | pattern '^cordSubscriber-\w+$'; |
| 181 | } |
| 182 | } |
Peter K. Lee | 3145d03 | 2016-07-14 17:24:57 -0700 | [diff] [blame] | 183 | action create; |
| 184 | action delete; |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 185 | } |
| 186 | |
| 187 | // here we augment the /api/tenant/cord API configuration tree in 'xos' module |
| 188 | augment "/xos:api/xos:tenant/xos:cord" { |
Peter K. Lee | cfb1e6f | 2016-07-19 10:01:45 -0700 | [diff] [blame^] | 189 | container subscriber { |
| 190 | //path "/subscriber"; |
| 191 | } |
Peter K. Lee | 2bade4d | 2016-07-14 16:19:56 -0700 | [diff] [blame] | 192 | } |
| 193 | |
| 194 | } |