aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-be/src/main/resources
diff options
context:
space:
mode:
Diffstat (limited to 'catalog-be/src/main/resources')
-rw-r--r--catalog-be/src/main/resources/config/configuration.yaml4
-rw-r--r--catalog-be/src/main/resources/scripts/import/tosca/typesToUpgrade.json7
-rw-r--r--catalog-be/src/main/resources/scripts/import/tosca/upgradeHeatAndNormativeTypes.py110
-rw-r--r--catalog-be/src/main/resources/scripts/import/tosca/upgradeNormative.py47
4 files changed, 152 insertions, 16 deletions
diff --git a/catalog-be/src/main/resources/config/configuration.yaml b/catalog-be/src/main/resources/config/configuration.yaml
index bbb1969255..5242652188 100644
--- a/catalog-be/src/main/resources/config/configuration.yaml
+++ b/catalog-be/src/main/resources/config/configuration.yaml
@@ -306,6 +306,10 @@ serviceDeploymentArtifacts:
MODEL_QUERY_SPEC:
acceptedTypes:
- xml
+ UCPE_LAYER_2_CONFIGURATION:
+ acceptedTypes:
+ - xml
+
#AAI Artifacts
AAI_SERVICE_MODEL:
acceptedTypes:
diff --git a/catalog-be/src/main/resources/scripts/import/tosca/typesToUpgrade.json b/catalog-be/src/main/resources/scripts/import/tosca/typesToUpgrade.json
new file mode 100644
index 0000000000..1ef72856a4
--- /dev/null
+++ b/catalog-be/src/main/resources/scripts/import/tosca/typesToUpgrade.json
@@ -0,0 +1,7 @@
+{
+ "heat": [
+ "Generic_PNF"
+ ],
+ "normative": [
+ ]
+} \ No newline at end of file
diff --git a/catalog-be/src/main/resources/scripts/import/tosca/upgradeHeatAndNormativeTypes.py b/catalog-be/src/main/resources/scripts/import/tosca/upgradeHeatAndNormativeTypes.py
new file mode 100644
index 0000000000..75afe33eba
--- /dev/null
+++ b/catalog-be/src/main/resources/scripts/import/tosca/upgradeHeatAndNormativeTypes.py
@@ -0,0 +1,110 @@
+import pycurl
+import sys, getopt
+from StringIO import StringIO
+import json
+import copy
+from importCommon import *
+from importNormativeTypes import *
+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):
+ responseCodes = [200, 201]
+ if (updateversion == 'false'):
+ responseCodes = [200, 201, 409]
+ with open("typesToUpgrade.json", 'r') as stream:
+ try:
+ types = json.load(stream)
+ heatTypes = types["heat"]
+ debug(heatTypes)
+ normativeTypes = types["normative"]
+ debug(normativeTypes)
+ heatFileDir = baseDir + "heat-types/"
+ debug(heatFileDir)
+ normativeFileDir = baseDir + "normative-types/"
+ debug(normativeFileDir)
+ results = []
+ for heatType in heatTypes:
+ result = createNormativeType(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)
+ results.append(result)
+ if (result[1] == None or result[1] not in responseCodes):
+ print "Failed creating normative type " + normativeType + ". " + str(result[1])
+ return results
+ except yaml.YAMLError as exc:
+ print(exc)
+
+
+
+def main(argv):
+ print 'Number of arguments:', len(sys.argv), 'arguments.'
+
+ beHost = 'localhost'
+ bePort = '8080'
+ adminUser = 'jh0003'
+ updateversion = 'true'
+
+ try:
+ opts, args = getopt.getopt(argv, "i:p:u:v:h:", ["ip=", "port=", "user=", "updateversion="])
+ except getopt.GetoptError:
+ usage()
+ errorAndExit(2, 'Invalid input')
+
+ for opt, arg in opts:
+ # print opt, arg
+ if opt == '-h':
+ usage()
+ sys.exit(3)
+ elif opt in ("-i", "--ip"):
+ beHost = arg
+ elif opt in ("-p", "--port"):
+ bePort = arg
+ elif opt in ("-u", "--user"):
+ adminUser = arg
+ elif opt in ("-v", "--updateversion"):
+ if (arg.lower() == "false" or arg.lower() == "no"):
+ updateversion = 'false'
+
+ print 'be host =', beHost, ', be port =', bePort, ', user =', adminUser
+
+ if (beHost == None):
+ usage()
+ sys.exit(3)
+
+ results = upgradeTypesPerConfigFile(beHost, bePort, adminUser, "../../../import/tosca/", updateversion)
+
+ print "-----------------------------"
+ for result in results:
+ print "{0:20} | {1:6}".format(result[0], result[1])
+ print "-----------------------------"
+
+ responseCodes = [200, 201]
+
+ if (updateversion == 'false'):
+ responseCodes = [200, 201, 409]
+
+ failedNormatives = filter(lambda x: x[1] == None or x[1] not in responseCodes, results)
+ if (len(failedNormatives) > 0):
+ errorAndExit(1, None)
+ else:
+ errorAndExit(0, None)
+
+
+if __name__ == "__main__":
+ main(sys.argv[1:]) \ No newline at end of file
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:])
-