blob: c6cfea7928d3b413c8f3287f7783e3fc129f23fd [file] [log] [blame]
Matteo Scandolod2044a42017-08-07 16:08:28 -07001# Copyright 2017-present Open Networking Foundation
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15
Matteo Scandolo67654fa2017-06-09 09:33:17 -070016import unittest
Scott Baker1f7791d2018-10-04 13:21:20 -070017from xosgenx.generator import XOSProcessor, XOSProcessorArgs
18from helpers import XProtoTestHelpers
Sapan Bhatia943dad52017-05-19 18:41:01 +020019
Zack Williams045b63d2019-01-22 16:30:57 -070020
Matteo Scandolo67654fa2017-06-09 09:33:17 -070021class XProtoGraphTests(unittest.TestCase):
Sapan Bhatia943dad52017-05-19 18:41:01 +020022 def test_cross_model(self):
Matteo Scandolo67654fa2017-06-09 09:33:17 -070023 target = XProtoTestHelpers.write_tmp_target(
Zack Williams045b63d2019-01-22 16:30:57 -070024 """
Sapan Bhatia943dad52017-05-19 18:41:01 +020025 {% for m in proto.messages %}
26 {{ m.name }} {
27 {%- for l in m.links %}
Sapan Bhatia3cfdf632017-06-08 05:14:03 +020028 {%- if proto.message_table[l.peer.fqn] -%}
29 {%- set model = proto.message_table[l.peer.fqn] %}
Sapan Bhatia943dad52017-05-19 18:41:01 +020030 {% for f in model.fields %}
31 {{ f.type }} {{ f.name }};
32 {% endfor %}
33 {%- endif -%}
34 {% endfor %}
35 }
36 {% endfor %}
Sapan Bhatia943dad52017-05-19 18:41:01 +020037"""
Zack Williams045b63d2019-01-22 16:30:57 -070038 )
39
40 proto = """
Sapan Bhatia943dad52017-05-19 18:41:01 +020041message Port (PlCoreBase,ParameterMixin){
42 required manytoone network->Network:links = 1 [db_index = True, null = False, blank = False];
43 optional manytoone instance->Instance:ports = 2 [db_index = True, null = True, blank = True];
44 optional string ip = 3 [max_length = 39, content_type = "ip", blank = True, help_text = "Instance ip address", null = True, db_index = False];
45 optional string port_id = 4 [help_text = "Neutron port id", max_length = 256, null = True, db_index = False, blank = True];
46 optional string mac = 5 [help_text = "MAC address associated with this port", max_length = 256, null = True, db_index = False, blank = True];
47 required bool xos_created = 6 [default = False, null = False, db_index = False, blank = True];
48}
49
50message Instance (PlCoreBase){
51 optional string instance_id = 1 [max_length = 200, content_type = "stripped", blank = True, help_text = "Nova instance id", null = True, db_index = False];
52 optional string instance_uuid = 2 [max_length = 200, content_type = "stripped", blank = True, help_text = "Nova instance uuid", null = True, db_index = False];
53 required string name = 3 [max_length = 200, content_type = "stripped", blank = False, help_text = "Instance name", null = False, db_index = False];
54 optional string instance_name = 4 [max_length = 200, content_type = "stripped", blank = True, help_text = "OpenStack generated name", null = True, db_index = False];
55 optional string ip = 5 [max_length = 39, content_type = "ip", blank = True, help_text = "Instance ip address", null = True, db_index = False];
56 required manytoone image->Image:instances = 6 [db_index = True, null = False, blank = False];
57 optional manytoone creator->User:instances = 7 [db_index = True, null = True, blank = True];
58 required manytoone slice->Slice:instances = 8 [db_index = True, null = False, blank = False];
59 required manytoone deployment->Deployment:instance_deployment = 9 [db_index = True, null = False, blank = False];
60 required manytoone node->Node:instances = 10 [db_index = True, null = False, blank = False];
61 required int32 numberCores = 11 [help_text = "Number of cores for instance", default = 0, null = False, db_index = False, blank = False];
62 required manytoone flavor->Flavor:instance = 12 [help_text = "Flavor of this instance", default = "get_default_flavor()", null = False, db_index = True, blank = False];
63 optional string userData = 13 [help_text = "user_data passed to instance during creation", null = True, db_index = False, blank = True];
64 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];
65 optional string volumes = 15 [help_text = "Comma-separated list of directories to expose to parent context", null = True, db_index = False, blank = True];
66 optional manytoone parent->Instance:instance = 16 [help_text = "Parent Instance for containers nested inside of VMs", null = True, db_index = True, blank = True];
67 required manytomany tags->Tag = 17 [db_index = False, null = False, blank = True];
68}
69
70message Network (PlCoreBase,ParameterMixin) {
71 required string name = 1 [db_index = False, max_length = 32, null = False, blank = False];
72 required manytoone template->NetworkTemplate:network = 2 [db_index = True, null = False, blank = False];
73 required string subnet = 3 [db_index = False, max_length = 32, null = False, blank = True];
74 required string start_ip = 4 [db_index = False, max_length = 32, null = False, blank = True];
75 required string end_ip = 5 [db_index = False, max_length = 32, null = False, blank = True];
76 optional string ports = 6 [db_index = False, max_length = 1024, null = True, blank = True];
77 optional string labels = 7 [db_index = False, max_length = 1024, null = True, blank = True];
78 required manytoone owner->Slice:ownedNetworks = 8 [help_text = "Slice that owns control of this Network", null = False, db_index = True, blank = False];
79 required int32 guaranteed_bandwidth = 9 [default = 0, null = False, db_index = False, blank = False];
80 required bool permit_all_slices = 10 [default = False, null = False, db_index = False, blank = True];
81 optional string topology_parameters = 11 [db_index = False, null = True, blank = True];
82 optional string controller_url = 12 [db_index = False, max_length = 1024, null = True, blank = True];
83 optional string controller_parameters = 13 [db_index = False, null = True, blank = True];
84 optional string network_id = 14 [help_text = "Quantum network", max_length = 256, null = True, db_index = False, blank = True];
85 optional string router_id = 15 [help_text = "Quantum router id", max_length = 256, null = True, db_index = False, blank = True];
86 optional string subnet_id = 16 [help_text = "Quantum subnet id", max_length = 256, null = True, db_index = False, blank = True];
87 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];
88 required manytomany permitted_slices->Slice/Network_permitted_slices:availableNetworks = 18 [db_index = False, null = False, blank = True];
89 required manytomany slices->Slice/NetworkSlice:networks = 19 [db_index = False, null = False, blank = True];
90 required manytomany instances->Instance/Port:networks = 20 [db_index = False, null = False, blank = True];
91}
92
93message Slice (PlCoreBase){
94 required string name = 1 [max_length = 80, content_type = "stripped", blank = False, help_text = "The Name of the Slice", null = False, db_index = False];
95 required bool enabled = 2 [help_text = "Status for this Slice", default = True, null = False, db_index = False, blank = True];
96 required bool omf_friendly = 3 [default = False, null = False, db_index = False, blank = True];
97 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];
98 required string slice_url = 5 [db_index = False, max_length = 512, null = False, content_type = "url", blank = True];
99 required manytoone site->Site:slices = 6 [help_text = "The Site this Slice belongs to", null = False, db_index = True, blank = False];
100 required int32 max_instances = 7 [default = 10, null = False, db_index = False, blank = False];
101 optional manytoone service->Service:slices = 8 [db_index = True, null = True, blank = True];
102 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'))"];
103 optional string exposed_ports = 10 [db_index = False, max_length = 256, null = True, blank = True];
104 optional manytoone serviceClass->ServiceClass:slices = 11 [db_index = True, null = True, blank = True];
105 optional manytoone creator->User:slices = 12 [db_index = True, null = True, blank = True];
106 optional manytoone default_flavor->Flavor:slices = 13 [db_index = True, null = True, blank = True];
107 optional manytoone default_image->Image:slices = 14 [db_index = True, null = True, blank = True];
108 optional manytoone default_node->Node:slices = 15 [db_index = True, null = True, blank = True];
109 optional string mount_data_sets = 16 [default = "GenBank", max_length = 256, content_type = "stripped", blank = True, null = True, db_index = False];
110 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];
111 required manytomany tags->Tag = 18 [db_index = False, null = False, blank = True];
112}
113"""
Matteo Scandolo67654fa2017-06-09 09:33:17 -0700114
Scott Baker1f7791d2018-10-04 13:21:20 -0700115 args = XOSProcessorArgs()
Matteo Scandolo67654fa2017-06-09 09:33:17 -0700116 args.inputs = proto
117 args.target = target
Sapan Bhatiabfb233a2018-02-09 14:53:09 -0800118 output = XOSProcessor.process(args)
Zack Williams045b63d2019-01-22 16:30:57 -0700119 num_semis = output.count(";")
120 self.assertGreater(
121 num_semis, 3
122 ) # 3 is the number of links, each of which contains at least one field
Sapan Bhatia943dad52017-05-19 18:41:01 +0200123
124 def test_base_class_fields(self):
Zack Williams045b63d2019-01-22 16:30:57 -0700125 target = """
Sapan Bhatia943dad52017-05-19 18:41:01 +0200126 {% for m in proto.messages %}
127 {{ m.name }} {
128 {%- for l in m.links %}
Sapan Bhatia3cfdf632017-06-08 05:14:03 +0200129 {%- if proto.message_table[l.peer.fqn] -%}
130 {%- set model = proto.message_table[l.peer.fqn] %}
Sapan Bhatia943dad52017-05-19 18:41:01 +0200131 {% for f in model.fields %}
132 {{ f.type }} {{ f.name }};
133 {% endfor %}
134 {%- endif -%}
135 {% endfor %}
136 }
137 {% endfor %}
138"""
Matteo Scandolo67654fa2017-06-09 09:33:17 -0700139 xtarget = XProtoTestHelpers.write_tmp_target(target)
Sapan Bhatia943dad52017-05-19 18:41:01 +0200140
Zack Williams045b63d2019-01-22 16:30:57 -0700141 proto = """
Sapan Bhatia943dad52017-05-19 18:41:01 +0200142message Port (PlCoreBase,ParameterMixin){
143 required manytoone network->Network:links = 1 [db_index = True, null = False, blank = False];
144 optional manytoone instance->Instance:ports = 2 [db_index = True, null = True, blank = True];
145 optional string ip = 3 [max_length = 39, content_type = "ip", blank = True, help_text = "Instance ip address", null = True, db_index = False];
146 optional string port_id = 4 [help_text = "Neutron port id", max_length = 256, null = True, db_index = False, blank = True];
147 optional string mac = 5 [help_text = "MAC address associated with this port", max_length = 256, null = True, db_index = False, blank = True];
148 required bool xos_created = 6 [default = False, null = False, db_index = False, blank = True];
149}
150
151message Instance (PlCoreBase){
152 optional string instance_id = 1 [max_length = 200, content_type = "stripped", blank = True, help_text = "Nova instance id", null = True, db_index = False];
153 optional string instance_uuid = 2 [max_length = 200, content_type = "stripped", blank = True, help_text = "Nova instance uuid", null = True, db_index = False];
154 required string name = 3 [max_length = 200, content_type = "stripped", blank = False, help_text = "Instance name", null = False, db_index = False];
155 optional string instance_name = 4 [max_length = 200, content_type = "stripped", blank = True, help_text = "OpenStack generated name", null = True, db_index = False];
156 optional string ip = 5 [max_length = 39, content_type = "ip", blank = True, help_text = "Instance ip address", null = True, db_index = False];
157 required manytoone image->Image:instances = 6 [db_index = True, null = False, blank = False];
158 optional manytoone creator->User:instances = 7 [db_index = True, null = True, blank = True];
159 required manytoone slice->Slice:instances = 8 [db_index = True, null = False, blank = False];
160 required manytoone deployment->Deployment:instance_deployment = 9 [db_index = True, null = False, blank = False];
161 required manytoone node->Node:instances = 10 [db_index = True, null = False, blank = False];
162 required int32 numberCores = 11 [help_text = "Number of cores for instance", default = 0, null = False, db_index = False, blank = False];
163 required manytoone flavor->Flavor:instance = 12 [help_text = "Flavor of this instance", default = "get_default_flavor()", null = False, db_index = True, blank = False];
164 optional string userData = 13 [help_text = "user_data passed to instance during creation", null = True, db_index = False, blank = True];
165 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];
166 optional string volumes = 15 [help_text = "Comma-separated list of directories to expose to parent context", null = True, db_index = False, blank = True];
167 optional manytoone parent->Instance:instance = 16 [help_text = "Parent Instance for containers nested inside of VMs", null = True, db_index = True, blank = True];
168 required manytomany tags->Tag = 17 [db_index = False, null = False, blank = True];
169}
170
171message Network (PlCoreBase,ParameterMixin) {
172 required string name = 1 [db_index = False, max_length = 32, null = False, blank = False];
173 required manytoone template->NetworkTemplate:network = 2 [db_index = True, null = False, blank = False];
174 required string subnet = 3 [db_index = False, max_length = 32, null = False, blank = True];
175 required string start_ip = 4 [db_index = False, max_length = 32, null = False, blank = True];
176 required string end_ip = 5 [db_index = False, max_length = 32, null = False, blank = True];
177 optional string ports = 6 [db_index = False, max_length = 1024, null = True, blank = True];
178 optional string labels = 7 [db_index = False, max_length = 1024, null = True, blank = True];
179 required manytoone owner->Slice:ownedNetworks = 8 [help_text = "Slice that owns control of this Network", null = False, db_index = True, blank = False];
180 required int32 guaranteed_bandwidth = 9 [default = 0, null = False, db_index = False, blank = False];
181 required bool permit_all_slices = 10 [default = False, null = False, db_index = False, blank = True];
182 optional string topology_parameters = 11 [db_index = False, null = True, blank = True];
183 optional string controller_url = 12 [db_index = False, max_length = 1024, null = True, blank = True];
184 optional string controller_parameters = 13 [db_index = False, null = True, blank = True];
185 optional string network_id = 14 [help_text = "Quantum network", max_length = 256, null = True, db_index = False, blank = True];
186 optional string router_id = 15 [help_text = "Quantum router id", max_length = 256, null = True, db_index = False, blank = True];
187 optional string subnet_id = 16 [help_text = "Quantum subnet id", max_length = 256, null = True, db_index = False, blank = True];
188 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];
189 required manytomany permitted_slices->Slice/Network_permitted_slices:availableNetworks = 18 [db_index = False, null = False, blank = True];
190 required manytomany slices->Slice/NetworkSlice:networks = 19 [db_index = False, null = False, blank = True];
191 required manytomany instances->Instance/Port:networks = 20 [db_index = False, null = False, blank = True];
192}
193
194message Slice (PlCoreBase){
195 required string name = 1 [max_length = 80, content_type = "stripped", blank = False, help_text = "The Name of the Slice", null = False, db_index = False];
196 required bool enabled = 2 [help_text = "Status for this Slice", default = True, null = False, db_index = False, blank = True];
197 required bool omf_friendly = 3 [default = False, null = False, db_index = False, blank = True];
198 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];
199 required string slice_url = 5 [db_index = False, max_length = 512, null = False, content_type = "url", blank = True];
200 required manytoone site->Site:slices = 6 [help_text = "The Site this Slice belongs to", null = False, db_index = True, blank = False];
201 required int32 max_instances = 7 [default = 10, null = False, db_index = False, blank = False];
202 optional manytoone service->Service:slices = 8 [db_index = True, null = True, blank = True];
203 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'))"];
204 optional string exposed_ports = 10 [db_index = False, max_length = 256, null = True, blank = True];
205 optional manytoone serviceClass->ServiceClass:slices = 11 [db_index = True, null = True, blank = True];
206 optional manytoone creator->User:slices = 12 [db_index = True, null = True, blank = True];
207 optional manytoone default_flavor->Flavor:slices = 13 [db_index = True, null = True, blank = True];
208 optional manytoone default_image->Image:slices = 14 [db_index = True, null = True, blank = True];
209 optional manytoone default_node->Node:slices = 15 [db_index = True, null = True, blank = True];
210 optional string mount_data_sets = 16 [default = "GenBank", max_length = 256, content_type = "stripped", blank = True, null = True, db_index = False];
211 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];
212 required manytomany tags->Tag = 18 [db_index = False, null = False, blank = True];
213}
214"""
Matteo Scandolo67654fa2017-06-09 09:33:17 -0700215
Scott Baker1f7791d2018-10-04 13:21:20 -0700216 args = XOSProcessorArgs()
Matteo Scandolo67654fa2017-06-09 09:33:17 -0700217 args.inputs = proto
218 args.target = xtarget
Sapan Bhatiabfb233a2018-02-09 14:53:09 -0800219 output = XOSProcessor.process(args)
Matteo Scandolo67654fa2017-06-09 09:33:17 -0700220
Zack Williams045b63d2019-01-22 16:30:57 -0700221 num_semis = output.count(";")
Sapan Bhatia3cfdf632017-06-08 05:14:03 +0200222 self.assertGreater(num_semis, 3)
Sapan Bhatia943dad52017-05-19 18:41:01 +0200223
224 def test_from_base(self):
Zack Williams045b63d2019-01-22 16:30:57 -0700225 target = """
Sapan Bhatia943dad52017-05-19 18:41:01 +0200226 {% for f in xproto_base_fields(proto.messages.3, proto.message_table) %}
227 {{ f.type }} {{ f.name }};
228 {% endfor %}
229"""
Matteo Scandolo67654fa2017-06-09 09:33:17 -0700230 xtarget = XProtoTestHelpers.write_tmp_target(target)
Zack Williams045b63d2019-01-22 16:30:57 -0700231 proto = """
Sapan Bhatia943dad52017-05-19 18:41:01 +0200232message Port (PlCoreBase,ParameterMixin){
233 required string easter_egg = 1;
234 required manytoone network->Network:links = 1 [db_index = True, null = False, blank = False];
235 optional manytoone instance->Instance:ports = 2 [db_index = True, null = True, blank = True];
236 optional string ip = 3 [max_length = 39, content_type = "ip", blank = True, help_text = "Instance ip address", null = True, db_index = False];
237 optional string port_id = 4 [help_text = "Neutron port id", max_length = 256, null = True, db_index = False, blank = True];
238 optional string mac = 5 [help_text = "MAC address associated with this port", max_length = 256, null = True, db_index = False, blank = True];
239 required bool xos_created = 6 [default = False, null = False, db_index = False, blank = True];
240}
241
242message Instance (Port){
243 optional string instance_id = 1 [max_length = 200, content_type = "stripped", blank = True, help_text = "Nova instance id", null = True, db_index = False];
244 optional string instance_uuid = 2 [max_length = 200, content_type = "stripped", blank = True, help_text = "Nova instance uuid", null = True, db_index = False];
245 required string name = 3 [max_length = 200, content_type = "stripped", blank = False, help_text = "Instance name", null = False, db_index = False];
246 optional string instance_name = 4 [max_length = 200, content_type = "stripped", blank = True, help_text = "OpenStack generated name", null = True, db_index = False];
247 optional string ip = 5 [max_length = 39, content_type = "ip", blank = True, help_text = "Instance ip address", null = True, db_index = False];
248 required manytoone image->Image:instances = 6 [db_index = True, null = False, blank = False];
249 optional manytoone creator->User:instances = 7 [db_index = True, null = True, blank = True];
250 required manytoone slice->Slice:instances = 8 [db_index = True, null = False, blank = False];
251 required manytoone deployment->Deployment:instance_deployment = 9 [db_index = True, null = False, blank = False];
252 required manytoone node->Node:instances = 10 [db_index = True, null = False, blank = False];
253 required int32 numberCores = 11 [help_text = "Number of cores for instance", default = 0, null = False, db_index = False, blank = False];
254 required manytoone flavor->Flavor:instance = 12 [help_text = "Flavor of this instance", default = "get_default_flavor()", null = False, db_index = True, blank = False];
255 optional string userData = 13 [help_text = "user_data passed to instance during creation", null = True, db_index = False, blank = True];
256 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];
257 optional string volumes = 15 [help_text = "Comma-separated list of directories to expose to parent context", null = True, db_index = False, blank = True];
258 optional manytoone parent->Instance:instance = 16 [help_text = "Parent Instance for containers nested inside of VMs", null = True, db_index = True, blank = True];
259 required manytomany tags->Tag = 17 [db_index = False, null = False, blank = True];
260}
261
262message Network (Instance) {
263 required string name = 1 [db_index = False, max_length = 32, null = False, blank = False];
264 required manytoone template->NetworkTemplate:network = 2 [db_index = True, null = False, blank = False];
265 required string subnet = 3 [db_index = False, max_length = 32, null = False, blank = True];
266 required string start_ip = 4 [db_index = False, max_length = 32, null = False, blank = True];
267 required string end_ip = 5 [db_index = False, max_length = 32, null = False, blank = True];
268 optional string ports = 6 [db_index = False, max_length = 1024, null = True, blank = True];
269 optional string labels = 7 [db_index = False, max_length = 1024, null = True, blank = True];
270 required manytoone owner->Slice:ownedNetworks = 8 [help_text = "Slice that owns control of this Network", null = False, db_index = True, blank = False];
271 required int32 guaranteed_bandwidth = 9 [default = 0, null = False, db_index = False, blank = False];
272 required bool permit_all_slices = 10 [default = False, null = False, db_index = False, blank = True];
273 optional string topology_parameters = 11 [db_index = False, null = True, blank = True];
274 optional string controller_url = 12 [db_index = False, max_length = 1024, null = True, blank = True];
275 optional string controller_parameters = 13 [db_index = False, null = True, blank = True];
276 optional string network_id = 14 [help_text = "Quantum network", max_length = 256, null = True, db_index = False, blank = True];
277 optional string router_id = 15 [help_text = "Quantum router id", max_length = 256, null = True, db_index = False, blank = True];
278 optional string subnet_id = 16 [help_text = "Quantum subnet id", max_length = 256, null = True, db_index = False, blank = True];
279 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];
280 required manytomany permitted_slices->Slice/Network_permitted_slices:availableNetworks = 18 [db_index = False, null = False, blank = True];
281 required manytomany slices->Slice/NetworkSlice:networks = 19 [db_index = False, null = False, blank = True];
282 required manytomany instances->Instance/Port:networks = 20 [db_index = False, null = False, blank = True];
283}
284
285message Slice (Network){
286 required string name = 1 [max_length = 80, content_type = "stripped", blank = False, help_text = "The Name of the Slice", null = False, db_index = False];
287 required bool enabled = 2 [help_text = "Status for this Slice", default = True, null = False, db_index = False, blank = True];
288 required bool omf_friendly = 3 [default = False, null = False, db_index = False, blank = True];
289 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];
290 required string slice_url = 5 [db_index = False, max_length = 512, null = False, content_type = "url", blank = True];
291 required manytoone site->Site:slices = 6 [help_text = "The Site this Slice belongs to", null = False, db_index = True, blank = False];
292 required int32 max_instances = 7 [default = 10, null = False, db_index = False, blank = False];
293 optional manytoone service->Service:slices = 8 [db_index = True, null = True, blank = True];
294 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'))"];
295 optional string exposed_ports = 10 [db_index = False, max_length = 256, null = True, blank = True];
296 optional manytoone serviceClass->ServiceClass:slices = 11 [db_index = True, null = True, blank = True];
297 optional manytoone creator->User:slices = 12 [db_index = True, null = True, blank = True];
298 optional manytoone default_flavor->Flavor:slices = 13 [db_index = True, null = True, blank = True];
299 optional manytoone default_image->Image:slices = 14 [db_index = True, null = True, blank = True];
300 optional manytoone default_node->Node:slices = 15 [db_index = True, null = True, blank = True];
301 optional string mount_data_sets = 16 [default = "GenBank", max_length = 256, content_type = "stripped", blank = True, null = True, db_index = False];
302 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];
303 required manytomany tags->Tag = 18 [db_index = False, null = False, blank = True];
304}
305"""
Scott Baker1f7791d2018-10-04 13:21:20 -0700306 args = XOSProcessorArgs()
Matteo Scandolo67654fa2017-06-09 09:33:17 -0700307 args.inputs = proto
308 args.target = xtarget
Sapan Bhatiabfb233a2018-02-09 14:53:09 -0800309 output = XOSProcessor.process(args)
Zack Williams045b63d2019-01-22 16:30:57 -0700310 self.assertIn("easter_egg", output)
Sapan Bhatia943dad52017-05-19 18:41:01 +0200311
Zack Williams045b63d2019-01-22 16:30:57 -0700312
313if __name__ == "__main__":
Sapan Bhatia943dad52017-05-19 18:41:01 +0200314 unittest.main()