1 module nfv-infrastructure {
2 namespace "urn:opnfv:promise:nfv:infrastructure";
5 import access-control-models { prefix acm; }
6 import ietf-inet-types { prefix inet; }
7 import ietf-yang-types { prefix yang; }
8 import complex-types { prefix ct; }
11 "NFV Infrastructure Data Models with complex types and typed instance
12 identifiers representing the various ResourceElements available
13 in the infrastructure across compute, network, and storage.";
17 "Introduce capacity and element collection into NFVI models";
22 "This YANG module is modeled using 'yangforge' which natively provides
23 complex types and typed instance identifiers. This module
24 provides various collections of resource management data models
25 for instance based management";
29 description "used by specific modules implementing manager role for NFVI";
32 grouping compute-capacity {
33 leaf cores { type int16; default 0; }
34 leaf ram { type int32; default 0; units 'MB'; }
35 leaf instances { type int16; default 0; }
38 grouping network-capacity {
39 leaf networks { type int16; default 0; }
40 leaf ports { type int16; default 0; }
41 leaf routers { type int16; default 0; }
42 leaf subnets { type int16; default 0; }
43 leaf addresses { type int32; default 0; }
46 grouping storage-capacity {
47 leaf gigabytes { type int32; default 0; units 'GB'; }
48 leaf snapshots { type int16; default 0; }
49 leaf volumes { type int16; default 0; }
52 grouping resource-capacity {
53 uses compute-capacity;
54 uses network-capacity;
55 uses storage-capacity;
58 grouping resource-collection {
60 "Information model capturing parameters for describing a collection of
61 resource capacity and resource elements";
63 container capacity { uses resource-capacity; }
65 type instance-identifier {
66 ct:instance-type nfvi:ResourceElement;
67 require-instance true;
72 grouping resource-stack {
74 "Information model describing a NFVI resource stack comprising of
75 various resource elements across compute, network, and storage";
77 ct:instance-list hosts { ct:instance-type nfvi:PhysicalHost; }
78 ct:instance-list hypervisors { ct:instance-type nfvi:Hypervisor; }
81 description "Contains compute related resources";
83 ct:instance-list servers { ct:instance-type nfvi:ServerInstance; }
84 ct:instance-list images { ct:instance-type nfvi:VirtualMachineImage; }
85 ct:instance-list flavors { ct:instance-type nfvi:ComputeFlavor; }
89 description "Contains networking related resources";
91 ct:instance-list networks { ct:instance-type nfvi:Network; }
92 ct:instance-list subnets { ct:instance-type nfvi:SubNetwork; }
93 ct:instance-list ports { ct:instance-type nfvi:SwitchPort; }
94 //ct:instance-list routers { ct:instance-type Router; }
98 /*********************************************
99 * Abstract Models (top-level)
100 *********************************************/
102 ct:complex-type ResourceElement {
106 leaf id { type yang:uuid; mandatory true; }
107 leaf name { type string; }
108 leaf enabled { type boolean; default true; }
109 leaf protected { type boolean; default false; }
110 leaf owner { type instance-identifier { ct:instance-type acm:Identity; } }
112 description "Specify visibility level available from the perspective of 'owner'";
122 leaf-list tags { type string; }
125 description "Optionally share with explicit list of members of AccessIdentity complex-type";
126 type instance-identifier {
127 ct:instance-type acm:Identity;
132 ct:complex-type ResourceInstance {
133 ct:extends ResourceElement;
144 type uint8 { range 0..100; }
149 ct:complex-type ResourceContainer {
150 ct:extends ResourceInstance;
154 "An abstract resource instance which contains a collection of capacity
157 uses resource-collection;
160 /*********************************************
162 *********************************************/
164 ct:complex-type AvailabilityZone {
165 ct:extends ResourceElement;
168 ct:complex-type PhysicalHost {
169 ct:extends ResourceElement;
171 leaf type { type string; }
172 leaf version { type string; }
174 leaf cpu { type uint8; }
175 leaf workload { type uint8; default 0; }
176 leaf uptime { type string; }
179 leaf total { type uint32; units 'MB'; }
180 leaf used { type uint32; units 'MB'; }
181 leaf free { type uint32; units 'MB'; }
184 leaf total { type uint32; units 'GB'; }
185 leaf used { type uint32; units 'GB'; }
186 leaf free { type uint32; units 'GB'; }
189 leaf-list hypervisors { type instance-identifier { ct:instance-type Hypervisor; } }
192 ct:complex-type Hypervisor {
193 ct:extends PhysicalHost;
196 type instance-identifier { ct:instance-type PhysicalHost; }
200 leaf total { type uint16; }
201 leaf used { type uint16; }
202 leaf free { type uint16; }
204 leaf-list servers { type instance-identifier { ct:instance-type ServerInstance; } }
207 ct:complex-type ComputeElement {
208 ct:extends ResourceElement;
211 container constraint {
212 leaf disk { type uint32; units 'GB'; default 0; }
213 leaf ram { type uint32; units 'MB'; default 0; }
214 leaf vcpu { type uint16; default 0; }
217 leaf-list instances {
218 description "State info about instances currently using this resource element";
219 type instance-identifier {
220 ct:instance-type ResourceInstance;
226 ct:complex-type VirtualMachineImage {
227 ct:extends ComputeElement;
230 leaf checksum { type string; mandatory true; }
231 leaf size { type uint32; units 'Bytes'; mandatory true; }
235 type enumeration { enum ami; enum ari; enum aki; enum bare; enum ovf; }
239 type enumeration { enum ami; enum ari; enum aki; enum vhd; enum vmdk; enum raw; enum qcow2; enum vdi; enum iso; }
243 description "should be a 'private' property so only direct access retrieves content";
249 ct:complex-type ComputeFlavor {
250 ct:extends ResourceElement;
252 leaf disk { type uint32; units 'GB'; default 0; }
253 leaf ram { type uint32; units 'MB'; default 0; }
254 leaf vcpus { type uint16; default 0; }
257 ct:complex-type ServerInstance {
258 ct:extends ResourceInstance;
261 type instance-identifier { ct:instance-type ComputeFlavor; }
265 type instance-identifier { ct:instance-type VirtualMachineImage; }
269 //ct:instance metadata { ct:instance-type MetaData; }
272 type instance-identifier { ct:instance-type PhysicalHost; }
275 leaf-list connections {
277 "References to collection of NetworkingElement class objects such as
278 Network, Subnet, Port, Router that this ServerInstance is
280 type instance-identifier { ct:instance-type NetworkElement; }
284 /*********************************************
285 * Network Models (Work-in-Progress)
286 *********************************************/
288 ct:complex-type NetworkElement {
289 ct:extends ResourceElement;
293 ct:complex-type Network {
294 ct:extends NetworkElement;
297 type instance-identifier { ct:instance-type SubNetwork; }
301 ct:complex-type SubNetwork {
302 ct:extends NetworkElement;
304 leaf network { type instance-identifier { ct:instance-type Network; } }
306 leaf-list nameservers { type string; }
309 leaf enabled { type boolean; }
311 leaf start { type inet:ip-address; }
312 leaf end { type inet:ip-address; }
317 ct:complex-type SwitchPort {
318 ct:extends NetworkElement;
320 leaf subnet { type instance-identifier { ct:instance-type SubNetwork; } }