Add external tls info to bpgenerator and component spec schema
[dcaegen2/platform.git] / mod / bpgenerator / src / main / java / org / onap / blueprintgenerator / models / onapbp / OnapNode.java
index 2b0b8c0..b0d1302 100644 (file)
 
 package org.onap.blueprintgenerator.models.onapbp;
 
+import java.util.ArrayList;
 import java.util.LinkedHashMap;
 import java.util.TreeMap;
 
+import org.onap.blueprintgenerator.core.PgaasNodeBuilder;
+import org.onap.blueprintgenerator.core.PolicyNodeBuilder;
 import org.onap.blueprintgenerator.models.blueprint.Interfaces;
 import org.onap.blueprintgenerator.models.blueprint.Node;
 import org.onap.blueprintgenerator.models.blueprint.Properties;
@@ -45,8 +48,7 @@ import lombok.NoArgsConstructor;
 @JsonInclude(value=Include.NON_NULL)
 
 public class OnapNode extends Node{
-       private TreeMap<String, Interfaces> interfaces;
-       private Properties properties;
+
        public TreeMap<String, LinkedHashMap<String, Object>> createOnapNode(TreeMap<String, LinkedHashMap<String, Object>> inps, ComponentSpec cs, String override) {
                TreeMap<String, LinkedHashMap<String, Object>> retInputs = new TreeMap<String, LinkedHashMap<String, Object>>();
                retInputs = inps;
@@ -59,7 +61,24 @@ public class OnapNode extends Node{
                this.setInterfaces(interfaces);
 
                //set the type
-               this.setType("dcae.nodes.ContainerizedPlatformComponent");
+               this.setType("dcae.nodes.ContainerizedServiceComponent");
+
+               //create and set the relationships
+               ArrayList<LinkedHashMap<String, String>> rets = new ArrayList();
+
+               //add relationship for policy if exist
+               if(cs.getPolicyInfo() != null){
+                       ArrayList<LinkedHashMap<String, String>> policyRelationshipsList = PolicyNodeBuilder.getPolicyRelationships(cs);
+                       rets.addAll(policyRelationshipsList);
+               }
+
+               //add relationships and env_variables for pgaas dbs if exist
+               if(cs.getAuxilary().getDatabases() != null){
+                       ArrayList<LinkedHashMap<String, String>> pgaasRelationshipsList = PgaasNodeBuilder.getPgaasNodeRelationships(cs);
+                       rets.addAll(pgaasRelationshipsList);
+               }
+
+               this.setRelationships(rets);
 
                //set the properties
                Properties props = new Properties();
@@ -68,4 +87,4 @@ public class OnapNode extends Node{
 
                return retInputs;
        }
-}
\ No newline at end of file
+}