blob: f74b73d83e7689accdfc3f0bdd2108cd270d5ef6 [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
Sapan Bhatia170ae272017-05-30 19:01:09 +020012 required string created = 1 [content_type = "date", auto_now_add = True];
13 required string updated = 2 [default = "now()", content_type = "date"];
14 optional string enacted = 3 [null = True, content_type = "date", blank = True, default = None];
15 optional string policed = 4 [null = True, content_type = "date", blank = True, default = None];
Sapan Bhatiacb35e7f2017-05-24 12:17:28 +020016 optional string backend_register = 5 [default = "{}", max_length = 1024];
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];
Sapan Bhatiada5e4442017-08-27 09:51:13 -040019 required string backend_status = 8 [default = "Provisioning in progress", max_length = 1024, null = True];
20 required int32 backend_code = 9 [default = 0];
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];
Sapan Bhatiada5e4442017-08-27 09:51:13 -040026 optional string policy_status = 16 [default = "Policy in process", max_length = 1024];
27 optional int32 policy_code = 16 [default = 0];
28 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];
Sapan Bhatia170ae272017-05-30 19:01:09 +020030}
31
Sapan Bhatiab5ce1862017-07-31 15:48:19 -040032// The calling user represents the user being accessed, or is a site admin.
33policy user_policy <
34 ctx.user.is_admin
35 | ctx.user.id = obj.id
36 | (exists Privilege:
37 Privilege.accessor_id = ctx.user.id
38 & Privilege.accessor_type = "User"
39 & Privilege.permission = "role:admin"
40 & Privilege.object_type = "Site"
41 & Privilege.object_id = ctx.user.site.id) >
42
43message User::user_policy (AbstractBaseUser,PlModelMixIn) {
Sapan Bhatiad022aeb2017-06-07 15:49:55 +020044 option skip_django = True;
Matteo Scandoloe425f9d2017-08-15 15:56:19 -070045 option description = "An XOS User";
Sapan Bhatiacb35e7f2017-05-24 12:17:28 +020046
Matteo Scandoloc3c0f0a2017-10-18 09:53:30 +020047 required string email = 1 [db_index = True, max_length = 255, null = False, blank = False, tosca_key=True];
Sapan Bhatiad022aeb2017-06-07 15:49:55 +020048 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 +020049 required string password = 3 [default = "Something", max_length = 255, blank = False, null = False, db_index = False];
Sapan Bhatiaafce8fd2017-06-28 23:24:53 -070050 optional string last_login = 4 [db_index = False, null = True, content_type = "date", blank = True];
51 required string firstname = 5 [max_length = 200, content_type = "stripped", blank = False, help_text = "person's given name", null = False, db_index = False];
52 required string lastname = 6 [max_length = 200, content_type = "stripped", blank = False, help_text = "person's surname", null = False, db_index = False];
53 optional string phone = 7 [max_length = 100, content_type = "stripped", blank = True, help_text = "phone number contact", null = True, db_index = False];
54 optional string user_url = 8 [db_index = False, max_length = 200, null = True, content_type = "url", blank = True];
55 required manytoone site->Site:users = 9 [help_text = "Site this user will be homed too", null = False, db_index = True, blank = False];
56 optional string public_key = 10 [help_text = "Public key string", max_length = 1024, null = True, db_index = False, blank = True, varchar = True];
57 required bool is_active = 11 [default = True, null = False, db_index = False, blank = True];
58 required bool is_admin = 12 [default = False, null = False, db_index = False, blank = True];
59 required bool is_staff = 13 [default = True, null = False, db_index = False, blank = True];
60 required bool is_readonly = 14 [default = False, null = False, db_index = False, blank = True];
61 required bool is_registering = 15 [default = False, null = False, db_index = False, blank = True];
62 required bool is_appuser = 16 [default = False, null = False, db_index = False, blank = True];
63 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];
64 required string created = 18 [db_index = False, null = False, content_type = "date", blank = True];
65 required string updated = 19 [db_index = False, null = False, content_type = "date", blank = True];
66 optional string enacted = 20 [db_index = False, null = True, content_type = "date", blank = False];
67 optional string policed = 21 [db_index = False, null = True, content_type = "date", blank = False];
68 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 -080069 required int32 backend_code = 34 [default = 0];
Sapan Bhatiaafce8fd2017-06-28 23:24:53 -070070 required bool backend_need_delete = 23 [default = False, null = False, db_index = False, blank = True];
71 required bool backend_need_reap = 24 [default = False, null = False, db_index = False, blank = True];
72 required bool deleted = 25 [default = False, null = False, db_index = False, blank = True];
73 required bool write_protect = 26 [default = False, null = False, db_index = False, blank = True];
74 required bool lazy_blocked = 27 [default = False, null = False, db_index = False, blank = True];
75 required bool no_sync = 28 [default = False, null = False, db_index = False, blank = True];
76 required bool no_policy = 29 [default = False, null = False, db_index = False, blank = True];
77 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 -070078 optional string policy_status = 32 [default = "0 - Policy in process", max_length = 1024];
Scott Bakeraed4abd2017-12-01 15:23:35 -080079 optional int32 policy_code = 35 [default = 0];
Sapan Bhatiae8a9e6d2017-09-03 21:02:32 -040080 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 Bakere08d0062017-07-11 12:04:26 -070081}
Sapan Bhatiad022aeb2017-06-07 15:49:55 +020082
Sapan Bhatiab5ce1862017-07-31 15:48:19 -040083// A user may give a permission that he has to another user
84policy grant_policy < ctx.user.is_admin
85 | exists Privilege:Privilege.object_type = obj.object_type
86 & Privilege.object_id = obj.object_id
87 & Privilege.accessor_type = "User"
Kailash Khalasiacab7e12017-12-14 11:27:26 -080088 & Privilege.accessor_id = ctx.user.id
Sapan Bhatiab5ce1862017-07-31 15:48:19 -040089 & Privilege.permission = "role:admin" >
Kailash Khalasiacab7e12017-12-14 11:27:26 -080090
Sapan Bhatiab5ce1862017-07-31 15:48:19 -040091message Privilege::grant_policy (XOSBase) {
Kailash Khalasiacab7e12017-12-14 11:27:26 -080092 required int32 accessor_id = 1 [null = False, blank=False];
Sapan Bhatia8918ac32017-07-09 00:43:27 -040093 required string accessor_type = 2 [null = False, max_length=1024];
Sapan Bhatiab5ce1862017-07-31 15:48:19 -040094 required int32 controller_id = 3 [null = True];
Kailash Khalasiacab7e12017-12-14 11:27:26 -080095 required int32 object_id = 4 [null = False, blank=False];
Sapan Bhatiab5ce1862017-07-31 15:48:19 -040096 required string object_type = 5 [null = False, max_length=1024];
Matteo Scandoloc3c0f0a2017-10-18 09:53:30 +020097 required string permission = 6 [null = False, default = "all", max_length=1024, tosca_key=True];
Sapan Bhatiab5ce1862017-07-31 15:48:19 -040098 required string granted = 7 [content_type = "date", auto_now_add = True, max_length=1024];
99 required string expires = 8 [content_type = "date", null = True, max_length=1024];
Sapan Bhatia8918ac32017-07-09 00:43:27 -0400100}
101
Sapan Bhatia170ae272017-05-30 19:01:09 +0200102message AddressPool (XOSBase) {
103 required string name = 1 [db_index = False, max_length = 32, null = False, blank = False];
Sapan Bhatiad022aeb2017-06-07 15:49:55 +0200104 optional string addresses = 2 [db_index = False, null = True, blank = True, varchar = True];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200105 optional string gateway_ip = 3 [db_index = False, max_length = 32, null = True, blank = False];
106 optional string gateway_mac = 4 [db_index = False, max_length = 32, null = True, blank = False];
107 optional string cidr = 5 [db_index = False, max_length = 32, null = True, blank = False];
Sapan Bhatiad022aeb2017-06-07 15:49:55 +0200108 optional string inuse = 6 [db_index = False, null = True, blank = True, varchar = True];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200109 optional manytoone service->Service:addresspools = 7 [db_index = True, null = True, blank = True];
110}
111
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400112// Admins at a deployment have access to controllers at those deployments
113policy controller_policy
114 < ctx.user.is_admin
115 | exists Privilege:
116 Privilege.accessor_id = ctx.user.id
117 & Privilege.object_type = "Deployment"
118 & Privilege.permission = "role:admin"
119 & Privilege.object_id = obj.id >
Sapan Bhatia170ae272017-05-30 19:01:09 +0200120
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400121message Controller::controller_policy (XOSBase) {
Sapan Bhatia170ae272017-05-30 19:01:09 +0200122 required string name = 1 [max_length = 200, content_type = "stripped", blank = False, help_text = "Name of the Controller", null = False, db_index = False];
123 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];
124 required string version = 3 [max_length = 200, content_type = "stripped", blank = False, help_text = "Controller version", null = False, db_index = False];
125 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];
126 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];
127 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];
128 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];
129 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];
130 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];
131 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];
132 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];
133 required manytoone deployment->Deployment:controllerdeployments = 12 [db_index = True, null = False, blank = False];
134}
135
Sapan Bhatia170ae272017-05-30 19:01:09 +0200136message ControllerImages (XOSBase) {
Sapan Bhatiaf7934b52017-06-12 05:04:23 -0700137 required manytoone image->Image:controllerimages = 1 [db_index = True, null = False, blank = False, unique_with = "controller"];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200138 required manytoone controller->Controller:controllerimages = 2 [db_index = True, null = False, blank = False];
139 optional string glance_image_id = 3 [max_length = 200, content_type = "stripped", blank = True, help_text = "Glance image id", null = True, db_index = False];
140}
141
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400142// Everyone has read access
143// For write access, you have to be a site_admin
Sapan Bhatia170ae272017-05-30 19:01:09 +0200144
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400145policy site_policy <
146 ctx.user.is_admin
147 | (ctx.write_access -> exists Privilege: Privilege.object_type = "Site" & Privilege.object_id = obj.id & Privilege.accessor_id = ctx.user.id & Privilege.permission = "role:admin") >
148
149// If you can access (read or write) the site, you can also access its slices
150// Otherwise, you need an explicit privilege on the Slice (admin for write access)
151// or admin privilege on the associated site.
152policy slice_policy <
153 ctx.user.is_admin
154 | (*site_policy(site)
Sapan Bhatia3cee9482017-09-01 23:10:16 -0400155 & (ctx.user = obj.creator
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400156 | (exists Privilege:
157 Privilege.accessor_id = ctx.user.id
158 & Privilege.accessor_type = "User"
159 & Privilege.object_type = "Slice"
160 & Privilege.object_id = obj.id
161 & (ctx.write_access -> Privilege.permission = "role:admin"))
162 )
163 |
164 (exists Privilege:
165 Privilege.accessor_id = ctx.user.id
166 & Privilege.accessor_type = "User"
167 & Privilege.object_type = "Slice"
168 & Privilege.object_id = obj.id)
169 | (exists Privilege:
170 Privilege.accessor_id = ctx.user.id
171 & Privilege.accessor_type = "User"
172 & Privilege.object_type = "Site"
173 & Privilege.object_id = obj.site.id
174 & Privilege.permission = "role:admin")
175 ) >
176
177policy controller_network_policy <
178 ctx.user.is_admin
179 | *slice_policy(network.owner) >
180
181
182message ControllerNetwork::controller_network_policy (XOSBase) {
Sapan Bhatiaf7934b52017-06-12 05:04:23 -0700183 required manytoone network->Network:controllernetworks = 1 [db_index = True, null = False, blank = False, unique_with = "controller"];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200184 required manytoone controller->Controller:controllernetworks = 2 [db_index = True, null = False, blank = False];
185 required string subnet = 3 [db_index = False, max_length = 32, null = False, blank = True];
186 required string start_ip = 4 [db_index = False, max_length = 32, null = False, blank = True];
187 required string stop_ip = 5 [db_index = False, max_length = 32, null = False, blank = True];
188 optional string net_id = 6 [help_text = "Neutron network", max_length = 256, null = True, db_index = False, blank = True];
189 optional string router_id = 7 [help_text = "Neutron router id", max_length = 256, null = True, db_index = False, blank = True];
190 optional string subnet_id = 8 [help_text = "Neutron subnet id", max_length = 256, null = True, db_index = False, blank = True];
191 optional string gateway = 9 [db_index = False, max_length = 32, null = True, blank = True];
192 optional string segmentation_id = 10 [db_index = False, max_length = 32, null = True, blank = True];
193}
194
Sapan Bhatia170ae272017-05-30 19:01:09 +0200195message ControllerRole (XOSBase) {
196 required string role = 1 [choices = "(('admin', 'Admin'),)", max_length = 30, content_type = "stripped", blank = False, null = False, db_index = False];
197}
198
Sapan Bhatia170ae272017-05-30 19:01:09 +0200199message ControllerSite (XOSBase) {
Matteo Scandolo68ab5432017-12-06 15:38:13 -0800200 required manytoone site->Site:controllersite = 1 [db_index = True, null = False, blank = False, unique_with="controller", tosca_key = True];
201 optional manytoone controller->Controller:controllersite = 2 [db_index = True, null = True, blank = True, tosca_key = True];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200202 optional string tenant_id = 3 [max_length = 200, content_type = "stripped", blank = True, help_text = "Keystone tenant id", null = True, db_index = True];
203}
204
Sapan Bhatia170ae272017-05-30 19:01:09 +0200205message ControllerSitePrivilege (XOSBase) {
Sapan Bhatiaf7934b52017-06-12 05:04:23 -0700206 required manytoone controller->Controller:controllersiteprivileges = 1 [db_index = True, null = False, blank = False, unique_with = "site_privilege"];
207 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 +0200208 optional string role_id = 3 [max_length = 200, content_type = "stripped", blank = True, help_text = "Keystone id", null = True, db_index = True];
209}
210
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400211policy controller_slice_policy <
212 ctx.user.is_admin
213 | *slice_policy(slice) >
Sapan Bhatia170ae272017-05-30 19:01:09 +0200214
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400215message ControllerSlice::controller_slice_policy (XOSBase) {
Sapan Bhatiaf7934b52017-06-12 05:04:23 -0700216 required manytoone controller->Controller:controllerslices = 1 [db_index = True, null = False, blank = False, unique_with = "slice"];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200217 required manytoone slice->Slice:controllerslices = 2 [db_index = True, null = False, blank = False];
218 optional string tenant_id = 3 [max_length = 200, content_type = "stripped", blank = True, help_text = "Keystone tenant id", null = True, db_index = False];
219}
220
Sapan Bhatia170ae272017-05-30 19:01:09 +0200221message ControllerSlicePrivilege (XOSBase) {
Sapan Bhatiaf7934b52017-06-12 05:04:23 -0700222 required manytoone controller->Controller:controllersliceprivileges = 1 [db_index = True, null = False, blank = False, unique_with = "slice_privilege"];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200223 required manytoone slice_privilege->SlicePrivilege:controllersliceprivileges = 2 [db_index = True, null = False, blank = False];
224 optional string role_id = 3 [max_length = 200, content_type = "stripped", blank = True, help_text = "Keystone id", null = True, db_index = True];
225}
226
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400227policy controller_user_policy <
228 ctx.user.is_admin
229 | (ctx.read_access & *user_policy(user)) >
Sapan Bhatia170ae272017-05-30 19:01:09 +0200230
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400231message ControllerUser::controller_user_policy (XOSBase) {
Sapan Bhatia170ae272017-05-30 19:01:09 +0200232 required manytoone user->User:controllerusers = 1 [db_index = True, null = False, blank = False];
Sapan Bhatiaf7934b52017-06-12 05:04:23 -0700233 required manytoone controller->Controller:controllersusers = 2 [db_index = True, null = False, blank = False, unique_with = "user"];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200234 optional string kuser_id = 3 [max_length = 200, content_type = "stripped", blank = True, help_text = "Keystone user id", null = True, db_index = False];
235}
236
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400237// Everyone has read access
238// For write access you need admin privileges at that deployment
239policy deployment_policy <
240 ctx.user.is_admin
241 | (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 +0200242
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400243message Deployment::deployment_policy (XOSBase) {
Sapan Bhatia170ae272017-05-30 19:01:09 +0200244 required string name = 1 [max_length = 200, content_type = "stripped", blank = False, help_text = "Name of the Deployment", null = False, db_index = False];
Sapan Bhatiad022aeb2017-06-07 15:49:55 +0200245 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 +0200246}
247
248
Sapan Bhatia170ae272017-05-30 19:01:09 +0200249message Diag (XOSBase) {
Matteo Scandolo2146dff2017-11-20 15:53:17 -0800250 option gui_hidden = True;
251 required string name = 1 [max_length = 200, content_type = "stripped", blank = False, help_text = "Name of the synchronizer", null = False, db_index = False];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200252}
253
254
255message Flavor (XOSBase) {
256 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];
257 optional string description = 2 [db_index = False, max_length = 1024, null = True, content_type = "stripped", blank = True];
258 required string flavor = 3 [max_length = 32, content_type = "stripped", blank = False, help_text = "flavor string used to configure deployments", null = False, db_index = False];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200259}
260
261
262message Image (XOSBase) {
263 required string name = 1 [db_index = False, max_length = 256, null = False, content_type = "stripped", blank = False];
264 required string kind = 2 [default = "vm", choices = "(('vm', 'Virtual Machine'), ('container', 'Container'))", max_length = 30, blank = False, null = False, db_index = False];
265 required string disk_format = 3 [db_index = False, max_length = 256, null = False, content_type = "stripped", blank = False];
266 required string container_format = 4 [db_index = False, max_length = 256, null = False, content_type = "stripped", blank = False];
267 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];
268 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 +0200269}
270
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400271policy image_deployment_policy <
272 *deployment_policy(deployment)
273>
Sapan Bhatia170ae272017-05-30 19:01:09 +0200274
275message ImageDeployments (XOSBase) {
Sapan Bhatiaf7934b52017-06-12 05:04:23 -0700276 required manytoone image->Image:imagedeployments = 1 [db_index = True, null = False, blank = False, unique_with = "deployment"];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200277 required manytoone deployment->Deployment:imagedeployments = 2 [db_index = True, null = False, blank = False];
278}
279
Sapan Bhatia5ea307d2017-07-19 00:13:21 -0400280policy instance_creator < obj.creator >
Sapan Bhatia9227b4d2017-07-25 23:14:48 -0400281policy instance_isolation < (obj.isolation = "container" | obj.isolation = "container_vm" ) -> (obj.image.kind = "container") >
282policy instance_isolation_container_vm_parent < (obj.isolation = "container_vm") -> obj.parent >
283policy instance_parent_isolation_container_vm < obj.parent -> ( obj.isolation = "container_vm" ) >
Sapan Bhatia5ea307d2017-07-19 00:13:21 -0400284policy instance_isolation_vm < (obj.isolation = "vm") -> (obj.image.kind = "vm") >
Sapan Bhatia5ea307d2017-07-19 00:13:21 -0400285policy 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 +0200286
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400287policy instance_policy < *slice_policy(slice) >
288
289message Instance::instance_policy (XOSBase) {
290 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";
Sapan Bhatia170ae272017-05-30 19:01:09 +0200291 optional string instance_id = 1 [max_length = 200, content_type = "stripped", blank = True, help_text = "Nova instance id", null = True, db_index = False];
292 optional string instance_uuid = 2 [max_length = 200, content_type = "stripped", blank = True, help_text = "Nova instance uuid", null = True, db_index = False];
293 required string name = 3 [max_length = 200, content_type = "stripped", blank = False, help_text = "Instance name", null = False, db_index = False];
294 optional string instance_name = 4 [max_length = 200, content_type = "stripped", blank = True, help_text = "OpenStack generated name", null = True, db_index = False];
Matteo Scandolobd8caca2017-08-17 15:36:10 -0700295 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 +0200296 required manytoone image->Image:instances = 6 [db_index = True, null = False, blank = False];
297 optional manytoone creator->User:instances = 7 [db_index = True, null = True, blank = True];
298 required manytoone slice->Slice:instances = 8 [db_index = True, null = False, blank = False];
299 required manytoone deployment->Deployment:instance_deployment = 9 [db_index = True, null = False, blank = False];
300 required manytoone node->Node:instances = 10 [db_index = True, null = False, blank = False];
301 required int32 numberCores = 11 [help_text = "Number of cores for instance", default = 0, null = False, db_index = False, blank = False];
302 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 +0200303 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 +0200304 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];
305 optional string volumes = 15 [help_text = "Comma-separated list of directories to expose to parent context", null = True, db_index = False, blank = True];
306 optional manytoone parent->Instance:instance = 16 [help_text = "Parent Instance for containers nested inside of VMs", null = True, db_index = True, blank = True];
307}
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400308
309
310policy network_policy < *slice_policy(owner) >
311
312message Network::network_policy (XOSBase) {
Sapan Bhatia170ae272017-05-30 19:01:09 +0200313 required string name = 1 [db_index = False, max_length = 32, null = False, blank = False];
314 required manytoone template->NetworkTemplate:network = 2 [db_index = True, null = False, blank = False];
315 required string subnet = 3 [db_index = False, max_length = 32, null = False, blank = True];
316 required string start_ip = 4 [db_index = False, max_length = 32, null = False, blank = True];
317 required string end_ip = 5 [db_index = False, max_length = 32, null = False, blank = True];
318 optional string ports = 6 [db_index = False, max_length = 1024, null = True, blank = True];
319 optional string labels = 7 [db_index = False, max_length = 1024, null = True, blank = True];
320 required manytoone owner->Slice:ownedNetworks = 8 [help_text = "Slice that owns control of this Network", null = False, db_index = True, blank = False];
321 required bool permit_all_slices = 10 [default = False, null = False, db_index = False, blank = True];
322 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];
323 required manytomany permitted_slices->Slice/Network_permitted_slices:availableNetworks = 18 [db_index = False, null = False, blank = True];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200324}
325
326
327message NetworkParameter (XOSBase) {
328 required manytoone parameter->NetworkParameterType:networkparameters = 1 [help_text = "The type of the parameter", null = False, db_index = True, blank = False];
329 required string value = 2 [help_text = "The value of this parameter", max_length = 1024, null = False, db_index = False, blank = False];
330 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];
331 required uint32 object_id = 4 [db_index = False, null = False, blank = False, help_text = "Object linked to this NetworkParameter"];
332}
333
334
335message NetworkParameterType (XOSBase) {
336 required string name = 1 [help_text = "The name of this parameter", max_length = 128, null = False, db_index = True, blank = False];
337 required string description = 2 [db_index = False, max_length = 1024, null = False, blank = False];
338}
339
Sapan Bhatia9227b4d2017-07-25 23:14:48 -0400340policy 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 -0400341policy network_slice_policy < *slice_policy(slice) & *network_policy(network) >
Sapan Bhatia170ae272017-05-30 19:01:09 +0200342
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400343message NetworkSlice::network_slice_policy (XOSBase) {
Sapan Bhatia52b1ea52017-10-19 13:02:22 -0400344 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 +0200345 required manytoone network->Network:networkslices = 1 [db_index = True, null = False, blank = False, unique_with = "slice", tosca_key=True];
346 required manytoone slice->Slice:networkslices = 2 [db_index = True, null = False, blank = False, tosca_key=True];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200347}
Sapan Bhatia5ea307d2017-07-19 00:13:21 -0400348
Sapan Bhatia170ae272017-05-30 19:01:09 +0200349message NetworkTemplate (XOSBase) {
350 required string name = 1 [db_index = False, max_length = 32, null = False, blank = False];
351 optional string description = 2 [db_index = False, max_length = 1024, null = True, blank = True];
352 required string visibility = 4 [default = "private", choices = "(('public', 'public'), ('private', 'private'))", max_length = 30, blank = False, null = False, db_index = False];
353 required string translation = 5 [default = "none", choices = "(('none', 'none'), ('NAT', 'NAT'))", max_length = 30, blank = False, null = False, db_index = False];
354 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];
355 optional string shared_network_name = 7 [db_index = False, max_length = 30, null = True, blank = True];
356 optional string shared_network_id = 8 [help_text = "Quantum network", max_length = 256, null = True, db_index = False, blank = True];
357 required string topology_kind = 9 [default = "bigswitch", choices = "(('bigswitch', 'BigSwitch'), ('physical', 'Physical'), ('custom', 'Custom'))", max_length = 30, blank = False, null = False, db_index = False];
358 optional string controller_kind = 10 [blank = True, max_length = 30, null = True, db_index = False, choices = "((None, 'None'), ('onos', 'ONOS'), ('custom', 'Custom'))"];
359 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'))", max_length = 30, blank = True, null = True, db_index = False];
360}
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400361
362policy node_policy < *site_policy(site_deployment.site) >
363
364message Node::node_policy (XOSBase) {
Sapan Bhatia170ae272017-05-30 19:01:09 +0200365 required string name = 1 [max_length = 200, content_type = "stripped", blank = False, help_text = "Name of the Node", null = False, db_index = False];
366 required manytoone site_deployment->SiteDeployment:nodes = 2 [db_index = True, null = False, blank = False];
Matteo Scandolobd67f8f2017-12-06 17:02:11 -0800367 required string bridgeId = 3 [max_length = 200, content_type = "stripped", blank = False, help_text = "Bridge Id", null = False, db_index = False];
368 required string dataPlaneIntf = 4 [max_length = 200, content_type = "stripped", blank = False, help_text = "Dataplane Interface", null = False, db_index = False];
369 required string dataPlaneIp = 5 [max_length = 200, content_type = "stripped", blank = True, help_text = "Dataplane Ip", null = True, db_index = False];
370 required 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 +0200371}
372message NodeLabel (XOSBase) {
373 required string name = 1 [max_length = 200, content_type = "stripped", blank = False, help_text = "label name", null = False, db_index = False];
374 required manytomany node->Node/NodeLabel_node:nodelabels = 2 [db_index = False, null = False, blank = True];
375}
Sapan Bhatia5ea307d2017-07-19 00:13:21 -0400376
Sapan Bhatia9227b4d2017-07-25 23:14:48 -0400377policy port_validator < (obj.instance.slice in obj.network.permitted_slices.all()) | (obj.instance.slice = obj.network.owner) | obj.network.permit_all_slices >
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400378policy port_policy < *instance_policy(instance) & *network_policy(network) >
Sapan Bhatia5ea307d2017-07-19 00:13:21 -0400379
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400380message Port::port_policy (XOSBase) {
Sapan Bhatia9227b4d2017-07-25 23:14:48 -0400381 option validators = "port_validator:Slice is not allowed to connect to network";
Sapan Bhatiaf7934b52017-06-12 05:04:23 -0700382 required manytoone network->Network:links = 1 [db_index = True, null = False, blank = False, unique_with = "instance"];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200383 optional manytoone instance->Instance:ports = 2 [db_index = True, null = True, blank = True];
384 optional string ip = 3 [max_length = 39, content_type = "ip", blank = True, help_text = "Instance ip address", null = True, db_index = False];
385 optional string port_id = 4 [help_text = "Neutron port id", max_length = 256, null = True, db_index = False, blank = True];
386 optional string mac = 5 [help_text = "MAC address associated with this port", max_length = 256, null = True, db_index = False, blank = True];
387 required bool xos_created = 6 [default = False, null = False, db_index = False, blank = True];
388}
389
390
391message Role (XOSBase) {
392 required string role_type = 1 [db_index = False, max_length = 80, null = False, content_type = "stripped", blank = False];
393 optional string role = 2 [db_index = False, max_length = 80, null = True, content_type = "stripped", blank = True];
394 required string description = 3 [db_index = False, max_length = 120, null = False, content_type = "stripped", blank = False];
395}
396
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400397policy 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 +0200398
399message Service (XOSBase,AttributeMixin) {
Sapan Bhatiad022aeb2017-06-07 15:49:55 +0200400 optional string description = 1 [help_text = "Description of Service", max_length = 254, null = True, db_index = False, blank = True, varchar = True];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200401 required bool enabled = 2 [default = True, null = False, db_index = False, blank = True];
Scott Bakerd6e533f2017-07-17 13:37:29 -0700402 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'))"];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200403 required string name = 4 [max_length = 30, content_type = "stripped", blank = False, help_text = "Service Name", null = False, db_index = False];
404 optional string versionNumber = 5 [max_length = 30, content_type = "stripped", blank = True, help_text = "Version of Service Definition", null = True, db_index = False];
405 required bool published = 6 [default = True, null = False, db_index = False, blank = True];
406 optional string view_url = 7 [db_index = False, max_length = 1024, null = True, content_type = "stripped", blank = True];
407 optional string icon_url = 8 [db_index = False, max_length = 1024, null = True, content_type = "stripped", blank = True];
Sapan Bhatiad022aeb2017-06-07 15:49:55 +0200408 optional string public_key = 9 [help_text = "Public key string", max_length = 4096, null = True, db_index = False, blank = True, varchar = True];
Zack Williamsf517e402017-05-20 13:37:43 -0700409 optional string private_key_fn = 10 [db_index = False, max_length = 4096, null = True, content_type = "stripped", blank = True];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200410 optional string service_specific_id = 11 [db_index = False, max_length = 30, null = True, content_type = "stripped", blank = True];
Sapan Bhatiad022aeb2017-06-07 15:49:55 +0200411 optional string service_specific_attribute = 12 [db_index = False, null = True, blank = True, varchar = True];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200412}
413
414
415message ServiceAttribute (XOSBase) {
416 required string name = 1 [help_text = "Attribute Name", max_length = 128, null = False, db_index = False, blank = False];
Sapan Bhatiad022aeb2017-06-07 15:49:55 +0200417 required string value = 2 [help_text = "Attribute Value", null = False, db_index = False, blank = False, varchar = True];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200418 required manytoone service->Service:serviceattributes = 3 [help_text = "The Service this attribute is associated with", null = False, db_index = True, blank = False];
419}
420
421
Scott Baker071da962017-07-13 10:43:41 -0700422message ServiceDependency (XOSBase) {
Matteo Scandoloc3c0f0a2017-10-18 09:53:30 +0200423 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];
Scott Bakerd6e533f2017-07-17 13:37:29 -0700424 required manytoone subscriber_service->Service:subscribed_dependencies = 2 [help_text = "The services that subscribes to this dependency", null=False, db_index=True, blank=False];
Scott Baker071da962017-07-13 10:43:41 -0700425 required string connect_method = 3 [max_length = 30, help_text = "method to connect the two services", null=False, blank=False, default="none", choices = "(('none', 'None'), ('private', 'Private'), ('public', 'Public'))"];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200426}
427
428
429message ServiceMonitoringAgentInfo (XOSBase) {
430 required string name = 1 [help_text = "Monitoring Agent Name", max_length = 128, null = False, db_index = False, blank = False];
431 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 +0200432 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 +0200433}
434
435
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400436message Site::site_policy (XOSBase) {
Sapan Bhatia170ae272017-05-30 19:01:09 +0200437 required string name = 1 [max_length = 200, content_type = "stripped", blank = False, help_text = "Name for this Site", null = False, db_index = False];
438 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];
439 required bool enabled = 3 [help_text = "Status for this Site", default = True, null = False, db_index = False, blank = True];
440 required bool hosts_nodes = 4 [help_text = "Indicates whether or not the site host nodes", default = True, null = False, db_index = False, blank = True];
441 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];
442 optional float longitude = 6 [db_index = False, null = True, blank = True];
443 optional float latitude = 7 [db_index = False, null = True, blank = True];
444 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];
445 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];
446 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 +0200447}
448
449
450message SiteDeployment (XOSBase) {
Matteo Scandoloc3c0f0a2017-10-18 09:53:30 +0200451 required manytoone site->Site:sitedeployments = 1 [db_index = True, null = False, blank = False, unique_with = "deployment", tosca_key=True];
452 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 +0200453 optional manytoone controller->Controller:sitedeployments = 3 [db_index = True, null = True, blank = True];
454 optional string availability_zone = 4 [max_length = 200, content_type = "stripped", blank = True, help_text = "OpenStack availability zone", null = True, db_index = False];
455}
456
Sapan Bhatia170ae272017-05-30 19:01:09 +0200457message SitePrivilege (XOSBase) {
458 required manytoone user->User:siteprivileges = 1 [db_index = True, null = False, blank = False];
Matteo Scandoloc3c0f0a2017-10-18 09:53:30 +0200459 required manytoone site->Site:siteprivileges = 2 [db_index = True, null = False, blank = False, tosca_key=True];
460 required manytoone role->SiteRole:siteprivileges = 3 [db_index = True, null = False, blank = False, tosca_key=True];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200461}
462
463
464message SiteRole (XOSBase) {
Matteo Scandolo68ab5432017-12-06 15:38:13 -0800465 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 +0200466}
Sapan Bhatiacb35e7f2017-05-24 12:17:28 +0200467
Sapan Bhatia9227b4d2017-07-25 23:14:48 -0400468policy slice_name < obj.id | {{ obj.name.startswith(obj.site.login_base) }} >
Sapan Bhatia5ea307d2017-07-19 00:13:21 -0400469policy slice_name_length_and_no_spaces < {{ len(obj.site.login_base) + 1 < len(obj.name) and ' ' not in obj.name }} >
470policy slice_has_creator < obj.creator >
471
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400472
473
474message Slice::slice_policy (XOSBase) {
Sapan Bhatia52b1ea52017-10-19 13:02:22 -0400475 option validators = "slice_name:Slice name ({obj.name}) must begin with site login_base ({obj.site.login_base}), slice_name_length_and_no_spaces:Slice name too short or contains spaces, slice_has_creator:Slice has no creator";
Sapan Bhatiacb35e7f2017-05-24 12:17:28 +0200476 option plural = "Slices";
Sapan Bhatia5ea307d2017-07-19 00:13:21 -0400477
Sapan Bhatia170ae272017-05-30 19:01:09 +0200478 required string name = 1 [max_length = 80, content_type = "stripped", blank = False, help_text = "The Name of the Slice", null = False, db_index = False];
479 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 +0200480 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 +0200481 required string slice_url = 5 [db_index = False, max_length = 512, null = False, content_type = "url", blank = True];
482 required manytoone site->Site:slices = 6 [help_text = "The Site this Slice belongs to", null = False, db_index = True, blank = False];
483 required int32 max_instances = 7 [default = 10, null = False, db_index = False, blank = False];
484 optional manytoone service->Service:slices = 8 [db_index = True, null = True, blank = True];
485 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'))"];
486 optional string exposed_ports = 10 [db_index = False, max_length = 256, null = True, blank = True];
Sapan Bhatia1c5d6072017-09-01 23:21:46 -0400487 optional manytoone creator->User:slices = 12 [db_index = True, null = False, blank = False];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200488 optional manytoone default_flavor->Flavor:slices = 13 [db_index = True, null = True, blank = True];
489 optional manytoone default_image->Image:slices = 14 [db_index = True, null = True, blank = True];
490 optional manytoone default_node->Node:slices = 15 [db_index = True, null = True, blank = True];
491 optional string mount_data_sets = 16 [default = "GenBank", max_length = 256, content_type = "stripped", blank = True, null = True, db_index = False];
492 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];
493}
494
Sapan Bhatia170ae272017-05-30 19:01:09 +0200495message SlicePrivilege (XOSBase) {
Sapan Bhatiaf7934b52017-06-12 05:04:23 -0700496 required manytoone user->User:sliceprivileges = 1 [db_index = True, null = False, blank = False, unique_with = "slice"];
497 required manytoone slice->Slice:sliceprivileges = 2 [db_index = True, null = False, blank = False, unique_with = "role"];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200498 required manytoone role->SliceRole:sliceprivileges = 3 [db_index = True, null = False, blank = False];
499}
500
501
502message SliceRole (XOSBase) {
Matteo Scandolo68ab5432017-12-06 15:38:13 -0800503 required string role = 1 [choices = "(('admin', 'Admin'), ('default', 'Default'))", max_length = 30, content_type = "stripped", blank = False, null = False, db_index = False, tosca_key=True];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200504}
505
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400506policy tag_policy < ctx.user.is_admin >
Sapan Bhatia170ae272017-05-30 19:01:09 +0200507
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400508message Tag::tag_policy (XOSBase) {
Sapan Bhatia170ae272017-05-30 19:01:09 +0200509 required manytoone service->Service:tags = 1 [help_text = "The Service this Tag is associated with", null = False, db_index = True, blank = False];
510 required string name = 2 [help_text = "The name of this tag", max_length = 128, null = False, db_index = True, blank = False];
511 required string value = 3 [max_length = 1024, content_type = "stripped", blank = False, help_text = "The value of this tag", null = False, db_index = False];
512 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];
513 required uint32 object_id = 5 [db_index = False, null = False, blank = False, help_text = "Object linked to this tag"];
514}
515
Scott Bakerd6e533f2017-07-17 13:37:29 -0700516message InterfaceType (XOSBase) {
517 required string name = 1 [db_index = False, max_length = 200, null = False, content_type = "stripped", blank = False];
518 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 +0200519}
520
Scott Bakerd6e533f2017-07-17 13:37:29 -0700521message ServiceInterface (XOSBase) {
Matteo Scandoloc3c0f0a2017-10-18 09:53:30 +0200522 required manytoone service->Service:service_interfaces = 1 [db_index = True, null = False, blank = False, tosca_key=True];
523 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 -0700524}
525
526message ServiceInstance (XOSBase, AttributeMixin) {
527 optional string name = 1 [db_index = False, max_length = 200, null = True, content_type = "stripped", blank = True];
528 required manytoone owner->Service:service_instances = 2 [db_index = True, null = False, blank = False];
529 optional string service_specific_id = 3 [db_index = False, max_length = 30, null = True, content_type = "stripped", blank = True];
530 optional string service_specific_attribute = 10 [db_index = False, null = True, blank = True, varchar = True];
Scott Bakerdedec902017-09-05 17:12:33 -0700531 optional uint32 link_deleted_count = 11 [default = 0, help_text = "Incremented each time a provided_link is deleted from this ServiceInstance"];
Sapan Bhatiaa2f24892017-10-31 00:25:47 -0400532 optional manytoone master_serviceinstance->ServiceInstance:child_serviceinstances = 12 [help_text = "The master service instance that set this service instance up"];
Scott Bakerd6e533f2017-07-17 13:37:29 -0700533}
534
535message ServiceInstanceLink (XOSBase) {
Matteo Scandoloc3c0f0a2017-10-18 09:53:30 +0200536 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 -0700537 optional manytoone provider_service_interface->ServiceInterface:provided_links = 2 [db_index = True, null = True, blank = True];
538 optional manytoone subscriber_service_instance->ServiceInstance:subscribed_links = 3 [db_index = True, null = True, blank = True];
Matteo Scandolo68ab5432017-12-06 15:38:13 -0800539 optional manytoone subscriber_service->Service:subscribed_links = 4 [db_index = True, null = True, blank = True, tosca_key_one_of=subscriber_service_instance];
540 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 -0700541}
542
543message ServiceInstanceAttribute (XOSBase) {
Sapan Bhatia170ae272017-05-30 19:01:09 +0200544 required string name = 1 [help_text = "Attribute Name", max_length = 128, null = False, db_index = False, blank = False];
545 required string value = 2 [help_text = "Attribute Value", null = False, db_index = False, blank = False];
Scott Bakerd6e533f2017-07-17 13:37:29 -0700546 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 +0200547}
548
Scott Bakerd6e533f2017-07-17 13:37:29 -0700549message TenantWithContainer (ServiceInstance) {
Sapan Bhatia170ae272017-05-30 19:01:09 +0200550 optional manytoone instance->Instance:+ = 1 [help_text = "Instance used by this Tenant", null = True, db_index = True, blank = True];
551 optional manytoone creator->User:+ = 2 [help_text = "Creator of this Tenant", null = True, db_index = True, blank = True];
552 optional string external_hostname = 3 [max_length = 30, content_type = "stripped", blank = True, help_text = "External host name", null = True, db_index = False];
553 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 -0500554 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 +0200555}
556
Scott Bakera33ccb02018-01-26 13:03:28 -0800557message XOSCore (XOSBase) {
558 option singular="XOSCore";
559 option plural="XOSCores";
Sapan Bhatia170ae272017-05-30 19:01:09 +0200560 required string name = 1 [default = "XOS", max_length = 200, content_type = "stripped", blank = False, help_text = "Name of XOS", null = False, db_index = False];
561}
562
Matteo Scandoloee367fd2017-11-22 14:55:09 -0800563message XOSGuiExtension::admin_policy (XOSBase) {
Matteo Scandoloe425f9d2017-08-15 15:56:19 -0700564 option verbose_name="XOS GUI Extension";
565 option description="This model holds the instruction to load an extension in the GUI";
Matteo Scandolo623da232017-12-01 11:49:45 -0800566 // option no_sync = True;
567 // option no_policy = True;
Matteo Scandolo39b4a272017-11-17 11:09:21 -0800568
Sapan Bhatia170ae272017-05-30 19:01:09 +0200569 required string name = 1 [max_length = 200, content_type = "stripped", blank = False, help_text = "Name of the GUI Extensions", null = False, db_index = False];
570 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];
571}
Sapan Bhatia5ea307d2017-07-19 00:13:21 -0400572
Matteo Scandoloe2afe4b2017-11-15 08:10:55 -0800573message ServiceGraphConstraint (XOSBase) {
574 option verbose_name="Graph Constraint";
575 option description="Define the position of the nodes in the service graph";
576 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];
577}
578