Sapan Bhatia | cb35e7f | 2017-05-24 12:17:28 +0200 | [diff] [blame] | 1 | option app_label = "core"; |
Sapan Bhatia | d022aeb | 2017-06-07 15:49:55 +0200 | [diff] [blame] | 2 | |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 3 | message XOSBase { |
Sapan Bhatia | d022aeb | 2017-06-07 15:49:55 +0200 | [diff] [blame] | 4 | option skip_init = True; |
Sapan Bhatia | cb35e7f | 2017-05-24 12:17:28 +0200 | [diff] [blame] | 5 | |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 6 | 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 Bhatia | cb35e7f | 2017-05-24 12:17:28 +0200 | [diff] [blame] | 10 | optional string backend_register = 5 [default = "{}", max_length = 1024]; |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 11 | required bool backend_need_delete = 6 [default = False]; |
| 12 | required bool backend_need_reap = 7 [default = False]; |
Sapan Bhatia | cb35e7f | 2017-05-24 12:17:28 +0200 | [diff] [blame] | 13 | required string backend_status = 8 [default = "0 - Provisioning in progress", max_length = 1024, null = True]; |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 14 | required bool deleted = 9 [default = False]; |
Sapan Bhatia | 5ea307d | 2017-07-19 00:13:21 -0400 | [diff] [blame] | 15 | required bool write_protect = 11 [default = False]; |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 16 | required bool lazy_blocked = 11 [default = False]; |
| 17 | required bool no_sync = 12 [default = False]; |
| 18 | required bool no_policy = 13 [default = False]; |
Scott Baker | 2c465a6 | 2017-06-09 14:21:11 -0700 | [diff] [blame] | 19 | optional string policy_status = 14 [default = "0 - Policy in process", max_length = 1024]; |
Sapan Bhatia | 113c2b9 | 2017-07-25 08:41:58 -0400 | [diff] [blame] | 20 | 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 Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 21 | } |
| 22 | |
Sapan Bhatia | b5ce186 | 2017-07-31 15:48:19 -0400 | [diff] [blame] | 23 | // The calling user represents the user being accessed, or is a site admin. |
| 24 | policy 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 | |
| 34 | message User::user_policy (AbstractBaseUser,PlModelMixIn) { |
Sapan Bhatia | d022aeb | 2017-06-07 15:49:55 +0200 | [diff] [blame] | 35 | option skip_django = True; |
Matteo Scandolo | e425f9d | 2017-08-15 15:56:19 -0700 | [diff] [blame^] | 36 | option description = "An XOS User"; |
Sapan Bhatia | cb35e7f | 2017-05-24 12:17:28 +0200 | [diff] [blame] | 37 | |
Sapan Bhatia | d022aeb | 2017-06-07 15:49:55 +0200 | [diff] [blame] | 38 | 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 Bhatia | cb35e7f | 2017-05-24 12:17:28 +0200 | [diff] [blame] | 40 | required string password = 3 [default = "Something", max_length = 255, blank = False, null = False, db_index = False]; |
Sapan Bhatia | afce8fd | 2017-06-28 23:24:53 -0700 | [diff] [blame] | 41 | 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 Baker | e08d006 | 2017-07-11 12:04:26 -0700 | [diff] [blame] | 69 | optional string policy_status = 32 [default = "0 - Policy in process", max_length = 1024]; |
| 70 | } |
Sapan Bhatia | d022aeb | 2017-06-07 15:49:55 +0200 | [diff] [blame] | 71 | |
Sapan Bhatia | b5ce186 | 2017-07-31 15:48:19 -0400 | [diff] [blame] | 72 | // A user may give a permission that he has to another user |
| 73 | policy 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 | |
| 80 | message Privilege::grant_policy (XOSBase) { |
Sapan Bhatia | 8918ac3 | 2017-07-09 00:43:27 -0400 | [diff] [blame] | 81 | required int32 accessor_id = 1 [null = False]; |
| 82 | required string accessor_type = 2 [null = False, max_length=1024]; |
Sapan Bhatia | b5ce186 | 2017-07-31 15:48:19 -0400 | [diff] [blame] | 83 | 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 Bhatia | 8918ac3 | 2017-07-09 00:43:27 -0400 | [diff] [blame] | 89 | } |
| 90 | |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 91 | message AddressPool (XOSBase) { |
| 92 | required string name = 1 [db_index = False, max_length = 32, null = False, blank = False]; |
Sapan Bhatia | d022aeb | 2017-06-07 15:49:55 +0200 | [diff] [blame] | 93 | optional string addresses = 2 [db_index = False, null = True, blank = True, varchar = True]; |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 94 | 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 Bhatia | d022aeb | 2017-06-07 15:49:55 +0200 | [diff] [blame] | 97 | optional string inuse = 6 [db_index = False, null = True, blank = True, varchar = True]; |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 98 | optional manytoone service->Service:addresspools = 7 [db_index = True, null = True, blank = True]; |
| 99 | } |
| 100 | |
Sapan Bhatia | b5ce186 | 2017-07-31 15:48:19 -0400 | [diff] [blame] | 101 | // Admins at a deployment have access to controllers at those deployments |
| 102 | policy 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 Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 109 | |
Sapan Bhatia | b5ce186 | 2017-07-31 15:48:19 -0400 | [diff] [blame] | 110 | message Controller::controller_policy (XOSBase) { |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 111 | 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 | |
| 126 | message 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 Bhatia | cb35e7f | 2017-05-24 12:17:28 +0200 | [diff] [blame] | 129 | required bool enabled = 3 [default = True, db_index = False, blank = True]; |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 130 | 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 | |
| 134 | message ControllerImages (XOSBase) { |
Sapan Bhatia | f7934b5 | 2017-06-12 05:04:23 -0700 | [diff] [blame] | 135 | required manytoone image->Image:controllerimages = 1 [db_index = True, null = False, blank = False, unique_with = "controller"]; |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 136 | 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 Bhatia | b5ce186 | 2017-07-31 15:48:19 -0400 | [diff] [blame] | 140 | // Everyone has read access |
| 141 | // For write access, you have to be a site_admin |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 142 | |
Sapan Bhatia | b5ce186 | 2017-07-31 15:48:19 -0400 | [diff] [blame] | 143 | policy 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. |
| 150 | policy 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 | |
| 175 | policy controller_network_policy < |
| 176 | ctx.user.is_admin |
| 177 | | *slice_policy(network.owner) > |
| 178 | |
| 179 | |
| 180 | message ControllerNetwork::controller_network_policy (XOSBase) { |
Sapan Bhatia | f7934b5 | 2017-06-12 05:04:23 -0700 | [diff] [blame] | 181 | required manytoone network->Network:controllernetworks = 1 [db_index = True, null = False, blank = False, unique_with = "controller"]; |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 182 | 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 | |
| 194 | message 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 | |
| 199 | message ControllerSite (XOSBase) { |
Sapan Bhatia | f7934b5 | 2017-06-12 05:04:23 -0700 | [diff] [blame] | 200 | required manytoone site->Site:controllersite = 1 [db_index = True, null = False, blank = False, unique_with="controller"]; |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 201 | 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 Bhatia | 8918ac3 | 2017-07-09 00:43:27 -0400 | [diff] [blame] | 205 | message 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 Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 210 | |
| 211 | message ControllerSitePrivilege (XOSBase) { |
Sapan Bhatia | f7934b5 | 2017-06-12 05:04:23 -0700 | [diff] [blame] | 212 | 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 Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 214 | 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 Bhatia | b5ce186 | 2017-07-31 15:48:19 -0400 | [diff] [blame] | 217 | policy controller_slice_policy < |
| 218 | ctx.user.is_admin |
| 219 | | *slice_policy(slice) > |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 220 | |
Sapan Bhatia | b5ce186 | 2017-07-31 15:48:19 -0400 | [diff] [blame] | 221 | message ControllerSlice::controller_slice_policy (XOSBase) { |
Sapan Bhatia | f7934b5 | 2017-06-12 05:04:23 -0700 | [diff] [blame] | 222 | required manytoone controller->Controller:controllerslices = 1 [db_index = True, null = False, blank = False, unique_with = "slice"]; |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 223 | 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 | |
| 228 | message ControllerSlicePrivilege (XOSBase) { |
Sapan Bhatia | f7934b5 | 2017-06-12 05:04:23 -0700 | [diff] [blame] | 229 | required manytoone controller->Controller:controllersliceprivileges = 1 [db_index = True, null = False, blank = False, unique_with = "slice_privilege"]; |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 230 | 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 Bhatia | b5ce186 | 2017-07-31 15:48:19 -0400 | [diff] [blame] | 234 | policy controller_user_policy < |
| 235 | ctx.user.is_admin |
| 236 | | (ctx.read_access & *user_policy(user)) > |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 237 | |
Sapan Bhatia | b5ce186 | 2017-07-31 15:48:19 -0400 | [diff] [blame] | 238 | message ControllerUser::controller_user_policy (XOSBase) { |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 239 | required manytoone user->User:controllerusers = 1 [db_index = True, null = False, blank = False]; |
Sapan Bhatia | f7934b5 | 2017-06-12 05:04:23 -0700 | [diff] [blame] | 240 | required manytoone controller->Controller:controllersusers = 2 [db_index = True, null = False, blank = False, unique_with = "user"]; |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 241 | 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 | |
| 245 | message 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 Bhatia | cb35e7f | 2017-05-24 12:17:28 +0200 | [diff] [blame] | 248 | required bool enabled = 3 [default = True, db_index = False, blank = True]; |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 249 | 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 Bhatia | b5ce186 | 2017-07-31 15:48:19 -0400 | [diff] [blame] | 255 | // Everyone has read access |
| 256 | // For write access you need admin privileges at that deployment |
| 257 | policy 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 Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 260 | |
Sapan Bhatia | b5ce186 | 2017-07-31 15:48:19 -0400 | [diff] [blame] | 261 | message Deployment::deployment_policy (XOSBase) { |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 262 | required string name = 1 [max_length = 200, content_type = "stripped", blank = False, help_text = "Name of the Deployment", null = False, db_index = False]; |
Sapan Bhatia | d022aeb | 2017-06-07 15:49:55 +0200 | [diff] [blame] | 263 | 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 Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 264 | } |
| 265 | |
| 266 | |
| 267 | message DeploymentPrivilege (XOSBase) { |
Sapan Bhatia | f7934b5 | 2017-06-12 05:04:23 -0700 | [diff] [blame] | 268 | 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 Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 270 | required manytoone role->DeploymentRole:deploymentprivileges = 3 [db_index = True, null = False, blank = False]; |
| 271 | } |
| 272 | |
| 273 | |
| 274 | message 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 | |
| 279 | message 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 | |
| 284 | message 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 Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 288 | } |
| 289 | |
| 290 | |
| 291 | message 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 Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 298 | } |
| 299 | |
Sapan Bhatia | b5ce186 | 2017-07-31 15:48:19 -0400 | [diff] [blame] | 300 | policy image_deployment_policy < |
| 301 | *deployment_policy(deployment) |
| 302 | > |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 303 | |
| 304 | message ImageDeployments (XOSBase) { |
Sapan Bhatia | f7934b5 | 2017-06-12 05:04:23 -0700 | [diff] [blame] | 305 | required manytoone image->Image:imagedeployments = 1 [db_index = True, null = False, blank = False, unique_with = "deployment"]; |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 306 | required manytoone deployment->Deployment:imagedeployments = 2 [db_index = True, null = False, blank = False]; |
| 307 | } |
| 308 | |
Sapan Bhatia | 5ea307d | 2017-07-19 00:13:21 -0400 | [diff] [blame] | 309 | policy instance_creator < obj.creator > |
Sapan Bhatia | 9227b4d | 2017-07-25 23:14:48 -0400 | [diff] [blame] | 310 | policy instance_isolation < (obj.isolation = "container" | obj.isolation = "container_vm" ) -> (obj.image.kind = "container") > |
| 311 | policy instance_isolation_container_vm_parent < (obj.isolation = "container_vm") -> obj.parent > |
| 312 | policy instance_parent_isolation_container_vm < obj.parent -> ( obj.isolation = "container_vm" ) > |
Sapan Bhatia | 5ea307d | 2017-07-19 00:13:21 -0400 | [diff] [blame] | 313 | policy instance_isolation_vm < (obj.isolation = "vm") -> (obj.image.kind = "vm") > |
Sapan Bhatia | 5ea307d | 2017-07-19 00:13:21 -0400 | [diff] [blame] | 314 | policy 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 Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 315 | |
Sapan Bhatia | b5ce186 | 2017-07-31 15:48:19 -0400 | [diff] [blame] | 316 | policy instance_policy < *slice_policy(slice) > |
| 317 | |
| 318 | message 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 Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 320 | 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 Scandolo | bd8caca | 2017-08-17 15:36:10 -0700 | [diff] [blame] | 324 | 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 Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 325 | 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 Bhatia | d022aeb | 2017-06-07 15:49:55 +0200 | [diff] [blame] | 332 | optional string userData = 13 [help_text = "user_data passed to instance during creation", null = True, db_index = False, blank = True, varchar = True]; |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 333 | 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 Bhatia | b5ce186 | 2017-07-31 15:48:19 -0400 | [diff] [blame] | 337 | |
| 338 | |
| 339 | policy network_policy < *slice_policy(owner) > |
| 340 | |
| 341 | message Network::network_policy (XOSBase) { |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 342 | 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 | |
| 358 | message 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 | |
| 366 | message 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 Bhatia | 9227b4d | 2017-07-25 23:14:48 -0400 | [diff] [blame] | 371 | policy network_slice_validator < (obj.slice in obj.network.permitted_slices.all()) | (obj.slice = obj.network.owner) | obj.network.permit_all_slices > |
Sapan Bhatia | b5ce186 | 2017-07-31 15:48:19 -0400 | [diff] [blame] | 372 | policy network_slice_policy < *slice_policy(slice) & *network_policy(network) > |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 373 | |
Sapan Bhatia | b5ce186 | 2017-07-31 15:48:19 -0400 | [diff] [blame] | 374 | message NetworkSlice::network_slice_policy (XOSBase) { |
Sapan Bhatia | 9227b4d | 2017-07-25 23:14:48 -0400 | [diff] [blame] | 375 | option validators = "network_slice_validator:Slice { obj.slice.name } is not allowed to connect to networks { obj.network }"; |
Sapan Bhatia | f7934b5 | 2017-06-12 05:04:23 -0700 | [diff] [blame] | 376 | required manytoone network->Network:networkslices = 1 [db_index = True, null = False, blank = False, unique_with = "slice"]; |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 377 | required manytoone slice->Slice:networkslices = 2 [db_index = True, null = False, blank = False]; |
| 378 | } |
Sapan Bhatia | 5ea307d | 2017-07-19 00:13:21 -0400 | [diff] [blame] | 379 | |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 380 | message 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 Bhatia | b5ce186 | 2017-07-31 15:48:19 -0400 | [diff] [blame] | 392 | |
| 393 | policy node_policy < *site_policy(site_deployment.site) > |
| 394 | |
| 395 | message Node::node_policy (XOSBase) { |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 396 | 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 | } |
| 399 | message 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 Bhatia | 5ea307d | 2017-07-19 00:13:21 -0400 | [diff] [blame] | 403 | |
Sapan Bhatia | 9227b4d | 2017-07-25 23:14:48 -0400 | [diff] [blame] | 404 | policy port_validator < (obj.instance.slice in obj.network.permitted_slices.all()) | (obj.instance.slice = obj.network.owner) | obj.network.permit_all_slices > |
Sapan Bhatia | b5ce186 | 2017-07-31 15:48:19 -0400 | [diff] [blame] | 405 | policy port_policy < *instance_policy(instance) & *network_policy(network) > |
Sapan Bhatia | 5ea307d | 2017-07-19 00:13:21 -0400 | [diff] [blame] | 406 | |
Sapan Bhatia | b5ce186 | 2017-07-31 15:48:19 -0400 | [diff] [blame] | 407 | message Port::port_policy (XOSBase) { |
Sapan Bhatia | 9227b4d | 2017-07-25 23:14:48 -0400 | [diff] [blame] | 408 | option validators = "port_validator:Slice is not allowed to connect to network"; |
Sapan Bhatia | f7934b5 | 2017-06-12 05:04:23 -0700 | [diff] [blame] | 409 | required manytoone network->Network:links = 1 [db_index = True, null = False, blank = False, unique_with = "instance"]; |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 410 | 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 | |
| 418 | message 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 Bhatia | b5ce186 | 2017-07-31 15:48:19 -0400 | [diff] [blame] | 424 | policy 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 Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 425 | |
| 426 | message Service (XOSBase,AttributeMixin) { |
Sapan Bhatia | d022aeb | 2017-06-07 15:49:55 +0200 | [diff] [blame] | 427 | optional string description = 1 [help_text = "Description of Service", max_length = 254, null = True, db_index = False, blank = True, varchar = True]; |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 428 | required bool enabled = 2 [default = True, null = False, db_index = False, blank = True]; |
Scott Baker | d6e533f | 2017-07-17 13:37:29 -0700 | [diff] [blame] | 429 | 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 Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 430 | 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 Bhatia | d022aeb | 2017-06-07 15:49:55 +0200 | [diff] [blame] | 435 | optional string public_key = 9 [help_text = "Public key string", max_length = 4096, null = True, db_index = False, blank = True, varchar = True]; |
Zack Williams | f517e40 | 2017-05-20 13:37:43 -0700 | [diff] [blame] | 436 | optional string private_key_fn = 10 [db_index = False, max_length = 4096, null = True, content_type = "stripped", blank = True]; |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 437 | optional string service_specific_id = 11 [db_index = False, max_length = 30, null = True, content_type = "stripped", blank = True]; |
Sapan Bhatia | d022aeb | 2017-06-07 15:49:55 +0200 | [diff] [blame] | 438 | optional string service_specific_attribute = 12 [db_index = False, null = True, blank = True, varchar = True]; |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 439 | } |
| 440 | |
| 441 | |
| 442 | message ServiceAttribute (XOSBase) { |
| 443 | required string name = 1 [help_text = "Attribute Name", max_length = 128, null = False, db_index = False, blank = False]; |
Sapan Bhatia | d022aeb | 2017-06-07 15:49:55 +0200 | [diff] [blame] | 444 | required string value = 2 [help_text = "Attribute Value", null = False, db_index = False, blank = False, varchar = True]; |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 445 | 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 Baker | 071da96 | 2017-07-13 10:43:41 -0700 | [diff] [blame] | 449 | message ServiceDependency (XOSBase) { |
Scott Baker | d6e533f | 2017-07-17 13:37:29 -0700 | [diff] [blame] | 450 | 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 Baker | 071da96 | 2017-07-13 10:43:41 -0700 | [diff] [blame] | 452 | 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 Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 453 | } |
| 454 | |
| 455 | |
| 456 | message 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 Bhatia | d022aeb | 2017-06-07 15:49:55 +0200 | [diff] [blame] | 459 | 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 Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 460 | } |
| 461 | |
| 462 | |
| 463 | message ServicePrivilege (XOSBase) { |
Sapan Bhatia | f7934b5 | 2017-06-12 05:04:23 -0700 | [diff] [blame] | 464 | 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 Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 466 | required manytoone role->ServiceRole:serviceprivileges = 3 [db_index = True, null = False, blank = False]; |
| 467 | } |
| 468 | |
| 469 | |
| 470 | message 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 Bhatia | b5ce186 | 2017-07-31 15:48:19 -0400 | [diff] [blame] | 475 | |
| 476 | message Site::site_policy (XOSBase) { |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 477 | 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 | |
| 491 | message SiteDeployment (XOSBase) { |
Sapan Bhatia | f7934b5 | 2017-06-12 05:04:23 -0700 | [diff] [blame] | 492 | 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 Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 494 | 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 | |
| 499 | message 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 | |
| 506 | message 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 Bhatia | cb35e7f | 2017-05-24 12:17:28 +0200 | [diff] [blame] | 509 | |
Sapan Bhatia | 9227b4d | 2017-07-25 23:14:48 -0400 | [diff] [blame] | 510 | policy slice_name < obj.id | {{ obj.name.startswith(obj.site.login_base) }} > |
Sapan Bhatia | 5ea307d | 2017-07-19 00:13:21 -0400 | [diff] [blame] | 511 | policy slice_name_length_and_no_spaces < {{ len(obj.site.login_base) + 1 < len(obj.name) and ' ' not in obj.name }} > |
| 512 | policy slice_has_creator < obj.creator > |
| 513 | |
Sapan Bhatia | b5ce186 | 2017-07-31 15:48:19 -0400 | [diff] [blame] | 514 | |
| 515 | |
| 516 | message 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 Bhatia | cb35e7f | 2017-05-24 12:17:28 +0200 | [diff] [blame] | 518 | option plural = "Slices"; |
Sapan Bhatia | 5ea307d | 2017-07-19 00:13:21 -0400 | [diff] [blame] | 519 | |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 520 | 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 Bhatia | d022aeb | 2017-06-07 15:49:55 +0200 | [diff] [blame] | 522 | 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 Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 523 | 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 | |
| 538 | message SlicePrivilege (XOSBase) { |
Sapan Bhatia | f7934b5 | 2017-06-12 05:04:23 -0700 | [diff] [blame] | 539 | 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 Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 541 | required manytoone role->SliceRole:sliceprivileges = 3 [db_index = True, null = False, blank = False]; |
| 542 | } |
| 543 | |
| 544 | |
| 545 | message 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 Bhatia | b5ce186 | 2017-07-31 15:48:19 -0400 | [diff] [blame] | 549 | policy tag_policy < ctx.user.is_admin > |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 550 | |
Sapan Bhatia | b5ce186 | 2017-07-31 15:48:19 -0400 | [diff] [blame] | 551 | message Tag::tag_policy (XOSBase) { |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 552 | 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 Baker | d6e533f | 2017-07-17 13:37:29 -0700 | [diff] [blame] | 559 | message 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 Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 562 | } |
| 563 | |
Scott Baker | d6e533f | 2017-07-17 13:37:29 -0700 | [diff] [blame] | 564 | message 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 | |
| 569 | message 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 | |
| 576 | message 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 | |
| 584 | message ServiceInstanceAttribute (XOSBase) { |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 585 | 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 Baker | d6e533f | 2017-07-17 13:37:29 -0700 | [diff] [blame] | 587 | 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 Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 588 | } |
| 589 | |
Scott Baker | d6e533f | 2017-07-17 13:37:29 -0700 | [diff] [blame] | 590 | message TenantWithContainer (ServiceInstance) { |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 591 | 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 Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 597 | message XOS (XOSBase) { |
Sapan Bhatia | cb35e7f | 2017-05-24 12:17:28 +0200 | [diff] [blame] | 598 | option singular="XOS"; |
| 599 | option plural="XOSes"; |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 600 | 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 | |
| 603 | message XOSGuiExtension (XOSBase) { |
Matteo Scandolo | e425f9d | 2017-08-15 15:56:19 -0700 | [diff] [blame^] | 604 | option verbose_name="XOS GUI Extension"; |
| 605 | option description="This model holds the instruction to load an extension in the GUI"; |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 606 | 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 Bhatia | 5ea307d | 2017-07-19 00:13:21 -0400 | [diff] [blame] | 609 | |