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