aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-be/src
diff options
context:
space:
mode:
authorTal Gitelman <tg851x@intl.att.com>2018-07-19 18:25:12 +0300
committerTal Gitelman <tg851x@intl.att.com>2018-07-25 15:03:36 +0000
commit924b33856a717a70570e9108596716a781e39ec0 (patch)
tree27951fd24b1d5e6217580254c49d6f02efc3185a /catalog-be/src
parent6c3541e2f1a64a7140b7bb54ff5aa546facbb14f (diff)
Align normatives and scripts
Change-Id: I5e15e3c5adaf13a5b785613d20411f5d0e42e264 Issue-ID: SDC-1544 Signed-off-by: Tal Gitelman <tg851x@intl.att.com>
Diffstat (limited to 'catalog-be/src')
-rw-r--r--catalog-be/src/main/resources/scripts/import/tosca/importAnnotationTypes.py35
-rw-r--r--catalog-be/src/main/resources/scripts/import/tosca/importCategoryTypes.py12
-rw-r--r--catalog-be/src/main/resources/scripts/import/tosca/importCommon.py84
-rw-r--r--catalog-be/src/main/resources/scripts/import/tosca/importDataTypes.py12
-rw-r--r--catalog-be/src/main/resources/scripts/import/tosca/importGroupTypes.py107
-rw-r--r--catalog-be/src/main/resources/scripts/import/tosca/importHeatTypes.py16
-rw-r--r--catalog-be/src/main/resources/scripts/import/tosca/importNfvTypes.py6
-rw-r--r--catalog-be/src/main/resources/scripts/import/tosca/importNodeType.py6
-rw-r--r--catalog-be/src/main/resources/scripts/import/tosca/importNormativeAll.py210
-rw-r--r--catalog-be/src/main/resources/scripts/import/tosca/importNormativeCapabilities.py12
-rw-r--r--catalog-be/src/main/resources/scripts/import/tosca/importNormativeElements.py110
-rw-r--r--catalog-be/src/main/resources/scripts/import/tosca/importNormativeInterfaceLifecycleTypes.py12
-rw-r--r--catalog-be/src/main/resources/scripts/import/tosca/importNormativeNoHeatAndNormativeTypes.py12
-rw-r--r--catalog-be/src/main/resources/scripts/import/tosca/importNormativeTypes.py6
-rw-r--r--catalog-be/src/main/resources/scripts/import/tosca/importONAPNormativeAll.py31
-rw-r--r--catalog-be/src/main/resources/scripts/import/tosca/importOnapTypes.py6
-rw-r--r--catalog-be/src/main/resources/scripts/import/tosca/importPolicyTypes.py108
-rw-r--r--catalog-be/src/main/resources/scripts/import/tosca/importSolTypes.py6
-rw-r--r--catalog-be/src/main/resources/scripts/import/tosca/importUsersFromYaml.py8
-rw-r--r--catalog-be/src/main/resources/scripts/import/tosca/typesToUpgrade.json3
-rw-r--r--catalog-be/src/main/resources/scripts/import/tosca/upgradeHeatAndNormativeTypes.py6
-rw-r--r--catalog-be/src/main/resources/scripts/import/tosca/upgradeHeatTypes1707.py6
-rw-r--r--catalog-be/src/main/resources/scripts/import/tosca/upgradeNfvTypes.py6
-rw-r--r--catalog-be/src/main/resources/scripts/import/tosca/upgradeNormative.py168
-rw-r--r--catalog-be/src/main/resources/scripts/import/tosca/upgradeNormativeVersion.py12
-rw-r--r--catalog-be/src/main/resources/scripts/import/tosca/upgradeNormativeVersionAll.py12
-rw-r--r--catalog-be/src/main/resources/scripts/import/tosca/upgradeNormativeVersionProd1702_3537.py12
-rw-r--r--catalog-be/src/main/resources/scripts/import/tosca/upgradeONAPNormative.py12
-rw-r--r--catalog-be/src/main/resources/scripts/import/tosca/upgradeONAPTypes.py6
-rw-r--r--catalog-be/src/main/resources/scripts/import/tosca/upgradeSolTypes.py6
30 files changed, 591 insertions, 457 deletions
diff --git a/catalog-be/src/main/resources/scripts/import/tosca/importAnnotationTypes.py b/catalog-be/src/main/resources/scripts/import/tosca/importAnnotationTypes.py
new file mode 100644
index 0000000000..5f0d4ad421
--- /dev/null
+++ b/catalog-be/src/main/resources/scripts/import/tosca/importAnnotationTypes.py
@@ -0,0 +1,35 @@
+import sys
+
+from importCommon import parse_cmd_line_params
+from importNormativeElements import import_element
+
+IMPORT_ANNOTATION_URL = "/sdc2/rest/v1/catalog/uploadType/annotationtypes"
+ANNOTATION_FILE_PATH = "../../../import/tosca/annotation-types/"
+ANNOTATION_ZIP_FILE = "annotationTypesZip"
+ANNOTATION_ELEMENT_NAME = "annotationTypes"
+
+#####################################################################################################################################################################################
+# #
+# Import tosca data types #
+# #
+# activation : #
+# python importAnnotaionTypes.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 importAnnotaionTypes.py [-f <input file> | --ifile=<input file> ] #
+# #
+#####################################################################################################################################################################################
+
+
+def import_annotation_types(scheme, be_host, be_port, admin_user, exit_on_success):
+ import_element(scheme, be_host, be_port, admin_user, exit_on_success, ANNOTATION_FILE_PATH, IMPORT_ANNOTATION_URL,
+ ANNOTATION_ELEMENT_NAME, ANNOTATION_ZIP_FILE)
+
+
+def main(argv):
+ scheme, be_host, be_port, admin_user = parse_cmd_line_params(argv)
+ import_annotation_types(scheme, be_host, be_port, admin_user, True)
+
+
+if __name__ == "__main__":
+ main(sys.argv[1:])
diff --git a/catalog-be/src/main/resources/scripts/import/tosca/importCategoryTypes.py b/catalog-be/src/main/resources/scripts/import/tosca/importCategoryTypes.py
index 2f3237173c..9ef8b4a200 100644
--- a/catalog-be/src/main/resources/scripts/import/tosca/importCategoryTypes.py
+++ b/catalog-be/src/main/resources/scripts/import/tosca/importCategoryTypes.py
@@ -25,15 +25,15 @@ def usage():
def importCategories(scheme, beHost, bePort, adminUser, exitOnSuccess, fileDir):
result = createNormativeElement(scheme, beHost, bePort, adminUser, fileDir, "/sdc2/rest/v1/catalog/uploadType/categories", "categoryTypes", "categoriesZip")
- printFrameLine()
- printNameAndReturnCode(result[0], result[1])
- printFrameLine()
+ print_frame_line()
+ print_name_and_return_code(result[0], result[1])
+ print_frame_line()
if ( result[1] == None or result[1] not in [200, 201, 409] ):
- errorAndExit(1, None)
+ error_and_exit(1, None)
else:
if (exitOnSuccess == True):
- errorAndExit(0, None)
+ error_and_exit(0, None)
def main(argv):
print 'Number of arguments:', len(sys.argv), 'arguments.'
@@ -47,7 +47,7 @@ def main(argv):
opts, args = getopt.getopt(argv,"i:p:u:h:s:",["ip=","port=","user=","scheme="])
except getopt.GetoptError:
usage()
- errorAndExit(2, 'Invalid input')
+ error_and_exit(2, 'Invalid input')
for opt, arg in opts:
#print opt, arg
diff --git a/catalog-be/src/main/resources/scripts/import/tosca/importCommon.py b/catalog-be/src/main/resources/scripts/import/tosca/importCommon.py
index acdb067849..ed92ca8b3d 100644
--- a/catalog-be/src/main/resources/scripts/import/tosca/importCommon.py
+++ b/catalog-be/src/main/resources/scripts/import/tosca/importCommon.py
@@ -11,33 +11,79 @@ import copy
debugFlag = True
+
def join_strings(lst):
concat = ""
for string in lst:
- if (string != None):
- if (type(string) == int):
- string = str(string)
- concat += (string + " ")
+ if string is not None:
+ if type(string) == int:
+ string = str(string)
+ concat += (string + " ")
return concat
+
def debug(desc, *args):
- 'print only if debug enabled'
- if (debugFlag == True):
- print desc, join_strings(args)
+ if debugFlag:
+ print desc, join_strings(args)
+
def log(desc, arg=None):
- 'print log info'
- print desc, arg
+ print desc, arg
+
+
+def error_and_exit(error_code, error_desc):
+ if error_code > 0:
+ print "status={0}. {1}".format(error_code, '' if error_desc is None else error_desc)
+ else:
+ print "status={0}".format(error_code)
+ sys.exit(error_code)
+
+
+def print_name_and_return_code(name, code):
+ print "{0:30} | {1:6}".format(name, code)
+
+
+def print_frame_line():
+ print "----------------------------------------"
+
+
+def parse_cmd_line_params(argv):
+ print 'Number of arguments:', len(sys.argv), 'arguments.'
+
+ be_host = 'localhost'
+ be_port = '8080'
+ admin_user = 'jh0003'
+ scheme = 'http'
+
+ try:
+ opts, args = getopt.getopt(argv, "i:p:u:h:s:", ["ip=", "port=", "user=", "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"):
+ be_host = arg
+ elif opt in ("-p", "--port"):
+ be_port = arg
+ elif opt in ("-u", "--user"):
+ admin_user = arg
+ elif opt in ("-s", "--scheme"):
+ scheme = arg
+
+ print 'scheme =', scheme, ', be host =', be_host, ', be port =', be_port, ', user =', admin_user
-def errorAndExit(errorCode, errorDesc):
- if ( errorCode > 0 ):
- print "status={0}. {1}".format(errorCode, '' if errorDesc == None else errorDesc)
- else:
- print "status={0}".format(errorCode)
- sys.exit(errorCode)
+ if be_host is None:
+ usage()
+ sys.exit(3)
+ return scheme, be_host, be_port, admin_user
-def printNameAndReturnCode(name, code):
- print "{0:30} | {1:6}".format(name, code)
-def printFrameLine():
- print "----------------------------------------"
+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> ] '
diff --git a/catalog-be/src/main/resources/scripts/import/tosca/importDataTypes.py b/catalog-be/src/main/resources/scripts/import/tosca/importDataTypes.py
index ef51a907d5..bc68297383 100644
--- a/catalog-be/src/main/resources/scripts/import/tosca/importDataTypes.py
+++ b/catalog-be/src/main/resources/scripts/import/tosca/importDataTypes.py
@@ -25,15 +25,15 @@ def usage():
def importDataTypes(scheme, beHost, bePort, adminUser, exitOnSuccess, fileDir):
result = createNormativeElement(scheme, beHost, bePort, adminUser, fileDir, "/sdc2/rest/v1/catalog/uploadType/datatypes", "dataTypes", "dataTypesZip")
- printFrameLine()
- printNameAndReturnCode(result[0], result[1])
- printFrameLine()
+ print_frame_line()
+ print_name_and_return_code(result[0], result[1])
+ print_frame_line()
if ( result[1] == None or result[1] not in [200, 201, 409] ):
- errorAndExit(1, None)
+ error_and_exit(1, None)
else:
if (exitOnSuccess == True):
- errorAndExit(0, None)
+ error_and_exit(0, None)
def main(argv):
print 'Number of arguments:', len(sys.argv), 'arguments.'
@@ -47,7 +47,7 @@ def main(argv):
opts, args = getopt.getopt(argv,"i:p:u:h:s:",["ip=","port=","user=","scheme="])
except getopt.GetoptError:
usage()
- errorAndExit(2, 'Invalid input')
+ error_and_exit(2, 'Invalid input')
for opt, arg in opts:
#print opt, arg
diff --git a/catalog-be/src/main/resources/scripts/import/tosca/importGroupTypes.py b/catalog-be/src/main/resources/scripts/import/tosca/importGroupTypes.py
index 9daa990fc5..0a94bbef95 100644
--- a/catalog-be/src/main/resources/scripts/import/tosca/importGroupTypes.py
+++ b/catalog-be/src/main/resources/scripts/import/tosca/importGroupTypes.py
@@ -1,11 +1,10 @@
-import pycurl
-import sys, getopt
-from StringIO import StringIO
-import json
-import copy
-from importNormativeElements import createNormativeElement
+import getopt
+import sys
from importCommon import *
+from importNormativeElements import createNormativeElement
+
+
#####################################################################################################################################################################################
# #
# Import tosca data types #
@@ -19,59 +18,61 @@ from importCommon import *
#####################################################################################################################################################################################
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> ]'
+ 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> ]'
+
+def importGroupTypes(scheme, be_host, be_port, admin_user, exit_on_success, file_dir):
+ result = createNormativeElement(scheme, be_host, be_port, admin_user, file_dir,
+ "/sdc2/rest/v1/catalog/uploadType/grouptypes", "groupTypes", "groupTypesZip", True)
-def importGroupTypes(scheme, beHost, bePort, adminUser, exitOnSuccess, fileDir):
- result = createNormativeElement(scheme, beHost, bePort, adminUser, fileDir, "/sdc2/rest/v1/catalog/uploadType/grouptypes", "groupTypes", "groupTypesZip")
+ print_frame_line()
+ print_name_and_return_code(result[0], result[1])
+ print_frame_line()
- printFrameLine()
- printNameAndReturnCode(result[0], result[1])
- printFrameLine()
+ if result[1] is None or result[1] not in [200, 201, 409]:
+ error_and_exit(1, None)
+ else:
+ if exit_on_success:
+ error_and_exit(0, None)
- if ( result[1] == None or result[1] not in [200, 201, 409] ):
- errorAndExit(1, None)
- else:
- if (exitOnSuccess == True):
- errorAndExit(0, None)
def main(argv):
- print 'Number of arguments:', len(sys.argv), 'arguments.'
-
- beHost = 'localhost'
- bePort = '8080'
- adminUser = 'jh0003'
- scheme = 'http'
-
- try:
- opts, args = getopt.getopt(argv,"i:p:u:h:s:",["ip=","port=","user=","scheme="])
- except getopt.GetoptError:
- usage()
- errorAndExit(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
-
- print 'scheme =',scheme,', be host =',beHost,', be port =', bePort,', user =', adminUser
-
- if ( beHost == None ):
- usage()
- sys.exit(3)
-
- importGroupTypes(scheme, beHost, bePort, adminUser, True, "../../../import/tosca/group-types/")
+ print 'Number of arguments:', len(sys.argv), 'arguments.'
+ be_host = 'localhost'
+ be_port = '8080'
+ admin_user = 'jh0003'
+ scheme = 'http'
-if __name__ == "__main__":
- main(sys.argv[1:])
+ try:
+ opts, args = getopt.getopt(argv, "i:p:u:h:s:", ["ip=", "port=", "user=", "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"):
+ be_host = arg
+ elif opt in ("-p", "--port"):
+ be_port = arg
+ elif opt in ("-u", "--user"):
+ admin_user = arg
+ elif opt in ("-s", "--scheme"):
+ scheme = arg
+
+ print 'scheme =', scheme, ', be host =', be_host, ', be port =', be_port, ', user =', admin_user
+
+ if be_host is None:
+ usage()
+ sys.exit(3)
+
+ importGroupTypes(scheme, be_host, be_port, admin_user, True, "../../../import/tosca/group-types/")
+
+
+if __name__ == "__main__":
+ main(sys.argv[1:])
diff --git a/catalog-be/src/main/resources/scripts/import/tosca/importHeatTypes.py b/catalog-be/src/main/resources/scripts/import/tosca/importHeatTypes.py
index 4490fec61a..74ecf71784 100644
--- a/catalog-be/src/main/resources/scripts/import/tosca/importHeatTypes.py
+++ b/catalog-be/src/main/resources/scripts/import/tosca/importHeatTypes.py
@@ -59,7 +59,15 @@ def importHeatTypes(scheme, beHost, bePort, adminUser, fileDir, updateversion):
"extNeutronCP",
"extContrailCP",
"portMirroringByPolicy",
- "forwardingPath"
+ "forwardingPath",
+ "VRFObject",
+ "extVirtualMachineInterfaceCP",
+ "VLANNetworkReceptor",
+ "VRFEntry",
+ "subInterfaceV2",
+ "contrailV2VLANSubInterfaceV2",
+ "configuration",
+ "fabricConfiguration"
]
responseCodes = [200, 201]
@@ -89,7 +97,7 @@ def main(argv):
opts, args = getopt.getopt(argv,"i:p:u:v:h:s:",["ip=","port=","user=","updateversion=","scheme="])
except getopt.GetoptError:
usage()
- errorAndExit(2, 'Invalid input')
+ error_and_exit(2, 'Invalid input')
for opt, arg in opts:
#print opt, arg
@@ -128,9 +136,9 @@ def main(argv):
failedNormatives = filter(lambda x: x[1] == None or x[1] not in responseCodes, results)
if (len(failedNormatives) > 0):
- errorAndExit(1, None)
+ error_and_exit(1, None)
else:
- errorAndExit(0, None)
+ error_and_exit(0, None)
if __name__ == "__main__":
diff --git a/catalog-be/src/main/resources/scripts/import/tosca/importNfvTypes.py b/catalog-be/src/main/resources/scripts/import/tosca/importNfvTypes.py
index 8e63d86140..3de471935e 100644
--- a/catalog-be/src/main/resources/scripts/import/tosca/importNfvTypes.py
+++ b/catalog-be/src/main/resources/scripts/import/tosca/importNfvTypes.py
@@ -68,7 +68,7 @@ def main(argv):
opts, args = getopt.getopt(argv,"i:p:u:v:h:",["ip=","port=","user=","updateversion="])
except getopt.GetoptError:
usage()
- errorAndExit(2, 'Invalid input')
+ error_and_exit(2, 'Invalid input')
for opt, arg in opts:
#print opt, arg
@@ -107,9 +107,9 @@ def main(argv):
failedNormatives = filter(lambda x: x[1] == None or x[1] not in responseCodes, results)
if (len(failedNormatives) > 0):
- errorAndExit(1, None)
+ error_and_exit(1, None)
else:
- errorAndExit(0, None)
+ error_and_exit(0, None)
if __name__ == "__main__":
diff --git a/catalog-be/src/main/resources/scripts/import/tosca/importNodeType.py b/catalog-be/src/main/resources/scripts/import/tosca/importNodeType.py
index 7d0b7c526a..24218b6a73 100644
--- a/catalog-be/src/main/resources/scripts/import/tosca/importNodeType.py
+++ b/catalog-be/src/main/resources/scripts/import/tosca/importNodeType.py
@@ -95,7 +95,7 @@ def main(argv):
opts, args = getopt.getopt(argv,"i:p:u:d:l:e:h:s:",["ip=","port=","user=","location=","element=", "debug=","scheme="])
except getopt.GetoptError:
usage()
- errorAndExit(2, 'Invalid input')
+ error_and_exit(2, 'Invalid input')
for opt, arg in opts:
#print opt, arg
@@ -153,9 +153,9 @@ def main(argv):
if ( result[1] == None or result[1] not in [200, 201] ) :
print "Failed creating normative type " + element + ". " + str(result[1])
- errorAndExit(1, None)
+ error_and_exit(1, None)
- errorAndExit(0, None)
+ error_and_exit(0, None)
if __name__ == "__main__":
main(sys.argv[1:])
diff --git a/catalog-be/src/main/resources/scripts/import/tosca/importNormativeAll.py b/catalog-be/src/main/resources/scripts/import/tosca/importNormativeAll.py
index d57c3d6ce4..8a8329027f 100644
--- a/catalog-be/src/main/resources/scripts/import/tosca/importNormativeAll.py
+++ b/catalog-be/src/main/resources/scripts/import/tosca/importNormativeAll.py
@@ -4,20 +4,20 @@ from StringIO import StringIO
import json
import copy
import time
-#from importNormativeElements import createNormativeElement
-from importNormativeElements import *
+from importNormativeElements import *
from importNormativeTypes import importNormativeTypes
from importHeatTypes import importHeatTypes
-from importOnapTypes import importOnapTypes
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 importAnnotationTypes import import_annotation_types
from importCommon import *
import importCommon
+
#################################################################################################################################################################################################################################
# #
# Import all users from a given file #
@@ -32,108 +32,114 @@ import importCommon
#################################################################################################################################################################################################################################
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>]'
+ 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):
- printFrameLine()
- for result in results:
- printNameAndReturnCode(result[0], result[1])
- printFrameLine()
-
- 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):
- errorAndExit(1, None)
+ 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()
- errorAndExit(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( 70 )
-
- fileLocation = baseFileLocation + "capability-types/"
- importNormativeCapabilities(scheme, beHost, bePort, adminUser, False, fileLocation)
-
- fileLocation = baseFileLocation + "interface-lifecycle-types/"
- importNormativeInterfaceLifecycleType(scheme, beHost, bePort, adminUser, False, fileLocation)
-
- fileLocation = baseFileLocation + "categories/"
- importCategories(scheme, beHost, bePort, adminUser, False, fileLocation)
-
- fileLocation = baseFileLocation + "normative-types/"
- results = importNormativeTypes(scheme, beHost, bePort, adminUser, fileLocation, updateversion)
- handleResults(results, updateversion)
-
- fileLocation = baseFileLocation + "heat-types/"
- resultsHeat = importHeatTypes(scheme, beHost, bePort, adminUser, fileLocation, updateversion)
- handleResults(resultsHeat, updateversion)
-
- fileLocation = baseFileLocation + "group-types/"
- importGroupTypes(scheme, beHost, bePort, adminUser, False, fileLocation)
-
- fileLocation = baseFileLocation + "policy-types/"
- importPolicyTypes(scheme, beHost, bePort, adminUser, False, fileLocation)
-
- errorAndExit(0, None)
+ 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(70)
+
+ fileLocation = baseFileLocation + "capability-types/"
+ importNormativeCapabilities(scheme, beHost, bePort, adminUser, False, fileLocation)
+
+ fileLocation = baseFileLocation + "interface-lifecycle-types/"
+ importNormativeInterfaceLifecycleType(scheme, beHost, bePort, adminUser, False, fileLocation)
+
+ fileLocation = baseFileLocation + "categories/"
+ importCategories(scheme, beHost, bePort, adminUser, False, fileLocation)
+
+ fileLocation = baseFileLocation + "normative-types/"
+ results = importNormativeTypes(scheme, beHost, bePort, adminUser, fileLocation, updateversion)
+ handleResults(results, updateversion)
+
+ fileLocation = baseFileLocation + "heat-types/"
+ resultsHeat = importHeatTypes(scheme, beHost, bePort, adminUser, fileLocation, updateversion)
+ handleResults(resultsHeat, updateversion)
+
+ fileLocation = baseFileLocation + "group-types/"
+ importGroupTypes(scheme, beHost, bePort, adminUser, False, fileLocation)
+
+ fileLocation = baseFileLocation + "policy-types/"
+ importPolicyTypes(scheme, beHost, bePort, adminUser, False, fileLocation)
+
+ import_annotation_types(scheme, beHost, bePort, adminUser, False)
+
+ error_and_exit(0, None)
-if __name__ == "__main__":
- main(sys.argv[1:])
+if __name__ == "__main__":
+ main(sys.argv[1:])
diff --git a/catalog-be/src/main/resources/scripts/import/tosca/importNormativeCapabilities.py b/catalog-be/src/main/resources/scripts/import/tosca/importNormativeCapabilities.py
index e4f92139c2..e0f5c40ac9 100644
--- a/catalog-be/src/main/resources/scripts/import/tosca/importNormativeCapabilities.py
+++ b/catalog-be/src/main/resources/scripts/import/tosca/importNormativeCapabilities.py
@@ -27,15 +27,15 @@ def usage():
def importNormativeCapabilities(scheme, beHost, bePort, adminUser, exitOnSuccess, fileDir):
result = createNormativeElement(scheme, beHost, bePort, adminUser, fileDir, "/sdc2/rest/v1/catalog/uploadType/capability", "capabilityTypes", "capabilityTypeZip")
- printFrameLine()
- printNameAndReturnCode(result[0], result[1])
- printFrameLine()
+ print_frame_line()
+ print_name_and_return_code(result[0], result[1])
+ print_frame_line()
if ( result[1] == None or result[1] not in [200, 201, 409] ):
- importCommon.errorAndExit(1, None)
+ importCommon.error_and_exit(1, None)
else:
if (exitOnSuccess == True):
- importCommon.errorAndExit(0, None)
+ importCommon.error_and_exit(0, None)
def main(argv):
@@ -50,7 +50,7 @@ def main(argv):
opts, args = getopt.getopt(argv,"i:p:u:h:s:",["ip=","port=","user=","scheme="])
except getopt.GetoptError:
usage()
- importCommon.errorAndExit(2, 'Invalid input')
+ importCommon.error_and_exit(2, 'Invalid input')
for opt, arg in opts:
#print opt, arg
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 c28bbfb143..f9f5cd5320 100644
--- a/catalog-be/src/main/resources/scripts/import/tosca/importNormativeElements.py
+++ b/catalog-be/src/main/resources/scripts/import/tosca/importNormativeElements.py
@@ -1,9 +1,10 @@
import pycurl
-import sys, getopt
from StringIO import StringIO
import json
import copy
from importCommon import *
+
+
#################################################################################################################################################################################
# #
# Import all users from a given file #
@@ -15,55 +16,86 @@ from importCommon import *
# python importUsers.py [-f <input file> | --ifile=<input file> ] #
# #
#################################################################################################################################################################################
+def import_element(scheme, be_host, be_port, admin_user, exit_on_success, file_dir, url_suffix, element_name, element_form_name,
+ with_metadata=False):
+ result = createNormativeElement(scheme, be_host, be_port, admin_user, file_dir, url_suffix, element_name, element_form_name, with_metadata)
+ print_frame_line()
+ print_name_and_return_code(result[0], result[1])
+ print_frame_line()
+
+ if result[1] is None or result[1] not in [200, 201, 409]:
+ error_and_exit(1, None)
+ else:
+ if exit_on_success:
+ 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:
+ log("in create normative element ", element_name)
+ buffer = StringIO()
+ c = pycurl.Curl()
+
+ url = scheme + '://' + be_host + ':' + be_port + url_suffix
+ c.setopt(c.URL, url)
+ c.setopt(c.POST, 1)
+
+ admin_header = 'USER_ID: ' + admin_user
+ c.setopt(pycurl.HTTPHEADER, [admin_header])
+
+ type_file_name = file_dir + "/" + element_name
+
+ multi_part_form_data = create_multipart_form_data(element_form_name, type_file_name, with_metadata)
+
+ c.setopt(pycurl.HTTPPOST, multi_part_form_data)
+ c.setopt(c.WRITEFUNCTION, buffer.write)
-def createNormativeElement(scheme, beHost, bePort, adminUser, fileDir, urlSuffix, ELEMENT_NAME, elementFormName):
-
- try:
- log("in create normative element ", ELEMENT_NAME)
+ if scheme == 'https':
+ c.setopt(c.SSL_VERIFYPEER, 0)
- buffer = StringIO()
- c = pycurl.Curl()
+ c.perform()
- url = scheme + '://' + beHost + ':' + bePort + urlSuffix
- c.setopt(c.URL, url)
- c.setopt(c.POST, 1)
+ http_res = c.getinfo(c.RESPONSE_CODE)
+ if http_res is not None:
+ debug("http response=", http_res)
+ debug("response buffer", buffer.getvalue())
+ c.close()
+ return (element_name, http_res, buffer.getvalue())
- adminHeader = 'USER_ID: ' + adminUser
- #c.setopt(pycurl.HTTPHEADER, ['Content-Type: application/json', 'Accept: application/json', adminHeader])
- c.setopt(pycurl.HTTPHEADER, [adminHeader])
+ except Exception as inst:
+ print("ERROR=" + str(inst))
+ return (element_name, None, None)
-
- path = fileDir + "/" + ELEMENT_NAME + ".zip"
- debug(path)
- send = [(elementFormName, (pycurl.FORM_FILE, path))]
- debug(send)
- c.setopt(pycurl.HTTPPOST, send)
+def create_multipart_form_data(element_form_name, type_file_name, with_metadata):
+ tosca_type_zip_part = create_zip_file_multi_part(element_form_name, type_file_name)
+ multi_part_form_data = [tosca_type_zip_part]
+ if with_metadata:
+ metadata_type_part = create_metadata_multipart(type_file_name)
+ multi_part_form_data.append(metadata_type_part)
+ debug(multi_part_form_data)
+ return multi_part_form_data
- #data = json.dumps(user)
- #c.setopt(c.POSTFIELDS, data)
- #c.setopt(c.WRITEFUNCTION, lambda x: None)
- c.setopt(c.WRITEFUNCTION, buffer.write)
+def create_metadata_multipart(type_file_name):
+ metadata = create_json_metadata_str(type_file_name)
+ return ("toscaTypeMetadata", metadata)
- if scheme == 'https':
- c.setopt(c.SSL_VERIFYPEER, 0)
- #print("before perform")
- res = c.perform()
-
- #print("Before get response code")
- httpRes = c.getinfo(c.RESPONSE_CODE)
- if (httpRes != None):
- debug("http response=", httpRes)
- #print('Status: ' + str(responseCode))
- debug("response buffer", buffer.getvalue())
- c.close()
+def create_zip_file_multi_part(element_form_name, type_file_name):
+ tosca_type_zip_path = type_file_name + ".zip"
+ tosca_type_zip_part = (element_form_name, (pycurl.FORM_FILE, tosca_type_zip_path))
+ return tosca_type_zip_part
- return (ELEMENT_NAME, httpRes, buffer.getvalue())
- except Exception as inst:
- print("ERROR=" + str(inst))
- return (ELEMENT_NAME, None, None)
+def create_json_metadata_str(file_name):
+ type_metadata_json_file = file_name + ".json"
+ debug(type_metadata_json_file)
+ json_file = open(type_metadata_json_file)
+ debug("before load json")
+ json_data = json.load(json_file, strict=False)
+ debug(json_data)
+ return json.dumps(json_data)
diff --git a/catalog-be/src/main/resources/scripts/import/tosca/importNormativeInterfaceLifecycleTypes.py b/catalog-be/src/main/resources/scripts/import/tosca/importNormativeInterfaceLifecycleTypes.py
index a6ab5741e4..89862f7df6 100644
--- a/catalog-be/src/main/resources/scripts/import/tosca/importNormativeInterfaceLifecycleTypes.py
+++ b/catalog-be/src/main/resources/scripts/import/tosca/importNormativeInterfaceLifecycleTypes.py
@@ -25,15 +25,15 @@ def usage():
def importNormativeInterfaceLifecycleType(scheme, beHost, bePort, adminUser, exitOnSuccess, fileDir):
result = createNormativeElement(scheme, beHost, bePort, adminUser, fileDir, "/sdc2/rest/v1/catalog/uploadType/interfaceLifecycle", "interfaceLifecycleTypes", "interfaceLifecycleTypeZip")
- printFrameLine()
- printNameAndReturnCode(result[0], result[1])
- printFrameLine()
+ print_frame_line()
+ print_name_and_return_code(result[0], result[1])
+ print_frame_line()
if ( result[1] == None or result[1] not in [200, 201, 409] ):
- errorAndExit(1, None)
+ error_and_exit(1, None)
else:
if (exitOnSuccess == True):
- errorAndExit(0, None)
+ error_and_exit(0, None)
def main(argv):
@@ -48,7 +48,7 @@ def main(argv):
opts, args = getopt.getopt(argv,"i:p:u:h:s:",["ip=","port=","user=","scheme="])
except getopt.GetoptError:
usage()
- errorAndExit(2, 'Invalid input')
+ error_and_exit(2, 'Invalid input')
for opt, arg in opts:
#print opt, arg
diff --git a/catalog-be/src/main/resources/scripts/import/tosca/importNormativeNoHeatAndNormativeTypes.py b/catalog-be/src/main/resources/scripts/import/tosca/importNormativeNoHeatAndNormativeTypes.py
index 1061df862c..c288d550f7 100644
--- a/catalog-be/src/main/resources/scripts/import/tosca/importNormativeNoHeatAndNormativeTypes.py
+++ b/catalog-be/src/main/resources/scripts/import/tosca/importNormativeNoHeatAndNormativeTypes.py
@@ -34,10 +34,10 @@ 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):
- printFrameLine()
+ print_frame_line()
for result in results:
- printNameAndReturnCode(result[0], result[1])
- printFrameLine()
+ print_name_and_return_code(result[0], result[1])
+ print_frame_line()
responseCodes = [200, 201]
@@ -46,7 +46,7 @@ def handleResults(results, updateversion):
failedResults = filter(lambda x: x[1] == None or x[1] not in responseCodes, results)
if (len(failedResults) > 0):
- errorAndExit(1, None)
+ error_and_exit(1, None)
def main(argv):
print 'Number of arguments:', len(sys.argv), 'arguments.'
@@ -63,7 +63,7 @@ def main(argv):
opts, args = getopt.getopt(argv,"i:p:u:d:v:h:s:",["ip=","port=","user=","debug=","updateversion=", "scheme="])
except getopt.GetoptError:
usage()
- errorAndExit(2, 'Invalid input')
+ error_and_exit(2, 'Invalid input')
for opt, arg in opts:
#print opt, arg
@@ -131,7 +131,7 @@ def main(argv):
fileLocation = baseFileLocation + "policy-types/"
importPolicyTypes(scheme, beHost, bePort, adminUser, False, fileLocation)
- errorAndExit(0, None)
+ error_and_exit(0, None)
if __name__ == "__main__":
main(sys.argv[1:])
diff --git a/catalog-be/src/main/resources/scripts/import/tosca/importNormativeTypes.py b/catalog-be/src/main/resources/scripts/import/tosca/importNormativeTypes.py
index 5b7b52d0a1..51d36586bc 100644
--- a/catalog-be/src/main/resources/scripts/import/tosca/importNormativeTypes.py
+++ b/catalog-be/src/main/resources/scripts/import/tosca/importNormativeTypes.py
@@ -116,7 +116,7 @@ def main(argv):
opts, args = getopt.getopt(argv,"i:p:u:v:h:s:",["ip=","port=","user=","updateversion=","scheme="])
except getopt.GetoptError:
usage()
- errorAndExit(2, 'Invalid input')
+ error_and_exit(2, 'Invalid input')
for opt, arg in opts:
#print opt, arg
@@ -155,9 +155,9 @@ def main(argv):
failedNormatives = filter(lambda x: x[1] == None or x[1] not in responseCodes, results)
if (len(failedNormatives) > 0):
- errorAndExit(1, None)
+ error_and_exit(1, None)
else:
- errorAndExit(0, None)
+ error_and_exit(0, None)
if __name__ == "__main__":
diff --git a/catalog-be/src/main/resources/scripts/import/tosca/importONAPNormativeAll.py b/catalog-be/src/main/resources/scripts/import/tosca/importONAPNormativeAll.py
index 6144d69104..ef1fe4d3b9 100644
--- a/catalog-be/src/main/resources/scripts/import/tosca/importONAPNormativeAll.py
+++ b/catalog-be/src/main/resources/scripts/import/tosca/importONAPNormativeAll.py
@@ -37,19 +37,20 @@ def usage():
print sys.argv[0], '[-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>]'
def handleResults(results, updateversion):
- printFrameLine()
- for result in results:
- printNameAndReturnCode(result[0], result[1])
- printFrameLine()
-
- 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):
- errorAndExit(1, None)
+ if results is not None:
+ 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.'
@@ -66,7 +67,7 @@ def main(argv):
opts, args = getopt.getopt(argv,"i:p:u:d:v:h",["ip=","port=","user=","debug=","updateversion="])
except getopt.GetoptError:
usage()
- errorAndExit(2, 'Invalid input')
+ error_and_exit(2, 'Invalid input')
for opt, arg in opts:
#print opt, arg
@@ -146,7 +147,7 @@ def main(argv):
fileLocation = baseFileLocation + "policy-types/"
importPolicyTypes(scheme, beHost, bePort, adminUser, False, fileLocation)
- errorAndExit(0, None)
+ error_and_exit(0, None)
if __name__ == "__main__":
main(sys.argv[1:])
diff --git a/catalog-be/src/main/resources/scripts/import/tosca/importOnapTypes.py b/catalog-be/src/main/resources/scripts/import/tosca/importOnapTypes.py
index f703b4b4ac..395b42d696 100644
--- a/catalog-be/src/main/resources/scripts/import/tosca/importOnapTypes.py
+++ b/catalog-be/src/main/resources/scripts/import/tosca/importOnapTypes.py
@@ -51,7 +51,7 @@ def main(argv):
opts, args = getopt.getopt(argv,"i:p:u:v:h:",["ip=","port=","user=","updateversion="])
except getopt.GetoptError:
usage()
- errorAndExit(2, 'Invalid input')
+ error_and_exit(2, 'Invalid input')
for opt, arg in opts:
#print opt, arg
@@ -90,9 +90,9 @@ def main(argv):
failedNormatives = filter(lambda x: x[1] == None or x[1] not in responseCodes, results)
if (len(failedNormatives) > 0):
- errorAndExit(1, None)
+ error_and_exit(1, None)
else:
- errorAndExit(0, None)
+ error_and_exit(0, None)
if __name__ == "__main__":
diff --git a/catalog-be/src/main/resources/scripts/import/tosca/importPolicyTypes.py b/catalog-be/src/main/resources/scripts/import/tosca/importPolicyTypes.py
index 103ad2d1da..1bd6befbf7 100644
--- a/catalog-be/src/main/resources/scripts/import/tosca/importPolicyTypes.py
+++ b/catalog-be/src/main/resources/scripts/import/tosca/importPolicyTypes.py
@@ -1,11 +1,10 @@
-import pycurl
-import sys, getopt
-from StringIO import StringIO
-import json
-import copy
-from importNormativeElements import createNormativeElement
+import getopt
+import sys
from importCommon import *
+from importNormativeElements import createNormativeElement
+
+
#####################################################################################################################################################################################
# #
# Import tosca data types #
@@ -19,59 +18,62 @@ from importCommon import *
#####################################################################################################################################################################################
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> ]'
+ 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> ]'
+
+def importPolicyTypes(scheme, be_host, be_port, admin_user, exit_on_success, file_dir):
+ result = createNormativeElement(scheme, be_host, be_port, admin_user, file_dir,
+ "/sdc2/rest/v1/catalog/uploadType/policytypes", "policyTypes", "policyTypesZip",
+ True)
-def importPolicyTypes(scheme, beHost, bePort, adminUser, exitOnSuccess, fileDir):
- result = createNormativeElement(scheme, beHost, bePort, adminUser, fileDir, "/sdc2/rest/v1/catalog/uploadType/policytypes", "policyTypes", "policyTypesZip")
+ print_frame_line()
+ print_name_and_return_code(result[0], result[1])
+ print_frame_line()
- printFrameLine()
- printNameAndReturnCode(result[0], result[1])
- printFrameLine()
+ if result[1] is None or result[1] not in [200, 201, 409]:
+ error_and_exit(1, None)
+ else:
+ if exit_on_success:
+ error_and_exit(0, None)
- if ( result[1] == None or result[1] not in [200, 201, 409] ):
- errorAndExit(1, None)
- else:
- if (exitOnSuccess == True):
- errorAndExit(0, None)
def main(argv):
- print 'Number of arguments:', len(sys.argv), 'arguments.'
-
- beHost = 'localhost'
- bePort = '8080'
- adminUser = 'jh0003'
- scheme = 'http'
-
- try:
- opts, args = getopt.getopt(argv,"i:p:u:h:s:",["ip=","port=","user=", "scheme="])
- except getopt.GetoptError:
- usage()
- errorAndExit(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
-
- print 'scheme =',scheme,', be host =',beHost,', be port =', bePort,', user =', adminUser
-
- if ( beHost == None ):
- usage()
- sys.exit(3)
-
- importPolicyTypes(scheme, beHost, bePort, adminUser, True, "../../../import/tosca/policy-types/")
+ print 'Number of arguments:', len(sys.argv), 'arguments.'
+ be_host = 'localhost'
+ be_port = '8080'
+ admin_user = 'jh0003'
+ scheme = 'http'
-if __name__ == "__main__":
- main(sys.argv[1:])
+ try:
+ opts, args = getopt.getopt(argv, "i:p:u:h:s:", ["ip=", "port=", "user=", "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"):
+ be_host = arg
+ elif opt in ("-p", "--port"):
+ be_port = arg
+ elif opt in ("-u", "--user"):
+ admin_user = arg
+ elif opt in ("-s", "--scheme"):
+ scheme = arg
+
+ print 'scheme =', scheme, ', be host =', be_host, ', be port =', be_port, ', user =', admin_user
+
+ if be_host is None:
+ usage()
+ sys.exit(3)
+
+ importPolicyTypes(scheme, be_host, be_port, admin_user, True, "../../../import/tosca/policy-types/")
+
+
+if __name__ == "__main__":
+ main(sys.argv[1:])
diff --git a/catalog-be/src/main/resources/scripts/import/tosca/importSolTypes.py b/catalog-be/src/main/resources/scripts/import/tosca/importSolTypes.py
index 0015a26655..24479c4f6b 100644
--- a/catalog-be/src/main/resources/scripts/import/tosca/importSolTypes.py
+++ b/catalog-be/src/main/resources/scripts/import/tosca/importSolTypes.py
@@ -51,7 +51,7 @@ def main(argv):
opts, args = getopt.getopt(argv,"i:p:u:v:h:",["ip=","port=","user=","updateversion="])
except getopt.GetoptError:
usage()
- errorAndExit(2, 'Invalid input')
+ error_and_exit(2, 'Invalid input')
for opt, arg in opts:
#print opt, arg
@@ -90,9 +90,9 @@ def main(argv):
failedNormatives = filter(lambda x: x[1] == None or x[1] not in responseCodes, results)
if (len(failedNormatives) > 0):
- errorAndExit(1, None)
+ error_and_exit(1, None)
else:
- errorAndExit(0, None)
+ error_and_exit(0, None)
if __name__ == "__main__":
diff --git a/catalog-be/src/main/resources/scripts/import/tosca/importUsersFromYaml.py b/catalog-be/src/main/resources/scripts/import/tosca/importUsersFromYaml.py
index 8e69ffcf49..23e854bcb8 100644
--- a/catalog-be/src/main/resources/scripts/import/tosca/importUsersFromYaml.py
+++ b/catalog-be/src/main/resources/scripts/import/tosca/importUsersFromYaml.py
@@ -129,7 +129,7 @@ def createUser(scheme, beHost, bePort, user, adminUser):
return (userId, None)
-def errorAndExit(errorCode, errorDesc):
+def error_and_exit(errorCode, errorDesc):
if ( errorCode > 0 ):
print("status=" + str(errorCode) + ". " + errorDesc)
else:
@@ -153,7 +153,7 @@ def main(argv):
opts, args = getopt.getopt(argv,"i:p:f:h:s:",["ip=","port=","ifile=","scheme="])
except getopt.GetoptError:
usage()
- errorAndExit(2, 'Invalid input')
+ error_and_exit(2, 'Invalid input')
for opt, arg in opts:
#print opt, arg
@@ -204,7 +204,7 @@ def main(argv):
if ( len(result) > 0 ):
#print("ERROR: Failed to load the users " + ', '.join(map(lambda x: x[0],result)))
- errorAndExit(3, "Failed to load the users " + ', '.join(map(lambda x: x[0],result)))
+ error_and_exit(3, "Failed to load the users " + ', '.join(map(lambda x: x[0],result)))
g = lambda x: x[1] == 409
result = filter(g, resultTable)
@@ -222,7 +222,7 @@ def main(argv):
print("Loaded users: " + ', '.join(map(lambda x: x[0],result)))
print("-------------------------------------------")
- errorAndExit(0, None)
+ error_and_exit(0, None)
if __name__ == "__main__":
diff --git a/catalog-be/src/main/resources/scripts/import/tosca/typesToUpgrade.json b/catalog-be/src/main/resources/scripts/import/tosca/typesToUpgrade.json
index 7ea3dd4eda..1ea8f98925 100644
--- a/catalog-be/src/main/resources/scripts/import/tosca/typesToUpgrade.json
+++ b/catalog-be/src/main/resources/scripts/import/tosca/typesToUpgrade.json
@@ -1,6 +1,7 @@
{
"heat": [
- "Generic_CR"
+ "configuration",
+ "fabricConfiguration"
],
"normative": [
]
diff --git a/catalog-be/src/main/resources/scripts/import/tosca/upgradeHeatAndNormativeTypes.py b/catalog-be/src/main/resources/scripts/import/tosca/upgradeHeatAndNormativeTypes.py
index 5a1d1046b9..265bf33f9a 100644
--- a/catalog-be/src/main/resources/scripts/import/tosca/upgradeHeatAndNormativeTypes.py
+++ b/catalog-be/src/main/resources/scripts/import/tosca/upgradeHeatAndNormativeTypes.py
@@ -65,7 +65,7 @@ def main(argv):
opts, args = getopt.getopt(argv, "i:p:u:v:h:s:", ["ip=", "port=", "user=", "updateversion=","scheme="])
except getopt.GetoptError:
usage()
- errorAndExit(2, 'Invalid input')
+ error_and_exit(2, 'Invalid input')
for opt, arg in opts:
# print opt, arg
@@ -104,9 +104,9 @@ def main(argv):
failedNormatives = filter(lambda x: x[1] == None or x[1] not in responseCodes, results)
if (len(failedNormatives) > 0):
- errorAndExit(1, None)
+ error_and_exit(1, None)
else:
- errorAndExit(0, None)
+ error_and_exit(0, None)
if __name__ == "__main__":
diff --git a/catalog-be/src/main/resources/scripts/import/tosca/upgradeHeatTypes1707.py b/catalog-be/src/main/resources/scripts/import/tosca/upgradeHeatTypes1707.py
index 5cb0ca3b0c..4f254f26fe 100644
--- a/catalog-be/src/main/resources/scripts/import/tosca/upgradeHeatTypes1707.py
+++ b/catalog-be/src/main/resources/scripts/import/tosca/upgradeHeatTypes1707.py
@@ -69,7 +69,7 @@ def main(argv):
opts, args = getopt.getopt(argv,"i:p:u:v:h:s:",["ip=","port=","user=","updateversion=","scheme="])
except getopt.GetoptError:
usage()
- errorAndExit(2, 'Invalid input')
+ error_and_exit(2, 'Invalid input')
for opt, arg in opts:
#print opt, arg
@@ -108,9 +108,9 @@ def main(argv):
failedNormatives = filter(lambda x: x[1] == None or x[1] not in responseCodes, results)
if (len(failedNormatives) > 0):
- errorAndExit(1, None)
+ error_and_exit(1, None)
else:
- errorAndExit(0, None)
+ error_and_exit(0, None)
if __name__ == "__main__":
diff --git a/catalog-be/src/main/resources/scripts/import/tosca/upgradeNfvTypes.py b/catalog-be/src/main/resources/scripts/import/tosca/upgradeNfvTypes.py
index 66d82f9e91..cb7628e974 100644
--- a/catalog-be/src/main/resources/scripts/import/tosca/upgradeNfvTypes.py
+++ b/catalog-be/src/main/resources/scripts/import/tosca/upgradeNfvTypes.py
@@ -55,7 +55,7 @@ def main(argv):
opts, args = getopt.getopt(argv, "i:p:u:v:h:s:", ["ip=", "port=", "user=", "updateversion=","scheme="])
except getopt.GetoptError:
usage()
- errorAndExit(2, 'Invalid input')
+ error_and_exit(2, 'Invalid input')
for opt, arg in opts:
# print opt, arg
@@ -94,9 +94,9 @@ def main(argv):
failedNormatives = filter(lambda x: x[1] == None or x[1] not in responseCodes, results)
if (len(failedNormatives) > 0):
- errorAndExit(1, None)
+ error_and_exit(1, None)
else:
- errorAndExit(0, None)
+ error_and_exit(0, None)
if __name__ == "__main__":
diff --git a/catalog-be/src/main/resources/scripts/import/tosca/upgradeNormative.py b/catalog-be/src/main/resources/scripts/import/tosca/upgradeNormative.py
index 573e05b46a..bbeb3d6972 100644
--- a/catalog-be/src/main/resources/scripts/import/tosca/upgradeNormative.py
+++ b/catalog-be/src/main/resources/scripts/import/tosca/upgradeNormative.py
@@ -11,7 +11,7 @@ from importPolicyTypes import importPolicyTypes
from importGroupTypes import importGroupTypes
from importNormativeCapabilities import importNormativeCapabilities
from importNormativeInterfaceLifecycleTypes import importNormativeInterfaceLifecycleType
-from importOnapTypes import importOnapTypes
+from importAnnotationTypes import import_annotation_types
from importCommon import *
@@ -31,93 +31,95 @@ import importCommon
#################################################################################################################################################################################################################################
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>]'
+ 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>]'
def handleResults(results, updateversion):
- printFrameLine()
- for result in results:
- printNameAndReturnCode(result[0], result[1])
- printFrameLine()
+ print_frame_line()
+ for result in results:
+ print_name_and_return_code(result[0], result[1])
+ print_frame_line()
- failedResults = filter(lambda x: x[1] == None or x[1] not in [200, 201, 409], results)
- if (len(failedResults) > 0):
- errorAndExit(1, None)
+ failedResults = filter(lambda x: x[1] == None or x[1] not in [200, 201, 409], 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:h:s:",["ip=","port=","user=","debug=","scheme="])
- except getopt.GetoptError:
- usage()
- errorAndExit(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")
-
- print 'scheme =',scheme,', be host =',beHost,', be port =', bePort,', user =', adminUser, ', debug =', debugf
-
- 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 + "categories/"
- importCategories(scheme, beHost, bePort, adminUser, False, fileLocation)
-
- fileLocation = baseFileLocation + "data-types/"
- importDataTypes(scheme, beHost, bePort, adminUser, False, fileLocation)
-
- fileLocation = baseFileLocation + "policy-types/"
- importPolicyTypes(scheme, beHost, bePort, adminUser, False, fileLocation)
-
- fileLocation = baseFileLocation + "capability-types/"
- importNormativeCapabilities(scheme, beHost, bePort, adminUser, False, fileLocation)
-
- fileLocation = baseFileLocation + "group-types/"
- importGroupTypes(scheme, beHost, bePort, adminUser, False, fileLocation)
-
- fileLocation = baseFileLocation + "interface-lifecycle-types/"
- importNormativeInterfaceLifecycleType(scheme, beHost, bePort, adminUser, False, fileLocation)
-
- print 'sleep until data type cache is updated'
- time.sleep( 70 )
-
- resultsHeat = upgradeTypesPerConfigFile(scheme, beHost, bePort, adminUser, baseFileLocation, updateversion)
- handleResults(resultsHeat, 'false')
-
- errorAndExit(0, None)
+ 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:h:s:",["ip=","port=","user=","debug=","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")
+
+ print 'scheme =',scheme,', be host =',beHost,', be port =', bePort,', user =', adminUser, ', debug =', debugf
+
+ 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 + "categories/"
+ importCategories(scheme, beHost, bePort, adminUser, False, fileLocation)
+
+ fileLocation = baseFileLocation + "data-types/"
+ importDataTypes(scheme, beHost, bePort, adminUser, False, fileLocation)
+
+ fileLocation = baseFileLocation + "policy-types/"
+ importPolicyTypes(scheme, beHost, bePort, adminUser, False, fileLocation)
+
+ fileLocation = baseFileLocation + "capability-types/"
+ importNormativeCapabilities(scheme, beHost, bePort, adminUser, False, fileLocation)
+
+ fileLocation = baseFileLocation + "group-types/"
+ importGroupTypes(scheme, beHost, bePort, adminUser, False, fileLocation)
+
+ fileLocation = baseFileLocation + "interface-lifecycle-types/"
+ importNormativeInterfaceLifecycleType(scheme, beHost, bePort, adminUser, False, fileLocation)
+
+ import_annotation_types(scheme, beHost, bePort, adminUser, False)
+
+ print 'sleep until data type cache is updated'
+ time.sleep( 70 )
+
+ resultsHeat = upgradeTypesPerConfigFile(scheme, beHost, bePort, adminUser, baseFileLocation, updateversion)
+ handleResults(resultsHeat, 'false')
+
+ error_and_exit(0, None)
if __name__ == "__main__":
main(sys.argv[1:])
diff --git a/catalog-be/src/main/resources/scripts/import/tosca/upgradeNormativeVersion.py b/catalog-be/src/main/resources/scripts/import/tosca/upgradeNormativeVersion.py
index 958416da33..c6fa1c9cab 100644
--- a/catalog-be/src/main/resources/scripts/import/tosca/upgradeNormativeVersion.py
+++ b/catalog-be/src/main/resources/scripts/import/tosca/upgradeNormativeVersion.py
@@ -24,14 +24,14 @@ 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>]'
def handleResults(results, updateversion):
- printFrameLine()
+ print_frame_line()
for result in results:
- printNameAndReturnCode(result[0], result[1])
- printFrameLine()
+ print_name_and_return_code(result[0], result[1])
+ print_frame_line()
failedResults = filter(lambda x: x[1] == None or x[1] not in [200, 201, 409], results)
if (len(failedResults) > 0):
- errorAndExit(1, None)
+ error_and_exit(1, None)
def main(argv):
print 'Number of arguments:', len(sys.argv), 'arguments.'
@@ -48,7 +48,7 @@ def main(argv):
opts, args = getopt.getopt(argv,"i:p:u:d:h:s:",["ip=","port=","user=","debug=","scheme="])
except getopt.GetoptError:
usage()
- errorAndExit(2, 'Invalid input')
+ error_and_exit(2, 'Invalid input')
for opt, arg in opts:
#print opt, arg
@@ -103,7 +103,7 @@ def main(argv):
handleResults(results, 'false')
- errorAndExit(0, None)
+ error_and_exit(0, None)
if __name__ == "__main__":
main(sys.argv[1:])
diff --git a/catalog-be/src/main/resources/scripts/import/tosca/upgradeNormativeVersionAll.py b/catalog-be/src/main/resources/scripts/import/tosca/upgradeNormativeVersionAll.py
index 805d012298..32045513b8 100644
--- a/catalog-be/src/main/resources/scripts/import/tosca/upgradeNormativeVersionAll.py
+++ b/catalog-be/src/main/resources/scripts/import/tosca/upgradeNormativeVersionAll.py
@@ -13,10 +13,10 @@ 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):
- printFrameLine()
+ print_frame_line()
for result in results:
- printNameAndReturnCode(result[0], result[1])
- printFrameLine()
+ print_name_and_return_code(result[0], result[1])
+ print_frame_line()
responseCodes = [200, 201]
@@ -25,7 +25,7 @@ def handleResults(results, updateversion):
failedResults = filter(lambda x: x[1] == None or x[1] not in responseCodes, results)
if (len(failedResults) > 0):
- errorAndExit(1, None)
+ error_and_exit(1, None)
def main(argv):
print 'Number of arguments:', len(sys.argv), 'arguments.'
@@ -42,7 +42,7 @@ def main(argv):
opts, args = getopt.getopt(argv,"i:p:u:d:v:h:s:",["ip=","port=","user=","debug=","updateversion=","scheme="])
except getopt.GetoptError:
usage()
- errorAndExit(2, 'Invalid input')
+ error_and_exit(2, 'Invalid input')
for opt, arg in opts:
#print opt, arg
@@ -93,7 +93,7 @@ def main(argv):
resultsOnap = importOnapTypes(beHost, bePort, adminUser, fileLocation, updateversion)
handleResults(resultsOnap, updateversion)
- errorAndExit(0, None)
+ error_and_exit(0, None)
if __name__ == "__main__":
main(sys.argv[1:])
diff --git a/catalog-be/src/main/resources/scripts/import/tosca/upgradeNormativeVersionProd1702_3537.py b/catalog-be/src/main/resources/scripts/import/tosca/upgradeNormativeVersionProd1702_3537.py
index c75966cfc9..972d792b20 100644
--- a/catalog-be/src/main/resources/scripts/import/tosca/upgradeNormativeVersionProd1702_3537.py
+++ b/catalog-be/src/main/resources/scripts/import/tosca/upgradeNormativeVersionProd1702_3537.py
@@ -24,14 +24,14 @@ 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>]'
def handleResults(results, updateversion):
- printFrameLine()
+ print_frame_line()
for result in results:
- printNameAndReturnCode(result[0], result[1])
- printFrameLine()
+ print_name_and_return_code(result[0], result[1])
+ print_frame_line()
failedResults = filter(lambda x: x[1] == None or x[1] not in [200, 201, 409], results)
if (len(failedResults) > 0):
- errorAndExit(1, None)
+ error_and_exit(1, None)
def main(argv):
print 'Number of arguments:', len(sys.argv), 'arguments.'
@@ -48,7 +48,7 @@ def main(argv):
opts, args = getopt.getopt(argv,"i:p:u:d:h:s:",["ip=","port=","user=","debug=","scheme="])
except getopt.GetoptError:
usage()
- errorAndExit(2, 'Invalid input')
+ error_and_exit(2, 'Invalid input')
for opt, arg in opts:
#print opt, arg
@@ -125,7 +125,7 @@ def main(argv):
handleResults(results, 'false')
- errorAndExit(0, None)
+ error_and_exit(0, None)
if __name__ == "__main__":
main(sys.argv[1:])
diff --git a/catalog-be/src/main/resources/scripts/import/tosca/upgradeONAPNormative.py b/catalog-be/src/main/resources/scripts/import/tosca/upgradeONAPNormative.py
index 289678b369..bebba6c2cb 100644
--- a/catalog-be/src/main/resources/scripts/import/tosca/upgradeONAPNormative.py
+++ b/catalog-be/src/main/resources/scripts/import/tosca/upgradeONAPNormative.py
@@ -37,15 +37,15 @@ def usage():
def handleResults(results):
if results is not None:
- printFrameLine()
+ print_frame_line()
for result in results:
- printNameAndReturnCode(result[0], result[1])
+ print_name_and_return_code(result[0], result[1])
- printFrameLine()
+ print_frame_line()
failedResults = filter(lambda x: x[1] == None or x[1] not in [200, 201, 409], results)
if (len(failedResults) > 0):
- errorAndExit(1, None)
+ error_and_exit(1, None)
def main(argv):
print 'Number of arguments:', len(sys.argv), 'arguments.'
@@ -63,7 +63,7 @@ def main(argv):
opts, args = getopt.getopt(argv,"i:p:u:d:h",["ip=","port=","user=","debug="])
except getopt.GetoptError:
usage()
- errorAndExit(2, 'Invalid input')
+ error_and_exit(2, 'Invalid input')
for opt, arg in opts:
#print opt, arg
@@ -131,7 +131,7 @@ def main(argv):
resultsHeat = upgradeSolTypesPerConfigFile(scheme, beHost, bePort, adminUser, baseFileLocation, updateOnapVersion)
handleResults(resultsHeat)
- errorAndExit(0, None)
+ error_and_exit(0, None)
if __name__ == "__main__":
main(sys.argv[1:])
diff --git a/catalog-be/src/main/resources/scripts/import/tosca/upgradeONAPTypes.py b/catalog-be/src/main/resources/scripts/import/tosca/upgradeONAPTypes.py
index edf5a194f6..24a7b0e5b3 100644
--- a/catalog-be/src/main/resources/scripts/import/tosca/upgradeONAPTypes.py
+++ b/catalog-be/src/main/resources/scripts/import/tosca/upgradeONAPTypes.py
@@ -55,7 +55,7 @@ def main(argv):
opts, args = getopt.getopt(argv, "i:p:u:v:h:s:", ["ip=", "port=", "user=", "updateversion=","scheme="])
except getopt.GetoptError:
usage()
- errorAndExit(2, 'Invalid input')
+ error_and_exit(2, 'Invalid input')
for opt, arg in opts:
# print opt, arg
@@ -94,9 +94,9 @@ def main(argv):
failedNormatives = filter(lambda x: x[1] == None or x[1] not in responseCodes, results)
if (len(failedNormatives) > 0):
- errorAndExit(1, None)
+ error_and_exit(1, None)
else:
- errorAndExit(0, None)
+ error_and_exit(0, None)
if __name__ == "__main__":
diff --git a/catalog-be/src/main/resources/scripts/import/tosca/upgradeSolTypes.py b/catalog-be/src/main/resources/scripts/import/tosca/upgradeSolTypes.py
index 25d9b4d1fc..d3e5a4b2da 100644
--- a/catalog-be/src/main/resources/scripts/import/tosca/upgradeSolTypes.py
+++ b/catalog-be/src/main/resources/scripts/import/tosca/upgradeSolTypes.py
@@ -55,7 +55,7 @@ def main(argv):
opts, args = getopt.getopt(argv, "i:p:u:v:h:s:", ["ip=", "port=", "user=", "updateversion=","scheme="])
except getopt.GetoptError:
usage()
- errorAndExit(2, 'Invalid input')
+ error_and_exit(2, 'Invalid input')
for opt, arg in opts:
# print opt, arg
@@ -94,9 +94,9 @@ def main(argv):
failedNormatives = filter(lambda x: x[1] == None or x[1] not in responseCodes, results)
if (len(failedNormatives) > 0):
- errorAndExit(1, None)
+ error_and_exit(1, None)
else:
- errorAndExit(0, None)
+ error_and_exit(0, None)
if __name__ == "__main__":