summaryrefslogtreecommitdiffstats
path: root/catalog-be/src/main/resources/scripts
diff options
context:
space:
mode:
authorMichael Lando <ml636r@att.com>2018-03-04 14:53:33 +0200
committerMichael Lando <ml636r@att.com>2018-03-07 13:19:05 +0000
commita5445100050e49e83f73424198d73cd72d672a4d (patch)
treecacf4df817df31be23e4e790d1dda857bdae061e /catalog-be/src/main/resources/scripts
parent51157f92c21976cba4914c378aaa3cba49826931 (diff)
Sync Integ to Master
Change-Id: I71e3acc26fa612127756ac04073a522b9cc6cd74 Issue-ID: SDC-977 Signed-off-by: Gitelman, Tal (tg851x) <tg851x@intl.att.com>
Diffstat (limited to 'catalog-be/src/main/resources/scripts')
-rw-r--r--catalog-be/src/main/resources/scripts/import/tosca/importCategoryTypes.py37
-rw-r--r--catalog-be/src/main/resources/scripts/import/tosca/importDataTypes.py37
-rw-r--r--catalog-be/src/main/resources/scripts/import/tosca/importGroupTypes.py37
-rw-r--r--catalog-be/src/main/resources/scripts/import/tosca/importHeatTypes.py39
-rw-r--r--catalog-be/src/main/resources/scripts/import/tosca/importNodeType.py18
-rw-r--r--catalog-be/src/main/resources/scripts/import/tosca/importNormativeAll.py51
-rw-r--r--catalog-be/src/main/resources/scripts/import/tosca/importNormativeCapabilities.py37
-rw-r--r--catalog-be/src/main/resources/scripts/import/tosca/importNormativeElements.py30
-rw-r--r--catalog-be/src/main/resources/scripts/import/tosca/importNormativeInterfaceLifecycleTypes.py37
-rw-r--r--catalog-be/src/main/resources/scripts/import/tosca/importNormativeNoHeatAndNormativeTypes.py43
-rw-r--r--catalog-be/src/main/resources/scripts/import/tosca/importNormativeTypes.py46
-rw-r--r--catalog-be/src/main/resources/scripts/import/tosca/importONAPNormativeAll.py27
-rw-r--r--catalog-be/src/main/resources/scripts/import/tosca/importOnapTypes.py35
-rw-r--r--catalog-be/src/main/resources/scripts/import/tosca/importPolicyTypes.py37
-rw-r--r--catalog-be/src/main/resources/scripts/import/tosca/importUsersFromYaml.py63
-rw-r--r--catalog-be/src/main/resources/scripts/import/tosca/typesToUpgrade.json15
-rw-r--r--catalog-be/src/main/resources/scripts/import/tosca/upgradeHeatAndNormativeTypes.py37
-rw-r--r--catalog-be/src/main/resources/scripts/import/tosca/upgradeHeatTypes1707.py37
-rw-r--r--catalog-be/src/main/resources/scripts/import/tosca/upgradeNormative.py51
-rw-r--r--catalog-be/src/main/resources/scripts/import/tosca/upgradeNormativeVersion.py39
-rw-r--r--catalog-be/src/main/resources/scripts/import/tosca/upgradeNormativeVersionAll.py13
-rw-r--r--catalog-be/src/main/resources/scripts/import/tosca/upgradeNormativeVersionProd1702_3537.py49
-rw-r--r--catalog-be/src/main/resources/scripts/import/tosca/upgradeONAPNormative.py21
23 files changed, 451 insertions, 385 deletions
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 aca21754e8..2f3237173c 100644
--- a/catalog-be/src/main/resources/scripts/import/tosca/importCategoryTypes.py
+++ b/catalog-be/src/main/resources/scripts/import/tosca/importCategoryTypes.py
@@ -6,24 +6,24 @@ import copy
from importNormativeElements import createNormativeElement
from importCommon import *
-################################################################################################################################################
-# #
-# Import all users from a given file #
-# #
-# activation : #
-# python importUsers.py [-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 importUsers.py [-f <input file> | --ifile=<input file> ] #
-# #
-################################################################################################################################################
+#########################################################################################################################################################################################
+# #
+# Import categoriy types #
+# #
+# activation : #
+# python importCategoryTypes.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 importCategoryTypes.py [-f <input file> | --ifile=<input file> ] #
+# #
+#########################################################################################################################################################################################
def usage():
- print sys.argv[0], '[-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 importCategories(beHost, bePort, adminUser, exitOnSuccess, fileDir):
- result = createNormativeElement(beHost, bePort, adminUser, fileDir, "/sdc2/rest/v1/catalog/uploadType/categories", "categoryTypes", "categoriesZip")
+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])
@@ -41,9 +41,10 @@ def main(argv):
beHost = 'localhost'
bePort = '8080'
adminUser = 'jh0003'
+ scheme = 'http'
try:
- opts, args = getopt.getopt(argv,"i:p:u:h:",["ip=","port=","user="])
+ opts, args = getopt.getopt(argv,"i:p:u:h:s:",["ip=","port=","user=","scheme="])
except getopt.GetoptError:
usage()
errorAndExit(2, 'Invalid input')
@@ -59,14 +60,16 @@ def main(argv):
bePort = arg
elif opt in ("-u", "--user"):
adminUser = arg
+ elif opt in ("-s", "--scheme"):
+ scheme = arg
- print 'be host =',beHost,', be port =', bePort,', user =', adminUser
+ print 'scheme =',scheme,', be host =',beHost,', be port =', bePort,', user =', adminUser
if ( beHost == None ):
usage()
sys.exit(3)
- importCategories(beHost, bePort, adminUser, True, "../../../import/tosca/categories/")
+ importCategories(scheme, beHost, bePort, adminUser, True, "../../../import/tosca/categories/")
if __name__ == "__main__":
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 5d7f5b7576..ef51a907d5 100644
--- a/catalog-be/src/main/resources/scripts/import/tosca/importDataTypes.py
+++ b/catalog-be/src/main/resources/scripts/import/tosca/importDataTypes.py
@@ -6,24 +6,24 @@ import copy
from importNormativeElements import createNormativeElement
from importCommon import *
-################################################################################################################################################
-# #
-# Import tosca data types #
-# #
-# activation : #
-# python importDataTypes.py [-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 importDataTypes.py [-f <input file> | --ifile=<input file> ] #
-# #
-################################################################################################################################################
+#####################################################################################################################################################################################
+# #
+# Import tosca data types #
+# #
+# activation : #
+# python importDataTypes.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 importDataTypes.py [-f <input file> | --ifile=<input file> ] #
+# #
+#####################################################################################################################################################################################
def usage():
- print sys.argv[0], '[-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 importDataTypes(beHost, bePort, adminUser, exitOnSuccess, fileDir):
- result = createNormativeElement(beHost, bePort, adminUser, fileDir, "/sdc2/rest/v1/catalog/uploadType/datatypes", "dataTypes", "dataTypesZip")
+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])
@@ -41,9 +41,10 @@ def main(argv):
beHost = 'localhost'
bePort = '8080'
adminUser = 'jh0003'
+ scheme = 'http'
try:
- opts, args = getopt.getopt(argv,"i:p:u:h:",["ip=","port=","user="])
+ opts, args = getopt.getopt(argv,"i:p:u:h:s:",["ip=","port=","user=","scheme="])
except getopt.GetoptError:
usage()
errorAndExit(2, 'Invalid input')
@@ -59,14 +60,16 @@ def main(argv):
bePort = arg
elif opt in ("-u", "--user"):
adminUser = arg
+ elif opt in ("-s", "--scheme"):
+ scheme = arg
- print 'be host =',beHost,', be port =', bePort,', user =', adminUser
+ print 'scheme =',scheme,', be host =',beHost,', be port =', bePort,', user =', adminUser
if ( beHost == None ):
usage()
sys.exit(3)
- importDataTypes(beHost, bePort, adminUser, True, "../../../import/tosca/data-types/")
+ importDataTypes(scheme, beHost, bePort, adminUser, True, "../../../import/tosca/data-types/")
if __name__ == "__main__":
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 2b6a5db6f8..9daa990fc5 100644
--- a/catalog-be/src/main/resources/scripts/import/tosca/importGroupTypes.py
+++ b/catalog-be/src/main/resources/scripts/import/tosca/importGroupTypes.py
@@ -6,24 +6,24 @@ import copy
from importNormativeElements import createNormativeElement
from importCommon import *
-################################################################################################################################################
-# #
-# Import tosca data types #
-# #
-# activation : #
-# python importGroupTypes.py [-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 importGroupTypes.py [-f <input file> | --ifile=<input file> ] #
-# #
-################################################################################################################################################
+#####################################################################################################################################################################################
+# #
+# Import tosca data types #
+# #
+# activation : #
+# python importGroupTypes.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 importGroupTypes.py [-f <input file> | --ifile=<input file> ] #
+# #
+#####################################################################################################################################################################################
def usage():
- print sys.argv[0], '[-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(beHost, bePort, adminUser, exitOnSuccess, fileDir):
- result = createNormativeElement(beHost, bePort, adminUser, fileDir, "/sdc2/rest/v1/catalog/uploadType/grouptypes", "groupTypes", "groupTypesZip")
+def importGroupTypes(scheme, beHost, bePort, adminUser, exitOnSuccess, fileDir):
+ result = createNormativeElement(scheme, beHost, bePort, adminUser, fileDir, "/sdc2/rest/v1/catalog/uploadType/grouptypes", "groupTypes", "groupTypesZip")
printFrameLine()
printNameAndReturnCode(result[0], result[1])
@@ -41,9 +41,10 @@ def main(argv):
beHost = 'localhost'
bePort = '8080'
adminUser = 'jh0003'
+ scheme = 'http'
try:
- opts, args = getopt.getopt(argv,"i:p:u:h:",["ip=","port=","user="])
+ opts, args = getopt.getopt(argv,"i:p:u:h:s:",["ip=","port=","user=","scheme="])
except getopt.GetoptError:
usage()
errorAndExit(2, 'Invalid input')
@@ -59,14 +60,16 @@ def main(argv):
bePort = arg
elif opt in ("-u", "--user"):
adminUser = arg
+ elif opt in ("-s", "--scheme"):
+ scheme = arg
- print 'be host =',beHost,', be port =', bePort,', user =', adminUser
+ print 'scheme =',scheme,', be host =',beHost,', be port =', bePort,', user =', adminUser
if ( beHost == None ):
usage()
sys.exit(3)
- importGroupTypes(beHost, bePort, adminUser, True, "../../../import/tosca/group-types/")
+ importGroupTypes(scheme, beHost, bePort, adminUser, True, "../../../import/tosca/group-types/")
if __name__ == "__main__":
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 8b16a72ab3..4490fec61a 100644
--- a/catalog-be/src/main/resources/scripts/import/tosca/importHeatTypes.py
+++ b/catalog-be/src/main/resources/scripts/import/tosca/importHeatTypes.py
@@ -7,19 +7,19 @@ from importCommon import *
from importNormativeTypes import *
import importCommon
-################################################################################################################################################
-# #
-# Import all users from a given file #
-# #
-# activation : #
-# python importUsers.py [-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 importUsers.py [-f <input file> | --ifile=<input file> ] #
-# #
-################################################################################################################################################
+#####################################################################################################################################################################################
+# #
+# Import heat types #
+# #
+# activation : #
+# python importHeatTypes.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 importHeatTypes.py [-f <input file> | --ifile=<input file> ] #
+# #
+#####################################################################################################################################################################################
-def importHeatTypes(beHost, bePort, adminUser, fileDir, updateversion):
+def importHeatTypes(scheme, beHost, bePort, adminUser, fileDir, updateversion):
heatTypes = [ "globalNetwork",
"globalPort",
@@ -38,6 +38,7 @@ def importHeatTypes(beHost, bePort, adminUser, fileDir, updateversion):
"abstractSubstitute",
"Generic_VFC",
"Generic_VF",
+ "Generic_CR",
"Generic_PNF",
"Generic_Service",
"contrailNetworkRules",
@@ -57,7 +58,8 @@ def importHeatTypes(beHost, bePort, adminUser, fileDir, updateversion):
"extCp2",
"extNeutronCP",
"extContrailCP",
- "portMirroringByPolicy"
+ "portMirroringByPolicy",
+ "forwardingPath"
]
responseCodes = [200, 201]
@@ -67,7 +69,7 @@ def importHeatTypes(beHost, bePort, adminUser, fileDir, updateversion):
results = []
for heatType in heatTypes:
- result = createNormativeType(beHost, bePort, adminUser, fileDir, heatType, updateversion)
+ 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])
@@ -81,9 +83,10 @@ def main(argv):
bePort = '8080'
adminUser = 'jh0003'
updateversion = 'true'
+ scheme = 'http'
try:
- opts, args = getopt.getopt(argv,"i:p:u:v:h:",["ip=","port=","user=","updateversion="])
+ opts, args = getopt.getopt(argv,"i:p:u:v:h:s:",["ip=","port=","user=","updateversion=","scheme="])
except getopt.GetoptError:
usage()
errorAndExit(2, 'Invalid input')
@@ -99,17 +102,19 @@ def main(argv):
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 'be host =',beHost,', be port =', bePort,', user =', adminUser
+ print 'scheme =',scheme,', be host =',beHost,', be port =', bePort,', user =', adminUser
if ( beHost == None ):
usage()
sys.exit(3)
- results = importHeatTypes(beHost, bePort, adminUser, "../../../import/tosca/heat-types/", updateversion)
+ results = importHeatTypes(scheme, beHost, bePort, adminUser, "../../../import/tosca/heat-types/", updateversion)
print "-----------------------------"
for result in results:
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 f35cc7bcee..7d0b7c526a 100644
--- a/catalog-be/src/main/resources/scripts/import/tosca/importNodeType.py
+++ b/catalog-be/src/main/resources/scripts/import/tosca/importNodeType.py
@@ -16,7 +16,7 @@ def createZipFromYml(ymlFile, zipFile):
zip.write(ymlFile, os.path.basename(ymlFile))
zip.close()
-def createUserNormativeType(beHost, bePort, adminUser, fileDir, ELEMENT_NAME):
+def createUserNormativeType(scheme, beHost, bePort, adminUser, fileDir, ELEMENT_NAME):
try:
log("in create normative type ", ELEMENT_NAME)
@@ -26,7 +26,7 @@ def createUserNormativeType(beHost, bePort, adminUser, fileDir, ELEMENT_NAME):
buffer = StringIO()
c = pycurl.Curl()
- url = 'http://' + beHost + ':' + bePort + '/sdc2/rest/v1/catalog/upload/multipart'
+ url = scheme + '://' + beHost + ':' + bePort + '/sdc2/rest/v1/catalog/upload/multipart'
c.setopt(c.URL, url)
c.setopt(c.POST, 1)
@@ -55,6 +55,9 @@ def createUserNormativeType(beHost, bePort, adminUser, fileDir, ELEMENT_NAME):
c.setopt(pycurl.HTTPPOST, send)
c.setopt(c.WRITEFUNCTION, buffer.write)
+ if scheme == 'https':
+ c.setopt(c.SSL_VERIFYPEER, 0)
+
res = c.perform()
#print("Before get response code")
@@ -73,7 +76,7 @@ def createUserNormativeType(beHost, bePort, adminUser, fileDir, ELEMENT_NAME):
def usage():
- print sys.argv[0], '[-i <be host> | --ip=<be host>] [-p <be port> | --port=<be port> ] [-u <user userId> | --user=<user userId> ] [-l <directory base location> | --location=<directory base location>] [-e <element name> | --element=<element name>]'
+ 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> ] [-l <directory base location> | --location=<directory base location>] [-e <element name> | --element=<element name>]'
print "----------------- Example -------------------"
print "python importNodeType.py -d false -l /home/vagrant/catalog-be-1604.0.2.15.6-SNAPSHOT/scripts/import/tosca/../../../import/tosca/user-normative-types/ -e root1"
@@ -86,9 +89,10 @@ def main(argv):
debugf = None
location = None
element = None
+ scheme = 'http'
try:
- opts, args = getopt.getopt(argv,"i:p:u:d:l:e:h",["ip=","port=","user=","location=","element=", "debug="])
+ 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')
@@ -108,11 +112,13 @@ def main(argv):
location = arg
elif opt in ("-e", "--element"):
element = 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 'be host =',beHost,', be port =', bePort,', user =', adminUser
+ print 'scheme =',scheme,', be host =',beHost,', be port =', bePort,', user =', adminUser
if ( beHost == None ):
usage()
@@ -139,7 +145,7 @@ def main(argv):
#normativeType = "root1"
- result = createUserNormativeType(beHost, bePort, adminUser, location, element)
+ result = createUserNormativeType(scheme, beHost, bePort, adminUser, location, element)
#result = createUserNormativeType(beHost, bePort, adminUser, fileDir, normativeType)
print "---------------------------------------"
print "{0:30} | {1:6}".format(result[0], result[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 b6e390992e..d57c3d6ce4 100644
--- a/catalog-be/src/main/resources/scripts/import/tosca/importNormativeAll.py
+++ b/catalog-be/src/main/resources/scripts/import/tosca/importNormativeAll.py
@@ -18,21 +18,21 @@ from importPolicyTypes import importPolicyTypes
from importCommon import *
import importCommon
-#################################################################################################################################################################################################
-# #
-# Import all users from a given file #
-# #
-# activation : #
-# python importNormativeAll.py [-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 #
-# #
-#################################################################################################################################################################################################
+#################################################################################################################################################################################################################################
+# #
+# 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], '[-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()
@@ -57,10 +57,11 @@ def main(argv):
adminUser = 'jh0003'
debugf = None
updateversion = 'true'
- importCommon.debugFlag = False
+ importCommon.debugFlag = False
+ scheme = 'http'
try:
- opts, args = getopt.getopt(argv,"i:p:u:d:v:h",["ip=","port=","user=","debug=","updateversion="])
+ 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')
@@ -76,6 +77,8 @@ def main(argv):
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")
@@ -84,7 +87,7 @@ def main(argv):
if (arg.lower() == "false" or arg.lower() == "no"):
updateversion = 'false'
- print 'be host =',beHost,', be port =', bePort,', user =', adminUser, ', debug =', debugf, ', updateversion =', updateversion
+ 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)
@@ -101,33 +104,33 @@ def main(argv):
baseFileLocation = pathdir + "/../../../import/tosca/"
fileLocation = baseFileLocation + "data-types/"
- importDataTypes(beHost, bePort, adminUser, False, fileLocation)
+ importDataTypes(scheme, beHost, bePort, adminUser, False, fileLocation)
print 'sleep until data type cache is updated'
time.sleep( 70 )
fileLocation = baseFileLocation + "capability-types/"
- importNormativeCapabilities(beHost, bePort, adminUser, False, fileLocation)
+ importNormativeCapabilities(scheme, beHost, bePort, adminUser, False, fileLocation)
fileLocation = baseFileLocation + "interface-lifecycle-types/"
- importNormativeInterfaceLifecycleType(beHost, bePort, adminUser, False, fileLocation)
+ importNormativeInterfaceLifecycleType(scheme, beHost, bePort, adminUser, False, fileLocation)
fileLocation = baseFileLocation + "categories/"
- importCategories(beHost, bePort, adminUser, False, fileLocation)
+ importCategories(scheme, beHost, bePort, adminUser, False, fileLocation)
fileLocation = baseFileLocation + "normative-types/"
- results = importNormativeTypes(beHost, bePort, adminUser, fileLocation, updateversion)
+ results = importNormativeTypes(scheme, beHost, bePort, adminUser, fileLocation, updateversion)
handleResults(results, updateversion)
fileLocation = baseFileLocation + "heat-types/"
- resultsHeat = importHeatTypes(beHost, bePort, adminUser, fileLocation, updateversion)
+ resultsHeat = importHeatTypes(scheme, beHost, bePort, adminUser, fileLocation, updateversion)
handleResults(resultsHeat, updateversion)
fileLocation = baseFileLocation + "group-types/"
- importGroupTypes(beHost, bePort, adminUser, False, fileLocation)
+ importGroupTypes(scheme, beHost, bePort, adminUser, False, fileLocation)
fileLocation = baseFileLocation + "policy-types/"
- importPolicyTypes(beHost, bePort, adminUser, False, fileLocation)
+ importPolicyTypes(scheme, beHost, bePort, adminUser, False, fileLocation)
errorAndExit(0, None)
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 bda02ddda9..e4f92139c2 100644
--- a/catalog-be/src/main/resources/scripts/import/tosca/importNormativeCapabilities.py
+++ b/catalog-be/src/main/resources/scripts/import/tosca/importNormativeCapabilities.py
@@ -7,25 +7,25 @@ from importNormativeElements import createNormativeElement
from importCommon import *
import importCommon
-################################################################################################################################################
-# #
-# Import all users from a given file #
-# #
-# activation : #
-# python importUsers.py [-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 importUsers.py [-f <input file> | --ifile=<input file> ] #
-# #
-################################################################################################################################################
+#################################################################################################################################################################################################
+# #
+# Import normative capabilities #
+# #
+# activation : #
+# python importNormativeCapabilities.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 importNormativeCapabilities.py [-f <input file> | --ifile=<input file> ] #
+# #
+#################################################################################################################################################################################################
def usage():
- print sys.argv[0], '[-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 importNormativeCapabilities(beHost, bePort, adminUser, exitOnSuccess, fileDir):
- result = createNormativeElement(beHost, bePort, adminUser, fileDir, "/sdc2/rest/v1/catalog/uploadType/capability", "capabilityTypes", "capabilityTypeZip")
+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])
@@ -44,9 +44,10 @@ def main(argv):
beHost = 'localhost'
bePort = '8080'
adminUser = 'jh0003'
+ scheme = 'http'
try:
- opts, args = getopt.getopt(argv,"i:p:u:h:",["ip=","port=","user="])
+ opts, args = getopt.getopt(argv,"i:p:u:h:s:",["ip=","port=","user=","scheme="])
except getopt.GetoptError:
usage()
importCommon.errorAndExit(2, 'Invalid input')
@@ -62,14 +63,16 @@ def main(argv):
bePort = arg
elif opt in ("-u", "--user"):
adminUser = arg
+ elif opt in ("-s", "--scheme"):
+ scheme = arg
- print 'be host =',beHost,', be port =', bePort,', user =', adminUser
+ print 'scheme =',scheme,', be host =',beHost,', be port =', bePort,', user =', adminUser
if ( beHost == None ):
usage()
sys.exit(3)
- importNormativeCapabilities(beHost, bePort, adminUser, True, "../../../import/tosca/capability-types/")
+ importNormativeCapabilities(scheme, beHost, bePort, adminUser, True, "../../../import/tosca/capability-types/")
if __name__ == "__main__":
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 af643da4f4..c28bbfb143 100644
--- a/catalog-be/src/main/resources/scripts/import/tosca/importNormativeElements.py
+++ b/catalog-be/src/main/resources/scripts/import/tosca/importNormativeElements.py
@@ -4,19 +4,19 @@ from StringIO import StringIO
import json
import copy
from importCommon import *
-################################################################################################################################################
-# #
-# Import all users from a given file #
-# #
-# activation : #
-# python importUsers.py [-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 importUsers.py [-f <input file> | --ifile=<input file> ] #
-# #
-################################################################################################################################################
+#################################################################################################################################################################################
+# #
+# Import all users from a given file #
+# #
+# activation : #
+# python importUsers.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 importUsers.py [-f <input file> | --ifile=<input file> ] #
+# #
+#################################################################################################################################################################################
-def createNormativeElement(beHost, bePort, adminUser, fileDir, urlSuffix, ELEMENT_NAME, elementFormName):
+def createNormativeElement(scheme, beHost, bePort, adminUser, fileDir, urlSuffix, ELEMENT_NAME, elementFormName):
try:
log("in create normative element ", ELEMENT_NAME)
@@ -24,7 +24,7 @@ def createNormativeElement(beHost, bePort, adminUser, fileDir, urlSuffix, ELEMEN
buffer = StringIO()
c = pycurl.Curl()
- url = 'http://' + beHost + ':' + bePort + urlSuffix
+ url = scheme + '://' + beHost + ':' + bePort + urlSuffix
c.setopt(c.URL, url)
c.setopt(c.POST, 1)
@@ -45,6 +45,10 @@ def createNormativeElement(beHost, bePort, adminUser, fileDir, urlSuffix, ELEMEN
#c.setopt(c.WRITEFUNCTION, lambda x: None)
c.setopt(c.WRITEFUNCTION, buffer.write)
+
+ if scheme == 'https':
+ c.setopt(c.SSL_VERIFYPEER, 0)
+
#print("before perform")
res = c.perform()
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 33f1cc42de..a6ab5741e4 100644
--- a/catalog-be/src/main/resources/scripts/import/tosca/importNormativeInterfaceLifecycleTypes.py
+++ b/catalog-be/src/main/resources/scripts/import/tosca/importNormativeInterfaceLifecycleTypes.py
@@ -6,24 +6,24 @@ import copy
from importNormativeElements import createNormativeElement
from importCommon import *
-################################################################################################################################################
-# #
-# Import all users from a given file #
-# #
-# activation : #
-# python importUsers.py [-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 importUsers.py [-f <input file> | --ifile=<input file> ] #
-# #
-################################################################################################################################################
+#############################################################################################################################################################################################################
+# #
+# Import all users from a given file #
+# #
+# activation : #
+# python importNormativeInterfaceLifecycleTypes.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 importNormativeInterfaceLifecycleTypes.py [-f <input file> | --ifile=<input file> ] #
+# #
+#############################################################################################################################################################################################################
def usage():
- print sys.argv[0], '[-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 importNormativeInterfaceLifecycleType(beHost, bePort, adminUser, exitOnSuccess, fileDir):
- result = createNormativeElement(beHost, bePort, adminUser, fileDir, "/sdc2/rest/v1/catalog/uploadType/interfaceLifecycle", "interfaceLifecycleTypes", "interfaceLifecycleTypeZip")
+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])
@@ -42,9 +42,10 @@ def main(argv):
beHost = 'localhost'
bePort = '8080'
adminUser = 'jh0003'
+ scheme = 'http'
try:
- opts, args = getopt.getopt(argv,"i:p:u:h:",["ip=","port=","user="])
+ opts, args = getopt.getopt(argv,"i:p:u:h:s:",["ip=","port=","user=","scheme="])
except getopt.GetoptError:
usage()
errorAndExit(2, 'Invalid input')
@@ -60,14 +61,16 @@ def main(argv):
bePort = arg
elif opt in ("-u", "--user"):
adminUser = arg
+ elif opt in ("-s", "--scheme"):
+ scheme = arg
- print 'be host =',beHost,', be port =', bePort,', user =', adminUser
+ print 'scheme =',scheme,', be host =',beHost,', be port =', bePort,', user =', adminUser
if ( beHost == None ):
usage()
sys.exit(3)
- importNormativeInterfaceLifecycleType(beHost, bePort, adminUser, True, "../../../import/tosca/interface-lifecycle-types//")
+ importNormativeInterfaceLifecycleType(scheme, beHost, bePort, adminUser, True, "../../../import/tosca/interface-lifecycle-types//")
if __name__ == "__main__":
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 64a639c3c8..1061df862c 100644
--- a/catalog-be/src/main/resources/scripts/import/tosca/importNormativeNoHeatAndNormativeTypes.py
+++ b/catalog-be/src/main/resources/scripts/import/tosca/importNormativeNoHeatAndNormativeTypes.py
@@ -17,21 +17,21 @@ from importPolicyTypes import importPolicyTypes
from importCommon import *
import importCommon
-#################################################################################################################################################################################################
-# #
-# Import all users from a given file #
-# #
-# activation : #
-# python importNormativeAll.py [-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 #
-# #
-#################################################################################################################################################################################################
+#####################################################################################################################################################################################################################################################
+# #
+# Import all users from a given file #
+# #
+# activation : #
+# python importNormativeNoHeatAndNormativeTypes.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 importNormativeNoHeatAndNormativeTypes.py #
+# #
+#####################################################################################################################################################################################################################################################
def usage():
- print sys.argv[0], '[-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()
@@ -57,9 +57,10 @@ def main(argv):
debugf = None
updateversion = 'true'
importCommon.debugFlag = False
+ scheme = 'http'
try:
- opts, args = getopt.getopt(argv,"i:p:u:d:v:h",["ip=","port=","user=","debug=","updateversion="])
+ 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')
@@ -75,6 +76,8 @@ def main(argv):
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")
@@ -83,7 +86,7 @@ def main(argv):
if (arg.lower() == "false" or arg.lower() == "no"):
updateversion = 'false'
- print 'be host =',beHost,', be port =', bePort,', user =', adminUser, ', debug =', debugf, ', updateversion =', updateversion
+ 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)
@@ -100,16 +103,16 @@ def main(argv):
baseFileLocation = pathdir + "/../../../import/tosca/"
fileLocation = baseFileLocation + "data-types/"
- importDataTypes(beHost, bePort, adminUser, False, fileLocation)
+ importDataTypes(scheme, beHost, bePort, adminUser, False, fileLocation)
print 'sleep until data type cache is updated'
time.sleep( 70 )
fileLocation = baseFileLocation + "capability-types/"
- importNormativeCapabilities(beHost, bePort, adminUser, False, fileLocation)
+ importNormativeCapabilities(scheme, beHost, bePort, adminUser, False, fileLocation)
fileLocation = baseFileLocation + "interface-lifecycle-types/"
- importNormativeInterfaceLifecycleType(beHost, bePort, adminUser, False, fileLocation)
+ importNormativeInterfaceLifecycleType(scheme, beHost, bePort, adminUser, False, fileLocation)
#fileLocation = baseFileLocation + "categories/"
#importCategories(beHost, bePort, adminUser, False, fileLocation)
@@ -123,10 +126,10 @@ def main(argv):
#handleResults(resultsHeat, updateversion)
fileLocation = baseFileLocation + "group-types/"
- importGroupTypes(beHost, bePort, adminUser, False, fileLocation)
+ importGroupTypes(scheme, beHost, bePort, adminUser, False, fileLocation)
fileLocation = baseFileLocation + "policy-types/"
- importPolicyTypes(beHost, bePort, adminUser, False, fileLocation)
+ importPolicyTypes(scheme, beHost, bePort, adminUser, False, fileLocation)
errorAndExit(0, None)
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 1f523858b6..df2cd49687 100644
--- a/catalog-be/src/main/resources/scripts/import/tosca/importNormativeTypes.py
+++ b/catalog-be/src/main/resources/scripts/import/tosca/importNormativeTypes.py
@@ -5,19 +5,19 @@ import json
import copy
from importCommon import *
import importCommon
-################################################################################################################################################
-# #
-# Import all users from a given file #
-# #
-# activation : #
-# python importUsers.py [-i <be host> | --ip=<be host>] [-p <be port> | --port=<be port> ] [-f <input file> | --ifile=<input file> ] #
-# [-v <true|false> | --updateversion=<true|false>] #
-# shortest activation (be host = localhost, be port = 8080): # #
-# python importUsers.py [-f <input file> | --ifile=<input file> ] #
-# #
-################################################################################################################################################
-
-def createNormativeType(beHost, bePort, adminUser, fileDir, ELEMENT_NAME, updateversion):
+#########################################################################################################################################################################################
+# #
+# Import all users from a given file #
+# #
+# activation : #
+# python importNormativeTypes.py [-s <scheme> | --scheme=<scheme> ] [-i <be host> | --ip=<be host>] [-p <be port> | --port=<be port> ] [-f <input file> | --ifile=<input file> ] #
+# [-v <true|false> | --updateversion=<true|false>] #
+# shortest activation (be host = localhost, be port = 8080): #
+# python importNormativeTypes.py [-f <input file> | --ifile=<input file> ] #
+# #
+#########################################################################################################################################################################################
+
+def createNormativeType(scheme, beHost, bePort, adminUser, fileDir, ELEMENT_NAME, updateversion):
try:
log("in create normative type ", ELEMENT_NAME)
@@ -27,7 +27,7 @@ def createNormativeType(beHost, bePort, adminUser, fileDir, ELEMENT_NAME, update
buffer = StringIO()
c = pycurl.Curl()
- url = 'http://' + beHost + ':' + bePort + '/sdc2/rest/v1/catalog/upload/multipart'
+ url = scheme + '://' + beHost + ':' + bePort + '/sdc2/rest/v1/catalog/upload/multipart'
if updateversion != None:
url += '?createNewVersion=' + updateversion
c.setopt(c.URL, url)
@@ -58,6 +58,9 @@ def createNormativeType(beHost, bePort, adminUser, fileDir, ELEMENT_NAME, update
#data = json.dumps(user)
#c.setopt(c.POSTFIELDS, data)
+ if scheme == 'https':
+ c.setopt(c.SSL_VERIFYPEER, 0)
+
#c.setopt(c.WRITEFUNCTION, lambda x: None)
c.setopt(c.WRITEFUNCTION, buffer.write)
#print("before perform")
@@ -79,10 +82,10 @@ def createNormativeType(beHost, bePort, adminUser, fileDir, ELEMENT_NAME, update
def usage():
- print sys.argv[0], '[-i <be host> | --ip=<be host>] [-p <be port> | --port=<be port> ] [-u <user userId> | --user=<user userId> ] [-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> ] [-v <true|false> | --updateversion=<true|false>]'
-def importNormativeTypes(beHost, bePort, adminUser, fileDir, updateversion):
+def importNormativeTypes(scheme, beHost, bePort, adminUser, fileDir, updateversion):
normativeTypes = [ "root", "compute", "softwareComponent", "webServer", "webApplication", "DBMS", "database", "objectStorage", "blockStorage", "containerRuntime", "containerApplication", "loadBalancer", "port", "network", "allottedResource"]
#normativeTypes = [ "root" ]
@@ -93,7 +96,7 @@ def importNormativeTypes(beHost, bePort, adminUser, fileDir, updateversion):
results = []
for normativeType in normativeTypes:
- result = createNormativeType(beHost, bePort, adminUser, fileDir, normativeType, updateversion)
+ result = createNormativeType(scheme, beHost, bePort, adminUser, fileDir, normativeType, updateversion)
results.append(result)
if ( result[1] == None or result[1] not in responseCodes ):
print "Failed creating normative type " + normativeType + ". " + str(result[1])
@@ -107,9 +110,10 @@ def main(argv):
bePort = '8080'
adminUser = 'jh0003'
updateversion = 'true'
+ scheme = 'http'
try:
- opts, args = getopt.getopt(argv,"i:p:u:v:h:",["ip=","port=","user=","updateversion="])
+ opts, args = getopt.getopt(argv,"i:p:u:v:h:s:",["ip=","port=","user=","updateversion=","scheme="])
except getopt.GetoptError:
usage()
errorAndExit(2, 'Invalid input')
@@ -125,17 +129,19 @@ def main(argv):
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 'be host =',beHost,', be port =', bePort,', user =', adminUser, ', updateversion =', updateversion
+ print 'scheme =',scheme,', be host =',beHost,', be port =', bePort,', user =', adminUser, ', updateversion =', updateversion
if ( beHost == None ):
usage()
sys.exit(3)
- results = importNormativeTypes(beHost, bePort, adminUser, "../../../import/tosca/normative-types/", updateversion)
+ results = importNormativeTypes(scheme, beHost, bePort, adminUser, "../../../import/tosca/normative-types/", updateversion)
print "-----------------------------"
for result in results:
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 3d7d9a9bbf..eb55bf84bc 100644
--- a/catalog-be/src/main/resources/scripts/import/tosca/importONAPNormativeAll.py
+++ b/catalog-be/src/main/resources/scripts/import/tosca/importONAPNormativeAll.py
@@ -23,7 +23,7 @@ import importCommon
# Import all users from a given file #
# #
# activation : #
-# python importNormativeAll.py [-i <be host> | --ip=<be host>] [-p <be port> | --port=<be port> ] [-u <user userId> | --user=<user userId> ] [-d <true|false> | --debug=<true|false>] #
+# 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): # # #
@@ -32,7 +32,7 @@ import importCommon
#################################################################################################################################################################################################
def usage():
- print sys.argv[0], '[-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], '[-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()
@@ -58,6 +58,7 @@ def main(argv):
debugf = None
updateversion = 'true'
importCommon.debugFlag = False
+ scheme = 'http'
try:
opts, args = getopt.getopt(argv,"i:p:u:d:v:h",["ip=","port=","user=","debug=","updateversion="])
@@ -76,6 +77,8 @@ def main(argv):
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")
@@ -84,7 +87,7 @@ def main(argv):
if (arg.lower() == "false" or arg.lower() == "no"):
updateversion = 'false'
- print 'be host =',beHost,', be port =', bePort,', user =', adminUser, ', debug =', debugf, ', updateversion =', updateversion
+ 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)
@@ -101,37 +104,37 @@ def main(argv):
baseFileLocation = pathdir + "/../../../import/tosca/"
fileLocation = baseFileLocation + "data-types/"
- importDataTypes(beHost, bePort, adminUser, False, fileLocation)
+ importDataTypes(scheme, beHost, bePort, adminUser, False, fileLocation)
print 'sleep until data type cache is updated'
time.sleep( 70 )
fileLocation = baseFileLocation + "capability-types/"
- importNormativeCapabilities(beHost, bePort, adminUser, False, fileLocation)
+ importNormativeCapabilities(scheme, beHost, bePort, adminUser, False, fileLocation)
fileLocation = baseFileLocation + "interface-lifecycle-types/"
- importNormativeInterfaceLifecycleType(beHost, bePort, adminUser, False, fileLocation)
+ importNormativeInterfaceLifecycleType(scheme, beHost, bePort, adminUser, False, fileLocation)
fileLocation = baseFileLocation + "categories/"
- importCategories(beHost, bePort, adminUser, False, fileLocation)
+ importCategories(scheme, beHost, bePort, adminUser, False, fileLocation)
fileLocation = baseFileLocation + "normative-types/"
- results = importNormativeTypes(beHost, bePort, adminUser, fileLocation, updateversion)
+ results = importNormativeTypes(scheme, beHost, bePort, adminUser, fileLocation, updateversion)
handleResults(results, updateversion)
fileLocation = baseFileLocation + "heat-types/"
- resultsHeat = importHeatTypes(beHost, bePort, adminUser, fileLocation, updateversion)
+ resultsHeat = importHeatTypes(scheme, beHost, bePort, adminUser, fileLocation, updateversion)
handleResults(resultsHeat, updateversion)
fileLocation = baseFileLocation + "onap-types/"
- resultsHeat = importOnapTypes(beHost, bePort, adminUser, fileLocation, updateversion)
+ resultsHeat = importOnapTypes(scheme, beHost, bePort, adminUser, fileLocation, updateversion)
handleResults(resultsHeat, updateversion)
fileLocation = baseFileLocation + "group-types/"
- importGroupTypes(beHost, bePort, adminUser, False, fileLocation)
+ importGroupTypes(scheme, beHost, bePort, adminUser, False, fileLocation)
fileLocation = baseFileLocation + "policy-types/"
- importPolicyTypes(beHost, bePort, adminUser, False, fileLocation)
+ importPolicyTypes(scheme, beHost, bePort, adminUser, False, fileLocation)
errorAndExit(0, None)
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 18d2270442..faad226d39 100644
--- a/catalog-be/src/main/resources/scripts/import/tosca/importOnapTypes.py
+++ b/catalog-be/src/main/resources/scripts/import/tosca/importOnapTypes.py
@@ -7,19 +7,19 @@ from importCommon import *
from importNormativeTypes import *
import importCommon
-################################################################################################################################################
-# #
-# Import all users from a given file #
-# #
-# activation : #
-# python importUsers.py [-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 importUsers.py [-f <input file> | --ifile=<input file> ] #
-# #
-################################################################################################################################################
+#####################################################################################################################################################################################################
+# #
+# Import all users from a given file #
+# #
+# activation : #
+# python importUsers.py [optional -s <scheme> | --scheme=<scheme>, default http] [-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 importUsers.py [-f <input file> | --ifile=<input file> ] #
+# #
+#####################################################################################################################################################################################################
-def importOnapTypes(beHost, bePort, adminUser, fileDir, updateversion):
+def importOnapTypes(scheme, beHost, bePort, adminUser, fileDir, updateversion):
onapTypes = [ "extImageFile",
"extLocalStorage",
@@ -41,7 +41,7 @@ def importOnapTypes(beHost, bePort, adminUser, fileDir, updateversion):
results = []
for onapType in onapTypes:
- result = createNormativeType(beHost, bePort, adminUser, fileDir, onapType, updateversion)
+ result = createNormativeType(scheme, beHost, bePort, adminUser, fileDir, onapType, updateversion)
results.append(result)
if ( result[1] == None or result[1] not in responseCodes) :
print "Failed creating heat type " + onapType + ". " + str(result[1])
@@ -55,6 +55,7 @@ def main(argv):
bePort = '8080'
adminUser = 'jh0003'
updateversion = 'true'
+ scheme = 'http'
try:
opts, args = getopt.getopt(argv,"i:p:u:v:h:",["ip=","port=","user=","updateversion="])
@@ -73,17 +74,19 @@ def main(argv):
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 'be host =',beHost,', be port =', bePort,', user =', adminUser
+ print 'scheme =',scheme,',be host =',beHost,', be port =', bePort,', user =', adminUser
if ( beHost == None ):
usage()
sys.exit(3)
- results = importOnapTypes(beHost, bePort, adminUser, "../../../import/tosca/onap-types/", updateversion)
+ results = importOnapTypes(scheme, beHost, bePort, adminUser, "../../../import/tosca/onap-types/", updateversion)
print "-----------------------------"
for result in results:
@@ -104,5 +107,3 @@ def main(argv):
if __name__ == "__main__":
main(sys.argv[1:])
-
-
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 c01e159264..103ad2d1da 100644
--- a/catalog-be/src/main/resources/scripts/import/tosca/importPolicyTypes.py
+++ b/catalog-be/src/main/resources/scripts/import/tosca/importPolicyTypes.py
@@ -6,24 +6,24 @@ import copy
from importNormativeElements import createNormativeElement
from importCommon import *
-################################################################################################################################################
-# #
-# Import tosca data types #
-# #
-# activation : #
-# python importPolicyTypes.py [-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 importPolicyTypes.py [-f <input file> | --ifile=<input file> ] #
-# #
-################################################################################################################################################
+#####################################################################################################################################################################################
+# #
+# Import tosca data types #
+# #
+# activation : #
+# python importPolicyTypes.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 importPolicyTypes.py [-f <input file> | --ifile=<input file> ] #
+# #
+#####################################################################################################################################################################################
def usage():
- print sys.argv[0], '[-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(beHost, bePort, adminUser, exitOnSuccess, fileDir):
- result = createNormativeElement(beHost, bePort, adminUser, fileDir, "/sdc2/rest/v1/catalog/uploadType/policytypes", "policyTypes", "policyTypesZip")
+def importPolicyTypes(scheme, beHost, bePort, adminUser, exitOnSuccess, fileDir):
+ result = createNormativeElement(scheme, beHost, bePort, adminUser, fileDir, "/sdc2/rest/v1/catalog/uploadType/policytypes", "policyTypes", "policyTypesZip")
printFrameLine()
printNameAndReturnCode(result[0], result[1])
@@ -41,9 +41,10 @@ def main(argv):
beHost = 'localhost'
bePort = '8080'
adminUser = 'jh0003'
+ scheme = 'http'
try:
- opts, args = getopt.getopt(argv,"i:p:u:h:",["ip=","port=","user="])
+ opts, args = getopt.getopt(argv,"i:p:u:h:s:",["ip=","port=","user=", "scheme="])
except getopt.GetoptError:
usage()
errorAndExit(2, 'Invalid input')
@@ -59,14 +60,16 @@ def main(argv):
bePort = arg
elif opt in ("-u", "--user"):
adminUser = arg
+ elif opt in ("-s", "--scheme"):
+ scheme = arg
- print 'be host =',beHost,', be port =', bePort,', user =', adminUser
+ print 'scheme =',scheme,', be host =',beHost,', be port =', bePort,', user =', adminUser
if ( beHost == None ):
usage()
sys.exit(3)
- importPolicyTypes(beHost, bePort, adminUser, True, "../../../import/tosca/policy-types/")
+ importPolicyTypes(scheme, beHost, bePort, adminUser, True, "../../../import/tosca/policy-types/")
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 8509855f38..8e69ffcf49 100644
--- a/catalog-be/src/main/resources/scripts/import/tosca/importUsersFromYaml.py
+++ b/catalog-be/src/main/resources/scripts/import/tosca/importUsersFromYaml.py
@@ -5,22 +5,22 @@ import json
import copy
import yaml
-########################################################################################################################################################
-# #
-# Import all users from a given YAML file #
-# #
-# activation : #
-# python importUsersFromYaml.py [-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 importUsersFromYaml.py [-f <input file> | --ifile=<input file> ] #
-# #
-# PyYAML module shall be added to python. #
-# pip install PyYAML>=3.1.0 --proxy=http://one.proxy.att.com:8080 #
-########################################################################################################################################################
-
-
-def importUsers(beHost, bePort, users, adminUser):
+#########################################################################################################################################################################################
+# #
+# Import all users from a given YAML file #
+# #
+# activation : #
+# python importUsersFromYaml.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 importUsersFromYaml.py [-f <input file> | --ifile=<input file> ] #
+# #
+# PyYAML module shall be added to python. #
+# pip install PyYAML>=3.1.0 --proxy=http://one.proxy.att.com:8080 #
+#########################################################################################################################################################################################
+
+
+def importUsers(scheme, beHost, bePort, users, adminUser):
result = []
@@ -28,12 +28,12 @@ def importUsers(beHost, bePort, users, adminUser):
#print("Going to add user " + user['userId'])
- getRes = getUser(beHost, bePort, user)
+ getRes = getUser(scheme, beHost, bePort, user)
userId = getRes[0]
error = getRes[1]
#print error
if ( error != None and error == 404 ):
- res = createUser(beHost, bePort, user ,adminUser)
+ res = createUser(scheme, beHost, bePort, user ,adminUser)
result.append(res)
else:
if ( error == 200 ):
@@ -45,7 +45,7 @@ def importUsers(beHost, bePort, users, adminUser):
return result
-def getUser(beHost, bePort, user):
+def getUser(scheme, beHost, bePort, user):
if (user.get('userId') == None):
print "Ignoring record", user
@@ -56,9 +56,12 @@ def getUser(beHost, bePort, user):
c = pycurl.Curl()
#print type(userId)
- url = 'http://' + beHost + ':' + bePort + '/sdc2/rest/v1/user/' + str(userId)
+ url = scheme + '://' + beHost + ':' + bePort + '/sdc2/rest/v1/user/' + str(userId)
c.setopt(c.URL, url)
+ if scheme == 'https':
+ c.setopt(c.SSL_VERIFYPEER, 0)
+
#adminHeader = 'USER_ID: ' + adminUser
c.setopt(pycurl.HTTPHEADER, ['Content-Type: application/json', 'Accept: application/json'])
c.setopt(c.WRITEFUNCTION, lambda x: None)
@@ -81,7 +84,7 @@ def getUser(beHost, bePort, user):
-def createUser(beHost, bePort, user, adminUser):
+def createUser(scheme, beHost, bePort, user, adminUser):
if (user.get('userId') == None):
print "Ignoring record", user
@@ -92,7 +95,7 @@ def createUser(beHost, bePort, user, adminUser):
buffer = StringIO()
c = pycurl.Curl()
- url = 'http://' + beHost + ':' + bePort + '/sdc2/rest/v1/user'
+ url = scheme + '://' + beHost + ':' + bePort + '/sdc2/rest/v1/user'
c.setopt(c.URL, url)
c.setopt(c.POST, 1)
@@ -100,7 +103,10 @@ def createUser(beHost, bePort, user, adminUser):
c.setopt(pycurl.HTTPHEADER, ['Content-Type: application/json', 'Accept: application/json', adminHeader])
data = json.dumps(user)
- c.setopt(c.POSTFIELDS, data)
+ c.setopt(c.POSTFIELDS, data)
+
+ if scheme == 'https':
+ c.setopt(c.SSL_VERIFYPEER, 0)
c.setopt(c.WRITEFUNCTION, lambda x: None)
#print("before perform")
@@ -131,7 +137,7 @@ def errorAndExit(errorCode, errorDesc):
sys.exit(errorCode)
def usage():
- print sys.argv[0], '[-i <be host> | --ip=<be host>] [-p <be port> | --port=<be port> ] [-f <input file> | --ifile=<input file> ]'
+ print sys.argv[0], '[optional -s <scheme> | --scheme=<scheme>, default http] [-i <be host> | --ip=<be host>] [-p <be port> | --port=<be port> ] [-f <input file> | --ifile=<input file> ]'
def main(argv):
print 'Number of arguments:', len(sys.argv), 'arguments.'
@@ -141,9 +147,10 @@ def main(argv):
inputfile = None
adminUser = 'jh0003'
+ scheme ='http'
try:
- opts, args = getopt.getopt(argv,"i:p:f:h:",["ip=","port=","ifile="])
+ opts, args = getopt.getopt(argv,"i:p:f:h:s:",["ip=","port=","ifile=","scheme="])
except getopt.GetoptError:
usage()
errorAndExit(2, 'Invalid input')
@@ -159,8 +166,10 @@ def main(argv):
bePort = arg
elif opt in ("-f", "--ifile"):
inputfile = arg
+ elif opt in ("-s", "--scheme"):
+ scheme = arg
- print 'be host =',beHost,', be port =', bePort,', users file =',inputfile
+ print 'scheme =',scheme,', be host =',beHost,', be port =', bePort,', users file =',inputfile
if ( inputfile == None ):
usage()
@@ -187,7 +196,7 @@ def main(argv):
#activeUsers = filter(lambda x: x.get('status') == None or x['status'] == 'ACTIVE', cloneUsers)
- resultTable = importUsers(beHost, bePort, cloneUsers, adminUser)
+ resultTable = importUsers(scheme, beHost, bePort, cloneUsers, adminUser)
g = lambda x: x[1] != 201 and x[1] != 409
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 d239a15c72..7ea3dd4eda 100644
--- a/catalog-be/src/main/resources/scripts/import/tosca/typesToUpgrade.json
+++ b/catalog-be/src/main/resources/scripts/import/tosca/typesToUpgrade.json
@@ -1,19 +1,6 @@
{
"heat": [
- "contrailPort",
- "extCp",
- "contrailV2VirtualMachineInterface",
- "neutronPort",
- "Generic_PNF",
- "portMirroring",
- "Generic_VF",
- "serviceProxy",
- "extCp2",
- "extContrailCP",
- "vnfConfiguration",
- "extVl",
- "multiFlavorVFC",
- "portMirroringByPolicy"
+ "Generic_CR"
],
"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 e35e2d28eb..5a1d1046b9 100644
--- a/catalog-be/src/main/resources/scripts/import/tosca/upgradeHeatAndNormativeTypes.py
+++ b/catalog-be/src/main/resources/scripts/import/tosca/upgradeHeatAndNormativeTypes.py
@@ -9,18 +9,18 @@ import importCommon
import json
-################################################################################################################################################
-# #
-# Upgrades all Heat and Normative types confiugred in "typesToUpgrade.json" file #
-# #
-# activation : #
-# python upgradeHeatAndNormativeTypes.py [-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 upgradeHeatAndNormativeTypes.py [-f <input file> | --ifile=<input file> ] #
-# #
-################################################################################################################################################
-def upgradeTypesPerConfigFile(beHost, bePort, adminUser, baseDir, updateversion):
+################################################################################################################################################################################################
+# #
+# Upgrades all Heat and Normative types confiugred in "typesToUpgrade.json" file #
+# #
+# activation #
+# python upgradeHeatAndNormativeTypes.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 upgradeHeatAndNormativeTypes.py [-f <input file> | --ifile=<input file> ] #
+# #
+################################################################################################################################################################################################
+def upgradeTypesPerConfigFile(scheme, beHost, bePort, adminUser, baseDir, updateversion):
responseCodes = [200, 201]
if (updateversion == 'false'):
responseCodes = [200, 201, 409]
@@ -37,12 +37,12 @@ def upgradeTypesPerConfigFile(beHost, bePort, adminUser, baseDir, updateversion)
debug(normativeFileDir)
results = []
for heatType in heatTypes:
- result = createNormativeType(beHost, bePort, adminUser, heatFileDir, heatType.encode('ascii', 'ignore'), updateversion)
+ result = createNormativeType(scheme, beHost, bePort, adminUser, heatFileDir, heatType.encode('ascii', 'ignore'), updateversion)
results.append(result)
if (result[1] == None or result[1] not in responseCodes):
print "Failed creating heat type " + heatType + ". " + str(result[1])
for normativeType in normativeTypes:
- result = createNormativeType(beHost, bePort, adminUser, normativeFileDir, normativeType.encode('ascii', 'ignore'), updateversion)
+ result = createNormativeType(scheme, beHost, bePort, adminUser, normativeFileDir, normativeType.encode('ascii', 'ignore'), updateversion)
results.append(result)
if (result[1] == None or result[1] not in responseCodes):
print "Failed creating normative type " + normativeType + ". " + str(result[1])
@@ -59,9 +59,10 @@ def main(argv):
bePort = '8080'
adminUser = 'jh0003'
updateversion = 'true'
+ scheme = 'http'
try:
- opts, args = getopt.getopt(argv, "i:p:u:v:h:", ["ip=", "port=", "user=", "updateversion="])
+ opts, args = getopt.getopt(argv, "i:p:u:v:h:s:", ["ip=", "port=", "user=", "updateversion=","scheme="])
except getopt.GetoptError:
usage()
errorAndExit(2, 'Invalid input')
@@ -77,17 +78,19 @@ def main(argv):
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 'be host =', beHost, ', be port =', bePort, ', user =', adminUser
+ print 'scheme =',scheme,', be host =',beHost, ', be port =', bePort, ', user =', adminUser
if (beHost == None):
usage()
sys.exit(3)
- results = upgradeTypesPerConfigFile(beHost, bePort, adminUser, "../../../import/tosca/", updateversion)
+ results = upgradeTypesPerConfigFile(scheme, beHost, bePort, adminUser, "../../../import/tosca/", updateversion)
print "-----------------------------"
for result in results:
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 7315ec0635..5cb0ca3b0c 100644
--- a/catalog-be/src/main/resources/scripts/import/tosca/upgradeHeatTypes1707.py
+++ b/catalog-be/src/main/resources/scripts/import/tosca/upgradeHeatTypes1707.py
@@ -7,19 +7,19 @@ from importCommon import *
from importNormativeTypes import *
import importCommon
-################################################################################################################################################
-# #
-# Import all users from a given file #
-# #
-# activation : #
-# python importUsers.py [-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 importUsers.py [-f <input file> | --ifile=<input file> ] #
-# #
-################################################################################################################################################
+#################################################################################################################################################################################
+# #
+# Import all users from a given file #
+# #
+# activation : #
+# python importUsers.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 importUsers.py [-f <input file> | --ifile=<input file> ] #
+# #
+#################################################################################################################################################################################
-def upgradeHeatTypes1707(beHost, bePort, adminUser, fileDir, updateversion):
+def upgradeHeatTypes1707(scheme, beHost, bePort, adminUser, fileDir, updateversion):
heatTypes = [ "volume",
"cinderVolume",
@@ -49,7 +49,7 @@ def upgradeHeatTypes1707(beHost, bePort, adminUser, fileDir, updateversion):
results = []
for heatType in heatTypes:
- result = createNormativeType(beHost, bePort, adminUser, fileDir, heatType, updateversion)
+ 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])
@@ -63,9 +63,10 @@ def main(argv):
bePort = '8080'
adminUser = 'jh0003'
updateversion = 'true'
-
+ scheme = 'http'
+
try:
- opts, args = getopt.getopt(argv,"i:p:u:v:h:",["ip=","port=","user=","updateversion="])
+ opts, args = getopt.getopt(argv,"i:p:u:v:h:s:",["ip=","port=","user=","updateversion=","scheme="])
except getopt.GetoptError:
usage()
errorAndExit(2, 'Invalid input')
@@ -81,17 +82,19 @@ def main(argv):
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 'be host =',beHost,', be port =', bePort,', user =', adminUser
+ print 'scheme =',scheme,', be host =',beHost,', be port =', bePort,', user =', adminUser
if ( beHost == None ):
usage()
sys.exit(3)
- results = upgradeHeatTypes1707(beHost, bePort, adminUser, "../../../import/tosca/heat-types/", updateversion)
+ results = upgradeHeatTypes1707(scheme, beHost, bePort, adminUser, "../../../import/tosca/heat-types/", updateversion)
print "-----------------------------"
for result in results:
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 69a51f41f1..573e05b46a 100644
--- a/catalog-be/src/main/resources/scripts/import/tosca/upgradeNormative.py
+++ b/catalog-be/src/main/resources/scripts/import/tosca/upgradeNormative.py
@@ -17,21 +17,21 @@ from importOnapTypes import importOnapTypes
from importCommon import *
import importCommon
-#################################################################################################################################################################################################
-# #
-# Upgrades the normative types #
-# #
-# activation : #
-# python upgradeNormative.py [-i <be host> | --ip=<be host>] [-p <be port> | --port=<be port> ] [-u <user userId> | --user=<user userId> ] [-d <true|false> | --debug=<true|false>] #
-# #
-# #
-# shortest activation (be host = localhost, be port = 8080, user = jh0003): # # #
-# python upgradeNormative.py #
-# #
-#################################################################################################################################################################################################
+#################################################################################################################################################################################################################################
+# #
+# Upgrades the normative types #
+# #
+# activation : #
+# python upgradeNormative.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>] #
+# #
+# #
+# shortest activation (be host = localhost, be port = 8080, user = jh0003): #
+# python upgradeNormative.py #
+# #
+#################################################################################################################################################################################################################################
def usage():
- print sys.argv[0], '[-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()
@@ -52,9 +52,10 @@ def main(argv):
debugf = None
updateversion = 'true'
importCommon.debugFlag = False
+ scheme = 'http'
try:
- opts, args = getopt.getopt(argv,"i:p:u:d:h",["ip=","port=","user=","debug="])
+ opts, args = getopt.getopt(argv,"i:p:u:d:h:s:",["ip=","port=","user=","debug=","scheme="])
except getopt.GetoptError:
usage()
errorAndExit(2, 'Invalid input')
@@ -70,11 +71,13 @@ def main(argv):
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 'be host =',beHost,', be port =', bePort,', user =', adminUser, ', debug =', debugf
+ print 'scheme =',scheme,', be host =',beHost,', be port =', bePort,', user =', adminUser, ', debug =', debugf
if (debugf != None):
print 'set debug mode to ' + str(debugf)
@@ -91,27 +94,27 @@ def main(argv):
baseFileLocation = pathdir + "/../../../import/tosca/"
fileLocation = baseFileLocation + "categories/"
- importCategories(beHost, bePort, adminUser, False, fileLocation)
+ importCategories(scheme, beHost, bePort, adminUser, False, fileLocation)
fileLocation = baseFileLocation + "data-types/"
- importDataTypes(beHost, bePort, adminUser, False, fileLocation)
+ importDataTypes(scheme, beHost, bePort, adminUser, False, fileLocation)
fileLocation = baseFileLocation + "policy-types/"
- importPolicyTypes(beHost, bePort, adminUser, False, fileLocation)
-
- fileLocation = baseFileLocation + "group-types/"
- importGroupTypes(beHost, bePort, adminUser, False, fileLocation)
+ importPolicyTypes(scheme, beHost, bePort, adminUser, False, fileLocation)
fileLocation = baseFileLocation + "capability-types/"
- importNormativeCapabilities(beHost, bePort, adminUser, False, fileLocation)
+ importNormativeCapabilities(scheme, beHost, bePort, adminUser, False, fileLocation)
+
+ fileLocation = baseFileLocation + "group-types/"
+ importGroupTypes(scheme, beHost, bePort, adminUser, False, fileLocation)
fileLocation = baseFileLocation + "interface-lifecycle-types/"
- importNormativeInterfaceLifecycleType(beHost, bePort, adminUser, False, fileLocation)
+ importNormativeInterfaceLifecycleType(scheme, beHost, bePort, adminUser, False, fileLocation)
print 'sleep until data type cache is updated'
time.sleep( 70 )
- resultsHeat = upgradeTypesPerConfigFile(beHost, bePort, adminUser, baseFileLocation, updateversion)
+ resultsHeat = upgradeTypesPerConfigFile(scheme, beHost, bePort, adminUser, baseFileLocation, updateversion)
handleResults(resultsHeat, 'false')
errorAndExit(0, None)
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 8f8e0491ae..958416da33 100644
--- a/catalog-be/src/main/resources/scripts/import/tosca/upgradeNormativeVersion.py
+++ b/catalog-be/src/main/resources/scripts/import/tosca/upgradeNormativeVersion.py
@@ -7,21 +7,21 @@ from importCommon import *
from importNormativeTypes import createNormativeType
import importCommon
-#################################################################################################################################################################################################
-# #
-# Upgrades the normative types #
-# #
-# activation : #
-# python upgradeNormative.py [-i <be host> | --ip=<be host>] [-p <be port> | --port=<be port> ] [-u <user userId> | --user=<user userId> ] [-d <true|false> | --debug=<true|false>] #
-# #
-# #
-# shortest activation (be host = localhost, be port = 8080, user = jh0003): # # #
-# python upgradeNormative.py #
-# #
-#################################################################################################################################################################################################
+#################################################################################################################################################################################################################################
+# #
+# Upgrades the normative types #
+# #
+# activation : #
+# python upgradeNormative.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>] #
+# #
+# #
+# shortest activation (be host = localhost, be port = 8080, user = jh0003): #
+# python upgradeNormative.py #
+# #
+#################################################################################################################################################################################################################################
def usage():
- print sys.argv[0], '[-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()
@@ -41,10 +41,11 @@ def main(argv):
adminUser = 'jh0003'
debugf = None
updateversion = 'true'
- importCommon.debugFlag = False
+ importCommon.debugFlag = False
+ scheme = 'http'
try:
- opts, args = getopt.getopt(argv,"i:p:u:d:h",["ip=","port=","user=","debug="])
+ opts, args = getopt.getopt(argv,"i:p:u:d:h:s:",["ip=","port=","user=","debug=","scheme="])
except getopt.GetoptError:
usage()
errorAndExit(2, 'Invalid input')
@@ -60,11 +61,13 @@ def main(argv):
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 'be host =',beHost,', be port =', bePort,', user =', adminUser, ', debug =', debugf
+ print 'scheme =',scheme,', be host =',beHost,', be port =', bePort,', user =', adminUser, ', debug =', debugf
if (debugf != None):
print 'set debug mode to ' + str(debugf)
@@ -87,11 +90,11 @@ def main(argv):
##########################################################################
fileLocation = baseFileLocation + "heat-types/"
- result = createNormativeType(beHost, bePort, adminUser, fileLocation, "contrailV2VirtualMachineInterface", updateversion)
+ result = createNormativeType(scheme, beHost, bePort, adminUser, fileLocation, "contrailV2VirtualMachineInterface", updateversion)
results.append(result)
fileLocation = baseFileLocation + "heat-types/"
- result = createNormativeType(beHost, bePort, adminUser, fileLocation, "neutronPort", updateversion)
+ result = createNormativeType(scheme, beHost, bePort, adminUser, fileLocation, "neutronPort", updateversion)
results.append(result)
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 d45b27e755..805d012298 100644
--- a/catalog-be/src/main/resources/scripts/import/tosca/upgradeNormativeVersionAll.py
+++ b/catalog-be/src/main/resources/scripts/import/tosca/upgradeNormativeVersionAll.py
@@ -10,7 +10,7 @@ from importCommon import *
import importCommon
def usage():
- print sys.argv[0], '[-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()
@@ -36,9 +36,10 @@ def main(argv):
debugf = None
updateversion = 'true'
importCommon.debugFlag = False
+ scheme = 'http'
try:
- opts, args = getopt.getopt(argv,"i:p:u:d:v:h",["ip=","port=","user=","debug=","updateversion="])
+ 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')
@@ -54,6 +55,8 @@ def main(argv):
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")
@@ -62,7 +65,7 @@ def main(argv):
if (arg.lower() == "false" or arg.lower() == "no"):
updateversion = 'false'
- print 'be host =',beHost,', be port =', bePort,', user =', adminUser, ', debug =', debugf, ', updateversion =', updateversion
+ 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)
@@ -79,11 +82,11 @@ def main(argv):
baseFileLocation = pathdir + "/../../../import/tosca/"
fileLocation = baseFileLocation + "normative-types/"
- results = importNormativeTypes(beHost, bePort, adminUser, fileLocation, updateversion)
+ results = importNormativeTypes(scheme, beHost, bePort, adminUser, fileLocation, updateversion)
handleResults(results, updateversion)
fileLocation = baseFileLocation + "heat-types/"
- resultsHeat = importHeatTypes(beHost, bePort, adminUser, fileLocation, updateversion)
+ resultsHeat = importHeatTypes(scheme, beHost, bePort, adminUser, fileLocation, updateversion)
handleResults(resultsHeat, updateversion)
fileLocation = baseFileLocation + "onap-types/"
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 13e5d7d63a..c75966cfc9 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
@@ -7,21 +7,21 @@ from importCommon import *
from importNormativeTypes import createNormativeType
import importCommon
-#################################################################################################################################################################################################
-# #
-# Upgrades the normative types #
-# #
-# activation : #
-# python upgradeNormative.py [-i <be host> | --ip=<be host>] [-p <be port> | --port=<be port> ] [-u <user userId> | --user=<user userId> ] [-d <true|false> | --debug=<true|false>] #
-# #
-# #
-# shortest activation (be host = localhost, be port = 8080, user = jh0003): # # #
-# python upgradeNormative.py #
-# #
-#################################################################################################################################################################################################
+#################################################################################################################################################################################################################################
+# #
+# Upgrades the normative types #
+# #
+# activation : #
+# python upgradeNormative.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>] #
+# #
+# #
+# shortest activation (be host = localhost, be port = 8080, user = jh0003): #
+# python upgradeNormative.py #
+# #
+#################################################################################################################################################################################################################################
def usage():
- print sys.argv[0], '[-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()
@@ -42,9 +42,10 @@ def main(argv):
debugf = None
updateversion = 'true'
importCommon.debugFlag = False
+ scheme = 'http'
try:
- opts, args = getopt.getopt(argv,"i:p:u:d:h",["ip=","port=","user=","debug="])
+ opts, args = getopt.getopt(argv,"i:p:u:d:h:s:",["ip=","port=","user=","debug=","scheme="])
except getopt.GetoptError:
usage()
errorAndExit(2, 'Invalid input')
@@ -60,11 +61,13 @@ def main(argv):
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 'be host =',beHost,', be port =', bePort,', user =', adminUser, ', debug =', debugf
+ print 'scheme =',scheme,', be host =',beHost,', be port =', bePort,', user =', adminUser, ', debug =', debugf
if (debugf != None):
print 'set debug mode to ' + str(debugf)
@@ -88,35 +91,35 @@ def main(argv):
fileLocation = baseFileLocation + "heat-types/"
- result = createNormativeType(beHost, bePort, adminUser, fileLocation, "contrailPort", updateversion)
+ result = createNormativeType(scheme, beHost, bePort, adminUser, fileLocation, "contrailPort", updateversion)
results.append(result)
fileLocation = baseFileLocation + "heat-types/"
- result = createNormativeType(beHost, bePort, adminUser, fileLocation, "contrailV2VirtualMachineInterface", updateversion)
+ result = createNormativeType(scheme, beHost, bePort, adminUser, fileLocation, "contrailV2VirtualMachineInterface", updateversion)
results.append(result)
fileLocation = baseFileLocation + "heat-types/"
- result = createNormativeType(beHost, bePort, adminUser, fileLocation, "neutronPort", updateversion)
+ result = createNormativeType(scheme, beHost, bePort, adminUser, fileLocation, "neutronPort", updateversion)
results.append(result)
fileLocation = baseFileLocation + "heat-types/"
- result = createNormativeType(beHost, bePort, adminUser, fileLocation, "contrailCompute", updateversion)
+ result = createNormativeType(scheme, beHost, bePort, adminUser, fileLocation, "contrailCompute", updateversion)
results.append(result)
fileLocation = baseFileLocation + "heat-types/"
- result = createNormativeType(beHost, bePort, adminUser, fileLocation, "novaServer", updateversion)
+ result = createNormativeType(scheme, beHost, bePort, adminUser, fileLocation, "novaServer", updateversion)
results.append(result)
fileLocation = baseFileLocation + "heat-types/"
- result = createNormativeType(beHost, bePort, adminUser, fileLocation, "contrailV2VirtualNetwork", updateversion)
+ result = createNormativeType(scheme, beHost, bePort, adminUser, fileLocation, "contrailV2VirtualNetwork", updateversion)
results.append(result)
fileLocation = baseFileLocation + "heat-types/"
- result = createNormativeType(beHost, bePort, adminUser, fileLocation, "contrailVirtualNetwork", updateversion)
+ result = createNormativeType(scheme, beHost, bePort, adminUser, fileLocation, "contrailVirtualNetwork", updateversion)
results.append(result)
fileLocation = baseFileLocation + "heat-types/"
- result = createNormativeType(beHost, bePort, adminUser, fileLocation, "neutronNet", updateversion)
+ result = createNormativeType(scheme, beHost, bePort, adminUser, fileLocation, "neutronNet", updateversion)
results.append(result)
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 4d0ec291f5..b272c2726c 100644
--- a/catalog-be/src/main/resources/scripts/import/tosca/upgradeONAPNormative.py
+++ b/catalog-be/src/main/resources/scripts/import/tosca/upgradeONAPNormative.py
@@ -52,6 +52,7 @@ def main(argv):
debugf = None
updateversion = 'true'
importCommon.debugFlag = False
+ scheme = 'http'
try:
opts, args = getopt.getopt(argv,"i:p:u:d:h",["ip=","port=","user=","debug="])
@@ -70,11 +71,13 @@ def main(argv):
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 'be host =',beHost,', be port =', bePort,', user =', adminUser, ', debug =', debugf
+ print 'scheme =',scheme,',be host =',beHost,', be port =', bePort,', user =', adminUser, ', debug =', debugf
if (debugf != None):
print 'set debug mode to ' + str(debugf)
@@ -91,31 +94,31 @@ def main(argv):
baseFileLocation = pathdir + "/../../../import/tosca/"
fileLocation = baseFileLocation + "categories/"
- importCategories(beHost, bePort, adminUser, False, fileLocation)
+ importCategories(scheme, beHost, bePort, adminUser, False, fileLocation)
fileLocation = baseFileLocation + "data-types/"
- importDataTypes(beHost, bePort, adminUser, False, fileLocation)
+ importDataTypes(scheme, beHost, bePort, adminUser, False, fileLocation)
fileLocation = baseFileLocation + "policy-types/"
- importPolicyTypes(beHost, bePort, adminUser, False, fileLocation)
+ importPolicyTypes(scheme, beHost, bePort, adminUser, False, fileLocation)
fileLocation = baseFileLocation + "group-types/"
- importGroupTypes(beHost, bePort, adminUser, False, fileLocation)
+ importGroupTypes(scheme, beHost, bePort, adminUser, False, fileLocation)
fileLocation = baseFileLocation + "capability-types/"
- importNormativeCapabilities(beHost, bePort, adminUser, False, fileLocation)
+ importNormativeCapabilities(scheme, beHost, bePort, adminUser, False, fileLocation)
fileLocation = baseFileLocation + "interface-lifecycle-types/"
- importNormativeInterfaceLifecycleType(beHost, bePort, adminUser, False, fileLocation)
+ importNormativeInterfaceLifecycleType(scheme, beHost, bePort, adminUser, False, fileLocation)
print 'sleep until data type cache is updated'
time.sleep( 70 )
- resultsHeat = upgradeTypesPerConfigFile(beHost, bePort, adminUser, baseFileLocation, updateversion)
+ resultsHeat = upgradeTypesPerConfigFile(scheme, beHost, bePort, adminUser, baseFileLocation, updateversion)
handleResults(resultsHeat, 'false')
fileLocation = baseFileLocation + "onap-types/"
- resultsHeat = importOnapTypes(beHost, bePort, adminUser, fileLocation, updateversion)
+ resultsHeat = importOnapTypes(scheme, beHost, bePort, adminUser, fileLocation, updateversion)
handleResults(resultsHeat, updateversion)
errorAndExit(0, None)