aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-be/src/main/resources/scripts/import/tosca/upgradeNormative.py
diff options
context:
space:
mode:
Diffstat (limited to 'catalog-be/src/main/resources/scripts/import/tosca/upgradeNormative.py')
-rw-r--r--catalog-be/src/main/resources/scripts/import/tosca/upgradeNormative.py47
1 files changed, 31 insertions, 16 deletions
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 488d4d739d..085467e09a 100644
--- a/catalog-be/src/main/resources/scripts/import/tosca/upgradeNormative.py
+++ b/catalog-be/src/main/resources/scripts/import/tosca/upgradeNormative.py
@@ -5,23 +5,28 @@ import json
import copy
import time
from importCategoryTypes import importCategories
-from upgradeHeatTypes1707 import upgradeHeatTypes1707
+from upgradeHeatAndNormativeTypes import upgradeTypesPerConfigFile
from importDataTypes import importDataTypes
+from importPolicyTypes import importPolicyTypes
+from importGroupTypes import importGroupTypes
+from importNormativeCapabilities import importNormativeCapabilities
+from importNormativeInterfaceLifecycleTypes import importNormativeInterfaceLifecycleType
+
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 #
-# #
+# #
#################################################################################################################################################################################################
def usage():
@@ -32,7 +37,7 @@ def handleResults(results, updateversion):
for result in results:
printNameAndReturnCode(result[0], result[1])
printFrameLine()
-
+
failedResults = filter(lambda x: x[1] == None or x[1] not in [200, 201, 409], results)
if (len(failedResults) > 0):
errorAndExit(1, None)
@@ -40,23 +45,23 @@ def handleResults(results, updateversion):
def main(argv):
print 'Number of arguments:', len(sys.argv), 'arguments.'
- beHost = 'localhost'
+ beHost = 'localhost'
bePort = '8080'
adminUser = 'jh0003'
debugf = None
updateversion = 'true'
- importCommon.debugFlag = False
+ importCommon.debugFlag = False
try:
opts, args = getopt.getopt(argv,"i:p:u:d:h",["ip=","port=","user=","debug="])
except getopt.GetoptError:
usage()
errorAndExit(2, 'Invalid input')
-
+
for opt, arg in opts:
#print opt, arg
if opt == '-h':
- usage()
+ usage()
sys.exit(3)
elif opt in ("-i", "--ip"):
beHost = arg
@@ -73,13 +78,13 @@ def main(argv):
if (debugf != None):
print 'set debug mode to ' + str(debugf)
importCommon.debugFlag = debugf
-
+
if ( beHost == None ):
usage()
sys.exit(3)
print sys.argv[0]
- pathdir = os.path.dirname(os.path.realpath(sys.argv[0]))
+ pathdir = os.path.dirname(os.path.realpath(sys.argv[0]))
debug("path dir =" + pathdir)
baseFileLocation = pathdir + "/../../../import/tosca/"
@@ -90,15 +95,25 @@ def main(argv):
fileLocation = baseFileLocation + "data-types/"
importDataTypes(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)
+
+ fileLocation = baseFileLocation + "capability-types/"
+ importNormativeCapabilities(beHost, bePort, adminUser, False, fileLocation)
+
+ fileLocation = baseFileLocation + "interface-lifecycle-types/"
+ importNormativeInterfaceLifecycleType(beHost, bePort, adminUser, False, fileLocation)
+
print 'sleep until data type cache is updated'
time.sleep( 70 )
- fileLocation = baseFileLocation + "heat-types/"
- resultsHeat = upgradeHeatTypes1707(beHost, bePort, adminUser, fileLocation, updateversion)
+ resultsHeat = upgradeTypesPerConfigFile(beHost, bePort, adminUser, baseFileLocation, updateversion)
handleResults(resultsHeat, 'false')
- errorAndExit(0, None)
+ errorAndExit(0, None)
if __name__ == "__main__":
main(sys.argv[1:])
-