diff options
Diffstat (limited to 'catalog-be/src/main/resources')
6 files changed, 131 insertions, 31 deletions
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 index 4506fa1b97..f446f21a62 100644 --- a/catalog-be/src/main/resources/import/tosca/relationship-types/relationshipTypes.yml +++ b/catalog-be/src/main/resources/import/tosca/relationship-types/relationshipTypes.yml @@ -15,18 +15,22 @@ tosca.relationships.Root: Configure: type: tosca.interfaces.relationship.Configure +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 + 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. @@ -52,12 +56,6 @@ tosca.relationships.AttachesTo: 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. @@ -70,15 +68,27 @@ tosca.relationships.DependsOn: 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. +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.Endpoint - properties: - credential: - type: tosca.datatypes.Credential - required: false + - tosca.capabilities.network.Linkable + +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 + +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 org.openecomp.relationships.VolumeAttachesTo: derived_from: org.openecomp.relationships.AttachesTo @@ -100,15 +110,6 @@ org.openecomp.relationships.VolumeAttachesTo: 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 org.openecomp.relationships.ForwardsTo: derived_from: tosca.relationships.Root valid_target_types: [org.openecomp.capabilities.Forwarder] diff --git a/catalog-be/src/main/resources/scripts/import/tosca/importNormativeAll.py b/catalog-be/src/main/resources/scripts/import/tosca/importNormativeAll.py index 8a8329027f..19ffc1762f 100644 --- a/catalog-be/src/main/resources/scripts/import/tosca/importNormativeAll.py +++ b/catalog-be/src/main/resources/scripts/import/tosca/importNormativeAll.py @@ -8,6 +8,7 @@ from importNormativeElements import * from importNormativeTypes import importNormativeTypes from importHeatTypes import importHeatTypes from importNormativeCapabilities import importNormativeCapabilities +from importNormativeRelationships import importNormativeRelationships from importCategoryTypes import importCategories from importNormativeInterfaceLifecycleTypes import importNormativeInterfaceLifecycleType from importDataTypes import importDataTypes @@ -116,6 +117,9 @@ def main(argv): fileLocation = baseFileLocation + "capability-types/" importNormativeCapabilities(scheme, beHost, bePort, adminUser, False, fileLocation) + fileLocation = baseFileLocation + "relationship-types/" + importNormativeRelationships(scheme, beHost, bePort, adminUser, False, fileLocation) + fileLocation = baseFileLocation + "interface-lifecycle-types/" importNormativeInterfaceLifecycleType(scheme, beHost, bePort, adminUser, False, fileLocation) diff --git a/catalog-be/src/main/resources/scripts/import/tosca/importNormativeRelationships.py b/catalog-be/src/main/resources/scripts/import/tosca/importNormativeRelationships.py new file mode 100644 index 0000000000..a86e520558 --- /dev/null +++ b/catalog-be/src/main/resources/scripts/import/tosca/importNormativeRelationships.py @@ -0,0 +1,83 @@ +import pycurl +import sys, getopt +from StringIO import StringIO +import json +import copy +from importNormativeElements import createNormativeElement +from importCommon import * +import importCommon + +################################################################################################################################################################################################# +# # +# Import normative relationships +# # +# # +# activation : # +# python importNormativeRelationships.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 importNormativeRelationships.py [-f <input file> | --ifile=<input file> ] +# # +# # +################################################################################################################################################################################################# + + +def usage(): + print sys.argv[0], '[optional -s <scheme> | --scheme=<scheme>, default http] [-i <be host> | --ip=<be host>] [-p <be port> | --port=<be port> ] [-u <user userId> | --user=<user userId> ]' + + +def importNormativeRelationships(scheme, beHost, bePort, adminUser, exitOnSuccess, fileDir): + result = createNormativeElement(scheme, beHost, bePort, adminUser, fileDir, "/sdc2/rest/v1/catalog/uploadType/relationship", "relationshipTypes", "relationshipTypeZip") + + print_frame_line() + print_name_and_return_code(result[0], result[1]) + print_frame_line() + + if ( result[1] == None or result[1] not in [200, 201, 409] ): + importCommon.error_and_exit(1, None) + else: + if (exitOnSuccess == True): + importCommon.error_and_exit(0, None) + + +def main(argv): + print 'Number of arguments:', len(sys.argv), 'arguments.' + + beHost = 'localhost' + bePort = '8080' + adminUser = 'jh0003' + scheme = 'http' + + try: + opts, args = getopt.getopt(argv,"i:p:u:h:s:",["ip=","port=","user=","scheme="]) + except getopt.GetoptError: + usage() + importCommon.error_and_exit(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 + + print 'scheme =',scheme,', be host =',beHost,', be port =', bePort,', user =', adminUser + + if ( beHost == None ): + usage() + sys.exit(3) + + importNormativeRelationships(scheme, beHost, bePort, adminUser, True, "../../../import/tosca/relationship-types/") + + +if __name__ == "__main__": + main(sys.argv[1:]) + diff --git a/catalog-be/src/main/resources/scripts/import/tosca/importONAPNormativeAll.py b/catalog-be/src/main/resources/scripts/import/tosca/importONAPNormativeAll.py index ef1fe4d3b9..30b5a5435d 100644 --- a/catalog-be/src/main/resources/scripts/import/tosca/importONAPNormativeAll.py +++ b/catalog-be/src/main/resources/scripts/import/tosca/importONAPNormativeAll.py @@ -12,6 +12,7 @@ from importNfvTypes import importNfvTypes from importOnapTypes import importOnapTypes from importSolTypes import importSolTypes from importNormativeCapabilities import importNormativeCapabilities +from importNormativeRelationships import importNormativeRelationships from importCategoryTypes import importCategories from importNormativeInterfaceLifecycleTypes import importNormativeInterfaceLifecycleType from importDataTypes import importDataTypes @@ -111,12 +112,15 @@ def main(argv): print 'sleep until data type cache is updated' time.sleep( 70 ) - + fileLocation = baseFileLocation + "capability-types/" importNormativeCapabilities(scheme, beHost, bePort, adminUser, False, fileLocation) + + fileLocation = baseFileLocation + "relationship-types/" + importNormativeRelationships(scheme, beHost, bePort, adminUser, False, fileLocation) fileLocation = baseFileLocation + "interface-lifecycle-types/" - importNormativeInterfaceLifecycleType(scheme, beHost, bePort, adminUser, False, fileLocation) + importNormativeInterfaceLifecycleType(scheme, beHost, bePort, adminUser, False, fileLocation) fileLocation = baseFileLocation + "categories/" importCategories(scheme, beHost, bePort, adminUser, False, fileLocation) 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 bbeb3d6972..36a5d1181a 100644 --- a/catalog-be/src/main/resources/scripts/import/tosca/upgradeNormative.py +++ b/catalog-be/src/main/resources/scripts/import/tosca/upgradeNormative.py @@ -10,6 +10,7 @@ from importDataTypes import importDataTypes from importPolicyTypes import importPolicyTypes from importGroupTypes import importGroupTypes from importNormativeCapabilities import importNormativeCapabilities +from importNormativeRelationships import importNormativeRelationships from importNormativeInterfaceLifecycleTypes import importNormativeInterfaceLifecycleType from importAnnotationTypes import import_annotation_types @@ -96,6 +97,9 @@ def main(argv): fileLocation = baseFileLocation + "categories/" importCategories(scheme, beHost, bePort, adminUser, False, fileLocation) + fileLocation = baseFileLocation + "relationship-types/" + importNormativeRelationships(scheme, beHost, bePort, adminUser, False, fileLocation) + fileLocation = baseFileLocation + "data-types/" importDataTypes(scheme, beHost, bePort, adminUser, False, fileLocation) diff --git a/catalog-be/src/main/resources/scripts/import/tosca/upgradeONAPNormative.py b/catalog-be/src/main/resources/scripts/import/tosca/upgradeONAPNormative.py index bebba6c2cb..c6d217f986 100644 --- a/catalog-be/src/main/resources/scripts/import/tosca/upgradeONAPNormative.py +++ b/catalog-be/src/main/resources/scripts/import/tosca/upgradeONAPNormative.py @@ -10,6 +10,7 @@ from importDataTypes import importDataTypes from importPolicyTypes import importPolicyTypes from importGroupTypes import importGroupTypes from importNormativeCapabilities import importNormativeCapabilities +from importNormativeRelationships import importNormativeRelationships from importNormativeInterfaceLifecycleTypes import importNormativeInterfaceLifecycleType from upgradeNfvTypes import upgradeNfvTypesPerConfigFile from upgradeONAPTypes import upgradeOnapTypesPerConfigFile @@ -101,6 +102,9 @@ def main(argv): fileLocation = baseFileLocation + "categories/" importCategories(scheme, beHost, bePort, adminUser, False, fileLocation) + fileLocation = baseFileLocation + "relationship-types/" + importNormativeRelationships(scheme, beHost, bePort, adminUser, False, fileLocation) + fileLocation = baseFileLocation + "data-types/" importDataTypes(scheme, beHost, bePort, adminUser, False, fileLocation) |