summaryrefslogtreecommitdiffstats
path: root/catalog-be/src/main/resources/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'catalog-be/src/main/resources/scripts')
-rw-r--r--catalog-be/src/main/resources/scripts/import/tosca/importNfvTypes.py40
1 files changed, 22 insertions, 18 deletions
diff --git a/catalog-be/src/main/resources/scripts/import/tosca/importNfvTypes.py b/catalog-be/src/main/resources/scripts/import/tosca/importNfvTypes.py
index 3de471935e..7c7ed410ec 100644
--- a/catalog-be/src/main/resources/scripts/import/tosca/importNfvTypes.py
+++ b/catalog-be/src/main/resources/scripts/import/tosca/importNfvTypes.py
@@ -8,19 +8,19 @@ from importNormativeTypes import *
import importCommon
#####################################################################################################################################################################################################
-# #
+# #
# Import Nfv Types from a given file #
-# #
+# #
# activation : #
# python importNfvTypes.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 importNfvTypes(scheme, beHost, bePort, adminUser, fileDir, updateversion):
-
+
nfvTypes = [ "underlayVpn",
"overlayTunnel",
"genericNeutronNet",
@@ -35,45 +35,49 @@ def importNfvTypes(scheme, beHost, bePort, adminUser, fileDir, updateversion):
"vduCompute",
"Cp",
"vduVirtualStorage",
- "vnfVirtualLinkDesc",
+ "vduVirtualBlockStorage",
+ "vduVirtualFileStorage",
+ "vduVirtualObjectStorage",
+ "vduVirtualStorage",
"vnfVirtualLink",
+ "vnfExtCp",
"vduCp",
"VNF"
]
-
+
responseCodes = [200, 201]
-
+
if(updateversion == 'false'):
responseCodes = [200, 201, 409]
-
+
results = []
for nfvType in nfvTypes:
result = createNormativeType(scheme, beHost, bePort, adminUser, fileDir, nfvType, updateversion)
results.append(result)
if ( result[1] == None or result[1] not in responseCodes) :
print "Failed creating heat type " + nfvType + ". " + str(result[1])
- return results
+ return results
def main(argv):
print 'Number of arguments:', len(sys.argv), 'arguments.'
- beHost = 'localhost'
+ beHost = 'localhost'
bePort = '8080'
adminUser = 'jh0003'
updateversion = 'true'
scheme = 'http'
-
+
try:
opts, args = getopt.getopt(argv,"i:p:u:v:h:",["ip=","port=","user=","updateversion="])
except getopt.GetoptError:
usage()
error_and_exit(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
@@ -88,7 +92,7 @@ def main(argv):
updateversion = 'false'
print 'scheme =',scheme,',be host =',beHost,', be port =', bePort,', user =', adminUser
-
+
if ( beHost == None ):
usage()
sys.exit(3)
@@ -99,12 +103,12 @@ def main(argv):
for result in results:
print "{0:20} | {1:6}".format(result[0], result[1])
print "-----------------------------"
-
+
responseCodes = [200, 201]
-
+
if(updateversion == 'false'):
responseCodes = [200, 201, 409]
-
+
failedNormatives = filter(lambda x: x[1] == None or x[1] not in responseCodes, results)
if (len(failedNormatives) > 0):
error_and_exit(1, None)