blob: 05e9c04abd58b9f9a43ab792f78d0a02b69cd816 [file] [log] [blame]
Sapan Bhatiacb35e7f2017-05-24 12:17:28 +02001option app_label = "core";
Sapan Bhatiad022aeb2017-06-07 15:49:55 +02002
Sapan Bhatia170ae272017-05-30 19:01:09 +02003message XOSBase {
Sapan Bhatiad022aeb2017-06-07 15:49:55 +02004 option skip_init = True;
Sapan Bhatiacb35e7f2017-05-24 12:17:28 +02005
Sapan Bhatia170ae272017-05-30 19:01:09 +02006 required string created = 1 [content_type = "date", auto_now_add = True];
7 required string updated = 2 [default = "now()", content_type = "date"];
8 optional string enacted = 3 [null = True, content_type = "date", blank = True, default = None];
9 optional string policed = 4 [null = True, content_type = "date", blank = True, default = None];
Sapan Bhatiacb35e7f2017-05-24 12:17:28 +020010 optional string backend_register = 5 [default = "{}", max_length = 1024];
Sapan Bhatia170ae272017-05-30 19:01:09 +020011 required bool backend_need_delete = 6 [default = False];
12 required bool backend_need_reap = 7 [default = False];
Sapan Bhatiacb35e7f2017-05-24 12:17:28 +020013 required string backend_status = 8 [default = "0 - Provisioning in progress", max_length = 1024, null = True];
Sapan Bhatia170ae272017-05-30 19:01:09 +020014 required bool deleted = 9 [default = False];
Sapan Bhatia5ea307d2017-07-19 00:13:21 -040015 required bool write_protect = 11 [default = False];
Sapan Bhatia170ae272017-05-30 19:01:09 +020016 required bool lazy_blocked = 11 [default = False];
17 required bool no_sync = 12 [default = False];
18 required bool no_policy = 13 [default = False];
Scott Baker2c465a62017-06-09 14:21:11 -070019 optional string policy_status = 14 [default = "0 - Policy in process", max_length = 1024];
Sapan Bhatia113c2b92017-07-25 08:41:58 -040020 required string leaf_model_name = 15 [null = False, max_length = 1024, help_text = "The most specialized model in this chain of inheritance, often defined by a service developer"];
Sapan Bhatia170ae272017-05-30 19:01:09 +020021}
22
Sapan Bhatiab5ce1862017-07-31 15:48:19 -040023// The calling user represents the user being accessed, or is a site admin.
24policy user_policy <
25 ctx.user.is_admin
26 | ctx.user.id = obj.id
27 | (exists Privilege:
28 Privilege.accessor_id = ctx.user.id
29 & Privilege.accessor_type = "User"
30 & Privilege.permission = "role:admin"
31 & Privilege.object_type = "Site"
32 & Privilege.object_id = ctx.user.site.id) >
33
34message User::user_policy (AbstractBaseUser,PlModelMixIn) {
Sapan Bhatiad022aeb2017-06-07 15:49:55 +020035 option skip_django = True;
Matteo Scandoloe425f9d2017-08-15 15:56:19 -070036 option description = "An XOS User";
Sapan Bhatiacb35e7f2017-05-24 12:17:28 +020037
Sapan Bhatiad022aeb2017-06-07 15:49:55 +020038 required string email = 1 [db_index = True, max_length = 255, null = False, blank = False];
39 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 +020040 required string password = 3 [default = "Something", max_length = 255, blank = False, null = False, db_index = False];
Sapan Bhatiaafce8fd2017-06-28 23:24:53 -070041 optional string last_login = 4 [db_index = False, null = True, content_type = "date", blank = True];
42 required string firstname = 5 [max_length = 200, content_type = "stripped", blank = False, help_text = "person's given name", null = False, db_index = False];
43 required string lastname = 6 [max_length = 200, content_type = "stripped", blank = False, help_text = "person's surname", null = False, db_index = False];
44 optional string phone = 7 [max_length = 100, content_type = "stripped", blank = True, help_text = "phone number contact", null = True, db_index = False];
45 optional string user_url = 8 [db_index = False, max_length = 200, null = True, content_type = "url", blank = True];
46 required manytoone site->Site:users = 9 [help_text = "Site this user will be homed too", null = False, db_index = True, blank = False];
47 optional string public_key = 10 [help_text = "Public key string", max_length = 1024, null = True, db_index = False, blank = True, varchar = True];
48 required bool is_active = 11 [default = True, null = False, db_index = False, blank = True];
49 required bool is_admin = 12 [default = False, null = False, db_index = False, blank = True];
50 required bool is_staff = 13 [default = True, null = False, db_index = False, blank = True];
51 required bool is_readonly = 14 [default = False, null = False, db_index = False, blank = True];
52 required bool is_registering = 15 [default = False, null = False, db_index = False, blank = True];
53 required bool is_appuser = 16 [default = False, null = False, db_index = False, blank = True];
54 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];
55 required string created = 18 [db_index = False, null = False, content_type = "date", blank = True];
56 required string updated = 19 [db_index = False, null = False, content_type = "date", blank = True];
57 optional string enacted = 20 [db_index = False, null = True, content_type = "date", blank = False];
58 optional string policed = 21 [db_index = False, null = True, content_type = "date", blank = False];
59 required string backend_status = 22 [default = "Provisioning in progress", max_length = 1024, content_type = "stripped", blank = False, null = False, db_index = False];
60 required bool backend_need_delete = 23 [default = False, null = False, db_index = False, blank = True];
61 required bool backend_need_reap = 24 [default = False, null = False, db_index = False, blank = True];
62 required bool deleted = 25 [default = False, null = False, db_index = False, blank = True];
63 required bool write_protect = 26 [default = False, null = False, db_index = False, blank = True];
64 required bool lazy_blocked = 27 [default = False, null = False, db_index = False, blank = True];
65 required bool no_sync = 28 [default = False, null = False, db_index = False, blank = True];
66 required bool no_policy = 29 [default = False, null = False, db_index = False, blank = True];
67 required string timezone = 30 [default = "America/New_York", max_length = 100, blank = False, null = False, db_index = False];
68 required manytomany dashboards->DashboardView/UserDashboardView:user = 31 [db_index = False, null = False, blank = True];
Scott Bakere08d0062017-07-11 12:04:26 -070069 optional string policy_status = 32 [default = "0 - Policy in process", max_length = 1024];
70}
Sapan Bhatiad022aeb2017-06-07 15:49:55 +020071
Sapan Bhatiab5ce1862017-07-31 15:48:19 -040072// A user may give a permission that he has to another user
73policy grant_policy < ctx.user.is_admin
74 | exists Privilege:Privilege.object_type = obj.object_type
75 & Privilege.object_id = obj.object_id
76 & Privilege.accessor_type = "User"
77 & Privilege.accessor_id = ctx.user.id
78 & Privilege.permission = "role:admin" >
79
80message Privilege::grant_policy (XOSBase) {
Sapan Bhatia8918ac32017-07-09 00:43:27 -040081 required int32 accessor_id = 1 [null = False];
82 required string accessor_type = 2 [null = False, max_length=1024];
Sapan Bhatiab5ce1862017-07-31 15:48:19 -040083 required int32 controller_id = 3 [null = True];
84 required int32 object_id = 4 [null = False];
85 required string object_type = 5 [null = False, max_length=1024];
86 required string permission = 6 [null = False, default = "all", max_length=1024];
87 required string granted = 7 [content_type = "date", auto_now_add = True, max_length=1024];
88 required string expires = 8 [content_type = "date", null = True, max_length=1024];
Sapan Bhatia8918ac32017-07-09 00:43:27 -040089}
90
Sapan Bhatia170ae272017-05-30 19:01:09 +020091message AddressPool (XOSBase) {
92 required string name = 1 [db_index = False, max_length = 32, null = False, blank = False];
Sapan Bhatiad022aeb2017-06-07 15:49:55 +020093 optional string addresses = 2 [db_index = False, null = True, blank = True, varchar = True];
Sapan Bhatia170ae272017-05-30 19:01:09 +020094 optional string gateway_ip = 3 [db_index = False, max_length = 32, null = True, blank = False];
95 optional string gateway_mac = 4 [db_index = False, max_length = 32, null = True, blank = False];
96 optional string cidr = 5 [db_index = False, max_length = 32, null = True, blank = False];
Sapan Bhatiad022aeb2017-06-07 15:49:55 +020097 optional string inuse = 6 [db_index = False, null = True, blank = True, varchar = True];
Sapan Bhatia170ae272017-05-30 19:01:09 +020098 optional manytoone service->Service:addresspools = 7 [db_index = True, null = True, blank = True];
99}
100
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400101// Admins at a deployment have access to controllers at those deployments
102policy controller_policy
103 < ctx.user.is_admin
104 | exists Privilege:
105 Privilege.accessor_id = ctx.user.id
106 & Privilege.object_type = "Deployment"
107 & Privilege.permission = "role:admin"
108 & Privilege.object_id = obj.id >
Sapan Bhatia170ae272017-05-30 19:01:09 +0200109
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400110message Controller::controller_policy (XOSBase) {
Sapan Bhatia170ae272017-05-30 19:01:09 +0200111 required string name = 1 [max_length = 200, content_type = "stripped", blank = False, help_text = "Name of the Controller", null = False, db_index = False];
112 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];
113 required string version = 3 [max_length = 200, content_type = "stripped", blank = False, help_text = "Controller version", null = False, db_index = False];
114 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];
115 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];
116 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];
117 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];
118 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];
119 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];
120 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];
121 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];
122 required manytoone deployment->Deployment:controllerdeployments = 12 [db_index = True, null = False, blank = False];
123}
124
125
126message ControllerDashboardView (XOSBase) {
127 required manytoone controller->Controller:controllerdashboardviews = 1 [db_index = True, null = False, blank = False];
128 required manytoone dashboardView->DashboardView:controllerdashboardviews = 2 [db_index = True, null = False, blank = False];
Sapan Bhatiacb35e7f2017-05-24 12:17:28 +0200129 required bool enabled = 3 [default = True, db_index = False, blank = True];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200130 required string url = 4 [max_length = 1024, content_type = "stripped", blank = False, help_text = "URL of Dashboard", null = False, db_index = False];
131}
132
133
134message ControllerImages (XOSBase) {
Sapan Bhatiaf7934b52017-06-12 05:04:23 -0700135 required manytoone image->Image:controllerimages = 1 [db_index = True, null = False, blank = False, unique_with = "controller"];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200136 required manytoone controller->Controller:controllerimages = 2 [db_index = True, null = False, blank = False];
137 optional string glance_image_id = 3 [max_length = 200, content_type = "stripped", blank = True, help_text = "Glance image id", null = True, db_index = False];
138}
139
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400140// Everyone has read access
141// For write access, you have to be a site_admin
Sapan Bhatia170ae272017-05-30 19:01:09 +0200142
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400143policy site_policy <
144 ctx.user.is_admin
145 | (ctx.write_access -> exists Privilege: Privilege.object_type = "Site" & Privilege.object_id = obj.id & Privilege.accessor_id = ctx.user.id & Privilege.permission = "role:admin") >
146
147// If you can access (read or write) the site, you can also access its slices
148// Otherwise, you need an explicit privilege on the Slice (admin for write access)
149// or admin privilege on the associated site.
150policy slice_policy <
151 ctx.user.is_admin
152 | (*site_policy(site)
153 & (ctx.user.id = obj.creator.id
154 | (exists Privilege:
155 Privilege.accessor_id = ctx.user.id
156 & Privilege.accessor_type = "User"
157 & Privilege.object_type = "Slice"
158 & Privilege.object_id = obj.id
159 & (ctx.write_access -> Privilege.permission = "role:admin"))
160 )
161 |
162 (exists Privilege:
163 Privilege.accessor_id = ctx.user.id
164 & Privilege.accessor_type = "User"
165 & Privilege.object_type = "Slice"
166 & Privilege.object_id = obj.id)
167 | (exists Privilege:
168 Privilege.accessor_id = ctx.user.id
169 & Privilege.accessor_type = "User"
170 & Privilege.object_type = "Site"
171 & Privilege.object_id = obj.site.id
172 & Privilege.permission = "role:admin")
173 ) >
174
175policy controller_network_policy <
176 ctx.user.is_admin
177 | *slice_policy(network.owner) >
178
179
180message ControllerNetwork::controller_network_policy (XOSBase) {
Sapan Bhatiaf7934b52017-06-12 05:04:23 -0700181 required manytoone network->Network:controllernetworks = 1 [db_index = True, null = False, blank = False, unique_with = "controller"];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200182 required manytoone controller->Controller:controllernetworks = 2 [db_index = True, null = False, blank = False];
183 required string subnet = 3 [db_index = False, max_length = 32, null = False, blank = True];
184 required string start_ip = 4 [db_index = False, max_length = 32, null = False, blank = True];
185 required string stop_ip = 5 [db_index = False, max_length = 32, null = False, blank = True];
186 optional string net_id = 6 [help_text = "Neutron network", max_length = 256, null = True, db_index = False, blank = True];
187 optional string router_id = 7 [help_text = "Neutron router id", max_length = 256, null = True, db_index = False, blank = True];
188 optional string subnet_id = 8 [help_text = "Neutron subnet id", max_length = 256, null = True, db_index = False, blank = True];
189 optional string gateway = 9 [db_index = False, max_length = 32, null = True, blank = True];
190 optional string segmentation_id = 10 [db_index = False, max_length = 32, null = True, blank = True];
191}
192
193
194message ControllerRole (XOSBase) {
195 required string role = 1 [choices = "(('admin', 'Admin'),)", max_length = 30, content_type = "stripped", blank = False, null = False, db_index = False];
196}
197
198
199message ControllerSite (XOSBase) {
Sapan Bhatiaf7934b52017-06-12 05:04:23 -0700200 required manytoone site->Site:controllersite = 1 [db_index = True, null = False, blank = False, unique_with="controller"];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200201 optional manytoone controller->Controller:controllersite = 2 [db_index = True, null = True, blank = True];
202 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 Bhatia8918ac32017-07-09 00:43:27 -0400205message ControllerPrivilege (XOSBase) {
206 required manytoone controller->Controller:controllerprivileges = 1 [db_index = True, null = False, blank = False];
207 required manytoone privilege->Privilege:controllerprivileges = 2 [db_index = True, null = False, blank = False];
208 optional string role_id = 3 [max_length = 200, content_type = "stripped", blank = True, help_text = "Keystone id", null = True, db_index = True];
209}
Sapan Bhatia170ae272017-05-30 19:01:09 +0200210
211message ControllerSitePrivilege (XOSBase) {
Sapan Bhatiaf7934b52017-06-12 05:04:23 -0700212 required manytoone controller->Controller:controllersiteprivileges = 1 [db_index = True, null = False, blank = False, unique_with = "site_privilege"];
213 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 +0200214 optional string role_id = 3 [max_length = 200, content_type = "stripped", blank = True, help_text = "Keystone id", null = True, db_index = True];
215}
216
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400217policy controller_slice_policy <
218 ctx.user.is_admin
219 | *slice_policy(slice) >
Sapan Bhatia170ae272017-05-30 19:01:09 +0200220
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400221message ControllerSlice::controller_slice_policy (XOSBase) {
Sapan Bhatiaf7934b52017-06-12 05:04:23 -0700222 required manytoone controller->Controller:controllerslices = 1 [db_index = True, null = False, blank = False, unique_with = "slice"];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200223 required manytoone slice->Slice:controllerslices = 2 [db_index = True, null = False, blank = False];
224 optional string tenant_id = 3 [max_length = 200, content_type = "stripped", blank = True, help_text = "Keystone tenant id", null = True, db_index = False];
225}
226
227
228message ControllerSlicePrivilege (XOSBase) {
Sapan Bhatiaf7934b52017-06-12 05:04:23 -0700229 required manytoone controller->Controller:controllersliceprivileges = 1 [db_index = True, null = False, blank = False, unique_with = "slice_privilege"];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200230 required manytoone slice_privilege->SlicePrivilege:controllersliceprivileges = 2 [db_index = True, null = False, blank = False];
231 optional string role_id = 3 [max_length = 200, content_type = "stripped", blank = True, help_text = "Keystone id", null = True, db_index = True];
232}
233
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400234policy controller_user_policy <
235 ctx.user.is_admin
236 | (ctx.read_access & *user_policy(user)) >
Sapan Bhatia170ae272017-05-30 19:01:09 +0200237
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400238message ControllerUser::controller_user_policy (XOSBase) {
Sapan Bhatia170ae272017-05-30 19:01:09 +0200239 required manytoone user->User:controllerusers = 1 [db_index = True, null = False, blank = False];
Sapan Bhatiaf7934b52017-06-12 05:04:23 -0700240 required manytoone controller->Controller:controllersusers = 2 [db_index = True, null = False, blank = False, unique_with = "user"];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200241 optional string kuser_id = 3 [max_length = 200, content_type = "stripped", blank = True, help_text = "Keystone user id", null = True, db_index = False];
242}
243
244
245message DashboardView (XOSBase) {
246 required string name = 1 [max_length = 200, content_type = "stripped", blank = False, help_text = "Name of the View", null = False, db_index = False];
247 required string url = 2 [max_length = 1024, content_type = "stripped", blank = False, help_text = "URL of Dashboard", null = False, db_index = False];
Sapan Bhatiacb35e7f2017-05-24 12:17:28 +0200248 required bool enabled = 3 [default = True, db_index = False, blank = True];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200249 required string icon = 4 [default = "default-icon.png", max_length = 200, blank = False, help_text = "Icon for Dashboard", null = False, db_index = False];
250 required string icon_active = 5 [default = "default-icon-active.png", max_length = 200, blank = False, help_text = "Icon for active Dashboard", null = False, db_index = False];
251 required manytomany controllers->Controller/ControllerDashboardView:dashboardviews = 6 [db_index = False, null = False, blank = True];
252 required manytomany deployments->Deployment/DashboardView_deployments:dashboardviews = 7 [help_text = "Deployments that should be included in this view", null = False, db_index = False, blank = True];
253}
254
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400255// Everyone has read access
256// For write access you need admin privileges at that deployment
257policy deployment_policy <
258 ctx.user.is_admin
259 | (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 +0200260
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400261message Deployment::deployment_policy (XOSBase) {
Sapan Bhatia170ae272017-05-30 19:01:09 +0200262 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 +0200263 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 +0200264}
265
266
267message DeploymentPrivilege (XOSBase) {
Sapan Bhatiaf7934b52017-06-12 05:04:23 -0700268 required manytoone user->User:deploymentprivileges = 1 [db_index = True, null = False, blank = False, unique_with="deployment"];
269 required manytoone deployment->Deployment:deploymentprivileges = 2 [db_index = True, null = False, blank = False, unique_with="role"];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200270 required manytoone role->DeploymentRole:deploymentprivileges = 3 [db_index = True, null = False, blank = False];
271}
272
273
274message DeploymentRole (XOSBase) {
275 required string role = 1 [choices = "(('admin', 'Admin'),)", max_length = 30, content_type = "stripped", blank = False, null = False, db_index = False];
276}
277
278
279message Diag (XOSBase) {
280 required string name = 1 [max_length = 200, content_type = "stripped", blank = False, help_text = "Name of the synchronizer", null = False, db_index = False];
281}
282
283
284message Flavor (XOSBase) {
285 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];
286 optional string description = 2 [db_index = False, max_length = 1024, null = True, content_type = "stripped", blank = True];
287 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 +0200288}
289
290
291message Image (XOSBase) {
292 required string name = 1 [db_index = False, max_length = 256, null = False, content_type = "stripped", blank = False];
293 required string kind = 2 [default = "vm", choices = "(('vm', 'Virtual Machine'), ('container', 'Container'))", max_length = 30, blank = False, null = False, db_index = False];
294 required string disk_format = 3 [db_index = False, max_length = 256, null = False, content_type = "stripped", blank = False];
295 required string container_format = 4 [db_index = False, max_length = 256, null = False, content_type = "stripped", blank = False];
296 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];
297 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 +0200298}
299
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400300policy image_deployment_policy <
301 *deployment_policy(deployment)
302>
Sapan Bhatia170ae272017-05-30 19:01:09 +0200303
304message ImageDeployments (XOSBase) {
Sapan Bhatiaf7934b52017-06-12 05:04:23 -0700305 required manytoone image->Image:imagedeployments = 1 [db_index = True, null = False, blank = False, unique_with = "deployment"];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200306 required manytoone deployment->Deployment:imagedeployments = 2 [db_index = True, null = False, blank = False];
307}
308
Sapan Bhatia5ea307d2017-07-19 00:13:21 -0400309policy instance_creator < obj.creator >
Sapan Bhatia9227b4d2017-07-25 23:14:48 -0400310policy instance_isolation < (obj.isolation = "container" | obj.isolation = "container_vm" ) -> (obj.image.kind = "container") >
311policy instance_isolation_container_vm_parent < (obj.isolation = "container_vm") -> obj.parent >
312policy instance_parent_isolation_container_vm < obj.parent -> ( obj.isolation = "container_vm" ) >
Sapan Bhatia5ea307d2017-07-19 00:13:21 -0400313policy instance_isolation_vm < (obj.isolation = "vm") -> (obj.image.kind = "vm") >
Sapan Bhatia5ea307d2017-07-19 00:13:21 -0400314policy 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 +0200315
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400316policy instance_policy < *slice_policy(slice) >
317
318message Instance::instance_policy (XOSBase) {
319 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 +0200320 optional string instance_id = 1 [max_length = 200, content_type = "stripped", blank = True, help_text = "Nova instance id", null = True, db_index = False];
321 optional string instance_uuid = 2 [max_length = 200, content_type = "stripped", blank = True, help_text = "Nova instance uuid", null = True, db_index = False];
322 required string name = 3 [max_length = 200, content_type = "stripped", blank = False, help_text = "Instance name", null = False, db_index = False];
323 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 -0700324 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 +0200325 required manytoone image->Image:instances = 6 [db_index = True, null = False, blank = False];
326 optional manytoone creator->User:instances = 7 [db_index = True, null = True, blank = True];
327 required manytoone slice->Slice:instances = 8 [db_index = True, null = False, blank = False];
328 required manytoone deployment->Deployment:instance_deployment = 9 [db_index = True, null = False, blank = False];
329 required manytoone node->Node:instances = 10 [db_index = True, null = False, blank = False];
330 required int32 numberCores = 11 [help_text = "Number of cores for instance", default = 0, null = False, db_index = False, blank = False];
331 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 +0200332 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 +0200333 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];
334 optional string volumes = 15 [help_text = "Comma-separated list of directories to expose to parent context", null = True, db_index = False, blank = True];
335 optional manytoone parent->Instance:instance = 16 [help_text = "Parent Instance for containers nested inside of VMs", null = True, db_index = True, blank = True];
336}
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400337
338
339policy network_policy < *slice_policy(owner) >
340
341message Network::network_policy (XOSBase) {
Sapan Bhatia170ae272017-05-30 19:01:09 +0200342 required string name = 1 [db_index = False, max_length = 32, null = False, blank = False];
343 required manytoone template->NetworkTemplate:network = 2 [db_index = True, null = False, blank = False];
344 required string subnet = 3 [db_index = False, max_length = 32, null = False, blank = True];
345 required string start_ip = 4 [db_index = False, max_length = 32, null = False, blank = True];
346 required string end_ip = 5 [db_index = False, max_length = 32, null = False, blank = True];
347 optional string ports = 6 [db_index = False, max_length = 1024, null = True, blank = True];
348 optional string labels = 7 [db_index = False, max_length = 1024, null = True, blank = True];
349 required manytoone owner->Slice:ownedNetworks = 8 [help_text = "Slice that owns control of this Network", null = False, db_index = True, blank = False];
350 required bool permit_all_slices = 10 [default = False, null = False, db_index = False, blank = True];
351 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];
352 required manytomany permitted_slices->Slice/Network_permitted_slices:availableNetworks = 18 [db_index = False, null = False, blank = True];
353 required manytomany slices->Slice/NetworkSlice:networks = 19 [db_index = False, null = False, blank = True];
354 required manytomany instances->Instance/Port:networks = 20 [db_index = False, null = False, blank = True];
355}
356
357
358message NetworkParameter (XOSBase) {
359 required manytoone parameter->NetworkParameterType:networkparameters = 1 [help_text = "The type of the parameter", null = False, db_index = True, blank = False];
360 required string value = 2 [help_text = "The value of this parameter", max_length = 1024, null = False, db_index = False, blank = False];
361 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];
362 required uint32 object_id = 4 [db_index = False, null = False, blank = False, help_text = "Object linked to this NetworkParameter"];
363}
364
365
366message NetworkParameterType (XOSBase) {
367 required string name = 1 [help_text = "The name of this parameter", max_length = 128, null = False, db_index = True, blank = False];
368 required string description = 2 [db_index = False, max_length = 1024, null = False, blank = False];
369}
370
Sapan Bhatia9227b4d2017-07-25 23:14:48 -0400371policy 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 -0400372policy network_slice_policy < *slice_policy(slice) & *network_policy(network) >
Sapan Bhatia170ae272017-05-30 19:01:09 +0200373
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400374message NetworkSlice::network_slice_policy (XOSBase) {
Sapan Bhatia9227b4d2017-07-25 23:14:48 -0400375 option validators = "network_slice_validator:Slice { obj.slice.name } is not allowed to connect to networks { obj.network }";
Sapan Bhatiaf7934b52017-06-12 05:04:23 -0700376 required manytoone network->Network:networkslices = 1 [db_index = True, null = False, blank = False, unique_with = "slice"];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200377 required manytoone slice->Slice:networkslices = 2 [db_index = True, null = False, blank = False];
378}
Sapan Bhatia5ea307d2017-07-19 00:13:21 -0400379
Sapan Bhatia170ae272017-05-30 19:01:09 +0200380message NetworkTemplate (XOSBase) {
381 required string name = 1 [db_index = False, max_length = 32, null = False, blank = False];
382 optional string description = 2 [db_index = False, max_length = 1024, null = True, blank = True];
383 required string visibility = 4 [default = "private", choices = "(('public', 'public'), ('private', 'private'))", max_length = 30, blank = False, null = False, db_index = False];
384 required string translation = 5 [default = "none", choices = "(('none', 'none'), ('NAT', 'NAT'))", max_length = 30, blank = False, null = False, db_index = False];
385 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];
386 optional string shared_network_name = 7 [db_index = False, max_length = 30, null = True, blank = True];
387 optional string shared_network_id = 8 [help_text = "Quantum network", max_length = 256, null = True, db_index = False, blank = True];
388 required string topology_kind = 9 [default = "bigswitch", choices = "(('bigswitch', 'BigSwitch'), ('physical', 'Physical'), ('custom', 'Custom'))", max_length = 30, blank = False, null = False, db_index = False];
389 optional string controller_kind = 10 [blank = True, max_length = 30, null = True, db_index = False, choices = "((None, 'None'), ('onos', 'ONOS'), ('custom', 'Custom'))"];
390 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];
391}
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400392
393policy node_policy < *site_policy(site_deployment.site) >
394
395message Node::node_policy (XOSBase) {
Sapan Bhatia170ae272017-05-30 19:01:09 +0200396 required string name = 1 [max_length = 200, content_type = "stripped", blank = False, help_text = "Name of the Node", null = False, db_index = False];
397 required manytoone site_deployment->SiteDeployment:nodes = 2 [db_index = True, null = False, blank = False];
398}
399message NodeLabel (XOSBase) {
400 required string name = 1 [max_length = 200, content_type = "stripped", blank = False, help_text = "label name", null = False, db_index = False];
401 required manytomany node->Node/NodeLabel_node:nodelabels = 2 [db_index = False, null = False, blank = True];
402}
Sapan Bhatia5ea307d2017-07-19 00:13:21 -0400403
Sapan Bhatia9227b4d2017-07-25 23:14:48 -0400404policy 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 -0400405policy port_policy < *instance_policy(instance) & *network_policy(network) >
Sapan Bhatia5ea307d2017-07-19 00:13:21 -0400406
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400407message Port::port_policy (XOSBase) {
Sapan Bhatia9227b4d2017-07-25 23:14:48 -0400408 option validators = "port_validator:Slice is not allowed to connect to network";
Sapan Bhatiaf7934b52017-06-12 05:04:23 -0700409 required manytoone network->Network:links = 1 [db_index = True, null = False, blank = False, unique_with = "instance"];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200410 optional manytoone instance->Instance:ports = 2 [db_index = True, null = True, blank = True];
411 optional string ip = 3 [max_length = 39, content_type = "ip", blank = True, help_text = "Instance ip address", null = True, db_index = False];
412 optional string port_id = 4 [help_text = "Neutron port id", max_length = 256, null = True, db_index = False, blank = True];
413 optional string mac = 5 [help_text = "MAC address associated with this port", max_length = 256, null = True, db_index = False, blank = True];
414 required bool xos_created = 6 [default = False, null = False, db_index = False, blank = True];
415}
416
417
418message Role (XOSBase) {
419 required string role_type = 1 [db_index = False, max_length = 80, null = False, content_type = "stripped", blank = False];
420 optional string role = 2 [db_index = False, max_length = 80, null = True, content_type = "stripped", blank = True];
421 required string description = 3 [db_index = False, max_length = 120, null = False, content_type = "stripped", blank = False];
422}
423
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400424policy 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 +0200425
426message Service (XOSBase,AttributeMixin) {
Sapan Bhatiad022aeb2017-06-07 15:49:55 +0200427 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 +0200428 required bool enabled = 2 [default = True, null = False, db_index = False, blank = True];
Scott Bakerd6e533f2017-07-17 13:37:29 -0700429 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 +0200430 required string name = 4 [max_length = 30, content_type = "stripped", blank = False, help_text = "Service Name", null = False, db_index = False];
431 optional string versionNumber = 5 [max_length = 30, content_type = "stripped", blank = True, help_text = "Version of Service Definition", null = True, db_index = False];
432 required bool published = 6 [default = True, null = False, db_index = False, blank = True];
433 optional string view_url = 7 [db_index = False, max_length = 1024, null = True, content_type = "stripped", blank = True];
434 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 +0200435 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 -0700436 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 +0200437 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 +0200438 optional string service_specific_attribute = 12 [db_index = False, null = True, blank = True, varchar = True];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200439}
440
441
442message ServiceAttribute (XOSBase) {
443 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 +0200444 required string value = 2 [help_text = "Attribute Value", null = False, db_index = False, blank = False, varchar = True];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200445 required manytoone service->Service:serviceattributes = 3 [help_text = "The Service this attribute is associated with", null = False, db_index = True, blank = False];
446}
447
448
Scott Baker071da962017-07-13 10:43:41 -0700449message ServiceDependency (XOSBase) {
Scott Bakerd6e533f2017-07-17 13:37:29 -0700450 required manytoone provider_service->Service:provided_dependencies = 1 [help_text = "The service that provides this dependency", null=False, db_index = True, blank=False];
451 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 -0700452 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 +0200453}
454
455
456message ServiceMonitoringAgentInfo (XOSBase) {
457 required string name = 1 [help_text = "Monitoring Agent Name", max_length = 128, null = False, db_index = False, blank = False];
458 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 +0200459 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 +0200460}
461
462
463message ServicePrivilege (XOSBase) {
Sapan Bhatiaf7934b52017-06-12 05:04:23 -0700464 required manytoone user->User:serviceprivileges = 1 [db_index = True, null = False, blank = False, unique_with = "service"];
465 required manytoone service->Service:serviceprivileges = 2 [db_index = True, null = False, blank = False, unique_with = "role"];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200466 required manytoone role->ServiceRole:serviceprivileges = 3 [db_index = True, null = False, blank = False];
467}
468
469
470message ServiceRole (XOSBase) {
471 required string role = 1 [choices = "(('admin', 'Admin'),)", max_length = 30, content_type = "stripped", blank = False, null = False, db_index = False];
472}
473
474
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400475
476message Site::site_policy (XOSBase) {
Sapan Bhatia170ae272017-05-30 19:01:09 +0200477 required string name = 1 [max_length = 200, content_type = "stripped", blank = False, help_text = "Name for this Site", null = False, db_index = False];
478 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];
479 required bool enabled = 3 [help_text = "Status for this Site", default = True, null = False, db_index = False, blank = True];
480 required bool hosts_nodes = 4 [help_text = "Indicates whether or not the site host nodes", default = True, null = False, db_index = False, blank = True];
481 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];
482 optional float longitude = 6 [db_index = False, null = True, blank = True];
483 optional float latitude = 7 [db_index = False, null = True, blank = True];
484 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];
485 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];
486 required string abbreviated_name = 10 [db_index = False, max_length = 80, null = False, content_type = "stripped", blank = False];
487 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];
488}
489
490
491message SiteDeployment (XOSBase) {
Sapan Bhatiaf7934b52017-06-12 05:04:23 -0700492 required manytoone site->Site:sitedeployments = 1 [db_index = True, null = False, blank = False, unique_with = "deployment"];
493 required manytoone deployment->Deployment:sitedeployments = 2 [db_index = True, null = False, blank = False, unique_with = "controller"];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200494 optional manytoone controller->Controller:sitedeployments = 3 [db_index = True, null = True, blank = True];
495 optional string availability_zone = 4 [max_length = 200, content_type = "stripped", blank = True, help_text = "OpenStack availability zone", null = True, db_index = False];
496}
497
498
499message SitePrivilege (XOSBase) {
500 required manytoone user->User:siteprivileges = 1 [db_index = True, null = False, blank = False];
501 required manytoone site->Site:siteprivileges = 2 [db_index = True, null = False, blank = False];
502 required manytoone role->SiteRole:siteprivileges = 3 [db_index = True, null = False, blank = False];
503}
504
505
506message SiteRole (XOSBase) {
507 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];
508}
Sapan Bhatiacb35e7f2017-05-24 12:17:28 +0200509
Sapan Bhatia9227b4d2017-07-25 23:14:48 -0400510policy slice_name < obj.id | {{ obj.name.startswith(obj.site.login_base) }} >
Sapan Bhatia5ea307d2017-07-19 00:13:21 -0400511policy slice_name_length_and_no_spaces < {{ len(obj.site.login_base) + 1 < len(obj.name) and ' ' not in obj.name }} >
512policy slice_has_creator < obj.creator >
513
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400514
515
516message Slice::slice_policy (XOSBase) {
517 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 +0200518 option plural = "Slices";
Sapan Bhatia5ea307d2017-07-19 00:13:21 -0400519
Sapan Bhatia170ae272017-05-30 19:01:09 +0200520 required string name = 1 [max_length = 80, content_type = "stripped", blank = False, help_text = "The Name of the Slice", null = False, db_index = False];
521 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 +0200522 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 +0200523 required string slice_url = 5 [db_index = False, max_length = 512, null = False, content_type = "url", blank = True];
524 required manytoone site->Site:slices = 6 [help_text = "The Site this Slice belongs to", null = False, db_index = True, blank = False];
525 required int32 max_instances = 7 [default = 10, null = False, db_index = False, blank = False];
526 optional manytoone service->Service:slices = 8 [db_index = True, null = True, blank = True];
527 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'))"];
528 optional string exposed_ports = 10 [db_index = False, max_length = 256, null = True, blank = True];
529 optional manytoone creator->User:slices = 12 [db_index = True, null = True, blank = True];
530 optional manytoone default_flavor->Flavor:slices = 13 [db_index = True, null = True, blank = True];
531 optional manytoone default_image->Image:slices = 14 [db_index = True, null = True, blank = True];
532 optional manytoone default_node->Node:slices = 15 [db_index = True, null = True, blank = True];
533 optional string mount_data_sets = 16 [default = "GenBank", max_length = 256, content_type = "stripped", blank = True, null = True, db_index = False];
534 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];
535}
536
537
538message SlicePrivilege (XOSBase) {
Sapan Bhatiaf7934b52017-06-12 05:04:23 -0700539 required manytoone user->User:sliceprivileges = 1 [db_index = True, null = False, blank = False, unique_with = "slice"];
540 required manytoone slice->Slice:sliceprivileges = 2 [db_index = True, null = False, blank = False, unique_with = "role"];
Sapan Bhatia170ae272017-05-30 19:01:09 +0200541 required manytoone role->SliceRole:sliceprivileges = 3 [db_index = True, null = False, blank = False];
542}
543
544
545message SliceRole (XOSBase) {
546 required string role = 1 [choices = "(('admin', 'Admin'), ('default', 'Default'))", max_length = 30, content_type = "stripped", blank = False, null = False, db_index = False];
547}
548
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400549policy tag_policy < ctx.user.is_admin >
Sapan Bhatia170ae272017-05-30 19:01:09 +0200550
Sapan Bhatiab5ce1862017-07-31 15:48:19 -0400551message Tag::tag_policy (XOSBase) {
Sapan Bhatia170ae272017-05-30 19:01:09 +0200552 required manytoone service->Service:tags = 1 [help_text = "The Service this Tag is associated with", null = False, db_index = True, blank = False];
553 required string name = 2 [help_text = "The name of this tag", max_length = 128, null = False, db_index = True, blank = False];
554 required string value = 3 [max_length = 1024, content_type = "stripped", blank = False, help_text = "The value of this tag", null = False, db_index = False];
555 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];
556 required uint32 object_id = 5 [db_index = False, null = False, blank = False, help_text = "Object linked to this tag"];
557}
558
Scott Bakerd6e533f2017-07-17 13:37:29 -0700559message InterfaceType (XOSBase) {
560 required string name = 1 [db_index = False, max_length = 200, null = False, content_type = "stripped", blank = False];
561 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 +0200562}
563
Scott Bakerd6e533f2017-07-17 13:37:29 -0700564message ServiceInterface (XOSBase) {
565 required manytoone service->Service:service_interfaces = 1 [db_index = True, null = False, blank = False];
566 required manytoone interface_type->InterfaceType:service_interfaces = 2 [db_index = True, null = False, blank = False];
567}
568
569message ServiceInstance (XOSBase, AttributeMixin) {
570 optional string name = 1 [db_index = False, max_length = 200, null = True, content_type = "stripped", blank = True];
571 required manytoone owner->Service:service_instances = 2 [db_index = True, null = False, blank = False];
572 optional string service_specific_id = 3 [db_index = False, max_length = 30, null = True, content_type = "stripped", blank = True];
573 optional string service_specific_attribute = 10 [db_index = False, null = True, blank = True, varchar = True];
574}
575
576message ServiceInstanceLink (XOSBase) {
577 required manytoone provider_service_instance->ServiceInstance:provided_links = 1 [db_index = True, null = False, blank = False];
578 optional manytoone provider_service_interface->ServiceInterface:provided_links = 2 [db_index = True, null = True, blank = True];
579 optional manytoone subscriber_service_instance->ServiceInstance:subscribed_links = 3 [db_index = True, null = True, blank = True];
580 optional manytoone subscriber_service->Service:subscribed_links = 4 [db_index = True, null = True, blank = True];
581 optional manytoone subscriber_network->Network:subscribed_links = 5 [db_index = True, null = True, blank = True];
582}
583
584message ServiceInstanceAttribute (XOSBase) {
Sapan Bhatia170ae272017-05-30 19:01:09 +0200585 required string name = 1 [help_text = "Attribute Name", max_length = 128, null = False, db_index = False, blank = False];
586 required string value = 2 [help_text = "Attribute Value", null = False, db_index = False, blank = False];
Scott Bakerd6e533f2017-07-17 13:37:29 -0700587 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 +0200588}
589
Scott Bakerd6e533f2017-07-17 13:37:29 -0700590message TenantWithContainer (ServiceInstance) {
Sapan Bhatia170ae272017-05-30 19:01:09 +0200591 optional manytoone instance->Instance:+ = 1 [help_text = "Instance used by this Tenant", null = True, db_index = True, blank = True];
592 optional manytoone creator->User:+ = 2 [help_text = "Creator of this Tenant", null = True, db_index = True, blank = True];
593 optional string external_hostname = 3 [max_length = 30, content_type = "stripped", blank = True, help_text = "External host name", null = True, db_index = False];
594 optional string external_container = 4 [max_length = 30, content_type = "stripped", blank = True, help_text = "External host name", null = True, db_index = False];
595}
596
Sapan Bhatia170ae272017-05-30 19:01:09 +0200597message XOS (XOSBase) {
Sapan Bhatiacb35e7f2017-05-24 12:17:28 +0200598 option singular="XOS";
599 option plural="XOSes";
Sapan Bhatia170ae272017-05-30 19:01:09 +0200600 required string name = 1 [default = "XOS", max_length = 200, content_type = "stripped", blank = False, help_text = "Name of XOS", null = False, db_index = False];
601}
602
603message XOSGuiExtension (XOSBase) {
Matteo Scandoloe425f9d2017-08-15 15:56:19 -0700604 option verbose_name="XOS GUI Extension";
605 option description="This model holds the instruction to load an extension in the GUI";
Sapan Bhatia170ae272017-05-30 19:01:09 +0200606 required string name = 1 [max_length = 200, content_type = "stripped", blank = False, help_text = "Name of the GUI Extensions", null = False, db_index = False];
607 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];
608}
Sapan Bhatia5ea307d2017-07-19 00:13:21 -0400609