2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
20 package org.onap.aai.util.genxsd;
22 import org.junit.Before;
23 import org.junit.BeforeClass;
24 import org.junit.Test;
25 import org.onap.aai.introspection.Version;
26 import org.slf4j.Logger;
27 import org.slf4j.LoggerFactory;
28 import org.w3c.dom.Element;
30 import java.io.BufferedWriter;
32 import java.io.IOException;
33 import java.nio.charset.Charset;
34 import java.nio.file.Files;
35 import java.nio.file.Path;
36 import java.nio.file.Paths;
38 import static org.hamcrest.CoreMatchers.is;
39 import static org.junit.Assert.assertThat;
41 public class YAMLfromOXMTest {
42 private static final Logger logger = LoggerFactory.getLogger("YAMLfromOXMTest.class");
43 private String testXML;
46 public static void setUpBeforeClass() throws Exception {
50 public void setUp() throws Exception {
51 XSDElementTest x = new XSDElementTest();
54 logger.debug(testXML);
58 public void testGetDocumentHeader() {
59 Version v = Version.v11;
60 String apiVersion = v.toString();
62 File edgeRuleFile = new File("../aai-core" + "/src/main/resources/dbedgerules/DbEdgeRules_" + apiVersion + ".json");
64 YAMLfromOXM swagger = new YAMLfromOXM(testXML, v, edgeRuleFile);
66 header = swagger.getDocumentHeader();
67 } catch(Exception e) {
70 assertThat("Header:\n"+header,header, is(YAMLheader()));
74 public void testProcess() {
75 Version v = Version.v11;
76 String apiVersion = v.toString();
77 String fileContent = null;
78 File edgeRuleFile = new File("../aai-core" + "/src/main/resources/dbedgerules/DbEdgeRules_" + apiVersion + ".json");
80 YAMLfromOXM swagger = new YAMLfromOXM(testXML, v, edgeRuleFile);
81 fileContent = swagger.process();
82 } catch(Exception e) {
85 assertThat("FileContent-TestProcess:\n"+fileContent,fileContent, is(YAMLresult()));
89 public void testYAMLfromOXMFileVersionFile() throws IOException {
90 String outfileName = "testXML.xml";
91 File XMLfile = new File(outfileName);
92 XMLfile.createNewFile();
93 BufferedWriter bw = null;
94 Charset charset = Charset.forName("UTF-8");
95 Path path = Paths.get(outfileName);
96 bw = Files.newBufferedWriter(path, charset);
99 Version v = Version.v11;
100 String apiVersion = v.toString();
101 String fileContent = null;
102 File edgeRuleFile = new File("../aai-core" + "/src/main/resources/dbedgerules/DbEdgeRules_" + apiVersion + ".json");
104 YAMLfromOXM swagger = new YAMLfromOXM(XMLfile, v, edgeRuleFile);
105 fileContent = swagger.process();
106 } catch(Exception e) {
110 assertThat("FileContent-OXMFileVersionFile:\n"+fileContent,fileContent, is(YAMLresult()));
114 public void testYAMLfromOXMStringVersionFile() {
115 Version v = Version.v11;
116 String apiVersion = v.toString();
117 String fileContent = null;
118 File edgeRuleFile = new File("../aai-core" + "/src/main/resources/dbedgerules/DbEdgeRules_" + apiVersion + ".json");
120 YAMLfromOXM swagger = new YAMLfromOXM(testXML, v, edgeRuleFile);
121 fileContent = swagger.process();
122 } catch(Exception e) {
125 assertThat("FileContent-OXMStringVersionFile:\n"+fileContent,fileContent, is(YAMLresult()));
129 public void testAppendDefinitions() {
130 Version v = Version.v11;
131 String apiVersion = v.toString();
132 String definitions = null;
133 File edgeRuleFile = new File("../aai-core" + "/src/main/resources/dbedgerules/DbEdgeRules_" + apiVersion + ".json");
135 YAMLfromOXM swagger = new YAMLfromOXM(testXML, v, edgeRuleFile);
137 definitions = swagger.appendDefinitions();
138 } catch(Exception e) {
141 assertThat("Definitions:\n"+definitions,definitions, is(YAMLdefs()+YAMLpatchDefs()+YAMLgetDefs()));
145 public void testGetXMLRootElementName() {
146 String target = "RootElement=customer";
147 Version v = Version.v11;
148 String apiVersion = v.toString();
149 Element customer = null;
151 File edgeRuleFile = new File("../aai-core" + "/src/main/resources/dbedgerules/DbEdgeRules_" + apiVersion + ".json");
153 YAMLfromOXM swagger = new YAMLfromOXM(testXML, v, edgeRuleFile);
155 customer = swagger.getJavaTypeElementSwagger("Customer");
156 root = swagger.getXMLRootElementName(customer);
157 } catch(Exception e) {
160 assertThat("RootElement="+root, is(target));
164 public void testGetXmlRootElementName() {
165 String target = "RootElement=customer";
166 Version v = Version.v11;
167 String apiVersion = v.toString();
169 File edgeRuleFile = new File("../aai-core" + "/src/main/resources/dbedgerules/DbEdgeRules_" + apiVersion + ".json");
171 YAMLfromOXM swagger = new YAMLfromOXM(testXML, v, edgeRuleFile);
173 root = swagger.getXmlRootElementName("Customer");
174 } catch(Exception e) {
177 assertThat("RootElement="+root, is(target));
181 public void testGetJavaTypeElementSwagger() {
182 String target = "Element=java-type/Customer";
183 Version v = Version.v11;
184 String apiVersion = v.toString();
185 Element customer = null;
186 File edgeRuleFile = new File("../aai-core" + "/src/main/resources/dbedgerules/DbEdgeRules_" + apiVersion + ".json");
188 YAMLfromOXM swagger = new YAMLfromOXM(testXML, v, edgeRuleFile);
190 customer = swagger.getJavaTypeElementSwagger("Customer");
191 } catch(Exception e) {
194 assertThat("Element="+customer.getNodeName()+"/"+customer.getAttribute("name"), is(target));
197 public String YAMLresult() {
198 StringBuilder sb = new StringBuilder(32368);
199 sb.append(YAMLheader());
200 sb.append(YAMLops());
201 sb.append(YAMLdefs());
202 sb.append(YAMLpatchDefs());
203 sb.append(YAMLgetDefs());
204 return sb.toString();
206 public String YAMLheader() {
207 StringBuilder sb = new StringBuilder(1500);
208 sb.append("swagger: \"2.0\"\n");
209 sb.append("info:\n");
210 sb.append(" description: |\n");
212 sb.append(" [Differences versus the previous schema version](apidocs/aai_swagger_v11.diff)\n");
214 sb.append(" Copyright © 2017 AT&T Intellectual Property. All rights reserved.\n");
216 sb.append(" Licensed under the Creative Commons License, Attribution 4.0 Intl. (the "License"); you may not use this documentation except in compliance with the License.\n");
218 sb.append(" You may obtain a copy of the License at\n");
220 sb.append(" (https://creativecommons.org/licenses/by/4.0/)\n");
222 sb.append(" Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.\n");
224 sb.append(" ECOMP and OpenECOMP are trademarks and service marks of AT&T Intellectual Property.\n");
226 sb.append(" This document is best viewed with Firefox or Chrome. Nodes can be found by appending /#/definitions/node-type-to-find to the path to this document. Edge definitions can be found with the node definitions.\n");
227 sb.append(" version: \"v11\"\n");
228 sb.append(" title: Active and Available Inventory REST API\n");
229 sb.append(" license:\n");
230 sb.append(" name: Apache 2.0\n");
231 sb.append(" url: http://www.apache.org/licenses/LICENSE-2.0.html\n");
232 sb.append(" contact:\n");
233 sb.append(" name:\n");
234 sb.append(" url:\n");
235 sb.append(" email:\n");
236 sb.append("host:\n");
237 sb.append("basePath: /aai/v11\n");
238 sb.append("schemes:\n");
239 sb.append(" - https\n");
240 sb.append("paths:\n");
241 return sb.toString();
244 public String YAMLops() {
245 StringBuilder sb = new StringBuilder(16384);
246 sb.append(" /business/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}:\n");
247 sb.append(" get:\n");
248 sb.append(" tags:\n");
249 sb.append(" - Business\n");
250 sb.append(" summary: returns service-subscription\n");
251 sb.append(" description: returns service-subscription\n");
252 sb.append(" operationId: getBusinessCustomersCustomerServiceSubscriptionsServiceSubscription\n");
253 sb.append(" produces:\n");
254 sb.append(" - application/json\n");
255 sb.append(" - application/xml\n");
256 sb.append(" responses:\n");
257 sb.append(" \"200\":\n");
258 sb.append(" description: successful operation\n");
259 sb.append(" schema:\n");
260 sb.append(" $ref: \"#/getDefinitions/service-subscription\"\n");
261 sb.append(" \"default\":\n");
262 sb.append(" null parameters:\n");
263 sb.append(" - name: global-customer-id\n");
264 sb.append(" in: path\n");
265 sb.append(" description: Global customer id used across ECOMP to uniquely identify customer.\n");
266 sb.append(" required: true\n");
267 sb.append(" type: string\n");
268 sb.append(" example: __GLOBAL-CUSTOMER-ID__\n");
269 sb.append(" - name: service-type\n");
270 sb.append(" in: path\n");
271 sb.append(" description: Value defined by orchestration to identify this service across ECOMP.\n");
272 sb.append(" required: true\n");
273 sb.append(" type: string\n");
274 sb.append(" example: __SERVICE-TYPE__\n");
275 sb.append(" put:\n");
276 sb.append(" tags:\n");
277 sb.append(" - Business\n");
278 sb.append(" summary: create or update an existing service-subscription\n");
279 sb.append(" description: |\n");
280 sb.append(" Create or update an existing service-subscription.\n");
282 sb.append(" Note! This PUT method has a corresponding PATCH method that can be used to update just a few of the fields of an existing object, rather than a full object replacement. An example can be found in the [PATCH section] below\n");
283 sb.append(" operationId: createOrUpdateBusinessCustomersCustomerServiceSubscriptionsServiceSubscription\n");
284 sb.append(" consumes:\n");
285 sb.append(" - application/json\n");
286 sb.append(" - application/xml\n");
287 sb.append(" produces:\n");
288 sb.append(" - application/json\n");
289 sb.append(" - application/xml\n");
290 sb.append(" responses:\n");
291 sb.append(" \"default\":\n");
292 sb.append(" null parameters:\n");
293 sb.append(" - name: global-customer-id\n");
294 sb.append(" in: path\n");
295 sb.append(" description: Global customer id used across ECOMP to uniquely identify customer.\n");
296 sb.append(" required: true\n");
297 sb.append(" type: string\n");
298 sb.append(" example: __GLOBAL-CUSTOMER-ID__\n");
299 sb.append(" - name: service-type\n");
300 sb.append(" in: path\n");
301 sb.append(" description: Value defined by orchestration to identify this service across ECOMP.\n");
302 sb.append(" required: true\n");
303 sb.append(" type: string\n");
304 sb.append(" example: __SERVICE-TYPE__\n");
305 sb.append(" - name: body\n");
306 sb.append(" in: body\n");
307 sb.append(" description: service-subscription object that needs to be created or updated. [Valid relationship examples shown here](apidocs/relations/v11/BusinessCustomersCustomerServiceSubscriptionsServiceSubscription.json)\n");
308 sb.append(" required: true\n");
309 sb.append(" schema:\n");
310 sb.append(" $ref: \"#/definitions/service-subscription\"\n");
311 sb.append(" patch:\n");
312 sb.append(" tags:\n");
313 sb.append(" - Business\n");
314 sb.append(" summary: update an existing service-subscription\n");
315 sb.append(" description: |\n");
316 sb.append(" Update an existing service-subscription\n");
318 sb.append(" Note: Endpoints that are not devoted to object relationships support both PUT and PATCH operations.\n");
319 sb.append(" The PUT operation will entirely replace an existing object.\n");
320 sb.append(" The PATCH operation sends a \"description of changes\" for an existing object. The entire set of changes must be applied. An error result means no change occurs.\n");
322 sb.append(" Other differences between PUT and PATCH are:\n");
324 sb.append(" - For PATCH, you can send any of the values shown in sample REQUEST body. There are no required values.\n");
325 sb.append(" - For PATCH, resource-id which is a required REQUEST body element for PUT, must not be sent.\n");
326 sb.append(" - PATCH cannot be used to update relationship elements; there are dedicated PUT operations for this.\n");
327 sb.append(" operationId: UpdateBusinessCustomersCustomerServiceSubscriptionsServiceSubscription\n");
328 sb.append(" consumes:\n");
329 sb.append(" - application/json\n");
330 sb.append(" - application/xml\n");
331 sb.append(" produces:\n");
332 sb.append(" - application/json\n");
333 sb.append(" - application/xml\n");
334 sb.append(" responses:\n");
335 sb.append(" \"default\":\n");
336 sb.append(" null parameters:\n");
337 sb.append(" - name: global-customer-id\n");
338 sb.append(" in: path\n");
339 sb.append(" description: Global customer id used across ECOMP to uniquely identify customer.\n");
340 sb.append(" required: true\n");
341 sb.append(" type: string\n");
342 sb.append(" example: __GLOBAL-CUSTOMER-ID__\n");
343 sb.append(" - name: service-type\n");
344 sb.append(" in: path\n");
345 sb.append(" description: Value defined by orchestration to identify this service across ECOMP.\n");
346 sb.append(" required: true\n");
347 sb.append(" type: string\n");
348 sb.append(" example: __SERVICE-TYPE__\n");
349 sb.append(" - name: body\n");
350 sb.append(" in: body\n");
351 sb.append(" description: service-subscription object that needs to be updated.\n");
352 sb.append(" required: true\n");
353 sb.append(" schema:\n");
354 sb.append(" $ref: \"#/patchDefinitions/service-subscription\"\n");
355 sb.append(" delete:\n");
356 sb.append(" tags:\n");
357 sb.append(" - Business\n");
358 sb.append(" summary: delete an existing service-subscription\n");
359 sb.append(" description: delete an existing service-subscription\n");
360 sb.append(" operationId: deleteBusinessCustomersCustomerServiceSubscriptionsServiceSubscription\n");
361 sb.append(" consumes:\n");
362 sb.append(" - application/json\n");
363 sb.append(" - application/xml\n");
364 sb.append(" produces:\n");
365 sb.append(" - application/json\n");
366 sb.append(" - application/xml\n");
367 sb.append(" responses:\n");
368 sb.append(" \"default\":\n");
369 sb.append(" null parameters:\n");
370 sb.append(" - name: global-customer-id\n");
371 sb.append(" in: path\n");
372 sb.append(" description: Global customer id used across ECOMP to uniquely identify customer.\n");
373 sb.append(" required: true\n");
374 sb.append(" type: string\n");
375 sb.append(" example: __GLOBAL-CUSTOMER-ID__\n");
376 sb.append(" - name: service-type\n");
377 sb.append(" in: path\n");
378 sb.append(" description: Value defined by orchestration to identify this service across ECOMP.\n");
379 sb.append(" required: true\n");
380 sb.append(" type: string\n");
381 sb.append(" example: __SERVICE-TYPE__\n");
382 sb.append(" - name: resource-version\n");
383 sb.append(" in: query\n");
384 sb.append(" description: resource-version for concurrency\n");
385 sb.append(" required: true\n");
386 sb.append(" type: string\n");
387 sb.append(" /business/customers/customer/{global-customer-id}/service-subscriptions:\n");
388 sb.append(" get:\n");
389 sb.append(" tags:\n");
390 sb.append(" - Business\n");
391 sb.append(" summary: returns service-subscriptions\n");
392 sb.append(" description: returns service-subscriptions\n");
393 sb.append(" operationId: getBusinessCustomersCustomerServiceSubscriptions\n");
394 sb.append(" produces:\n");
395 sb.append(" - application/json\n");
396 sb.append(" - application/xml\n");
397 sb.append(" responses:\n");
398 sb.append(" \"200\":\n");
399 sb.append(" description: successful operation\n");
400 sb.append(" schema:\n");
401 sb.append(" $ref: \"#/getDefinitions/service-subscriptions\"\n");
402 sb.append(" \"default\":\n");
403 sb.append(" null parameters:\n");
404 sb.append(" - name: global-customer-id\n");
405 sb.append(" in: path\n");
406 sb.append(" description: Global customer id used across ECOMP to uniquely identify customer.\n");
407 sb.append(" required: true\n");
408 sb.append(" type: string\n");
409 sb.append(" example: __GLOBAL-CUSTOMER-ID__\n");
410 sb.append(" - name: service-type\n");
411 sb.append(" in: query\n");
412 sb.append(" description:\n");
413 sb.append(" required: false\n");
414 sb.append(" type: string\n");
415 sb.append(" /business/customers/customer/{global-customer-id}:\n");
416 sb.append(" get:\n");
417 sb.append(" tags:\n");
418 sb.append(" - Business\n");
419 sb.append(" summary: returns customer\n");
420 sb.append(" description: returns customer\n");
421 sb.append(" operationId: getBusinessCustomersCustomer\n");
422 sb.append(" produces:\n");
423 sb.append(" - application/json\n");
424 sb.append(" - application/xml\n");
425 sb.append(" responses:\n");
426 sb.append(" \"200\":\n");
427 sb.append(" description: successful operation\n");
428 sb.append(" schema:\n");
429 sb.append(" $ref: \"#/getDefinitions/customer\"\n");
430 sb.append(" \"default\":\n");
431 sb.append(" null parameters:\n");
432 sb.append(" - name: global-customer-id\n");
433 sb.append(" in: path\n");
434 sb.append(" description: Global customer id used across ECOMP to uniquely identify customer.\n");
435 sb.append(" required: true\n");
436 sb.append(" type: string\n");
437 sb.append(" example: __GLOBAL-CUSTOMER-ID__\n");
438 sb.append(" put:\n");
439 sb.append(" tags:\n");
440 sb.append(" - Business\n");
441 sb.append(" summary: create or update an existing customer\n");
442 sb.append(" description: |\n");
443 sb.append(" Create or update an existing customer.\n");
445 sb.append(" Note! This PUT method has a corresponding PATCH method that can be used to update just a few of the fields of an existing object, rather than a full object replacement. An example can be found in the [PATCH section] below\n");
446 sb.append(" operationId: createOrUpdateBusinessCustomersCustomer\n");
447 sb.append(" consumes:\n");
448 sb.append(" - application/json\n");
449 sb.append(" - application/xml\n");
450 sb.append(" produces:\n");
451 sb.append(" - application/json\n");
452 sb.append(" - application/xml\n");
453 sb.append(" responses:\n");
454 sb.append(" \"default\":\n");
455 sb.append(" null parameters:\n");
456 sb.append(" - name: global-customer-id\n");
457 sb.append(" in: path\n");
458 sb.append(" description: Global customer id used across ECOMP to uniquely identify customer.\n");
459 sb.append(" required: true\n");
460 sb.append(" type: string\n");
461 sb.append(" example: __GLOBAL-CUSTOMER-ID__\n");
462 sb.append(" - name: body\n");
463 sb.append(" in: body\n");
464 sb.append(" description: customer object that needs to be created or updated. [Valid relationship examples shown here](apidocs/relations/v11/BusinessCustomersCustomer.json)\n");
465 sb.append(" required: true\n");
466 sb.append(" schema:\n");
467 sb.append(" $ref: \"#/definitions/customer\"\n");
468 sb.append(" patch:\n");
469 sb.append(" tags:\n");
470 sb.append(" - Business\n");
471 sb.append(" summary: update an existing customer\n");
472 sb.append(" description: |\n");
473 sb.append(" Update an existing customer\n");
475 sb.append(" Note: Endpoints that are not devoted to object relationships support both PUT and PATCH operations.\n");
476 sb.append(" The PUT operation will entirely replace an existing object.\n");
477 sb.append(" The PATCH operation sends a \"description of changes\" for an existing object. The entire set of changes must be applied. An error result means no change occurs.\n");
479 sb.append(" Other differences between PUT and PATCH are:\n");
481 sb.append(" - For PATCH, you can send any of the values shown in sample REQUEST body. There are no required values.\n");
482 sb.append(" - For PATCH, resource-id which is a required REQUEST body element for PUT, must not be sent.\n");
483 sb.append(" - PATCH cannot be used to update relationship elements; there are dedicated PUT operations for this.\n");
484 sb.append(" operationId: UpdateBusinessCustomersCustomer\n");
485 sb.append(" consumes:\n");
486 sb.append(" - application/json\n");
487 sb.append(" - application/xml\n");
488 sb.append(" produces:\n");
489 sb.append(" - application/json\n");
490 sb.append(" - application/xml\n");
491 sb.append(" responses:\n");
492 sb.append(" \"default\":\n");
493 sb.append(" null parameters:\n");
494 sb.append(" - name: global-customer-id\n");
495 sb.append(" in: path\n");
496 sb.append(" description: Global customer id used across ECOMP to uniquely identify customer.\n");
497 sb.append(" required: true\n");
498 sb.append(" type: string\n");
499 sb.append(" example: __GLOBAL-CUSTOMER-ID__\n");
500 sb.append(" - name: body\n");
501 sb.append(" in: body\n");
502 sb.append(" description: customer object that needs to be updated.\n");
503 sb.append(" required: true\n");
504 sb.append(" schema:\n");
505 sb.append(" $ref: \"#/patchDefinitions/customer\"\n");
506 sb.append(" delete:\n");
507 sb.append(" tags:\n");
508 sb.append(" - Business\n");
509 sb.append(" summary: delete an existing customer\n");
510 sb.append(" description: delete an existing customer\n");
511 sb.append(" operationId: deleteBusinessCustomersCustomer\n");
512 sb.append(" consumes:\n");
513 sb.append(" - application/json\n");
514 sb.append(" - application/xml\n");
515 sb.append(" produces:\n");
516 sb.append(" - application/json\n");
517 sb.append(" - application/xml\n");
518 sb.append(" responses:\n");
519 sb.append(" \"default\":\n");
520 sb.append(" null parameters:\n");
521 sb.append(" - name: global-customer-id\n");
522 sb.append(" in: path\n");
523 sb.append(" description: Global customer id used across ECOMP to uniquely identify customer.\n");
524 sb.append(" required: true\n");
525 sb.append(" type: string\n");
526 sb.append(" example: __GLOBAL-CUSTOMER-ID__\n");
527 sb.append(" - name: resource-version\n");
528 sb.append(" in: query\n");
529 sb.append(" description: resource-version for concurrency\n");
530 sb.append(" required: true\n");
531 sb.append(" type: string\n");
532 sb.append(" /business/customers:\n");
533 sb.append(" get:\n");
534 sb.append(" tags:\n");
535 sb.append(" - Business\n");
536 sb.append(" summary: returns customers\n");
537 sb.append(" description: returns customers\n");
538 sb.append(" operationId: getBusinessCustomers\n");
539 sb.append(" produces:\n");
540 sb.append(" - application/json\n");
541 sb.append(" - application/xml\n");
542 sb.append(" responses:\n");
543 sb.append(" \"200\":\n");
544 sb.append(" description: successful operation\n");
545 sb.append(" schema:\n");
546 sb.append(" $ref: \"#/getDefinitions/customers\"\n");
547 sb.append(" \"default\":\n");
548 sb.append(" null parameters:\n");
549 sb.append(" - name: global-customer-id\n");
550 sb.append(" in: query\n");
551 sb.append(" description:\n");
552 sb.append(" required: false\n");
553 sb.append(" type: string\n");
554 sb.append(" - name: subscriber-name\n");
555 sb.append(" in: query\n");
556 sb.append(" description:\n");
557 sb.append(" required: false\n");
558 sb.append(" type: string\n");
559 sb.append(" - name: subscriber-type\n");
560 sb.append(" in: query\n");
561 sb.append(" description:\n");
562 sb.append(" required: false\n");
563 sb.append(" type: string\n");
564 return sb.toString();
566 public String YAMLdefs() {
567 StringBuilder sb = new StringBuilder(8092);
568 sb.append("definitions:\n");
569 sb.append(" business:\n");
570 sb.append(" description: |\n");
571 sb.append(" Namespace for business related constructs\n");
572 sb.append(" properties:\n");
573 sb.append(" customers:\n");
574 sb.append(" type: array\n");
575 sb.append(" items:\n");
576 sb.append(" $ref: \"#/definitions/customer\"\n");
577 sb.append(" customer:\n");
578 sb.append(" description: |\n");
579 sb.append(" customer identifiers to provide linkage back to BSS information.\n");
580 sb.append(" ###### Related Nodes\n");
581 sb.append(" - FROM service-subscription( service-subscription BelongsTo customer, MANY2ONE)(1)\n");
583 sb.append(" -(1) IF this CUSTOMER node is deleted, this FROM node is DELETED also\n");
584 sb.append(" required:\n");
585 sb.append(" - global-customer-id\n");
586 sb.append(" - subscriber-name\n");
587 sb.append(" - subscriber-type\n");
588 sb.append(" properties:\n");
589 sb.append(" global-customer-id:\n");
590 sb.append(" type: string\n");
591 sb.append(" description: Global customer id used across ECOMP to uniquely identify customer.\n");
592 sb.append(" subscriber-name:\n");
593 sb.append(" type: string\n");
594 sb.append(" description: Subscriber name, an alternate way to retrieve a customer.\n");
595 sb.append(" subscriber-type:\n");
596 sb.append(" type: string\n");
597 sb.append(" description: Subscriber type, a way to provide VID with only the INFRA customers.\n");
598 sb.append(" resource-version:\n");
599 sb.append(" type: string\n");
600 sb.append(" description: Used for optimistic concurrency. Must be empty on create, valid on update and delete.\n");
601 sb.append(" service-subscriptions:\n");
602 sb.append(" type: array\n");
603 sb.append(" items:\n");
604 sb.append(" $ref: \"#/definitions/service-subscription\"\n");
605 sb.append(" customers:\n");
606 sb.append(" description: |\n");
607 sb.append(" Collection of customer identifiers to provide linkage back to BSS information.\n");
608 sb.append(" properties:\n");
609 sb.append(" customer:\n");
610 sb.append(" type: array\n");
611 sb.append(" items: \n");
612 sb.append(" $ref: \"#/definitions/customer\"\n");
613 sb.append(" inventory:\n");
614 sb.append(" properties:\n");
615 sb.append(" business:\n");
616 sb.append(" type: object\n");
617 sb.append(" $ref: \"#/definitions/business\"\n");
618 sb.append(" nodes:\n");
619 sb.append(" properties:\n");
620 sb.append(" inventory-item-data:\n");
621 sb.append(" type: array\n");
622 sb.append(" items:\n");
623 sb.append(" $ref: \"#/definitions/inventory-item-data\"\n");
624 sb.append(" service-subscription:\n");
625 sb.append(" description: |\n");
626 sb.append(" Object that group service instances.\n");
627 sb.append(" ###### Related Nodes\n");
628 sb.append(" - TO customer( service-subscription BelongsTo customer, MANY2ONE)(4)\n");
629 sb.append(" - TO tenant( service-subscription Uses tenant, MANY2MANY)\n");
630 sb.append(" - FROM service-instance( service-instance BelongsTo service-subscription, MANY2ONE)(1)\n");
632 sb.append(" -(1) IF this SERVICE-SUBSCRIPTION node is deleted, this FROM node is DELETED also\n");
633 sb.append(" -(4) IF this TO node is deleted, this SERVICE-SUBSCRIPTION is DELETED also\n");
634 sb.append(" required:\n");
635 sb.append(" - service-type\n");
636 sb.append(" properties:\n");
637 sb.append(" service-type:\n");
638 sb.append(" type: string\n");
639 sb.append(" description: Value defined by orchestration to identify this service across ECOMP.\n");
640 sb.append(" temp-ub-sub-account-id:\n");
641 sb.append(" type: string\n");
642 sb.append(" description: This property will be deleted from A&AI in the near future. Only stop gap solution.\n");
643 sb.append(" resource-version:\n");
644 sb.append(" type: string\n");
645 sb.append(" description: Used for optimistic concurrency. Must be empty on create, valid on update and delete.\n");
646 sb.append(" service-subscriptions:\n");
647 sb.append(" description: |\n");
648 sb.append(" Collection of objects that group service instances.\n");
649 sb.append(" properties:\n");
650 sb.append(" service-subscription:\n");
651 sb.append(" type: array\n");
652 sb.append(" items: \n");
653 sb.append(" $ref: \"#/definitions/service-subscription\"\n");
654 return sb.toString();
656 public String YAMLpatchDefs() {
657 StringBuilder sb = new StringBuilder(8092);
658 sb.append("patchDefinitions:\n");
659 sb.append(" business:\n");
660 sb.append(" description: |\n");
661 sb.append(" Namespace for business related constructs\n");
662 sb.append(" properties:\n");
663 sb.append(" customers:\n");
664 sb.append(" type: array\n");
665 sb.append(" items:\n");
666 sb.append(" $ref: \"#/patchDefinitions/customer\"\n");
667 sb.append(" customer:\n");
668 sb.append(" description: |\n");
669 sb.append(" customer identifiers to provide linkage back to BSS information.\n");
670 sb.append(" ###### Related Nodes\n");
671 sb.append(" - FROM service-subscription( service-subscription BelongsTo customer, MANY2ONE)(1)\n");
673 sb.append(" -(1) IF this CUSTOMER node is deleted, this FROM node is DELETED also\n");
674 sb.append(" required:\n");
675 sb.append(" - global-customer-id\n");
676 sb.append(" - subscriber-name\n");
677 sb.append(" - subscriber-type\n");
678 sb.append(" properties:\n");
679 sb.append(" global-customer-id:\n");
680 sb.append(" type: string\n");
681 sb.append(" description: Global customer id used across ECOMP to uniquely identify customer.\n");
682 sb.append(" subscriber-name:\n");
683 sb.append(" type: string\n");
684 sb.append(" description: Subscriber name, an alternate way to retrieve a customer.\n");
685 sb.append(" subscriber-type:\n");
686 sb.append(" type: string\n");
687 sb.append(" description: Subscriber type, a way to provide VID with only the INFRA customers.\n");
688 sb.append(" customers:\n");
689 sb.append(" description: |\n");
690 sb.append(" Collection of customer identifiers to provide linkage back to BSS information.\n");
691 sb.append(" properties:\n");
692 sb.append(" customer:\n");
693 sb.append(" type: array\n");
694 sb.append(" items: \n");
695 sb.append(" $ref: \"#/patchDefinitions/customer\"\n");
696 sb.append(" inventory:\n");
697 sb.append(" properties:\n");
698 sb.append(" business:\n");
699 sb.append(" type: object\n");
700 sb.append(" $ref: \"#/patchDefinitions/business\"\n");
701 sb.append(" nodes:\n");
702 sb.append(" properties:\n");
703 sb.append(" inventory-item-data:\n");
704 sb.append(" type: array\n");
705 sb.append(" items:\n");
706 sb.append(" $ref: \"#/patchDefinitions/inventory-item-data\"\n");
707 sb.append(" service-subscription:\n");
708 sb.append(" description: |\n");
709 sb.append(" Object that group service instances.\n");
710 sb.append(" ###### Related Nodes\n");
711 sb.append(" - TO customer( service-subscription BelongsTo customer, MANY2ONE)(4)\n");
712 sb.append(" - TO tenant( service-subscription Uses tenant, MANY2MANY)\n");
713 sb.append(" - FROM service-instance( service-instance BelongsTo service-subscription, MANY2ONE)(1)\n");
715 sb.append(" -(1) IF this SERVICE-SUBSCRIPTION node is deleted, this FROM node is DELETED also\n");
716 sb.append(" -(4) IF this TO node is deleted, this SERVICE-SUBSCRIPTION is DELETED also\n");
717 sb.append(" required:\n");
718 sb.append(" - service-type\n");
719 sb.append(" properties:\n");
720 sb.append(" service-type:\n");
721 sb.append(" type: string\n");
722 sb.append(" description: Value defined by orchestration to identify this service across ECOMP.\n");
723 sb.append(" temp-ub-sub-account-id:\n");
724 sb.append(" type: string\n");
725 sb.append(" description: This property will be deleted from A&AI in the near future. Only stop gap solution.\n");
726 sb.append(" service-subscriptions:\n");
727 sb.append(" description: |\n");
728 sb.append(" Collection of objects that group service instances.\n");
729 sb.append(" properties:\n");
730 sb.append(" service-subscription:\n");
731 sb.append(" type: array\n");
732 sb.append(" items: \n");
733 sb.append(" $ref: \"#/patchDefinitions/service-subscription\"\n");
734 return sb.toString();
736 public String YAMLgetDefs() {
737 StringBuilder sb = new StringBuilder(8092);
738 sb.append("getDefinitions:\n");
739 sb.append(" business:\n");
740 sb.append(" description: |\n");
741 sb.append(" Namespace for business related constructs\n");
742 sb.append(" properties:\n");
743 sb.append(" customers:\n");
744 sb.append(" type: array\n");
745 sb.append(" items:\n");
746 sb.append(" $ref: \"#/getDefinitions/customer\"\n");
747 sb.append(" customer:\n");
748 sb.append(" description: |\n");
749 sb.append(" customer identifiers to provide linkage back to BSS information.\n");
750 sb.append(" ###### Related Nodes\n");
751 sb.append(" - FROM service-subscription( service-subscription BelongsTo customer, MANY2ONE)(1)\n");
753 sb.append(" -(1) IF this CUSTOMER node is deleted, this FROM node is DELETED also\n");
754 sb.append(" required:\n");
755 sb.append(" - global-customer-id\n");
756 sb.append(" - subscriber-name\n");
757 sb.append(" - subscriber-type\n");
758 sb.append(" properties:\n");
759 sb.append(" global-customer-id:\n");
760 sb.append(" type: string\n");
761 sb.append(" description: Global customer id used across ECOMP to uniquely identify customer.\n");
762 sb.append(" subscriber-name:\n");
763 sb.append(" type: string\n");
764 sb.append(" description: Subscriber name, an alternate way to retrieve a customer.\n");
765 sb.append(" subscriber-type:\n");
766 sb.append(" type: string\n");
767 sb.append(" description: Subscriber type, a way to provide VID with only the INFRA customers.\n");
768 sb.append(" resource-version:\n");
769 sb.append(" type: string\n");
770 sb.append(" description: Used for optimistic concurrency. Must be empty on create, valid on update and delete.\n");
771 sb.append(" service-subscriptions:\n");
772 sb.append(" type: array\n");
773 sb.append(" items:\n");
774 sb.append(" $ref: \"#/getDefinitions/service-subscription\"\n");
775 sb.append(" customers:\n");
776 sb.append(" description: |\n");
777 sb.append(" Collection of customer identifiers to provide linkage back to BSS information.\n");
778 sb.append(" properties:\n");
779 sb.append(" customer:\n");
780 sb.append(" type: array\n");
781 sb.append(" items: \n");
782 sb.append(" $ref: \"#/getDefinitions/customer\"\n");
783 sb.append(" inventory:\n");
784 sb.append(" properties:\n");
785 sb.append(" business:\n");
786 sb.append(" type: object\n");
787 sb.append(" $ref: \"#/getDefinitions/business\"\n");
788 sb.append(" nodes:\n");
789 sb.append(" properties:\n");
790 sb.append(" inventory-item-data:\n");
791 sb.append(" type: array\n");
792 sb.append(" items:\n");
793 sb.append(" $ref: \"#/getDefinitions/inventory-item-data\"\n");
794 sb.append(" service-subscription:\n");
795 sb.append(" description: |\n");
796 sb.append(" Object that group service instances.\n");
797 sb.append(" ###### Related Nodes\n");
798 sb.append(" - TO customer( service-subscription BelongsTo customer, MANY2ONE)(4)\n");
799 sb.append(" - TO tenant( service-subscription Uses tenant, MANY2MANY)\n");
800 sb.append(" - FROM service-instance( service-instance BelongsTo service-subscription, MANY2ONE)(1)\n");
802 sb.append(" -(1) IF this SERVICE-SUBSCRIPTION node is deleted, this FROM node is DELETED also\n");
803 sb.append(" -(4) IF this TO node is deleted, this SERVICE-SUBSCRIPTION is DELETED also\n");
804 sb.append(" required:\n");
805 sb.append(" - service-type\n");
806 sb.append(" properties:\n");
807 sb.append(" service-type:\n");
808 sb.append(" type: string\n");
809 sb.append(" description: Value defined by orchestration to identify this service across ECOMP.\n");
810 sb.append(" temp-ub-sub-account-id:\n");
811 sb.append(" type: string\n");
812 sb.append(" description: This property will be deleted from A&AI in the near future. Only stop gap solution.\n");
813 sb.append(" resource-version:\n");
814 sb.append(" type: string\n");
815 sb.append(" description: Used for optimistic concurrency. Must be empty on create, valid on update and delete.\n");
816 sb.append(" service-subscriptions:\n");
817 sb.append(" description: |\n");
818 sb.append(" Collection of objects that group service instances.\n");
819 sb.append(" properties:\n");
820 sb.append(" service-subscription:\n");
821 sb.append(" type: array\n");
822 sb.append(" items: \n");
823 sb.append(" $ref: \"#/getDefinitions/service-subscription\"\n");
824 return sb.toString();