blob: 956acfc03b4056a87c4c46449e0aeda55fff2beb [file] [log] [blame]
Sapan Bhatiacb35e7f2017-05-24 12:17:28 +02001option app_label = "core";
Sapan Bhatiad022aeb2017-06-07 15:49:55 +02002
Matteo Scandolo81c154d2017-11-22 14:55:09 -08003// use thi policy to allow access to admins only
4policy admin_policy < ctx.user.is_admin >
5
Sapan Bhatia170ae272017-05-30 19:01:09 +02006message XOSBase {
Sapan Bhatiad022aeb2017-06-07 15:49:55 +02007 option skip_init = True;
Sapan Bhatiacb35e7f2017-05-24 12:17:28 +02008
Sapan Bhatia170ae272017-05-30 19:01:09 +02009 required string created = 1 [content_type = "date", auto_now_add = True];
10 required string updated = 2 [default = "now()", content_type = "date"];
11 optional string enacted = 3 [null = True, content_type = "date", blank = True, default = None];
12 optional string policed = 4 [null = True, content_type = "date", blank = True, default = None];
Sapan Bhatiacb35e7f2017-05-24 12:17:28 +020013 optional string backend_register = 5 [default = "{}", max_length = 1024];
Matteo Scandolo031028f2017-10-03 17:01:22 -070014 required bool backend_need_delete = 6 [default = False, blank = True];
15 required bool backend_need_reap = 7 [default = False, blank = True];
Sapan Bhatiada5e4442017-08-27 09:51:13 -040016 required string backend_status = 8 [default = "Provisioning in progress", max_length = 1024, null = True];
17 required int32 backend_code = 9 [default = 0];
Matteo Scandolo031028f2017-10-03 17:01:22 -070018 required bool deleted = 10 [default = False, blank = True];
19 required bool write_protect = 12 [default = False, blank = True];
20 required bool lazy_blocked = 13 [default = False, blank = True];
21 required bool no_sync = 14 [default = False, blank = True];
22 required bool no_policy = 15 [default = False, blank = True];
Sapan Bhatiada5e4442017-08-27 09:51:13 -040023 optional string policy_status = 16 [default = "Policy in process", max_length = 1024];
24 optional int32 policy_code = 16 [default = 0];
25 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 Scandolo031028f2017-10-03 17:01:22 -070026 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 +020027}
28
Sapan Bhatiab5ce1862017-07-31 15:48:19 -040029// The calling user represents the user being accessed, or is a site admin.
30policy user_policy <
31 ctx.user.is_admin
32 | ctx.user.id = obj.id
33 | (exists Privilege:
34 Privilege.accessor_id = ctx.user.id
35 & Privilege.accessor_type = "User"
36 & Privilege.permission = "role:admin"
37 & Privilege.object_type = "Site"
38 & Privilege.object_id = ctx.user.site.id) >
39
40message User::user_policy (AbstractBaseUser,PlModelMixIn) {
Sapan Bhatiad022aeb2017-06-07 15:49:55 +020041 option skip_django = True;
Matteo Scandoloe425f9d2017-08-15 15:56:19 -070042 option description = "An XOS User";
Sapan Bhatiacb35e7f2017-05-24 12:17:28 +020043
Matteo Scandolofb37c8f2017-10-18 09:53:30 +020044 required string email = 1 [db_index = True, max_length = 255, null = False, blank = False, tosca_key=True];
Sapan Bhatiad022aeb2017-06-07 15:49:55 +020045 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 +020046 required string password = 3 [default = "Something", max_length = 255, blank = False, null = False, db_index = False];
Sapan Bhatiaafce8fd2017-06-28 23:24:53 -070047 optional string last_login = 4 [db_index = False, null = True, content_type = "date", blank = True];
48 required string firstname = 5 [max_length = 200, content_type = "stripped", blank = False, help_text = "person's given name", null = False, db_index = False];
49 required string lastname = 6 [max_length = 200, content_type = "stripped", blank = False, help_text = "person's surname", null = False, db_index = False];
50 optional string phone = 7 [max_length = 100, content_type = "stripped", blank = True, help_text = "phone number contact", null = True, db_index = False];
51 optional string user_url = 8 [db_index = False, max_length = 200, null = True, content_type = "url", blank = True];
52 required manytoone site->Site:users = 9 [help_text = "Site this user will be homed too", null = False, db_index = True, blank = False];
53 optional string public_key = 10 [help_text = "Public key string", max_length = 1024, null = True, db_index = False, blank = True, varchar = True];
54 required bool is_active = 11 [default = True, null = False, db_index = False, blank = True];
55 required bool is_admin = 12 [default = False, null = False, db_index = False, blank = True];
56 required bool is_staff = 13 [default = True, null = False, db_index = False, blank = True];
57 required bool is_readonly = 14 [default = False, null = False, db_index = False, blank = True];
58 required bool is_registering = 15 [default = False, null = False, db_index = False, blank = True];
59 required bool is_appuser = 16 [default = False, null = False, db_index = False, blank = True];
60 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];
61 required string created = 18 [db_index = False, null = False, content_type = "date", blank = True];
62 required string updated = 19 [db_index = False, null = False, content_type = "date", blank = True];
63 optional string enacted = 20 [db_index = False, null = True, content_type = "date", blank = False];
64 optional string policed = 21 [db_index = False, null = True, content_type = "date", blank = False];
65 required string backend_status = 22 [default = "Provisioning in progress", max_length = 1024, content_type = "stripped", blank = False, null = False, db_index = False];
Scott Baker708418b2017-12-01 15:23:35 -080066 required int32 backend_code = 34 [default = 0];
Sapan Bhatiaafce8fd2017-06-28 23:24:53 -070067 required bool backend_need_delete = 23 [default = False, null = False, db_index = False, blank = True];
68 required bool backend_need_reap = 24 [default = False, null = False, db_index = False, blank = True];
69 required bool deleted = 25 [default = False, null = False, db_index = False, blank = True];
70 required bool write_protect = 26 [default = False, null = False, db_index = False, blank = True];
71 required bool lazy_blocked = 27 [default = False, null = False, db_index = False, blank = True];
72 required bool no_sync = 28 [default = False, null = False, db_index = False, blank = True];
73 required bool no_policy = 29 [default = False, null = False, db_index = False, blank = True];
74 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 -070075 optional string policy_status = 32 [default = "0 - Policy in process", max_length = 1024];
Scott Baker708418b2017-12-01 15:23:35 -080076 optional int32 policy_code = 35 [default = 0];
Sapan Bhatia784a5162017-09-03 21:02:32 -040077 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 -070078}
Sapan Bhatiad022aeb2017-06-07 15:49:55 +020079
Sapan Bhatiab5ce1862017-07-31 15:48:19 -040080// A user may give a permission that he has to another user
81policy grant_policy < ctx.user.is_admin
82 | exists Privilege:Privilege.object_type = obj.object_type
83 & Privilege.object_id = obj.object_id
84 & Privilege.accessor_type = "User"
85 & Privilege.accessor_id = ctx.user.id
86 & Privilege.permission = "role:admin" >
87
88message Privilege::grant_policy (XOSBase) {
Sapan Bhatia8918ac32017-07-09 00:43:27 -040089 required int32 accessor_id = 1 [null = False];
90 required string accessor_type = 2 [null = False, max_length=1024];
Sapan Bhatiab5ce1862017-07-31 15:48:19 -040091 required int32 controller_id = 3 [null = True];
92 required int32 object_id = 4 [null = False];
93 required string object_type = 5 [null = False, max_length=1024];
Matteo Scandolofb37c8f2017-10-18 09:53:30 +020094 required string permission = 6 [null = False, default = "all", max_length=1024, tosca_key=True];
Sapan Bhatiab5ce1862017-07-31 15:48:19 -040095 required string granted = 7 [content_type = "date", auto_now_add = True, max_length=1024];
96 required string expires = 8 [content_type = "date", null = True, max_length=1024];
Sapan Bhatia8918ac32017-07-09 00:43:27 -040097}
98
Sapan Bhatia170ae272017-05-30 19:01:09 +020099message AddressPool (XOSBase) {
100 required string name = 1 [db_index = False, max_length = 32, null = False, blank = False];
Sapan Bhatiad022aeb2017-06-07 15:49:55 +0200101 optional string addresses = 2 [db_index = False, null = True, blank = True, varchar = True];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200102 optional string gateway_ip = 3 [db_index = False, max_length = 32, null = True, blank = False];
103 optional string gateway_mac = 4 [db_index = False, max_length = 32, null = True, blank = False];
104 optional string cidr = 5 [db_index = False, max_length = 32, null = True, blank = False];
Sapan Bhatiad022aeb2017-06-07 15:49:55 +0200105 optional string inuse = 6 [db_index = False, null = True, blank = True, varchar = True];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200106 optional manytoone service->Service:addresspools = 7 [db_index = True, null = True, blank = True];
107}
108
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400109// Admins at a deployment have access to controllers at those deployments
110policy controller_policy
111 < ctx.user.is_admin
112 | exists Privilege:
113 Privilege.accessor_id = ctx.user.id
114 & Privilege.object_type = "Deployment"
115 & Privilege.permission = "role:admin"
116 & Privilege.object_id = obj.id >
Sapan Bhatia170ae272017-05-30 19:01:09 +0200117
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400118message Controller::controller_policy (XOSBase) {
Sapan Bhatia170ae272017-05-30 19:01:09 +0200119 required string name = 1 [max_length = 200, content_type = "stripped", blank = False, help_text = "Name of the Controller", null = False, db_index = False];
120 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];
121 required string version = 3 [max_length = 200, content_type = "stripped", blank = False, help_text = "Controller version", null = False, db_index = False];
122 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];
123 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];
124 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];
125 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];
126 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];
127 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];
128 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];
129 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];
130 required manytoone deployment->Deployment:controllerdeployments = 12 [db_index = True, null = False, blank = False];
131}
132
Sapan Bhatia170ae272017-05-30 19:01:09 +0200133message ControllerImages (XOSBase) {
Sapan Bhatiaf7934b52017-06-12 05:04:23 -0700134 required manytoone image->Image:controllerimages = 1 [db_index = True, null = False, blank = False, unique_with = "controller"];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200135 required manytoone controller->Controller:controllerimages = 2 [db_index = True, null = False, blank = False];
136 optional string glance_image_id = 3 [max_length = 200, content_type = "stripped", blank = True, help_text = "Glance image id", null = True, db_index = False];
137}
138
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400139// Everyone has read access
140// For write access, you have to be a site_admin
Sapan Bhatia170ae272017-05-30 19:01:09 +0200141
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400142policy site_policy <
143 ctx.user.is_admin
144 | (ctx.write_access -> exists Privilege: Privilege.object_type = "Site" & Privilege.object_id = obj.id & Privilege.accessor_id = ctx.user.id & Privilege.permission = "role:admin") >
145
146// If you can access (read or write) the site, you can also access its slices
147// Otherwise, you need an explicit privilege on the Slice (admin for write access)
148// or admin privilege on the associated site.
149policy slice_policy <
150 ctx.user.is_admin
151 | (*site_policy(site)
Sapan Bhatia0534b472017-09-01 23:10:16 -0400152 & (ctx.user = obj.creator
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400153 | (exists Privilege:
154 Privilege.accessor_id = ctx.user.id
155 & Privilege.accessor_type = "User"
156 & Privilege.object_type = "Slice"
157 & Privilege.object_id = obj.id
158 & (ctx.write_access -> Privilege.permission = "role:admin"))
159 )
160 |
161 (exists Privilege:
162 Privilege.accessor_id = ctx.user.id
163 & Privilege.accessor_type = "User"
164 & Privilege.object_type = "Slice"
165 & Privilege.object_id = obj.id)
166 | (exists Privilege:
167 Privilege.accessor_id = ctx.user.id
168 & Privilege.accessor_type = "User"
169 & Privilege.object_type = "Site"
170 & Privilege.object_id = obj.site.id
171 & Privilege.permission = "role:admin")
172 ) >
173
174policy controller_network_policy <
175 ctx.user.is_admin
176 | *slice_policy(network.owner) >
177
178
179message ControllerNetwork::controller_network_policy (XOSBase) {
Sapan Bhatiaf7934b52017-06-12 05:04:23 -0700180 required manytoone network->Network:controllernetworks = 1 [db_index = True, null = False, blank = False, unique_with = "controller"];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200181 required manytoone controller->Controller:controllernetworks = 2 [db_index = True, null = False, blank = False];
182 required string subnet = 3 [db_index = False, max_length = 32, null = False, blank = True];
183 required string start_ip = 4 [db_index = False, max_length = 32, null = False, blank = True];
184 required string stop_ip = 5 [db_index = False, max_length = 32, null = False, blank = True];
185 optional string net_id = 6 [help_text = "Neutron network", max_length = 256, null = True, db_index = False, blank = True];
186 optional string router_id = 7 [help_text = "Neutron router id", max_length = 256, null = True, db_index = False, blank = True];
187 optional string subnet_id = 8 [help_text = "Neutron subnet id", max_length = 256, null = True, db_index = False, blank = True];
188 optional string gateway = 9 [db_index = False, max_length = 32, null = True, blank = True];
189 optional string segmentation_id = 10 [db_index = False, max_length = 32, null = True, blank = True];
190}
191
192
193message ControllerRole (XOSBase) {
194 required string role = 1 [choices = "(('admin', 'Admin'),)", max_length = 30, content_type = "stripped", blank = False, null = False, db_index = False];
195}
196
197
198message ControllerSite (XOSBase) {
Matteo Scandolod0693cc2017-12-06 15:38:13 -0800199 required manytoone site->Site:controllersite = 1 [db_index = True, null = False, blank = False, unique_with="controller", tosca_key = True];
200 optional manytoone controller->Controller:controllersite = 2 [db_index = True, null = True, blank = True, tosca_key = True];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200201 optional string tenant_id = 3 [max_length = 200, content_type = "stripped", blank = True, help_text = "Keystone tenant id", null = True, db_index = True];
202}
203
Sapan Bhatia8918ac32017-07-09 00:43:27 -0400204message ControllerPrivilege (XOSBase) {
205 required manytoone controller->Controller:controllerprivileges = 1 [db_index = True, null = False, blank = False];
206 required manytoone privilege->Privilege:controllerprivileges = 2 [db_index = True, null = False, blank = False];
207 optional string role_id = 3 [max_length = 200, content_type = "stripped", blank = True, help_text = "Keystone id", null = True, db_index = True];
208}
Sapan Bhatia170ae272017-05-30 19:01:09 +0200209
210message ControllerSitePrivilege (XOSBase) {
Sapan Bhatiaf7934b52017-06-12 05:04:23 -0700211 required manytoone controller->Controller:controllersiteprivileges = 1 [db_index = True, null = False, blank = False, unique_with = "site_privilege"];
212 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 +0200213 optional string role_id = 3 [max_length = 200, content_type = "stripped", blank = True, help_text = "Keystone id", null = True, db_index = True];
214}
215
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400216policy controller_slice_policy <
217 ctx.user.is_admin
218 | *slice_policy(slice) >
Sapan Bhatia170ae272017-05-30 19:01:09 +0200219
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400220message ControllerSlice::controller_slice_policy (XOSBase) {
Sapan Bhatiaf7934b52017-06-12 05:04:23 -0700221 required manytoone controller->Controller:controllerslices = 1 [db_index = True, null = False, blank = False, unique_with = "slice"];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200222 required manytoone slice->Slice:controllerslices = 2 [db_index = True, null = False, blank = False];
223 optional string tenant_id = 3 [max_length = 200, content_type = "stripped", blank = True, help_text = "Keystone tenant id", null = True, db_index = False];
224}
225
226
227message ControllerSlicePrivilege (XOSBase) {
Sapan Bhatiaf7934b52017-06-12 05:04:23 -0700228 required manytoone controller->Controller:controllersliceprivileges = 1 [db_index = True, null = False, blank = False, unique_with = "slice_privilege"];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200229 required manytoone slice_privilege->SlicePrivilege:controllersliceprivileges = 2 [db_index = True, null = False, blank = False];
230 optional string role_id = 3 [max_length = 200, content_type = "stripped", blank = True, help_text = "Keystone id", null = True, db_index = True];
231}
232
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400233policy controller_user_policy <
234 ctx.user.is_admin
235 | (ctx.read_access & *user_policy(user)) >
Sapan Bhatia170ae272017-05-30 19:01:09 +0200236
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400237message ControllerUser::controller_user_policy (XOSBase) {
Sapan Bhatia170ae272017-05-30 19:01:09 +0200238 required manytoone user->User:controllerusers = 1 [db_index = True, null = False, blank = False];
Sapan Bhatiaf7934b52017-06-12 05:04:23 -0700239 required manytoone controller->Controller:controllersusers = 2 [db_index = True, null = False, blank = False, unique_with = "user"];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200240 optional string kuser_id = 3 [max_length = 200, content_type = "stripped", blank = True, help_text = "Keystone user id", null = True, db_index = False];
241}
242
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400243// Everyone has read access
244// For write access you need admin privileges at that deployment
245policy deployment_policy <
246 ctx.user.is_admin
247 | (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 +0200248
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400249message Deployment::deployment_policy (XOSBase) {
Sapan Bhatia170ae272017-05-30 19:01:09 +0200250 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 +0200251 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 +0200252}
253
254
255message DeploymentPrivilege (XOSBase) {
Sapan Bhatiaf7934b52017-06-12 05:04:23 -0700256 required manytoone user->User:deploymentprivileges = 1 [db_index = True, null = False, blank = False, unique_with="deployment"];
257 required manytoone deployment->Deployment:deploymentprivileges = 2 [db_index = True, null = False, blank = False, unique_with="role"];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200258 required manytoone role->DeploymentRole:deploymentprivileges = 3 [db_index = True, null = False, blank = False];
259}
260
261
262message DeploymentRole (XOSBase) {
Matteo Scandolod0693cc2017-12-06 15:38:13 -0800263 required string role = 1 [choices = "(('admin', 'Admin'),)", max_length = 30, content_type = "stripped", blank = False, null = False, db_index = False, tosca_key=True];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200264}
265
266
267message Diag (XOSBase) {
Matteo Scandolo2521a4d2017-11-20 15:53:17 -0800268 option gui_hidden = True;
269 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 +0200270}
271
272
273message Flavor (XOSBase) {
274 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];
275 optional string description = 2 [db_index = False, max_length = 1024, null = True, content_type = "stripped", blank = True];
276 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 +0200277}
278
279
280message Image (XOSBase) {
281 required string name = 1 [db_index = False, max_length = 256, null = False, content_type = "stripped", blank = False];
282 required string kind = 2 [default = "vm", choices = "(('vm', 'Virtual Machine'), ('container', 'Container'))", max_length = 30, blank = False, null = False, db_index = False];
283 required string disk_format = 3 [db_index = False, max_length = 256, null = False, content_type = "stripped", blank = False];
284 required string container_format = 4 [db_index = False, max_length = 256, null = False, content_type = "stripped", blank = False];
285 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];
286 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 +0200287}
288
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400289policy image_deployment_policy <
290 *deployment_policy(deployment)
291>
Sapan Bhatia170ae272017-05-30 19:01:09 +0200292
293message ImageDeployments (XOSBase) {
Sapan Bhatiaf7934b52017-06-12 05:04:23 -0700294 required manytoone image->Image:imagedeployments = 1 [db_index = True, null = False, blank = False, unique_with = "deployment"];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200295 required manytoone deployment->Deployment:imagedeployments = 2 [db_index = True, null = False, blank = False];
296}
297
Sapan Bhatia5ea307d2017-07-19 00:13:21 -0400298policy instance_creator < obj.creator >
Sapan Bhatia9227b4d2017-07-25 23:14:48 -0400299policy instance_isolation < (obj.isolation = "container" | obj.isolation = "container_vm" ) -> (obj.image.kind = "container") >
300policy instance_isolation_container_vm_parent < (obj.isolation = "container_vm") -> obj.parent >
301policy instance_parent_isolation_container_vm < obj.parent -> ( obj.isolation = "container_vm" ) >
Sapan Bhatia5ea307d2017-07-19 00:13:21 -0400302policy instance_isolation_vm < (obj.isolation = "vm") -> (obj.image.kind = "vm") >
Sapan Bhatia5ea307d2017-07-19 00:13:21 -0400303policy 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 +0200304
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400305policy instance_policy < *slice_policy(slice) >
306
307message Instance::instance_policy (XOSBase) {
308 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 +0200309 optional string instance_id = 1 [max_length = 200, content_type = "stripped", blank = True, help_text = "Nova instance id", null = True, db_index = False];
310 optional string instance_uuid = 2 [max_length = 200, content_type = "stripped", blank = True, help_text = "Nova instance uuid", null = True, db_index = False];
311 required string name = 3 [max_length = 200, content_type = "stripped", blank = False, help_text = "Instance name", null = False, db_index = False];
312 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 -0700313 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 +0200314 required manytoone image->Image:instances = 6 [db_index = True, null = False, blank = False];
315 optional manytoone creator->User:instances = 7 [db_index = True, null = True, blank = True];
316 required manytoone slice->Slice:instances = 8 [db_index = True, null = False, blank = False];
317 required manytoone deployment->Deployment:instance_deployment = 9 [db_index = True, null = False, blank = False];
318 required manytoone node->Node:instances = 10 [db_index = True, null = False, blank = False];
319 required int32 numberCores = 11 [help_text = "Number of cores for instance", default = 0, null = False, db_index = False, blank = False];
320 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 +0200321 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 +0200322 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];
323 optional string volumes = 15 [help_text = "Comma-separated list of directories to expose to parent context", null = True, db_index = False, blank = True];
324 optional manytoone parent->Instance:instance = 16 [help_text = "Parent Instance for containers nested inside of VMs", null = True, db_index = True, blank = True];
325}
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400326
327
328policy network_policy < *slice_policy(owner) >
329
330message Network::network_policy (XOSBase) {
Sapan Bhatia170ae272017-05-30 19:01:09 +0200331 required string name = 1 [db_index = False, max_length = 32, null = False, blank = False];
332 required manytoone template->NetworkTemplate:network = 2 [db_index = True, null = False, blank = False];
333 required string subnet = 3 [db_index = False, max_length = 32, null = False, blank = True];
334 required string start_ip = 4 [db_index = False, max_length = 32, null = False, blank = True];
335 required string end_ip = 5 [db_index = False, max_length = 32, null = False, blank = True];
336 optional string ports = 6 [db_index = False, max_length = 1024, null = True, blank = True];
337 optional string labels = 7 [db_index = False, max_length = 1024, null = True, blank = True];
338 required manytoone owner->Slice:ownedNetworks = 8 [help_text = "Slice that owns control of this Network", null = False, db_index = True, blank = False];
339 required bool permit_all_slices = 10 [default = False, null = False, db_index = False, blank = True];
340 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];
341 required manytomany permitted_slices->Slice/Network_permitted_slices:availableNetworks = 18 [db_index = False, null = False, blank = True];
342 required manytomany slices->Slice/NetworkSlice:networks = 19 [db_index = False, null = False, blank = True];
343 required manytomany instances->Instance/Port:networks = 20 [db_index = False, null = False, blank = True];
344}
345
346
347message NetworkParameter (XOSBase) {
348 required manytoone parameter->NetworkParameterType:networkparameters = 1 [help_text = "The type of the parameter", null = False, db_index = True, blank = False];
349 required string value = 2 [help_text = "The value of this parameter", max_length = 1024, null = False, db_index = False, blank = False];
350 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];
351 required uint32 object_id = 4 [db_index = False, null = False, blank = False, help_text = "Object linked to this NetworkParameter"];
352}
353
354
355message NetworkParameterType (XOSBase) {
356 required string name = 1 [help_text = "The name of this parameter", max_length = 128, null = False, db_index = True, blank = False];
357 required string description = 2 [db_index = False, max_length = 1024, null = False, blank = False];
358}
359
Sapan Bhatia9227b4d2017-07-25 23:14:48 -0400360policy 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 -0400361policy network_slice_policy < *slice_policy(slice) & *network_policy(network) >
Sapan Bhatia170ae272017-05-30 19:01:09 +0200362
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400363message NetworkSlice::network_slice_policy (XOSBase) {
Sapan Bhatia39419592017-10-19 13:02:22 -0400364 option validators = "network_slice_validator:Slice {obj.slice.name} is not allowed to connect to networks {obj.network}";
Matteo Scandolofb37c8f2017-10-18 09:53:30 +0200365 required manytoone network->Network:networkslices = 1 [db_index = True, null = False, blank = False, unique_with = "slice", tosca_key=True];
366 required manytoone slice->Slice:networkslices = 2 [db_index = True, null = False, blank = False, tosca_key=True];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200367}
Sapan Bhatia5ea307d2017-07-19 00:13:21 -0400368
Sapan Bhatia170ae272017-05-30 19:01:09 +0200369message NetworkTemplate (XOSBase) {
370 required string name = 1 [db_index = False, max_length = 32, null = False, blank = False];
371 optional string description = 2 [db_index = False, max_length = 1024, null = True, blank = True];
372 required string visibility = 4 [default = "private", choices = "(('public', 'public'), ('private', 'private'))", max_length = 30, blank = False, null = False, db_index = False];
373 required string translation = 5 [default = "none", choices = "(('none', 'none'), ('NAT', 'NAT'))", max_length = 30, blank = False, null = False, db_index = False];
374 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];
375 optional string shared_network_name = 7 [db_index = False, max_length = 30, null = True, blank = True];
376 optional string shared_network_id = 8 [help_text = "Quantum network", max_length = 256, null = True, db_index = False, blank = True];
377 required string topology_kind = 9 [default = "bigswitch", choices = "(('bigswitch', 'BigSwitch'), ('physical', 'Physical'), ('custom', 'Custom'))", max_length = 30, blank = False, null = False, db_index = False];
378 optional string controller_kind = 10 [blank = True, max_length = 30, null = True, db_index = False, choices = "((None, 'None'), ('onos', 'ONOS'), ('custom', 'Custom'))"];
379 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];
380}
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400381
382policy node_policy < *site_policy(site_deployment.site) >
383
384message Node::node_policy (XOSBase) {
Sapan Bhatia170ae272017-05-30 19:01:09 +0200385 required string name = 1 [max_length = 200, content_type = "stripped", blank = False, help_text = "Name of the Node", null = False, db_index = False];
386 required manytoone site_deployment->SiteDeployment:nodes = 2 [db_index = True, null = False, blank = False];
387}
388message NodeLabel (XOSBase) {
389 required string name = 1 [max_length = 200, content_type = "stripped", blank = False, help_text = "label name", null = False, db_index = False];
390 required manytomany node->Node/NodeLabel_node:nodelabels = 2 [db_index = False, null = False, blank = True];
391}
Sapan Bhatia5ea307d2017-07-19 00:13:21 -0400392
Sapan Bhatia9227b4d2017-07-25 23:14:48 -0400393policy 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 -0400394policy port_policy < *instance_policy(instance) & *network_policy(network) >
Sapan Bhatia5ea307d2017-07-19 00:13:21 -0400395
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400396message Port::port_policy (XOSBase) {
Sapan Bhatia9227b4d2017-07-25 23:14:48 -0400397 option validators = "port_validator:Slice is not allowed to connect to network";
Sapan Bhatiaf7934b52017-06-12 05:04:23 -0700398 required manytoone network->Network:links = 1 [db_index = True, null = False, blank = False, unique_with = "instance"];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200399 optional manytoone instance->Instance:ports = 2 [db_index = True, null = True, blank = True];
400 optional string ip = 3 [max_length = 39, content_type = "ip", blank = True, help_text = "Instance ip address", null = True, db_index = False];
401 optional string port_id = 4 [help_text = "Neutron port id", max_length = 256, null = True, db_index = False, blank = True];
402 optional string mac = 5 [help_text = "MAC address associated with this port", max_length = 256, null = True, db_index = False, blank = True];
403 required bool xos_created = 6 [default = False, null = False, db_index = False, blank = True];
404}
405
406
407message Role (XOSBase) {
408 required string role_type = 1 [db_index = False, max_length = 80, null = False, content_type = "stripped", blank = False];
409 optional string role = 2 [db_index = False, max_length = 80, null = True, content_type = "stripped", blank = True];
410 required string description = 3 [db_index = False, max_length = 120, null = False, content_type = "stripped", blank = False];
411}
412
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400413policy 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 +0200414
415message Service (XOSBase,AttributeMixin) {
Sapan Bhatiad022aeb2017-06-07 15:49:55 +0200416 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 +0200417 required bool enabled = 2 [default = True, null = False, db_index = False, blank = True];
Scott Bakerd6e533f2017-07-17 13:37:29 -0700418 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 +0200419 required string name = 4 [max_length = 30, content_type = "stripped", blank = False, help_text = "Service Name", null = False, db_index = False];
420 optional string versionNumber = 5 [max_length = 30, content_type = "stripped", blank = True, help_text = "Version of Service Definition", null = True, db_index = False];
421 required bool published = 6 [default = True, null = False, db_index = False, blank = True];
422 optional string view_url = 7 [db_index = False, max_length = 1024, null = True, content_type = "stripped", blank = True];
423 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 +0200424 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 -0700425 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 +0200426 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 +0200427 optional string service_specific_attribute = 12 [db_index = False, null = True, blank = True, varchar = True];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200428}
429
430
431message ServiceAttribute (XOSBase) {
432 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 +0200433 required string value = 2 [help_text = "Attribute Value", null = False, db_index = False, blank = False, varchar = True];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200434 required manytoone service->Service:serviceattributes = 3 [help_text = "The Service this attribute is associated with", null = False, db_index = True, blank = False];
435}
436
437
Scott Baker071da962017-07-13 10:43:41 -0700438message ServiceDependency (XOSBase) {
Matteo Scandolofb37c8f2017-10-18 09:53:30 +0200439 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 Chen99a618d2018-03-14 13:42:12 +0800440 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];
Scott Baker071da962017-07-13 10:43:41 -0700441 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 +0200442}
443
444
445message ServiceMonitoringAgentInfo (XOSBase) {
446 required string name = 1 [help_text = "Monitoring Agent Name", max_length = 128, null = False, db_index = False, blank = False];
447 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 +0200448 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 +0200449}
450
451
452message ServicePrivilege (XOSBase) {
Sapan Bhatiaf7934b52017-06-12 05:04:23 -0700453 required manytoone user->User:serviceprivileges = 1 [db_index = True, null = False, blank = False, unique_with = "service"];
454 required manytoone service->Service:serviceprivileges = 2 [db_index = True, null = False, blank = False, unique_with = "role"];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200455 required manytoone role->ServiceRole:serviceprivileges = 3 [db_index = True, null = False, blank = False];
456}
457
458
459message ServiceRole (XOSBase) {
460 required string role = 1 [choices = "(('admin', 'Admin'),)", max_length = 30, content_type = "stripped", blank = False, null = False, db_index = False];
461}
462
463
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400464
465message Site::site_policy (XOSBase) {
Sapan Bhatia170ae272017-05-30 19:01:09 +0200466 required string name = 1 [max_length = 200, content_type = "stripped", blank = False, help_text = "Name for this Site", null = False, db_index = False];
467 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];
468 required bool enabled = 3 [help_text = "Status for this Site", default = True, null = False, db_index = False, blank = True];
469 required bool hosts_nodes = 4 [help_text = "Indicates whether or not the site host nodes", default = True, null = False, db_index = False, blank = True];
470 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];
471 optional float longitude = 6 [db_index = False, null = True, blank = True];
472 optional float latitude = 7 [db_index = False, null = True, blank = True];
473 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];
474 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];
475 required string abbreviated_name = 10 [db_index = False, max_length = 80, null = False, content_type = "stripped", blank = False];
476 required manytomany deployments->Deployment/SiteDeployment:sites = 11 [help_text = "Select which sites are allowed to host nodes in this deployment", null = False, db_index = False, blank = True];
477}
478
479
480message SiteDeployment (XOSBase) {
Matteo Scandolofb37c8f2017-10-18 09:53:30 +0200481 required manytoone site->Site:sitedeployments = 1 [db_index = True, null = False, blank = False, unique_with = "deployment", tosca_key=True];
482 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 +0200483 optional manytoone controller->Controller:sitedeployments = 3 [db_index = True, null = True, blank = True];
484 optional string availability_zone = 4 [max_length = 200, content_type = "stripped", blank = True, help_text = "OpenStack availability zone", null = True, db_index = False];
485}
486
487
488message SitePrivilege (XOSBase) {
489 required manytoone user->User:siteprivileges = 1 [db_index = True, null = False, blank = False];
Matteo Scandolofb37c8f2017-10-18 09:53:30 +0200490 required manytoone site->Site:siteprivileges = 2 [db_index = True, null = False, blank = False, tosca_key=True];
491 required manytoone role->SiteRole:siteprivileges = 3 [db_index = True, null = False, blank = False, tosca_key=True];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200492}
493
494
495message SiteRole (XOSBase) {
Matteo Scandolod0693cc2017-12-06 15:38:13 -0800496 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 +0200497}
Sapan Bhatiacb35e7f2017-05-24 12:17:28 +0200498
Sapan Bhatia9227b4d2017-07-25 23:14:48 -0400499policy slice_name < obj.id | {{ obj.name.startswith(obj.site.login_base) }} >
Sapan Bhatia5ea307d2017-07-19 00:13:21 -0400500policy slice_name_length_and_no_spaces < {{ len(obj.site.login_base) + 1 < len(obj.name) and ' ' not in obj.name }} >
501policy slice_has_creator < obj.creator >
502
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400503
504
505message Slice::slice_policy (XOSBase) {
Sapan Bhatia39419592017-10-19 13:02:22 -0400506 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 +0200507 option plural = "Slices";
Sapan Bhatia5ea307d2017-07-19 00:13:21 -0400508
Sapan Bhatia170ae272017-05-30 19:01:09 +0200509 required string name = 1 [max_length = 80, content_type = "stripped", blank = False, help_text = "The Name of the Slice", null = False, db_index = False];
510 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 +0200511 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 +0200512 required string slice_url = 5 [db_index = False, max_length = 512, null = False, content_type = "url", blank = True];
513 required manytoone site->Site:slices = 6 [help_text = "The Site this Slice belongs to", null = False, db_index = True, blank = False];
514 required int32 max_instances = 7 [default = 10, null = False, db_index = False, blank = False];
515 optional manytoone service->Service:slices = 8 [db_index = True, null = True, blank = True];
516 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'))"];
517 optional string exposed_ports = 10 [db_index = False, max_length = 256, null = True, blank = True];
Sapan Bhatiafd37ac52017-09-01 23:21:46 -0400518 optional manytoone creator->User:slices = 12 [db_index = True, null = False, blank = False];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200519 optional manytoone default_flavor->Flavor:slices = 13 [db_index = True, null = True, blank = True];
520 optional manytoone default_image->Image:slices = 14 [db_index = True, null = True, blank = True];
521 optional manytoone default_node->Node:slices = 15 [db_index = True, null = True, blank = True];
522 optional string mount_data_sets = 16 [default = "GenBank", max_length = 256, content_type = "stripped", blank = True, null = True, db_index = False];
523 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];
524}
525
526
527message SlicePrivilege (XOSBase) {
Sapan Bhatiaf7934b52017-06-12 05:04:23 -0700528 required manytoone user->User:sliceprivileges = 1 [db_index = True, null = False, blank = False, unique_with = "slice"];
529 required manytoone slice->Slice:sliceprivileges = 2 [db_index = True, null = False, blank = False, unique_with = "role"];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200530 required manytoone role->SliceRole:sliceprivileges = 3 [db_index = True, null = False, blank = False];
531}
532
533
534message SliceRole (XOSBase) {
Matteo Scandolod0693cc2017-12-06 15:38:13 -0800535 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 +0200536}
537
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400538policy tag_policy < ctx.user.is_admin >
Sapan Bhatia170ae272017-05-30 19:01:09 +0200539
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400540message Tag::tag_policy (XOSBase) {
Sapan Bhatia170ae272017-05-30 19:01:09 +0200541 required manytoone service->Service:tags = 1 [help_text = "The Service this Tag is associated with", null = False, db_index = True, blank = False];
542 required string name = 2 [help_text = "The name of this tag", max_length = 128, null = False, db_index = True, blank = False];
543 required string value = 3 [max_length = 1024, content_type = "stripped", blank = False, help_text = "The value of this tag", null = False, db_index = False];
544 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];
545 required uint32 object_id = 5 [db_index = False, null = False, blank = False, help_text = "Object linked to this tag"];
546}
547
Scott Bakerd6e533f2017-07-17 13:37:29 -0700548message InterfaceType (XOSBase) {
549 required string name = 1 [db_index = False, max_length = 200, null = False, content_type = "stripped", blank = False];
550 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 +0200551}
552
Scott Bakerd6e533f2017-07-17 13:37:29 -0700553message ServiceInterface (XOSBase) {
Matteo Scandolofb37c8f2017-10-18 09:53:30 +0200554 required manytoone service->Service:service_interfaces = 1 [db_index = True, null = False, blank = False, tosca_key=True];
555 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 -0700556}
557
558message ServiceInstance (XOSBase, AttributeMixin) {
559 optional string name = 1 [db_index = False, max_length = 200, null = True, content_type = "stripped", blank = True];
560 required manytoone owner->Service:service_instances = 2 [db_index = True, null = False, blank = False];
561 optional string service_specific_id = 3 [db_index = False, max_length = 30, null = True, content_type = "stripped", blank = True];
562 optional string service_specific_attribute = 10 [db_index = False, null = True, blank = True, varchar = True];
Scott Bakerdbb36272017-09-05 17:12:33 -0700563 optional uint32 link_deleted_count = 11 [default = 0, help_text = "Incremented each time a provided_link is deleted from this ServiceInstance"];
Sapan Bhatia21890112017-10-31 00:25:47 -0400564 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 -0700565}
566
567message ServiceInstanceLink (XOSBase) {
Matteo Scandolofb37c8f2017-10-18 09:53:30 +0200568 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 -0700569 optional manytoone provider_service_interface->ServiceInterface:provided_links = 2 [db_index = True, null = True, blank = True];
570 optional manytoone subscriber_service_instance->ServiceInstance:subscribed_links = 3 [db_index = True, null = True, blank = True];
Matteo Scandolod0693cc2017-12-06 15:38:13 -0800571 optional manytoone subscriber_service->Service:subscribed_links = 4 [db_index = True, null = True, blank = True, tosca_key_one_of=subscriber_service_instance];
572 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 -0700573}
574
575message ServiceInstanceAttribute (XOSBase) {
Sapan Bhatia170ae272017-05-30 19:01:09 +0200576 required string name = 1 [help_text = "Attribute Name", max_length = 128, null = False, db_index = False, blank = False];
577 required string value = 2 [help_text = "Attribute Value", null = False, db_index = False, blank = False];
Scott Bakerd6e533f2017-07-17 13:37:29 -0700578 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 +0200579}
580
Scott Bakerd6e533f2017-07-17 13:37:29 -0700581message TenantWithContainer (ServiceInstance) {
Sapan Bhatia170ae272017-05-30 19:01:09 +0200582 optional manytoone instance->Instance:+ = 1 [help_text = "Instance used by this Tenant", null = True, db_index = True, blank = True];
583 optional manytoone creator->User:+ = 2 [help_text = "Creator of this Tenant", null = True, db_index = True, blank = True];
584 optional string external_hostname = 3 [max_length = 30, content_type = "stripped", blank = True, help_text = "External host name", null = True, db_index = False];
585 optional string external_container = 4 [max_length = 30, content_type = "stripped", blank = True, help_text = "External host name", null = True, db_index = False];
586}
587
Sapan Bhatia170ae272017-05-30 19:01:09 +0200588message XOS (XOSBase) {
Sapan Bhatiacb35e7f2017-05-24 12:17:28 +0200589 option singular="XOS";
590 option plural="XOSes";
Sapan Bhatia170ae272017-05-30 19:01:09 +0200591 required string name = 1 [default = "XOS", max_length = 200, content_type = "stripped", blank = False, help_text = "Name of XOS", null = False, db_index = False];
592}
593
Matteo Scandolo81c154d2017-11-22 14:55:09 -0800594message XOSGuiExtension::admin_policy (XOSBase) {
Matteo Scandoloe425f9d2017-08-15 15:56:19 -0700595 option verbose_name="XOS GUI Extension";
596 option description="This model holds the instruction to load an extension in the GUI";
Matteo Scandolocf397792017-12-01 11:49:45 -0800597 // option no_sync = True;
598 // option no_policy = True;
Matteo Scandolo31363ca2017-11-17 11:09:21 -0800599
Sapan Bhatia170ae272017-05-30 19:01:09 +0200600 required string name = 1 [max_length = 200, content_type = "stripped", blank = False, help_text = "Name of the GUI Extensions", null = False, db_index = False];
601 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];
602}
Sapan Bhatia5ea307d2017-07-19 00:13:21 -0400603
Matteo Scandolo7e3414c2017-11-15 08:10:55 -0800604message ServiceGraphConstraint (XOSBase) {
605 option verbose_name="Graph Constraint";
606 option description="Define the position of the nodes in the service graph";
607 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];
608}
609