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