f926b40bc24540cc8b56b815b2e946e801425f93
[aai/schema-service.git] / aai-schema-gen / src / test / java / org / onap / aai / schemagen / genxsd / NodesYAMLfromOXMTest.java
1 /**
2  * ============LICENSE_START=======================================================
3  * org.onap.aai
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
10  *
11  *    http://www.apache.org/licenses/LICENSE-2.0
12  *
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=========================================================
19  */
20 package org.onap.aai.schemagen.genxsd;
21
22 import org.junit.Before;
23 import org.junit.BeforeClass;
24 import org.junit.Test;
25 import org.junit.runner.RunWith;
26 import org.onap.aai.edges.EdgeIngestor;
27 import org.onap.aai.nodes.NodeIngestor;
28 import org.onap.aai.schemagen.SwaggerGenerationConfiguration;
29 import org.onap.aai.schemagen.testutils.TestUtilConfigTranslatorforEdges;
30 import org.onap.aai.setup.SchemaLocationsBean;
31 import org.onap.aai.setup.SchemaVersion;
32 import org.onap.aai.setup.SchemaVersions;
33 import org.slf4j.Logger;
34 import org.slf4j.LoggerFactory;
35 import org.springframework.beans.factory.annotation.Autowired;
36 import org.springframework.context.annotation.AnnotationConfigApplicationContext;
37 import org.springframework.test.context.ContextConfiguration;
38 import org.springframework.test.context.TestPropertySource;
39 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
40 import org.w3c.dom.Element;
41
42 import java.io.BufferedWriter;
43 import java.io.File;
44 import java.io.FileWriter;
45 import java.io.IOException;
46 import java.nio.charset.Charset;
47 import java.nio.file.Files;
48 import java.nio.file.Path;
49 import java.nio.file.Paths;
50
51 import static org.hamcrest.CoreMatchers.is;
52 import static org.junit.Assert.assertThat;
53
54 @RunWith(SpringJUnit4ClassRunner.class)
55 @ContextConfiguration(classes = {
56                 SchemaVersions.class,
57         SchemaLocationsBean.class,
58         TestUtilConfigTranslatorforEdges.class,
59         EdgeIngestor.class,
60         NodeIngestor.class,
61                 SwaggerGenerationConfiguration.class
62
63 })
64 @TestPropertySource(properties = {
65                 "schema.uri.base.path = /aai",
66                 "schema.xsd.maxoccurs = 5000"
67 })
68 public class NodesYAMLfromOXMTest {
69 //public class NodesYAMLfromOXMTest extends AAISetup {
70         private static final Logger logger = LoggerFactory.getLogger("NodesYAMLfromOXMTest.class");
71         private static final String OXMFILENAME = "src/test/resources/oxm/business_v11.xml";
72         private static final String EDGEFILENAME = "src/test/resources/dbedgerules/EdgeDescriptionRules_test.json";
73         public static AnnotationConfigApplicationContext ctx = null;
74         private static String testXML;
75
76         @Autowired
77         NodesYAMLfromOXM nodesYamlFromOxm;
78         @Autowired
79     SchemaVersions schemaVersions;
80
81         @BeforeClass
82         public static void setUpBeforeClass() throws Exception {
83
84                 XSDElementTest x = new XSDElementTest();
85                 x.setUp();
86                 testXML = x.testXML;
87                 logger.debug(testXML);
88                 BufferedWriter bw = new BufferedWriter(new FileWriter(OXMFILENAME));
89                 bw.write(testXML);
90                 bw.close();
91                 BufferedWriter bw1 = new BufferedWriter(new FileWriter(EDGEFILENAME));
92                 bw1.write(YAMLfromOXMTest.EdgeDefs());
93                 bw1.close();
94
95
96         }
97
98         @Before
99         public void setUp() throws Exception {
100
101                 NodeGetOperation.checklist.clear();
102                 XSDElementTest x = new XSDElementTest();
103                 x.setUp();
104                 testXML = x.testXML;
105
106                 logger.debug(testXML);
107         }
108
109         @Test
110         public void testGetDocumentHeader() {
111                 SchemaVersion v = schemaVersions.getAppRootVersion();
112                 String apiVersion = v.toString();
113                 String header = null;
114                 try {
115                         nodesYamlFromOxm.setXmlVersion(testXML, v);
116                         nodesYamlFromOxm.process();
117                         header = nodesYamlFromOxm.getDocumentHeader();
118                 } catch(Exception e) {
119                         e.printStackTrace();
120                 }
121                 assertThat("Header:\n"+header,header, is(YAMLheader()));
122         }
123
124         @Test
125         public void testProcess() {
126
127                 SchemaVersion v = schemaVersions.getAppRootVersion();
128                 String apiVersion = v.toString();
129                 String fileContent = null;
130                 try {
131                         nodesYamlFromOxm.setXmlVersion(testXML, v);
132                         fileContent = nodesYamlFromOxm.process();
133                 } catch(Exception e) {
134                         e.printStackTrace();
135                 }
136                 assertThat("FileContent-I:\n"+fileContent,fileContent, is(YAMLresult()));
137         }
138
139         @Test
140         public void testNodesYAMLfromOXMFileVersionFile() throws IOException {
141                 String outfileName = "testXML.xml";
142                 File XMLfile = new File(outfileName);
143                 XMLfile.createNewFile();
144                 BufferedWriter bw = null;
145                 Charset charset = Charset.forName("UTF-8");
146                 Path path = Paths.get(outfileName);
147                 bw = Files.newBufferedWriter(path, charset);
148                 bw.write(testXML);
149                 bw.close();
150                 SchemaVersion v = schemaVersions.getAppRootVersion();
151                 String apiVersion = v.toString();
152                 String fileContent = null;
153                 try {
154                         nodesYamlFromOxm.setXmlVersion(testXML, v);
155                         fileContent = nodesYamlFromOxm.process();
156                 } catch(Exception e) {
157                         e.printStackTrace();
158                 }
159                 XMLfile.delete();
160                 assertThat("FileContent:\n"+fileContent,fileContent, is(YAMLresult()));
161          }
162
163         @Test
164         public void testNodesYAMLfromOXMStringVersionFile() {
165                 SchemaVersion v = schemaVersions.getAppRootVersion();
166                 String apiVersion = v.toString();
167                 String fileContent = null;
168                 try {
169                         nodesYamlFromOxm.setXmlVersion(testXML, v);
170                         fileContent = nodesYamlFromOxm.process();
171                 } catch(Exception e) {
172                         e.printStackTrace();
173                 }
174                 assertThat("FileContent-II:\n"+fileContent,fileContent, is(YAMLresult()));
175         }
176
177         @Test
178         public void testAppendDefinitions() {
179                 SchemaVersion v = schemaVersions.getAppRootVersion();
180                 String apiVersion = v.toString();
181                 String definitions = null;
182                 try {
183                         nodesYamlFromOxm.setXmlVersion(testXML, v);
184                         nodesYamlFromOxm.process();
185                         definitions = nodesYamlFromOxm.appendDefinitions();
186                 } catch(Exception e) {
187                         e.printStackTrace();
188                 }
189                 assertThat("Definitions:\n"+definitions,definitions, is(YAMLgetDefs()));
190         }
191
192         @Test
193         public void testGetXMLRootElementName() {
194                 String target = "RootElement=customer";
195                 SchemaVersion v = schemaVersions.getAppRootVersion();
196                 String apiVersion = v.toString();
197                 Element customer = null;
198                 String root = null;
199                 try {
200                         nodesYamlFromOxm.setXmlVersion(testXML, v);
201                         nodesYamlFromOxm.process();
202                         customer = nodesYamlFromOxm.getJavaTypeElementSwagger("Customer");
203                         root = nodesYamlFromOxm.getXMLRootElementName(customer);
204                 } catch(Exception e) {
205                         e.printStackTrace();
206                 }
207                 assertThat("RootElement="+root, is(target));
208         }
209
210         @Test
211         public void testGetXmlRootElementName() {
212                 String target = "RootElement=customer";
213                 SchemaVersion v = schemaVersions.getAppRootVersion();
214                 String apiVersion = v.toString();
215                 String root = null;
216                 try {
217                         nodesYamlFromOxm.setXmlVersion(testXML, v);
218                         nodesYamlFromOxm.process();
219                         root = nodesYamlFromOxm.getXmlRootElementName("Customer");
220                 } catch(Exception e) {
221                         e.printStackTrace();
222                 }
223                 assertThat("RootElement="+root, is(target));
224         }
225
226         @Test
227         public void testGetJavaTypeElementSwagger() {
228                 String target = "Element=java-type/Customer";
229                 SchemaVersion v = schemaVersions.getAppRootVersion();
230                 String apiVersion = v.toString();
231                 Element customer = null;
232                 try {
233                         nodesYamlFromOxm.setXmlVersion(testXML, v);
234                         nodesYamlFromOxm.process();
235                         customer = nodesYamlFromOxm.getJavaTypeElementSwagger("Customer");
236                 } catch(Exception e) {
237                         e.printStackTrace();
238                 }
239                 assertThat("Element="+customer.getNodeName()+"/"+customer.getAttribute("name"), is(target));
240         }
241
242         public String YAMLresult() {
243                 StringBuilder sb = new StringBuilder(32368);
244                 sb.append(YAMLheader());
245                 sb.append(YAMLops());
246 //              sb.append(YAMLdefs());
247 //              sb.append(YAMLpatchDefs());
248                 sb.append(YAMLgetDefs());
249                 return sb.toString();
250         }
251         public String YAMLheader() {
252                 StringBuilder sb = new StringBuilder(1500);
253                 sb.append("swagger: \"2.0\"\n");
254                 sb.append("info:\n");
255                 sb.append("  description: |\n");
256                 sb.append("\n");
257                 sb.append("    [Differences versus the previous schema version](apidocs/aai_swagger_v11.diff)\n");
258                 sb.append("\n");
259                 sb.append("    Copyright © 2017-18 AT&T Intellectual Property. All rights reserved.\n");
260                 sb.append("\n");
261                 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");
262                 sb.append("\n");
263                 sb.append("    You may obtain a copy of the License at\n");
264                 sb.append("\n");
265                 sb.append("    (https://creativecommons.org/licenses/by/4.0/)\n");
266                 sb.append("\n");
267                 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");
268                 sb.append("\n");
269                 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");
270                 sb.append("  version: \"v11\"\n");
271                 sb.append("  title: Active and Available Inventory REST API\n");
272                 sb.append("  license:\n");
273                 sb.append("    name: Apache 2.0\n");
274                 sb.append("    url: http://www.apache.org/licenses/LICENSE-2.0.html\n");
275                 sb.append("  contact:\n");
276                 sb.append("    name:\n");
277                 sb.append("    url:\n");
278                 sb.append("    email:\n");
279                 sb.append("host:\n");
280                 sb.append("basePath: /aai/v11\n");
281                 sb.append("schemes:\n");
282                 sb.append("  - https\n");
283                 sb.append("paths:\n");
284                 return sb.toString();
285         }
286
287         public String YAMLops() {
288                 StringBuilder sb = new StringBuilder(16384);
289                 sb.append("  /nodes/customers/customer/{global-customer-id}:\n");
290                 sb.append("    get:\n");
291                 sb.append("      tags:\n");
292                 sb.append("        - Operations\n");
293                 sb.append("      summary: returns customer\n");
294                 sb.append("      description: returns customer\n");
295                 sb.append("      operationId: getBusinessCustomersCustomer\n");
296                 sb.append("      produces:\n");
297                 sb.append("        - application/json\n");
298                 sb.append("        - application/xml\n");
299                 sb.append("      responses:\n");
300                 sb.append("        \"200\":\n");
301                 sb.append("          description: successful operation\n");
302                 sb.append("          schema:\n");
303                 sb.append("              $ref: \"#/definitions/customer\"\n");
304                 sb.append("        \"default\":\n");
305                 sb.append("          null\n      parameters:\n");
306                 sb.append("        - name: global-customer-id\n");
307                 sb.append("          in: path\n");
308                 sb.append("          description: Global customer id used across to uniquely identify customer.\n");
309                 sb.append("          required: true\n");
310                 sb.append("          type: string\n");
311                 sb.append("          example: __GLOBAL-CUSTOMER-ID__\n");
312                 sb.append("  /nodes/customers?parameter=value[&parameter2=value2]:\n");
313                 sb.append("    get:\n");
314                 sb.append("      tags:\n");
315                 sb.append("        - Operations\n");
316                 sb.append("      summary: returns customers\n");
317                 sb.append("      description: returns customers\n");
318                 sb.append("      operationId: getBusinessCustomers\n");
319                 sb.append("      produces:\n");
320                 sb.append("        - application/json\n");
321                 sb.append("        - application/xml\n");
322                 sb.append("      responses:\n");
323                 sb.append("        \"200\":\n");
324                 sb.append("          description: successful operation\n");
325                 sb.append("          schema:\n");
326                 sb.append("              $ref: \"#/definitions/customers\"\n");
327                 sb.append("        \"default\":\n");
328                 sb.append("          null\n      parameters:\n");
329                 sb.append("        - name: global-customer-id\n");
330                 sb.append("          in: query\n");
331                 sb.append("          description:\n");
332                 sb.append("          required: false\n");
333                 sb.append("          type: string\n");
334                 sb.append("        - name: subscriber-name\n");
335                 sb.append("          in: query\n");
336                 sb.append("          description:\n");
337                 sb.append("          required: false\n");
338                 sb.append("          type: string\n");
339                 sb.append("        - name: subscriber-type\n");
340                 sb.append("          in: query\n");
341                 sb.append("          description:\n");
342                 sb.append("          required: false\n");
343                 sb.append("          type: string\n");
344                 sb.append("  /nodes/service-subscriptions/service-subscription/{service-type}:\n");
345                 sb.append("    get:\n");
346                 sb.append("      tags:\n");
347                 sb.append("        - Operations\n");
348                 sb.append("      summary: returns service-subscription\n");
349                 sb.append("      description: returns service-subscription\n");
350                 sb.append("      operationId: getBusinessCustomersCustomerServiceSubscriptionsServiceSubscription\n");
351                 sb.append("      produces:\n");
352                 sb.append("        - application/json\n");
353                 sb.append("        - application/xml\n");
354                 sb.append("      responses:\n");
355                 sb.append("        \"200\":\n");
356                 sb.append("          description: successful operation\n");
357                 sb.append("          schema:\n");
358                 sb.append("              $ref: \"#/definitions/service-subscription\"\n");
359                 sb.append("        \"default\":\n");
360                 sb.append("          null\n      parameters:\n");
361                 sb.append("        - name: service-type\n");
362                 sb.append("          in: path\n");
363                 sb.append("          description: Value defined by orchestration to identify this service.\n");
364                 sb.append("          required: true\n");
365                 sb.append("          type: string\n");
366                 sb.append("          example: __SERVICE-TYPE__\n");
367                 sb.append("  /nodes/service-subscriptions?parameter=value[&parameter2=value2]:\n");
368                 sb.append("    get:\n");
369                 sb.append("      tags:\n");
370                 sb.append("        - Operations\n");
371                 sb.append("      summary: returns service-subscriptions\n");
372                 sb.append("      description: returns service-subscriptions\n");
373                 sb.append("      operationId: getBusinessCustomersCustomerServiceSubscriptions\n");
374                 sb.append("      produces:\n");
375                 sb.append("        - application/json\n");
376                 sb.append("        - application/xml\n");
377                 sb.append("      responses:\n");
378                 sb.append("        \"200\":\n");
379                 sb.append("          description: successful operation\n");
380                 sb.append("          schema:\n");
381                 sb.append("              $ref: \"#/definitions/service-subscriptions\"\n");
382                 sb.append("        \"default\":\n");
383                 sb.append("          null\n      parameters:\n");
384                 sb.append("        - name: service-type\n");
385                 sb.append("          in: query\n");
386                 sb.append("          description:\n");
387                 sb.append("          required: false\n");
388                 sb.append("          type: string\n");
389                 return sb.toString();
390         }
391         public String YAMLdefs() {
392                 StringBuilder sb = new StringBuilder(8092);
393                 sb.append("definitions:\n");
394                 sb.append("  business:\n");
395                 sb.append("    description: |\n");
396                 sb.append("      Namespace for business related constructs\n");
397                 sb.append("    properties:\n");
398                 sb.append("      customers:\n");
399                 sb.append("        type: array\n");
400                 sb.append("        items:\n");
401                 sb.append("          $ref: \"#/definitions/customer\"\n");
402                 sb.append("  customer:\n");
403                 sb.append("    description: |\n");
404                 sb.append("      customer identifiers to provide linkage back to BSS information.\n");
405                 sb.append("      ###### Related Nodes\n");
406                 sb.append("      - FROM service-subscription (CHILD of customer, service-subscription BelongsTo customer, MANY2ONE)(1)\n");
407                 sb.append("\n");
408                 sb.append("      -(1) IF this CUSTOMER node is deleted, this FROM node is DELETED also\n");
409                 sb.append("    required:\n");
410                 sb.append("    - global-customer-id\n");
411                 sb.append("    - subscriber-name\n");
412                 sb.append("    - subscriber-type\n");
413                 sb.append("    properties:\n");
414                 sb.append("      global-customer-id:\n");
415                 sb.append("        type: string\n");
416                 sb.append("        description: Global customer id used across to uniquely identify customer.\n");
417                 sb.append("      subscriber-name:\n");
418                 sb.append("        type: string\n");
419                 sb.append("        description: Subscriber name, an alternate way to retrieve a customer.\n");
420                 sb.append("      subscriber-type:\n");
421                 sb.append("        type: string\n");
422                 sb.append("        description: Subscriber type, a way to provide VID with only the INFRA customers.\n");
423                 sb.append("      resource-version:\n");
424                 sb.append("        type: string\n");
425                 sb.append("        description: Used for optimistic concurrency.  Must be empty on create, valid on update and delete.\n");
426                 sb.append("      service-subscriptions:\n");
427                 sb.append("        type: array\n");
428                 sb.append("        items:\n");
429                 sb.append("          $ref: \"#/definitions/service-subscription\"\n");
430                 sb.append("  customers:\n");
431                 sb.append("    description: |\n");
432                 sb.append("      Collection of customer identifiers to provide linkage back to BSS information.\n");
433                 sb.append("    properties:\n");
434                 sb.append("      customer:\n");
435                 sb.append("        type: array\n");
436                 sb.append("        items:          \n");
437                 sb.append("          $ref: \"#/definitions/customer\"\n");
438                 sb.append("  inventory:\n");
439                 sb.append("    properties:\n");
440                 sb.append("      business:\n");
441                 sb.append("        type: object\n");
442                 sb.append("        $ref: \"#/definitions/business\"\n");
443                 sb.append("  nodes:\n");
444                 sb.append("    properties:\n");
445                 sb.append("      inventory-item-data:\n");
446                 sb.append("        type: array\n");
447                 sb.append("        items:\n");
448                 sb.append("          $ref: \"#/definitions/inventory-item-data\"\n");
449                 sb.append("  service-subscription:\n");
450                 sb.append("    description: |\n");
451                 sb.append("      Object that group service instances.\n");
452                 sb.append("      ###### Related Nodes\n");
453                 sb.append("      - TO customer (PARENT of service-subscription, service-subscription BelongsTo customer, MANY2ONE)(4)\n");
454                 sb.append("      - TO tenant( service-subscription Uses tenant, MANY2MANY)\n");
455                 sb.append("      - FROM service-instance (CHILD of service-subscription, service-instance BelongsTo service-subscription, MANY2ONE)(1)\n");
456                 sb.append("\n");
457                 sb.append("      -(1) IF this SERVICE-SUBSCRIPTION node is deleted, this FROM node is DELETED also\n");
458                 sb.append("      -(4) IF this TO node is deleted, this SERVICE-SUBSCRIPTION is DELETED also\n");
459                 sb.append("    required:\n");
460                 sb.append("    - service-type\n");
461                 sb.append("    properties:\n");
462                 sb.append("      service-type:\n");
463                 sb.append("        type: string\n");
464                 sb.append("        description: Value defined by orchestration to identify this service.\n");
465                 sb.append("      temp-ub-sub-account-id:\n");
466                 sb.append("        type: string\n");
467                 sb.append("        description: This property will be deleted from A&AI in the near future. Only stop gap solution.\n");
468                 sb.append("      resource-version:\n");
469                 sb.append("        type: string\n");
470                 sb.append("        description: Used for optimistic concurrency.  Must be empty on create, valid on update and delete.\n");
471                 sb.append("  service-subscriptions:\n");
472                 sb.append("    description: |\n");
473                 sb.append("      Collection of objects that group service instances.\n");
474                 sb.append("    properties:\n");
475                 sb.append("      service-subscription:\n");
476                 sb.append("        type: array\n");
477                 sb.append("        items:          \n");
478                 sb.append("          $ref: \"#/definitions/service-subscription\"\n");
479                 return sb.toString();
480         }
481         public String YAMLpatchDefs() {
482                 StringBuilder sb = new StringBuilder(8092);
483                 sb.append("patchDefinitions:\n");
484                 sb.append("  business:\n");
485                 sb.append("    description: |\n");
486                 sb.append("      Namespace for business related constructs\n");
487                 sb.append("    properties:\n");
488                 sb.append("      customers:\n");
489                 sb.append("        type: array\n");
490                 sb.append("        items:\n");
491                 sb.append("          $ref: \"#/patchDefinitions/customer\"\n");
492                 sb.append("  customer:\n");
493                 sb.append("    description: |\n");
494                 sb.append("      customer identifiers to provide linkage back to BSS information.\n");
495                 sb.append("      ###### Related Nodes\n");
496                 sb.append("      - FROM service-subscription (CHILD of customer, service-subscription BelongsTo customer, MANY2ONE)(1)\n");
497                 sb.append("\n");
498                 sb.append("      -(1) IF this CUSTOMER node is deleted, this FROM node is DELETED also\n");
499                 sb.append("    required:\n");
500                 sb.append("    - global-customer-id\n");
501                 sb.append("    - subscriber-name\n");
502                 sb.append("    - subscriber-type\n");
503                 sb.append("    properties:\n");
504                 sb.append("      global-customer-id:\n");
505                 sb.append("        type: string\n");
506                 sb.append("        description: Global customer id used across to uniquely identify customer.\n");
507                 sb.append("      subscriber-name:\n");
508                 sb.append("        type: string\n");
509                 sb.append("        description: Subscriber name, an alternate way to retrieve a customer.\n");
510                 sb.append("      subscriber-type:\n");
511                 sb.append("        type: string\n");
512                 sb.append("        description: Subscriber type, a way to provide VID with only the INFRA customers.\n");
513                 sb.append("  customers:\n");
514                 sb.append("    description: |\n");
515                 sb.append("      Collection of customer identifiers to provide linkage back to BSS information.\n");
516                 sb.append("    properties:\n");
517                 sb.append("      customer:\n");
518                 sb.append("        type: array\n");
519                 sb.append("        items:          \n");
520                 sb.append("          $ref: \"#/patchDefinitions/customer\"\n");
521                 sb.append("  inventory:\n");
522                 sb.append("    properties:\n");
523                 sb.append("      business:\n");
524                 sb.append("        type: object\n");
525                 sb.append("        $ref: \"#/patchDefinitions/business\"\n");
526                 sb.append("  nodes:\n");
527                 sb.append("    properties:\n");
528                 sb.append("      inventory-item-data:\n");
529                 sb.append("        type: array\n");
530                 sb.append("        items:\n");
531                 sb.append("          $ref: \"#/patchDefinitions/inventory-item-data\"\n");
532                 sb.append("  service-subscription:\n");
533                 sb.append("    description: |\n");
534                 sb.append("      Object that group service instances.\n");
535                 sb.append("      ###### Related Nodes\n");
536                 sb.append("      - TO customer (CHILD of customer, service-subscription BelongsTo customer, MANY2ONE)(4)\n");
537                 sb.append("      - TO tenant( service-subscription Uses tenant, MANY2MANY)\n");
538                 sb.append("      - FROM service-instance (CHILD of service-subscription, service-instance BelongsTo service-subscription, MANY2ONE)(1)\n");
539                 sb.append("\n");
540                 sb.append("      -(1) IF this SERVICE-SUBSCRIPTION node is deleted, this FROM node is DELETED also\n");
541                 sb.append("      -(4) IF this TO node is deleted, this SERVICE-SUBSCRIPTION is DELETED also\n");
542                 sb.append("    required:\n");
543                 sb.append("    - service-type\n");
544                 sb.append("    properties:\n");
545                 sb.append("      service-type:\n");
546                 sb.append("        type: string\n");
547                 sb.append("        description: Value defined by orchestration to identify this service.\n");
548                 sb.append("      temp-ub-sub-account-id:\n");
549                 sb.append("        type: string\n");
550                 sb.append("        description: This property will be deleted from A&AI in the near future. Only stop gap solution.\n");
551                 sb.append("  service-subscriptions:\n");
552                 sb.append("    description: |\n");
553                 sb.append("      Collection of objects that group service instances.\n");
554                 sb.append("    properties:\n");
555                 sb.append("      service-subscription:\n");
556                 sb.append("        type: array\n");
557                 sb.append("        items:          \n");
558                 sb.append("          $ref: \"#/patchDefinitions/service-subscription\"\n");
559                 return sb.toString();
560         }
561         public String YAMLgetDefs() {
562                 StringBuilder sb = new StringBuilder(8092);
563                 sb.append("definitions:\n");
564                 sb.append("  business:\n");
565                 sb.append("    description: |\n");
566                 sb.append("      Namespace for business related constructs\n");
567                 sb.append("    properties:\n");
568                 sb.append("      customers:\n");
569                 sb.append("        type: array\n");
570                 sb.append("        items:\n");
571                 sb.append("          $ref: \"#/definitions/customer\"\n");
572                 sb.append("  customer:\n");
573                 sb.append("    description: |\n");
574                 sb.append("      customer identifiers to provide linkage back to BSS information.\n");
575                 sb.append("      ###### Related Nodes\n");
576                 sb.append("      - FROM service-subscription (CHILD of customer, service-subscription BelongsTo customer, MANY2ONE)(1)\n");
577                 sb.append("\n");
578                 sb.append("      -(1) IF this CUSTOMER node is deleted, this FROM node is DELETED also\n");
579                 sb.append("    required:\n");
580                 sb.append("    - global-customer-id\n");
581                 sb.append("    - subscriber-name\n");
582                 sb.append("    - subscriber-type\n");
583                 sb.append("    properties:\n");
584                 sb.append("      global-customer-id:\n");
585                 sb.append("        type: string\n");
586                 sb.append("        description: Global customer id used across to uniquely identify customer.\n");
587                 sb.append("      subscriber-name:\n");
588                 sb.append("        type: string\n");
589                 sb.append("        description: Subscriber name, an alternate way to retrieve a customer.\n");
590                 sb.append("      subscriber-type:\n");
591                 sb.append("        type: string\n");
592                 sb.append("        description: Subscriber type, a way to provide VID with only the INFRA customers.\n");
593                 sb.append("      resource-version:\n");
594                 sb.append("        type: string\n");
595                 sb.append("        description: Used for optimistic concurrency.  Must be empty on create, valid on update and delete.\n");
596                 sb.append("      service-subscriptions:\n");
597                 sb.append("        type: array\n");
598                 sb.append("        items:\n");
599                 sb.append("          $ref: \"#/definitions/service-subscription\"\n");
600                 sb.append("  customers:\n");
601                 sb.append("    description: |\n");
602                 sb.append("      Collection of customer identifiers to provide linkage back to BSS information.\n");
603                 sb.append("    properties:\n");
604                 sb.append("      customer:\n");
605                 sb.append("        type: array\n");
606                 sb.append("        items:          \n");
607                 sb.append("          $ref: \"#/definitions/customer\"\n");
608                 sb.append("  inventory:\n");
609                 sb.append("    properties:\n");
610                 sb.append("      business:\n");
611                 sb.append("        type: object\n");
612                 sb.append("        $ref: \"#/definitions/business\"\n");
613                 sb.append("  nodes:\n");
614                 sb.append("    properties:\n");
615                 sb.append("      inventory-item-data:\n");
616                 sb.append("        type: array\n");
617                 sb.append("        items:\n");
618                 sb.append("          $ref: \"#/definitions/inventory-item-data\"\n");
619                 sb.append("  service-subscription:\n");
620                 sb.append("    description: |\n");
621                 sb.append("      Object that group service instances.\n");
622                 sb.append("      ###### Related Nodes\n");
623                 sb.append("      - TO customer (PARENT of service-subscription, service-subscription BelongsTo customer, MANY2ONE)(4)\n");
624                 sb.append("      - TO tenant( service-subscription Uses tenant, MANY2MANY)\n");
625                 sb.append("      - FROM service-instance (CHILD of service-subscription, service-instance BelongsTo service-subscription, MANY2ONE)(1)\n");
626                 sb.append("\n");
627                 sb.append("      -(1) IF this SERVICE-SUBSCRIPTION node is deleted, this FROM node is DELETED also\n");
628                 sb.append("      -(4) IF this TO node is deleted, this SERVICE-SUBSCRIPTION is DELETED also\n");
629                 sb.append("    required:\n");
630                 sb.append("    - service-type\n");
631                 sb.append("    properties:\n");
632                 sb.append("      service-type:\n");
633                 sb.append("        type: string\n");
634                 sb.append("        description: Value defined by orchestration to identify this service.\n");
635                 sb.append("      temp-ub-sub-account-id:\n");
636                 sb.append("        type: string\n");
637                 sb.append("        description: This property will be deleted from A&AI in the near future. Only stop gap solution.\n");
638                 sb.append("      resource-version:\n");
639                 sb.append("        type: string\n");
640                 sb.append("        description: Used for optimistic concurrency.  Must be empty on create, valid on update and delete.\n");
641                 sb.append("  service-subscriptions:\n");
642                 sb.append("    description: |\n");
643                 sb.append("      Collection of objects that group service instances.\n");
644                 sb.append("    properties:\n");
645                 sb.append("      service-subscription:\n");
646                 sb.append("        type: array\n");
647                 sb.append("        items:          \n");
648                 sb.append("          $ref: \"#/definitions/service-subscription\"\n");
649                 return sb.toString();
650         }
651 }
652