Merge "Error in Jetty logs" into release-1.1.0
authorMichael Lando <ml636r@att.com>
Wed, 15 Nov 2017 09:24:55 +0000 (09:24 +0000)
committerGerrit Code Review <gerrit@onap.org>
Wed, 15 Nov 2017 09:24:55 +0000 (09:24 +0000)
catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaExportHandler.java
docs/images/SDC_In_ONAP.png
sdc-os-chef/scripts/docker_run.sh

index e65c4b5..1f29eb2 100644 (file)
@@ -938,12 +938,12 @@ public class ToscaExportHandler {
                if(CollectionUtils.isEmpty(filteredRelations)){
                        result = true;
                } else {
-                       result = !filteredRelations.stream().filter(rel -> !addRequirement(componentInstance, originComponent, component.getComponentInstances(), rel, toscaRequirements)).findFirst().isPresent();
+                       result = !filteredRelations.stream().filter(rel -> !addRequirement(component,componentInstance, originComponent, component.getComponentInstances(), rel, toscaRequirements)).findFirst().isPresent();
                }
                return result;
        }
        
-       private boolean addRequirement(ComponentInstance fromInstance, Component originComponent, List<ComponentInstance> instancesList, RequirementCapabilityRelDef rel, List<Map<String, ToscaTemplateRequirement>> toscaRequirements){
+       private boolean addRequirement(Component component,ComponentInstance fromInstance, Component originComponent, List<ComponentInstance> instancesList, RequirementCapabilityRelDef rel, List<Map<String, ToscaTemplateRequirement>> toscaRequirements){
                
                boolean result = true;
                Map<String,Component> originComponents = new HashMap<>();
@@ -962,7 +962,13 @@ public class ToscaExportHandler {
                        result = false;
                }
                if(result){
-                       reqOpt = findRequirement(reqMap, reqAndRelationshipPair.getRequirementUid());
+
+                       if(component.getComponentType().equals(ComponentTypeEnum.SERVICE)) {
+                               reqOpt = findRequirement(reqMap, reqAndRelationshipPair);
+                       }
+                       else {
+                               reqOpt = findRequirement(reqMap, reqAndRelationshipPair.getRequirementUid());
+                       }
                        if(!reqOpt.isPresent()){
                                log.debug("Failed to find a requirement with uniqueId {} on a component with uniqueId {}", reqAndRelationshipPair.getRequirementUid(), originComponent.getUniqueId());
                                result = false;
@@ -1020,7 +1026,23 @@ public class ToscaExportHandler {
                }
                return Optional.empty();
        }
+       
+       private Optional<RequirementDefinition> findRequirement(Map<String, List<RequirementDefinition>> reqMap, RequirementAndRelationshipPair reqAndRelationshipPair) {
+               for(List<RequirementDefinition> reqList: reqMap.values()){
+                       Optional<RequirementDefinition> reqOpt = reqList.stream().filter(r -> 
+                               isRequirmentBelongTo(reqAndRelationshipPair, r))
+                                       .findFirst();
+                       if(reqOpt.isPresent()){
+                               return reqOpt;
+                       }
+               }
+               return Optional.empty();
+       }
 
+       private boolean isRequirmentBelongTo(RequirementAndRelationshipPair reqAndRelationshipPair, RequirementDefinition r) {
+               return StringUtils.isNotEmpty(r.getOwnerId()) && r.getOwnerId().equals(reqAndRelationshipPair.getRequirementOwnerId()) 
+                               && StringUtils.isNotEmpty(r.getName()) && r.getName().equals(reqAndRelationshipPair.getRequirement());
+       }
 
        private Either<SubstitutionMapping, ToscaError> convertCapabilities(Component component, SubstitutionMapping substitutionMappings) {
                
index ddca064..9c91d73 100644 (file)
Binary files a/docs/images/SDC_In_ONAP.png and b/docs/images/SDC_In_ONAP.png differ
index b147c81..ed4246d 100755 (executable)
@@ -59,44 +59,24 @@ LOCAL=false
 SKIPTESTS=false
 DEBUG_PORT="--publish 4000:4000"
 
-[ -f /opt/config/env_name.txt ] && DEP_ENV=$(cat /opt/config/env_name.txt) || DEP_ENV=__ENV-NAME__
-[ -f /opt/config/nexus_username.txt ] && NEXUS_USERNAME=$(cat /opt/config/nexus_username.txt)    || NEXUS_USERNAME=release
-[ -f /opt/config/nexus_password.txt ] && NEXUS_PASSWD=$(cat /opt/config/nexus_password.txt)      || NEXUS_PASSWD=sfWU3DFVdBr7GVxB85mTYgAW
-[ -f /opt/config/nexus_docker_repo.txt ] && NEXUS_DOCKER_REPO=$(cat /opt/config/nexus_docker_repo.txt) || NEXUS_DOCKER_REPO=ecomp-nexus:${PORT}
-
-while test $# -gt 0; do
+while [ $# -gt 0 ]
+do
     case $1 in
-        -r | --release )
-            shift
-            RELEASE=$1
-            ;;
-        -e | --environment )
-                       shift
-            DEP_ENV=$1
-            ;;
-               -p | --port )
-            shift
-            PORT=$1
-                       ;;
-       -l | --local )
-           shift
-           LOCAL=true
-           ;;
-       -s | --skipTests )
-          shift
-          SKIPTESTS=true
-               ;;
-        -h | --help )
-                       usage
-            exit
-            ;;
-        * )
-               usage
-            exit 1
+        -r | --release )     shift 1 ;  RELEASE=$1     ; shift 1 ;;
+        -e | --environment ) shift 1 ;  DEP_ENV=$1     ; shift 1 ;;
+       -p | --port )        shift 1 ;  PORT=$1        ; shift 1 ;;
+       -l | --local )                  LOCAL=true     ; shift 1 ;;
+       -s | --skipTests )              SKIPTESTS=true ; shift 1 ;;
+        -h | --help )                   usage          ; exit  0  ;;
+        * )                            usage          ; exit  1  ;;
     esac
 done
 
 
+[ -f /opt/config/env_name.txt ] && DEP_ENV=$(cat /opt/config/env_name.txt) || DEP_ENV=__ENV-NAME__
+[ -f /opt/config/nexus_username.txt ] && NEXUS_USERNAME=$(cat /opt/config/nexus_username.txt)    || NEXUS_USERNAME=release
+[ -f /opt/config/nexus_password.txt ] && NEXUS_PASSWD=$(cat /opt/config/nexus_password.txt)      || NEXUS_PASSWD=sfWU3DFVdBr7GVxB85mTYgAW
+[ -f /opt/config/nexus_docker_repo.txt ] && NEXUS_DOCKER_REPO=$(cat /opt/config/nexus_docker_repo.txt) || NEXUS_DOCKER_REPO=nexus3.onap.org:${PORT}
 [ -f /opt/config/nexus_username.txt ] && docker login -u $NEXUS_USERNAME -p $NEXUS_PASSWD $NEXUS_DOCKER_REPO
 
 
@@ -118,7 +98,7 @@ if [ ${LOCAL} = false ]; then
        echo "pulling code"
        docker pull ${PREFIX}/sdc-elasticsearch:${RELEASE}
 fi
-docker run --detach --name sdc-es --env ENVNAME="${DEP_ENV}" --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --memory 1g --memory-swap=1g --ulimit memlock=-1:-1 --ulimit nofile=4096:100000 --volume /etc/localtime:/etc/localtime:ro -e ES_HEAP_SIZE=1024M --volume /data/ES:/usr/share/elasticsearch/data --volume /data/environments:/root/chef-solo/environments --publish 9200:9200 --publish 9300:9300 ${PREFIX}/sdc-elasticsearch:${RELEASE}
+docker run --detach --name sdc-es --env ENVNAME="${DEP_ENV}" --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --memory 750m --memory-swap=750m -e ES_JAVA_OPTS="-Xms512m -Xmx512m" --ulimit memlock=-1:-1 --ulimit nofile=4096:100000 --volume /etc/localtime:/etc/localtime:ro -e ES_HEAP_SIZE=1024M --volume /data/ES:/usr/share/elasticsearch/data --volume /data/environments:/root/chef-solo/environments --publish 9200:9200 --publish 9300:9300 ${PREFIX}/sdc-elasticsearch:${RELEASE}
 
 
 # cassandra
@@ -212,5 +192,6 @@ echo "Triger sanity docker, please wait..."
     if [ ${LOCAL} = false ]; then
           docker pull ${PREFIX}/sdc-sanity:${RELEASE}
     fi
-       docker run --detach --name sdc-sanity --env HOST_IP=${IP} --env ENVNAME="${DEP_ENV}" --env http_proxy=${http_proxy} --env https_proxy=${https_proxy} --env no_proxy=${no_proxy} --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --ulimit memlock=-1:-1 --memory 1g --memory-swap=1g --ulimit nofile=4096:100000 --volume /etc/localtime:/etc/localtime:ro --volume /data/logs/sdc-sanity/target:/var/lib/tests/target --volume /data/logs/sdc-sanity/ExtentReport:/var/lib/tests/ExtentReport --volume /data/logs/sdc-sanity/outputCsar:/var/lib/tests/outputCsar --volume /data/environments:/root/chef-solo/environments --publish 9560:9560 ${PREFIX}/sdc-sanity:${RELEASE}
-fi
\ No newline at end of file
+
+docker run --detach --name sdc-sanity --env HOST_IP=${IP} --env ENVNAME="${DEP_ENV}" --env http_proxy=${http_proxy} --env https_proxy=${https_proxy} --env no_proxy=${no_proxy} --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --ulimit memlock=-1:-1 --memory 1500m --memory-swap=1500m --ulimit nofile=4096:100000 --volume /etc/localtime:/etc/localtime:ro --volume /data/logs/sdc-sanity/target:/var/lib/tests/target --volume /data/logs/sdc-sanity/ExtentReport:/var/lib/tests/ExtentReport --volume /data/logs/sdc-sanity/outputCsar:/var/lib/tests/outputCsar --volume /data/environments:/root/chef-solo/environments --publish 9560:9560 ${PREFIX}/sdc-sanity:${RELEASE}
+fi