blob: 7ede4523ea83a0b30ba1a4340dcc0642cc6a821b [file] [log] [blame]
Sapan Bhatiacb35e7f2017-05-24 12:17:28 +02001option app_label = "core";
Scott Bakera33ccb02018-01-26 13:03:28 -08002option legacy="True";
Sapan Bhatiad022aeb2017-06-07 15:49:55 +02003
Matteo Scandoloee367fd2017-11-22 14:55:09 -08004// use thi policy to allow access to admins only
5policy admin_policy < ctx.user.is_admin >
6
Sapan Bhatia170ae272017-05-30 19:01:09 +02007message XOSBase {
Sapan Bhatiad022aeb2017-06-07 15:49:55 +02008 option skip_init = True;
Scott Bakera33ccb02018-01-26 13:03:28 -08009 option custom_header = "xosbase_header";
10 option abstract = True;
Sapan Bhatiacb35e7f2017-05-24 12:17:28 +020011
Scott Bakerd8246712018-07-12 18:08:31 -070012 required string created = 1 [content_type = "date", auto_now_add = True, help_text = "Time this model was created"];
13 required string updated = 2 [default = "now()", content_type = "date", help_text = "Time this model was changed by a non-synchronizer"];
14 optional string enacted = 3 [null = True, content_type = "date", blank = True, default = None, help_text = "When synced, set to the timestamp of the data that was synced"];
15 optional string policed = 4 [null = True, content_type = "date", blank = True, default = None, help_text = "When policed, set to the timestamp of the data that was policed"];
Matteo Scandolo23cf15f2018-03-06 18:12:36 -080016 optional string backend_register = 5 [default = "{}", max_length = 1024, feedback_state = True];
Matteo Scandoloe16797a2017-10-03 17:01:22 -070017 required bool backend_need_delete = 6 [default = False, blank = True];
18 required bool backend_need_reap = 7 [default = False, blank = True];
Matteo Scandolo23cf15f2018-03-06 18:12:36 -080019 required string backend_status = 8 [default = "Provisioning in progress", max_length = 1024, null = True, feedback_state = True];
20 required int32 backend_code = 9 [default = 0, feedback_state = True];
Matteo Scandoloe16797a2017-10-03 17:01:22 -070021 required bool deleted = 10 [default = False, blank = True];
22 required bool write_protect = 12 [default = False, blank = True];
23 required bool lazy_blocked = 13 [default = False, blank = True];
24 required bool no_sync = 14 [default = False, blank = True];
25 required bool no_policy = 15 [default = False, blank = True];
Matteo Scandolo23cf15f2018-03-06 18:12:36 -080026 optional string policy_status = 16 [default = "Policy in process", max_length = 1024, feedback_state = True];
27 optional int32 policy_code = 16 [default = 0, feedback_state = True];
Sapan Bhatiada5e4442017-08-27 09:51:13 -040028 required string leaf_model_name = 17 [null = False, max_length = 1024, help_text = "The most specialized model in this chain of inheritance, often defined by a service developer"];
Matteo Scandoloe16797a2017-10-03 17:01:22 -070029 required bool backend_need_delete_policy = 18 [default = False, help_text = "True if delete model_policy must be run before object can be reaped", blank = True];
Matteo Scandolo03bb4412018-07-26 16:38:58 -070030 required bool xos_managed = 19 [default = True, help_text = "True if xos is responsible for creating/deleting this object", blank = True, gui_hidden = True];
31 optional string backend_handle = 20 [max_length = 1024, feedback_state = True, blank=True, null=True, help_text = "Handle used by the backend to track this object", gui_hidden = True];
Scott Bakerd8246712018-07-12 18:08:31 -070032 optional string changed_by_step = 21 [null = True, content_type = "date", blank = True, default = None, gui_hidden = True, help_text = "Time this model was changed by a sync step"];
33 optional string changed_by_policy = 22 [null = True, content_type = "date", blank = True, default = None, gui_hidden = True, help_text = "Time this model was changed by a model policy"];
Sapan Bhatia170ae272017-05-30 19:01:09 +020034}
35
Sapan Bhatiab5ce1862017-07-31 15:48:19 -040036// The calling user represents the user being accessed, or is a site admin.
37policy user_policy <
38 ctx.user.is_admin
39 | ctx.user.id = obj.id
40 | (exists Privilege:
41 Privilege.accessor_id = ctx.user.id
42 & Privilege.accessor_type = "User"
43 & Privilege.permission = "role:admin"
44 & Privilege.object_type = "Site"
45 & Privilege.object_id = ctx.user.site.id) >
46
47message User::user_policy (AbstractBaseUser,PlModelMixIn) {
Sapan Bhatiad022aeb2017-06-07 15:49:55 +020048 option skip_django = True;
Matteo Scandoloe425f9d2017-08-15 15:56:19 -070049 option description = "An XOS User";
Sapan Bhatiacb35e7f2017-05-24 12:17:28 +020050
Matteo Scandoloc3c0f0a2017-10-18 09:53:30 +020051 required string email = 1 [db_index = True, max_length = 255, null = False, blank = False, tosca_key=True];
Sapan Bhatiad022aeb2017-06-07 15:49:55 +020052 required string username = 2 [default = "Something", max_length = 255, content_type = "stripped", blank = False, null = False, db_index = False];
Sapan Bhatiacb35e7f2017-05-24 12:17:28 +020053 required string password = 3 [default = "Something", max_length = 255, blank = False, null = False, db_index = False];
Sapan Bhatiaafce8fd2017-06-28 23:24:53 -070054 optional string last_login = 4 [db_index = False, null = True, content_type = "date", blank = True];
55 required string firstname = 5 [max_length = 200, content_type = "stripped", blank = False, help_text = "person's given name", null = False, db_index = False];
56 required string lastname = 6 [max_length = 200, content_type = "stripped", blank = False, help_text = "person's surname", null = False, db_index = False];
57 optional string phone = 7 [max_length = 100, content_type = "stripped", blank = True, help_text = "phone number contact", null = True, db_index = False];
58 optional string user_url = 8 [db_index = False, max_length = 200, null = True, content_type = "url", blank = True];
59 required manytoone site->Site:users = 9 [help_text = "Site this user will be homed too", null = False, db_index = True, blank = False];
60 optional string public_key = 10 [help_text = "Public key string", max_length = 1024, null = True, db_index = False, blank = True, varchar = True];
61 required bool is_active = 11 [default = True, null = False, db_index = False, blank = True];
62 required bool is_admin = 12 [default = False, null = False, db_index = False, blank = True];
63 required bool is_staff = 13 [default = True, null = False, db_index = False, blank = True];
64 required bool is_readonly = 14 [default = False, null = False, db_index = False, blank = True];
65 required bool is_registering = 15 [default = False, null = False, db_index = False, blank = True];
66 required bool is_appuser = 16 [default = False, null = False, db_index = False, blank = True];
67 optional string login_page = 17 [max_length = 200, content_type = "stripped", blank = True, help_text = "send this user to a specific page on login", null = True, db_index = False];
68 required string created = 18 [db_index = False, null = False, content_type = "date", blank = True];
69 required string updated = 19 [db_index = False, null = False, content_type = "date", blank = True];
70 optional string enacted = 20 [db_index = False, null = True, content_type = "date", blank = False];
71 optional string policed = 21 [db_index = False, null = True, content_type = "date", blank = False];
72 required string backend_status = 22 [default = "Provisioning in progress", max_length = 1024, content_type = "stripped", blank = False, null = False, db_index = False];
Scott Bakeraed4abd2017-12-01 15:23:35 -080073 required int32 backend_code = 34 [default = 0];
Sapan Bhatiaafce8fd2017-06-28 23:24:53 -070074 required bool backend_need_delete = 23 [default = False, null = False, db_index = False, blank = True];
75 required bool backend_need_reap = 24 [default = False, null = False, db_index = False, blank = True];
76 required bool deleted = 25 [default = False, null = False, db_index = False, blank = True];
77 required bool write_protect = 26 [default = False, null = False, db_index = False, blank = True];
78 required bool lazy_blocked = 27 [default = False, null = False, db_index = False, blank = True];
79 required bool no_sync = 28 [default = False, null = False, db_index = False, blank = True];
80 required bool no_policy = 29 [default = False, null = False, db_index = False, blank = True];
81 required string timezone = 30 [default = "America/New_York", max_length = 100, blank = False, null = False, db_index = False];
Scott Bakere08d0062017-07-11 12:04:26 -070082 optional string policy_status = 32 [default = "0 - Policy in process", max_length = 1024];
Scott Bakeraed4abd2017-12-01 15:23:35 -080083 optional int32 policy_code = 35 [default = 0];
Sapan Bhatiae8a9e6d2017-09-03 21:02:32 -040084 required string leaf_model_name = 33 [null = False, max_length = 1024, help_text = "The most specialized model in this chain of inheritance, often defined by a service developer"];
Scott Bakerd8246712018-07-12 18:08:31 -070085 required bool backend_need_delete_policy = 34 [default = False, help_text = "True if delete model_policy must be run before object can be reaped", blank = True];
86 required bool xos_managed = 35 [default = True, help_text = "True if xos is responsible for creating/deleting this object", blank = True, gui_hidden = True];
87 optional string backend_handle = 36 [max_length = 1024, feedback_state = True, blank=True, null=True, help_text = "Handle used by the backend to track this object", gui_hidden = True];
88 optional string changed_by_step = 37 [null = True, content_type = "date", blank = True, default = None, gui_hidden = True, help_text = "Time this model was changed by a sync step"];
89 optional string changed_by_policy = 38 [null = True, content_type = "date", blank = True, default = None, gui_hidden = True, help_text = "Time this model was changed by a model policy"];
Scott Bakere08d0062017-07-11 12:04:26 -070090}
Sapan Bhatiad022aeb2017-06-07 15:49:55 +020091
Sapan Bhatiab5ce1862017-07-31 15:48:19 -040092// A user may give a permission that he has to another user
93policy grant_policy < ctx.user.is_admin
94 | exists Privilege:Privilege.object_type = obj.object_type
95 & Privilege.object_id = obj.object_id
96 & Privilege.accessor_type = "User"
Kailash Khalasiacab7e12017-12-14 11:27:26 -080097 & Privilege.accessor_id = ctx.user.id
Sapan Bhatiab5ce1862017-07-31 15:48:19 -040098 & Privilege.permission = "role:admin" >
Kailash Khalasiacab7e12017-12-14 11:27:26 -080099
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400100message Privilege::grant_policy (XOSBase) {
Kailash Khalasiacab7e12017-12-14 11:27:26 -0800101 required int32 accessor_id = 1 [null = False, blank=False];
Scott Baker01fe9a32018-05-01 15:03:54 -0700102 required string accessor_type = 2 [null = False, max_length=1024, blank = False];
103 optional int32 controller_id = 3 [null = True, blank = True];
Kailash Khalasiacab7e12017-12-14 11:27:26 -0800104 required int32 object_id = 4 [null = False, blank=False];
Scott Baker01fe9a32018-05-01 15:03:54 -0700105 required string object_type = 5 [null = False, max_length=1024, blank = False];
Matteo Scandoloc3c0f0a2017-10-18 09:53:30 +0200106 required string permission = 6 [null = False, default = "all", max_length=1024, tosca_key=True];
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400107 required string granted = 7 [content_type = "date", auto_now_add = True, max_length=1024];
108 required string expires = 8 [content_type = "date", null = True, max_length=1024];
Sapan Bhatia8918ac32017-07-09 00:43:27 -0400109}
110
Sapan Bhatia170ae272017-05-30 19:01:09 +0200111message AddressPool (XOSBase) {
Scott Bakerc11206e2018-08-23 08:33:47 -0700112 required string name = 1 [db_index = False, max_length = 32, null = False, blank = False, unique = True, help_text="Name of this AddressPool"];
113 optional string addresses = 2 [db_index = False, null = True, blank = True, varchar = True, help_text="Space-separated list of available addresses"];
114 required string gateway_ip = 3 [db_index = False, max_length = 32, help_text="Gateway IP address for this AddressPool"];
115 required string gateway_mac = 4 [db_index = False, max_length = 32, help_text="Gateway MAC address for this AddressPool"];
116 required string cidr = 5 [db_index = False, max_length = 32, help_text="Subnet for this AddressPool"];
117 optional string inuse = 6 [db_index = False, null = True, blank = True, varchar = True, help_text="Space-separated list of inuse addresses"];
118 optional manytoone service->Service:addresspools = 7 [db_index = True, null = True, blank = True, help_text="Service this AddressPool belongs to"];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200119}
120
Scott Baker6b260ea2018-04-18 07:12:22 -0700121message ComputeServiceInstance (ServiceInstance) {
122 required manytoone slice->Slice:computeserviceinstances = 1 [db_index = True, null = False, blank = False, help_text = "Slice that controls this ServiceInstance"];
123 required manytoone image->Image:computeserviceinstances = 2 [db_index = True, null = False, blank = False, help_text = "Image used to instantiate this ServiceInstance"];
124}
125
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400126// Admins at a deployment have access to controllers at those deployments
127policy controller_policy
128 < ctx.user.is_admin
129 | exists Privilege:
130 Privilege.accessor_id = ctx.user.id
131 & Privilege.object_type = "Deployment"
132 & Privilege.permission = "role:admin"
133 & Privilege.object_id = obj.id >
Sapan Bhatia170ae272017-05-30 19:01:09 +0200134
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400135message Controller::controller_policy (XOSBase) {
Scott Bakereb782fc2018-04-27 13:50:21 -0700136 required string name = 1 [max_length = 200, content_type = "stripped", blank = False, help_text = "Name of the Controller", null = False, db_index = False, unique = True];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200137 required string backend_type = 2 [max_length = 200, content_type = "stripped", blank = False, help_text = "Type of compute controller, e.g. EC2, OpenStack, or OpenStack version", null = False, db_index = False];
138 required string version = 3 [max_length = 200, content_type = "stripped", blank = False, help_text = "Controller version", null = False, db_index = False];
139 optional string auth_url = 4 [max_length = 200, content_type = "stripped", blank = True, help_text = "Auth url for the compute controller", null = True, db_index = False];
140 optional string admin_user = 5 [max_length = 200, content_type = "stripped", blank = True, help_text = "Username of an admin user at this controller", null = True, db_index = False];
141 optional string admin_password = 6 [max_length = 200, content_type = "stripped", blank = True, help_text = "Password of theadmin user at this controller", null = True, db_index = False];
142 optional string admin_tenant = 7 [max_length = 200, content_type = "stripped", blank = True, help_text = "Name of the tenant the admin user belongs to", null = True, db_index = False];
143 optional string domain = 8 [max_length = 200, content_type = "stripped", blank = True, help_text = "Name of the domain this controller belongs to", null = True, db_index = False];
144 optional string rabbit_host = 9 [max_length = 200, content_type = "stripped", blank = True, help_text = "IP address of rabbitmq server at this controller", null = True, db_index = False];
145 optional string rabbit_user = 10 [max_length = 200, content_type = "stripped", blank = True, help_text = "Username of rabbitmq server at this controller", null = True, db_index = False];
146 optional string rabbit_password = 11 [max_length = 200, content_type = "stripped", blank = True, help_text = "Password of rabbitmq server at this controller", null = True, db_index = False];
147 required manytoone deployment->Deployment:controllerdeployments = 12 [db_index = True, null = False, blank = False];
148}
149
Sapan Bhatia170ae272017-05-30 19:01:09 +0200150message ControllerImages (XOSBase) {
Sapan Bhatiaf7934b52017-06-12 05:04:23 -0700151 required manytoone image->Image:controllerimages = 1 [db_index = True, null = False, blank = False, unique_with = "controller"];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200152 required manytoone controller->Controller:controllerimages = 2 [db_index = True, null = False, blank = False];
153 optional string glance_image_id = 3 [max_length = 200, content_type = "stripped", blank = True, help_text = "Glance image id", null = True, db_index = False];
154}
155
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400156// Everyone has read access
157// For write access, you have to be a site_admin
Sapan Bhatia170ae272017-05-30 19:01:09 +0200158
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400159policy site_policy <
160 ctx.user.is_admin
161 | (ctx.write_access -> exists Privilege: Privilege.object_type = "Site" & Privilege.object_id = obj.id & Privilege.accessor_id = ctx.user.id & Privilege.permission = "role:admin") >
162
163// If you can access (read or write) the site, you can also access its slices
164// Otherwise, you need an explicit privilege on the Slice (admin for write access)
165// or admin privilege on the associated site.
166policy slice_policy <
167 ctx.user.is_admin
168 | (*site_policy(site)
Sapan Bhatia3cee9482017-09-01 23:10:16 -0400169 & (ctx.user = obj.creator
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400170 | (exists Privilege:
171 Privilege.accessor_id = ctx.user.id
172 & Privilege.accessor_type = "User"
173 & Privilege.object_type = "Slice"
174 & Privilege.object_id = obj.id
175 & (ctx.write_access -> Privilege.permission = "role:admin"))
176 )
177 |
178 (exists Privilege:
179 Privilege.accessor_id = ctx.user.id
180 & Privilege.accessor_type = "User"
181 & Privilege.object_type = "Slice"
182 & Privilege.object_id = obj.id)
183 | (exists Privilege:
184 Privilege.accessor_id = ctx.user.id
185 & Privilege.accessor_type = "User"
186 & Privilege.object_type = "Site"
187 & Privilege.object_id = obj.site.id
188 & Privilege.permission = "role:admin")
189 ) >
190
191policy controller_network_policy <
192 ctx.user.is_admin
193 | *slice_policy(network.owner) >
194
195
196message ControllerNetwork::controller_network_policy (XOSBase) {
Sapan Bhatiaf7934b52017-06-12 05:04:23 -0700197 required manytoone network->Network:controllernetworks = 1 [db_index = True, null = False, blank = False, unique_with = "controller"];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200198 required manytoone controller->Controller:controllernetworks = 2 [db_index = True, null = False, blank = False];
199 required string subnet = 3 [db_index = False, max_length = 32, null = False, blank = True];
200 required string start_ip = 4 [db_index = False, max_length = 32, null = False, blank = True];
201 required string stop_ip = 5 [db_index = False, max_length = 32, null = False, blank = True];
202 optional string net_id = 6 [help_text = "Neutron network", max_length = 256, null = True, db_index = False, blank = True];
203 optional string router_id = 7 [help_text = "Neutron router id", max_length = 256, null = True, db_index = False, blank = True];
204 optional string subnet_id = 8 [help_text = "Neutron subnet id", max_length = 256, null = True, db_index = False, blank = True];
205 optional string gateway = 9 [db_index = False, max_length = 32, null = True, blank = True];
206 optional string segmentation_id = 10 [db_index = False, max_length = 32, null = True, blank = True];
207}
208
Sapan Bhatia170ae272017-05-30 19:01:09 +0200209message ControllerRole (XOSBase) {
210 required string role = 1 [choices = "(('admin', 'Admin'),)", max_length = 30, content_type = "stripped", blank = False, null = False, db_index = False];
211}
212
Sapan Bhatia170ae272017-05-30 19:01:09 +0200213message ControllerSite (XOSBase) {
Matteo Scandolo68ab5432017-12-06 15:38:13 -0800214 required manytoone site->Site:controllersite = 1 [db_index = True, null = False, blank = False, unique_with="controller", tosca_key = True];
215 optional manytoone controller->Controller:controllersite = 2 [db_index = True, null = True, blank = True, tosca_key = True];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200216 optional string tenant_id = 3 [max_length = 200, content_type = "stripped", blank = True, help_text = "Keystone tenant id", null = True, db_index = True];
217}
218
Sapan Bhatia170ae272017-05-30 19:01:09 +0200219message ControllerSitePrivilege (XOSBase) {
Sapan Bhatiaf7934b52017-06-12 05:04:23 -0700220 required manytoone controller->Controller:controllersiteprivileges = 1 [db_index = True, null = False, blank = False, unique_with = "site_privilege"];
221 required manytoone site_privilege->SitePrivilege:controllersiteprivileges = 2 [db_index = True, null = False, blank = False, unique_with = "role_id"];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200222 optional string role_id = 3 [max_length = 200, content_type = "stripped", blank = True, help_text = "Keystone id", null = True, db_index = True];
223}
224
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400225policy controller_slice_policy <
226 ctx.user.is_admin
227 | *slice_policy(slice) >
Sapan Bhatia170ae272017-05-30 19:01:09 +0200228
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400229message ControllerSlice::controller_slice_policy (XOSBase) {
Sapan Bhatiaf7934b52017-06-12 05:04:23 -0700230 required manytoone controller->Controller:controllerslices = 1 [db_index = True, null = False, blank = False, unique_with = "slice"];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200231 required manytoone slice->Slice:controllerslices = 2 [db_index = True, null = False, blank = False];
232 optional string tenant_id = 3 [max_length = 200, content_type = "stripped", blank = True, help_text = "Keystone tenant id", null = True, db_index = False];
233}
234
Sapan Bhatia170ae272017-05-30 19:01:09 +0200235message ControllerSlicePrivilege (XOSBase) {
Sapan Bhatiaf7934b52017-06-12 05:04:23 -0700236 required manytoone controller->Controller:controllersliceprivileges = 1 [db_index = True, null = False, blank = False, unique_with = "slice_privilege"];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200237 required manytoone slice_privilege->SlicePrivilege:controllersliceprivileges = 2 [db_index = True, null = False, blank = False];
238 optional string role_id = 3 [max_length = 200, content_type = "stripped", blank = True, help_text = "Keystone id", null = True, db_index = True];
239}
240
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400241policy controller_user_policy <
242 ctx.user.is_admin
243 | (ctx.read_access & *user_policy(user)) >
Sapan Bhatia170ae272017-05-30 19:01:09 +0200244
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400245message ControllerUser::controller_user_policy (XOSBase) {
Sapan Bhatia170ae272017-05-30 19:01:09 +0200246 required manytoone user->User:controllerusers = 1 [db_index = True, null = False, blank = False];
Sapan Bhatiaf7934b52017-06-12 05:04:23 -0700247 required manytoone controller->Controller:controllersusers = 2 [db_index = True, null = False, blank = False, unique_with = "user"];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200248 optional string kuser_id = 3 [max_length = 200, content_type = "stripped", blank = True, help_text = "Keystone user id", null = True, db_index = False];
249}
250
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400251// Everyone has read access
252// For write access you need admin privileges at that deployment
253policy deployment_policy <
254 ctx.user.is_admin
255 | (ctx.write_access -> exists Privilege: Privilege.object_type = "Deployment" & Privilege.object_id = obj.id & Privilege.accessor_id = ctx.user.id & Privilege.permission = "role:admin") >
Sapan Bhatia170ae272017-05-30 19:01:09 +0200256
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400257message Deployment::deployment_policy (XOSBase) {
Scott Bakereb782fc2018-04-27 13:50:21 -0700258 required string name = 1 [max_length = 200, content_type = "stripped", blank = False, help_text = "Name of the Deployment", null = False, db_index = False, unique = True];
Sapan Bhatiad022aeb2017-06-07 15:49:55 +0200259 required string accessControl = 2 [default = "allow all", max_length = 200, blank = False, help_text = "Access control list that specifies which sites/users may use nodes in this deployment", null = False, db_index = False, varchar = True];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200260}
261
262
Sapan Bhatia170ae272017-05-30 19:01:09 +0200263message Flavor (XOSBase) {
Scott Bakereb782fc2018-04-27 13:50:21 -0700264 required string name = 1 [max_length = 32, content_type = "stripped", blank = False, help_text = "name of this flavor, as displayed to users", null = False, db_index = False, unique = True];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200265 optional string description = 2 [db_index = False, max_length = 1024, null = True, content_type = "stripped", blank = True];
Scott Baker01fe9a32018-05-01 15:03:54 -0700266 required string flavor = 3 [max_length = 32, content_type = "stripped", blank = True, help_text = "flavor string used to configure deployments", null = False, db_index = False];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200267}
268
269
270message Image (XOSBase) {
Matteo Scandolo33d81332018-09-19 10:07:33 -0700271 required string name = 1 [db_index = False, max_length = 256, null = False, content_type = "stripped", blank = False, unique_with = "tag"];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200272 required string kind = 2 [default = "vm", choices = "(('vm', 'Virtual Machine'), ('container', 'Container'))", max_length = 30, blank = False, null = False, db_index = False];
Scott Baker01fe9a32018-05-01 15:03:54 -0700273 optional string disk_format = 3 [db_index = False, max_length = 256, null = True, content_type = "stripped", blank = True];
274 optional string container_format = 4 [db_index = False, max_length = 256, null = True, content_type = "stripped", blank = True];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200275 optional string path = 5 [max_length = 256, content_type = "stripped", blank = True, help_text = "Path to image on local disk", null = True, db_index = False];
276 optional string tag = 6 [max_length = 256, content_type = "stripped", blank = True, help_text = "For Docker Images, tag of image", null = True, db_index = False];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200277}
278
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400279policy image_deployment_policy <
280 *deployment_policy(deployment)
281>
Sapan Bhatia170ae272017-05-30 19:01:09 +0200282
283message ImageDeployments (XOSBase) {
Sapan Bhatiaf7934b52017-06-12 05:04:23 -0700284 required manytoone image->Image:imagedeployments = 1 [db_index = True, null = False, blank = False, unique_with = "deployment"];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200285 required manytoone deployment->Deployment:imagedeployments = 2 [db_index = True, null = False, blank = False];
286}
287
Sapan Bhatia5ea307d2017-07-19 00:13:21 -0400288policy instance_creator < obj.creator >
Sapan Bhatia9227b4d2017-07-25 23:14:48 -0400289policy instance_isolation < (obj.isolation = "container" | obj.isolation = "container_vm" ) -> (obj.image.kind = "container") >
290policy instance_isolation_container_vm_parent < (obj.isolation = "container_vm") -> obj.parent >
291policy instance_parent_isolation_container_vm < obj.parent -> ( obj.isolation = "container_vm" ) >
Sapan Bhatia5ea307d2017-07-19 00:13:21 -0400292policy instance_isolation_vm < (obj.isolation = "vm") -> (obj.image.kind = "vm") >
Sapan Bhatia5ea307d2017-07-19 00:13:21 -0400293policy instance_creator_privilege < not (obj.slice.creator = obj.creator) -> exists Privilege:Privilege.object_id = obj.slice.id & Privilege.accessor_id = obj.creator.id & Privilege.object_type = "Slice" >
Sapan Bhatia170ae272017-05-30 19:01:09 +0200294
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400295policy instance_policy < *slice_policy(slice) >
296
297message Instance::instance_policy (XOSBase) {
298 option validators = "instance_creator:Instance has no creator, instance_isolation: Container instance {obj.name} must use container image, instance_isolation_container_vm_parent:Container-vm instance {obj.name} must have a parent, instance_parent_isolation_container_vm:Parent field can only be set on Container-vm instances ({obj.name}), instance_isolation_vm: VM Instance {obj.name} must use VM image, instance_creator_privilege: instance creator has no privileges on slice";
Matteo Scandolo23cf15f2018-03-06 18:12:36 -0800299 optional string instance_id = 1 [max_length = 200, content_type = "stripped", blank = True, help_text = "Nova instance id", null = True, db_index = False, feedback_state = True];
300 optional string instance_uuid = 2 [max_length = 200, content_type = "stripped", blank = True, help_text = "Nova instance uuid", null = True, db_index = False, feedback_state = True];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200301 required string name = 3 [max_length = 200, content_type = "stripped", blank = False, help_text = "Instance name", null = False, db_index = False];
Matteo Scandolo23cf15f2018-03-06 18:12:36 -0800302 optional string instance_name = 4 [max_length = 200, content_type = "stripped", blank = True, help_text = "OpenStack generated name", null = True, db_index = False, feedback_state = True];
Matteo Scandolobd8caca2017-08-17 15:36:10 -0700303 optional string ip = 5 [max_length = 39, content_type = "ip", blank = True, help_text = "Instance ip address", null = True, db_index = False, gui_hidden = True];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200304 required manytoone image->Image:instances = 6 [db_index = True, null = False, blank = False];
305 optional manytoone creator->User:instances = 7 [db_index = True, null = True, blank = True];
306 required manytoone slice->Slice:instances = 8 [db_index = True, null = False, blank = False];
307 required manytoone deployment->Deployment:instance_deployment = 9 [db_index = True, null = False, blank = False];
308 required manytoone node->Node:instances = 10 [db_index = True, null = False, blank = False];
309 required int32 numberCores = 11 [help_text = "Number of cores for instance", default = 0, null = False, db_index = False, blank = False];
310 required manytoone flavor->Flavor:instance = 12 [help_text = "Flavor of this instance", null = False, db_index = True, blank = False];
Sapan Bhatiad022aeb2017-06-07 15:49:55 +0200311 optional string userData = 13 [help_text = "user_data passed to instance during creation", null = True, db_index = False, blank = True, varchar = True];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200312 required string isolation = 14 [default = "vm", choices = "(('vm', 'Virtual Machine'), ('container', 'Container'), ('container_vm', 'Container In VM'))", max_length = 30, blank = False, null = False, db_index = False];
313 optional string volumes = 15 [help_text = "Comma-separated list of directories to expose to parent context", null = True, db_index = False, blank = True];
314 optional manytoone parent->Instance:instance = 16 [help_text = "Parent Instance for containers nested inside of VMs", null = True, db_index = True, blank = True];
315}
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400316
317
318policy network_policy < *slice_policy(owner) >
319
320message Network::network_policy (XOSBase) {
Scott Bakereb782fc2018-04-27 13:50:21 -0700321 required string name = 1 [db_index = False, max_length = 32, null = False, blank = False, unique = True];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200322 required manytoone template->NetworkTemplate:network = 2 [db_index = True, null = False, blank = False];
323 required string subnet = 3 [db_index = False, max_length = 32, null = False, blank = True];
324 required string start_ip = 4 [db_index = False, max_length = 32, null = False, blank = True];
325 required string end_ip = 5 [db_index = False, max_length = 32, null = False, blank = True];
326 optional string ports = 6 [db_index = False, max_length = 1024, null = True, blank = True];
327 optional string labels = 7 [db_index = False, max_length = 1024, null = True, blank = True];
328 required manytoone owner->Slice:ownedNetworks = 8 [help_text = "Slice that owns control of this Network", null = False, db_index = True, blank = False];
329 required bool permit_all_slices = 10 [default = False, null = False, db_index = False, blank = True];
330 required bool autoconnect = 17 [help_text = "This network can be autoconnected to the slice that owns it", default = True, null = False, db_index = False, blank = True];
Zack Williamsffc9b212018-03-22 17:25:33 -0700331 required manytomany permitted_slices->Slice/Network_permitted_slices:availableNetworks = 18 [db_index = False, blank = True];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200332}
333
334
335message NetworkParameter (XOSBase) {
336 required manytoone parameter->NetworkParameterType:networkparameters = 1 [help_text = "The type of the parameter", null = False, db_index = True, blank = False];
337 required string value = 2 [help_text = "The value of this parameter", max_length = 1024, null = False, db_index = False, blank = False];
338 required string content_type = 4 [max_length = 1024, content_type = "stripped", blank = False, help_text = "Content type id linked to this network parameter", null = False, db_index = False];
339 required uint32 object_id = 4 [db_index = False, null = False, blank = False, help_text = "Object linked to this NetworkParameter"];
340}
341
342
343message NetworkParameterType (XOSBase) {
Scott Bakereb782fc2018-04-27 13:50:21 -0700344 required string name = 1 [help_text = "The name of this parameter", max_length = 128, null = False, db_index = True, blank = False, unique = True];
Scott Baker01fe9a32018-05-01 15:03:54 -0700345 required string description = 2 [db_index = False, max_length = 1024, null = False, blank = True];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200346}
347
Sapan Bhatia9227b4d2017-07-25 23:14:48 -0400348policy network_slice_validator < (obj.slice in obj.network.permitted_slices.all()) | (obj.slice = obj.network.owner) | obj.network.permit_all_slices >
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400349policy network_slice_policy < *slice_policy(slice) & *network_policy(network) >
Sapan Bhatia170ae272017-05-30 19:01:09 +0200350
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400351message NetworkSlice::network_slice_policy (XOSBase) {
Sapan Bhatia52b1ea52017-10-19 13:02:22 -0400352 option validators = "network_slice_validator:Slice {obj.slice.name} is not allowed to connect to networks {obj.network}";
Matteo Scandoloc3c0f0a2017-10-18 09:53:30 +0200353 required manytoone network->Network:networkslices = 1 [db_index = True, null = False, blank = False, unique_with = "slice", tosca_key=True];
354 required manytoone slice->Slice:networkslices = 2 [db_index = True, null = False, blank = False, tosca_key=True];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200355}
Sapan Bhatia5ea307d2017-07-19 00:13:21 -0400356
Sapan Bhatia170ae272017-05-30 19:01:09 +0200357message NetworkTemplate (XOSBase) {
Scott Bakereb782fc2018-04-27 13:50:21 -0700358 required string name = 1 [db_index = False, max_length = 32, null = False, blank = False, unique = True];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200359 optional string description = 2 [db_index = False, max_length = 1024, null = True, blank = True];
360 required string visibility = 4 [default = "private", choices = "(('public', 'public'), ('private', 'private'))", max_length = 30, blank = False, null = False, db_index = False];
361 required string translation = 5 [default = "none", choices = "(('none', 'none'), ('NAT', 'NAT'))", max_length = 30, blank = False, null = False, db_index = False];
362 optional string access = 6 [choices = "((None, 'None'), ('indirect', 'Indirect'), ('direct', 'Direct'))", max_length = 30, blank = True, help_text = "Advertise this network as a means for other slices to contact this slice", null = True, db_index = False];
363 optional string shared_network_name = 7 [db_index = False, max_length = 30, null = True, blank = True];
364 optional string shared_network_id = 8 [help_text = "Quantum network", max_length = 256, null = True, db_index = False, blank = True];
365 required string topology_kind = 9 [default = "bigswitch", choices = "(('bigswitch', 'BigSwitch'), ('physical', 'Physical'), ('custom', 'Custom'))", max_length = 30, blank = False, null = False, db_index = False];
366 optional string controller_kind = 10 [blank = True, max_length = 30, null = True, db_index = False, choices = "((None, 'None'), ('onos', 'ONOS'), ('custom', 'Custom'))"];
Scott Baker4af5c942018-08-29 13:42:18 -0700367 optional string vtn_kind = 11 [default = "PRIVATE", choices = "(('PRIVATE', 'Private'), ('PUBLIC', 'Public'), ('MANAGEMENT_LOCAL', 'Management Local'), ('MANAGEMENT_HOST', 'Management Host'), ('VSG', 'VSG'), ('ACCESS_AGENT', 'Access Agent'), ('FLAT', 'Flat'))", max_length = 30, blank = True, null = True, db_index = False];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200368}
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400369
370policy node_policy < *site_policy(site_deployment.site) >
371
372message Node::node_policy (XOSBase) {
Scott Bakereb782fc2018-04-27 13:50:21 -0700373 required string name = 1 [max_length = 200, content_type = "stripped", blank = False, help_text = "Name of the Node", null = False, db_index = False, unique = True];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200374 required manytoone site_deployment->SiteDeployment:nodes = 2 [db_index = True, null = False, blank = False];
Scott Baker01fe9a32018-05-01 15:03:54 -0700375 optional string bridgeId = 3 [max_length = 200, content_type = "stripped", blank = True, help_text = "Bridge Id", null = True, db_index = False];
376 optional string dataPlaneIntf = 4 [max_length = 200, content_type = "stripped", blank = True, help_text = "Dataplane Interface", null = True, db_index = False];
377 optional string dataPlaneIp = 5 [max_length = 200, content_type = "stripped", blank = True, help_text = "Dataplane Ip", null = True, db_index = False];
378 optional string hostManagementIface = 6 [max_length = 200, content_type = "stripped", blank = True, help_text = "Host Management Interface", null = True, db_index = False];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200379}
380message NodeLabel (XOSBase) {
Scott Bakereb782fc2018-04-27 13:50:21 -0700381 required string name = 1 [max_length = 200, content_type = "stripped", blank = False, help_text = "label name", null = False, db_index = False, unique = True];
Zack Williamsffc9b212018-03-22 17:25:33 -0700382 required manytomany node->Node/NodeLabel_node:nodelabels = 2 [db_index = False, blank = True];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200383}
Sapan Bhatia5ea307d2017-07-19 00:13:21 -0400384
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400385policy port_policy < *instance_policy(instance) & *network_policy(network) >
Sapan Bhatia5ea307d2017-07-19 00:13:21 -0400386
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400387message Port::port_policy (XOSBase) {
Scott Baker61ad7dc2018-06-15 15:25:39 -0700388 required manytoone network->Network:links = 1 [db_index = True, null = False, blank = False, unique_with = "instance", help_text = "Network bound to this port"];
389 optional manytoone instance->Instance:ports = 2 [db_index = True, null = True, blank = True, help_text = "Instance bound to this port"];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200390 optional string ip = 3 [max_length = 39, content_type = "ip", blank = True, help_text = "Instance ip address", null = True, db_index = False];
391 optional string port_id = 4 [help_text = "Neutron port id", max_length = 256, null = True, db_index = False, blank = True];
392 optional string mac = 5 [help_text = "MAC address associated with this port", max_length = 256, null = True, db_index = False, blank = True];
393 required bool xos_created = 6 [default = False, null = False, db_index = False, blank = True];
Scott Baker61ad7dc2018-06-15 15:25:39 -0700394 optional manytoone service_instance->ServiceInstance:ports = 2 [db_index = True, null = True, blank = True, help_text = "ServiceInstance bound to this port"];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200395}
396
Scott Baker6b260ea2018-04-18 07:12:22 -0700397message Principal (XOSBase) {
398 required string name = 1 [max_length = 128, null = False, db_index = True, blank = False, help_text = "The name of this principal"];
399 required manytoone trust_domain->TrustDomain:principals = 2 [db_index = True, null = False, blank = False, help_text = "Trust domain this principal resides in"];
400}
Sapan Bhatia170ae272017-05-30 19:01:09 +0200401
402message Role (XOSBase) {
403 required string role_type = 1 [db_index = False, max_length = 80, null = False, content_type = "stripped", blank = False];
404 optional string role = 2 [db_index = False, max_length = 80, null = True, content_type = "stripped", blank = True];
405 required string description = 3 [db_index = False, max_length = 120, null = False, content_type = "stripped", blank = False];
406}
407
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400408policy service_policy <ctx.user.is_admin | exists Privilege: Privilege.accessor_id = ctx.user.id & Privilege.accessor_type = "User" & Privilege.object_type = "Service" & Privilege.object_id = obj.id >
Sapan Bhatia170ae272017-05-30 19:01:09 +0200409
410message Service (XOSBase,AttributeMixin) {
Sapan Bhatiad022aeb2017-06-07 15:49:55 +0200411 optional string description = 1 [help_text = "Description of Service", max_length = 254, null = True, db_index = False, blank = True, varchar = True];
Matteo Scandolo03bb4412018-07-26 16:38:58 -0700412 required bool enabled = 2 [default = True, null = False, db_index = False, blank = True, gui_hidden = True];
Matteo Scandolo61a9f202018-08-01 08:58:13 -0400413 required string kind = 3 [default = "generic", max_length = 30, content_type = "stripped", blank = False, help_text = "Kind of service", null = False, db_index = False, choices="(('generic', 'Generic'), ('data', 'Data Plane'), ('control', 'Control Plane'), ('oss', 'OSS'))"];
Scott Bakereb782fc2018-04-27 13:50:21 -0700414 required string name = 4 [max_length = 30, content_type = "stripped", blank = False, help_text = "Service Name", null = False, db_index = False, unique = True];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200415 optional string versionNumber = 5 [max_length = 30, content_type = "stripped", blank = True, help_text = "Version of Service Definition", null = True, db_index = False];
Matteo Scandolo03bb4412018-07-26 16:38:58 -0700416 required bool published = 6 [default = True, null = False, db_index = False, blank = True, gui_hidden = True];
417 optional string icon_url = 8 [db_index = False, max_length = 1024, null = True, content_type = "stripped", blank = True, gui_hidden = True];
418 optional string public_key = 9 [help_text = "Public key string", max_length = 4096, null = True, db_index = False, blank = True, varchar = True, gui_hidden = True];
419 optional string private_key_fn = 10 [db_index = False, max_length = 4096, null = True, content_type = "stripped", blank = True, gui_hidden = True];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200420 optional string service_specific_id = 11 [db_index = False, max_length = 30, null = True, content_type = "stripped", blank = True];
Matteo Scandolo03bb4412018-07-26 16:38:58 -0700421 optional string service_specific_attribute = 12 [db_index = False, null = True, blank = True, varchar = True, gui_hidden = True];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200422}
423
Scott Baker6b260ea2018-04-18 07:12:22 -0700424message ServicePort (XOSBase) {
425 required string name = 1 [max_length = 128, null = False, db_index = False, blank = False, help_text = "Service Port Name"];
426 required int32 external_port = 2 [blank = False, help_text = "external port number"];
427 required int32 internal_port = 3 [blank = False, help_text = "internal port number"];
428 required string protocol = 4 [max_length = 32, null = False, db_index = False, blank = False, default="TCP", help_text = "Protocol"];
429 required manytoone service->Service:serviceports = 5 [null = False, db_index = True, blank = False, help_text = "The Service this ServicePort is associated with"];
430}
Sapan Bhatia170ae272017-05-30 19:01:09 +0200431
432message ServiceAttribute (XOSBase) {
Scott Bakereb782fc2018-04-27 13:50:21 -0700433 required string name = 1 [help_text = "Attribute Name", max_length = 128, null = False, db_index = False, blank = False, unique_with="service"];
Sapan Bhatiad022aeb2017-06-07 15:49:55 +0200434 required string value = 2 [help_text = "Attribute Value", null = False, db_index = False, blank = False, varchar = True];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200435 required manytoone service->Service:serviceattributes = 3 [help_text = "The Service this attribute is associated with", null = False, db_index = True, blank = False];
436}
437
438
Scott Baker071da962017-07-13 10:43:41 -0700439message ServiceDependency (XOSBase) {
Matteo Scandoloc3c0f0a2017-10-18 09:53:30 +0200440 required manytoone provider_service->Service:provided_dependencies = 1 [help_text = "The service that provides this dependency", null=False, db_index = True, blank=False, tosca_key=True];
Wei-Yu Chen85f58fc2018-03-14 13:42:12 +0800441 required manytoone subscriber_service->Service:subscribed_dependencies = 2 [help_text = "The services that subscribes to this dependency", null=False, db_index=True, blank=False, tosca_key=True];
Matteo Scandolo61a9f202018-08-01 08:58:13 -0400442 required string connect_method = 3 [max_length = 30, help_text = "method to connect the two services", default="none", choices = "(('none', 'None'), ('private', 'Private'), ('public', 'Public'))"];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200443}
444
445
446message ServiceMonitoringAgentInfo (XOSBase) {
Scott Bakereb782fc2018-04-27 13:50:21 -0700447 required string name = 1 [help_text = "Monitoring Agent Name", max_length = 128, null = False, db_index = False, blank = False, unique_with="service"];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200448 optional manytoone service->Service:servicemonitoringagents = 2 [help_text = "The Service this attribute is associated with", null = True, db_index = True, blank = True];
Sapan Bhatiad022aeb2017-06-07 15:49:55 +0200449 required string target_uri = 3 [help_text = "Monitoring collector URI to be used by agents to publish the data", null = False, db_index = False, blank = False, varchar = True];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200450}
451
452
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400453message Site::site_policy (XOSBase) {
Scott Bakereb782fc2018-04-27 13:50:21 -0700454 required string name = 1 [max_length = 200, content_type = "stripped", blank = False, help_text = "Name for this Site", null = False, db_index = False, unique = True];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200455 optional string site_url = 2 [max_length = 512, content_type = "url", blank = True, help_text = "Site's Home URL Page", null = True, db_index = False];
456 required bool enabled = 3 [help_text = "Status for this Site", default = True, null = False, db_index = False, blank = True];
457 required bool hosts_nodes = 4 [help_text = "Indicates whether or not the site host nodes", default = True, null = False, db_index = False, blank = True];
458 required bool hosts_users = 5 [help_text = "Indicates whether or not the site manages user accounts", default = True, null = False, db_index = False, blank = True];
459 optional float longitude = 6 [db_index = False, null = True, blank = True];
460 optional float latitude = 7 [db_index = False, null = True, blank = True];
461 required string login_base = 8 [max_length = 50, content_type = "stripped", blank = False, help_text = "Prefix for Slices associated with this Site", null = False, db_index = False];
462 required bool is_public = 9 [help_text = "Indicates the visibility of this site to other members", default = True, null = False, db_index = False, blank = True];
463 required string abbreviated_name = 10 [db_index = False, max_length = 80, null = False, content_type = "stripped", blank = False];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200464}
465
466
467message SiteDeployment (XOSBase) {
Matteo Scandoloc3c0f0a2017-10-18 09:53:30 +0200468 required manytoone site->Site:sitedeployments = 1 [db_index = True, null = False, blank = False, unique_with = "deployment", tosca_key=True];
469 required manytoone deployment->Deployment:sitedeployments = 2 [db_index = True, null = False, blank = False, unique_with = "controller", tosca_key=True];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200470 optional manytoone controller->Controller:sitedeployments = 3 [db_index = True, null = True, blank = True];
471 optional string availability_zone = 4 [max_length = 200, content_type = "stripped", blank = True, help_text = "OpenStack availability zone", null = True, db_index = False];
472}
473
Sapan Bhatia170ae272017-05-30 19:01:09 +0200474message SitePrivilege (XOSBase) {
475 required manytoone user->User:siteprivileges = 1 [db_index = True, null = False, blank = False];
Matteo Scandoloc3c0f0a2017-10-18 09:53:30 +0200476 required manytoone site->Site:siteprivileges = 2 [db_index = True, null = False, blank = False, tosca_key=True];
477 required manytoone role->SiteRole:siteprivileges = 3 [db_index = True, null = False, blank = False, tosca_key=True];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200478}
479
480
481message SiteRole (XOSBase) {
Matteo Scandolo68ab5432017-12-06 15:38:13 -0800482 required string role = 1 [choices = "(('admin', 'Admin'), ('pi', 'PI'), ('tech', 'Tech'), ('billing', 'Billing'))", max_length = 30, content_type = "stripped", blank = False, null = False, db_index = False, tosca_key=True];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200483}
Sapan Bhatiacb35e7f2017-05-24 12:17:28 +0200484
Scott Baker6b260ea2018-04-18 07:12:22 -0700485policy slice_name_no_spaces < {{ ' ' not in obj.name }} >
Sapan Bhatia5ea307d2017-07-19 00:13:21 -0400486policy slice_has_creator < obj.creator >
487
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400488message Slice::slice_policy (XOSBase) {
Scott Baker6b260ea2018-04-18 07:12:22 -0700489 option validators = "slice_name_no_spaces:Slice name contains spaces, slice_has_creator:Slice has no creator";
Sapan Bhatiacb35e7f2017-05-24 12:17:28 +0200490 option plural = "Slices";
Sapan Bhatia5ea307d2017-07-19 00:13:21 -0400491
Scott Bakereb782fc2018-04-27 13:50:21 -0700492 required string name = 1 [max_length = 80, content_type = "stripped", blank = False, help_text = "The Name of the Slice", null = False, db_index = False, unique = True];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200493 required bool enabled = 2 [help_text = "Status for this Slice", default = True, null = False, db_index = False, blank = True];
Sapan Bhatiad022aeb2017-06-07 15:49:55 +0200494 required string description = 4 [help_text = "High level description of the slice and expected activities", max_length = 1024, null = False, db_index = False, blank = True, varchar = True];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200495 required manytoone site->Site:slices = 6 [help_text = "The Site this Slice belongs to", null = False, db_index = True, blank = False];
496 required int32 max_instances = 7 [default = 10, null = False, db_index = False, blank = False];
497 optional manytoone service->Service:slices = 8 [db_index = True, null = True, blank = True];
498 optional string network = 9 [blank = True, max_length = 256, null = True, db_index = False, choices = "((None, 'Default'), ('host', 'Host'), ('bridged', 'Bridged'), ('noauto', 'No Automatic Networks'))"];
499 optional string exposed_ports = 10 [db_index = False, max_length = 256, null = True, blank = True];
Sapan Bhatia1c5d6072017-09-01 23:21:46 -0400500 optional manytoone creator->User:slices = 12 [db_index = True, null = False, blank = False];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200501 optional manytoone default_flavor->Flavor:slices = 13 [db_index = True, null = True, blank = True];
502 optional manytoone default_image->Image:slices = 14 [db_index = True, null = True, blank = True];
503 optional manytoone default_node->Node:slices = 15 [db_index = True, null = True, blank = True];
504 optional string mount_data_sets = 16 [default = "GenBank", max_length = 256, content_type = "stripped", blank = True, null = True, db_index = False];
505 required string default_isolation = 17 [default = "vm", choices = "(('vm', 'Virtual Machine'), ('container', 'Container'), ('container_vm', 'Container In VM'))", max_length = 30, blank = False, null = False, db_index = False];
Scott Baker6b260ea2018-04-18 07:12:22 -0700506 optional manytoone trust_domain->TrustDomain:slices = 12 [db_index = True, null = False, blank = False, help_text = "Trust domain this slice resides in"];
507 optional manytoone principal->Principal:slices = 12 [db_index = True, null = False, blank = False, help_text = "Principal this slice may use to interact with other components"];
508 optional int32 controller_replica_count = 13 [default = 0, null = False, db_index = False, blank = False, help_text = "Replica count, controller-dependent"];
509 optional string controller_kind = 14 [max_length = 256, content_type = "stripped", blank = True, help_text = "Type of controller, vim-dependent", null = True, db_index = False];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200510}
511
Sapan Bhatia170ae272017-05-30 19:01:09 +0200512message SlicePrivilege (XOSBase) {
Sapan Bhatiaf7934b52017-06-12 05:04:23 -0700513 required manytoone user->User:sliceprivileges = 1 [db_index = True, null = False, blank = False, unique_with = "slice"];
514 required manytoone slice->Slice:sliceprivileges = 2 [db_index = True, null = False, blank = False, unique_with = "role"];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200515 required manytoone role->SliceRole:sliceprivileges = 3 [db_index = True, null = False, blank = False];
516}
517
518
519message SliceRole (XOSBase) {
Matteo Scandolo61a9f202018-08-01 08:58:13 -0400520 required string role = 1 [choices = "(('admin', 'Admin'), ('default', 'Default'), ('access', 'Access'))", max_length = 30, content_type = "stripped", blank = False, null = False, db_index = False, tosca_key=True];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200521}
522
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400523policy tag_policy < ctx.user.is_admin >
Sapan Bhatia170ae272017-05-30 19:01:09 +0200524
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400525message Tag::tag_policy (XOSBase) {
Sapan Bhatia170ae272017-05-30 19:01:09 +0200526 required manytoone service->Service:tags = 1 [help_text = "The Service this Tag is associated with", null = False, db_index = True, blank = False];
527 required string name = 2 [help_text = "The name of this tag", max_length = 128, null = False, db_index = True, blank = False];
528 required string value = 3 [max_length = 1024, content_type = "stripped", blank = False, help_text = "The value of this tag", null = False, db_index = False];
529 required string content_type = 4 [max_length = 1024, content_type = "stripped", blank = False, help_text = "Content type id linked to this tag", null = False, db_index = False];
530 required uint32 object_id = 5 [db_index = False, null = False, blank = False, help_text = "Object linked to this tag"];
531}
532
Scott Bakerd6e533f2017-07-17 13:37:29 -0700533message InterfaceType (XOSBase) {
Scott Bakereb782fc2018-04-27 13:50:21 -0700534 required string name = 1 [db_index = False, max_length = 200, null = False, content_type = "stripped", blank = False, unique_with = "direction"];
Scott Bakerd6e533f2017-07-17 13:37:29 -0700535 required string direction = 2 [db_index = False, max_length = 30, null = False, content_type = "stripped", blank = False, choices = "(('in', 'In'), ('out', 'Out'))"];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200536}
537
Scott Bakerd6e533f2017-07-17 13:37:29 -0700538message ServiceInterface (XOSBase) {
Matteo Scandoloc3c0f0a2017-10-18 09:53:30 +0200539 required manytoone service->Service:service_interfaces = 1 [db_index = True, null = False, blank = False, tosca_key=True];
540 required manytoone interface_type->InterfaceType:service_interfaces = 2 [db_index = True, null = False, blank = False, tosca_key=True];
Scott Bakerd6e533f2017-07-17 13:37:29 -0700541}
542
543message ServiceInstance (XOSBase, AttributeMixin) {
544 optional string name = 1 [db_index = False, max_length = 200, null = True, content_type = "stripped", blank = True];
545 required manytoone owner->Service:service_instances = 2 [db_index = True, null = False, blank = False];
Matteo Scandolo03bb4412018-07-26 16:38:58 -0700546 optional string service_specific_id = 3 [db_index = False, max_length = 30, null = True, content_type = "stripped", blank = True, gui_hidden = True];
547 optional string service_specific_attribute = 10 [db_index = False, null = True, blank = True, varchar = True, gui_hidden = True];
548 optional uint32 link_deleted_count = 11 [default = 0, help_text = "Incremented each time a provided_link is deleted from this ServiceInstance", gui_hidden = True];
Matteo Scandolo61a9f202018-08-01 08:58:13 -0400549 optional manytoone master_serviceinstance->ServiceInstance:child_serviceinstances = 12 [help_text = "The master service instance that set this service instance up", gui_hidden = True, blank = True];
Scott Bakerd6e533f2017-07-17 13:37:29 -0700550}
551
552message ServiceInstanceLink (XOSBase) {
Matteo Scandoloc3c0f0a2017-10-18 09:53:30 +0200553 required manytoone provider_service_instance->ServiceInstance:provided_links = 1 [db_index = True, null = False, blank = False, tosca_key=True];
Scott Bakerd6e533f2017-07-17 13:37:29 -0700554 optional manytoone provider_service_interface->ServiceInterface:provided_links = 2 [db_index = True, null = True, blank = True];
555 optional manytoone subscriber_service_instance->ServiceInstance:subscribed_links = 3 [db_index = True, null = True, blank = True];
Matteo Scandolo68ab5432017-12-06 15:38:13 -0800556 optional manytoone subscriber_service->Service:subscribed_links = 4 [db_index = True, null = True, blank = True, tosca_key_one_of=subscriber_service_instance];
557 optional manytoone subscriber_network->Network:subscribed_links = 5 [db_index = True, null = True, blank = True, tosca_key_one_of=subscriber_service_instance];
Scott Bakerd6e533f2017-07-17 13:37:29 -0700558}
559
560message ServiceInstanceAttribute (XOSBase) {
Scott Bakereb782fc2018-04-27 13:50:21 -0700561 required string name = 1 [help_text = "Attribute Name", max_length = 128, null = False, db_index = False, blank = False, unique_with="service_instance"];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200562 required string value = 2 [help_text = "Attribute Value", null = False, db_index = False, blank = False];
Scott Bakerd6e533f2017-07-17 13:37:29 -0700563 required manytoone service_instance->ServiceInstance:service_instance_attributes = 3 [help_text = "The Tenant this attribute is associated with", null = False, db_index = True, blank = False];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200564}
565
Scott Bakerd6e533f2017-07-17 13:37:29 -0700566message TenantWithContainer (ServiceInstance) {
Sapan Bhatia170ae272017-05-30 19:01:09 +0200567 optional manytoone instance->Instance:+ = 1 [help_text = "Instance used by this Tenant", null = True, db_index = True, blank = True];
568 optional manytoone creator->User:+ = 2 [help_text = "Creator of this Tenant", null = True, db_index = True, blank = True];
569 optional string external_hostname = 3 [max_length = 30, content_type = "stripped", blank = True, help_text = "External host name", null = True, db_index = False];
570 optional string external_container = 4 [max_length = 30, content_type = "stripped", blank = True, help_text = "External host name", null = True, db_index = False];
Sapan Bhatiaba870b82017-12-01 09:52:42 -0500571 optional string node_label = 5 [max_length = 30, content_type = "stripped", blank = True, help_text = "Node constraint", null = True, db_index = False];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200572}
573
Scott Baker6b260ea2018-04-18 07:12:22 -0700574message TrustDomain (XOSBase) {
575 required string name = 1 [max_length = 255, null = False, db_index = True, blank = False, help_text = "Name of this trust domain"];
576 required manytoone owner->Service:owned_trust_domains = 2 [null = False, db_index = True, blank = False, help_text = "Service partioned by this trust domain"];
577}
578
Scott Bakera33ccb02018-01-26 13:03:28 -0800579message XOSCore (XOSBase) {
580 option singular="XOSCore";
581 option plural="XOSCores";
Scott Bakereb782fc2018-04-27 13:50:21 -0700582 required string name = 1 [default = "XOS", max_length = 200, content_type = "stripped", blank = False, help_text = "Name of XOS", null = False, db_index = False, unique = "True"];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200583}
584
Matteo Scandoloee367fd2017-11-22 14:55:09 -0800585message XOSGuiExtension::admin_policy (XOSBase) {
Matteo Scandoloe425f9d2017-08-15 15:56:19 -0700586 option verbose_name="XOS GUI Extension";
587 option description="This model holds the instruction to load an extension in the GUI";
Matteo Scandolo623da232017-12-01 11:49:45 -0800588 // option no_sync = True;
589 // option no_policy = True;
Matteo Scandolo39b4a272017-11-17 11:09:21 -0800590
Scott Bakereb782fc2018-04-27 13:50:21 -0700591 required string name = 1 [max_length = 200, content_type = "stripped", blank = False, help_text = "Name of the GUI Extensions", null = False, db_index = False, unique = True];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200592 required string files = 2 [max_length = 1024, content_type = "stripped", blank = False, help_text = "List of comma separated file composing the view", null = False, db_index = False];
593}
Sapan Bhatia5ea307d2017-07-19 00:13:21 -0400594
Matteo Scandoloe2afe4b2017-11-15 08:10:55 -0800595message ServiceGraphConstraint (XOSBase) {
596 option verbose_name="Graph Constraint";
597 option description="Define the position of the nodes in the service graph";
598 required string constraints = 1 [max_length = 1024, content_type = "stripped", blank = True, help_text = "A composite array defining positions, eg [volt, vsg, [address_manager, vrouter]]", null = False, tosca_key=True];
599}
600