diff options
Diffstat (limited to 'catalog-be/src/main/resources')
12 files changed, 321 insertions, 18 deletions
diff --git a/catalog-be/src/main/resources/config/SDC.zip b/catalog-be/src/main/resources/config/SDC.zip Binary files differdeleted file mode 100644 index 6df1b13f2b..0000000000 --- a/catalog-be/src/main/resources/config/SDC.zip +++ /dev/null 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/config/license.txt b/catalog-be/src/main/resources/config/license.txt new file mode 100644 index 0000000000..0a4f362316 --- /dev/null +++ b/catalog-be/src/main/resources/config/license.txt @@ -0,0 +1,13 @@ +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# diff --git a/catalog-be/src/main/resources/import/tosca/artifact-types/artifactTypes.yml b/catalog-be/src/main/resources/import/tosca/artifact-types/artifactTypes.yml new file mode 100644 index 0000000000..7b7e640a3c --- /dev/null +++ b/catalog-be/src/main/resources/import/tosca/artifact-types/artifactTypes.yml @@ -0,0 +1,30 @@ +tosca.artifacts.Root: + description: This is the default (root) TOSCA Artifact Type definition that all other TOSCA base Artifact Types derive from. + +tosca.artifacts.Deployment.Image: + derived_from: tosca.artifacts.Deployment + description: This artifact type represents a parent type for any "image" which is an opaque packaging of a TOSCA Node's deployment (whether real or virtual) whose contents are typically already installed and pre-configured (i.e., "stateful") and prepared to be run on a known target container. + +tosca.artifacts.Implementation.Bash: + derived_from: tosca.artifacts.Implementation + description: This artifact type represents a Bash script type that contains Bash commands that can be executed on the Unix Bash shell. + +tosca.artifacts.Deployment.Image.VM: + derived_from: tosca.artifacts.Deployment + description: This artifact represents the parent type for all Virtual Machine (VM) image and container formatted deployment artifacts. These images contain a stateful capture of a machine (e.g., server) including operating system and installed software along with any configurations and can be run on another machine using a hypervisor which virtualizes typical server (i.e., hardware) resources. + +tosca.artifacts.Implementation.Python: + derived_from: tosca.artifacts.Implementation + description: This artifact type represents a Python file that contains Python language constructs that can be executed within a Python interpreter. + +tosca.artifacts.Deployment: + derived_from: tosca.artifacts.Root + description: This artifact type represents the parent type for all deployment artifacts in TOSCA. This class of artifacts typically represents a binary packaging of an application or service that is used to install/create or deploy it as part of a node's lifecycle. + +tosca.artifacts.File: + derived_from: tosca.artifacts.Root + description: This artifact type is used when an artifact definition needs to have its associated file simply treated as a file and no special handling/handlers are invoked (i.e., it is not treated as either an implementation or deployment artifact type). + +tosca.artifacts.Implementation: + derived_from: tosca.artifacts.Root + description: This artifact type represents the parent type for all implementation artifacts in TOSCA. These artifacts are used to implement operations of TOSCA interfaces either directly (e.g., scripts) or indirectly (e.g., config. files). diff --git a/catalog-be/src/main/resources/import/tosca/artifact-types/artifactTypes.zip b/catalog-be/src/main/resources/import/tosca/artifact-types/artifactTypes.zip Binary files differnew file mode 100644 index 0000000000..7a0a5d9404 --- /dev/null +++ b/catalog-be/src/main/resources/import/tosca/artifact-types/artifactTypes.zip diff --git a/catalog-be/src/main/resources/import/tosca/data-types/dataTypes.yml b/catalog-be/src/main/resources/import/tosca/data-types/dataTypes.yml index da15414d9d..621274796f 100644 --- a/catalog-be/src/main/resources/import/tosca/data-types/dataTypes.yml +++ b/catalog-be/src/main/resources/import/tosca/data-types/dataTypes.yml @@ -67,7 +67,7 @@ tosca.datatypes.TimeInterval: tosca.datatypes.network.NetworkInfo: derived_from: tosca.datatypes.Root - properties: + properties: network_name: type: string network_id: @@ -1045,7 +1045,13 @@ org.openecomp.datatypes.network.IpRequirements: required: false floating_ip_count_required: type: org.openecomp.datatypes.AssignmentRequirements - required: false + required: false + ip_address_plan_name: + type: string + required: false + vrf_name: + type: string + required: false org.openecomp.datatypes.network.MacAssignments: derived_from: org.openecomp.datatypes.Root diff --git a/catalog-be/src/main/resources/import/tosca/data-types/dataTypes.zip b/catalog-be/src/main/resources/import/tosca/data-types/dataTypes.zip Binary files differindex 08d4bfc3a5..ffbe146f9b 100644 --- a/catalog-be/src/main/resources/import/tosca/data-types/dataTypes.zip +++ b/catalog-be/src/main/resources/import/tosca/data-types/dataTypes.zip diff --git a/catalog-be/src/main/resources/import/tosca/relationship-types/relationshipTypes.yml b/catalog-be/src/main/resources/import/tosca/relationship-types/relationshipTypes.yml new file mode 100644 index 0000000000..5fb5390721 --- /dev/null +++ b/catalog-be/src/main/resources/import/tosca/relationship-types/relationshipTypes.yml @@ -0,0 +1,111 @@ + tosca.relationships.Root: + description: This is the default (root) TOSCA Relationship Type definition that all other TOSCA Relationship Types derive from. + attributes: + tosca_id: + description: A unique identifier of the realized instance of a Relationship Template that derives from any TOSCA normative type. + type: string + tosca_name: + description: This attribute reflects the name of the Relationship Template as defined in the TOSCA service template. This name is not unique to the realized instance model of corresponding deployed application as each template in the model can result in one or more instances (e.g., scaled) when orchestrated to a provider environment. + type: string + state: + description: The state of the relationship instance. + type: string + default: initial + interfaces: + Configure: + type: tosca.interfaces.relationship.Configure + + tosca.relationships.RoutesTo: + derived_from: tosca.relationships.ConnectsTo + description: This type represents an intentional network routing between two Endpoints in different networks. + valid_target_types: + - tosca.capabilities.Endpoint + + tosca.relationships.network.LinksTo: + derived_from: tosca.relationships.DependsOn + description: This relationship type represents an association relationship between Port and Network node types. + valid_target_types: + - tosca.capabilities.network.Linkable + + tosca.relationships.AttachesTo: + derived_from: tosca.relationships.Root + description: This type represents an attachment relationship between two nodes. For example, an AttachesTo relationship type would be used for attaching a storage node to a Compute node. + valid_target_types: + - tosca.capabilities.Attachment + properties: + location: + description: 'The relative location (e.g., path on the file system), which + provides the root location to address an attached node. e.g., a mount point + / path such as ''/usr/data''. Note: The user must provide it and it cannot + be "root".' + type: string + constraints: + - min_length: 1 + device: + description: The logical device name which for the attached device (which is represented by the target node in the model). e.g., '/dev/hda1'. + type: string + required: false + attributes: + device: + description: 'The logical name of the device as exposed to the instance. Note: + A runtime property that gets set when the model gets instantiated by the + orchestrator.' + type: string + + tosca.relationships.network.BindsTo: + derived_from: tosca.relationships.DependsOn + description: This type represents a network association relationship between Port and Compute node types. + valid_target_types: + - tosca.capabilities.network.Bindable + + tosca.relationships.HostedOn: + derived_from: tosca.relationships.Root + description: This type represents a hosting relationship between two nodes. + valid_target_types: + - tosca.capabilities.Container + + tosca.relationships.DependsOn: + derived_from: tosca.relationships.Root + description: This type represents a general dependency relationship between two nodes. + valid_target_types: + - tosca.capabilities.Node + + tosca.relationships.ConnectsTo: + derived_from: tosca.relationships.Root + description: This type represents a network connection relationship between two nodes. + valid_target_types: + - tosca.capabilities.Endpoint + properties: + credential: + type: tosca.datatypes.Credential + required: false + + org.openecomp.relationships.VolumeAttachesTo: + derived_from: org.openecomp.relationships.AttachesTo + description: This type represents an attachment relationship for associating volume + properties: + volume_id: + description: The ID of the volume to be attached + type: string + status: SUPPORTED + required: true + instance_uuid: + description: The ID of the server to which the volume attaches + type: string + status: SUPPORTED + required: true + attributes: + show: + description: Detailed information about resource + type: string + status: SUPPORTED + + org.openecomp.relationships.AttachesTo: + derived_from: tosca.relationships.AttachesTo + description: This type represents an attachment relationship + properties: + location: + description: The relative location (e.g., path on the file system), which provides the root location to address an attached node. + type: string + status: SUPPORTED + required: false
\ No newline at end of file diff --git a/catalog-be/src/main/resources/import/tosca/relationship-types/relationshipTypes.zip b/catalog-be/src/main/resources/import/tosca/relationship-types/relationshipTypes.zip Binary files differnew file mode 100644 index 0000000000..dbb1ca02f2 --- /dev/null +++ b/catalog-be/src/main/resources/import/tosca/relationship-types/relationshipTypes.zip 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..a6948f5da8 --- /dev/null +++ b/catalog-be/src/main/resources/scripts/import/tosca/typesToUpgrade.json @@ -0,0 +1,13 @@ +{ + "heat": [ + "contrailPort", + "extCp", + "contrailV2VirtualMachineInterface", + "neutronPort", + "Generic_PNF", + "multiFlavorVFC", + "vnfConfiguration" + ], + "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..e35e2d28eb --- /dev/null +++ b/catalog-be/src/main/resources/scripts/import/tosca/upgradeHeatAndNormativeTypes.py @@ -0,0 +1,111 @@ +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:]) + 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:]) - |