From a5445100050e49e83f73424198d73cd72d672a4d Mon Sep 17 00:00:00 2001 From: Michael Lando Date: Sun, 4 Mar 2018 14:53:33 +0200 Subject: Sync Integ to Master Change-Id: I71e3acc26fa612127756ac04073a522b9cc6cd74 Issue-ID: SDC-977 Signed-off-by: Gitelman, Tal (tg851x) --- .../src/main/resources/application-context.xml | 58 ++------ .../main/resources/config/DME2preferredRouter.txt | 0 .../src/main/resources/config/configuration.yaml | 72 ++++++++- .../config/distribution-engine-configuration.yaml | 39 ++++- .../main/resources/config/error-configuration.yaml | 162 ++++++++++++++++++++- catalog-be/src/main/resources/config/logback.xml | 10 +- .../tosca/capability-types/capabilityTypes.yml | 12 ++ .../tosca/capability-types/capabilityTypes.zip | Bin 1676 -> 1735 bytes .../import/tosca/data-types/dataTypes.yml | 3 +- .../import/tosca/data-types/dataTypes.zip | Bin 6601 -> 6315 bytes .../import/tosca/group-types/groupTypes.yml | 59 +++++++- .../import/tosca/group-types/groupTypes.zip | Bin 1088 -> 1356 bytes .../tosca/heat-types/Generic_CR/Generic_CR.json | 21 +++ .../tosca/heat-types/Generic_CR/Generic_CR.yml | 15 ++ .../tosca/heat-types/Generic_CR/Generic_CR.zip | Bin 0 -> 678 bytes .../tosca/heat-types/Generic_VF/Generic_VF.zip | Bin 460 -> 462 bytes .../import/tosca/heat-types/extVl/extVl.zip | Bin 762 -> 767 bytes .../heat-types/forwardingPath/forwardingPath.json | 21 +++ .../heat-types/forwardingPath/forwardingPath.yml | 24 +++ .../heat-types/forwardingPath/forwardingPath.zip | Bin 0 -> 509 bytes .../tosca/heat-types/globalPort/globalPort.yml | 2 + .../tosca/heat-types/globalPort/globalPort.zip | Bin 1245 -> 1183 bytes .../import/tosca/policy-types/policyTypes.yml | 35 ++++- .../import/tosca/policy-types/policyTypes.zip | Bin 673 -> 905 bytes .../tosca/relationship-types/relationshipTypes.yml | 5 +- .../tosca/relationship-types/relationshipTypes.zip | Bin 1396 -> 1421 bytes .../scripts/import/tosca/importCategoryTypes.py | 37 ++--- .../scripts/import/tosca/importDataTypes.py | 37 ++--- .../scripts/import/tosca/importGroupTypes.py | 37 ++--- .../scripts/import/tosca/importHeatTypes.py | 39 ++--- .../scripts/import/tosca/importNodeType.py | 18 ++- .../scripts/import/tosca/importNormativeAll.py | 51 ++++--- .../import/tosca/importNormativeCapabilities.py | 37 ++--- .../import/tosca/importNormativeElements.py | 30 ++-- .../importNormativeInterfaceLifecycleTypes.py | 37 ++--- .../importNormativeNoHeatAndNormativeTypes.py | 43 +++--- .../scripts/import/tosca/importNormativeTypes.py | 46 +++--- .../scripts/import/tosca/importONAPNormativeAll.py | 27 ++-- .../scripts/import/tosca/importOnapTypes.py | 35 ++--- .../scripts/import/tosca/importPolicyTypes.py | 37 ++--- .../scripts/import/tosca/importUsersFromYaml.py | 63 ++++---- .../scripts/import/tosca/typesToUpgrade.json | 15 +- .../import/tosca/upgradeHeatAndNormativeTypes.py | 37 ++--- .../scripts/import/tosca/upgradeHeatTypes1707.py | 37 ++--- .../scripts/import/tosca/upgradeNormative.py | 51 ++++--- .../import/tosca/upgradeNormativeVersion.py | 39 ++--- .../import/tosca/upgradeNormativeVersionAll.py | 13 +- .../tosca/upgradeNormativeVersionProd1702_3537.py | 49 ++++--- .../scripts/import/tosca/upgradeONAPNormative.py | 21 +-- 49 files changed, 914 insertions(+), 460 deletions(-) create mode 100644 catalog-be/src/main/resources/config/DME2preferredRouter.txt create mode 100644 catalog-be/src/main/resources/import/tosca/heat-types/Generic_CR/Generic_CR.json create mode 100644 catalog-be/src/main/resources/import/tosca/heat-types/Generic_CR/Generic_CR.yml create mode 100644 catalog-be/src/main/resources/import/tosca/heat-types/Generic_CR/Generic_CR.zip create mode 100644 catalog-be/src/main/resources/import/tosca/heat-types/forwardingPath/forwardingPath.json create mode 100644 catalog-be/src/main/resources/import/tosca/heat-types/forwardingPath/forwardingPath.yml create mode 100644 catalog-be/src/main/resources/import/tosca/heat-types/forwardingPath/forwardingPath.zip (limited to 'catalog-be/src/main/resources') diff --git a/catalog-be/src/main/resources/application-context.xml b/catalog-be/src/main/resources/application-context.xml index 2b3603ce3b..b34ad69ffb 100644 --- a/catalog-be/src/main/resources/application-context.xml +++ b/catalog-be/src/main/resources/application-context.xml @@ -11,56 +11,18 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - + base-package= "org.openecomp.sdc.be.components.health, + org.openecomp.sdc.be.servlets, + org.openecomp.sdc.be.externalapi.servlet, + org.openecomp.sdc.be.components.scheduledtasks, + org.openecomp.sdc.be.model.jsontitan.utils"> + + + + + diff --git a/catalog-be/src/main/resources/config/DME2preferredRouter.txt b/catalog-be/src/main/resources/config/DME2preferredRouter.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/catalog-be/src/main/resources/config/configuration.yaml b/catalog-be/src/main/resources/config/configuration.yaml index 190153cb0a..aefdacea98 100644 --- a/catalog-be/src/main/resources/config/configuration.yaml +++ b/catalog-be/src/main/resources/config/configuration.yaml @@ -23,7 +23,7 @@ beSslPort: 8443 version: 1.1.0 released: 2012-11-30 -toscaConformanceLevel: 5.0 +toscaConformanceLevel: 7.0 minToscaConformanceLevel: 3.0 titanCfgFile: /home/vagrant/catalog-be/config/catalog-be/titan.properties @@ -146,6 +146,7 @@ resourceTypes: &allResourceTypes - CP - VL - VF + - CR - VFCMT - Abstract - CVFC @@ -198,7 +199,8 @@ toscaArtifacts: excludeResourceCategory: - Generic excludeResourceType: - - PNF + - PNF + - CR informationalResourceArtifacts: features: displayName: Features @@ -422,7 +424,7 @@ resourceDeploymentArtifacts: DCAE_DOC: acceptedTypes: validForResourceTypes: - - VF + - VF - VFCMT DCAE_EVENT: acceptedTypes: @@ -532,6 +534,7 @@ resourceInformationalArtifacts: - CP - VL - VF + - CR - VFCMT - Abstract - PNF @@ -641,6 +644,7 @@ genericAssetNodeTypes: VFC: org.openecomp.resource.abstract.nodes.VFC CVFC: org.openecomp.resource.abstract.nodes.VFC VF : org.openecomp.resource.abstract.nodes.VF + CR : org.openecomp.resource.abstract.nodes.CR PNF: org.openecomp.resource.abstract.nodes.PNF Service: org.openecomp.resource.abstract.nodes.service @@ -662,3 +666,65 @@ environmentContext: - Needed_Non-Revenue - Useful_Non-Revenue - General_Non-Revenue + +dmaapConsumerConfiguration: + hosts: olsd004.wnsnet.attws.com:3905 + consumerGroup: asdc + consumerId: mama #mama - in Order To Consume Remove This String And Replace It With -> mama + timeoutMs: 15000 + limit: 1 + pollingInterval: 2 + topic: com.att.sdc.23911-SDCforTestDev-v001 + latitude: 32.109333 + longitude: 34.855499 + version: 1.0 + serviceName: dmaap-v1.dev.dmaap.dt.saat.acsi.att.com/events + environment: TEST + partner: BOT_R + routeOffer: MR1 + protocol: https + contenttype: application/json + dme2TraceOn: true + aftEnvironment: AFTUAT + aftDme2ConnectionTimeoutMs: 15000 + aftDme2RoundtripTimeoutMs: 240000 + aftDme2ReadTimeoutMs: 50000 + dme2preferredRouterFilePath: DME2preferredRouter.txt + timeLimitForNotificationHandleMs: 120000 + credential: + username: m09875@sdc.att.com + password: hmXYcznAljMSisdy8zgcag== + + + +dmeConfiguration: + dme2Search: DME2SEARCH + dme2Resolve: DME2RESOLVE + + +excludedPolicyTypesMapping: + # VF: + # - a.b.c + # - c.d.e + #CR: + # - x.y.z + +excludedGroupTypesMapping: + CR: + - org.openecomp.groups.VfModule + - org.openecomp.groups.heat.HeatStack + - tosca.groups.Root + VF: + - org.openecomp.groups.VfModule + - org.openecomp.groups.heat.HeatStack + - tosca.groups.Root + Service: + - org.openecomp.groups.VfModule + - org.openecomp.groups.heat.HeatStack + - tosca.groups.Root + +healthStatusExclude: + - DE + - ES + - DMAAP + diff --git a/catalog-be/src/main/resources/config/distribution-engine-configuration.yaml b/catalog-be/src/main/resources/config/distribution-engine-configuration.yaml index 60886cf40f..5ebbe82985 100644 --- a/catalog-be/src/main/resources/config/distribution-engine-configuration.yaml +++ b/catalog-be/src/main/resources/config/distribution-engine-configuration.yaml @@ -45,4 +45,41 @@ createTopic: startDistributionEngine: true -useHttpsWithDmaap: true \ No newline at end of file + +useHttpsWithDmaap: false +opEnvRecoveryIntervalSec: 180 +allowedTimeBeforeStaleSec: 300 + +aaiConfig: + httpRequestConfig: + serverRootUrl: https://aai-uint3.test.att.com:8443 + resourceNamespaces: + operationalEnvironments: /aai/v12/cloud-infrastructure/operational-environments + + httpClientConfig: + timeouts: + readTimeoutMs: 5000 + connectTimeoutMs: 1000 + clientCertificate: + keyStore: /opt/app/jetty/base/be/etc/non-prod.jks + keyStorePassword: hmXYcznAljMSisdy8zgcag== + headers: + X-FromAppId: asdc + numOfRetries: 3 + +msoConfig: + httpRequestConfig: + serverRootUrl: http://127.0.0.1:8080/onap/mso/infra/modelDistributions/v1 + resourceNamespaces: + distributions: /distributions + + httpClientConfig: + timeouts: + readTimeoutMs: 2000 + connectTimeoutMs: 500 + basicAuthorization: + userName: asdc + password: OTLEp5lfVhYdyw5EAtTUBQ== + numOfRetries: 3 + +currentArtifactInstallationTimeout: 120 diff --git a/catalog-be/src/main/resources/config/error-configuration.yaml b/catalog-be/src/main/resources/config/error-configuration.yaml index 9dc0355212..56d0e74b73 100644 --- a/catalog-be/src/main/resources/config/error-configuration.yaml +++ b/catalog-be/src/main/resources/config/error-configuration.yaml @@ -8,6 +8,10 @@ errors: code: 201, message: "OK" } + ACCEPTED: { + code: 202, + message: "Accepted" + } NO_CONTENT: { code: 204, message: "No Content" @@ -411,7 +415,6 @@ errors: message: "Error: Invalid Content. Missing Capability Type '%1'.", messageId: "SVC4115" } -#-----------SVC4116--------------------------- RESOURCE_INSTANCE_BAD_REQUEST: { code: 400, message: "Error: Invalid Content.", @@ -595,7 +598,7 @@ errors: } #---------SVC4301------------------------------ RESTRICTED_OPERATION: { - code: 409, + code: 403, message: "Error: Restricted operation.", messageId: "SVC4301" } @@ -1187,6 +1190,7 @@ errors: message: "Error: Invalid occurrences format.", messageId: "SVC4585" } +#---------SVC4586------------------------------ #---------SVC4586------------------------------ INVALID_SERVICE_API_URL: { code: 400, @@ -1658,7 +1662,7 @@ errors: # %1 - "groupName" INVALID_VF_MODULE_NAME: { code: 400, - message: "Error: Invalid Content. VF Module name '%1' contains invalid characters", + message: "Error: Invalid Content. Group name '%1' contains invalid characters", messageId: "SVC4646" } @@ -1877,4 +1881,154 @@ errors: code: 404, message: "Error: Requested relation %1 was not found on the container %2.", messageId: "SVC4674" - } \ No newline at end of file + } + + +#---------SVC4675------------------------------ + INVALID_SERVICE_STATE: { + code: 409, + message: "Service state is invalid for this action", + messageId: "SVC4675" + } + +#---------SVC4676------------------------------ + INVALID_RESPONSE_FROM_PROXY: { + code: 502, + message: "Error: The server was acting as a gateway or proxy and received an invalid response from the upstream server", + messageId: "SVC4676" + } + +#---------SVC4677------------------------------ + API_RESOURCE_NOT_FOUND: { + code: 404, + message: "Error: Requested '%1' was not found.", + messageId: "SVC4677" + } + +#---------SVC4678------------------------------ + BAD_REQUEST_MISSING_RESOURCE: { + code: 400, + message: "Error: The required resource name/id is missing in the request", + messageId: "SVC4678" + } +#---------SVC4679------------------------------ +# %1 forwarding path name maximum length + FORWARDING_PATH_NAME_MAXIMUM_LENGTH: { + code: 400, + message: "Forwarding path name too long, , maximum allowed 200 characters : '%1'.", + messageId: "SVC4679" + } +#---------SVC4680------------------------------ +# %1 Forwarding path name already in use + FORWARDING_PATH_NAME_ALREADY_IN_USE: { + code: 400, + message: "Forwarding path name already in use : '%1'.", + messageId: "SVC4680" + } +#---------SVC4681------------------------------ +# %1 Forwarding path name empty + FORWARDING_PATH_NAME_EMPTY: { + code: 400, + message: "Forwarding Path Name can't be empty .", + messageId: "SVC4681" + } +#---------SVC4682------------------------------ +# %1 - resource uniqueId +# %2 - resource component type + RESOURCE_CANNOT_CONTAIN_POLICIES: { + code: 400, + message: "Error: The resource %1 type of %2 cannot contain policies.", + messageId: "SVC4682" + } +#---------SVC4683------------------------------ +# %1 - policy uniqueId +# %2 - component uniqueId + POLICY_NOT_FOUND_ON_CONTAINER: { + code: 404, + message: "Error: Requested policy %1 was not found on the container %2.", + messageId: "SVC4683" +} +#---------SVC4684------------------------------ +# %1 - policy name + INVALID_POLICY_NAME: { + code: 400, + message: "Error: Invalid policy name %1 received.", + messageId: "SVC4684" + } +#---------SVC4685------------------------------ +# %1 - policy name + POLICY_NAME_ALREADY_EXIST: { + code: 409, + message: "Error: The policy with the name %1 already exists.", + messageId: "SVC4685" + } +#---------SVC4686------------------------------ +# %1 - policy name + POLICY_TARGET_DOES_NOT_EXIST: { + code: 400, + message: "Error: The targets %1 are not valid, all targets have to be on the topologyTemplate.", + messageId: "SVC4686" + } +#---------SVC4687------------------------------ +# %1 - policy type +# %2 - component type + EXCLUDED_POLICY_TYPE: { + code: 400, + message: "Error: The policy of the type %1 excluded to add to a component of the type %2.", + messageId: "SVC4687" + } + #---------SVC4688------------------------------ +# %1 - group type +# %2 - component type + GROUP_TYPE_ILLEGAL_PER_COMPONENT: { + code: 400, + message: "Error: group type %1 not permitted in component of type %2", + messageId: "SVC4688" + } + #---------SVC4689------------------------------ +# %1 - group type +# %2 - component type + POLICY_TARGET_TYPE_DOES_NOT_EXIST: { + code: 400, + message: "Error: The target types %1 are not valid.", + messageId: "SVC4689" + } + +#---------SVC4690------------------------------ +# %1 forwarding path protocol maximum length + FORWARDING_PATH_PROTOCOL_MAXIMUM_LENGTH: { + code: 400, + message: "Forwarding path protocol too long, , maximum allowed 200 characters : '%1'.", + messageId: "SVC4690" + } + +#---------SVC4691------------------------------ +# %1 forwarding path destination port maximum length + FORWARDING_PATH_DESTINATION_PORT_MAXIMUM_LENGTH: { + code: 400, + message: "Forwarding path destination port too long, , maximum allowed 200 characters : '%1'.", + messageId: "SVC4691" + } + +#---------POL4692------------------------------ + MISSING_OLD_COMPONENT_INSTANCE: { + code: 400 , + message: "Error: Missing 'componentInstanceId' HTTP param.", + messageId: "POL4692" + } + +#---------POL4693------------------------------ + MISSING_NEW_COMPONENT_INSTANCE: { + code: 400 , + message: "Error: Missing 'newComponentInstanceId' HTTP param.", + messageId: "POL4693" + } + +#---------SVC4694------------------------------ +# %1 External Reference Value + EXT_REF_NOT_FOUND: { + code: 404, + message: "Error: External Reference '%1' was not found.", + messageId: "SVC4694" + } + diff --git a/catalog-be/src/main/resources/config/logback.xml b/catalog-be/src/main/resources/config/logback.xml index ba16783536..b436f20c31 100644 --- a/catalog-be/src/main/resources/config/logback.xml +++ b/catalog-be/src/main/resources/config/logback.xml @@ -11,6 +11,8 @@ + + @@ -18,13 +20,11 @@ - ${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/all.log - + ${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/all.log - ${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/all.log.%i - + ${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/all.log.%i 1 10 @@ -210,7 +210,7 @@ 20MB - ${default-log-pattern} + ${auditLoggerPattern} diff --git a/catalog-be/src/main/resources/import/tosca/capability-types/capabilityTypes.yml b/catalog-be/src/main/resources/import/tosca/capability-types/capabilityTypes.yml index 4e25d735d0..50f74f8853 100644 --- a/catalog-be/src/main/resources/import/tosca/capability-types/capabilityTypes.yml +++ b/catalog-be/src/main/resources/import/tosca/capability-types/capabilityTypes.yml @@ -122,6 +122,8 @@ tosca.capabilities.Scalable: type: integer tosca.capabilities.network.Bindable: derived_from: tosca.capabilities.Node + + tosca.capabilities.Container.Docker: derived_from: tosca.capabilities.Container properties: @@ -207,6 +209,16 @@ org.openecomp.capabilities.metric.SnmpTrap: description: Object Id of the metric required: true status: SUPPORTED +org.openecomp.capabilities.Forwarder: + derived_from: tosca.capabilities.Root +org.openecomp.capabilities.VLANAssignment: + derived_from: tosca.capabilities.Root + description: ability to expose routing information of the internal network + properties: + vfc_instance_group_reference: + type: string + description: Ability to recognize capability per vfc instance group on vnf instance + required: true #ONAP types tosca.capabilities.nfv.VirtualStorage: derived_from: tosca.capabilities.Root diff --git a/catalog-be/src/main/resources/import/tosca/capability-types/capabilityTypes.zip b/catalog-be/src/main/resources/import/tosca/capability-types/capabilityTypes.zip index 84871d6a07..6c443c9662 100644 Binary files a/catalog-be/src/main/resources/import/tosca/capability-types/capabilityTypes.zip and b/catalog-be/src/main/resources/import/tosca/capability-types/capabilityTypes.zip differ 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 449842c2f4..493f399453 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 @@ -1257,6 +1257,7 @@ org.openecomp.datatypes.flavors.DeploymentFlavor: license_flavor: type: org.openecomp.datatypes.flavors.LicenseFlavor required: false + org.openecomp.datatypes.ImageInfo: derived_from: tosca.datatypes.Root properties: @@ -1271,7 +1272,7 @@ org.openecomp.datatypes.ImageInfo: type: string required: false default: md5 -#onap +#ONAP types tosca.datatypes.nfv.VnfcConfigurableProperties: derived_from: tosca.datatypes.Root properties: 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 index 1f79bf2c2d..75f9f73a35 100644 Binary files a/catalog-be/src/main/resources/import/tosca/data-types/dataTypes.zip and b/catalog-be/src/main/resources/import/tosca/data-types/dataTypes.zip differ diff --git a/catalog-be/src/main/resources/import/tosca/group-types/groupTypes.yml b/catalog-be/src/main/resources/import/tosca/group-types/groupTypes.yml index ce457e4add..9711bfdebe 100644 --- a/catalog-be/src/main/resources/import/tosca/group-types/groupTypes.yml +++ b/catalog-be/src/main/resources/import/tosca/group-types/groupTypes.yml @@ -1,3 +1,8 @@ +tosca.groups.Root: + description: The TOSCA Group Type all other TOSCA Group Types derive from + interfaces: + Standard: + type: tosca.interfaces.node.lifecycle.Standard org.openecomp.groups.heat.HeatStack: derived_from: tosca.groups.Root description: Grouped all heat resources which are in the same heat stack @@ -77,9 +82,51 @@ org.openecomp.groups.VfModule: required: false description: > Identifies the set of VM types and their count included in the VF-Module -tosca.groups.Root: - description: The TOSCA Group Type all other TOSCA Group Types derive from - interfaces: - Standard: - type: tosca.interfaces.node.lifecycle.Standard - +org.openecomp.groups.NetworkCollection: + derived_from: tosca.groups.Root + description: groups l3-networks in network collection + properties: + network_collection_type: + type: string + required: true + description: network collection type, defined with default value + default: l3-network + network_collection_subtype: + type: string + required: true + description: network collection subtype, defined with default value + default: sub-interface + network_collection_role: + type: string + required: true + description: network collection role + network_collection_description: + type: string + required: true + description: network collection description, free format text +org.openecomp.groups.VfcInstanceGroup: + derived_from: tosca.groups.Root + description: groups VFCs with same parent port role + properties: + vfc_instance_group_role: + type: string + required: true + description: role of this VFC group + vfc_parent_port_role: + type: string + required: true + description: common role of parent ports of VFCs in this group + network_collection_role: + type: string + required: true + description: network collection role assigned to this group + subinterface_role: + type: string + required: true + description: common role of subinterfaces of VFCs in this group, criteria the group is created + capabilities: + vlan_assignment: + type: org.openecomp.capabilities.VLANAssignment + properties: + vfc_instance_group_reference: + type: string \ No newline at end of file diff --git a/catalog-be/src/main/resources/import/tosca/group-types/groupTypes.zip b/catalog-be/src/main/resources/import/tosca/group-types/groupTypes.zip index 7acd7a6b45..71a4af957a 100644 Binary files a/catalog-be/src/main/resources/import/tosca/group-types/groupTypes.zip and b/catalog-be/src/main/resources/import/tosca/group-types/groupTypes.zip differ diff --git a/catalog-be/src/main/resources/import/tosca/heat-types/Generic_CR/Generic_CR.json b/catalog-be/src/main/resources/import/tosca/heat-types/Generic_CR/Generic_CR.json new file mode 100644 index 0000000000..4245f4dab1 --- /dev/null +++ b/catalog-be/src/main/resources/import/tosca/heat-types/Generic_CR/Generic_CR.json @@ -0,0 +1,21 @@ +{ + "payloadName": "Generic_CR.yml", + "contactId": "jh0003", + "name": "Generic_CR", + "description": "Represents a generic CR.", + "resourceIconPath": "defaulticon", + "resourceType": "ABSTRACT", + "categories": [ + { + "name": "Generic", + "subcategories": [ + { + "name": "Abstract" + } + ] + } +], + "tags": [ + "Generic_CR" + ] +} \ No newline at end of file diff --git a/catalog-be/src/main/resources/import/tosca/heat-types/Generic_CR/Generic_CR.yml b/catalog-be/src/main/resources/import/tosca/heat-types/Generic_CR/Generic_CR.yml new file mode 100644 index 0000000000..941bc451da --- /dev/null +++ b/catalog-be/src/main/resources/import/tosca/heat-types/Generic_CR/Generic_CR.yml @@ -0,0 +1,15 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 +node_types: + org.openecomp.resource.abstract.nodes.CR: + derived_from: tosca.nodes.Root + properties: + nf_function: + type: string + nf_role: + type: string + nf_naming_code: + type: string + nf_type: + type: string + nf_naming: + type: org.openecomp.datatypes.Naming diff --git a/catalog-be/src/main/resources/import/tosca/heat-types/Generic_CR/Generic_CR.zip b/catalog-be/src/main/resources/import/tosca/heat-types/Generic_CR/Generic_CR.zip new file mode 100644 index 0000000000..5ea130c95e Binary files /dev/null and b/catalog-be/src/main/resources/import/tosca/heat-types/Generic_CR/Generic_CR.zip differ diff --git a/catalog-be/src/main/resources/import/tosca/heat-types/Generic_VF/Generic_VF.zip b/catalog-be/src/main/resources/import/tosca/heat-types/Generic_VF/Generic_VF.zip index 85adfbc2a1..d20e69e8d6 100644 Binary files a/catalog-be/src/main/resources/import/tosca/heat-types/Generic_VF/Generic_VF.zip and b/catalog-be/src/main/resources/import/tosca/heat-types/Generic_VF/Generic_VF.zip differ diff --git a/catalog-be/src/main/resources/import/tosca/heat-types/extVl/extVl.zip b/catalog-be/src/main/resources/import/tosca/heat-types/extVl/extVl.zip index f69e5b40fb..48ebb1f610 100644 Binary files a/catalog-be/src/main/resources/import/tosca/heat-types/extVl/extVl.zip and b/catalog-be/src/main/resources/import/tosca/heat-types/extVl/extVl.zip differ diff --git a/catalog-be/src/main/resources/import/tosca/heat-types/forwardingPath/forwardingPath.json b/catalog-be/src/main/resources/import/tosca/heat-types/forwardingPath/forwardingPath.json new file mode 100644 index 0000000000..5b426db133 --- /dev/null +++ b/catalog-be/src/main/resources/import/tosca/heat-types/forwardingPath/forwardingPath.json @@ -0,0 +1,21 @@ +{ + "payloadName": "forwardingPath.yml", + "contactId": "jh0003", + "name": "Forwarding Path", + "description": "Forwarding Path configuration object", + "resourceIconPath": "defaulticon", + "resourceType": "ABSTRACT", + "categories": [ + { + "name": "Generic", + "subcategories": [ + { + "name": "Abstract" + } + ] + } + ], + "tags": [ + "Forwarding Path" + ] +} \ No newline at end of file diff --git a/catalog-be/src/main/resources/import/tosca/heat-types/forwardingPath/forwardingPath.yml b/catalog-be/src/main/resources/import/tosca/heat-types/forwardingPath/forwardingPath.yml new file mode 100644 index 0000000000..fe1be7f1f2 --- /dev/null +++ b/catalog-be/src/main/resources/import/tosca/heat-types/forwardingPath/forwardingPath.yml @@ -0,0 +1,24 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 +node_types: + org.openecomp.nodes.ForwardingPath: + derived_from: tosca.nodes.Root + properties: + target_range: + type: list + required: true + status: SUPPORTED + entry_schema: + description: Identifier of the reciever port of the VNF or the service + type: integer + protocol: + type: string + description: protocol type that runs on the link + required: true + status: SUPPORTED + requirements: + - forwarder: + capability: org.openecomp.capabilities.Forwarder + relationship: org.openecomp.relationships.ForwardsTo + occurrences: + - 0 + - UNBOUNDED \ No newline at end of file diff --git a/catalog-be/src/main/resources/import/tosca/heat-types/forwardingPath/forwardingPath.zip b/catalog-be/src/main/resources/import/tosca/heat-types/forwardingPath/forwardingPath.zip new file mode 100644 index 0000000000..7135677bf1 Binary files /dev/null and b/catalog-be/src/main/resources/import/tosca/heat-types/forwardingPath/forwardingPath.zip differ diff --git a/catalog-be/src/main/resources/import/tosca/heat-types/globalPort/globalPort.yml b/catalog-be/src/main/resources/import/tosca/heat-types/globalPort/globalPort.yml index 89ee9f81f0..791a0b9a3b 100644 --- a/catalog-be/src/main/resources/import/tosca/heat-types/globalPort/globalPort.yml +++ b/catalog-be/src/main/resources/import/tosca/heat-types/globalPort/globalPort.yml @@ -73,6 +73,8 @@ node_types: occurrences: - 1 - UNBOUNDED + forwarder: + type: org.openecomp.capabilities.Forwarder network.outgoing.bytes: type: org.openecomp.capabilities.metric.Ceilometer description: A node type that includes the Metric capability indicates that it can be monitored using ceilometer. diff --git a/catalog-be/src/main/resources/import/tosca/heat-types/globalPort/globalPort.zip b/catalog-be/src/main/resources/import/tosca/heat-types/globalPort/globalPort.zip index 8a23aa77c2..efeafe824e 100644 Binary files a/catalog-be/src/main/resources/import/tosca/heat-types/globalPort/globalPort.zip and b/catalog-be/src/main/resources/import/tosca/heat-types/globalPort/globalPort.zip differ diff --git a/catalog-be/src/main/resources/import/tosca/policy-types/policyTypes.yml b/catalog-be/src/main/resources/import/tosca/policy-types/policyTypes.yml index ceb22da2af..57f4b45abe 100644 --- a/catalog-be/src/main/resources/import/tosca/policy-types/policyTypes.yml +++ b/catalog-be/src/main/resources/import/tosca/policy-types/policyTypes.yml @@ -13,7 +13,7 @@ tosca.policies.Performance: derived_from: tosca.policies.Root description: The TOSCA Policy Type definition that is used to declare performance requirements for TOSCA nodes or groups of nodes. org.openecomp.policies.placement.Antilocate: - derived_from: tosca.policy.placement + derived_from: tosca.policies.Placement description: My placement policy for separation based upon container type value properties: name: @@ -32,7 +32,7 @@ org.openecomp.policies.placement.Antilocate: - region - compute org.openecomp.policies.placement.Colocate: - derived_from: tosca.policy.placement + derived_from: tosca.policies.Placement description: Keep associated nodes (groups of nodes) based upon affinity value properties: name: @@ -51,7 +51,7 @@ org.openecomp.policies.placement.Colocate: - region - compute org.openecomp.policies.placement.valet.Diversity: - derived_from: tosca.policy.placement + derived_from: tosca.policies.Placement description: Valet Diversity properties: level: @@ -65,7 +65,7 @@ org.openecomp.policies.placement.valet.Diversity: - host - rack org.openecomp.policies.placement.valet.Exclusivity: - derived_from: tosca.policy.placement + derived_from: tosca.policies.Placement description: Valet Exclusivity properties: level: @@ -79,7 +79,7 @@ org.openecomp.policies.placement.valet.Exclusivity: - host - rack org.openecomp.policies.placement.valet.Affinity: - derived_from: tosca.policy.placement + derived_from: tosca.policies.Placement description: Valet Affinity properties: level: @@ -91,4 +91,27 @@ org.openecomp.policies.placement.valet.Affinity: constraints: - valid_values: - host - - rack \ No newline at end of file + - rack +org.openecomp.policies.scaling.Fixed: + derived_from: tosca.policies.Scaling + properties: + quantity: + description: the exact number of instances to keep up + type: integer + required: true +org.openecomp.policies.External: + derived_from: tosca.policies.Root + description: externally managed policy (for example, type="network assignment", source="Policy Manager", name="route target") + properties: + source: + type: string + description: The name of the server that exposes the policy with predefined type and name. + required: false + type: + type: string + description: The type (category) of the policy same as it is defined in the source. + required: false + name: + type: string + description: The name of the policy, that related to specific type, same as it is defined in the source. + required: false diff --git a/catalog-be/src/main/resources/import/tosca/policy-types/policyTypes.zip b/catalog-be/src/main/resources/import/tosca/policy-types/policyTypes.zip index 5ed696e4a9..fbc09f2e0c 100644 Binary files a/catalog-be/src/main/resources/import/tosca/policy-types/policyTypes.zip and b/catalog-be/src/main/resources/import/tosca/policy-types/policyTypes.zip differ 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 5fb5390721..36325ba8e6 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 @@ -108,4 +108,7 @@ 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 + required: false + org.openecomp.relationships.ForwardsTo: + derived_from: tosca.relationships.Root + valid_target_types: [org.openecomp.capabilities.Forwarder] \ 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 index dbb1ca02f2..d8eb62d4d3 100644 Binary files a/catalog-be/src/main/resources/import/tosca/relationship-types/relationshipTypes.zip and b/catalog-be/src/main/resources/import/tosca/relationship-types/relationshipTypes.zip differ diff --git a/catalog-be/src/main/resources/scripts/import/tosca/importCategoryTypes.py b/catalog-be/src/main/resources/scripts/import/tosca/importCategoryTypes.py index aca21754e8..2f3237173c 100644 --- a/catalog-be/src/main/resources/scripts/import/tosca/importCategoryTypes.py +++ b/catalog-be/src/main/resources/scripts/import/tosca/importCategoryTypes.py @@ -6,24 +6,24 @@ import copy from importNormativeElements import createNormativeElement from importCommon import * -################################################################################################################################################ -# # -# Import all users from a given file # -# # -# activation : # -# python importUsers.py [-i | --ip=] [-p | --port= ] [-f | --ifile= ] # -# # -# shortest activation (be host = localhost, be port = 8080): # # -# python importUsers.py [-f | --ifile= ] # -# # -################################################################################################################################################ +######################################################################################################################################################################################### +# # +# Import categoriy types # +# # +# activation : # +# python importCategoryTypes.py [-s | --scheme= ] [-i | --ip=] [-p | --port= ] [-f | --ifile= ] # +# # +# shortest activation (be host = localhost, be port = 8080): # +# python importCategoryTypes.py [-f | --ifile= ] # +# # +######################################################################################################################################################################################### def usage(): - print sys.argv[0], '[-i | --ip=] [-p | --port= ] [-u | --user= ]' + print sys.argv[0], '[optional -s | --scheme=, default http] [-i | --ip=] [-p | --port= ] [-u | --user= ]' -def importCategories(beHost, bePort, adminUser, exitOnSuccess, fileDir): - result = createNormativeElement(beHost, bePort, adminUser, fileDir, "/sdc2/rest/v1/catalog/uploadType/categories", "categoryTypes", "categoriesZip") +def importCategories(scheme, beHost, bePort, adminUser, exitOnSuccess, fileDir): + result = createNormativeElement(scheme, beHost, bePort, adminUser, fileDir, "/sdc2/rest/v1/catalog/uploadType/categories", "categoryTypes", "categoriesZip") printFrameLine() printNameAndReturnCode(result[0], result[1]) @@ -41,9 +41,10 @@ def main(argv): beHost = 'localhost' bePort = '8080' adminUser = 'jh0003' + scheme = 'http' try: - opts, args = getopt.getopt(argv,"i:p:u:h:",["ip=","port=","user="]) + opts, args = getopt.getopt(argv,"i:p:u:h:s:",["ip=","port=","user=","scheme="]) except getopt.GetoptError: usage() errorAndExit(2, 'Invalid input') @@ -59,14 +60,16 @@ def main(argv): bePort = arg elif opt in ("-u", "--user"): adminUser = arg + elif opt in ("-s", "--scheme"): + scheme = arg - print 'be host =',beHost,', be port =', bePort,', user =', adminUser + print 'scheme =',scheme,', be host =',beHost,', be port =', bePort,', user =', adminUser if ( beHost == None ): usage() sys.exit(3) - importCategories(beHost, bePort, adminUser, True, "../../../import/tosca/categories/") + importCategories(scheme, beHost, bePort, adminUser, True, "../../../import/tosca/categories/") if __name__ == "__main__": diff --git a/catalog-be/src/main/resources/scripts/import/tosca/importDataTypes.py b/catalog-be/src/main/resources/scripts/import/tosca/importDataTypes.py index 5d7f5b7576..ef51a907d5 100644 --- a/catalog-be/src/main/resources/scripts/import/tosca/importDataTypes.py +++ b/catalog-be/src/main/resources/scripts/import/tosca/importDataTypes.py @@ -6,24 +6,24 @@ import copy from importNormativeElements import createNormativeElement from importCommon import * -################################################################################################################################################ -# # -# Import tosca data types # -# # -# activation : # -# python importDataTypes.py [-i | --ip=] [-p | --port= ] [-f | --ifile= ] # -# # -# shortest activation (be host = localhost, be port = 8080): # # -# python importDataTypes.py [-f | --ifile= ] # -# # -################################################################################################################################################ +##################################################################################################################################################################################### +# # +# Import tosca data types # +# # +# activation : # +# python importDataTypes.py [-s | --scheme= ] [-i | --ip=] [-p | --port= ] [-f | --ifile= ] # +# # +# shortest activation (be host = localhost, be port = 8080): # +# python importDataTypes.py [-f | --ifile= ] # +# # +##################################################################################################################################################################################### def usage(): - print sys.argv[0], '[-i | --ip=] [-p | --port= ] [-u | --user= ]' + print sys.argv[0], '[optional -s | --scheme=, default http ] [-i | --ip=] [-p | --port= ] [-u | --user= ]' -def importDataTypes(beHost, bePort, adminUser, exitOnSuccess, fileDir): - result = createNormativeElement(beHost, bePort, adminUser, fileDir, "/sdc2/rest/v1/catalog/uploadType/datatypes", "dataTypes", "dataTypesZip") +def importDataTypes(scheme, beHost, bePort, adminUser, exitOnSuccess, fileDir): + result = createNormativeElement(scheme, beHost, bePort, adminUser, fileDir, "/sdc2/rest/v1/catalog/uploadType/datatypes", "dataTypes", "dataTypesZip") printFrameLine() printNameAndReturnCode(result[0], result[1]) @@ -41,9 +41,10 @@ def main(argv): beHost = 'localhost' bePort = '8080' adminUser = 'jh0003' + scheme = 'http' try: - opts, args = getopt.getopt(argv,"i:p:u:h:",["ip=","port=","user="]) + opts, args = getopt.getopt(argv,"i:p:u:h:s:",["ip=","port=","user=","scheme="]) except getopt.GetoptError: usage() errorAndExit(2, 'Invalid input') @@ -59,14 +60,16 @@ def main(argv): bePort = arg elif opt in ("-u", "--user"): adminUser = arg + elif opt in ("-s", "--scheme"): + scheme = arg - print 'be host =',beHost,', be port =', bePort,', user =', adminUser + print 'scheme =',scheme,', be host =',beHost,', be port =', bePort,', user =', adminUser if ( beHost == None ): usage() sys.exit(3) - importDataTypes(beHost, bePort, adminUser, True, "../../../import/tosca/data-types/") + importDataTypes(scheme, beHost, bePort, adminUser, True, "../../../import/tosca/data-types/") if __name__ == "__main__": diff --git a/catalog-be/src/main/resources/scripts/import/tosca/importGroupTypes.py b/catalog-be/src/main/resources/scripts/import/tosca/importGroupTypes.py index 2b6a5db6f8..9daa990fc5 100644 --- a/catalog-be/src/main/resources/scripts/import/tosca/importGroupTypes.py +++ b/catalog-be/src/main/resources/scripts/import/tosca/importGroupTypes.py @@ -6,24 +6,24 @@ import copy from importNormativeElements import createNormativeElement from importCommon import * -################################################################################################################################################ -# # -# Import tosca data types # -# # -# activation : # -# python importGroupTypes.py [-i | --ip=] [-p | --port= ] [-f | --ifile= ] # -# # -# shortest activation (be host = localhost, be port = 8080): # # -# python importGroupTypes.py [-f | --ifile= ] # -# # -################################################################################################################################################ +##################################################################################################################################################################################### +# # +# Import tosca data types # +# # +# activation : # +# python importGroupTypes.py [-s | --scheme= ] [-i | --ip=] [-p | --port= ] [-f | --ifile= ] # +# # +# shortest activation (be host = localhost, be port = 8080): # +# python importGroupTypes.py [-f | --ifile= ] # +# # +##################################################################################################################################################################################### def usage(): - print sys.argv[0], '[-i | --ip=] [-p | --port= ] [-u | --user= ]' + print sys.argv[0], '[optional -s | --scheme=, default http ] [-i | --ip=] [-p | --port= ] [-u | --user= ]' -def importGroupTypes(beHost, bePort, adminUser, exitOnSuccess, fileDir): - result = createNormativeElement(beHost, bePort, adminUser, fileDir, "/sdc2/rest/v1/catalog/uploadType/grouptypes", "groupTypes", "groupTypesZip") +def importGroupTypes(scheme, beHost, bePort, adminUser, exitOnSuccess, fileDir): + result = createNormativeElement(scheme, beHost, bePort, adminUser, fileDir, "/sdc2/rest/v1/catalog/uploadType/grouptypes", "groupTypes", "groupTypesZip") printFrameLine() printNameAndReturnCode(result[0], result[1]) @@ -41,9 +41,10 @@ def main(argv): beHost = 'localhost' bePort = '8080' adminUser = 'jh0003' + scheme = 'http' try: - opts, args = getopt.getopt(argv,"i:p:u:h:",["ip=","port=","user="]) + opts, args = getopt.getopt(argv,"i:p:u:h:s:",["ip=","port=","user=","scheme="]) except getopt.GetoptError: usage() errorAndExit(2, 'Invalid input') @@ -59,14 +60,16 @@ def main(argv): bePort = arg elif opt in ("-u", "--user"): adminUser = arg + elif opt in ("-s", "--scheme"): + scheme = arg - print 'be host =',beHost,', be port =', bePort,', user =', adminUser + print 'scheme =',scheme,', be host =',beHost,', be port =', bePort,', user =', adminUser if ( beHost == None ): usage() sys.exit(3) - importGroupTypes(beHost, bePort, adminUser, True, "../../../import/tosca/group-types/") + importGroupTypes(scheme, beHost, bePort, adminUser, True, "../../../import/tosca/group-types/") if __name__ == "__main__": diff --git a/catalog-be/src/main/resources/scripts/import/tosca/importHeatTypes.py b/catalog-be/src/main/resources/scripts/import/tosca/importHeatTypes.py index 8b16a72ab3..4490fec61a 100644 --- a/catalog-be/src/main/resources/scripts/import/tosca/importHeatTypes.py +++ b/catalog-be/src/main/resources/scripts/import/tosca/importHeatTypes.py @@ -7,19 +7,19 @@ from importCommon import * from importNormativeTypes import * import importCommon -################################################################################################################################################ -# # -# Import all users from a given file # -# # -# activation : # -# python importUsers.py [-i | --ip=] [-p | --port= ] [-f | --ifile= ] # -# # -# shortest activation (be host = localhost, be port = 8080): # -# python importUsers.py [-f | --ifile= ] # -# # -################################################################################################################################################ +##################################################################################################################################################################################### +# # +# Import heat types # +# # +# activation : # +# python importHeatTypes.py [-s | --scheme= ] [-i | --ip=] [-p | --port= ] [-f | --ifile= ] # +# # +# shortest activation (be host = localhost, be port = 8080): # +# python importHeatTypes.py [-f | --ifile= ] # +# # +##################################################################################################################################################################################### -def importHeatTypes(beHost, bePort, adminUser, fileDir, updateversion): +def importHeatTypes(scheme, beHost, bePort, adminUser, fileDir, updateversion): heatTypes = [ "globalNetwork", "globalPort", @@ -38,6 +38,7 @@ def importHeatTypes(beHost, bePort, adminUser, fileDir, updateversion): "abstractSubstitute", "Generic_VFC", "Generic_VF", + "Generic_CR", "Generic_PNF", "Generic_Service", "contrailNetworkRules", @@ -57,7 +58,8 @@ def importHeatTypes(beHost, bePort, adminUser, fileDir, updateversion): "extCp2", "extNeutronCP", "extContrailCP", - "portMirroringByPolicy" + "portMirroringByPolicy", + "forwardingPath" ] responseCodes = [200, 201] @@ -67,7 +69,7 @@ def importHeatTypes(beHost, bePort, adminUser, fileDir, updateversion): results = [] for heatType in heatTypes: - result = createNormativeType(beHost, bePort, adminUser, fileDir, heatType, updateversion) + result = createNormativeType(scheme, beHost, bePort, adminUser, fileDir, heatType, updateversion) results.append(result) if ( result[1] == None or result[1] not in responseCodes) : print "Failed creating heat type " + heatType + ". " + str(result[1]) @@ -81,9 +83,10 @@ def main(argv): bePort = '8080' adminUser = 'jh0003' updateversion = 'true' + scheme = 'http' try: - opts, args = getopt.getopt(argv,"i:p:u:v:h:",["ip=","port=","user=","updateversion="]) + opts, args = getopt.getopt(argv,"i:p:u:v:h:s:",["ip=","port=","user=","updateversion=","scheme="]) except getopt.GetoptError: usage() errorAndExit(2, 'Invalid input') @@ -99,17 +102,19 @@ def main(argv): 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 'be host =',beHost,', be port =', bePort,', user =', adminUser + print 'scheme =',scheme,', be host =',beHost,', be port =', bePort,', user =', adminUser if ( beHost == None ): usage() sys.exit(3) - results = importHeatTypes(beHost, bePort, adminUser, "../../../import/tosca/heat-types/", updateversion) + results = importHeatTypes(scheme, beHost, bePort, adminUser, "../../../import/tosca/heat-types/", updateversion) print "-----------------------------" for result in results: diff --git a/catalog-be/src/main/resources/scripts/import/tosca/importNodeType.py b/catalog-be/src/main/resources/scripts/import/tosca/importNodeType.py index f35cc7bcee..7d0b7c526a 100644 --- a/catalog-be/src/main/resources/scripts/import/tosca/importNodeType.py +++ b/catalog-be/src/main/resources/scripts/import/tosca/importNodeType.py @@ -16,7 +16,7 @@ def createZipFromYml(ymlFile, zipFile): zip.write(ymlFile, os.path.basename(ymlFile)) zip.close() -def createUserNormativeType(beHost, bePort, adminUser, fileDir, ELEMENT_NAME): +def createUserNormativeType(scheme, beHost, bePort, adminUser, fileDir, ELEMENT_NAME): try: log("in create normative type ", ELEMENT_NAME) @@ -26,7 +26,7 @@ def createUserNormativeType(beHost, bePort, adminUser, fileDir, ELEMENT_NAME): buffer = StringIO() c = pycurl.Curl() - url = 'http://' + beHost + ':' + bePort + '/sdc2/rest/v1/catalog/upload/multipart' + url = scheme + '://' + beHost + ':' + bePort + '/sdc2/rest/v1/catalog/upload/multipart' c.setopt(c.URL, url) c.setopt(c.POST, 1) @@ -55,6 +55,9 @@ def createUserNormativeType(beHost, bePort, adminUser, fileDir, ELEMENT_NAME): c.setopt(pycurl.HTTPPOST, send) c.setopt(c.WRITEFUNCTION, buffer.write) + if scheme == 'https': + c.setopt(c.SSL_VERIFYPEER, 0) + res = c.perform() #print("Before get response code") @@ -73,7 +76,7 @@ def createUserNormativeType(beHost, bePort, adminUser, fileDir, ELEMENT_NAME): def usage(): - print sys.argv[0], '[-i | --ip=] [-p | --port= ] [-u | --user= ] [-l | --location=] [-e | --element=]' + print sys.argv[0], '[optional -s | --scheme=, default http] [-i | --ip=] [-p | --port= ] [-u | --user= ] [-l | --location=] [-e | --element=]' print "----------------- Example -------------------" print "python importNodeType.py -d false -l /home/vagrant/catalog-be-1604.0.2.15.6-SNAPSHOT/scripts/import/tosca/../../../import/tosca/user-normative-types/ -e root1" @@ -86,9 +89,10 @@ def main(argv): debugf = None location = None element = None + scheme = 'http' try: - opts, args = getopt.getopt(argv,"i:p:u:d:l:e:h",["ip=","port=","user=","location=","element=", "debug="]) + opts, args = getopt.getopt(argv,"i:p:u:d:l:e:h:s:",["ip=","port=","user=","location=","element=", "debug=","scheme="]) except getopt.GetoptError: usage() errorAndExit(2, 'Invalid input') @@ -108,11 +112,13 @@ def main(argv): location = arg elif opt in ("-e", "--element"): element = arg + elif opt in ("-s", "--scheme"): + scheme = arg elif opt in ("-d", "--debug"): print arg debugf = bool(arg.lower() == "true" or arg.lower() == "yes") - print 'be host =',beHost,', be port =', bePort,', user =', adminUser + print 'scheme =',scheme,', be host =',beHost,', be port =', bePort,', user =', adminUser if ( beHost == None ): usage() @@ -139,7 +145,7 @@ def main(argv): #normativeType = "root1" - result = createUserNormativeType(beHost, bePort, adminUser, location, element) + result = createUserNormativeType(scheme, beHost, bePort, adminUser, location, element) #result = createUserNormativeType(beHost, bePort, adminUser, fileDir, normativeType) print "---------------------------------------" print "{0:30} | {1:6}".format(result[0], result[1]) 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 b6e390992e..d57c3d6ce4 100644 --- a/catalog-be/src/main/resources/scripts/import/tosca/importNormativeAll.py +++ b/catalog-be/src/main/resources/scripts/import/tosca/importNormativeAll.py @@ -18,21 +18,21 @@ from importPolicyTypes import importPolicyTypes from importCommon import * import importCommon -################################################################################################################################################################################################# -# # -# Import all users from a given file # -# # -# activation : # -# python importNormativeAll.py [-i | --ip=] [-p | --port= ] [-u | --user= ] [-d | --debug=] # -# [-v | --updateversion=] # -# # -# shortest activation (be host = localhost, be port = 8080, user = jh0003): # # # -# python importNormativeAll.py # -# # -################################################################################################################################################################################################# +################################################################################################################################################################################################################################# +# # +# Import all users from a given file # +# # +# activation : # +# python importNormativeAll.py [-s | --scheme= ] [-i | --ip=] [-p | --port= ] [-u | --user= ] [-d | --debug=] # +# [-v | --updateversion=] # +# # +# shortest activation (be host = localhost, be port = 8080, user = jh0003): # +# python importNormativeAll.py # +# # +################################################################################################################################################################################################################################# def usage(): - print sys.argv[0], '[-i | --ip=] [-p | --port= ] [-u | --user= ] [-d | --debug=] [-v | --updateversion=]' + print sys.argv[0], '[optional -s | --scheme=, default http] [-i | --ip=] [-p | --port= ] [-u | --user= ] [-d | --debug=] [-v | --updateversion=]' def handleResults(results, updateversion): printFrameLine() @@ -57,10 +57,11 @@ def main(argv): adminUser = 'jh0003' debugf = None updateversion = 'true' - importCommon.debugFlag = False + importCommon.debugFlag = False + scheme = 'http' try: - opts, args = getopt.getopt(argv,"i:p:u:d:v:h",["ip=","port=","user=","debug=","updateversion="]) + opts, args = getopt.getopt(argv,"i:p:u:d:v:h:s:",["ip=","port=","user=","debug=","updateversion=","scheme="]) except getopt.GetoptError: usage() errorAndExit(2, 'Invalid input') @@ -76,6 +77,8 @@ def main(argv): bePort = arg elif opt in ("-u", "--user"): adminUser = arg + elif opt in ("-s", "--scheme"): + scheme = arg elif opt in ("-d", "--debug"): print arg debugf = bool(arg.lower() == "true" or arg.lower() == "yes") @@ -84,7 +87,7 @@ def main(argv): if (arg.lower() == "false" or arg.lower() == "no"): updateversion = 'false' - print 'be host =',beHost,', be port =', bePort,', user =', adminUser, ', debug =', debugf, ', updateversion =', updateversion + print 'scheme =',scheme,', be host =',beHost,', be port =', bePort,', user =', adminUser, ', debug =', debugf, ', updateversion =', updateversion if (debugf != None): print 'set debug mode to ' + str(debugf) @@ -101,33 +104,33 @@ def main(argv): baseFileLocation = pathdir + "/../../../import/tosca/" fileLocation = baseFileLocation + "data-types/" - importDataTypes(beHost, bePort, adminUser, False, fileLocation) + importDataTypes(scheme, beHost, bePort, adminUser, False, fileLocation) print 'sleep until data type cache is updated' time.sleep( 70 ) fileLocation = baseFileLocation + "capability-types/" - importNormativeCapabilities(beHost, bePort, adminUser, False, fileLocation) + importNormativeCapabilities(scheme, beHost, bePort, adminUser, False, fileLocation) fileLocation = baseFileLocation + "interface-lifecycle-types/" - importNormativeInterfaceLifecycleType(beHost, bePort, adminUser, False, fileLocation) + importNormativeInterfaceLifecycleType(scheme, beHost, bePort, adminUser, False, fileLocation) fileLocation = baseFileLocation + "categories/" - importCategories(beHost, bePort, adminUser, False, fileLocation) + importCategories(scheme, beHost, bePort, adminUser, False, fileLocation) fileLocation = baseFileLocation + "normative-types/" - results = importNormativeTypes(beHost, bePort, adminUser, fileLocation, updateversion) + results = importNormativeTypes(scheme, beHost, bePort, adminUser, fileLocation, updateversion) handleResults(results, updateversion) fileLocation = baseFileLocation + "heat-types/" - resultsHeat = importHeatTypes(beHost, bePort, adminUser, fileLocation, updateversion) + resultsHeat = importHeatTypes(scheme, beHost, bePort, adminUser, fileLocation, updateversion) handleResults(resultsHeat, updateversion) fileLocation = baseFileLocation + "group-types/" - importGroupTypes(beHost, bePort, adminUser, False, fileLocation) + importGroupTypes(scheme, beHost, bePort, adminUser, False, fileLocation) fileLocation = baseFileLocation + "policy-types/" - importPolicyTypes(beHost, bePort, adminUser, False, fileLocation) + importPolicyTypes(scheme, beHost, bePort, adminUser, False, fileLocation) errorAndExit(0, None) diff --git a/catalog-be/src/main/resources/scripts/import/tosca/importNormativeCapabilities.py b/catalog-be/src/main/resources/scripts/import/tosca/importNormativeCapabilities.py index bda02ddda9..e4f92139c2 100644 --- a/catalog-be/src/main/resources/scripts/import/tosca/importNormativeCapabilities.py +++ b/catalog-be/src/main/resources/scripts/import/tosca/importNormativeCapabilities.py @@ -7,25 +7,25 @@ from importNormativeElements import createNormativeElement from importCommon import * import importCommon -################################################################################################################################################ -# # -# Import all users from a given file # -# # -# activation : # -# python importUsers.py [-i | --ip=] [-p | --port= ] [-f | --ifile= ] # -# # -# shortest activation (be host = localhost, be port = 8080): # # -# python importUsers.py [-f | --ifile= ] # -# # -################################################################################################################################################ +################################################################################################################################################################################################# +# # +# Import normative capabilities # +# # +# activation : # +# python importNormativeCapabilities.py [-s | --scheme= ] [-i | --ip=] [-p | --port= ] [-f | --ifile= ] # +# # +# shortest activation (be host = localhost, be port = 8080): # +# python importNormativeCapabilities.py [-f | --ifile= ] # +# # +################################################################################################################################################################################################# def usage(): - print sys.argv[0], '[-i | --ip=] [-p | --port= ] [-u | --user= ]' + print sys.argv[0], '[optional -s | --scheme=, default http] [-i | --ip=] [-p | --port= ] [-u | --user= ]' -def importNormativeCapabilities(beHost, bePort, adminUser, exitOnSuccess, fileDir): - result = createNormativeElement(beHost, bePort, adminUser, fileDir, "/sdc2/rest/v1/catalog/uploadType/capability", "capabilityTypes", "capabilityTypeZip") +def importNormativeCapabilities(scheme, beHost, bePort, adminUser, exitOnSuccess, fileDir): + result = createNormativeElement(scheme, beHost, bePort, adminUser, fileDir, "/sdc2/rest/v1/catalog/uploadType/capability", "capabilityTypes", "capabilityTypeZip") printFrameLine() printNameAndReturnCode(result[0], result[1]) @@ -44,9 +44,10 @@ def main(argv): beHost = 'localhost' bePort = '8080' adminUser = 'jh0003' + scheme = 'http' try: - opts, args = getopt.getopt(argv,"i:p:u:h:",["ip=","port=","user="]) + opts, args = getopt.getopt(argv,"i:p:u:h:s:",["ip=","port=","user=","scheme="]) except getopt.GetoptError: usage() importCommon.errorAndExit(2, 'Invalid input') @@ -62,14 +63,16 @@ def main(argv): bePort = arg elif opt in ("-u", "--user"): adminUser = arg + elif opt in ("-s", "--scheme"): + scheme = arg - print 'be host =',beHost,', be port =', bePort,', user =', adminUser + print 'scheme =',scheme,', be host =',beHost,', be port =', bePort,', user =', adminUser if ( beHost == None ): usage() sys.exit(3) - importNormativeCapabilities(beHost, bePort, adminUser, True, "../../../import/tosca/capability-types/") + importNormativeCapabilities(scheme, beHost, bePort, adminUser, True, "../../../import/tosca/capability-types/") if __name__ == "__main__": diff --git a/catalog-be/src/main/resources/scripts/import/tosca/importNormativeElements.py b/catalog-be/src/main/resources/scripts/import/tosca/importNormativeElements.py index af643da4f4..c28bbfb143 100644 --- a/catalog-be/src/main/resources/scripts/import/tosca/importNormativeElements.py +++ b/catalog-be/src/main/resources/scripts/import/tosca/importNormativeElements.py @@ -4,19 +4,19 @@ from StringIO import StringIO import json import copy from importCommon import * -################################################################################################################################################ -# # -# Import all users from a given file # -# # -# activation : # -# python importUsers.py [-i | --ip=] [-p | --port= ] [-f | --ifile= ] # -# # -# shortest activation (be host = localhost, be port = 8080): # # -# python importUsers.py [-f | --ifile= ] # -# # -################################################################################################################################################ +################################################################################################################################################################################# +# # +# Import all users from a given file # +# # +# activation : # +# python importUsers.py [-s | --scheme= ] [-i | --ip=] [-p | --port= ] [-f | --ifile= ] # +# # +# shortest activation (be host = localhost, be port = 8080): # +# python importUsers.py [-f | --ifile= ] # +# # +################################################################################################################################################################################# -def createNormativeElement(beHost, bePort, adminUser, fileDir, urlSuffix, ELEMENT_NAME, elementFormName): +def createNormativeElement(scheme, beHost, bePort, adminUser, fileDir, urlSuffix, ELEMENT_NAME, elementFormName): try: log("in create normative element ", ELEMENT_NAME) @@ -24,7 +24,7 @@ def createNormativeElement(beHost, bePort, adminUser, fileDir, urlSuffix, ELEMEN buffer = StringIO() c = pycurl.Curl() - url = 'http://' + beHost + ':' + bePort + urlSuffix + url = scheme + '://' + beHost + ':' + bePort + urlSuffix c.setopt(c.URL, url) c.setopt(c.POST, 1) @@ -45,6 +45,10 @@ def createNormativeElement(beHost, bePort, adminUser, fileDir, urlSuffix, ELEMEN #c.setopt(c.WRITEFUNCTION, lambda x: None) c.setopt(c.WRITEFUNCTION, buffer.write) + + if scheme == 'https': + c.setopt(c.SSL_VERIFYPEER, 0) + #print("before perform") res = c.perform() diff --git a/catalog-be/src/main/resources/scripts/import/tosca/importNormativeInterfaceLifecycleTypes.py b/catalog-be/src/main/resources/scripts/import/tosca/importNormativeInterfaceLifecycleTypes.py index 33f1cc42de..a6ab5741e4 100644 --- a/catalog-be/src/main/resources/scripts/import/tosca/importNormativeInterfaceLifecycleTypes.py +++ b/catalog-be/src/main/resources/scripts/import/tosca/importNormativeInterfaceLifecycleTypes.py @@ -6,24 +6,24 @@ import copy from importNormativeElements import createNormativeElement from importCommon import * -################################################################################################################################################ -# # -# Import all users from a given file # -# # -# activation : # -# python importUsers.py [-i | --ip=] [-p | --port= ] [-f | --ifile= ] # -# # -# shortest activation (be host = localhost, be port = 8080): # # -# python importUsers.py [-f | --ifile= ] # -# # -################################################################################################################################################ +############################################################################################################################################################################################################# +# # +# Import all users from a given file # +# # +# activation : # +# python importNormativeInterfaceLifecycleTypes.py [-s | --scheme= ] [-i | --ip=] [-p | --port= ] [-f | --ifile= ] # +# # +# shortest activation (be host = localhost, be port = 8080): # +# python importNormativeInterfaceLifecycleTypes.py [-f | --ifile= ] # +# # +############################################################################################################################################################################################################# def usage(): - print sys.argv[0], '[-i | --ip=] [-p | --port= ] [-u | --user= ]' + print sys.argv[0], '[optional -s | --scheme=, default http] [-i | --ip=] [-p | --port= ] [-u | --user= ]' -def importNormativeInterfaceLifecycleType(beHost, bePort, adminUser, exitOnSuccess, fileDir): - result = createNormativeElement(beHost, bePort, adminUser, fileDir, "/sdc2/rest/v1/catalog/uploadType/interfaceLifecycle", "interfaceLifecycleTypes", "interfaceLifecycleTypeZip") +def importNormativeInterfaceLifecycleType(scheme, beHost, bePort, adminUser, exitOnSuccess, fileDir): + result = createNormativeElement(scheme, beHost, bePort, adminUser, fileDir, "/sdc2/rest/v1/catalog/uploadType/interfaceLifecycle", "interfaceLifecycleTypes", "interfaceLifecycleTypeZip") printFrameLine() printNameAndReturnCode(result[0], result[1]) @@ -42,9 +42,10 @@ def main(argv): beHost = 'localhost' bePort = '8080' adminUser = 'jh0003' + scheme = 'http' try: - opts, args = getopt.getopt(argv,"i:p:u:h:",["ip=","port=","user="]) + opts, args = getopt.getopt(argv,"i:p:u:h:s:",["ip=","port=","user=","scheme="]) except getopt.GetoptError: usage() errorAndExit(2, 'Invalid input') @@ -60,14 +61,16 @@ def main(argv): bePort = arg elif opt in ("-u", "--user"): adminUser = arg + elif opt in ("-s", "--scheme"): + scheme = arg - print 'be host =',beHost,', be port =', bePort,', user =', adminUser + print 'scheme =',scheme,', be host =',beHost,', be port =', bePort,', user =', adminUser if ( beHost == None ): usage() sys.exit(3) - importNormativeInterfaceLifecycleType(beHost, bePort, adminUser, True, "../../../import/tosca/interface-lifecycle-types//") + importNormativeInterfaceLifecycleType(scheme, beHost, bePort, adminUser, True, "../../../import/tosca/interface-lifecycle-types//") if __name__ == "__main__": diff --git a/catalog-be/src/main/resources/scripts/import/tosca/importNormativeNoHeatAndNormativeTypes.py b/catalog-be/src/main/resources/scripts/import/tosca/importNormativeNoHeatAndNormativeTypes.py index 64a639c3c8..1061df862c 100644 --- a/catalog-be/src/main/resources/scripts/import/tosca/importNormativeNoHeatAndNormativeTypes.py +++ b/catalog-be/src/main/resources/scripts/import/tosca/importNormativeNoHeatAndNormativeTypes.py @@ -17,21 +17,21 @@ from importPolicyTypes import importPolicyTypes from importCommon import * import importCommon -################################################################################################################################################################################################# -# # -# Import all users from a given file # -# # -# activation : # -# python importNormativeAll.py [-i | --ip=] [-p | --port= ] [-u | --user= ] [-d | --debug=] # -# [-v | --updateversion=] # -# # -# shortest activation (be host = localhost, be port = 8080, user = jh0003): # # # -# python importNormativeAll.py # -# # -################################################################################################################################################################################################# +##################################################################################################################################################################################################################################################### +# # +# Import all users from a given file # +# # +# activation : # +# python importNormativeNoHeatAndNormativeTypes.py [-s | --scheme= ] [-i | --ip=] [-p | --port= ] [-u | --user= ] [-d | --debug=] # +# [-v | --updateversion=] # +# # +# shortest activation (be host = localhost, be port = 8080, user = jh0003): # +# python importNormativeNoHeatAndNormativeTypes.py # +# # +##################################################################################################################################################################################################################################################### def usage(): - print sys.argv[0], '[-i | --ip=] [-p | --port= ] [-u | --user= ] [-d | --debug=] [-v | --updateversion=]' + print sys.argv[0], '[optional -s | --scheme=, default http] [-i | --ip=] [-p | --port= ] [-u | --user= ] [-d | --debug=] [-v | --updateversion=]' def handleResults(results, updateversion): printFrameLine() @@ -57,9 +57,10 @@ def main(argv): debugf = None updateversion = 'true' importCommon.debugFlag = False + scheme = 'http' try: - opts, args = getopt.getopt(argv,"i:p:u:d:v:h",["ip=","port=","user=","debug=","updateversion="]) + opts, args = getopt.getopt(argv,"i:p:u:d:v:h:s:",["ip=","port=","user=","debug=","updateversion=", "scheme="]) except getopt.GetoptError: usage() errorAndExit(2, 'Invalid input') @@ -75,6 +76,8 @@ def main(argv): bePort = arg elif opt in ("-u", "--user"): adminUser = arg + elif opt in ("-s", "--scheme"): + scheme = arg elif opt in ("-d", "--debug"): print arg debugf = bool(arg.lower() == "true" or arg.lower() == "yes") @@ -83,7 +86,7 @@ def main(argv): if (arg.lower() == "false" or arg.lower() == "no"): updateversion = 'false' - print 'be host =',beHost,', be port =', bePort,', user =', adminUser, ', debug =', debugf, ', updateversion =', updateversion + print 'scheme =',scheme,', be host =',beHost,', be port =', bePort,', user =', adminUser, ', debug =', debugf, ', updateversion =', updateversion if (debugf != None): print 'set debug mode to ' + str(debugf) @@ -100,16 +103,16 @@ def main(argv): baseFileLocation = pathdir + "/../../../import/tosca/" fileLocation = baseFileLocation + "data-types/" - importDataTypes(beHost, bePort, adminUser, False, fileLocation) + importDataTypes(scheme, beHost, bePort, adminUser, False, fileLocation) print 'sleep until data type cache is updated' time.sleep( 70 ) fileLocation = baseFileLocation + "capability-types/" - importNormativeCapabilities(beHost, bePort, adminUser, False, fileLocation) + importNormativeCapabilities(scheme, beHost, bePort, adminUser, False, fileLocation) fileLocation = baseFileLocation + "interface-lifecycle-types/" - importNormativeInterfaceLifecycleType(beHost, bePort, adminUser, False, fileLocation) + importNormativeInterfaceLifecycleType(scheme, beHost, bePort, adminUser, False, fileLocation) #fileLocation = baseFileLocation + "categories/" #importCategories(beHost, bePort, adminUser, False, fileLocation) @@ -123,10 +126,10 @@ def main(argv): #handleResults(resultsHeat, updateversion) fileLocation = baseFileLocation + "group-types/" - importGroupTypes(beHost, bePort, adminUser, False, fileLocation) + importGroupTypes(scheme, beHost, bePort, adminUser, False, fileLocation) fileLocation = baseFileLocation + "policy-types/" - importPolicyTypes(beHost, bePort, adminUser, False, fileLocation) + importPolicyTypes(scheme, beHost, bePort, adminUser, False, fileLocation) errorAndExit(0, None) diff --git a/catalog-be/src/main/resources/scripts/import/tosca/importNormativeTypes.py b/catalog-be/src/main/resources/scripts/import/tosca/importNormativeTypes.py index 1f523858b6..df2cd49687 100644 --- a/catalog-be/src/main/resources/scripts/import/tosca/importNormativeTypes.py +++ b/catalog-be/src/main/resources/scripts/import/tosca/importNormativeTypes.py @@ -5,19 +5,19 @@ import json import copy from importCommon import * import importCommon -################################################################################################################################################ -# # -# Import all users from a given file # -# # -# activation : # -# python importUsers.py [-i | --ip=] [-p | --port= ] [-f | --ifile= ] # -# [-v | --updateversion=] # -# shortest activation (be host = localhost, be port = 8080): # # -# python importUsers.py [-f | --ifile= ] # -# # -################################################################################################################################################ - -def createNormativeType(beHost, bePort, adminUser, fileDir, ELEMENT_NAME, updateversion): +######################################################################################################################################################################################### +# # +# Import all users from a given file # +# # +# activation : # +# python importNormativeTypes.py [-s | --scheme= ] [-i | --ip=] [-p | --port= ] [-f | --ifile= ] # +# [-v | --updateversion=] # +# shortest activation (be host = localhost, be port = 8080): # +# python importNormativeTypes.py [-f | --ifile= ] # +# # +######################################################################################################################################################################################### + +def createNormativeType(scheme, beHost, bePort, adminUser, fileDir, ELEMENT_NAME, updateversion): try: log("in create normative type ", ELEMENT_NAME) @@ -27,7 +27,7 @@ def createNormativeType(beHost, bePort, adminUser, fileDir, ELEMENT_NAME, update buffer = StringIO() c = pycurl.Curl() - url = 'http://' + beHost + ':' + bePort + '/sdc2/rest/v1/catalog/upload/multipart' + url = scheme + '://' + beHost + ':' + bePort + '/sdc2/rest/v1/catalog/upload/multipart' if updateversion != None: url += '?createNewVersion=' + updateversion c.setopt(c.URL, url) @@ -58,6 +58,9 @@ def createNormativeType(beHost, bePort, adminUser, fileDir, ELEMENT_NAME, update #data = json.dumps(user) #c.setopt(c.POSTFIELDS, data) + if scheme == 'https': + c.setopt(c.SSL_VERIFYPEER, 0) + #c.setopt(c.WRITEFUNCTION, lambda x: None) c.setopt(c.WRITEFUNCTION, buffer.write) #print("before perform") @@ -79,10 +82,10 @@ def createNormativeType(beHost, bePort, adminUser, fileDir, ELEMENT_NAME, update def usage(): - print sys.argv[0], '[-i | --ip=] [-p | --port= ] [-u | --user= ] [-v | --updateversion=]' + print sys.argv[0], '[optional -s | --scheme=, default http] [-i | --ip=] [-p | --port= ] [-u | --user= ] [-v | --updateversion=]' -def importNormativeTypes(beHost, bePort, adminUser, fileDir, updateversion): +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" ] @@ -93,7 +96,7 @@ def importNormativeTypes(beHost, bePort, adminUser, fileDir, updateversion): results = [] for normativeType in normativeTypes: - result = createNormativeType(beHost, bePort, adminUser, fileDir, normativeType, updateversion) + result = createNormativeType(scheme, beHost, bePort, adminUser, fileDir, normativeType, updateversion) results.append(result) if ( result[1] == None or result[1] not in responseCodes ): print "Failed creating normative type " + normativeType + ". " + str(result[1]) @@ -107,9 +110,10 @@ def main(argv): bePort = '8080' adminUser = 'jh0003' updateversion = 'true' + scheme = 'http' try: - opts, args = getopt.getopt(argv,"i:p:u:v:h:",["ip=","port=","user=","updateversion="]) + opts, args = getopt.getopt(argv,"i:p:u:v:h:s:",["ip=","port=","user=","updateversion=","scheme="]) except getopt.GetoptError: usage() errorAndExit(2, 'Invalid input') @@ -125,17 +129,19 @@ def main(argv): 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 'be host =',beHost,', be port =', bePort,', user =', adminUser, ', updateversion =', updateversion + print 'scheme =',scheme,', be host =',beHost,', be port =', bePort,', user =', adminUser, ', updateversion =', updateversion if ( beHost == None ): usage() sys.exit(3) - results = importNormativeTypes(beHost, bePort, adminUser, "../../../import/tosca/normative-types/", updateversion) + results = importNormativeTypes(scheme, beHost, bePort, adminUser, "../../../import/tosca/normative-types/", updateversion) print "-----------------------------" for result in results: 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 3d7d9a9bbf..eb55bf84bc 100644 --- a/catalog-be/src/main/resources/scripts/import/tosca/importONAPNormativeAll.py +++ b/catalog-be/src/main/resources/scripts/import/tosca/importONAPNormativeAll.py @@ -23,7 +23,7 @@ import importCommon # Import all users from a given file # # # # activation : # -# python importNormativeAll.py [-i | --ip=] [-p | --port= ] [-u | --user= ] [-d | --debug=] # +# python importNormativeAll.py [-s | --scheme= ] [-i | --ip=] [-p | --port= ] [-u | --user= ] [-d | --debug=] # # [-v | --updateversion=] # # # # shortest activation (be host = localhost, be port = 8080, user = jh0003): # # # @@ -32,7 +32,7 @@ import importCommon ################################################################################################################################################################################################# def usage(): - print sys.argv[0], '[-i | --ip=] [-p | --port= ] [-u | --user= ] [-d | --debug=] [-v | --updateversion=]' + print sys.argv[0], '[-s | --scheme= ] [-i | --ip=] [-p | --port= ] [-u | --user= ] [-d | --debug=] [-v | --updateversion=]' def handleResults(results, updateversion): printFrameLine() @@ -58,6 +58,7 @@ def main(argv): debugf = None updateversion = 'true' importCommon.debugFlag = False + scheme = 'http' try: opts, args = getopt.getopt(argv,"i:p:u:d:v:h",["ip=","port=","user=","debug=","updateversion="]) @@ -76,6 +77,8 @@ def main(argv): bePort = arg elif opt in ("-u", "--user"): adminUser = arg + elif opt in ("-s", "--scheme"): + scheme = arg elif opt in ("-d", "--debug"): print arg debugf = bool(arg.lower() == "true" or arg.lower() == "yes") @@ -84,7 +87,7 @@ def main(argv): if (arg.lower() == "false" or arg.lower() == "no"): updateversion = 'false' - print 'be host =',beHost,', be port =', bePort,', user =', adminUser, ', debug =', debugf, ', updateversion =', updateversion + print 'scheme =',scheme,',be host =',beHost,', be port =', bePort,', user =', adminUser, ', debug =', debugf, ', updateversion =', updateversion if (debugf != None): print 'set debug mode to ' + str(debugf) @@ -101,37 +104,37 @@ def main(argv): baseFileLocation = pathdir + "/../../../import/tosca/" fileLocation = baseFileLocation + "data-types/" - importDataTypes(beHost, bePort, adminUser, False, fileLocation) + importDataTypes(scheme, beHost, bePort, adminUser, False, fileLocation) print 'sleep until data type cache is updated' time.sleep( 70 ) fileLocation = baseFileLocation + "capability-types/" - importNormativeCapabilities(beHost, bePort, adminUser, False, fileLocation) + importNormativeCapabilities(scheme, beHost, bePort, adminUser, False, fileLocation) fileLocation = baseFileLocation + "interface-lifecycle-types/" - importNormativeInterfaceLifecycleType(beHost, bePort, adminUser, False, fileLocation) + importNormativeInterfaceLifecycleType(scheme, beHost, bePort, adminUser, False, fileLocation) fileLocation = baseFileLocation + "categories/" - importCategories(beHost, bePort, adminUser, False, fileLocation) + importCategories(scheme, beHost, bePort, adminUser, False, fileLocation) fileLocation = baseFileLocation + "normative-types/" - results = importNormativeTypes(beHost, bePort, adminUser, fileLocation, updateversion) + results = importNormativeTypes(scheme, beHost, bePort, adminUser, fileLocation, updateversion) handleResults(results, updateversion) fileLocation = baseFileLocation + "heat-types/" - resultsHeat = importHeatTypes(beHost, bePort, adminUser, fileLocation, updateversion) + resultsHeat = importHeatTypes(scheme, beHost, bePort, adminUser, fileLocation, updateversion) handleResults(resultsHeat, updateversion) fileLocation = baseFileLocation + "onap-types/" - resultsHeat = importOnapTypes(beHost, bePort, adminUser, fileLocation, updateversion) + resultsHeat = importOnapTypes(scheme, beHost, bePort, adminUser, fileLocation, updateversion) handleResults(resultsHeat, updateversion) fileLocation = baseFileLocation + "group-types/" - importGroupTypes(beHost, bePort, adminUser, False, fileLocation) + importGroupTypes(scheme, beHost, bePort, adminUser, False, fileLocation) fileLocation = baseFileLocation + "policy-types/" - importPolicyTypes(beHost, bePort, adminUser, False, fileLocation) + importPolicyTypes(scheme, beHost, bePort, adminUser, False, fileLocation) errorAndExit(0, None) diff --git a/catalog-be/src/main/resources/scripts/import/tosca/importOnapTypes.py b/catalog-be/src/main/resources/scripts/import/tosca/importOnapTypes.py index 18d2270442..faad226d39 100644 --- a/catalog-be/src/main/resources/scripts/import/tosca/importOnapTypes.py +++ b/catalog-be/src/main/resources/scripts/import/tosca/importOnapTypes.py @@ -7,19 +7,19 @@ from importCommon import * from importNormativeTypes import * import importCommon -################################################################################################################################################ -# # -# Import all users from a given file # -# # -# activation : # -# python importUsers.py [-i | --ip=] [-p | --port= ] [-f | --ifile= ] # -# # -# shortest activation (be host = localhost, be port = 8080): # -# python importUsers.py [-f | --ifile= ] # -# # -################################################################################################################################################ +##################################################################################################################################################################################################### +# # +# Import all users from a given file # +# # +# activation : # +# python importUsers.py [optional -s | --scheme=, default http] [-i | --ip=] [-p | --port= ] [-f | --ifile= ] # +# # +# shortest activation (be host = localhost, be port = 8080): # +# python importUsers.py [-f | --ifile= ] # +# # +##################################################################################################################################################################################################### -def importOnapTypes(beHost, bePort, adminUser, fileDir, updateversion): +def importOnapTypes(scheme, beHost, bePort, adminUser, fileDir, updateversion): onapTypes = [ "extImageFile", "extLocalStorage", @@ -41,7 +41,7 @@ def importOnapTypes(beHost, bePort, adminUser, fileDir, updateversion): results = [] for onapType in onapTypes: - result = createNormativeType(beHost, bePort, adminUser, fileDir, onapType, updateversion) + 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]) @@ -55,6 +55,7 @@ def main(argv): bePort = '8080' adminUser = 'jh0003' updateversion = 'true' + scheme = 'http' try: opts, args = getopt.getopt(argv,"i:p:u:v:h:",["ip=","port=","user=","updateversion="]) @@ -73,17 +74,19 @@ def main(argv): 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 'be host =',beHost,', be port =', bePort,', user =', adminUser + print 'scheme =',scheme,',be host =',beHost,', be port =', bePort,', user =', adminUser if ( beHost == None ): usage() sys.exit(3) - results = importOnapTypes(beHost, bePort, adminUser, "../../../import/tosca/onap-types/", updateversion) + results = importOnapTypes(scheme, beHost, bePort, adminUser, "../../../import/tosca/onap-types/", updateversion) print "-----------------------------" for result in results: @@ -104,5 +107,3 @@ def main(argv): if __name__ == "__main__": main(sys.argv[1:]) - - diff --git a/catalog-be/src/main/resources/scripts/import/tosca/importPolicyTypes.py b/catalog-be/src/main/resources/scripts/import/tosca/importPolicyTypes.py index c01e159264..103ad2d1da 100644 --- a/catalog-be/src/main/resources/scripts/import/tosca/importPolicyTypes.py +++ b/catalog-be/src/main/resources/scripts/import/tosca/importPolicyTypes.py @@ -6,24 +6,24 @@ import copy from importNormativeElements import createNormativeElement from importCommon import * -################################################################################################################################################ -# # -# Import tosca data types # -# # -# activation : # -# python importPolicyTypes.py [-i | --ip=] [-p | --port= ] [-f | --ifile= ] # -# # -# shortest activation (be host = localhost, be port = 8080): # # -# python importPolicyTypes.py [-f | --ifile= ] # -# # -################################################################################################################################################ +##################################################################################################################################################################################### +# # +# Import tosca data types # +# # +# activation : # +# python importPolicyTypes.py [-s | --scheme= ] [-i | --ip=] [-p | --port= ] [-f | --ifile= ] # +# # +# shortest activation (be host = localhost, be port = 8080): # +# python importPolicyTypes.py [-f | --ifile= ] # +# # +##################################################################################################################################################################################### def usage(): - print sys.argv[0], '[-i | --ip=] [-p | --port= ] [-u | --user= ]' + print sys.argv[0], '[optional -s | --scheme=, default http] [-i | --ip=] [-p | --port= ] [-u | --user= ]' -def importPolicyTypes(beHost, bePort, adminUser, exitOnSuccess, fileDir): - result = createNormativeElement(beHost, bePort, adminUser, fileDir, "/sdc2/rest/v1/catalog/uploadType/policytypes", "policyTypes", "policyTypesZip") +def importPolicyTypes(scheme, beHost, bePort, adminUser, exitOnSuccess, fileDir): + result = createNormativeElement(scheme, beHost, bePort, adminUser, fileDir, "/sdc2/rest/v1/catalog/uploadType/policytypes", "policyTypes", "policyTypesZip") printFrameLine() printNameAndReturnCode(result[0], result[1]) @@ -41,9 +41,10 @@ def main(argv): beHost = 'localhost' bePort = '8080' adminUser = 'jh0003' + scheme = 'http' try: - opts, args = getopt.getopt(argv,"i:p:u:h:",["ip=","port=","user="]) + opts, args = getopt.getopt(argv,"i:p:u:h:s:",["ip=","port=","user=", "scheme="]) except getopt.GetoptError: usage() errorAndExit(2, 'Invalid input') @@ -59,14 +60,16 @@ def main(argv): bePort = arg elif opt in ("-u", "--user"): adminUser = arg + elif opt in ("-s", "--scheme"): + scheme = arg - print 'be host =',beHost,', be port =', bePort,', user =', adminUser + print 'scheme =',scheme,', be host =',beHost,', be port =', bePort,', user =', adminUser if ( beHost == None ): usage() sys.exit(3) - importPolicyTypes(beHost, bePort, adminUser, True, "../../../import/tosca/policy-types/") + importPolicyTypes(scheme, beHost, bePort, adminUser, True, "../../../import/tosca/policy-types/") if __name__ == "__main__": diff --git a/catalog-be/src/main/resources/scripts/import/tosca/importUsersFromYaml.py b/catalog-be/src/main/resources/scripts/import/tosca/importUsersFromYaml.py index 8509855f38..8e69ffcf49 100644 --- a/catalog-be/src/main/resources/scripts/import/tosca/importUsersFromYaml.py +++ b/catalog-be/src/main/resources/scripts/import/tosca/importUsersFromYaml.py @@ -5,22 +5,22 @@ import json import copy import yaml -######################################################################################################################################################## -# # -# Import all users from a given YAML file # -# # -# activation : # -# python importUsersFromYaml.py [-i | --ip=] [-p | --port= ] [-f | --ifile= ] # -# # -# shortest activation (be host = localhost, be port = 8080): # # -# python importUsersFromYaml.py [-f | --ifile= ] # -# # -# PyYAML module shall be added to python. # -# pip install PyYAML>=3.1.0 --proxy=http://one.proxy.att.com:8080 # -######################################################################################################################################################## - - -def importUsers(beHost, bePort, users, adminUser): +######################################################################################################################################################################################### +# # +# Import all users from a given YAML file # +# # +# activation : # +# python importUsersFromYaml.py [-s | --scheme= ] [-i | --ip=] [-p | --port= ] [-f | --ifile= ] # +# # +# shortest activation (be host = localhost, be port = 8080): # +# python importUsersFromYaml.py [-f | --ifile= ] # +# # +# PyYAML module shall be added to python. # +# pip install PyYAML>=3.1.0 --proxy=http://one.proxy.att.com:8080 # +######################################################################################################################################################################################### + + +def importUsers(scheme, beHost, bePort, users, adminUser): result = [] @@ -28,12 +28,12 @@ def importUsers(beHost, bePort, users, adminUser): #print("Going to add user " + user['userId']) - getRes = getUser(beHost, bePort, user) + getRes = getUser(scheme, beHost, bePort, user) userId = getRes[0] error = getRes[1] #print error if ( error != None and error == 404 ): - res = createUser(beHost, bePort, user ,adminUser) + res = createUser(scheme, beHost, bePort, user ,adminUser) result.append(res) else: if ( error == 200 ): @@ -45,7 +45,7 @@ def importUsers(beHost, bePort, users, adminUser): return result -def getUser(beHost, bePort, user): +def getUser(scheme, beHost, bePort, user): if (user.get('userId') == None): print "Ignoring record", user @@ -56,9 +56,12 @@ def getUser(beHost, bePort, user): c = pycurl.Curl() #print type(userId) - url = 'http://' + beHost + ':' + bePort + '/sdc2/rest/v1/user/' + str(userId) + url = scheme + '://' + beHost + ':' + bePort + '/sdc2/rest/v1/user/' + str(userId) c.setopt(c.URL, url) + if scheme == 'https': + c.setopt(c.SSL_VERIFYPEER, 0) + #adminHeader = 'USER_ID: ' + adminUser c.setopt(pycurl.HTTPHEADER, ['Content-Type: application/json', 'Accept: application/json']) c.setopt(c.WRITEFUNCTION, lambda x: None) @@ -81,7 +84,7 @@ def getUser(beHost, bePort, user): -def createUser(beHost, bePort, user, adminUser): +def createUser(scheme, beHost, bePort, user, adminUser): if (user.get('userId') == None): print "Ignoring record", user @@ -92,7 +95,7 @@ def createUser(beHost, bePort, user, adminUser): buffer = StringIO() c = pycurl.Curl() - url = 'http://' + beHost + ':' + bePort + '/sdc2/rest/v1/user' + url = scheme + '://' + beHost + ':' + bePort + '/sdc2/rest/v1/user' c.setopt(c.URL, url) c.setopt(c.POST, 1) @@ -100,7 +103,10 @@ def createUser(beHost, bePort, user, adminUser): c.setopt(pycurl.HTTPHEADER, ['Content-Type: application/json', 'Accept: application/json', adminHeader]) data = json.dumps(user) - c.setopt(c.POSTFIELDS, data) + c.setopt(c.POSTFIELDS, data) + + if scheme == 'https': + c.setopt(c.SSL_VERIFYPEER, 0) c.setopt(c.WRITEFUNCTION, lambda x: None) #print("before perform") @@ -131,7 +137,7 @@ def errorAndExit(errorCode, errorDesc): sys.exit(errorCode) def usage(): - print sys.argv[0], '[-i | --ip=] [-p | --port= ] [-f | --ifile= ]' + print sys.argv[0], '[optional -s | --scheme=, default http] [-i | --ip=] [-p | --port= ] [-f | --ifile= ]' def main(argv): print 'Number of arguments:', len(sys.argv), 'arguments.' @@ -141,9 +147,10 @@ def main(argv): inputfile = None adminUser = 'jh0003' + scheme ='http' try: - opts, args = getopt.getopt(argv,"i:p:f:h:",["ip=","port=","ifile="]) + opts, args = getopt.getopt(argv,"i:p:f:h:s:",["ip=","port=","ifile=","scheme="]) except getopt.GetoptError: usage() errorAndExit(2, 'Invalid input') @@ -159,8 +166,10 @@ def main(argv): bePort = arg elif opt in ("-f", "--ifile"): inputfile = arg + elif opt in ("-s", "--scheme"): + scheme = arg - print 'be host =',beHost,', be port =', bePort,', users file =',inputfile + print 'scheme =',scheme,', be host =',beHost,', be port =', bePort,', users file =',inputfile if ( inputfile == None ): usage() @@ -187,7 +196,7 @@ def main(argv): #activeUsers = filter(lambda x: x.get('status') == None or x['status'] == 'ACTIVE', cloneUsers) - resultTable = importUsers(beHost, bePort, cloneUsers, adminUser) + resultTable = importUsers(scheme, beHost, bePort, cloneUsers, adminUser) g = lambda x: x[1] != 201 and x[1] != 409 diff --git a/catalog-be/src/main/resources/scripts/import/tosca/typesToUpgrade.json b/catalog-be/src/main/resources/scripts/import/tosca/typesToUpgrade.json index d239a15c72..7ea3dd4eda 100644 --- a/catalog-be/src/main/resources/scripts/import/tosca/typesToUpgrade.json +++ b/catalog-be/src/main/resources/scripts/import/tosca/typesToUpgrade.json @@ -1,19 +1,6 @@ { "heat": [ - "contrailPort", - "extCp", - "contrailV2VirtualMachineInterface", - "neutronPort", - "Generic_PNF", - "portMirroring", - "Generic_VF", - "serviceProxy", - "extCp2", - "extContrailCP", - "vnfConfiguration", - "extVl", - "multiFlavorVFC", - "portMirroringByPolicy" + "Generic_CR" ], "normative": [ ] diff --git a/catalog-be/src/main/resources/scripts/import/tosca/upgradeHeatAndNormativeTypes.py b/catalog-be/src/main/resources/scripts/import/tosca/upgradeHeatAndNormativeTypes.py index e35e2d28eb..5a1d1046b9 100644 --- a/catalog-be/src/main/resources/scripts/import/tosca/upgradeHeatAndNormativeTypes.py +++ b/catalog-be/src/main/resources/scripts/import/tosca/upgradeHeatAndNormativeTypes.py @@ -9,18 +9,18 @@ import importCommon import json -################################################################################################################################################ -# # -# Upgrades all Heat and Normative types confiugred in "typesToUpgrade.json" file # -# # -# activation : # -# python upgradeHeatAndNormativeTypes.py [-i | --ip=] [-p | --port= ] [-f | --ifile= ] # -# # -# shortest activation (be host = localhost, be port = 8080): # -# python upgradeHeatAndNormativeTypes.py [-f | --ifile= ] # -# # -################################################################################################################################################ -def upgradeTypesPerConfigFile(beHost, bePort, adminUser, baseDir, updateversion): +################################################################################################################################################################################################ +# # +# Upgrades all Heat and Normative types confiugred in "typesToUpgrade.json" file # +# # +# activation # +# python upgradeHeatAndNormativeTypes.py [-s | --scheme= ] [-i | --ip=] [-p | --port= ] [-f | --ifile= ] # +# # +# shortest activation (be host = localhost, be port = 8080): # +# python upgradeHeatAndNormativeTypes.py [-f | --ifile= ] # +# # +################################################################################################################################################################################################ +def upgradeTypesPerConfigFile(scheme, beHost, bePort, adminUser, baseDir, updateversion): responseCodes = [200, 201] if (updateversion == 'false'): responseCodes = [200, 201, 409] @@ -37,12 +37,12 @@ def upgradeTypesPerConfigFile(beHost, bePort, adminUser, baseDir, updateversion) debug(normativeFileDir) results = [] for heatType in heatTypes: - result = createNormativeType(beHost, bePort, adminUser, heatFileDir, heatType.encode('ascii', 'ignore'), updateversion) + result = createNormativeType(scheme, 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) + result = createNormativeType(scheme, 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]) @@ -59,9 +59,10 @@ def main(argv): bePort = '8080' adminUser = 'jh0003' updateversion = 'true' + scheme = 'http' try: - opts, args = getopt.getopt(argv, "i:p:u:v:h:", ["ip=", "port=", "user=", "updateversion="]) + opts, args = getopt.getopt(argv, "i:p:u:v:h:s:", ["ip=", "port=", "user=", "updateversion=","scheme="]) except getopt.GetoptError: usage() errorAndExit(2, 'Invalid input') @@ -77,17 +78,19 @@ def main(argv): 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 'be host =', beHost, ', be port =', bePort, ', user =', adminUser + print 'scheme =',scheme,', be host =',beHost, ', be port =', bePort, ', user =', adminUser if (beHost == None): usage() sys.exit(3) - results = upgradeTypesPerConfigFile(beHost, bePort, adminUser, "../../../import/tosca/", updateversion) + results = upgradeTypesPerConfigFile(scheme, beHost, bePort, adminUser, "../../../import/tosca/", updateversion) print "-----------------------------" for result in results: diff --git a/catalog-be/src/main/resources/scripts/import/tosca/upgradeHeatTypes1707.py b/catalog-be/src/main/resources/scripts/import/tosca/upgradeHeatTypes1707.py index 7315ec0635..5cb0ca3b0c 100644 --- a/catalog-be/src/main/resources/scripts/import/tosca/upgradeHeatTypes1707.py +++ b/catalog-be/src/main/resources/scripts/import/tosca/upgradeHeatTypes1707.py @@ -7,19 +7,19 @@ from importCommon import * from importNormativeTypes import * import importCommon -################################################################################################################################################ -# # -# Import all users from a given file # -# # -# activation : # -# python importUsers.py [-i | --ip=] [-p | --port= ] [-f | --ifile= ] # -# # -# shortest activation (be host = localhost, be port = 8080): # -# python importUsers.py [-f | --ifile= ] # -# # -################################################################################################################################################ +################################################################################################################################################################################# +# # +# Import all users from a given file # +# # +# activation : # +# python importUsers.py [-s | --scheme= ] [-i | --ip=] [-p | --port= ] [-f | --ifile= ] # +# # +# shortest activation (be host = localhost, be port = 8080): # +# python importUsers.py [-f | --ifile= ] # +# # +################################################################################################################################################################################# -def upgradeHeatTypes1707(beHost, bePort, adminUser, fileDir, updateversion): +def upgradeHeatTypes1707(scheme, beHost, bePort, adminUser, fileDir, updateversion): heatTypes = [ "volume", "cinderVolume", @@ -49,7 +49,7 @@ def upgradeHeatTypes1707(beHost, bePort, adminUser, fileDir, updateversion): results = [] for heatType in heatTypes: - result = createNormativeType(beHost, bePort, adminUser, fileDir, heatType, updateversion) + result = createNormativeType(scheme, beHost, bePort, adminUser, fileDir, heatType, updateversion) results.append(result) if ( result[1] == None or result[1] not in responseCodes) : print "Failed creating heat type " + heatType + ". " + str(result[1]) @@ -63,9 +63,10 @@ def main(argv): bePort = '8080' adminUser = 'jh0003' updateversion = 'true' - + scheme = 'http' + try: - opts, args = getopt.getopt(argv,"i:p:u:v:h:",["ip=","port=","user=","updateversion="]) + opts, args = getopt.getopt(argv,"i:p:u:v:h:s:",["ip=","port=","user=","updateversion=","scheme="]) except getopt.GetoptError: usage() errorAndExit(2, 'Invalid input') @@ -81,17 +82,19 @@ def main(argv): 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 'be host =',beHost,', be port =', bePort,', user =', adminUser + print 'scheme =',scheme,', be host =',beHost,', be port =', bePort,', user =', adminUser if ( beHost == None ): usage() sys.exit(3) - results = upgradeHeatTypes1707(beHost, bePort, adminUser, "../../../import/tosca/heat-types/", updateversion) + results = upgradeHeatTypes1707(scheme, beHost, bePort, adminUser, "../../../import/tosca/heat-types/", updateversion) print "-----------------------------" for result in results: 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 69a51f41f1..573e05b46a 100644 --- a/catalog-be/src/main/resources/scripts/import/tosca/upgradeNormative.py +++ b/catalog-be/src/main/resources/scripts/import/tosca/upgradeNormative.py @@ -17,21 +17,21 @@ from importOnapTypes import importOnapTypes from importCommon import * import importCommon -################################################################################################################################################################################################# -# # -# Upgrades the normative types # -# # -# activation : # -# python upgradeNormative.py [-i | --ip=] [-p | --port= ] [-u | --user= ] [-d | --debug=] # -# # -# # -# shortest activation (be host = localhost, be port = 8080, user = jh0003): # # # -# python upgradeNormative.py # -# # -################################################################################################################################################################################################# +################################################################################################################################################################################################################################# +# # +# Upgrades the normative types # +# # +# activation : # +# python upgradeNormative.py [-s | --scheme= ] [-i | --ip=] [-p | --port= ] [-u | --user= ] [-d | --debug=] # +# # +# # +# shortest activation (be host = localhost, be port = 8080, user = jh0003): # +# python upgradeNormative.py # +# # +################################################################################################################################################################################################################################# def usage(): - print sys.argv[0], '[-i | --ip=] [-p | --port= ] [-u | --user= ] [-d | --debug=]' + print sys.argv[0], '[optional -s | --scheme=, default http] [-i | --ip=] [-p | --port= ] [-u | --user= ] [-d | --debug=]' def handleResults(results, updateversion): printFrameLine() @@ -52,9 +52,10 @@ def main(argv): debugf = None updateversion = 'true' importCommon.debugFlag = False + scheme = 'http' try: - opts, args = getopt.getopt(argv,"i:p:u:d:h",["ip=","port=","user=","debug="]) + opts, args = getopt.getopt(argv,"i:p:u:d:h:s:",["ip=","port=","user=","debug=","scheme="]) except getopt.GetoptError: usage() errorAndExit(2, 'Invalid input') @@ -70,11 +71,13 @@ def main(argv): bePort = arg elif opt in ("-u", "--user"): adminUser = arg + elif opt in ("-s", "--scheme"): + scheme = arg elif opt in ("-d", "--debug"): print arg debugf = bool(arg.lower() == "true" or arg.lower() == "yes") - print 'be host =',beHost,', be port =', bePort,', user =', adminUser, ', debug =', debugf + print 'scheme =',scheme,', be host =',beHost,', be port =', bePort,', user =', adminUser, ', debug =', debugf if (debugf != None): print 'set debug mode to ' + str(debugf) @@ -91,27 +94,27 @@ def main(argv): baseFileLocation = pathdir + "/../../../import/tosca/" fileLocation = baseFileLocation + "categories/" - importCategories(beHost, bePort, adminUser, False, fileLocation) + importCategories(scheme, beHost, bePort, adminUser, False, fileLocation) fileLocation = baseFileLocation + "data-types/" - importDataTypes(beHost, bePort, adminUser, False, fileLocation) + importDataTypes(scheme, 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) + importPolicyTypes(scheme, beHost, bePort, adminUser, False, fileLocation) fileLocation = baseFileLocation + "capability-types/" - importNormativeCapabilities(beHost, bePort, adminUser, False, fileLocation) + importNormativeCapabilities(scheme, beHost, bePort, adminUser, False, fileLocation) + + fileLocation = baseFileLocation + "group-types/" + importGroupTypes(scheme, beHost, bePort, adminUser, False, fileLocation) fileLocation = baseFileLocation + "interface-lifecycle-types/" - importNormativeInterfaceLifecycleType(beHost, bePort, adminUser, False, fileLocation) + importNormativeInterfaceLifecycleType(scheme, beHost, bePort, adminUser, False, fileLocation) print 'sleep until data type cache is updated' time.sleep( 70 ) - resultsHeat = upgradeTypesPerConfigFile(beHost, bePort, adminUser, baseFileLocation, updateversion) + resultsHeat = upgradeTypesPerConfigFile(scheme, beHost, bePort, adminUser, baseFileLocation, updateversion) handleResults(resultsHeat, 'false') errorAndExit(0, None) diff --git a/catalog-be/src/main/resources/scripts/import/tosca/upgradeNormativeVersion.py b/catalog-be/src/main/resources/scripts/import/tosca/upgradeNormativeVersion.py index 8f8e0491ae..958416da33 100644 --- a/catalog-be/src/main/resources/scripts/import/tosca/upgradeNormativeVersion.py +++ b/catalog-be/src/main/resources/scripts/import/tosca/upgradeNormativeVersion.py @@ -7,21 +7,21 @@ from importCommon import * from importNormativeTypes import createNormativeType import importCommon -################################################################################################################################################################################################# -# # -# Upgrades the normative types # -# # -# activation : # -# python upgradeNormative.py [-i | --ip=] [-p | --port= ] [-u | --user= ] [-d | --debug=] # -# # -# # -# shortest activation (be host = localhost, be port = 8080, user = jh0003): # # # -# python upgradeNormative.py # -# # -################################################################################################################################################################################################# +################################################################################################################################################################################################################################# +# # +# Upgrades the normative types # +# # +# activation : # +# python upgradeNormative.py [-s | --scheme= ] [-i | --ip=] [-p | --port= ] [-u | --user= ] [-d | --debug=] # +# # +# # +# shortest activation (be host = localhost, be port = 8080, user = jh0003): # +# python upgradeNormative.py # +# # +################################################################################################################################################################################################################################# def usage(): - print sys.argv[0], '[-i | --ip=] [-p | --port= ] [-u | --user= ] [-d | --debug=]' + print sys.argv[0], '[optional -s | --scheme=, default http] [-i | --ip=] [-p | --port= ] [-u | --user= ] [-d | --debug=]' def handleResults(results, updateversion): printFrameLine() @@ -41,10 +41,11 @@ def main(argv): adminUser = 'jh0003' debugf = None updateversion = 'true' - importCommon.debugFlag = False + importCommon.debugFlag = False + scheme = 'http' try: - opts, args = getopt.getopt(argv,"i:p:u:d:h",["ip=","port=","user=","debug="]) + opts, args = getopt.getopt(argv,"i:p:u:d:h:s:",["ip=","port=","user=","debug=","scheme="]) except getopt.GetoptError: usage() errorAndExit(2, 'Invalid input') @@ -60,11 +61,13 @@ def main(argv): bePort = arg elif opt in ("-u", "--user"): adminUser = arg + elif opt in ("-s", "--scheme"): + scheme = arg elif opt in ("-d", "--debug"): print arg debugf = bool(arg.lower() == "true" or arg.lower() == "yes") - print 'be host =',beHost,', be port =', bePort,', user =', adminUser, ', debug =', debugf + print 'scheme =',scheme,', be host =',beHost,', be port =', bePort,', user =', adminUser, ', debug =', debugf if (debugf != None): print 'set debug mode to ' + str(debugf) @@ -87,11 +90,11 @@ def main(argv): ########################################################################## fileLocation = baseFileLocation + "heat-types/" - result = createNormativeType(beHost, bePort, adminUser, fileLocation, "contrailV2VirtualMachineInterface", updateversion) + result = createNormativeType(scheme, beHost, bePort, adminUser, fileLocation, "contrailV2VirtualMachineInterface", updateversion) results.append(result) fileLocation = baseFileLocation + "heat-types/" - result = createNormativeType(beHost, bePort, adminUser, fileLocation, "neutronPort", updateversion) + result = createNormativeType(scheme, beHost, bePort, adminUser, fileLocation, "neutronPort", updateversion) results.append(result) diff --git a/catalog-be/src/main/resources/scripts/import/tosca/upgradeNormativeVersionAll.py b/catalog-be/src/main/resources/scripts/import/tosca/upgradeNormativeVersionAll.py index d45b27e755..805d012298 100644 --- a/catalog-be/src/main/resources/scripts/import/tosca/upgradeNormativeVersionAll.py +++ b/catalog-be/src/main/resources/scripts/import/tosca/upgradeNormativeVersionAll.py @@ -10,7 +10,7 @@ from importCommon import * import importCommon def usage(): - print sys.argv[0], '[-i | --ip=] [-p | --port= ] [-u | --user= ] [-d | --debug=] [-v | --updateversion=]' + print sys.argv[0], '[optional -s | --scheme=, default http] [-i | --ip=] [-p | --port= ] [-u | --user= ] [-d | --debug=] [-v | --updateversion=]' def handleResults(results, updateversion): printFrameLine() @@ -36,9 +36,10 @@ def main(argv): debugf = None updateversion = 'true' importCommon.debugFlag = False + scheme = 'http' try: - opts, args = getopt.getopt(argv,"i:p:u:d:v:h",["ip=","port=","user=","debug=","updateversion="]) + opts, args = getopt.getopt(argv,"i:p:u:d:v:h:s:",["ip=","port=","user=","debug=","updateversion=","scheme="]) except getopt.GetoptError: usage() errorAndExit(2, 'Invalid input') @@ -54,6 +55,8 @@ def main(argv): bePort = arg elif opt in ("-u", "--user"): adminUser = arg + elif opt in ("-s", "--scheme"): + scheme = arg elif opt in ("-d", "--debug"): print arg debugf = bool(arg.lower() == "true" or arg.lower() == "yes") @@ -62,7 +65,7 @@ def main(argv): if (arg.lower() == "false" or arg.lower() == "no"): updateversion = 'false' - print 'be host =',beHost,', be port =', bePort,', user =', adminUser, ', debug =', debugf, ', updateversion =', updateversion + print 'scheme =',scheme,', be host =',beHost,', be port =', bePort,', user =', adminUser, ', debug =', debugf, ', updateversion =', updateversion if (debugf != None): print 'set debug mode to ' + str(debugf) @@ -79,11 +82,11 @@ def main(argv): baseFileLocation = pathdir + "/../../../import/tosca/" fileLocation = baseFileLocation + "normative-types/" - results = importNormativeTypes(beHost, bePort, adminUser, fileLocation, updateversion) + results = importNormativeTypes(scheme, beHost, bePort, adminUser, fileLocation, updateversion) handleResults(results, updateversion) fileLocation = baseFileLocation + "heat-types/" - resultsHeat = importHeatTypes(beHost, bePort, adminUser, fileLocation, updateversion) + resultsHeat = importHeatTypes(scheme, beHost, bePort, adminUser, fileLocation, updateversion) handleResults(resultsHeat, updateversion) fileLocation = baseFileLocation + "onap-types/" diff --git a/catalog-be/src/main/resources/scripts/import/tosca/upgradeNormativeVersionProd1702_3537.py b/catalog-be/src/main/resources/scripts/import/tosca/upgradeNormativeVersionProd1702_3537.py index 13e5d7d63a..c75966cfc9 100644 --- a/catalog-be/src/main/resources/scripts/import/tosca/upgradeNormativeVersionProd1702_3537.py +++ b/catalog-be/src/main/resources/scripts/import/tosca/upgradeNormativeVersionProd1702_3537.py @@ -7,21 +7,21 @@ from importCommon import * from importNormativeTypes import createNormativeType import importCommon -################################################################################################################################################################################################# -# # -# Upgrades the normative types # -# # -# activation : # -# python upgradeNormative.py [-i | --ip=] [-p | --port= ] [-u | --user= ] [-d | --debug=] # -# # -# # -# shortest activation (be host = localhost, be port = 8080, user = jh0003): # # # -# python upgradeNormative.py # -# # -################################################################################################################################################################################################# +################################################################################################################################################################################################################################# +# # +# Upgrades the normative types # +# # +# activation : # +# python upgradeNormative.py [-s | --scheme= ] [-i | --ip=] [-p | --port= ] [-u | --user= ] [-d | --debug=] # +# # +# # +# shortest activation (be host = localhost, be port = 8080, user = jh0003): # +# python upgradeNormative.py # +# # +################################################################################################################################################################################################################################# def usage(): - print sys.argv[0], '[-i | --ip=] [-p | --port= ] [-u | --user= ] [-d | --debug=]' + print sys.argv[0], '[optional -s | --scheme=, default http] [-i | --ip=] [-p | --port= ] [-u | --user= ] [-d | --debug=]' def handleResults(results, updateversion): printFrameLine() @@ -42,9 +42,10 @@ def main(argv): debugf = None updateversion = 'true' importCommon.debugFlag = False + scheme = 'http' try: - opts, args = getopt.getopt(argv,"i:p:u:d:h",["ip=","port=","user=","debug="]) + opts, args = getopt.getopt(argv,"i:p:u:d:h:s:",["ip=","port=","user=","debug=","scheme="]) except getopt.GetoptError: usage() errorAndExit(2, 'Invalid input') @@ -60,11 +61,13 @@ def main(argv): bePort = arg elif opt in ("-u", "--user"): adminUser = arg + elif opt in ("-s", "--scheme"): + scheme = arg elif opt in ("-d", "--debug"): print arg debugf = bool(arg.lower() == "true" or arg.lower() == "yes") - print 'be host =',beHost,', be port =', bePort,', user =', adminUser, ', debug =', debugf + print 'scheme =',scheme,', be host =',beHost,', be port =', bePort,', user =', adminUser, ', debug =', debugf if (debugf != None): print 'set debug mode to ' + str(debugf) @@ -88,35 +91,35 @@ def main(argv): fileLocation = baseFileLocation + "heat-types/" - result = createNormativeType(beHost, bePort, adminUser, fileLocation, "contrailPort", updateversion) + result = createNormativeType(scheme, beHost, bePort, adminUser, fileLocation, "contrailPort", updateversion) results.append(result) fileLocation = baseFileLocation + "heat-types/" - result = createNormativeType(beHost, bePort, adminUser, fileLocation, "contrailV2VirtualMachineInterface", updateversion) + result = createNormativeType(scheme, beHost, bePort, adminUser, fileLocation, "contrailV2VirtualMachineInterface", updateversion) results.append(result) fileLocation = baseFileLocation + "heat-types/" - result = createNormativeType(beHost, bePort, adminUser, fileLocation, "neutronPort", updateversion) + result = createNormativeType(scheme, beHost, bePort, adminUser, fileLocation, "neutronPort", updateversion) results.append(result) fileLocation = baseFileLocation + "heat-types/" - result = createNormativeType(beHost, bePort, adminUser, fileLocation, "contrailCompute", updateversion) + result = createNormativeType(scheme, beHost, bePort, adminUser, fileLocation, "contrailCompute", updateversion) results.append(result) fileLocation = baseFileLocation + "heat-types/" - result = createNormativeType(beHost, bePort, adminUser, fileLocation, "novaServer", updateversion) + result = createNormativeType(scheme, beHost, bePort, adminUser, fileLocation, "novaServer", updateversion) results.append(result) fileLocation = baseFileLocation + "heat-types/" - result = createNormativeType(beHost, bePort, adminUser, fileLocation, "contrailV2VirtualNetwork", updateversion) + result = createNormativeType(scheme, beHost, bePort, adminUser, fileLocation, "contrailV2VirtualNetwork", updateversion) results.append(result) fileLocation = baseFileLocation + "heat-types/" - result = createNormativeType(beHost, bePort, adminUser, fileLocation, "contrailVirtualNetwork", updateversion) + result = createNormativeType(scheme, beHost, bePort, adminUser, fileLocation, "contrailVirtualNetwork", updateversion) results.append(result) fileLocation = baseFileLocation + "heat-types/" - result = createNormativeType(beHost, bePort, adminUser, fileLocation, "neutronNet", updateversion) + result = createNormativeType(scheme, beHost, bePort, adminUser, fileLocation, "neutronNet", updateversion) results.append(result) 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 4d0ec291f5..b272c2726c 100644 --- a/catalog-be/src/main/resources/scripts/import/tosca/upgradeONAPNormative.py +++ b/catalog-be/src/main/resources/scripts/import/tosca/upgradeONAPNormative.py @@ -52,6 +52,7 @@ def main(argv): debugf = None updateversion = 'true' importCommon.debugFlag = False + scheme = 'http' try: opts, args = getopt.getopt(argv,"i:p:u:d:h",["ip=","port=","user=","debug="]) @@ -70,11 +71,13 @@ def main(argv): bePort = arg elif opt in ("-u", "--user"): adminUser = arg + elif opt in ("-s", "--scheme"): + scheme = arg elif opt in ("-d", "--debug"): print arg debugf = bool(arg.lower() == "true" or arg.lower() == "yes") - print 'be host =',beHost,', be port =', bePort,', user =', adminUser, ', debug =', debugf + print 'scheme =',scheme,',be host =',beHost,', be port =', bePort,', user =', adminUser, ', debug =', debugf if (debugf != None): print 'set debug mode to ' + str(debugf) @@ -91,31 +94,31 @@ def main(argv): baseFileLocation = pathdir + "/../../../import/tosca/" fileLocation = baseFileLocation + "categories/" - importCategories(beHost, bePort, adminUser, False, fileLocation) + importCategories(scheme, beHost, bePort, adminUser, False, fileLocation) fileLocation = baseFileLocation + "data-types/" - importDataTypes(beHost, bePort, adminUser, False, fileLocation) + importDataTypes(scheme, beHost, bePort, adminUser, False, fileLocation) fileLocation = baseFileLocation + "policy-types/" - importPolicyTypes(beHost, bePort, adminUser, False, fileLocation) + importPolicyTypes(scheme, beHost, bePort, adminUser, False, fileLocation) fileLocation = baseFileLocation + "group-types/" - importGroupTypes(beHost, bePort, adminUser, False, fileLocation) + importGroupTypes(scheme, beHost, bePort, adminUser, False, fileLocation) fileLocation = baseFileLocation + "capability-types/" - importNormativeCapabilities(beHost, bePort, adminUser, False, fileLocation) + importNormativeCapabilities(scheme, beHost, bePort, adminUser, False, fileLocation) fileLocation = baseFileLocation + "interface-lifecycle-types/" - importNormativeInterfaceLifecycleType(beHost, bePort, adminUser, False, fileLocation) + importNormativeInterfaceLifecycleType(scheme, beHost, bePort, adminUser, False, fileLocation) print 'sleep until data type cache is updated' time.sleep( 70 ) - resultsHeat = upgradeTypesPerConfigFile(beHost, bePort, adminUser, baseFileLocation, updateversion) + resultsHeat = upgradeTypesPerConfigFile(scheme, beHost, bePort, adminUser, baseFileLocation, updateversion) handleResults(resultsHeat, 'false') fileLocation = baseFileLocation + "onap-types/" - resultsHeat = importOnapTypes(beHost, bePort, adminUser, fileLocation, updateversion) + resultsHeat = importOnapTypes(scheme, beHost, bePort, adminUser, fileLocation, updateversion) handleResults(resultsHeat, updateversion) errorAndExit(0, None) -- cgit 1.2.3-korg