Sapan Bhatia | cb35e7f | 2017-05-24 12:17:28 +0200 | [diff] [blame] | 1 | option app_label = "core"; |
Scott Baker | a33ccb0 | 2018-01-26 13:03:28 -0800 | [diff] [blame] | 2 | option legacy="True"; |
Sapan Bhatia | d022aeb | 2017-06-07 15:49:55 +0200 | [diff] [blame] | 3 | |
Matteo Scandolo | ee367fd | 2017-11-22 14:55:09 -0800 | [diff] [blame] | 4 | // use thi policy to allow access to admins only |
| 5 | policy admin_policy < ctx.user.is_admin > |
| 6 | |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 7 | message XOSBase { |
Sapan Bhatia | d022aeb | 2017-06-07 15:49:55 +0200 | [diff] [blame] | 8 | option skip_init = True; |
Scott Baker | a33ccb0 | 2018-01-26 13:03:28 -0800 | [diff] [blame] | 9 | option custom_header = "xosbase_header"; |
| 10 | option abstract = True; |
Sapan Bhatia | cb35e7f | 2017-05-24 12:17:28 +0200 | [diff] [blame] | 11 | |
Scott Baker | d824671 | 2018-07-12 18:08:31 -0700 | [diff] [blame] | 12 | required string created = 1 [content_type = "date", auto_now_add = True, help_text = "Time this model was created"]; |
| 13 | required string updated = 2 [default = "now()", content_type = "date", help_text = "Time this model was changed by a non-synchronizer"]; |
| 14 | optional string enacted = 3 [null = True, content_type = "date", blank = True, default = None, help_text = "When synced, set to the timestamp of the data that was synced"]; |
| 15 | optional string policed = 4 [null = True, content_type = "date", blank = True, default = None, help_text = "When policed, set to the timestamp of the data that was policed"]; |
Matteo Scandolo | 23cf15f | 2018-03-06 18:12:36 -0800 | [diff] [blame] | 16 | optional string backend_register = 5 [default = "{}", max_length = 1024, feedback_state = True]; |
Matteo Scandolo | e16797a | 2017-10-03 17:01:22 -0700 | [diff] [blame] | 17 | required bool backend_need_delete = 6 [default = False, blank = True]; |
| 18 | required bool backend_need_reap = 7 [default = False, blank = True]; |
Matteo Scandolo | 23cf15f | 2018-03-06 18:12:36 -0800 | [diff] [blame] | 19 | required string backend_status = 8 [default = "Provisioning in progress", max_length = 1024, null = True, feedback_state = True]; |
| 20 | required int32 backend_code = 9 [default = 0, feedback_state = True]; |
Matteo Scandolo | e16797a | 2017-10-03 17:01:22 -0700 | [diff] [blame] | 21 | required bool deleted = 10 [default = False, blank = True]; |
| 22 | required bool write_protect = 12 [default = False, blank = True]; |
| 23 | required bool lazy_blocked = 13 [default = False, blank = True]; |
| 24 | required bool no_sync = 14 [default = False, blank = True]; |
| 25 | required bool no_policy = 15 [default = False, blank = True]; |
Matteo Scandolo | 23cf15f | 2018-03-06 18:12:36 -0800 | [diff] [blame] | 26 | optional string policy_status = 16 [default = "Policy in process", max_length = 1024, feedback_state = True]; |
| 27 | optional int32 policy_code = 16 [default = 0, feedback_state = True]; |
Sapan Bhatia | da5e444 | 2017-08-27 09:51:13 -0400 | [diff] [blame] | 28 | required string leaf_model_name = 17 [null = False, max_length = 1024, help_text = "The most specialized model in this chain of inheritance, often defined by a service developer"]; |
Matteo Scandolo | e16797a | 2017-10-03 17:01:22 -0700 | [diff] [blame] | 29 | required bool backend_need_delete_policy = 18 [default = False, help_text = "True if delete model_policy must be run before object can be reaped", blank = True]; |
Matteo Scandolo | 03bb441 | 2018-07-26 16:38:58 -0700 | [diff] [blame] | 30 | required bool xos_managed = 19 [default = True, help_text = "True if xos is responsible for creating/deleting this object", blank = True, gui_hidden = True]; |
| 31 | optional string backend_handle = 20 [max_length = 1024, feedback_state = True, blank=True, null=True, help_text = "Handle used by the backend to track this object", gui_hidden = True]; |
Scott Baker | d824671 | 2018-07-12 18:08:31 -0700 | [diff] [blame] | 32 | optional string changed_by_step = 21 [null = True, content_type = "date", blank = True, default = None, gui_hidden = True, help_text = "Time this model was changed by a sync step"]; |
| 33 | optional string changed_by_policy = 22 [null = True, content_type = "date", blank = True, default = None, gui_hidden = True, help_text = "Time this model was changed by a model policy"]; |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 34 | } |
| 35 | |
Sapan Bhatia | b5ce186 | 2017-07-31 15:48:19 -0400 | [diff] [blame] | 36 | // The calling user represents the user being accessed, or is a site admin. |
| 37 | policy user_policy < |
| 38 | ctx.user.is_admin |
| 39 | | ctx.user.id = obj.id |
| 40 | | (exists Privilege: |
| 41 | Privilege.accessor_id = ctx.user.id |
| 42 | & Privilege.accessor_type = "User" |
| 43 | & Privilege.permission = "role:admin" |
| 44 | & Privilege.object_type = "Site" |
| 45 | & Privilege.object_id = ctx.user.site.id) > |
| 46 | |
| 47 | message User::user_policy (AbstractBaseUser,PlModelMixIn) { |
Sapan Bhatia | d022aeb | 2017-06-07 15:49:55 +0200 | [diff] [blame] | 48 | option skip_django = True; |
Matteo Scandolo | e425f9d | 2017-08-15 15:56:19 -0700 | [diff] [blame] | 49 | option description = "An XOS User"; |
Sapan Bhatia | cb35e7f | 2017-05-24 12:17:28 +0200 | [diff] [blame] | 50 | |
Matteo Scandolo | c3c0f0a | 2017-10-18 09:53:30 +0200 | [diff] [blame] | 51 | required string email = 1 [db_index = True, max_length = 255, null = False, blank = False, tosca_key=True]; |
Sapan Bhatia | d022aeb | 2017-06-07 15:49:55 +0200 | [diff] [blame] | 52 | 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] | 53 | 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] | 54 | optional string last_login = 4 [db_index = False, null = True, content_type = "date", blank = True]; |
| 55 | required string firstname = 5 [max_length = 200, content_type = "stripped", blank = False, help_text = "person's given name", null = False, db_index = False]; |
| 56 | required string lastname = 6 [max_length = 200, content_type = "stripped", blank = False, help_text = "person's surname", null = False, db_index = False]; |
| 57 | optional string phone = 7 [max_length = 100, content_type = "stripped", blank = True, help_text = "phone number contact", null = True, db_index = False]; |
| 58 | optional string user_url = 8 [db_index = False, max_length = 200, null = True, content_type = "url", blank = True]; |
| 59 | required manytoone site->Site:users = 9 [help_text = "Site this user will be homed too", null = False, db_index = True, blank = False]; |
| 60 | optional string public_key = 10 [help_text = "Public key string", max_length = 1024, null = True, db_index = False, blank = True, varchar = True]; |
| 61 | required bool is_active = 11 [default = True, null = False, db_index = False, blank = True]; |
| 62 | required bool is_admin = 12 [default = False, null = False, db_index = False, blank = True]; |
| 63 | required bool is_staff = 13 [default = True, null = False, db_index = False, blank = True]; |
| 64 | required bool is_readonly = 14 [default = False, null = False, db_index = False, blank = True]; |
| 65 | required bool is_registering = 15 [default = False, null = False, db_index = False, blank = True]; |
| 66 | required bool is_appuser = 16 [default = False, null = False, db_index = False, blank = True]; |
| 67 | optional string login_page = 17 [max_length = 200, content_type = "stripped", blank = True, help_text = "send this user to a specific page on login", null = True, db_index = False]; |
| 68 | required string created = 18 [db_index = False, null = False, content_type = "date", blank = True]; |
| 69 | required string updated = 19 [db_index = False, null = False, content_type = "date", blank = True]; |
| 70 | optional string enacted = 20 [db_index = False, null = True, content_type = "date", blank = False]; |
| 71 | optional string policed = 21 [db_index = False, null = True, content_type = "date", blank = False]; |
| 72 | required string backend_status = 22 [default = "Provisioning in progress", max_length = 1024, content_type = "stripped", blank = False, null = False, db_index = False]; |
Scott Baker | aed4abd | 2017-12-01 15:23:35 -0800 | [diff] [blame] | 73 | required int32 backend_code = 34 [default = 0]; |
Sapan Bhatia | afce8fd | 2017-06-28 23:24:53 -0700 | [diff] [blame] | 74 | required bool backend_need_delete = 23 [default = False, null = False, db_index = False, blank = True]; |
| 75 | required bool backend_need_reap = 24 [default = False, null = False, db_index = False, blank = True]; |
| 76 | required bool deleted = 25 [default = False, null = False, db_index = False, blank = True]; |
| 77 | required bool write_protect = 26 [default = False, null = False, db_index = False, blank = True]; |
| 78 | required bool lazy_blocked = 27 [default = False, null = False, db_index = False, blank = True]; |
| 79 | required bool no_sync = 28 [default = False, null = False, db_index = False, blank = True]; |
| 80 | required bool no_policy = 29 [default = False, null = False, db_index = False, blank = True]; |
| 81 | required string timezone = 30 [default = "America/New_York", max_length = 100, blank = False, null = False, db_index = False]; |
Scott Baker | e08d006 | 2017-07-11 12:04:26 -0700 | [diff] [blame] | 82 | optional string policy_status = 32 [default = "0 - Policy in process", max_length = 1024]; |
Scott Baker | aed4abd | 2017-12-01 15:23:35 -0800 | [diff] [blame] | 83 | optional int32 policy_code = 35 [default = 0]; |
Sapan Bhatia | e8a9e6d | 2017-09-03 21:02:32 -0400 | [diff] [blame] | 84 | required string leaf_model_name = 33 [null = False, max_length = 1024, help_text = "The most specialized model in this chain of inheritance, often defined by a service developer"]; |
Scott Baker | d824671 | 2018-07-12 18:08:31 -0700 | [diff] [blame] | 85 | required bool backend_need_delete_policy = 34 [default = False, help_text = "True if delete model_policy must be run before object can be reaped", blank = True]; |
| 86 | required bool xos_managed = 35 [default = True, help_text = "True if xos is responsible for creating/deleting this object", blank = True, gui_hidden = True]; |
| 87 | optional string backend_handle = 36 [max_length = 1024, feedback_state = True, blank=True, null=True, help_text = "Handle used by the backend to track this object", gui_hidden = True]; |
| 88 | optional string changed_by_step = 37 [null = True, content_type = "date", blank = True, default = None, gui_hidden = True, help_text = "Time this model was changed by a sync step"]; |
| 89 | optional string changed_by_policy = 38 [null = True, content_type = "date", blank = True, default = None, gui_hidden = True, help_text = "Time this model was changed by a model policy"]; |
Scott Baker | e08d006 | 2017-07-11 12:04:26 -0700 | [diff] [blame] | 90 | } |
Sapan Bhatia | d022aeb | 2017-06-07 15:49:55 +0200 | [diff] [blame] | 91 | |
Sapan Bhatia | b5ce186 | 2017-07-31 15:48:19 -0400 | [diff] [blame] | 92 | // A user may give a permission that he has to another user |
| 93 | policy grant_policy < ctx.user.is_admin |
| 94 | | exists Privilege:Privilege.object_type = obj.object_type |
| 95 | & Privilege.object_id = obj.object_id |
| 96 | & Privilege.accessor_type = "User" |
Kailash Khalasi | acab7e1 | 2017-12-14 11:27:26 -0800 | [diff] [blame] | 97 | & Privilege.accessor_id = ctx.user.id |
Sapan Bhatia | b5ce186 | 2017-07-31 15:48:19 -0400 | [diff] [blame] | 98 | & Privilege.permission = "role:admin" > |
Kailash Khalasi | acab7e1 | 2017-12-14 11:27:26 -0800 | [diff] [blame] | 99 | |
Sapan Bhatia | b5ce186 | 2017-07-31 15:48:19 -0400 | [diff] [blame] | 100 | message Privilege::grant_policy (XOSBase) { |
Kailash Khalasi | acab7e1 | 2017-12-14 11:27:26 -0800 | [diff] [blame] | 101 | required int32 accessor_id = 1 [null = False, blank=False]; |
Scott Baker | 01fe9a3 | 2018-05-01 15:03:54 -0700 | [diff] [blame] | 102 | required string accessor_type = 2 [null = False, max_length=1024, blank = False]; |
| 103 | optional int32 controller_id = 3 [null = True, blank = True]; |
Kailash Khalasi | acab7e1 | 2017-12-14 11:27:26 -0800 | [diff] [blame] | 104 | required int32 object_id = 4 [null = False, blank=False]; |
Scott Baker | 01fe9a3 | 2018-05-01 15:03:54 -0700 | [diff] [blame] | 105 | required string object_type = 5 [null = False, max_length=1024, blank = False]; |
Matteo Scandolo | c3c0f0a | 2017-10-18 09:53:30 +0200 | [diff] [blame] | 106 | required string permission = 6 [null = False, default = "all", max_length=1024, tosca_key=True]; |
Sapan Bhatia | b5ce186 | 2017-07-31 15:48:19 -0400 | [diff] [blame] | 107 | required string granted = 7 [content_type = "date", auto_now_add = True, max_length=1024]; |
| 108 | required string expires = 8 [content_type = "date", null = True, max_length=1024]; |
Sapan Bhatia | 8918ac3 | 2017-07-09 00:43:27 -0400 | [diff] [blame] | 109 | } |
| 110 | |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 111 | message AddressPool (XOSBase) { |
Scott Baker | c11206e | 2018-08-23 08:33:47 -0700 | [diff] [blame] | 112 | required string name = 1 [db_index = False, max_length = 32, null = False, blank = False, unique = True, help_text="Name of this AddressPool"]; |
| 113 | optional string addresses = 2 [db_index = False, null = True, blank = True, varchar = True, help_text="Space-separated list of available addresses"]; |
| 114 | required string gateway_ip = 3 [db_index = False, max_length = 32, help_text="Gateway IP address for this AddressPool"]; |
| 115 | required string gateway_mac = 4 [db_index = False, max_length = 32, help_text="Gateway MAC address for this AddressPool"]; |
| 116 | required string cidr = 5 [db_index = False, max_length = 32, help_text="Subnet for this AddressPool"]; |
| 117 | optional string inuse = 6 [db_index = False, null = True, blank = True, varchar = True, help_text="Space-separated list of inuse addresses"]; |
| 118 | optional manytoone service->Service:addresspools = 7 [db_index = True, null = True, blank = True, help_text="Service this AddressPool belongs to"]; |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 119 | } |
| 120 | |
Scott Baker | 6b260ea | 2018-04-18 07:12:22 -0700 | [diff] [blame] | 121 | message ComputeServiceInstance (ServiceInstance) { |
| 122 | required manytoone slice->Slice:computeserviceinstances = 1 [db_index = True, null = False, blank = False, help_text = "Slice that controls this ServiceInstance"]; |
| 123 | required manytoone image->Image:computeserviceinstances = 2 [db_index = True, null = False, blank = False, help_text = "Image used to instantiate this ServiceInstance"]; |
| 124 | } |
| 125 | |
Sapan Bhatia | b5ce186 | 2017-07-31 15:48:19 -0400 | [diff] [blame] | 126 | // Admins at a deployment have access to controllers at those deployments |
| 127 | policy controller_policy |
| 128 | < ctx.user.is_admin |
| 129 | | exists Privilege: |
| 130 | Privilege.accessor_id = ctx.user.id |
| 131 | & Privilege.object_type = "Deployment" |
| 132 | & Privilege.permission = "role:admin" |
| 133 | & Privilege.object_id = obj.id > |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 134 | |
Sapan Bhatia | b5ce186 | 2017-07-31 15:48:19 -0400 | [diff] [blame] | 135 | message Controller::controller_policy (XOSBase) { |
Scott Baker | eb782fc | 2018-04-27 13:50:21 -0700 | [diff] [blame] | 136 | required string name = 1 [max_length = 200, content_type = "stripped", blank = False, help_text = "Name of the Controller", null = False, db_index = False, unique = True]; |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 137 | required string backend_type = 2 [max_length = 200, content_type = "stripped", blank = False, help_text = "Type of compute controller, e.g. EC2, OpenStack, or OpenStack version", null = False, db_index = False]; |
| 138 | required string version = 3 [max_length = 200, content_type = "stripped", blank = False, help_text = "Controller version", null = False, db_index = False]; |
| 139 | optional string auth_url = 4 [max_length = 200, content_type = "stripped", blank = True, help_text = "Auth url for the compute controller", null = True, db_index = False]; |
| 140 | optional string admin_user = 5 [max_length = 200, content_type = "stripped", blank = True, help_text = "Username of an admin user at this controller", null = True, db_index = False]; |
| 141 | optional string admin_password = 6 [max_length = 200, content_type = "stripped", blank = True, help_text = "Password of theadmin user at this controller", null = True, db_index = False]; |
| 142 | optional string admin_tenant = 7 [max_length = 200, content_type = "stripped", blank = True, help_text = "Name of the tenant the admin user belongs to", null = True, db_index = False]; |
| 143 | optional string domain = 8 [max_length = 200, content_type = "stripped", blank = True, help_text = "Name of the domain this controller belongs to", null = True, db_index = False]; |
| 144 | optional string rabbit_host = 9 [max_length = 200, content_type = "stripped", blank = True, help_text = "IP address of rabbitmq server at this controller", null = True, db_index = False]; |
| 145 | optional string rabbit_user = 10 [max_length = 200, content_type = "stripped", blank = True, help_text = "Username of rabbitmq server at this controller", null = True, db_index = False]; |
| 146 | optional string rabbit_password = 11 [max_length = 200, content_type = "stripped", blank = True, help_text = "Password of rabbitmq server at this controller", null = True, db_index = False]; |
| 147 | required manytoone deployment->Deployment:controllerdeployments = 12 [db_index = True, null = False, blank = False]; |
| 148 | } |
| 149 | |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 150 | message ControllerImages (XOSBase) { |
Sapan Bhatia | f7934b5 | 2017-06-12 05:04:23 -0700 | [diff] [blame] | 151 | 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] | 152 | required manytoone controller->Controller:controllerimages = 2 [db_index = True, null = False, blank = False]; |
| 153 | optional string glance_image_id = 3 [max_length = 200, content_type = "stripped", blank = True, help_text = "Glance image id", null = True, db_index = False]; |
| 154 | } |
| 155 | |
Sapan Bhatia | b5ce186 | 2017-07-31 15:48:19 -0400 | [diff] [blame] | 156 | // Everyone has read access |
| 157 | // For write access, you have to be a site_admin |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 158 | |
Sapan Bhatia | b5ce186 | 2017-07-31 15:48:19 -0400 | [diff] [blame] | 159 | policy site_policy < |
| 160 | ctx.user.is_admin |
| 161 | | (ctx.write_access -> exists Privilege: Privilege.object_type = "Site" & Privilege.object_id = obj.id & Privilege.accessor_id = ctx.user.id & Privilege.permission = "role:admin") > |
| 162 | |
| 163 | // If you can access (read or write) the site, you can also access its slices |
| 164 | // Otherwise, you need an explicit privilege on the Slice (admin for write access) |
| 165 | // or admin privilege on the associated site. |
| 166 | policy slice_policy < |
| 167 | ctx.user.is_admin |
| 168 | | (*site_policy(site) |
Sapan Bhatia | 3cee948 | 2017-09-01 23:10:16 -0400 | [diff] [blame] | 169 | & (ctx.user = obj.creator |
Sapan Bhatia | b5ce186 | 2017-07-31 15:48:19 -0400 | [diff] [blame] | 170 | | (exists Privilege: |
| 171 | Privilege.accessor_id = ctx.user.id |
| 172 | & Privilege.accessor_type = "User" |
| 173 | & Privilege.object_type = "Slice" |
| 174 | & Privilege.object_id = obj.id |
| 175 | & (ctx.write_access -> Privilege.permission = "role:admin")) |
| 176 | ) |
| 177 | | |
| 178 | (exists Privilege: |
| 179 | Privilege.accessor_id = ctx.user.id |
| 180 | & Privilege.accessor_type = "User" |
| 181 | & Privilege.object_type = "Slice" |
| 182 | & Privilege.object_id = obj.id) |
| 183 | | (exists Privilege: |
| 184 | Privilege.accessor_id = ctx.user.id |
| 185 | & Privilege.accessor_type = "User" |
| 186 | & Privilege.object_type = "Site" |
| 187 | & Privilege.object_id = obj.site.id |
| 188 | & Privilege.permission = "role:admin") |
| 189 | ) > |
| 190 | |
| 191 | policy controller_network_policy < |
| 192 | ctx.user.is_admin |
| 193 | | *slice_policy(network.owner) > |
| 194 | |
| 195 | |
| 196 | message ControllerNetwork::controller_network_policy (XOSBase) { |
Sapan Bhatia | f7934b5 | 2017-06-12 05:04:23 -0700 | [diff] [blame] | 197 | 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] | 198 | required manytoone controller->Controller:controllernetworks = 2 [db_index = True, null = False, blank = False]; |
| 199 | required string subnet = 3 [db_index = False, max_length = 32, null = False, blank = True]; |
| 200 | required string start_ip = 4 [db_index = False, max_length = 32, null = False, blank = True]; |
| 201 | required string stop_ip = 5 [db_index = False, max_length = 32, null = False, blank = True]; |
| 202 | optional string net_id = 6 [help_text = "Neutron network", max_length = 256, null = True, db_index = False, blank = True]; |
| 203 | optional string router_id = 7 [help_text = "Neutron router id", max_length = 256, null = True, db_index = False, blank = True]; |
| 204 | optional string subnet_id = 8 [help_text = "Neutron subnet id", max_length = 256, null = True, db_index = False, blank = True]; |
| 205 | optional string gateway = 9 [db_index = False, max_length = 32, null = True, blank = True]; |
| 206 | optional string segmentation_id = 10 [db_index = False, max_length = 32, null = True, blank = True]; |
| 207 | } |
| 208 | |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 209 | message ControllerRole (XOSBase) { |
| 210 | required string role = 1 [choices = "(('admin', 'Admin'),)", max_length = 30, content_type = "stripped", blank = False, null = False, db_index = False]; |
| 211 | } |
| 212 | |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 213 | message ControllerSite (XOSBase) { |
Matteo Scandolo | 68ab543 | 2017-12-06 15:38:13 -0800 | [diff] [blame] | 214 | required manytoone site->Site:controllersite = 1 [db_index = True, null = False, blank = False, unique_with="controller", tosca_key = True]; |
| 215 | optional manytoone controller->Controller:controllersite = 2 [db_index = True, null = True, blank = True, tosca_key = True]; |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 216 | optional string tenant_id = 3 [max_length = 200, content_type = "stripped", blank = True, help_text = "Keystone tenant id", null = True, db_index = True]; |
| 217 | } |
| 218 | |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 219 | message ControllerSitePrivilege (XOSBase) { |
Sapan Bhatia | f7934b5 | 2017-06-12 05:04:23 -0700 | [diff] [blame] | 220 | required manytoone controller->Controller:controllersiteprivileges = 1 [db_index = True, null = False, blank = False, unique_with = "site_privilege"]; |
| 221 | required manytoone site_privilege->SitePrivilege:controllersiteprivileges = 2 [db_index = True, null = False, blank = False, unique_with = "role_id"]; |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 222 | optional string role_id = 3 [max_length = 200, content_type = "stripped", blank = True, help_text = "Keystone id", null = True, db_index = True]; |
| 223 | } |
| 224 | |
Sapan Bhatia | b5ce186 | 2017-07-31 15:48:19 -0400 | [diff] [blame] | 225 | policy controller_slice_policy < |
| 226 | ctx.user.is_admin |
| 227 | | *slice_policy(slice) > |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 228 | |
Sapan Bhatia | b5ce186 | 2017-07-31 15:48:19 -0400 | [diff] [blame] | 229 | message ControllerSlice::controller_slice_policy (XOSBase) { |
Sapan Bhatia | f7934b5 | 2017-06-12 05:04:23 -0700 | [diff] [blame] | 230 | 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] | 231 | required manytoone slice->Slice:controllerslices = 2 [db_index = True, null = False, blank = False]; |
| 232 | optional string tenant_id = 3 [max_length = 200, content_type = "stripped", blank = True, help_text = "Keystone tenant id", null = True, db_index = False]; |
| 233 | } |
| 234 | |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 235 | message ControllerSlicePrivilege (XOSBase) { |
Sapan Bhatia | f7934b5 | 2017-06-12 05:04:23 -0700 | [diff] [blame] | 236 | 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] | 237 | required manytoone slice_privilege->SlicePrivilege:controllersliceprivileges = 2 [db_index = True, null = False, blank = False]; |
| 238 | optional string role_id = 3 [max_length = 200, content_type = "stripped", blank = True, help_text = "Keystone id", null = True, db_index = True]; |
| 239 | } |
| 240 | |
Sapan Bhatia | b5ce186 | 2017-07-31 15:48:19 -0400 | [diff] [blame] | 241 | policy controller_user_policy < |
| 242 | ctx.user.is_admin |
| 243 | | (ctx.read_access & *user_policy(user)) > |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 244 | |
Sapan Bhatia | b5ce186 | 2017-07-31 15:48:19 -0400 | [diff] [blame] | 245 | message ControllerUser::controller_user_policy (XOSBase) { |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 246 | 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] | 247 | 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] | 248 | optional string kuser_id = 3 [max_length = 200, content_type = "stripped", blank = True, help_text = "Keystone user id", null = True, db_index = False]; |
| 249 | } |
| 250 | |
Sapan Bhatia | b5ce186 | 2017-07-31 15:48:19 -0400 | [diff] [blame] | 251 | // Everyone has read access |
| 252 | // For write access you need admin privileges at that deployment |
| 253 | policy deployment_policy < |
| 254 | ctx.user.is_admin |
| 255 | | (ctx.write_access -> exists Privilege: Privilege.object_type = "Deployment" & Privilege.object_id = obj.id & Privilege.accessor_id = ctx.user.id & Privilege.permission = "role:admin") > |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 256 | |
Sapan Bhatia | b5ce186 | 2017-07-31 15:48:19 -0400 | [diff] [blame] | 257 | message Deployment::deployment_policy (XOSBase) { |
Scott Baker | eb782fc | 2018-04-27 13:50:21 -0700 | [diff] [blame] | 258 | required string name = 1 [max_length = 200, content_type = "stripped", blank = False, help_text = "Name of the Deployment", null = False, db_index = False, unique = True]; |
Sapan Bhatia | d022aeb | 2017-06-07 15:49:55 +0200 | [diff] [blame] | 259 | 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] | 260 | } |
| 261 | |
| 262 | |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 263 | message Flavor (XOSBase) { |
Scott Baker | eb782fc | 2018-04-27 13:50:21 -0700 | [diff] [blame] | 264 | required string name = 1 [max_length = 32, content_type = "stripped", blank = False, help_text = "name of this flavor, as displayed to users", null = False, db_index = False, unique = True]; |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 265 | optional string description = 2 [db_index = False, max_length = 1024, null = True, content_type = "stripped", blank = True]; |
Scott Baker | 01fe9a3 | 2018-05-01 15:03:54 -0700 | [diff] [blame] | 266 | required string flavor = 3 [max_length = 32, content_type = "stripped", blank = True, help_text = "flavor string used to configure deployments", null = False, db_index = False]; |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 267 | } |
| 268 | |
| 269 | |
| 270 | message Image (XOSBase) { |
Matteo Scandolo | 33d8133 | 2018-09-19 10:07:33 -0700 | [diff] [blame^] | 271 | required string name = 1 [db_index = False, max_length = 256, null = False, content_type = "stripped", blank = False, unique_with = "tag"]; |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 272 | required string kind = 2 [default = "vm", choices = "(('vm', 'Virtual Machine'), ('container', 'Container'))", max_length = 30, blank = False, null = False, db_index = False]; |
Scott Baker | 01fe9a3 | 2018-05-01 15:03:54 -0700 | [diff] [blame] | 273 | optional string disk_format = 3 [db_index = False, max_length = 256, null = True, content_type = "stripped", blank = True]; |
| 274 | optional string container_format = 4 [db_index = False, max_length = 256, null = True, content_type = "stripped", blank = True]; |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 275 | optional string path = 5 [max_length = 256, content_type = "stripped", blank = True, help_text = "Path to image on local disk", null = True, db_index = False]; |
| 276 | optional string tag = 6 [max_length = 256, content_type = "stripped", blank = True, help_text = "For Docker Images, tag of image", null = True, db_index = False]; |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 277 | } |
| 278 | |
Sapan Bhatia | b5ce186 | 2017-07-31 15:48:19 -0400 | [diff] [blame] | 279 | policy image_deployment_policy < |
| 280 | *deployment_policy(deployment) |
| 281 | > |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 282 | |
| 283 | message ImageDeployments (XOSBase) { |
Sapan Bhatia | f7934b5 | 2017-06-12 05:04:23 -0700 | [diff] [blame] | 284 | 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] | 285 | required manytoone deployment->Deployment:imagedeployments = 2 [db_index = True, null = False, blank = False]; |
| 286 | } |
| 287 | |
Sapan Bhatia | 5ea307d | 2017-07-19 00:13:21 -0400 | [diff] [blame] | 288 | policy instance_creator < obj.creator > |
Sapan Bhatia | 9227b4d | 2017-07-25 23:14:48 -0400 | [diff] [blame] | 289 | policy instance_isolation < (obj.isolation = "container" | obj.isolation = "container_vm" ) -> (obj.image.kind = "container") > |
| 290 | policy instance_isolation_container_vm_parent < (obj.isolation = "container_vm") -> obj.parent > |
| 291 | policy instance_parent_isolation_container_vm < obj.parent -> ( obj.isolation = "container_vm" ) > |
Sapan Bhatia | 5ea307d | 2017-07-19 00:13:21 -0400 | [diff] [blame] | 292 | policy instance_isolation_vm < (obj.isolation = "vm") -> (obj.image.kind = "vm") > |
Sapan Bhatia | 5ea307d | 2017-07-19 00:13:21 -0400 | [diff] [blame] | 293 | 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] | 294 | |
Sapan Bhatia | b5ce186 | 2017-07-31 15:48:19 -0400 | [diff] [blame] | 295 | policy instance_policy < *slice_policy(slice) > |
| 296 | |
| 297 | message Instance::instance_policy (XOSBase) { |
| 298 | option validators = "instance_creator:Instance has no creator, instance_isolation: Container instance {obj.name} must use container image, instance_isolation_container_vm_parent:Container-vm instance {obj.name} must have a parent, instance_parent_isolation_container_vm:Parent field can only be set on Container-vm instances ({obj.name}), instance_isolation_vm: VM Instance {obj.name} must use VM image, instance_creator_privilege: instance creator has no privileges on slice"; |
Matteo Scandolo | 23cf15f | 2018-03-06 18:12:36 -0800 | [diff] [blame] | 299 | optional string instance_id = 1 [max_length = 200, content_type = "stripped", blank = True, help_text = "Nova instance id", null = True, db_index = False, feedback_state = True]; |
| 300 | optional string instance_uuid = 2 [max_length = 200, content_type = "stripped", blank = True, help_text = "Nova instance uuid", null = True, db_index = False, feedback_state = True]; |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 301 | required string name = 3 [max_length = 200, content_type = "stripped", blank = False, help_text = "Instance name", null = False, db_index = False]; |
Matteo Scandolo | 23cf15f | 2018-03-06 18:12:36 -0800 | [diff] [blame] | 302 | optional string instance_name = 4 [max_length = 200, content_type = "stripped", blank = True, help_text = "OpenStack generated name", null = True, db_index = False, feedback_state = True]; |
Matteo Scandolo | bd8caca | 2017-08-17 15:36:10 -0700 | [diff] [blame] | 303 | 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] | 304 | required manytoone image->Image:instances = 6 [db_index = True, null = False, blank = False]; |
| 305 | optional manytoone creator->User:instances = 7 [db_index = True, null = True, blank = True]; |
| 306 | required manytoone slice->Slice:instances = 8 [db_index = True, null = False, blank = False]; |
| 307 | required manytoone deployment->Deployment:instance_deployment = 9 [db_index = True, null = False, blank = False]; |
| 308 | required manytoone node->Node:instances = 10 [db_index = True, null = False, blank = False]; |
| 309 | required int32 numberCores = 11 [help_text = "Number of cores for instance", default = 0, null = False, db_index = False, blank = False]; |
| 310 | required manytoone flavor->Flavor:instance = 12 [help_text = "Flavor of this instance", null = False, db_index = True, blank = False]; |
Sapan Bhatia | d022aeb | 2017-06-07 15:49:55 +0200 | [diff] [blame] | 311 | 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] | 312 | required string isolation = 14 [default = "vm", choices = "(('vm', 'Virtual Machine'), ('container', 'Container'), ('container_vm', 'Container In VM'))", max_length = 30, blank = False, null = False, db_index = False]; |
| 313 | optional string volumes = 15 [help_text = "Comma-separated list of directories to expose to parent context", null = True, db_index = False, blank = True]; |
| 314 | optional manytoone parent->Instance:instance = 16 [help_text = "Parent Instance for containers nested inside of VMs", null = True, db_index = True, blank = True]; |
| 315 | } |
Sapan Bhatia | b5ce186 | 2017-07-31 15:48:19 -0400 | [diff] [blame] | 316 | |
| 317 | |
| 318 | policy network_policy < *slice_policy(owner) > |
| 319 | |
| 320 | message Network::network_policy (XOSBase) { |
Scott Baker | eb782fc | 2018-04-27 13:50:21 -0700 | [diff] [blame] | 321 | required string name = 1 [db_index = False, max_length = 32, null = False, blank = False, unique = True]; |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 322 | required manytoone template->NetworkTemplate:network = 2 [db_index = True, null = False, blank = False]; |
| 323 | required string subnet = 3 [db_index = False, max_length = 32, null = False, blank = True]; |
| 324 | required string start_ip = 4 [db_index = False, max_length = 32, null = False, blank = True]; |
| 325 | required string end_ip = 5 [db_index = False, max_length = 32, null = False, blank = True]; |
| 326 | optional string ports = 6 [db_index = False, max_length = 1024, null = True, blank = True]; |
| 327 | optional string labels = 7 [db_index = False, max_length = 1024, null = True, blank = True]; |
| 328 | required manytoone owner->Slice:ownedNetworks = 8 [help_text = "Slice that owns control of this Network", null = False, db_index = True, blank = False]; |
| 329 | required bool permit_all_slices = 10 [default = False, null = False, db_index = False, blank = True]; |
| 330 | required bool autoconnect = 17 [help_text = "This network can be autoconnected to the slice that owns it", default = True, null = False, db_index = False, blank = True]; |
Zack Williams | ffc9b21 | 2018-03-22 17:25:33 -0700 | [diff] [blame] | 331 | required manytomany permitted_slices->Slice/Network_permitted_slices:availableNetworks = 18 [db_index = False, blank = True]; |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 332 | } |
| 333 | |
| 334 | |
| 335 | message NetworkParameter (XOSBase) { |
| 336 | required manytoone parameter->NetworkParameterType:networkparameters = 1 [help_text = "The type of the parameter", null = False, db_index = True, blank = False]; |
| 337 | required string value = 2 [help_text = "The value of this parameter", max_length = 1024, null = False, db_index = False, blank = False]; |
| 338 | required string content_type = 4 [max_length = 1024, content_type = "stripped", blank = False, help_text = "Content type id linked to this network parameter", null = False, db_index = False]; |
| 339 | required uint32 object_id = 4 [db_index = False, null = False, blank = False, help_text = "Object linked to this NetworkParameter"]; |
| 340 | } |
| 341 | |
| 342 | |
| 343 | message NetworkParameterType (XOSBase) { |
Scott Baker | eb782fc | 2018-04-27 13:50:21 -0700 | [diff] [blame] | 344 | required string name = 1 [help_text = "The name of this parameter", max_length = 128, null = False, db_index = True, blank = False, unique = True]; |
Scott Baker | 01fe9a3 | 2018-05-01 15:03:54 -0700 | [diff] [blame] | 345 | required string description = 2 [db_index = False, max_length = 1024, null = False, blank = True]; |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 346 | } |
| 347 | |
Sapan Bhatia | 9227b4d | 2017-07-25 23:14:48 -0400 | [diff] [blame] | 348 | 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] | 349 | policy network_slice_policy < *slice_policy(slice) & *network_policy(network) > |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 350 | |
Sapan Bhatia | b5ce186 | 2017-07-31 15:48:19 -0400 | [diff] [blame] | 351 | message NetworkSlice::network_slice_policy (XOSBase) { |
Sapan Bhatia | 52b1ea5 | 2017-10-19 13:02:22 -0400 | [diff] [blame] | 352 | option validators = "network_slice_validator:Slice {obj.slice.name} is not allowed to connect to networks {obj.network}"; |
Matteo Scandolo | c3c0f0a | 2017-10-18 09:53:30 +0200 | [diff] [blame] | 353 | required manytoone network->Network:networkslices = 1 [db_index = True, null = False, blank = False, unique_with = "slice", tosca_key=True]; |
| 354 | required manytoone slice->Slice:networkslices = 2 [db_index = True, null = False, blank = False, tosca_key=True]; |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 355 | } |
Sapan Bhatia | 5ea307d | 2017-07-19 00:13:21 -0400 | [diff] [blame] | 356 | |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 357 | message NetworkTemplate (XOSBase) { |
Scott Baker | eb782fc | 2018-04-27 13:50:21 -0700 | [diff] [blame] | 358 | required string name = 1 [db_index = False, max_length = 32, null = False, blank = False, unique = True]; |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 359 | optional string description = 2 [db_index = False, max_length = 1024, null = True, blank = True]; |
| 360 | required string visibility = 4 [default = "private", choices = "(('public', 'public'), ('private', 'private'))", max_length = 30, blank = False, null = False, db_index = False]; |
| 361 | required string translation = 5 [default = "none", choices = "(('none', 'none'), ('NAT', 'NAT'))", max_length = 30, blank = False, null = False, db_index = False]; |
| 362 | optional string access = 6 [choices = "((None, 'None'), ('indirect', 'Indirect'), ('direct', 'Direct'))", max_length = 30, blank = True, help_text = "Advertise this network as a means for other slices to contact this slice", null = True, db_index = False]; |
| 363 | optional string shared_network_name = 7 [db_index = False, max_length = 30, null = True, blank = True]; |
| 364 | optional string shared_network_id = 8 [help_text = "Quantum network", max_length = 256, null = True, db_index = False, blank = True]; |
| 365 | required string topology_kind = 9 [default = "bigswitch", choices = "(('bigswitch', 'BigSwitch'), ('physical', 'Physical'), ('custom', 'Custom'))", max_length = 30, blank = False, null = False, db_index = False]; |
| 366 | optional string controller_kind = 10 [blank = True, max_length = 30, null = True, db_index = False, choices = "((None, 'None'), ('onos', 'ONOS'), ('custom', 'Custom'))"]; |
Scott Baker | 4af5c94 | 2018-08-29 13:42:18 -0700 | [diff] [blame] | 367 | optional string vtn_kind = 11 [default = "PRIVATE", choices = "(('PRIVATE', 'Private'), ('PUBLIC', 'Public'), ('MANAGEMENT_LOCAL', 'Management Local'), ('MANAGEMENT_HOST', 'Management Host'), ('VSG', 'VSG'), ('ACCESS_AGENT', 'Access Agent'), ('FLAT', 'Flat'))", max_length = 30, blank = True, null = True, db_index = False]; |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 368 | } |
Sapan Bhatia | b5ce186 | 2017-07-31 15:48:19 -0400 | [diff] [blame] | 369 | |
| 370 | policy node_policy < *site_policy(site_deployment.site) > |
| 371 | |
| 372 | message Node::node_policy (XOSBase) { |
Scott Baker | eb782fc | 2018-04-27 13:50:21 -0700 | [diff] [blame] | 373 | required string name = 1 [max_length = 200, content_type = "stripped", blank = False, help_text = "Name of the Node", null = False, db_index = False, unique = True]; |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 374 | required manytoone site_deployment->SiteDeployment:nodes = 2 [db_index = True, null = False, blank = False]; |
Scott Baker | 01fe9a3 | 2018-05-01 15:03:54 -0700 | [diff] [blame] | 375 | optional string bridgeId = 3 [max_length = 200, content_type = "stripped", blank = True, help_text = "Bridge Id", null = True, db_index = False]; |
| 376 | optional string dataPlaneIntf = 4 [max_length = 200, content_type = "stripped", blank = True, help_text = "Dataplane Interface", null = True, db_index = False]; |
| 377 | optional string dataPlaneIp = 5 [max_length = 200, content_type = "stripped", blank = True, help_text = "Dataplane Ip", null = True, db_index = False]; |
| 378 | optional string hostManagementIface = 6 [max_length = 200, content_type = "stripped", blank = True, help_text = "Host Management Interface", null = True, db_index = False]; |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 379 | } |
| 380 | message NodeLabel (XOSBase) { |
Scott Baker | eb782fc | 2018-04-27 13:50:21 -0700 | [diff] [blame] | 381 | required string name = 1 [max_length = 200, content_type = "stripped", blank = False, help_text = "label name", null = False, db_index = False, unique = True]; |
Zack Williams | ffc9b21 | 2018-03-22 17:25:33 -0700 | [diff] [blame] | 382 | required manytomany node->Node/NodeLabel_node:nodelabels = 2 [db_index = False, blank = True]; |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 383 | } |
Sapan Bhatia | 5ea307d | 2017-07-19 00:13:21 -0400 | [diff] [blame] | 384 | |
Sapan Bhatia | b5ce186 | 2017-07-31 15:48:19 -0400 | [diff] [blame] | 385 | policy port_policy < *instance_policy(instance) & *network_policy(network) > |
Sapan Bhatia | 5ea307d | 2017-07-19 00:13:21 -0400 | [diff] [blame] | 386 | |
Sapan Bhatia | b5ce186 | 2017-07-31 15:48:19 -0400 | [diff] [blame] | 387 | message Port::port_policy (XOSBase) { |
Scott Baker | 61ad7dc | 2018-06-15 15:25:39 -0700 | [diff] [blame] | 388 | required manytoone network->Network:links = 1 [db_index = True, null = False, blank = False, unique_with = "instance", help_text = "Network bound to this port"]; |
| 389 | optional manytoone instance->Instance:ports = 2 [db_index = True, null = True, blank = True, help_text = "Instance bound to this port"]; |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 390 | optional string ip = 3 [max_length = 39, content_type = "ip", blank = True, help_text = "Instance ip address", null = True, db_index = False]; |
| 391 | optional string port_id = 4 [help_text = "Neutron port id", max_length = 256, null = True, db_index = False, blank = True]; |
| 392 | optional string mac = 5 [help_text = "MAC address associated with this port", max_length = 256, null = True, db_index = False, blank = True]; |
| 393 | required bool xos_created = 6 [default = False, null = False, db_index = False, blank = True]; |
Scott Baker | 61ad7dc | 2018-06-15 15:25:39 -0700 | [diff] [blame] | 394 | optional manytoone service_instance->ServiceInstance:ports = 2 [db_index = True, null = True, blank = True, help_text = "ServiceInstance bound to this port"]; |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 395 | } |
| 396 | |
Scott Baker | 6b260ea | 2018-04-18 07:12:22 -0700 | [diff] [blame] | 397 | message Principal (XOSBase) { |
| 398 | required string name = 1 [max_length = 128, null = False, db_index = True, blank = False, help_text = "The name of this principal"]; |
| 399 | required manytoone trust_domain->TrustDomain:principals = 2 [db_index = True, null = False, blank = False, help_text = "Trust domain this principal resides in"]; |
| 400 | } |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 401 | |
| 402 | message Role (XOSBase) { |
| 403 | required string role_type = 1 [db_index = False, max_length = 80, null = False, content_type = "stripped", blank = False]; |
| 404 | optional string role = 2 [db_index = False, max_length = 80, null = True, content_type = "stripped", blank = True]; |
| 405 | required string description = 3 [db_index = False, max_length = 120, null = False, content_type = "stripped", blank = False]; |
| 406 | } |
| 407 | |
Sapan Bhatia | b5ce186 | 2017-07-31 15:48:19 -0400 | [diff] [blame] | 408 | 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] | 409 | |
| 410 | message Service (XOSBase,AttributeMixin) { |
Sapan Bhatia | d022aeb | 2017-06-07 15:49:55 +0200 | [diff] [blame] | 411 | optional string description = 1 [help_text = "Description of Service", max_length = 254, null = True, db_index = False, blank = True, varchar = True]; |
Matteo Scandolo | 03bb441 | 2018-07-26 16:38:58 -0700 | [diff] [blame] | 412 | required bool enabled = 2 [default = True, null = False, db_index = False, blank = True, gui_hidden = True]; |
Matteo Scandolo | 61a9f20 | 2018-08-01 08:58:13 -0400 | [diff] [blame] | 413 | required string kind = 3 [default = "generic", max_length = 30, content_type = "stripped", blank = False, help_text = "Kind of service", null = False, db_index = False, choices="(('generic', 'Generic'), ('data', 'Data Plane'), ('control', 'Control Plane'), ('oss', 'OSS'))"]; |
Scott Baker | eb782fc | 2018-04-27 13:50:21 -0700 | [diff] [blame] | 414 | required string name = 4 [max_length = 30, content_type = "stripped", blank = False, help_text = "Service Name", null = False, db_index = False, unique = True]; |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 415 | optional string versionNumber = 5 [max_length = 30, content_type = "stripped", blank = True, help_text = "Version of Service Definition", null = True, db_index = False]; |
Matteo Scandolo | 03bb441 | 2018-07-26 16:38:58 -0700 | [diff] [blame] | 416 | required bool published = 6 [default = True, null = False, db_index = False, blank = True, gui_hidden = True]; |
| 417 | optional string icon_url = 8 [db_index = False, max_length = 1024, null = True, content_type = "stripped", blank = True, gui_hidden = True]; |
| 418 | optional string public_key = 9 [help_text = "Public key string", max_length = 4096, null = True, db_index = False, blank = True, varchar = True, gui_hidden = True]; |
| 419 | optional string private_key_fn = 10 [db_index = False, max_length = 4096, null = True, content_type = "stripped", blank = True, gui_hidden = True]; |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 420 | optional string service_specific_id = 11 [db_index = False, max_length = 30, null = True, content_type = "stripped", blank = True]; |
Matteo Scandolo | 03bb441 | 2018-07-26 16:38:58 -0700 | [diff] [blame] | 421 | optional string service_specific_attribute = 12 [db_index = False, null = True, blank = True, varchar = True, gui_hidden = True]; |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 422 | } |
| 423 | |
Scott Baker | 6b260ea | 2018-04-18 07:12:22 -0700 | [diff] [blame] | 424 | message ServicePort (XOSBase) { |
| 425 | required string name = 1 [max_length = 128, null = False, db_index = False, blank = False, help_text = "Service Port Name"]; |
| 426 | required int32 external_port = 2 [blank = False, help_text = "external port number"]; |
| 427 | required int32 internal_port = 3 [blank = False, help_text = "internal port number"]; |
| 428 | required string protocol = 4 [max_length = 32, null = False, db_index = False, blank = False, default="TCP", help_text = "Protocol"]; |
| 429 | required manytoone service->Service:serviceports = 5 [null = False, db_index = True, blank = False, help_text = "The Service this ServicePort is associated with"]; |
| 430 | } |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 431 | |
| 432 | message ServiceAttribute (XOSBase) { |
Scott Baker | eb782fc | 2018-04-27 13:50:21 -0700 | [diff] [blame] | 433 | required string name = 1 [help_text = "Attribute Name", max_length = 128, null = False, db_index = False, blank = False, unique_with="service"]; |
Sapan Bhatia | d022aeb | 2017-06-07 15:49:55 +0200 | [diff] [blame] | 434 | 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] | 435 | required manytoone service->Service:serviceattributes = 3 [help_text = "The Service this attribute is associated with", null = False, db_index = True, blank = False]; |
| 436 | } |
| 437 | |
| 438 | |
Scott Baker | 071da96 | 2017-07-13 10:43:41 -0700 | [diff] [blame] | 439 | message ServiceDependency (XOSBase) { |
Matteo Scandolo | c3c0f0a | 2017-10-18 09:53:30 +0200 | [diff] [blame] | 440 | required manytoone provider_service->Service:provided_dependencies = 1 [help_text = "The service that provides this dependency", null=False, db_index = True, blank=False, tosca_key=True]; |
Wei-Yu Chen | 85f58fc | 2018-03-14 13:42:12 +0800 | [diff] [blame] | 441 | required manytoone subscriber_service->Service:subscribed_dependencies = 2 [help_text = "The services that subscribes to this dependency", null=False, db_index=True, blank=False, tosca_key=True]; |
Matteo Scandolo | 61a9f20 | 2018-08-01 08:58:13 -0400 | [diff] [blame] | 442 | required string connect_method = 3 [max_length = 30, help_text = "method to connect the two services", default="none", choices = "(('none', 'None'), ('private', 'Private'), ('public', 'Public'))"]; |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 443 | } |
| 444 | |
| 445 | |
| 446 | message ServiceMonitoringAgentInfo (XOSBase) { |
Scott Baker | eb782fc | 2018-04-27 13:50:21 -0700 | [diff] [blame] | 447 | required string name = 1 [help_text = "Monitoring Agent Name", max_length = 128, null = False, db_index = False, blank = False, unique_with="service"]; |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 448 | 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] | 449 | 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] | 450 | } |
| 451 | |
| 452 | |
Sapan Bhatia | b5ce186 | 2017-07-31 15:48:19 -0400 | [diff] [blame] | 453 | message Site::site_policy (XOSBase) { |
Scott Baker | eb782fc | 2018-04-27 13:50:21 -0700 | [diff] [blame] | 454 | required string name = 1 [max_length = 200, content_type = "stripped", blank = False, help_text = "Name for this Site", null = False, db_index = False, unique = True]; |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 455 | optional string site_url = 2 [max_length = 512, content_type = "url", blank = True, help_text = "Site's Home URL Page", null = True, db_index = False]; |
| 456 | required bool enabled = 3 [help_text = "Status for this Site", default = True, null = False, db_index = False, blank = True]; |
| 457 | required bool hosts_nodes = 4 [help_text = "Indicates whether or not the site host nodes", default = True, null = False, db_index = False, blank = True]; |
| 458 | required bool hosts_users = 5 [help_text = "Indicates whether or not the site manages user accounts", default = True, null = False, db_index = False, blank = True]; |
| 459 | optional float longitude = 6 [db_index = False, null = True, blank = True]; |
| 460 | optional float latitude = 7 [db_index = False, null = True, blank = True]; |
| 461 | required string login_base = 8 [max_length = 50, content_type = "stripped", blank = False, help_text = "Prefix for Slices associated with this Site", null = False, db_index = False]; |
| 462 | required bool is_public = 9 [help_text = "Indicates the visibility of this site to other members", default = True, null = False, db_index = False, blank = True]; |
| 463 | required string abbreviated_name = 10 [db_index = False, max_length = 80, null = False, content_type = "stripped", blank = False]; |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 464 | } |
| 465 | |
| 466 | |
| 467 | message SiteDeployment (XOSBase) { |
Matteo Scandolo | c3c0f0a | 2017-10-18 09:53:30 +0200 | [diff] [blame] | 468 | required manytoone site->Site:sitedeployments = 1 [db_index = True, null = False, blank = False, unique_with = "deployment", tosca_key=True]; |
| 469 | required manytoone deployment->Deployment:sitedeployments = 2 [db_index = True, null = False, blank = False, unique_with = "controller", tosca_key=True]; |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 470 | optional manytoone controller->Controller:sitedeployments = 3 [db_index = True, null = True, blank = True]; |
| 471 | optional string availability_zone = 4 [max_length = 200, content_type = "stripped", blank = True, help_text = "OpenStack availability zone", null = True, db_index = False]; |
| 472 | } |
| 473 | |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 474 | message SitePrivilege (XOSBase) { |
| 475 | required manytoone user->User:siteprivileges = 1 [db_index = True, null = False, blank = False]; |
Matteo Scandolo | c3c0f0a | 2017-10-18 09:53:30 +0200 | [diff] [blame] | 476 | required manytoone site->Site:siteprivileges = 2 [db_index = True, null = False, blank = False, tosca_key=True]; |
| 477 | required manytoone role->SiteRole:siteprivileges = 3 [db_index = True, null = False, blank = False, tosca_key=True]; |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 478 | } |
| 479 | |
| 480 | |
| 481 | message SiteRole (XOSBase) { |
Matteo Scandolo | 68ab543 | 2017-12-06 15:38:13 -0800 | [diff] [blame] | 482 | required string role = 1 [choices = "(('admin', 'Admin'), ('pi', 'PI'), ('tech', 'Tech'), ('billing', 'Billing'))", max_length = 30, content_type = "stripped", blank = False, null = False, db_index = False, tosca_key=True]; |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 483 | } |
Sapan Bhatia | cb35e7f | 2017-05-24 12:17:28 +0200 | [diff] [blame] | 484 | |
Scott Baker | 6b260ea | 2018-04-18 07:12:22 -0700 | [diff] [blame] | 485 | policy slice_name_no_spaces < {{ ' ' not in obj.name }} > |
Sapan Bhatia | 5ea307d | 2017-07-19 00:13:21 -0400 | [diff] [blame] | 486 | policy slice_has_creator < obj.creator > |
| 487 | |
Sapan Bhatia | b5ce186 | 2017-07-31 15:48:19 -0400 | [diff] [blame] | 488 | message Slice::slice_policy (XOSBase) { |
Scott Baker | 6b260ea | 2018-04-18 07:12:22 -0700 | [diff] [blame] | 489 | option validators = "slice_name_no_spaces:Slice name contains spaces, slice_has_creator:Slice has no creator"; |
Sapan Bhatia | cb35e7f | 2017-05-24 12:17:28 +0200 | [diff] [blame] | 490 | option plural = "Slices"; |
Sapan Bhatia | 5ea307d | 2017-07-19 00:13:21 -0400 | [diff] [blame] | 491 | |
Scott Baker | eb782fc | 2018-04-27 13:50:21 -0700 | [diff] [blame] | 492 | required string name = 1 [max_length = 80, content_type = "stripped", blank = False, help_text = "The Name of the Slice", null = False, db_index = False, unique = True]; |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 493 | 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] | 494 | 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] | 495 | required manytoone site->Site:slices = 6 [help_text = "The Site this Slice belongs to", null = False, db_index = True, blank = False]; |
| 496 | required int32 max_instances = 7 [default = 10, null = False, db_index = False, blank = False]; |
| 497 | optional manytoone service->Service:slices = 8 [db_index = True, null = True, blank = True]; |
| 498 | optional string network = 9 [blank = True, max_length = 256, null = True, db_index = False, choices = "((None, 'Default'), ('host', 'Host'), ('bridged', 'Bridged'), ('noauto', 'No Automatic Networks'))"]; |
| 499 | optional string exposed_ports = 10 [db_index = False, max_length = 256, null = True, blank = True]; |
Sapan Bhatia | 1c5d607 | 2017-09-01 23:21:46 -0400 | [diff] [blame] | 500 | optional manytoone creator->User:slices = 12 [db_index = True, null = False, blank = False]; |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 501 | optional manytoone default_flavor->Flavor:slices = 13 [db_index = True, null = True, blank = True]; |
| 502 | optional manytoone default_image->Image:slices = 14 [db_index = True, null = True, blank = True]; |
| 503 | optional manytoone default_node->Node:slices = 15 [db_index = True, null = True, blank = True]; |
| 504 | optional string mount_data_sets = 16 [default = "GenBank", max_length = 256, content_type = "stripped", blank = True, null = True, db_index = False]; |
| 505 | required string default_isolation = 17 [default = "vm", choices = "(('vm', 'Virtual Machine'), ('container', 'Container'), ('container_vm', 'Container In VM'))", max_length = 30, blank = False, null = False, db_index = False]; |
Scott Baker | 6b260ea | 2018-04-18 07:12:22 -0700 | [diff] [blame] | 506 | optional manytoone trust_domain->TrustDomain:slices = 12 [db_index = True, null = False, blank = False, help_text = "Trust domain this slice resides in"]; |
| 507 | optional manytoone principal->Principal:slices = 12 [db_index = True, null = False, blank = False, help_text = "Principal this slice may use to interact with other components"]; |
| 508 | optional int32 controller_replica_count = 13 [default = 0, null = False, db_index = False, blank = False, help_text = "Replica count, controller-dependent"]; |
| 509 | optional string controller_kind = 14 [max_length = 256, content_type = "stripped", blank = True, help_text = "Type of controller, vim-dependent", null = True, db_index = False]; |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 510 | } |
| 511 | |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 512 | message SlicePrivilege (XOSBase) { |
Sapan Bhatia | f7934b5 | 2017-06-12 05:04:23 -0700 | [diff] [blame] | 513 | required manytoone user->User:sliceprivileges = 1 [db_index = True, null = False, blank = False, unique_with = "slice"]; |
| 514 | required manytoone slice->Slice:sliceprivileges = 2 [db_index = True, null = False, blank = False, unique_with = "role"]; |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 515 | required manytoone role->SliceRole:sliceprivileges = 3 [db_index = True, null = False, blank = False]; |
| 516 | } |
| 517 | |
| 518 | |
| 519 | message SliceRole (XOSBase) { |
Matteo Scandolo | 61a9f20 | 2018-08-01 08:58:13 -0400 | [diff] [blame] | 520 | required string role = 1 [choices = "(('admin', 'Admin'), ('default', 'Default'), ('access', 'Access'))", max_length = 30, content_type = "stripped", blank = False, null = False, db_index = False, tosca_key=True]; |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 521 | } |
| 522 | |
Sapan Bhatia | b5ce186 | 2017-07-31 15:48:19 -0400 | [diff] [blame] | 523 | policy tag_policy < ctx.user.is_admin > |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 524 | |
Sapan Bhatia | b5ce186 | 2017-07-31 15:48:19 -0400 | [diff] [blame] | 525 | message Tag::tag_policy (XOSBase) { |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 526 | required manytoone service->Service:tags = 1 [help_text = "The Service this Tag is associated with", null = False, db_index = True, blank = False]; |
| 527 | required string name = 2 [help_text = "The name of this tag", max_length = 128, null = False, db_index = True, blank = False]; |
| 528 | required string value = 3 [max_length = 1024, content_type = "stripped", blank = False, help_text = "The value of this tag", null = False, db_index = False]; |
| 529 | required string content_type = 4 [max_length = 1024, content_type = "stripped", blank = False, help_text = "Content type id linked to this tag", null = False, db_index = False]; |
| 530 | required uint32 object_id = 5 [db_index = False, null = False, blank = False, help_text = "Object linked to this tag"]; |
| 531 | } |
| 532 | |
Scott Baker | d6e533f | 2017-07-17 13:37:29 -0700 | [diff] [blame] | 533 | message InterfaceType (XOSBase) { |
Scott Baker | eb782fc | 2018-04-27 13:50:21 -0700 | [diff] [blame] | 534 | required string name = 1 [db_index = False, max_length = 200, null = False, content_type = "stripped", blank = False, unique_with = "direction"]; |
Scott Baker | d6e533f | 2017-07-17 13:37:29 -0700 | [diff] [blame] | 535 | 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] | 536 | } |
| 537 | |
Scott Baker | d6e533f | 2017-07-17 13:37:29 -0700 | [diff] [blame] | 538 | message ServiceInterface (XOSBase) { |
Matteo Scandolo | c3c0f0a | 2017-10-18 09:53:30 +0200 | [diff] [blame] | 539 | required manytoone service->Service:service_interfaces = 1 [db_index = True, null = False, blank = False, tosca_key=True]; |
| 540 | required manytoone interface_type->InterfaceType:service_interfaces = 2 [db_index = True, null = False, blank = False, tosca_key=True]; |
Scott Baker | d6e533f | 2017-07-17 13:37:29 -0700 | [diff] [blame] | 541 | } |
| 542 | |
| 543 | message ServiceInstance (XOSBase, AttributeMixin) { |
| 544 | optional string name = 1 [db_index = False, max_length = 200, null = True, content_type = "stripped", blank = True]; |
| 545 | required manytoone owner->Service:service_instances = 2 [db_index = True, null = False, blank = False]; |
Matteo Scandolo | 03bb441 | 2018-07-26 16:38:58 -0700 | [diff] [blame] | 546 | optional string service_specific_id = 3 [db_index = False, max_length = 30, null = True, content_type = "stripped", blank = True, gui_hidden = True]; |
| 547 | optional string service_specific_attribute = 10 [db_index = False, null = True, blank = True, varchar = True, gui_hidden = True]; |
| 548 | optional uint32 link_deleted_count = 11 [default = 0, help_text = "Incremented each time a provided_link is deleted from this ServiceInstance", gui_hidden = True]; |
Matteo Scandolo | 61a9f20 | 2018-08-01 08:58:13 -0400 | [diff] [blame] | 549 | optional manytoone master_serviceinstance->ServiceInstance:child_serviceinstances = 12 [help_text = "The master service instance that set this service instance up", gui_hidden = True, blank = True]; |
Scott Baker | d6e533f | 2017-07-17 13:37:29 -0700 | [diff] [blame] | 550 | } |
| 551 | |
| 552 | message ServiceInstanceLink (XOSBase) { |
Matteo Scandolo | c3c0f0a | 2017-10-18 09:53:30 +0200 | [diff] [blame] | 553 | required manytoone provider_service_instance->ServiceInstance:provided_links = 1 [db_index = True, null = False, blank = False, tosca_key=True]; |
Scott Baker | d6e533f | 2017-07-17 13:37:29 -0700 | [diff] [blame] | 554 | optional manytoone provider_service_interface->ServiceInterface:provided_links = 2 [db_index = True, null = True, blank = True]; |
| 555 | optional manytoone subscriber_service_instance->ServiceInstance:subscribed_links = 3 [db_index = True, null = True, blank = True]; |
Matteo Scandolo | 68ab543 | 2017-12-06 15:38:13 -0800 | [diff] [blame] | 556 | optional manytoone subscriber_service->Service:subscribed_links = 4 [db_index = True, null = True, blank = True, tosca_key_one_of=subscriber_service_instance]; |
| 557 | optional manytoone subscriber_network->Network:subscribed_links = 5 [db_index = True, null = True, blank = True, tosca_key_one_of=subscriber_service_instance]; |
Scott Baker | d6e533f | 2017-07-17 13:37:29 -0700 | [diff] [blame] | 558 | } |
| 559 | |
| 560 | message ServiceInstanceAttribute (XOSBase) { |
Scott Baker | eb782fc | 2018-04-27 13:50:21 -0700 | [diff] [blame] | 561 | required string name = 1 [help_text = "Attribute Name", max_length = 128, null = False, db_index = False, blank = False, unique_with="service_instance"]; |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 562 | 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] | 563 | 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] | 564 | } |
| 565 | |
Scott Baker | d6e533f | 2017-07-17 13:37:29 -0700 | [diff] [blame] | 566 | message TenantWithContainer (ServiceInstance) { |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 567 | optional manytoone instance->Instance:+ = 1 [help_text = "Instance used by this Tenant", null = True, db_index = True, blank = True]; |
| 568 | optional manytoone creator->User:+ = 2 [help_text = "Creator of this Tenant", null = True, db_index = True, blank = True]; |
| 569 | optional string external_hostname = 3 [max_length = 30, content_type = "stripped", blank = True, help_text = "External host name", null = True, db_index = False]; |
| 570 | optional string external_container = 4 [max_length = 30, content_type = "stripped", blank = True, help_text = "External host name", null = True, db_index = False]; |
Sapan Bhatia | ba870b8 | 2017-12-01 09:52:42 -0500 | [diff] [blame] | 571 | optional string node_label = 5 [max_length = 30, content_type = "stripped", blank = True, help_text = "Node constraint", null = True, db_index = False]; |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 572 | } |
| 573 | |
Scott Baker | 6b260ea | 2018-04-18 07:12:22 -0700 | [diff] [blame] | 574 | message TrustDomain (XOSBase) { |
| 575 | required string name = 1 [max_length = 255, null = False, db_index = True, blank = False, help_text = "Name of this trust domain"]; |
| 576 | required manytoone owner->Service:owned_trust_domains = 2 [null = False, db_index = True, blank = False, help_text = "Service partioned by this trust domain"]; |
| 577 | } |
| 578 | |
Scott Baker | a33ccb0 | 2018-01-26 13:03:28 -0800 | [diff] [blame] | 579 | message XOSCore (XOSBase) { |
| 580 | option singular="XOSCore"; |
| 581 | option plural="XOSCores"; |
Scott Baker | eb782fc | 2018-04-27 13:50:21 -0700 | [diff] [blame] | 582 | required string name = 1 [default = "XOS", max_length = 200, content_type = "stripped", blank = False, help_text = "Name of XOS", null = False, db_index = False, unique = "True"]; |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 583 | } |
| 584 | |
Matteo Scandolo | ee367fd | 2017-11-22 14:55:09 -0800 | [diff] [blame] | 585 | message XOSGuiExtension::admin_policy (XOSBase) { |
Matteo Scandolo | e425f9d | 2017-08-15 15:56:19 -0700 | [diff] [blame] | 586 | option verbose_name="XOS GUI Extension"; |
| 587 | option description="This model holds the instruction to load an extension in the GUI"; |
Matteo Scandolo | 623da23 | 2017-12-01 11:49:45 -0800 | [diff] [blame] | 588 | // option no_sync = True; |
| 589 | // option no_policy = True; |
Matteo Scandolo | 39b4a27 | 2017-11-17 11:09:21 -0800 | [diff] [blame] | 590 | |
Scott Baker | eb782fc | 2018-04-27 13:50:21 -0700 | [diff] [blame] | 591 | required string name = 1 [max_length = 200, content_type = "stripped", blank = False, help_text = "Name of the GUI Extensions", null = False, db_index = False, unique = True]; |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 592 | required string files = 2 [max_length = 1024, content_type = "stripped", blank = False, help_text = "List of comma separated file composing the view", null = False, db_index = False]; |
| 593 | } |
Sapan Bhatia | 5ea307d | 2017-07-19 00:13:21 -0400 | [diff] [blame] | 594 | |
Matteo Scandolo | e2afe4b | 2017-11-15 08:10:55 -0800 | [diff] [blame] | 595 | message ServiceGraphConstraint (XOSBase) { |
| 596 | option verbose_name="Graph Constraint"; |
| 597 | option description="Define the position of the nodes in the service graph"; |
| 598 | required string constraints = 1 [max_length = 1024, content_type = "stripped", blank = True, help_text = "A composite array defining positions, eg [volt, vsg, [address_manager, vrouter]]", null = False, tosca_key=True]; |
| 599 | } |
| 600 | |