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 | |
Matteo Scandolo | ee367fd | 2017-11-22 14:55:09 -0800 | [diff] [blame] | 3 | // use thi policy to allow access to admins only |
| 4 | policy admin_policy < ctx.user.is_admin > |
| 5 | |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 6 | message XOSBase { |
Sapan Bhatia | d022aeb | 2017-06-07 15:49:55 +0200 | [diff] [blame] | 7 | option skip_init = True; |
Scott Baker | a33ccb0 | 2018-01-26 13:03:28 -0800 | [diff] [blame] | 8 | option custom_header = "xosbase_header"; |
| 9 | option abstract = True; |
Scott Baker | be2a517 | 2019-04-10 18:02:50 -0700 | [diff] [blame] | 10 | option custom_python=True; |
Sapan Bhatia | cb35e7f | 2017-05-24 12:17:28 +0200 | [diff] [blame] | 11 | |
Scott Baker | c237f88 | 2018-09-28 14:12:47 -0700 | [diff] [blame] | 12 | // field 1 is reserved for "id" |
Scott Baker | 4447685 | 2019-05-02 11:44:26 -0700 | [diff] [blame] | 13 | required string created = 2 [content_type = "date", auto_now_add = True, bookkeeping_state = True, help_text = "Time this model was created"]; |
| 14 | required string updated = 3 [default = "now()", content_type = "date", bookkeeping_state = True, help_text = "Time this model was changed by a non-synchronizer"]; |
| 15 | optional string enacted = 4 [content_type = "date", blank = True, default = None, bookkeeping_state = True, help_text = "When synced, set to the timestamp of the data that was synced"]; |
| 16 | optional string policed = 5 [content_type = "date", blank = True, default = None, bookkeeping_state = True, help_text = "When policed, set to the timestamp of the data that was policed"]; |
Scott Baker | c237f88 | 2018-09-28 14:12:47 -0700 | [diff] [blame] | 17 | optional string backend_register = 6 [default = "{}", max_length = 1024, feedback_state = True]; |
Scott Baker | 4447685 | 2019-05-02 11:44:26 -0700 | [diff] [blame] | 18 | required bool backend_need_delete = 7 [default = False, bookkeeping_state = True]; |
| 19 | required bool backend_need_reap = 8 [default = False, bookkeeping_state = True]; |
Zack Williams | 00e22d6 | 2019-03-01 22:32:13 -0700 | [diff] [blame] | 20 | required string backend_status = 9 [default = "Provisioning in progress", max_length = 1024, feedback_state = True]; |
Scott Baker | c237f88 | 2018-09-28 14:12:47 -0700 | [diff] [blame] | 21 | required int32 backend_code = 10 [default = 0, feedback_state = True]; |
Scott Baker | 4447685 | 2019-05-02 11:44:26 -0700 | [diff] [blame] | 22 | required bool deleted = 11 [default = False, bookkeeping_state = True]; |
| 23 | required bool write_protect = 12 [default = False, bookkeeping_state = True]; |
| 24 | required bool lazy_blocked = 13 [default = False, bookkeeping_state = True]; |
| 25 | required bool no_sync = 14 [default = False, bookkeeping_state = True]; |
| 26 | required bool no_policy = 15 [default = False, bookkeeping_state = True]; |
Matteo Scandolo | 23cf15f | 2018-03-06 18:12:36 -0800 | [diff] [blame] | 27 | optional string policy_status = 16 [default = "Policy in process", max_length = 1024, feedback_state = True]; |
Scott Baker | c237f88 | 2018-09-28 14:12:47 -0700 | [diff] [blame] | 28 | optional int32 policy_code = 17 [default = 0, feedback_state = True]; |
Scott Baker | 4447685 | 2019-05-02 11:44:26 -0700 | [diff] [blame] | 29 | required string leaf_model_name = 18 [max_length = 1024, bookkeeping_state = True, help_text = "The most specialized model in this chain of inheritance, often defined by a service developer"]; |
| 30 | required bool backend_need_delete_policy = 19 [default = False, bookkeeping_state = True, help_text = "True if delete model_policy must be run before object can be reaped"]; |
Scott Baker | c80304a | 2019-03-07 11:07:29 -0800 | [diff] [blame] | 31 | required bool xos_managed = 20 [default = True, help_text = "True if xos is responsible for creating/deleting this object", gui_hidden = True]; |
Scott Baker | 83cc6f5 | 2019-03-11 11:10:24 -0700 | [diff] [blame] | 32 | optional string backend_handle = 21 [max_length = 1024, feedback_state = True, blank=True, help_text = "Handle used by the backend to track this object", gui_hidden = True]; |
Scott Baker | 4447685 | 2019-05-02 11:44:26 -0700 | [diff] [blame] | 33 | optional string changed_by_step = 22 [content_type = "date", blank = True, default = None, bookkeeping_state = True, gui_hidden = True, help_text = "Time this model was changed by a sync step"]; |
| 34 | optional string changed_by_policy = 23 [content_type = "date", blank = True, default = None, bookkeeping_state = True, 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] | 35 | } |
| 36 | |
Sapan Bhatia | b5ce186 | 2017-07-31 15:48:19 -0400 | [diff] [blame] | 37 | // The calling user represents the user being accessed, or is a site admin. |
| 38 | policy user_policy < |
| 39 | ctx.user.is_admin |
| 40 | | ctx.user.id = obj.id |
| 41 | | (exists Privilege: |
| 42 | Privilege.accessor_id = ctx.user.id |
| 43 | & Privilege.accessor_type = "User" |
| 44 | & Privilege.permission = "role:admin" |
| 45 | & Privilege.object_type = "Site" |
| 46 | & Privilege.object_id = ctx.user.site.id) > |
| 47 | |
| 48 | message User::user_policy (AbstractBaseUser,PlModelMixIn) { |
Sapan Bhatia | d022aeb | 2017-06-07 15:49:55 +0200 | [diff] [blame] | 49 | option skip_django = True; |
Matteo Scandolo | e425f9d | 2017-08-15 15:56:19 -0700 | [diff] [blame] | 50 | option description = "An XOS User"; |
Sapan Bhatia | cb35e7f | 2017-05-24 12:17:28 +0200 | [diff] [blame] | 51 | |
Scott Baker | c237f88 | 2018-09-28 14:12:47 -0700 | [diff] [blame] | 52 | // field 1 is reserved for "id" |
Scott Baker | 08d1040 | 2019-04-08 16:19:59 -0700 | [diff] [blame] | 53 | required string email = 2 [db_index = True, max_length = 256, blank = False, tosca_key=True]; |
| 54 | required string username = 3 [default = "Something", max_length = 256, content_type = "stripped", blank = False, db_index = False]; |
| 55 | required string password = 4 [default = "Something", max_length = 256, blank = False, db_index = False]; |
Scott Baker | 83cc6f5 | 2019-03-11 11:10:24 -0700 | [diff] [blame] | 56 | optional string last_login = 5 [db_index = False, content_type = "date", blank = True]; |
| 57 | required string firstname = 6 [max_length = 200, content_type = "stripped", blank = False, help_text = "person's given name", db_index = False]; |
| 58 | required string lastname = 7 [max_length = 200, content_type = "stripped", blank = False, help_text = "person's surname", db_index = False]; |
| 59 | optional string phone = 8 [max_length = 100, content_type = "stripped", blank = True, help_text = "phone number contact", db_index = False]; |
| 60 | optional string user_url = 9 [db_index = False, max_length = 200, content_type = "url", blank = True]; |
| 61 | required manytoone site->Site:users = 10:1001 [help_text = "Site this user will be homed too", db_index = True, blank = False]; |
Scott Baker | 08d1040 | 2019-04-08 16:19:59 -0700 | [diff] [blame] | 62 | optional string public_key = 11 [help_text = "Public key string", db_index = False, blank = True, text = True]; |
Scott Baker | 83cc6f5 | 2019-03-11 11:10:24 -0700 | [diff] [blame] | 63 | required bool is_active = 12 [default = True, db_index = False]; |
| 64 | required bool is_admin = 13 [default = False, db_index = False]; |
| 65 | required bool is_staff = 14 [default = True, db_index = False]; |
| 66 | required bool is_readonly = 15 [default = False, db_index = False]; |
| 67 | required bool is_registering = 16 [default = False, db_index = False]; |
| 68 | required bool is_appuser = 17 [default = False, db_index = False]; |
| 69 | optional string login_page = 18 [max_length = 200, content_type = "stripped", blank = True, help_text = "send this user to a specific page on login", db_index = False]; |
Himanshu Bhandari | 05c0698 | 2020-05-14 04:36:42 +0530 | [diff] [blame^] | 70 | required string created = 19 [content_type = "date", auto_now_add = True, help_text = "Time this model was created", bookkeeping_state = True]; |
Scott Baker | c80304a | 2019-03-07 11:07:29 -0800 | [diff] [blame] | 71 | required string updated = 20 [default = "now()", content_type = "date", help_text = "Time this model was changed by a non-synchronizer"]; |
Scott Baker | 83cc6f5 | 2019-03-11 11:10:24 -0700 | [diff] [blame] | 72 | optional string enacted = 21 [content_type = "date", blank = True, default = None, help_text = "When synced, set to the timestamp of the data that was synced"]; |
| 73 | optional string policed = 22 [content_type = "date", blank = True, default = None, help_text = "When policed, set to the timestamp of the data that was policed"]; |
| 74 | required string backend_status = 23 [default = "Provisioning in progress", max_length = 1024, content_type = "stripped", blank = False, db_index = False]; |
Scott Baker | c237f88 | 2018-09-28 14:12:47 -0700 | [diff] [blame] | 75 | required int32 backend_code = 24 [default = 0]; |
Scott Baker | 83cc6f5 | 2019-03-11 11:10:24 -0700 | [diff] [blame] | 76 | required bool backend_need_delete = 25 [default = False, db_index = False]; |
| 77 | required bool backend_need_reap = 26 [default = False, db_index = False]; |
| 78 | required bool deleted = 27 [default = False, db_index = False]; |
| 79 | required bool write_protect = 28 [default = False, db_index = False]; |
| 80 | required bool lazy_blocked = 29 [default = False, db_index = False]; |
| 81 | required bool no_sync = 30 [default = False, db_index = False]; |
| 82 | required bool no_policy = 31 [default = False, db_index = False]; |
| 83 | required string timezone = 32 [default = "America/New_York", max_length = 100, blank = False, db_index = False]; |
Scott Baker | c237f88 | 2018-09-28 14:12:47 -0700 | [diff] [blame] | 84 | optional string policy_status = 33 [default = "0 - Policy in process", max_length = 1024]; |
| 85 | optional int32 policy_code = 34 [default = 0]; |
Himanshu Bhandari | 05c0698 | 2020-05-14 04:36:42 +0530 | [diff] [blame^] | 86 | required string leaf_model_name = 35 [max_length = 1024, help_text = "The most specialized model in this chain of inheritance, often defined by a service developer", bookkeeping_state = True]; |
Scott Baker | c80304a | 2019-03-07 11:07:29 -0800 | [diff] [blame] | 87 | required bool backend_need_delete_policy = 36 [default = False, help_text = "True if delete model_policy must be run before object can be reaped"]; |
| 88 | required bool xos_managed = 37 [default = True, help_text = "True if xos is responsible for creating/deleting this object", gui_hidden = True]; |
Scott Baker | 83cc6f5 | 2019-03-11 11:10:24 -0700 | [diff] [blame] | 89 | optional string backend_handle = 38 [max_length = 1024, feedback_state = True, blank=True, help_text = "Handle used by the backend to track this object", gui_hidden = True]; |
| 90 | optional string changed_by_step = 39 [content_type = "date", blank = True, default = None, gui_hidden = True, help_text = "Time this model was changed by a sync step"]; |
| 91 | optional string changed_by_policy = 40 [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] | 92 | } |
Sapan Bhatia | d022aeb | 2017-06-07 15:49:55 +0200 | [diff] [blame] | 93 | |
Sapan Bhatia | b5ce186 | 2017-07-31 15:48:19 -0400 | [diff] [blame] | 94 | // A user may give a permission that he has to another user |
| 95 | policy grant_policy < ctx.user.is_admin |
| 96 | | exists Privilege:Privilege.object_type = obj.object_type |
| 97 | & Privilege.object_id = obj.object_id |
| 98 | & Privilege.accessor_type = "User" |
Kailash Khalasi | acab7e1 | 2017-12-14 11:27:26 -0800 | [diff] [blame] | 99 | & Privilege.accessor_id = ctx.user.id |
Sapan Bhatia | b5ce186 | 2017-07-31 15:48:19 -0400 | [diff] [blame] | 100 | & Privilege.permission = "role:admin" > |
Kailash Khalasi | acab7e1 | 2017-12-14 11:27:26 -0800 | [diff] [blame] | 101 | |
Sapan Bhatia | b5ce186 | 2017-07-31 15:48:19 -0400 | [diff] [blame] | 102 | message Privilege::grant_policy (XOSBase) { |
Scott Baker | 83cc6f5 | 2019-03-11 11:10:24 -0700 | [diff] [blame] | 103 | required int32 accessor_id = 1 [blank=False]; |
| 104 | required string accessor_type = 2 [max_length=1024, blank = False]; |
| 105 | required int32 object_id = 4 [blank=False]; |
| 106 | required string object_type = 5 [max_length=1024, blank = False]; |
| 107 | required string permission = 6 [default = "all", max_length=1024, tosca_key=True]; |
Sapan Bhatia | b5ce186 | 2017-07-31 15:48:19 -0400 | [diff] [blame] | 108 | required string granted = 7 [content_type = "date", auto_now_add = True, max_length=1024]; |
Zack Williams | 00e22d6 | 2019-03-01 22:32:13 -0700 | [diff] [blame] | 109 | optional string expires = 8 [content_type = "date", max_length=1024]; |
Sapan Bhatia | 8918ac3 | 2017-07-09 00:43:27 -0400 | [diff] [blame] | 110 | } |
| 111 | |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 112 | message AddressPool (XOSBase) { |
Scott Baker | be2a517 | 2019-04-10 18:02:50 -0700 | [diff] [blame] | 113 | option custom_python=True; |
Scott Baker | 83cc6f5 | 2019-03-11 11:10:24 -0700 | [diff] [blame] | 114 | required string name = 1 [db_index = False, max_length = 32, blank = False, unique = True, help_text="Name of this AddressPool"]; |
Scott Baker | 08d1040 | 2019-04-08 16:19:59 -0700 | [diff] [blame] | 115 | optional string addresses = 2 [db_index = False, blank = True, text = True, help_text="Space-separated list of available addresses"]; |
Scott Baker | 83cc6f5 | 2019-03-11 11:10:24 -0700 | [diff] [blame] | 116 | required string gateway_ip = 3 [max_length = 32, help_text="Gateway IP address for this AddressPool"]; |
| 117 | required string gateway_mac = 4 [max_length = 32, help_text="Gateway MAC address for this AddressPool"]; |
| 118 | required string cidr = 5 [max_length = 32, help_text="Subnet for this AddressPool"]; |
Scott Baker | 08d1040 | 2019-04-08 16:19:59 -0700 | [diff] [blame] | 119 | optional string inuse = 6 [db_index = False, blank = True, text = True, help_text="Space-separated list of inuse addresses"]; |
Scott Baker | 83cc6f5 | 2019-03-11 11:10:24 -0700 | [diff] [blame] | 120 | optional manytoone service->Service:addresspools = 7:1001 [db_index = True, blank = True, help_text="Service this AddressPool belongs to"]; |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 121 | } |
| 122 | |
Scott Baker | 6bd238f | 2019-04-16 16:28:52 -0700 | [diff] [blame] | 123 | message BackupFile (XOSBase) { |
| 124 | required string name = 1 [ |
| 125 | help_text = "human-readable name of this backup file", |
| 126 | max_length = 256]; |
| 127 | required string uri = 2 [ |
| 128 | help_text = "location of the backup file", |
| 129 | max_length = 1024]; |
| 130 | optional string checksum = 3 [ |
| 131 | help_text = "checksum of backup file, formatted as algorithm:hash", |
| 132 | max_length = 1024]; |
| 133 | // status: |
| 134 | // retrieved - file has been retrieved from URI |
| 135 | // sent - file has been sent to URI |
| 136 | // inprogress - file transfer is in progress |
| 137 | optional string status = 4 [ |
| 138 | help_text = "status of file transfer", |
| 139 | choices = "(('retrieved', 'retrieved'), ('sent', 'sent'), ('inprogress', 'inprogress'))", |
| 140 | feedback_state = True, |
| 141 | max_length = 32]; |
| 142 | optional string backend_filename = 5 [ |
| 143 | help_text = "for internal use, local filename", |
| 144 | feedback_state = True, |
| 145 | max_length = 1024]; |
| 146 | } |
| 147 | |
| 148 | message BackupOperation (XOSBase) { |
Scott Baker | 89704b1 | 2019-05-07 16:42:11 -0700 | [diff] [blame] | 149 | option custom_python=True; |
| 150 | |
Scott Baker | 6bd238f | 2019-04-16 16:28:52 -0700 | [diff] [blame] | 151 | // `file` is required for restores. |
| 152 | // `file` is optional for backups. If file is unspecified then XOS will create a backup file using |
| 153 | // a default mechanism. |
| 154 | optional manytoone file->BackupFile:operations = 1:1001 [ |
| 155 | help_text = "File to backup to or restore from"]; |
| 156 | required string component = 2 [ |
| 157 | help_text = "component that this operation applies to", |
| 158 | // XOS is currently the only allowed component |
| 159 | choices = "(('xos', 'XOS'), )", |
| 160 | default = "xos", |
| 161 | max_length = 32]; |
| 162 | required string operation = 3 [ |
| 163 | help_text = "operation to perform", |
| 164 | choices = "(('create', 'create'), ('restore', 'restore'), ('verify', 'verify'))", |
| 165 | max_length = 32]; |
| 166 | optional string status = 4 [ |
| 167 | help_text = "status of operation", |
| 168 | choices = "(('created', 'created'), ('restored', 'restored'), ('failed', 'failed'), ('inprogress', 'in progress'), ('orphaned', 'orphaned'))", |
| 169 | feedback_state = True, |
| 170 | max_length = 32]; |
| 171 | optional string error_msg = 5 [ |
| 172 | help_text = "error message from backup processor, if status is failure", |
| 173 | feedback_state = True, |
| 174 | max_length = 4096]; |
| 175 | // `effective_date` may be different from `XOSBase.enacted` if a synchronizer is performing |
| 176 | // an operation on an external component. `XOSBase.enacted` is always set to the time the |
| 177 | // model is saved, which could differ from the time the backup or restore completed by |
| 178 | // a short time. |
| 179 | optional string effective_date = 6 [ |
| 180 | help_text = "the time and date the operation was completed", |
| 181 | content_type = "date", |
| 182 | feedback_state = True]; |
Scott Baker | 89704b1 | 2019-05-07 16:42:11 -0700 | [diff] [blame] | 183 | optional string uuid = 7 [ |
| 184 | help_text = "unique identifer of this request", |
| 185 | bookkeeping_state = True, |
| 186 | max_length = 80]; |
Scott Baker | 6bd238f | 2019-04-16 16:28:52 -0700 | [diff] [blame] | 187 | } |
| 188 | |
Scott Baker | 6b260ea | 2018-04-18 07:12:22 -0700 | [diff] [blame] | 189 | message ComputeServiceInstance (ServiceInstance) { |
Scott Baker | 83cc6f5 | 2019-03-11 11:10:24 -0700 | [diff] [blame] | 190 | required manytoone slice->Slice:computeserviceinstances = 1:1001 [db_index = True, blank = False, help_text = "Slice that controls this ServiceInstance"]; |
| 191 | required manytoone image->Image:computeserviceinstances = 2:1001 [db_index = True, blank = False, help_text = "Image used to instantiate this ServiceInstance"]; |
Scott Baker | 6b260ea | 2018-04-18 07:12:22 -0700 | [diff] [blame] | 192 | } |
| 193 | |
Sapan Bhatia | b5ce186 | 2017-07-31 15:48:19 -0400 | [diff] [blame] | 194 | // Everyone has read access |
| 195 | // For write access, you have to be a site_admin |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 196 | |
Sapan Bhatia | b5ce186 | 2017-07-31 15:48:19 -0400 | [diff] [blame] | 197 | policy site_policy < |
| 198 | ctx.user.is_admin |
| 199 | | (ctx.write_access -> exists Privilege: Privilege.object_type = "Site" & Privilege.object_id = obj.id & Privilege.accessor_id = ctx.user.id & Privilege.permission = "role:admin") > |
| 200 | |
| 201 | // If you can access (read or write) the site, you can also access its slices |
| 202 | // Otherwise, you need an explicit privilege on the Slice (admin for write access) |
| 203 | // or admin privilege on the associated site. |
| 204 | policy slice_policy < |
| 205 | ctx.user.is_admin |
| 206 | | (*site_policy(site) |
Zack Williams | 00e22d6 | 2019-03-01 22:32:13 -0700 | [diff] [blame] | 207 | & (ctx.user = obj.creator |
Sapan Bhatia | b5ce186 | 2017-07-31 15:48:19 -0400 | [diff] [blame] | 208 | | (exists Privilege: |
| 209 | Privilege.accessor_id = ctx.user.id |
| 210 | & Privilege.accessor_type = "User" |
| 211 | & Privilege.object_type = "Slice" |
| 212 | & Privilege.object_id = obj.id |
| 213 | & (ctx.write_access -> Privilege.permission = "role:admin")) |
| 214 | ) |
| 215 | | |
| 216 | (exists Privilege: |
| 217 | Privilege.accessor_id = ctx.user.id |
| 218 | & Privilege.accessor_type = "User" |
| 219 | & Privilege.object_type = "Slice" |
| 220 | & Privilege.object_id = obj.id) |
| 221 | | (exists Privilege: |
| 222 | Privilege.accessor_id = ctx.user.id |
| 223 | & Privilege.accessor_type = "User" |
| 224 | & Privilege.object_type = "Site" |
| 225 | & Privilege.object_id = obj.site.id |
| 226 | & Privilege.permission = "role:admin") |
| 227 | ) > |
| 228 | |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 229 | |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 230 | message Flavor (XOSBase) { |
Scott Baker | 83cc6f5 | 2019-03-11 11:10:24 -0700 | [diff] [blame] | 231 | required string name = 1 [max_length = 32, content_type = "stripped", blank = False, help_text = "name of this flavor, as displayed to users", db_index = False, unique = True]; |
| 232 | optional string description = 2 [db_index = False, max_length = 1024, content_type = "stripped"]; |
| 233 | required string flavor = 3 [max_length = 32, content_type = "stripped", help_text = "flavor string used to configure deployments"]; |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 234 | } |
| 235 | |
| 236 | |
| 237 | message Image (XOSBase) { |
Scott Baker | 83cc6f5 | 2019-03-11 11:10:24 -0700 | [diff] [blame] | 238 | required string name = 1 [db_index = False, max_length = 256, content_type = "stripped", blank = False, unique_with = "tag"]; |
| 239 | required string kind = 2 [default = "vm", choices = "(('vm', 'Virtual Machine'), ('container', 'Container'))", max_length = 30, blank = False, db_index = False]; |
| 240 | optional string disk_format = 3 [db_index = False, max_length = 256, content_type = "stripped", blank = True]; |
| 241 | optional string container_format = 4 [db_index = False, max_length = 256, content_type = "stripped", blank = True]; |
| 242 | optional string path = 5 [max_length = 256, content_type = "stripped", blank = True, help_text = "Path to image on local disk", db_index = False]; |
| 243 | optional string tag = 6 [max_length = 256, content_type = "stripped", blank = True, help_text = "For Docker Images, tag of image", db_index = False]; |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 244 | } |
| 245 | |
Sapan Bhatia | b5ce186 | 2017-07-31 15:48:19 -0400 | [diff] [blame] | 246 | policy network_policy < *slice_policy(owner) > |
| 247 | |
| 248 | message Network::network_policy (XOSBase) { |
Scott Baker | 83cc6f5 | 2019-03-11 11:10:24 -0700 | [diff] [blame] | 249 | required string name = 1 [db_index = False, max_length = 32, blank = False, unique = True]; |
| 250 | required manytoone template->NetworkTemplate:network = 2:1001 [db_index = True, blank = False]; |
| 251 | optional string subnet = 3 [max_length = 32]; |
| 252 | optional string start_ip = 4 [max_length = 32]; |
| 253 | optional string end_ip = 5 [max_length = 32]; |
| 254 | optional string ports = 6 [max_length = 1024]; |
| 255 | optional string labels = 7 [max_length = 1024]; |
| 256 | required manytoone owner->Slice:ownedNetworks = 8:1004 [help_text = "Slice that owns control of this Network", db_index = True, blank = False]; |
| 257 | required bool permit_all_slices = 10 [default = False, db_index = False]; |
| 258 | required bool autoconnect = 17 [help_text = "This network can be autoconnected to the slice that owns it", default = True, db_index = False]; |
| 259 | optional manytomany permitted_slices->Slice/Network_permitted_slices:availableNetworks = 18:1005 []; |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 260 | } |
| 261 | |
| 262 | |
| 263 | message NetworkParameter (XOSBase) { |
Scott Baker | 83cc6f5 | 2019-03-11 11:10:24 -0700 | [diff] [blame] | 264 | required manytoone parameter->NetworkParameterType:networkparameters = 1:1001 [help_text = "The type of the parameter", db_index = True, blank = False]; |
| 265 | required string value = 2 [help_text = "The value of this parameter", max_length = 1024, db_index = False, blank = False]; |
| 266 | required string content_type = 4 [max_length = 1024, content_type = "stripped", blank = False, help_text = "Content type id linked to this network parameter", db_index = False]; |
| 267 | required uint32 object_id = 5 [db_index = False, blank = False, help_text = "Object linked to this NetworkParameter"]; |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 268 | } |
| 269 | |
| 270 | |
| 271 | message NetworkParameterType (XOSBase) { |
Scott Baker | 83cc6f5 | 2019-03-11 11:10:24 -0700 | [diff] [blame] | 272 | required string name = 1 [help_text = "The name of this parameter", max_length = 128, db_index = True, blank = False, unique = True]; |
| 273 | optional string description = 2 [max_length = 1024]; |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 274 | } |
| 275 | |
Sapan Bhatia | 9227b4d | 2017-07-25 23:14:48 -0400 | [diff] [blame] | 276 | 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] | 277 | policy network_slice_policy < *slice_policy(slice) & *network_policy(network) > |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 278 | |
Sapan Bhatia | b5ce186 | 2017-07-31 15:48:19 -0400 | [diff] [blame] | 279 | message NetworkSlice::network_slice_policy (XOSBase) { |
Sapan Bhatia | 52b1ea5 | 2017-10-19 13:02:22 -0400 | [diff] [blame] | 280 | option validators = "network_slice_validator:Slice {obj.slice.name} is not allowed to connect to networks {obj.network}"; |
Scott Baker | 83cc6f5 | 2019-03-11 11:10:24 -0700 | [diff] [blame] | 281 | required manytoone network->Network:networkslices = 1:1002 [db_index = True, blank = False, unique_with = "slice", tosca_key=True]; |
| 282 | required manytoone slice->Slice:networkslices = 2:1006 [db_index = True, blank = False, tosca_key=True]; |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 283 | } |
Sapan Bhatia | 5ea307d | 2017-07-19 00:13:21 -0400 | [diff] [blame] | 284 | |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 285 | message NetworkTemplate (XOSBase) { |
Scott Baker | 83cc6f5 | 2019-03-11 11:10:24 -0700 | [diff] [blame] | 286 | required string name = 1 [db_index = False, max_length = 32, blank = False, unique = True]; |
| 287 | optional string description = 2 [max_length = 1024]; |
| 288 | required string visibility = 4 [default = "private", choices = "(('public', 'public'), ('private', 'private'))", max_length = 30, blank = False, db_index = False]; |
| 289 | required string translation = 5 [default = "none", choices = "(('none', 'none'), ('NAT', 'NAT'))", max_length = 30, blank = False, db_index = False]; |
| 290 | 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", db_index = False]; |
| 291 | optional string shared_network_name = 7 [db_index = False, max_length = 30, blank = True]; |
| 292 | optional string shared_network_id = 8 [help_text = "Quantum network", max_length = 256, db_index = False, blank = True]; |
| 293 | required string topology_kind = 9 [default = "bigswitch", choices = "(('bigswitch', 'BigSwitch'), ('physical', 'Physical'), ('custom', 'Custom'))", max_length = 30, blank = False, db_index = False]; |
| 294 | optional string controller_kind = 10 [blank = True, max_length = 30, db_index = False, choices = "((None, 'None'), ('onos', 'ONOS'), ('custom', 'Custom'))"]; |
| 295 | 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, db_index = False]; |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 296 | } |
Sapan Bhatia | b5ce186 | 2017-07-31 15:48:19 -0400 | [diff] [blame] | 297 | |
Scott Baker | 4839dec | 2019-02-27 16:50:37 -0800 | [diff] [blame] | 298 | message Node (XOSBase) { |
Scott Baker | 83cc6f5 | 2019-03-11 11:10:24 -0700 | [diff] [blame] | 299 | required string name = 1 [max_length = 200, content_type = "stripped", blank = False, help_text = "Name of the Node", db_index = False, unique = True]; |
| 300 | optional string bridgeId = 3 [max_length = 200, content_type = "stripped", blank = True, help_text = "Bridge Id", db_index = False]; |
| 301 | optional string dataPlaneIntf = 4 [max_length = 200, content_type = "stripped", blank = True, help_text = "Dataplane Interface", db_index = False]; |
| 302 | optional string dataPlaneIp = 5 [max_length = 200, content_type = "stripped", blank = True, help_text = "Dataplane Ip", db_index = False]; |
| 303 | optional string hostManagementIface = 6 [max_length = 200, content_type = "stripped", blank = True, help_text = "Host Management Interface", db_index = False]; |
| 304 | required manytoone site->Site:nodes = 7:1006 [db_index = True, blank = False, default=get_first_site]; |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 305 | } |
| 306 | message NodeLabel (XOSBase) { |
Scott Baker | be2a517 | 2019-04-10 18:02:50 -0700 | [diff] [blame] | 307 | option custom_python=True; |
Scott Baker | 83cc6f5 | 2019-03-11 11:10:24 -0700 | [diff] [blame] | 308 | required string name = 1 [max_length = 200, content_type = "stripped", blank = False, help_text = "label name", db_index = False, unique = True]; |
| 309 | optional manytomany node->Node/NodeLabel_node:nodelabels = 2:1002 []; |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 310 | } |
Sapan Bhatia | 5ea307d | 2017-07-19 00:13:21 -0400 | [diff] [blame] | 311 | |
Scott Baker | 4839dec | 2019-02-27 16:50:37 -0800 | [diff] [blame] | 312 | policy port_policy < *network_policy(network) > |
Sapan Bhatia | 5ea307d | 2017-07-19 00:13:21 -0400 | [diff] [blame] | 313 | |
Sapan Bhatia | b5ce186 | 2017-07-31 15:48:19 -0400 | [diff] [blame] | 314 | message Port::port_policy (XOSBase) { |
Scott Baker | 83cc6f5 | 2019-03-11 11:10:24 -0700 | [diff] [blame] | 315 | required manytoone network->Network:links = 1:1003 [db_index = True, blank = False, unique_with = "service_instance", help_text = "Network bound to this port"]; |
| 316 | optional string ip = 3 [max_length = 39, content_type = "ip", blank = True, help_text = "Instance ip address", db_index = False]; |
| 317 | optional string port_id = 4 [help_text = "Neutron port id", max_length = 256, db_index = False, blank = True]; |
| 318 | optional string mac = 5 [help_text = "MAC address associated with this port", max_length = 256, db_index = False, blank = True]; |
| 319 | required bool xos_created = 6 [default = False]; |
| 320 | optional manytoone service_instance->ServiceInstance:ports = 7:1001 [db_index = True, blank = True, help_text = "ServiceInstance bound to this port"]; |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 321 | } |
| 322 | |
Scott Baker | 6b260ea | 2018-04-18 07:12:22 -0700 | [diff] [blame] | 323 | message Principal (XOSBase) { |
Scott Baker | 83cc6f5 | 2019-03-11 11:10:24 -0700 | [diff] [blame] | 324 | required string name = 1 [max_length = 128, db_index = True, blank = False, help_text = "The name of this principal"]; |
| 325 | required manytoone trust_domain->TrustDomain:principals = 2:1001 [db_index = True, blank = False, help_text = "Trust domain this principal resides in"]; |
Scott Baker | 6b260ea | 2018-04-18 07:12:22 -0700 | [diff] [blame] | 326 | } |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 327 | |
| 328 | message Role (XOSBase) { |
Scott Baker | 83cc6f5 | 2019-03-11 11:10:24 -0700 | [diff] [blame] | 329 | required string role_type = 1 [db_index = False, max_length = 80, content_type = "stripped", blank = False]; |
| 330 | optional string role = 2 [db_index = False, max_length = 80, content_type = "stripped", blank = True]; |
| 331 | optional string description = 3 [max_length = 120, content_type = "stripped"]; |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 332 | } |
| 333 | |
Sapan Bhatia | b5ce186 | 2017-07-31 15:48:19 -0400 | [diff] [blame] | 334 | 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] | 335 | |
| 336 | message Service (XOSBase,AttributeMixin) { |
Scott Baker | acfbc89 | 2019-01-24 12:23:58 -0800 | [diff] [blame] | 337 | option description = "A service managed by XOS"; |
Scott Baker | be2a517 | 2019-04-10 18:02:50 -0700 | [diff] [blame] | 338 | option custom_python=True; |
Scott Baker | acfbc89 | 2019-01-24 12:23:58 -0800 | [diff] [blame] | 339 | |
| 340 | optional string description = 1 [ |
| 341 | help_text = "Description of Service", |
Scott Baker | 08d1040 | 2019-04-08 16:19:59 -0700 | [diff] [blame] | 342 | text = True]; |
Scott Baker | acfbc89 | 2019-01-24 12:23:58 -0800 | [diff] [blame] | 343 | required bool enabled = 2 [ |
| 344 | help_text = "Whether or not service is Enabled", |
Scott Baker | acfbc89 | 2019-01-24 12:23:58 -0800 | [diff] [blame] | 345 | default = True, |
Scott Baker | acfbc89 | 2019-01-24 12:23:58 -0800 | [diff] [blame] | 346 | gui_hidden = True]; |
| 347 | required string kind = 3 [ |
| 348 | help_text = "Kind of service", |
Scott Baker | acfbc89 | 2019-01-24 12:23:58 -0800 | [diff] [blame] | 349 | choices="(('generic', 'Generic'), ('data', 'Data Plane'), ('control', 'Control Plane'), ('oss', 'OSS'))", |
| 350 | content_type = "stripped", |
Scott Baker | acfbc89 | 2019-01-24 12:23:58 -0800 | [diff] [blame] | 351 | default = "generic", |
Scott Baker | 83cc6f5 | 2019-03-11 11:10:24 -0700 | [diff] [blame] | 352 | max_length = 30]; |
Scott Baker | acfbc89 | 2019-01-24 12:23:58 -0800 | [diff] [blame] | 353 | required string name = 4 [ |
| 354 | help_text = "Unique name of service", |
Scott Baker | acfbc89 | 2019-01-24 12:23:58 -0800 | [diff] [blame] | 355 | content_type = "stripped", |
Scott Baker | acfbc89 | 2019-01-24 12:23:58 -0800 | [diff] [blame] | 356 | max_length = 30, |
Scott Baker | acfbc89 | 2019-01-24 12:23:58 -0800 | [diff] [blame] | 357 | unique = True]; |
| 358 | optional string versionNumber = 5 [ |
| 359 | help_text = "Version of Service Definition", |
Scott Baker | acfbc89 | 2019-01-24 12:23:58 -0800 | [diff] [blame] | 360 | content_type = "stripped", |
Scott Baker | 83cc6f5 | 2019-03-11 11:10:24 -0700 | [diff] [blame] | 361 | max_length = 30]; |
Scott Baker | acfbc89 | 2019-01-24 12:23:58 -0800 | [diff] [blame] | 362 | required bool published = 6 [ |
| 363 | help_text = "True if this service should be published in XOS", |
Scott Baker | acfbc89 | 2019-01-24 12:23:58 -0800 | [diff] [blame] | 364 | default = True, |
Scott Baker | c80304a | 2019-03-07 11:07:29 -0800 | [diff] [blame] | 365 | gui_hidden = True]; // deprecated? |
Scott Baker | acfbc89 | 2019-01-24 12:23:58 -0800 | [diff] [blame] | 366 | optional string icon_url = 8 [ |
Scott Baker | acfbc89 | 2019-01-24 12:23:58 -0800 | [diff] [blame] | 367 | content_type = "stripped", |
Scott Baker | acfbc89 | 2019-01-24 12:23:58 -0800 | [diff] [blame] | 368 | gui_hidden = True, |
Scott Baker | 83cc6f5 | 2019-03-11 11:10:24 -0700 | [diff] [blame] | 369 | max_length = 1024]; // deprecated? |
Scott Baker | acfbc89 | 2019-01-24 12:23:58 -0800 | [diff] [blame] | 370 | optional string public_key = 9 [ |
| 371 | help_text = "Public key string", |
Scott Baker | acfbc89 | 2019-01-24 12:23:58 -0800 | [diff] [blame] | 372 | gui_hidden = True, |
Scott Baker | 08d1040 | 2019-04-08 16:19:59 -0700 | [diff] [blame] | 373 | text = True]; // likely only used by VM-based services. deprecated? |
Scott Baker | acfbc89 | 2019-01-24 12:23:58 -0800 | [diff] [blame] | 374 | optional string private_key_fn = 10 [ |
| 375 | help_text = "Filename of private key file, located within core container", |
Scott Baker | acfbc89 | 2019-01-24 12:23:58 -0800 | [diff] [blame] | 376 | content_type = "stripped", |
Scott Baker | acfbc89 | 2019-01-24 12:23:58 -0800 | [diff] [blame] | 377 | gui_hidden = True, |
Scott Baker | 83cc6f5 | 2019-03-11 11:10:24 -0700 | [diff] [blame] | 378 | max_length = 4096]; // likely only used by VM-based services. deprecated? |
Scott Baker | acfbc89 | 2019-01-24 12:23:58 -0800 | [diff] [blame] | 379 | optional string service_specific_id = 11 [ |
| 380 | help_text = "Service-specific identifier, opaque to XOS core", |
Scott Baker | acfbc89 | 2019-01-24 12:23:58 -0800 | [diff] [blame] | 381 | content_type = "stripped", |
Scott Baker | 83cc6f5 | 2019-03-11 11:10:24 -0700 | [diff] [blame] | 382 | max_length = 30]; |
Scott Baker | acfbc89 | 2019-01-24 12:23:58 -0800 | [diff] [blame] | 383 | optional string service_specific_attribute = 12 [ |
| 384 | help_text = "Service-specific string attribute, opaque to XOS core", |
Scott Baker | acfbc89 | 2019-01-24 12:23:58 -0800 | [diff] [blame] | 385 | gui_hidden = True, |
Scott Baker | 08d1040 | 2019-04-08 16:19:59 -0700 | [diff] [blame] | 386 | text = True]; |
Himanshu Bhandari | 51d71c1 | 2020-03-17 07:47:59 +0000 | [diff] [blame] | 387 | optional manytoone site->Site:service = 13:1012 [ |
| 388 | help_text = "The Site this Service belongs to", |
| 389 | db_index = True]; |
| 390 | |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 391 | } |
| 392 | |
Scott Baker | 6b260ea | 2018-04-18 07:12:22 -0700 | [diff] [blame] | 393 | message ServicePort (XOSBase) { |
Scott Baker | acfbc89 | 2019-01-24 12:23:58 -0800 | [diff] [blame] | 394 | option description = "Exposes a port in a service outside of the pod, implementation depends on Compute Service"; |
| 395 | |
| 396 | required string name = 1 [ |
| 397 | help_text = "Unique service port name", |
Scott Baker | 83cc6f5 | 2019-03-11 11:10:24 -0700 | [diff] [blame] | 398 | max_length = 128]; |
Scott Baker | acfbc89 | 2019-01-24 12:23:58 -0800 | [diff] [blame] | 399 | required int32 external_port = 2 [ |
Scott Baker | 83cc6f5 | 2019-03-11 11:10:24 -0700 | [diff] [blame] | 400 | help_text = "external port number"]; |
Scott Baker | acfbc89 | 2019-01-24 12:23:58 -0800 | [diff] [blame] | 401 | required int32 internal_port = 3 [ |
Scott Baker | 83cc6f5 | 2019-03-11 11:10:24 -0700 | [diff] [blame] | 402 | help_text = "internal port number"]; |
Scott Baker | acfbc89 | 2019-01-24 12:23:58 -0800 | [diff] [blame] | 403 | required string protocol = 4 [ |
| 404 | help_text = "Protocol", |
Scott Baker | acfbc89 | 2019-01-24 12:23:58 -0800 | [diff] [blame] | 405 | default="TCP", |
Scott Baker | 83cc6f5 | 2019-03-11 11:10:24 -0700 | [diff] [blame] | 406 | max_length = 32]; |
Scott Baker | acfbc89 | 2019-01-24 12:23:58 -0800 | [diff] [blame] | 407 | required manytoone service->Service:serviceports = 5:1002 [ |
| 408 | help_text = "The Service this ServicePort is associated with", |
Scott Baker | 83cc6f5 | 2019-03-11 11:10:24 -0700 | [diff] [blame] | 409 | db_index = True]; |
Scott Baker | 6b260ea | 2018-04-18 07:12:22 -0700 | [diff] [blame] | 410 | } |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 411 | |
| 412 | message ServiceAttribute (XOSBase) { |
Scott Baker | acfbc89 | 2019-01-24 12:23:58 -0800 | [diff] [blame] | 413 | option description = "An (key, value) attribute associated with a Service"; |
| 414 | |
| 415 | required string name = 1 [ |
| 416 | help_text = "Attribute Name", |
Scott Baker | acfbc89 | 2019-01-24 12:23:58 -0800 | [diff] [blame] | 417 | max_length = 128, |
Scott Baker | acfbc89 | 2019-01-24 12:23:58 -0800 | [diff] [blame] | 418 | unique_with="service"]; |
| 419 | required string value = 2 [ |
| 420 | help_text = "Attribute Value", |
Scott Baker | 08d1040 | 2019-04-08 16:19:59 -0700 | [diff] [blame] | 421 | text = True]; |
Scott Baker | acfbc89 | 2019-01-24 12:23:58 -0800 | [diff] [blame] | 422 | required manytoone service->Service:serviceattributes = 3:1003 [ |
| 423 | help_text = "The Service this attribute is associated with", |
Scott Baker | 83cc6f5 | 2019-03-11 11:10:24 -0700 | [diff] [blame] | 424 | db_index = True]; |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 425 | } |
| 426 | |
| 427 | |
Scott Baker | 071da96 | 2017-07-13 10:43:41 -0700 | [diff] [blame] | 428 | message ServiceDependency (XOSBase) { |
Scott Baker | acfbc89 | 2019-01-24 12:23:58 -0800 | [diff] [blame] | 429 | option description = "A dependency relation between a provider and a subscriber service"; |
| 430 | |
| 431 | required manytoone provider_service->Service:provided_dependencies = 1:1004 [ |
| 432 | help_text = "The service that provides this dependency", |
Scott Baker | acfbc89 | 2019-01-24 12:23:58 -0800 | [diff] [blame] | 433 | db_index = True, |
Scott Baker | acfbc89 | 2019-01-24 12:23:58 -0800 | [diff] [blame] | 434 | tosca_key=True]; |
| 435 | required manytoone subscriber_service->Service:subscribed_dependencies = 2:1005 [ |
| 436 | help_text = "The services that subscribes to this dependency", |
Scott Baker | acfbc89 | 2019-01-24 12:23:58 -0800 | [diff] [blame] | 437 | db_index=True, |
Scott Baker | acfbc89 | 2019-01-24 12:23:58 -0800 | [diff] [blame] | 438 | tosca_key=True]; |
| 439 | required string connect_method = 3 [ |
| 440 | help_text = "method to connect the two services", |
| 441 | choices = "(('none', 'None'), ('private', 'Private'), ('public', 'Public'))", |
| 442 | default="none", |
| 443 | max_length = 30]; |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 444 | } |
| 445 | |
| 446 | |
Sapan Bhatia | b5ce186 | 2017-07-31 15:48:19 -0400 | [diff] [blame] | 447 | message Site::site_policy (XOSBase) { |
Scott Baker | 83cc6f5 | 2019-03-11 11:10:24 -0700 | [diff] [blame] | 448 | required string name = 1 [max_length = 200, content_type = "stripped", blank = False, help_text = "Name for this Site", db_index = False, unique = True]; |
| 449 | optional string site_url = 2 [max_length = 512, content_type = "url", blank = True, help_text = "Site's Home URL Page", db_index = False]; |
| 450 | required bool enabled = 3 [help_text = "Status for this Site", default = True]; |
| 451 | required bool hosts_nodes = 4 [help_text = "Indicates whether or not the site host nodes", default = True]; |
| 452 | required bool hosts_users = 5 [help_text = "Indicates whether or not the site manages user accounts", default = True]; |
| 453 | optional float longitude = 6 [db_index = False, blank = True]; |
| 454 | optional float latitude = 7 [db_index = False, blank = True]; |
| 455 | required string login_base = 8 [max_length = 50, content_type = "stripped", blank = False, help_text = "Prefix for Slices associated with this Site", db_index = False]; |
| 456 | required bool is_public = 9 [help_text = "Indicates the visibility of this site to other members", default = True]; |
| 457 | required string abbreviated_name = 10 [db_index = False, max_length = 80, content_type = "stripped", blank = False]; |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 458 | } |
| 459 | |
Scott Baker | 6b260ea | 2018-04-18 07:12:22 -0700 | [diff] [blame] | 460 | policy slice_name_no_spaces < {{ ' ' not in obj.name }} > |
Sapan Bhatia | 5ea307d | 2017-07-19 00:13:21 -0400 | [diff] [blame] | 461 | policy slice_has_creator < obj.creator > |
| 462 | |
Sapan Bhatia | b5ce186 | 2017-07-31 15:48:19 -0400 | [diff] [blame] | 463 | message Slice::slice_policy (XOSBase) { |
Scott Baker | 6b260ea | 2018-04-18 07:12:22 -0700 | [diff] [blame] | 464 | 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] | 465 | option plural = "Slices"; |
Scott Baker | be2a517 | 2019-04-10 18:02:50 -0700 | [diff] [blame] | 466 | option custom_python=True; |
Sapan Bhatia | 5ea307d | 2017-07-19 00:13:21 -0400 | [diff] [blame] | 467 | |
Scott Baker | 83cc6f5 | 2019-03-11 11:10:24 -0700 | [diff] [blame] | 468 | required string name = 1 [max_length = 80, content_type = "stripped", blank = False, help_text = "The Name of the Slice", db_index = False, unique = True]; |
| 469 | required bool enabled = 2 [help_text = "Status for this Slice", default = True]; |
Scott Baker | 08d1040 | 2019-04-08 16:19:59 -0700 | [diff] [blame] | 470 | optional string description = 4 [help_text = "High level description of the slice and expected activities", text = True]; |
Scott Baker | 83cc6f5 | 2019-03-11 11:10:24 -0700 | [diff] [blame] | 471 | required manytoone site->Site:slices = 6:1005 [help_text = "The Site this Slice belongs to", db_index = True, blank = False]; |
| 472 | required int32 max_instances = 7 [default = 10, db_index = False, blank = False]; |
| 473 | optional manytoone service->Service:slices = 8:1006 [db_index = True, blank = True]; |
| 474 | optional string network = 9 [blank = True, max_length = 256, db_index = False, choices = "((None, 'Default'), ('host', 'Host'), ('bridged', 'Bridged'), ('noauto', 'No Automatic Networks'))"]; |
| 475 | optional string exposed_ports = 10 [db_index = False, max_length = 256, blank = True]; |
Zack Williams | 00e22d6 | 2019-03-01 22:32:13 -0700 | [diff] [blame] | 476 | optional manytoone creator->User:slices = 12:1004 [db_index = True]; |
Scott Baker | 83cc6f5 | 2019-03-11 11:10:24 -0700 | [diff] [blame] | 477 | optional manytoone default_flavor->Flavor:slices = 13:1002 [db_index = True, blank = True]; |
| 478 | optional manytoone default_image->Image:slices = 14:1005 [db_index = True, blank = True]; |
| 479 | optional manytoone default_node->Node:slices = 15:1003 [db_index = True, blank = True]; |
| 480 | optional string mount_data_sets = 16 [default = "GenBank", max_length = 256, content_type = "stripped", blank = True, db_index = False]; |
| 481 | required string default_isolation = 17 [default = "vm", choices = "(('vm', 'Virtual Machine'), ('container', 'Container'), ('container_vm', 'Container In VM'))", max_length = 30, blank = False, db_index = False]; |
Zack Williams | 00e22d6 | 2019-03-01 22:32:13 -0700 | [diff] [blame] | 482 | optional manytoone trust_domain->TrustDomain:slices = 18:1002 [db_index = True, help_text = "Trust domain this slice resides in"]; |
| 483 | optional manytoone principal->Principal:slices = 19:1001 [db_index = True, help_text = "Principal this slice may use to interact with other components"]; |
Scott Baker | 83cc6f5 | 2019-03-11 11:10:24 -0700 | [diff] [blame] | 484 | optional int32 controller_replica_count = 20 [default = 0, help_text = "Replica count, controller-dependent"]; |
| 485 | optional string controller_kind = 21 [max_length = 256, content_type = "stripped", blank = True, help_text = "Type of controller, vim-dependent", db_index = False]; |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 486 | } |
| 487 | |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 488 | |
Sapan Bhatia | b5ce186 | 2017-07-31 15:48:19 -0400 | [diff] [blame] | 489 | policy tag_policy < ctx.user.is_admin > |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 490 | |
Sapan Bhatia | b5ce186 | 2017-07-31 15:48:19 -0400 | [diff] [blame] | 491 | message Tag::tag_policy (XOSBase) { |
Scott Baker | 83cc6f5 | 2019-03-11 11:10:24 -0700 | [diff] [blame] | 492 | required manytoone service->Service:tags = 1:1007 [help_text = "The Service this Tag is associated with", db_index = True, blank = False]; |
| 493 | required string name = 2 [help_text = "The name of this tag", max_length = 128, db_index = True, blank = False]; |
| 494 | required string value = 3 [max_length = 1024, content_type = "stripped", blank = False, help_text = "The value of this tag", db_index = False]; |
| 495 | required string content_type = 4 [max_length = 1024, content_type = "stripped", blank = False, help_text = "Content type id linked to this tag", db_index = False]; |
| 496 | required uint32 object_id = 5 [db_index = False, blank = False, help_text = "Object linked to this tag"]; |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 497 | } |
| 498 | |
Scott Baker | d6e533f | 2017-07-17 13:37:29 -0700 | [diff] [blame] | 499 | message InterfaceType (XOSBase) { |
Scott Baker | acfbc89 | 2019-01-24 12:23:58 -0800 | [diff] [blame] | 500 | option description = "Defines an InterfaceType that may be used by Services to connect ServiceInstances"; |
| 501 | |
| 502 | required string name = 1 [ |
| 503 | help_text = "Name of this interface type", |
Scott Baker | acfbc89 | 2019-01-24 12:23:58 -0800 | [diff] [blame] | 504 | content_type = "stripped", |
Scott Baker | acfbc89 | 2019-01-24 12:23:58 -0800 | [diff] [blame] | 505 | max_length = 200, |
Scott Baker | acfbc89 | 2019-01-24 12:23:58 -0800 | [diff] [blame] | 506 | unique_with = "direction"]; |
| 507 | required string direction = 2 [ |
| 508 | help_text = "Direction, either in or out", |
Scott Baker | acfbc89 | 2019-01-24 12:23:58 -0800 | [diff] [blame] | 509 | choices = "(('in', 'In'), ('out', 'Out'))", |
| 510 | content_type = "stripped", |
Scott Baker | 83cc6f5 | 2019-03-11 11:10:24 -0700 | [diff] [blame] | 511 | max_length = 30]; |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 512 | } |
| 513 | |
Scott Baker | d6e533f | 2017-07-17 13:37:29 -0700 | [diff] [blame] | 514 | message ServiceInterface (XOSBase) { |
Scott Baker | acfbc89 | 2019-01-24 12:23:58 -0800 | [diff] [blame] | 515 | option description = "Describes the type of connection attached to a ServiceInstanceLink"; |
| 516 | |
| 517 | required manytoone service->Service:service_interfaces = 1:1008 [ |
| 518 | help_text = "Service that this ServiceInterface is associated with", |
Scott Baker | acfbc89 | 2019-01-24 12:23:58 -0800 | [diff] [blame] | 519 | db_index = True, |
Scott Baker | acfbc89 | 2019-01-24 12:23:58 -0800 | [diff] [blame] | 520 | tosca_key=True]; |
| 521 | required manytoone interface_type->InterfaceType:service_interfaces = 2:1001 [ |
| 522 | help_text = "Interface type that describes this interface", |
Scott Baker | acfbc89 | 2019-01-24 12:23:58 -0800 | [diff] [blame] | 523 | db_index = True, |
Scott Baker | acfbc89 | 2019-01-24 12:23:58 -0800 | [diff] [blame] | 524 | tosca_key=True]; |
Scott Baker | d6e533f | 2017-07-17 13:37:29 -0700 | [diff] [blame] | 525 | } |
| 526 | |
| 527 | message ServiceInstance (XOSBase, AttributeMixin) { |
Scott Baker | acfbc89 | 2019-01-24 12:23:58 -0800 | [diff] [blame] | 528 | option description = "A portion of a service broken up into a tenant-sized piece"; |
Scott Baker | be2a517 | 2019-04-10 18:02:50 -0700 | [diff] [blame] | 529 | option custom_python=True; |
Scott Baker | acfbc89 | 2019-01-24 12:23:58 -0800 | [diff] [blame] | 530 | |
| 531 | optional string name = 1 [ |
| 532 | help_text = "Name of ServiceInstance", |
Scott Baker | acfbc89 | 2019-01-24 12:23:58 -0800 | [diff] [blame] | 533 | content_type = "stripped", |
Scott Baker | 83cc6f5 | 2019-03-11 11:10:24 -0700 | [diff] [blame] | 534 | max_length = 200]; |
Scott Baker | acfbc89 | 2019-01-24 12:23:58 -0800 | [diff] [blame] | 535 | required manytoone owner->Service:service_instances = 2:1009 [ |
| 536 | help_text = "The Service that owns this ServiceInstance", |
Scott Baker | 83cc6f5 | 2019-03-11 11:10:24 -0700 | [diff] [blame] | 537 | db_index = True]; |
Scott Baker | acfbc89 | 2019-01-24 12:23:58 -0800 | [diff] [blame] | 538 | optional string service_specific_id = 3 [ |
| 539 | help_text = "Service-specific identifier, opaque to the XOS core", |
Scott Baker | acfbc89 | 2019-01-24 12:23:58 -0800 | [diff] [blame] | 540 | content_type = "stripped", |
Scott Baker | acfbc89 | 2019-01-24 12:23:58 -0800 | [diff] [blame] | 541 | gui_hidden = True, |
Scott Baker | 83cc6f5 | 2019-03-11 11:10:24 -0700 | [diff] [blame] | 542 | max_length = 30]; |
Scott Baker | acfbc89 | 2019-01-24 12:23:58 -0800 | [diff] [blame] | 543 | optional string service_specific_attribute = 10 [ |
| 544 | help_text = "Service-specific text attribute, opaque to the XOS core", |
Scott Baker | acfbc89 | 2019-01-24 12:23:58 -0800 | [diff] [blame] | 545 | gui_hidden = True, |
Scott Baker | 08d1040 | 2019-04-08 16:19:59 -0700 | [diff] [blame] | 546 | text = True]; |
Scott Baker | acfbc89 | 2019-01-24 12:23:58 -0800 | [diff] [blame] | 547 | optional uint32 link_deleted_count = 11 [ |
| 548 | help_text = "Incremented each time a provided_link is deleted from this ServiceInstance", |
| 549 | default = 0, |
| 550 | gui_hidden = True]; |
| 551 | optional manytoone master_serviceinstance->ServiceInstance:child_serviceinstances = 12:1002 [ |
| 552 | help_text = "The master service instance that set this service instance up", |
Scott Baker | acfbc89 | 2019-01-24 12:23:58 -0800 | [diff] [blame] | 553 | gui_hidden = True]; |
Scott Baker | d6e533f | 2017-07-17 13:37:29 -0700 | [diff] [blame] | 554 | } |
| 555 | |
| 556 | message ServiceInstanceLink (XOSBase) { |
Scott Baker | acfbc89 | 2019-01-24 12:23:58 -0800 | [diff] [blame] | 557 | option description = "A link in a chain between two ServiceInstances"; |
Scott Baker | be2a517 | 2019-04-10 18:02:50 -0700 | [diff] [blame] | 558 | option custom_python=True; |
Scott Baker | acfbc89 | 2019-01-24 12:23:58 -0800 | [diff] [blame] | 559 | |
| 560 | required manytoone provider_service_instance->ServiceInstance:provided_links = 1:1003 [ |
| 561 | help_text = "Eastbound serviceinstance of this link", |
| 562 | db_index = True, |
Scott Baker | acfbc89 | 2019-01-24 12:23:58 -0800 | [diff] [blame] | 563 | tosca_key=True]; |
| 564 | optional manytoone provider_service_interface->ServiceInterface:provided_links = 2:1004 [ |
| 565 | help_text = "Interface descrption of the eastbound linkage point", |
Scott Baker | 83cc6f5 | 2019-03-11 11:10:24 -0700 | [diff] [blame] | 566 | db_index = True]; |
Scott Baker | acfbc89 | 2019-01-24 12:23:58 -0800 | [diff] [blame] | 567 | optional manytoone subscriber_service_instance->ServiceInstance:subscribed_links = 3:1005 [ |
| 568 | help_text = "Westbound ServiceInstance of this link", |
Scott Baker | 83cc6f5 | 2019-03-11 11:10:24 -0700 | [diff] [blame] | 569 | db_index = True]; |
Scott Baker | acfbc89 | 2019-01-24 12:23:58 -0800 | [diff] [blame] | 570 | optional manytoone subscriber_service->Service:subscribed_links = 4:1010 [ |
| 571 | help_text = "Interface description of the westbound linkage point", |
| 572 | db_index = True, |
Scott Baker | acfbc89 | 2019-01-24 12:23:58 -0800 | [diff] [blame] | 573 | tosca_key_one_of = subscriber_service_instance]; |
| 574 | optional manytoone subscriber_network->Network:subscribed_links = 5:1004 [ |
| 575 | help_text = "Alternative to subscriber_service_instance, if a Network model is the subscriber instead of a ServiceInstance", |
| 576 | db_index = True, |
Scott Baker | acfbc89 | 2019-01-24 12:23:58 -0800 | [diff] [blame] | 577 | tosca_key_one_of=subscriber_service_instance]; |
Scott Baker | d6e533f | 2017-07-17 13:37:29 -0700 | [diff] [blame] | 578 | } |
| 579 | |
| 580 | message ServiceInstanceAttribute (XOSBase) { |
Scott Baker | acfbc89 | 2019-01-24 12:23:58 -0800 | [diff] [blame] | 581 | option description = "A (key, value) attribute associated with a ServiceInstance"; |
| 582 | |
| 583 | required string name = 1 [ |
| 584 | help_text = "Attribute Name", |
Scott Baker | acfbc89 | 2019-01-24 12:23:58 -0800 | [diff] [blame] | 585 | max_length = 128, |
Scott Baker | acfbc89 | 2019-01-24 12:23:58 -0800 | [diff] [blame] | 586 | unique_with = "service_instance"]; |
| 587 | required string value = 2 [ |
Scott Baker | 08d1040 | 2019-04-08 16:19:59 -0700 | [diff] [blame] | 588 | help_text = "Attribute Value", |
| 589 | text = True]; |
Scott Baker | acfbc89 | 2019-01-24 12:23:58 -0800 | [diff] [blame] | 590 | required manytoone service_instance->ServiceInstance:service_instance_attributes = 3:1006 [ |
| 591 | help_text = "The Tenant this attribute is associated with", |
Scott Baker | 83cc6f5 | 2019-03-11 11:10:24 -0700 | [diff] [blame] | 592 | db_index = True]; |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 593 | } |
| 594 | |
Scott Baker | 6b260ea | 2018-04-18 07:12:22 -0700 | [diff] [blame] | 595 | message TrustDomain (XOSBase) { |
Scott Baker | 08d1040 | 2019-04-08 16:19:59 -0700 | [diff] [blame] | 596 | required string name = 1 [max_length = 256, db_index = True, blank = False, help_text = "Name of this trust domain"]; |
Scott Baker | 83cc6f5 | 2019-03-11 11:10:24 -0700 | [diff] [blame] | 597 | required manytoone owner->Service:owned_trust_domains = 2:1011 [db_index = True, blank = False, help_text = "Service partioned by this trust domain"]; |
Scott Baker | 6b260ea | 2018-04-18 07:12:22 -0700 | [diff] [blame] | 598 | } |
| 599 | |
Scott Baker | a33ccb0 | 2018-01-26 13:03:28 -0800 | [diff] [blame] | 600 | message XOSCore (XOSBase) { |
| 601 | option singular="XOSCore"; |
| 602 | option plural="XOSCores"; |
Scott Baker | 83cc6f5 | 2019-03-11 11:10:24 -0700 | [diff] [blame] | 603 | required string name = 1 [default = "XOS", max_length = 200, content_type = "stripped", blank = False, help_text = "Name of XOS", db_index = False, unique = True]; |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 604 | } |
| 605 | |
Matteo Scandolo | ee367fd | 2017-11-22 14:55:09 -0800 | [diff] [blame] | 606 | message XOSGuiExtension::admin_policy (XOSBase) { |
Matteo Scandolo | e425f9d | 2017-08-15 15:56:19 -0700 | [diff] [blame] | 607 | option verbose_name="XOS GUI Extension"; |
| 608 | 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] | 609 | // option no_sync = True; |
| 610 | // option no_policy = True; |
Matteo Scandolo | 39b4a27 | 2017-11-17 11:09:21 -0800 | [diff] [blame] | 611 | |
Scott Baker | 83cc6f5 | 2019-03-11 11:10:24 -0700 | [diff] [blame] | 612 | required string name = 1 [max_length = 200, content_type = "stripped", blank = False, help_text = "Name of the GUI Extensions", db_index = False, unique = True]; |
| 613 | required string files = 2 [max_length = 1024, content_type = "stripped", blank = False, help_text = "List of comma separated file composing the view", db_index = False]; |
Sapan Bhatia | 170ae27 | 2017-05-30 19:01:09 +0200 | [diff] [blame] | 614 | } |
Sapan Bhatia | 5ea307d | 2017-07-19 00:13:21 -0400 | [diff] [blame] | 615 | |
Matteo Scandolo | e2afe4b | 2017-11-15 08:10:55 -0800 | [diff] [blame] | 616 | message ServiceGraphConstraint (XOSBase) { |
| 617 | option verbose_name="Graph Constraint"; |
| 618 | option description="Define the position of the nodes in the service graph"; |
Matteo Scandolo | 11a2c5e | 2019-03-13 10:40:17 -0700 | [diff] [blame] | 619 | required string constraints = 1 [max_length = 1024, content_type = "stripped", help_text = "A composite array defining service positions in the graph, eg [volt, vsg, [address_manager, vrouter]]", tosca_key=True]; |
| 620 | optional int32 priority = 2 [help_text = "The priority of the constraint, the one with highest priority will be used", default=0]; |
Matteo Scandolo | e2afe4b | 2017-11-15 08:10:55 -0800 | [diff] [blame] | 621 | } |
| 622 | |