--- /dev/null
+{
+ "payloadName": "NSD.yml",
+ "contactId": "jh0003",
+ "name": "NSD",
+ "description": "NSD",
+ "resourceIconPath": "network",
+ "resourceType": "VFC",
+ "categories": [{
+ "name": "Generic",
+ "subcategories": [{
+ "name": "Network Elements"
+ }]
+ }],
+ "tags": ["NSD"]
+}
\ No newline at end of file
--- /dev/null
+tosca_definitions_version: tosca_simple_yaml_1_0_0
+node_types:
+ org.openecomp.resource.vfc.NSD:
+ derived_from: tosca.nodes.Root
+ description: ECOMP Allotted Resource base type all other allotted resources node types derive from
+ properties:
+ nsd_id:
+ type: string
+ required: true
+ description: ID of the NSD
+ nsd_designer:
+ type: string
+ required: true
+ description: Designer of the NSD
+ nsd_version:
+ type: string
+ required: true
+ description: Version of the NSD
+ nsd_name:
+ type: string
+ required: true
+ description: Name of the NSD
+ providing_service_uuid:
+ type: string
+ required: true
+ description: The depending service uuid in order to map the allotted resource to the specific service version
+ providing_service_invariant_uuid:
+ type: string
+ required: true
+ description: The depending service invariant uuid in order to map the allotted resource to the specific service version
+ providing_service_name:
+ type: string
+ required: true
+ description: The depending service name in order to map the allotted resource to the specific service version
+ requirements:
+ - virtualLink:
+ capability: tosca.capabilities.network.Linkable
+ relationship: tosca.relationships.network.LinksTo
+ capabilities:
+ virtual_linkable:
+ type: tosca.capabilities.network.Linkable
--- /dev/null
+{
+ "payloadName": "VDU.yml",
+ "contactId": "jh0003",
+ "name": "VDU",
+ "description": "VDU",
+ "resourceIconPath": "compute",
+ "resourceType": "VFC",
+ "categories": [{
+ "name": "Generic",
+ "subcategories": [{
+ "name": "Infrastructure"
+ }]
+ }],
+ "tags": ["VDU"]
+}
\ No newline at end of file
--- /dev/null
+tosca_definitions_version: tosca_simple_yaml_1_0_0
+node_types:
+ tosca.nodes.nfv.VDU:
+ derived_from: tosca.nodes.SoftwareComponent
+ capabilities:
+#Not found in any spec
+# high_availability:
+# type: nfv.capabilities.HA
+ Virtualbinding:
+ type: tosca.capabilities.nfv.VirtualBindable
+# monitoring_parameter:
+# type: nfv.capabilities.Metric
+ requirements:
+#Not found in any spec
+# - high_availability:
+# capability: nfv.capabilities.HA
+# relationship: nfv.relationships.HA
+# occurrences: [ 0, 1 ]
+ - host:
+ capability: tosca.capabilities.Container
+ node: tosca.nodes.Compute
+ relationship: tosca.relationships.HostedOn
--- /dev/null
+{
+ "payloadName": "extImageFile.yml",
+ "contactId": "jh0003",
+ "name": "Ext Image File",
+ "description": "Ext Image File",
+ "resourceIconPath": "defaulticon",
+ "resourceType": "VFC",
+ "categories": [{
+ "name": "Generic",
+ "subcategories": [{
+ "name": "Infrastructure"
+ }]
+ }],
+ "tags": ["Ext Image File"]
+}
\ No newline at end of file
--- /dev/null
+tosca_definitions_version: tosca_simple_yaml_1_0_0
+node_types:
+ tosca.nodes.nfv.ext.ImageFile:
+ derived_from: tosca.nodes.Root
+ properties:
+ file_url:
+ type: string
+ required: false
+ container_type:
+ type: string
+ required: false
+ name:
+ type: string
+ required: false
+ disk_format:
+ type: string
+ required: false
+ version:
+ type: string
+ required: false
+ capabilities:
+ guest_os:
+ type: tosca.capabilities.nfv.ext.GuestOs
+ image_fle:
+ type: tosca.capabilities.nfv.ext.ImageFile
--- /dev/null
+{
+ "payloadName": "extLocalStorage.yml",
+ "contactId": "jh0003",
+ "name": "Ext Local Storage",
+ "description": "Ext Local Storage",
+ "resourceIconPath": "objectStorage",
+ "resourceType": "VFC",
+ "categories": [{
+ "name": "Generic",
+ "subcategories": [{
+ "name": "Infrastructure"
+ }]
+ }],
+ "tags": ["Ext Local Storage"]
+}
\ No newline at end of file
--- /dev/null
+tosca_definitions_version: tosca_simple_yaml_1_0_0
+node_types:
+ tosca.nodes.nfv.ext.LocalStorage:
+ derived_from: tosca.nodes.Root
+ properties:
+ size:
+ type: string
+ required: false
+ disk_type:
+ type: string
+ required: false
+ capabilities:
+ local_attachment:
+ type: tosca.capabilities.nfv.ext.LocalAttachment
\ No newline at end of file
--- /dev/null
+{
+ "payloadName": "extZteCP.yml",
+ "contactId": "jh0003",
+ "name": "ext ZTE CP",
+ "description": "Ext ZTE CP",
+ "resourceIconPath": "network",
+ "resourceType": "CP",
+ "categories": [{
+ "name": "Generic",
+ "subcategories": [{
+ "name": "Network Elements"
+ }]
+ }],
+ "tags": ["ext ZTE CP"]
+}
\ No newline at end of file
--- /dev/null
+tosca_definitions_version: tosca_simple_yaml_1_0_0
+node_types:
+ tosca.nodes.nfv.ext.zte.CP:
+ derived_from: tosca.nodes.Root
+ properties:
+ guest_os_mtu:
+ type: integer
+ required: false
+ bandwidth:
+ type: integer
+ required: false
+ interface_name:
+ type: string
+ required: false
+ allowed_address_pairs:
+ type: list
+ required: false
+ entry_schema:
+ type: tosca.datatypes.nfv.ext.AddressPairs
+ ip_address:
+ type: string
+ required: false
+ bond:
+ type: string
+ required: false
+ proxiedVNFs:
+ type: list
+ required: false
+ entry_schema:
+ type: string
+ sfc_encapsulation:
+ type: string
+ required: false
+ floating_ip_address:
+ type: tosca.datatypes.nfv.ext.FloatingIP
+ required: false
+ service_ip_address:
+ required: false
+ type: string
+ mac_address:
+ type: string
+ required: false
+ proxiedVNFtype:
+ type: string
+ required: false
+ macbond:
+ type: string
+ required: false
+ vnic_type:
+ type: string
+ required: false
+ direction:
+ type: string
+ required: false
+ order:
+ type: integer
+ required: false
+ requirements:
+ - forwarder:
+ capability: tosca.capabilities.nfv.Forwarder
+ occurrences:
+ - 0
+ - UNBOUNDED
+ - virtualbinding:
+ capability: tosca.capabilities.nfv.VirtualBindable
+ occurrences:
+ - 0
+ - UNBOUNDED
+ - virtualLink:
+ capability: tosca.capabilities.nfv.VirtualLinkable
+ occurrences:
+ - 0
+ - UNBOUNDED
+ capabilities:
+ forwarder:
+ type: tosca.capabilities.nfv.Forwarder
\ No newline at end of file
--- /dev/null
+{
+ "payloadName": "extZteVDU.yml",
+ "contactId": "jh0003",
+ "name": "Ext Zte VDU",
+ "description": "Ext Zte VDU",
+ "resourceIconPath": "compute",
+ "resourceType": "VFC",
+ "categories": [{
+ "name": "Generic",
+ "subcategories": [{
+ "name": "Infrastructure"
+ }]
+ }],
+ "tags": ["Ext Zte VDU"]
+}
\ No newline at end of file
--- /dev/null
+tosca_definitions_version: tosca_simple_yaml_1_0_0
+node_types:
+ tosca.nodes.nfv.ext.zte.VDU:
+ derived_from: tosca.nodes.Root
+ properties:
+ manual_scale_select_vim:
+ type: boolean
+ required: false
+ vdu_type:
+ type: string
+ required: false
+ watchdog:
+ type: tosca.datatypes.nfv.ext.zte.WatchDog
+ required: false
+ name:
+ type: string
+ required: false
+ local_affinity_antiaffinity_rule:
+ type: tosca.datatypes.nfv.ext.LocalAffinityOrAntiAffinityRule
+ required: false
+ support_scaling:
+ type: boolean
+ required: false
+ storage_policy:
+ type: string
+ required: false
+ key_vdu:
+ type: boolean
+ required: false
+ location_info:
+ type: tosca.datatypes.nfv.ext.LocationInfo
+ required: false
+ inject_data_list:
+ type: list
+ required: false
+ entry_schema:
+ type: tosca.datatypes.nfv.ext.InjectData
+ requirements:
+ - guest_os:
+ capability: tosca.capabilities.nfv.ext.GuestOs
+ occurrences:
+ - 0
+ - UNBOUNDED
+ - local_storage:
+ capability: tosca.capabilities.nfv.ext.LocalAttachment
+ occurrences:
+ - 0
+ - UNBOUNDED
+ - volume_storage:
+ capability: tosca.capabilities.Attachment
+ occurrences:
+ - 0
+ - UNBOUNDED
+ - dependency:
+ capability: tosca.capabilities.Node
+ occurrences:
+ - 0
+ - UNBOUNDED
+ capabilities:
+ scalable:
+ type: tosca.capabilities.Scalable
+ monitoring_parameter:
+ type: tosca.capabilities.nfv.Metric
+ nfv_compute:
+ type: tosca.capabilities.nfv.ext.Compute.Container.Architecture
+ virtualbinding:
+ type: tosca.capabilities.nfv.VirtualBindable
\ No newline at end of file
--- /dev/null
+{
+ "payloadName": "extZteVL.yml",
+ "contactId": "jh0003",
+ "name": "ext ZTE VL",
+ "description": "Ext ZTE VL",
+ "resourceIconPath": "network",
+ "resourceType": "VL",
+ "categories": [{
+ "name": "Generic",
+ "subcategories": [{
+ "name": "Network Elements"
+ }]
+ }],
+ "tags": ["ext ZTE VL"]
+}
\ No newline at end of file
--- /dev/null
+tosca_definitions_version: tosca_simple_yaml_1_0_0
+node_types:
+ tosca.nodes.nfv.ext.zte.VL:
+ derived_from: tosca.nodes.Root
+ properties:
+ segmentation_id:
+ type: string
+ required: false
+ network_name:
+ type: string
+ required: false
+ is_predefined:
+ type: boolean
+ required: false
+ mtu:
+ type: integer
+ required: false
+ dns_nameservers:
+ type: list
+ required: false
+ entry_schema:
+ type: string
+ physical_network:
+ type: string
+ required: false
+ dhcp_enabled:
+ type: boolean
+ required: false
+ network_id:
+ type: string
+ required: false
+ host_routes:
+ type: list
+ required: false
+ entry_schema:
+ type: tosca.datatypes.nfv.ext.HostRouteInfo
+ ip_version:
+ type: integer
+ required: false
+ vendor:
+ type: string
+ required: false
+ name:
+ type: string
+ required: false
+ start_ip:
+ type: string
+ required: false
+ vlan_transparent:
+ type: boolean
+ required: false
+ cidr:
+ type: string
+ required: false
+ gateway_ip:
+ type: string
+ required: false
+ network_type:
+ type: string
+ required: false
+ end_ip:
+ type: string
+ required: false
+ location_info:
+ type: tosca.datatypes.nfv.ext.LocationInfo
+ required: false
+ capabilities:
+ virtual_linkable:
+ type: tosca.capabilities.nfv.VirtualLinkable
\ No newline at end of file
--- /dev/null
+{
+ "payloadName": "vduCompute.yml",
+ "contactId": "jh0003",
+ "name": "VDU Compute",
+ "description": "VDU Compute",
+ "resourceIconPath": "compute",
+ "resourceType": "VFC",
+ "categories": [{
+ "name": "Generic",
+ "subcategories": [{
+ "name": "Infrastructure"
+ }]
+ }],
+ "tags": ["VDU Compute"]
+}
\ No newline at end of file
--- /dev/null
+tosca_definitions_version: tosca_simple_yaml_1_0_0
+node_types:
+ tosca.nodes.nfv.VDU.Compute:
+ derived_from: tosca.nodes.Root
+ properties:
+ configurable_properties:
+ type: map
+ required: true
+ status: SUPPORTED
+ entry_schema:
+ type: tosca.datatypes.nfv.VnfcConfigurableProperties
+ name:
+ type: string
+ required: true
+ status: SUPPORTED
+ nfvi_constraints:
+ type: list
+ required: false
+ status: SUPPORTED
+ entry_schema:
+ type: string
+ descrption:
+ type: string
+ required: true
+ status: SUPPORTED
+ boot_order:
+ type: list
+ required: false
+ status: SUPPORTED
+ entry_schema:
+ type: string
+ attributes:
+ private_address:
+ type: string
+ status: SUPPORTED
+ public_address:
+ type: string
+ status: SUPPORTED
+ networks:
+ type: string
+ status: SUPPORTED
+ ports:
+ type: string
+ status: SUPPORTED
+ requirements:
+ - local_storage:
+ capability: tosca.capabilities.Attachment
+ occurrences:
+ - 0
+ - UNBOUNDED
+ - virtual_storage:
+ capability: tosca.capabilities.nfv.VirtualStorage
+ occurrences:
+ - 0
+ - UNBOUNDED
+ capabilities:
+ scalable:
+ type: tosca.capabilities.Scalable
+ occurrences:
+ - 1
+ - UNBOUNDED
+ virtual_compute:
+ type: tosca.capabilities.nfv.VirtualCompute
+ occurrences:
+ - 1
+ - UNBOUNDED
+ endpoint:
+ type: tosca.capabilities.Endpoint.Admin
+ occurrences:
+ - 1
+ - UNBOUNDED
+ os:
+ type: tosca.capabilities.OperatingSystem
+ occurrences:
+ - 1
+ - UNBOUNDED
+ virtual_binding:
+ type: tosca.capabilities.nfv.VirtualBindable
+ occurrences:
+ - 1
+ - UNBOUNDED
+ host:
+ type: tosca.capabilities.Container
+ occurrences:
+ - 1
+ - UNBOUNDED
+ binding:
+ type: tosca.capabilities.network.Bindable
+ occurrences:
+ - 1
+ - UNBOUNDED
+ monitoring_parameter:
+ type: tosca.capabilities.nfv.Metric
+ occurrences:
+ - 1
+ - UNBOUNDED
\ No newline at end of file
--- /dev/null
+{
+ "payloadName": "vduCpd.yml",
+ "contactId": "jh0003",
+ "name": "VDU Cpd",
+ "description": "VDU Cpd",
+ "resourceIconPath": "port",
+ "resourceType": "CP",
+ "categories": [{
+ "name": "Generic",
+ "subcategories": [{
+ "name": "Network Elements"
+ }]
+ }],
+ "tags": ["VDU Cpd"]
+}
\ No newline at end of file
--- /dev/null
+#NOT SPEC COMPLAINT!!!!!!!!!!!!!!!!!!!!!!
+tosca_definitions_version: tosca_simple_yaml_1_0_0
+node_types:
+ tosca.nodes.nfv.VduCpd:
+ derived_from: tosca.nodes.Root
+ properties:
+ virtual_network_interface_requirements:
+ type: list
+ required: false
+ status: SUPPORTED
+ entry_schema:
+ type: tosca.datatypes.nfv.VirtualNetworkInterfaceRequirements
+ role:
+ type: string
+ required: false
+ status: SUPPORTED
+ constraints:
+ - valid_values:
+ - root
+ - leaf
+ bitrate_requirement:
+ type: integer
+ required: false
+ status: SUPPORTED
+ description:
+ type: string
+ required: false
+ status: SUPPORTED
+ layer_protocol:
+ type: string
+ required: true
+ status: SUPPORTED
+ constraints:
+ - valid_values:
+ - ethernet
+ - mpls
+ - odu2
+ - ipv4
+ - ipv6
+ - pseudo_wire
+ address_data:
+ type: list
+ required: false
+ status: SUPPORTED
+ entry_schema:
+ type: tosca.datatype.nfv.AddressData
+ requirements:
+ - virtual_binding:
+ capability: tosca.capabilities.nfv.VirtualBindable
+ occurrences:
+ - 0
+ - UNBOUNDED
+ - virtual_link:
+ capability: tosca.capabilities.nfv.VirtualLinkable
+ occurrences:
+ - 0
+ - UNBOUNDED
\ No newline at end of file
--- /dev/null
+{
+ "payloadName": "vduVirtualStorage.yml",
+ "contactId": "jh0003",
+ "name": "VDU VirtualStorage",
+ "description": "VDU VirtualStorage",
+ "resourceIconPath": "objectStorage",
+ "resourceType": "VFC",
+ "categories": [{
+ "name": "Generic",
+ "subcategories": [{
+ "name": "Infrastructure"
+ }]
+ }],
+ "tags": ["VDU VirtualStorage"]
+}
\ No newline at end of file
--- /dev/null
+tosca_definitions_version: tosca_simple_yaml_1_0_0
+node_types:
+ tosca.nodes.nfv.VDU.VirtualStorage:
+ derived_from: tosca.nodes.Root
+ properties:
+ id:
+ type: string
+ required: true
+ status: SUPPORTED
+ size_of_storage:
+ type: string
+ required: true
+ status: SUPPORTED
+ rdma_enabled:
+ type: boolean
+ required: false
+ status: SUPPORTED
+ type_of_storage:
+ type: string
+ required: true
+ status: SUPPORTED
+ capabilities:
+ virtual_storage:
+ type: tosca.capabilities.nfv.VirtualStorage
+ occurrences:
+ - 1
+ - UNBOUNDED
--- /dev/null
+{
+ "payloadName": "vnfVirtualLinkDesc.yml",
+ "contactId": "jh0003",
+ "name": "VnfVirtualLinkDesc",
+ "description": "VnfVirtualLinkDesc",
+ "resourceIconPath": "network",
+ "resourceType": "VL",
+ "categories": [{
+ "name": "Generic",
+ "subcategories": [{
+ "name": "Infrastructure"
+ }]
+ }],
+ "tags": ["VnfVirtualLinkDesc"]
+}
\ No newline at end of file
--- /dev/null
+tosca_definitions_version: tosca_simple_yaml_1_0_0
+node_types:
+ tosca.nodes.nfv.VnfVirtualLinkDesc:
+ derived_from: tosca.nodes.Root
+ properties:
+ connectivity_type:
+ type: tosca.datatypes.nfv.ConnectivityType
+ required: true
+ description:
+ type: string
+ required: false
+ test_access:
+ type: list
+ entry_schema:
+ type: string
+ required: false
+ vl_flavours:
+ type: map
+ entry_schema:
+ type: tosca.datatypes.nfv.VlFlavour
+ required: true
+ capabilities:
+ #monitoring_parameters:
+ # modeled as ad hoc (named) capabilities in node template
+ virtual_linkable:
+ type: tosca.capabilities.nfv.VirtualLinkable
\ No newline at end of file
--- /dev/null
+import pycurl
+import sys, getopt
+from StringIO import StringIO
+import json
+import copy
+from importCommon import *
+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",
+ "allottedResource",
+ "extImageFile",
+ "extLocalStorage",
+ "extZteCP",
+ "extZteVDU",
+ "extZteVL",
+ "NSD",
+ "VDU",
+ "vduCompute",
+ "vduCpd",
+ "vduVirtualStorage",
+ "vnfVirtualLinkDesc"
+ ]
+
+ 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
+
+
+def main(argv):
+ print 'Number of arguments:', len(sys.argv), 'arguments.'
+
+ 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()
+ errorAndExit(2, 'Invalid input')
+
+ for opt, arg in opts:
+ #print opt, arg
+ if opt == '-h':
+ usage()
+ sys.exit(3)
+ elif opt in ("-i", "--ip"):
+ beHost = arg
+ elif opt in ("-p", "--port"):
+ bePort = arg
+ elif opt in ("-u", "--user"):
+ adminUser = arg
+ elif opt in ("-s", "--scheme"):
+ scheme = arg
+ elif opt in ("-v", "--updateversion"):
+ if (arg.lower() == "false" or arg.lower() == "no"):
+ updateversion = 'false'
+
+ print 'scheme =',scheme,',be host =',beHost,', be port =', bePort,', user =', adminUser
+
+ if ( beHost == None ):
+ usage()
+ sys.exit(3)
+
+ results = importNfvTypes(scheme, beHost, bePort, adminUser, "../../../import/tosca/nfv-types/", 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:])
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", "compute", "softwareComponent", "webServer", "webApplication", "DBMS", "database", "objectStorage", "blockStorage", "containerRuntime", "containerApplication", "loadBalancer", "port", "network"]
#normativeTypes = [ "root" ]
responseCodes = [200, 201]
from importNormativeElements import *
from importNormativeTypes import importNormativeTypes
from importHeatTypes import importHeatTypes
+from importNfvTypes import importNfvTypes
from importOnapTypes import importOnapTypes
+from importSolTypes import importSolTypes
from importNormativeCapabilities import importNormativeCapabilities
from importCategoryTypes import importCategories
from importNormativeInterfaceLifecycleTypes import importNormativeInterfaceLifecycleType
fileLocation = baseFileLocation + "heat-types/"
resultsHeat = importHeatTypes(scheme, beHost, bePort, adminUser, fileLocation, updateversion)
handleResults(resultsHeat, updateversion)
-
+
+ fileLocation = baseFileLocation + "nfv-types/"
+ resultsHeat = importNfvTypes(scheme, beHost, bePort, adminUser, fileLocation, updateversion)
+ handleResults(resultsHeat, updateversion)
+
fileLocation = baseFileLocation + "onap-types/"
resultsHeat = importOnapTypes(scheme, beHost, bePort, adminUser, fileLocation, updateversion)
handleResults(resultsHeat, updateversion)
-
+
+ fileLocation = baseFileLocation + "sol-types/"
+ resultsHeat = importSolTypes(scheme, beHost, bePort, adminUser, fileLocation, updateversion)
+ handleResults(resultsHeat, updateversion)
+
fileLocation = baseFileLocation + "group-types/"
importGroupTypes(scheme, beHost, bePort, adminUser, False, fileLocation)
errorAndExit(0, None)
if __name__ == "__main__":
- main(sys.argv[1:])
+ main(sys.argv[1:])
#####################################################################################################################################################################################################
def importOnapTypes(scheme, beHost, bePort, adminUser, fileDir, updateversion):
-
- onapTypes = [ "extImageFile",
- "extLocalStorage",
- "extZteCP",
- "extZteVDU",
- "extZteVL",
- "NSD",
- "VDU",
- "vduCompute",
- "vduCpd",
- "vduVirtualStorage",
- "vnfVirtualLinkDesc"
- ]
+
+ #Add desired type names to the list
+ onapTypes = []
responseCodes = [200, 201]
--- /dev/null
+import pycurl
+import sys, getopt
+from StringIO import StringIO
+import json
+import copy
+from importCommon import *
+from importNormativeTypes import *
+import importCommon
+
+#####################################################################################################################################################################################################
+# #
+# Import Sol Types from a given file #
+# #
+# activation : #
+# python importSolTypes.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 importSolTypes(scheme, beHost, bePort, adminUser, fileDir, updateversion):
+
+ #Add desired type names to the list
+ solTypes = []
+
+ responseCodes = [200, 201]
+
+ if(updateversion == 'false'):
+ responseCodes = [200, 201, 409]
+
+ results = []
+ for onapType in solTypes:
+ 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])
+ return results
+
+
+def main(argv):
+ print 'Number of arguments:', len(sys.argv), 'arguments.'
+
+ 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()
+ errorAndExit(2, 'Invalid input')
+
+ for opt, arg in opts:
+ #print opt, arg
+ if opt == '-h':
+ usage()
+ sys.exit(3)
+ elif opt in ("-i", "--ip"):
+ beHost = arg
+ elif opt in ("-p", "--port"):
+ bePort = arg
+ elif opt in ("-u", "--user"):
+ adminUser = arg
+ elif opt in ("-s", "--scheme"):
+ scheme = arg
+ elif opt in ("-v", "--updateversion"):
+ if (arg.lower() == "false" or arg.lower() == "no"):
+ updateversion = 'false'
+
+ print 'scheme =',scheme,',be host =',beHost,', be port =', bePort,', user =', adminUser
+
+ if ( beHost == None ):
+ usage()
+ sys.exit(3)
+
+ results = importSolTypes(scheme, beHost, bePort, adminUser, "../../../import/tosca/sol-types/", 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:])
{
+ "nfv": [
+ ],
"onap": [
+ ],
+ "sol":[
]
}
\ No newline at end of file
--- /dev/null
+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 [-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 upgradeNfvTypesPerConfigFile(scheme, beHost, bePort, adminUser, baseDir, updateversion):
+ responseCodes = [200, 201]
+ if (updateversion == 'false'):
+ responseCodes = [200, 201, 409]
+ with open("onapTypesToUpgrade.json", 'r') as stream:
+ try:
+ types = json.load(stream)
+ nfvTypes = types["nfv"]
+ debug(nfvTypes)
+ nfvFileDir = baseDir + "nfv-types/"
+ debug(nfvFileDir)
+ results = []
+ for nfvType in nfvTypes:
+ result = createNormativeType(scheme, beHost, bePort, adminUser, nfvFileDir, nfvType.encode('ascii', 'ignore'), updateversion)
+ results.append(result)
+ if (result[1] == None or result[1] not in responseCodes):
+ print "Failed creating nfv type " + nfvType + ". " + str(result[1])
+ 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'
+ scheme = 'http'
+
+ try:
+ opts, args = getopt.getopt(argv, "i:p:u:v:h:s:", ["ip=", "port=", "user=", "updateversion=","scheme="])
+ except getopt.GetoptError:
+ usage()
+ errorAndExit(2, 'Invalid input')
+
+ for opt, arg in opts:
+ # print opt, arg
+ if opt == '-h':
+ usage()
+ sys.exit(3)
+ elif opt in ("-i", "--ip"):
+ beHost = arg
+ elif opt in ("-p", "--port"):
+ bePort = arg
+ elif opt in ("-u", "--user"):
+ adminUser = arg
+ elif opt in ("-s", "--scheme"):
+ scheme = arg
+ elif opt in ("-v", "--updateversion"):
+ if (arg.lower() == "false" or arg.lower() == "no"):
+ updateversion = 'false'
+
+ print 'scheme =',scheme,', be host =',beHost, ', be port =', bePort, ', user =', adminUser
+
+ if (beHost == None):
+ usage()
+ sys.exit(3)
+
+ results = upgradeNfvTypesPerConfigFile(scheme, 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:])
+
from importGroupTypes import importGroupTypes
from importNormativeCapabilities import importNormativeCapabilities
from importNormativeInterfaceLifecycleTypes import importNormativeInterfaceLifecycleType
+from upgradeNfvTypes import upgradeNfvTypesPerConfigFile
from upgradeONAPTypes import upgradeOnapTypesPerConfigFile
+from upgradeSolTypes import upgradeSolTypesPerConfigFile
from importCommon import *
resultsHeat = upgradeTypesPerConfigFile(scheme, beHost, bePort, adminUser, baseFileLocation, updateversion)
handleResults(resultsHeat)
-
+
+ resultsHeat = upgradeNfvTypesPerConfigFile(scheme, beHost, bePort, adminUser, baseFileLocation, updateOnapVersion)
+ handleResults(resultsHeat)
+
resultsHeat = upgradeOnapTypesPerConfigFile(scheme, beHost, bePort, adminUser, baseFileLocation, updateOnapVersion)
handleResults(resultsHeat)
-
+
+ resultsHeat = upgradeSolTypesPerConfigFile(scheme, beHost, bePort, adminUser, baseFileLocation, updateOnapVersion)
+ handleResults(resultsHeat)
+
errorAndExit(0, None)
if __name__ == "__main__":
--- /dev/null
+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 [-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 upgradeSolTypesPerConfigFile(scheme, beHost, bePort, adminUser, baseDir, updateversion):
+ responseCodes = [200, 201]
+ if (updateversion == 'false'):
+ responseCodes = [200, 201, 409]
+ with open("onapTypesToUpgrade.json", 'r') as stream:
+ try:
+ types = json.load(stream)
+ solTypes = types["sol"]
+ debug(solTypes)
+ solFileDir = baseDir + "sol-types/"
+ debug(solFileDir)
+ results = []
+ for solType in solTypes:
+ result = createNormativeType(scheme, beHost, bePort, adminUser, solFileDir, solType.encode('ascii', 'ignore'), updateversion)
+ results.append(result)
+ if (result[1] == None or result[1] not in responseCodes):
+ print "Failed creating sol type " + solType + ". " + str(result[1])
+ 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'
+ scheme = 'http'
+
+ try:
+ opts, args = getopt.getopt(argv, "i:p:u:v:h:s:", ["ip=", "port=", "user=", "updateversion=","scheme="])
+ except getopt.GetoptError:
+ usage()
+ errorAndExit(2, 'Invalid input')
+
+ for opt, arg in opts:
+ # print opt, arg
+ if opt == '-h':
+ usage()
+ sys.exit(3)
+ elif opt in ("-i", "--ip"):
+ beHost = arg
+ elif opt in ("-p", "--port"):
+ bePort = arg
+ elif opt in ("-u", "--user"):
+ adminUser = arg
+ elif opt in ("-s", "--scheme"):
+ scheme = arg
+ elif opt in ("-v", "--updateversion"):
+ if (arg.lower() == "false" or arg.lower() == "no"):
+ updateversion = 'false'
+
+ print 'scheme =',scheme,', be host =',beHost, ', be port =', bePort, ', user =', adminUser
+
+ if (beHost == None):
+ usage()
+ sys.exit(3)
+
+ results = upgradeSolTypesPerConfigFile(scheme, 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:])
+