diff options
Diffstat (limited to 'catalog-be/src/main/resources')
8 files changed, 345 insertions, 67 deletions
diff --git a/catalog-be/src/main/resources/application-context.xml b/catalog-be/src/main/resources/application-context.xml index b34ad69ffb..b3dcbc1de1 100644 --- a/catalog-be/src/main/resources/application-context.xml +++ b/catalog-be/src/main/resources/application-context.xml @@ -14,8 +14,8 @@ base-package= "org.openecomp.sdc.be.components.health, org.openecomp.sdc.be.servlets, org.openecomp.sdc.be.externalapi.servlet, - org.openecomp.sdc.be.components.scheduledtasks, - org.openecomp.sdc.be.model.jsontitan.utils"> + org.openecomp.sdc.be.components.scheduledtasks + "> </context:component-scan> <bean class="org.openecomp.sdc.be.dao.config.DAOSpringConfig"/> @@ -24,6 +24,14 @@ <bean class="org.openecomp.sdc.config.CatalogBESpringConfig"/> + <aop:config> + <aop:aspect id="lockAspect" ref="componentLockAspect"> + <aop:pointcut id="lockingTransaction" expression="@annotation(org.openecomp.sdc.be.components.impl.lock.LockingTransactional) and args(componentId, componentType,..)"/> + <aop:around method="lock" arg-names="proceedingJoinPoint,componentId,componentType" pointcut-ref="lockingTransaction"/> + </aop:aspect> + </aop:config> + + <util:properties id="elasticsearchConfig" location="file:${config.home}/elasticsearch.yml" /> </beans> diff --git a/catalog-be/src/main/resources/config/configuration.yaml b/catalog-be/src/main/resources/config/configuration.yaml index 991ed92e5d..527857f13d 100644 --- a/catalog-be/src/main/resources/config/configuration.yaml +++ b/catalog-be/src/main/resources/config/configuration.yaml @@ -23,9 +23,26 @@ beSslPort: 8443 version: 1.1.0 released: 2012-11-30 -toscaConformanceLevel: 10.0 +toscaConformanceLevel: 8.0 minToscaConformanceLevel: 3.0 +# These values are necessary for running upgrade migration 1710.0 process +enableAutoHealing: false +appVersion: 1.1.0 +artifactGeneratorConfig: Artifact-Generator.properties +resourcesForUpgrade: + 8.0: + - org.openecomp.resource.cp.extCP + - tosca.nodes.network.Network + - tosca.nodes.network.Port + - org.openecomp.resource.cp.nodes.network.SubInterface +skipUpgradeFailedVfs: true +skipUpgradeVSPs: true +autoHealingOwner: jh0003 +supportAllottedResourcesAndProxy: true +deleteLockTimeoutInSeconds: 60 +maxDeleteComponents: 10 + titanCfgFile: /home/vagrant/catalog-be/config/catalog-be/titan.properties titanInMemoryGraph: false titanLockTimeout: 1800 @@ -60,6 +77,8 @@ defaultImports: file: groups.yml - policies: file: policies.yml + - annotations: + file: annotations.yml # Users users: @@ -73,20 +92,22 @@ neo4j: password: "12345" cassandraConfig: - cassandraHosts: ['localhost'] - localDataCenter: datacenter1 + cassandraHosts: [192.168.33.10] + localDataCenter: DC-sdc-iltlv650 reconnectTimeout : 30000 - authenticate: false - username: koko - password: bobo - ssl: false - truststorePath : /path/path - truststorePassword : 123123 + authenticate: true + username: asdc_user + password: Aa1234%^! + ssl: true + truststorePath : /opt/app/jetty/base/be/config/.truststore + truststorePassword : Aa123456 keySpaces: - - { name: sdcaudit, replicationStrategy: SimpleStrategy, replicationInfo: ['1']} - - { name: sdcartifact, replicationStrategy: SimpleStrategy, replicationInfo: ['1']} - - { name: sdccomponent, replicationStrategy: SimpleStrategy, replicationInfo: ['1']} - - { name: sdcrepository, replicationStrategy: SimpleStrategy, replicationInfo: ['1']} + - { name: dox, replicationStrategy: NetworkTopologyStrategy, replicationInfo: ['DC-sdc-iltlv650', '1']} + - { name: sdcaudit, replicationStrategy: NetworkTopologyStrategy, replicationInfo: ['DC-sdc-iltlv650', '1']} + - { name: sdcartifact, replicationStrategy: NetworkTopologyStrategy, replicationInfo: ['DC-sdc-iltlv650', '1']} + - { name: sdccomponent, replicationStrategy: NetworkTopologyStrategy, replicationInfo: ['DC-sdc-iltlv650', '1']} + - { name: sdcrepository, replicationStrategy: NetworkTopologyStrategy, replicationInfo: ['DC-sdc-iltlv650', '1']} + #Application-specific settings of ES elasticSearch: @@ -133,7 +154,6 @@ artifactTypes: - SNMP_POLL - SNMP_TRAP - GUIDE - - PLAN licenseTypes: - User @@ -325,14 +345,6 @@ serviceDeploymentArtifacts: - xml OTHER: acceptedTypes: - -#PLAN - PLAN: - acceptedTypes: - - xml - validForResourceTypes: - - VF - - VFC resourceDeploymentArtifacts: HEAT: @@ -450,11 +462,6 @@ resourceDeploymentArtifacts: SNMP_TRAP: acceptedTypes: validForResourceTypes: *allResourceTypes - -#PLAN - PLAN: - acceptedTypes: - - xml resourceInstanceDeploymentArtifacts: HEAT_ENV: @@ -492,11 +499,6 @@ resourceInstanceDeploymentArtifacts: SNMP_TRAP: acceptedTypes: validForResourceTypes: *allResourceTypes - -#PLAN - PLAN: - acceptedTypes: - - xml resourceInformationalArtifacts: CHEF: @@ -714,6 +716,10 @@ excludedGroupTypesMapping: - org.openecomp.groups.VfModule - org.openecomp.groups.heat.HeatStack - tosca.groups.Root + PNF: + - org.openecomp.groups.VfModule + - org.openecomp.groups.heat.HeatStack + - tosca.groups.Root VF: - org.openecomp.groups.VfModule - org.openecomp.groups.heat.HeatStack @@ -727,4 +733,3 @@ healthStatusExclude: - DE - ES - DMAAP - diff --git a/catalog-be/src/main/resources/config/distribution-engine-configuration.yaml b/catalog-be/src/main/resources/config/distribution-engine-configuration.yaml index 5ebbe82985..4a788caaab 100644 --- a/catalog-be/src/main/resources/config/distribution-engine-configuration.yaml +++ b/catalog-be/src/main/resources/config/distribution-engine-configuration.yaml @@ -25,7 +25,7 @@ distribNotifResourceArtifactTypes: - DG-XML environments: - - PROD + - PROD_TEST distributionStatusTopic: pollingIntervalSec: 60 @@ -45,8 +45,8 @@ createTopic: startDistributionEngine: true - -useHttpsWithDmaap: false +useHttpsWithDmaap: true + opEnvRecoveryIntervalSec: 180 allowedTimeBeforeStaleSec: 300 diff --git a/catalog-be/src/main/resources/config/error-configuration.yaml b/catalog-be/src/main/resources/config/error-configuration.yaml index de5196e11e..26fee5b28e 100644 --- a/catalog-be/src/main/resources/config/error-configuration.yaml +++ b/catalog-be/src/main/resources/config/error-configuration.yaml @@ -350,7 +350,7 @@ errors: # %2 - resource/service COMPONENT_IN_USE: { code: 403, - message: "Error: Requested '%1' %2 is in use by another user.", + message: "Error: '%1' %2 is still held by previous action. Please try again later.", messageId: "SVC4086" } #-----------SVC4087--------------------------- @@ -575,13 +575,6 @@ errors: message: "Error: Invalid distribution environment.", messageId: "SVC4138" } -#---------SVC4139------------------------------ -# %1 - service name - DISTRIBUTION_ARTIFACT_NOT_FOUND: { - code: 409, - message: "Error: Service '%1' cannot be distributed due to missing deployment artifacts.", - messageId: "SVC4139" - } #---------SVC4200------------------------------ # %1 - Service/Resource # %2 - max icon name length @@ -2078,23 +2071,66 @@ errors: message: "Error: Interface operations not found in the resource %1", messageId: "SVC4701" } -#---------SVC46702----------------------------- +#---------SVC4702----------------------------- INTERFACE_OPERATION_NOT_DELETED: { code: 404, message: "Error: Failed to delete interface operation.", messageId: "SVC4702" } -#---------SVC4703----------------------------- +#-----------SVC4692--------------------------- + RESOURCE_LIFECYCLE_STATE_NOT_VALID: { + code: 400, + message: "Error: Lifecycle state %1 is not valid for resource", + messageId: "SVC4692" + } +#-----------SVC4693--------------------------- +#%1 - component name + COMPONENT_IS_ARCHIVED: { + code: 400, + message: "Error: Component %1 is arhived", + messageId: "SVC4693" + } +#-----------SVC4703--------------------------- +#%1 - component name + COMPONENT_IS_NOT_HIHGEST_CERTIFIED: { + code: 400, + message: "Error: Component %1 is not highest certified", + messageId: "SVC4703" + } +#---------SVC4704------------------------------ +# %1 - "service"/"VF" +# %2 - "Resource name" + ARCHIVED_ORIGINS_FOUND: { + code: 403, + message: "Error: Action is not permitted as your '%1' '%2' includes archived resources", + messageId: "SVC4704" + } +#---------SVC4705------------------------------ +# %1-artifact name + ARTIFACT_PAYLOAD_EMPTY: { + code: 400, + message: "Error: Invalid content. Uploaded file %1 is empty. Please retry with the correct file.", + messageId: "SVC4705" + } +#---------SVC4706------------------------------ +# %1-input(s) name(s) string + INPUTS_NOT_FOUND: { + code: 400, + message: "Error: missing input value(s) %1.", + messageId: "SVC4706" + } + #---------SVC4707----------------------------- # %1 – asset type [service / resource ] # %2 – main asset uuid ERROR_DURING_CSAR_CREATION: { code: 404, message: "Error: CSAR packaging failed for %1 %2.", - messageId: "SVC4702" + messageId: "SVC4706" } -#---------SVC46703----------------------------- +#---------SVC46708----------------------------- INTERFACE_OPERATION_INPUT_NAME_MANDATORY: { code: 404, message: "Error: Interface operation input parameter name should not be empty", - messageId: "SVC46703" - } + messageId: "SVC46707" + } + diff --git a/catalog-be/src/main/resources/config/logback.xml b/catalog-be/src/main/resources/config/logback.xml index b436f20c31..3ec6e45f3e 100644 --- a/catalog-be/src/main/resources/config/logback.xml +++ b/catalog-be/src/main/resources/config/logback.xml @@ -4,27 +4,34 @@ <property scope="system" name="ECOMP-component-name" value="SDC" /> <property scope="system" name="ECOMP-subcomponent-name" value="SDC-BE" /> <property file="${config.home}/catalog-be/configuration.yaml" /> - <property scope="context" name="enable-all-log" value="false" /> + <property scope="context" name="enable-all-log" value="true" /> <!-- value used by pattern field list (| - is inter-field separator, || - unavailable or not applicable field value) (m - mandatory, o- optional)--> <!--timestamp(m)| requestID(m)| serviceInstanceID(o)| threadID(m)| physicalServerName(o)| serviceName(m)| userID(m)| logLevel(m)| severity(o)| serverIpAddress(m)| serverName(m)| clientIpAddress(o)| className(m)| timer(o)| detailedMessage(o)--> <property name="default-log-pattern" - value="%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%X{BeginTimestamp}|%X{EndTimestamp}|%X{uuid}|%X{serviceInstanceID}|%thread|%X{ServerName}|%X{ServiceName}|${ECOMP-subcomponent-name}|%X{userId}|%X{TargetEntity}|%X{TargetServiceName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDescription}|%X{InstanceUUID}|%level|%X{alarmSeverity}|%X{localAddr}|%X{ElapsedTime}|${beFqdn}|%X{remoteAddr}|%logger{35}|%X{timer}|ActivityType=<%M>, Desc=<%msg>%n" /> + value="%date{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%X{BeginTimestamp}|%X{EndTimestamp}|%X{uuid}|%X{serviceInstanceID}|%thread|%X{ServerName}|%X{ServiceName}|${ECOMP-subcomponent-name}|%X{userId}|%X{TargetEntity}|%X{TargetServiceName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDescription}|%X{InstanceUUID}|%level|%X{alarmSeverity}|%X{localAddr}|%X{ElapsedTime}|${beFqdn}|%X{remoteAddr}|%logger{35}|%X{timer}|ActivityType=<%M>, Desc=<%msg>%n" /> - <property name="auditLoggerPattern" value="%X{BeginTimestamp}|%X{EndTimestamp}|%X{RequestId}|%X{ServiceInstanceId}|%thread|%X{VirtualServerName}|%X{ServiceName}|%X{PartnerName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDescription}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{ElapsedTime}|%X{ServerFQDN}|%X{RemoteHost}|%X{ClassName}|%X{Unused}|%X{ProcessKey}|%X{CustomField1}|%X{CustomField2}|%X{CustomField3}|%X{CustomField4}| ActivityType=<%M>, Desc=<%msg>%n" /> + <property name="error-log-pattern" + value="%date{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%X{RequestId}|%thread|%X{ServiceName}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%X{ErrorCategory}|%X{ErrorCode}|%msg|%n" /> - <property name="asdc-debug-log-pattern" value="%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%X{RequestId}|%msg %n"/> + <property name="audit-log-pattern" value="%X{AuditBeginTimestamp}|%X{EndTimestamp}|%X{RequestId}|%X{ServiceInstanceId}|%thread|%X{VirtualServerName}|%X{ServiceName}|%X{PartnerName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDescription}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{ElapsedTime}|%X{ServerFQDN}|%X{RemoteHost}|%X{ClassName}|%X{Unused}|%X{ProcessKey}|%X{CustomField1}|%X{CustomField2}|%X{CustomField3}|%X{CustomField4}|ActivityType=<%M>, Desc=<%msg>%n" /> + + <property name="metric-log-pattern" value="%X{MetricBeginTimestamp}|%X{EndTimestamp}|%X{RequestId}|%X{ServiceInstanceId}|%thread|%X{VirtualServerName}|%X{ServiceName}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDescription}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{ElapsedTime}|%X{ServerFQDN}|%X{RemoteHost}|%X{ClassName}|%X{Unused}|%X{ProcessKey}|%X{CustomField1}|%X{CustomField2}|%X{CustomField3}|%X{CustomField4}|ActivityType=<%M>, Desc=<%msg>%n" /> + + <property name="debug-log-pattern" value="%date{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%X{RequestId}|%msg|^\n%n"/> <!-- All log --> <if condition='property("enable-all-log").equalsIgnoreCase("true")'> <then> <appender name="ALL_ROLLING" class="ch.qos.logback.core.rolling.RollingFileAppender"> - <file>${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/all.log</file> + <file>${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/all.log + </file> <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy"> - <fileNamePattern>${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/all.log.%i</fileNamePattern> + <fileNamePattern>${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/all.log.%i + </fileNamePattern> <minIndex>1</minIndex> <maxIndex>10</maxIndex> </rollingPolicy> @@ -37,7 +44,7 @@ <pattern>${default-log-pattern}</pattern> </encoder> </appender> - + <appender name="ASYNC_ALL" class="ch.qos.logback.classic.AsyncAppender"> <appender-ref ref="ALL_ROLLING" /> </appender> @@ -85,7 +92,7 @@ <maxFileSize>20MB</maxFileSize> </triggeringPolicy> <encoder> - <pattern>${default-log-pattern}</pattern> + <pattern>${error-log-pattern}</pattern> </encoder> </appender> @@ -95,9 +102,9 @@ <file>${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/debug.log </file> - <!-- No need to deny audit messages - they are INFO only, will be denied + <!-- No need to deny audit messages - they are INFO only, will be denied anyway --> - <!-- Transaction messages filter - deny Transaction messages, there are + <!-- Transaction messages filter - deny Transaction messages, there are some DEBUG level messages among them --> <filter class="ch.qos.logback.core.filter.EvaluatorFilter"> <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator"> @@ -131,7 +138,7 @@ <maxFileSize>20MB</maxFileSize> </triggeringPolicy> <encoder> - <pattern>${default-log-pattern}</pattern> + <pattern>${debug-log-pattern}</pattern> </encoder> </appender> @@ -177,7 +184,7 @@ <maxFileSize>20MB</maxFileSize> </triggeringPolicy> <encoder> - <pattern>${asdc-debug-log-pattern}</pattern> + <pattern>${debug-log-pattern}</pattern> </encoder> </appender> @@ -210,7 +217,7 @@ <maxFileSize>20MB</maxFileSize> </triggeringPolicy> <encoder> - <pattern>${auditLoggerPattern}</pattern> + <pattern>${audit-log-pattern}</pattern> </encoder> </appender> @@ -242,7 +249,7 @@ <maxFileSize>20MB</maxFileSize> </triggeringPolicy> <encoder> - <pattern>${default-log-pattern}</pattern> + <pattern>${metric-log-pattern}</pattern> </encoder> </appender> @@ -324,5 +331,5 @@ </if> </root> - <logger name="org.openecomp.sdc" level="INFO" /> + <logger name="org.openecomp.sdc" level="DEBUG" /> </configuration>
\ No newline at end of file diff --git a/catalog-be/src/main/resources/scripts/import/tosca/importHeatTypes1.py b/catalog-be/src/main/resources/scripts/import/tosca/importHeatTypes1.py new file mode 100644 index 0000000000..93394b3ed5 --- /dev/null +++ b/catalog-be/src/main/resources/scripts/import/tosca/importHeatTypes1.py @@ -0,0 +1,100 @@ +import pycurl +import sys, getopt +from StringIO import StringIO +import json +import copy +from importCommon import * +from importNormativeTypes import * +import importCommon + +##################################################################################################################################################################################### +# # +# Import heat types # +# # +# activation : # +# python importHeatTypes1.py [-s <scheme> | --scheme=<scheme> ] [-i <be host> | --ip=<be host>] [-p <be port> | --port=<be port> ] [-f <input file> | --ifile=<input file> ] # +# # +# shortest activation (be host = localhost, be port = 8080): # +# python importHeatTypes1.py [-f <input file> | --ifile=<input file> ] # +# # +##################################################################################################################################################################################### + +def importHeatTypes1(scheme, beHost, bePort, adminUser, fileDir, updateversion): + + heatTypes = ["extCp"] + + responseCodes = [200, 201] + + if(updateversion == 'false'): + responseCodes = [200, 201, 409] + + results = [] + for heatType in heatTypes: + result = createNormativeType(scheme, beHost, bePort, adminUser, fileDir, heatType, updateversion) + results.append(result) + if ( result[1] == None or result[1] not in responseCodes) : + print "Failed creating heat type " + heatType + ". " + str(result[1]) + return results + + +def main(argv): + print 'Number of arguments:', len(sys.argv), 'arguments.' + + beHost = 'localhost' + bePort = '8080' + adminUser = 'jh0003' + updateversion = 'true' + scheme = 'http' + + try: + opts, args = getopt.getopt(argv,"i:p:u:v:h:s:",["ip=","port=","user=","updateversion=","scheme="]) + except getopt.GetoptError: + usage() + error_and_exit(2, 'Invalid input') + + for opt, arg in opts: + #print opt, arg + if opt == '-h': + usage() + sys.exit(3) + elif opt in ("-i", "--ip"): + beHost = arg + elif opt in ("-p", "--port"): + bePort = arg + elif opt in ("-u", "--user"): + adminUser = arg + elif opt in ("-s", "--scheme"): + scheme = arg + elif opt in ("-v", "--updateversion"): + if (arg.lower() == "false" or arg.lower() == "no"): + updateversion = 'false' + + print 'scheme =',scheme,', be host =',beHost,', be port =', bePort,', user =', adminUser + + if ( beHost == None ): + usage() + sys.exit(3) + + results = importHeatTypes1(scheme, beHost, bePort, adminUser, "../../../import/tosca/heat-types/", updateversion) + + print "-----------------------------" + for result in results: + print "{0:20} | {1:6}".format(result[0], result[1]) + print "-----------------------------" + + responseCodes = [200, 201] + + if(updateversion == 'false'): + responseCodes = [200, 201, 409] + + failedNormatives = filter(lambda x: x[1] == None or x[1] not in responseCodes, results) + if (len(failedNormatives) > 0): + error_and_exit(1, None) + else: + error_and_exit(0, None) + + +if __name__ == "__main__": + main(sys.argv[1:]) + + diff --git a/catalog-be/src/main/resources/scripts/import/tosca/importNormativeAll1.py b/catalog-be/src/main/resources/scripts/import/tosca/importNormativeAll1.py new file mode 100644 index 0000000000..1dbd5fdcb3 --- /dev/null +++ b/catalog-be/src/main/resources/scripts/import/tosca/importNormativeAll1.py @@ -0,0 +1,121 @@ +import pycurl +import sys, getopt, os +from StringIO import StringIO +import json +import copy +import time +#from importNormativeElements import createNormativeElement +from importNormativeElements import * +from importNormativeTypes import importNormativeTypes +from importHeatTypes1 import importHeatTypes1 +from importNormativeCapabilities import importNormativeCapabilities +from importCategoryTypes import importCategories +from importNormativeInterfaceLifecycleTypes import importNormativeInterfaceLifecycleType +from importDataTypes import importDataTypes +from importGroupTypes import importGroupTypes +from importPolicyTypes import importPolicyTypes +from importCommon import * +import importCommon + +################################################################################################################################################################################################################################# +# # +# Import all users from a given file # +# # +# activation : # +# python importNormativeAll.py [-s <scheme> | --scheme=<scheme> ] [-i <be host> | --ip=<be host>] [-p <be port> | --port=<be port> ] [-u <user userId> | --user=<user userId> ] [-d <true|false> | --debug=<true|false>] # +# [-v <true|false> | --updateversion=<true|false>] # +# # +# shortest activation (be host = localhost, be port = 8080, user = jh0003): # +# python importNormativeAll.py # +# # +################################################################################################################################################################################################################################# + +def usage(): + print sys.argv[0], '[optional -s <scheme> | --scheme=<scheme>, default http] [-i <be host> | --ip=<be host>] [-p <be port> | --port=<be port> ] [-u <user userId> | --user=<user userId> ] [-d <true|false> | --debug=<true|false>] [-v <true|false> | --updateversion=<true|false>]' + +def handleResults(results, updateversion): + print_frame_line() + for result in results: + print_name_and_return_code(result[0], result[1]) + print_frame_line() + + responseCodes = [200, 201] + + if(updateversion == 'false'): + responseCodes = [200, 201, 409] + + failedResults = filter(lambda x: x[1] == None or x[1] not in responseCodes, results) + if (len(failedResults) > 0): + error_and_exit(1, None) + +def main(argv): + print 'Number of arguments:', len(sys.argv), 'arguments.' + + beHost = 'localhost' + bePort = '8080' + adminUser = 'jh0003' + debugf = None + updateversion = 'true' + importCommon.debugFlag = False + scheme = 'http' + + try: + opts, args = getopt.getopt(argv,"i:p:u:d:v:h:s:",["ip=","port=","user=","debug=","updateversion=","scheme="]) + except getopt.GetoptError: + usage() + error_and_exit(2, 'Invalid input') + + for opt, arg in opts: + #print opt, arg + if opt == '-h': + usage() + sys.exit(3) + elif opt in ("-i", "--ip"): + beHost = arg + elif opt in ("-p", "--port"): + bePort = arg + elif opt in ("-u", "--user"): + adminUser = arg + elif opt in ("-s", "--scheme"): + scheme = arg + elif opt in ("-d", "--debug"): + print arg + debugf = bool(arg.lower() == "true" or arg.lower() == "yes") + elif opt in ("-v", "--updateversion"): + print arg + if (arg.lower() == "false" or arg.lower() == "no"): + updateversion = 'false' + + print 'scheme =',scheme,', be host =',beHost,', be port =', bePort,', user =', adminUser, ', debug =', debugf, ', updateversion =', updateversion + + if (debugf != None): + print 'set debug mode to ' + str(debugf) + importCommon.debugFlag = debugf + + if ( beHost == None ): + usage() + sys.exit(3) + + print sys.argv[0] + pathdir = os.path.dirname(os.path.realpath(sys.argv[0])) + debug("path dir =" + pathdir) + + baseFileLocation = pathdir + "/../../../import/tosca/" + + fileLocation = baseFileLocation + "data-types/" + importDataTypes(scheme, beHost, bePort, adminUser, False, fileLocation) + + print 'sleep until data type cache is updated' + time.sleep( 1 ) + + fileLocation = baseFileLocation + "heat-types/" + resultsHeat = importHeatTypes1(scheme, beHost, bePort, adminUser, fileLocation, updateversion) + handleResults(resultsHeat, updateversion) + + + + error_and_exit(0, None) + +if __name__ == "__main__": + main(sys.argv[1:]) + diff --git a/catalog-be/src/main/resources/scripts/import/tosca/importNormativeElements.py b/catalog-be/src/main/resources/scripts/import/tosca/importNormativeElements.py index f9f5cd5320..347898a815 100644 --- a/catalog-be/src/main/resources/scripts/import/tosca/importNormativeElements.py +++ b/catalog-be/src/main/resources/scripts/import/tosca/importNormativeElements.py @@ -30,6 +30,7 @@ def import_element(scheme, be_host, be_port, admin_user, exit_on_success, file_d error_and_exit(0, None) + def createNormativeElement(scheme, be_host, be_port, admin_user, file_dir, url_suffix, element_name, element_form_name, with_metadata=False): try: |