From: Tal Gitelman Date: Thu, 19 Jul 2018 15:25:12 +0000 (+0300) Subject: Align normatives and scripts X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F29%2F56929%2F1;p=sdc.git Align normatives and scripts Change-Id: I5e15e3c5adaf13a5b785613d20411f5d0e42e264 Issue-ID: SDC-1544 Signed-off-by: Tal Gitelman --- diff --git a/catalog-be/src/main/resources/import/tosca/annotation-types/annotationTypes.yml b/catalog-be/src/main/resources/import/tosca/annotation-types/annotationTypes.yml new file mode 100644 index 0000000000..edd20e73e6 --- /dev/null +++ b/catalog-be/src/main/resources/import/tosca/annotation-types/annotationTypes.yml @@ -0,0 +1,13 @@ +org.openecomp.annotations.Source: + description: Indicates the origin source of an input + properties: + source_type: + type: string + vf_module_label: + type: list + description: List of VF Modules this input was originated from + entry_schema: + type: string + param_name: + type: string + description: Source parameter name diff --git a/catalog-be/src/main/resources/import/tosca/annotation-types/annotationTypes.zip b/catalog-be/src/main/resources/import/tosca/annotation-types/annotationTypes.zip new file mode 100644 index 0000000000..5783c9794a Binary files /dev/null and b/catalog-be/src/main/resources/import/tosca/annotation-types/annotationTypes.zip differ 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 56da214e88..9a6bc093e4 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 @@ -219,6 +219,11 @@ org.openecomp.capabilities.VLANAssignment: type: string description: Ability to recognize capability per vfc instance group on vnf instance required: true +org.openecomp.capabilities.RoutingConfiguration: + derived_from: tosca.capabilities.Root +org.openecomp.capabilities.FabricConfiguration: + derived_from: tosca.capabilities.Root + #ONAP types tosca.capabilities.nfv.VirtualStorage: derived_from: tosca.capabilities.Root @@ -247,7 +252,7 @@ tosca.capabilities.nfv.VirtualBindable: tosca.capabilities.nfv.VirtualLinkable: derived_from: tosca.capabilities.Root tosca.capabilities.nfv.ExtVirtualLinkable: - derived_from: tosca.capabilities.Root + derived_from: tosca.capabilities.Root tosca.capabilities.nfv.Forwarder: derived_from: tosca.capabilities.Root tosca.capabilities.nfv.ext.GuestOs: 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 dce4bf7565..8304553483 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 c5555a5838..b3635dc09f 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 @@ -57,14 +57,20 @@ tosca.datatypes.Credential: org.openecomp.datatypes.PortMirroringConnectionPointDescription: derived_from: tosca.datatypes.Root properties: - nf_type: - type: string - nfc_type: - type: string + nf_naming_code: + type: string + nfc_naming_code: + type: string network_role: - type: string - pps_capacity: - type: string + type: string + pps_capacity: + type: string + nf_type: + type: string + description: deprecated + nfc_type: + type: string + description: deprecated tosca.datatypes.TimeInterval: derived_from: tosca.datatypes.Root @@ -1391,8 +1397,7 @@ tosca.datatypes.nfv.injectFile: #used for vCPE usecase type: string required: true tosca.datatypes.nfv.L2AddressData: - derived_from: tosca.datatypes.Root - properties: + properties: mac_address_assignment: type: boolean required: true @@ -1452,7 +1457,7 @@ tosca.datatypes.nfv.VlFlavour: flavourId: type: string tosca.datatypes.nfv.ext.AddressPairs: - properties: + properties: ip: type: string required: false @@ -1460,7 +1465,7 @@ tosca.datatypes.nfv.ext.AddressPairs: type: string required: false tosca.datatypes.nfv.ext.FloatingIP: - properties: + properties: external_network: type: string required: false @@ -1468,7 +1473,7 @@ tosca.datatypes.nfv.ext.FloatingIP: type: string required: false tosca.datatypes.nfv.ext.LocationInfo: - properties: + properties: availability_zone: type: string required: false @@ -1479,7 +1484,7 @@ tosca.datatypes.nfv.ext.LocationInfo: type: string required: false tosca.datatypes.nfv.ext.HostRouteInfo: - properties: + properties: destination: type: string required: false @@ -1487,7 +1492,7 @@ tosca.datatypes.nfv.ext.HostRouteInfo: type: string required: false tosca.datatypes.nfv.ext.InjectData: - properties: + properties: file_name: type: string required: false @@ -1495,7 +1500,7 @@ tosca.datatypes.nfv.ext.InjectData: type: string required: false tosca.datatypes.nfv.ext.zte.WatchDog: - properties: + properties: enable_delay: type: integer required: false @@ -1503,7 +1508,7 @@ tosca.datatypes.nfv.ext.zte.WatchDog: type: string required: false tosca.datatypes.nfv.ext.LocalAffinityOrAntiAffinityRule: - properties: + properties: scope: type: string required: false diff --git a/catalog-be/src/main/resources/import/tosca/group-types/groupTypes.json b/catalog-be/src/main/resources/import/tosca/group-types/groupTypes.json new file mode 100644 index 0000000000..caea6a8063 --- /dev/null +++ b/catalog-be/src/main/resources/import/tosca/group-types/groupTypes.json @@ -0,0 +1,22 @@ +{ + "tosca.groups.Root": { + "displayName": "Root", + "icon": "group-root" + }, + "org.openecomp.groups.heat.HeatStack": { + "displayName": "Heat Stack", + "icon": "group-heat-stack" + }, + "org.openecomp.groups.VfModule": { + "displayName": "VF Module", + "icon": "group-vf-module" + }, + "org.openecomp.groups.NetworkCollection": { + "displayName": "Network Collection", + "icon": "group-network-collection" + }, + "org.openecomp.groups.VfcInstanceGroup": { + "displayName": "Vfc Instance", + "icon": "group-vfc-instance" + } +} \ No newline at end of file diff --git a/catalog-be/src/main/resources/import/tosca/heat-types/Generic_Service/Generic_Service.yml b/catalog-be/src/main/resources/import/tosca/heat-types/Generic_Service/Generic_Service.yml index 902cf0c0c8..3652ae4e12 100644 --- a/catalog-be/src/main/resources/import/tosca/heat-types/Generic_Service/Generic_Service.yml +++ b/catalog-be/src/main/resources/import/tosca/heat-types/Generic_Service/Generic_Service.yml @@ -2,4 +2,3 @@ tosca_definitions_version: tosca_simple_yaml_1_0_0 node_types: org.openecomp.resource.abstract.nodes.service: derived_from: tosca.nodes.Root - \ No newline at end of file diff --git a/catalog-be/src/main/resources/import/tosca/heat-types/Generic_Service/Generic_Service.zip b/catalog-be/src/main/resources/import/tosca/heat-types/Generic_Service/Generic_Service.zip index 060dec1aa1..f1e3fdd173 100644 Binary files a/catalog-be/src/main/resources/import/tosca/heat-types/Generic_Service/Generic_Service.zip and b/catalog-be/src/main/resources/import/tosca/heat-types/Generic_Service/Generic_Service.zip differ diff --git a/catalog-be/src/main/resources/import/tosca/heat-types/VLANNetworkReceptor/VLANNetworkReceptor.json b/catalog-be/src/main/resources/import/tosca/heat-types/VLANNetworkReceptor/VLANNetworkReceptor.json new file mode 100644 index 0000000000..157b62a3e2 --- /dev/null +++ b/catalog-be/src/main/resources/import/tosca/heat-types/VLANNetworkReceptor/VLANNetworkReceptor.json @@ -0,0 +1,21 @@ +{ + "payloadName": "VLANNetworkReceptor.yml", + "contactId": "jh0003", + "name": "VLAN Network Receptor Configuration", + "description": "VLAN network receptor configuration object", + "resourceIconPath": "pmc", + "resourceType": "Configuration", + "categories": [ + { + "name": "Configuration", + "subcategories": [ + { + "name": "Configuration" + } + ] + } +], + "tags": [ + "VLAN Network Receptor Configuration" + ] +} \ No newline at end of file diff --git a/catalog-be/src/main/resources/import/tosca/heat-types/VLANNetworkReceptor/VLANNetworkReceptor.yml b/catalog-be/src/main/resources/import/tosca/heat-types/VLANNetworkReceptor/VLANNetworkReceptor.yml new file mode 100644 index 0000000000..6d7818685d --- /dev/null +++ b/catalog-be/src/main/resources/import/tosca/heat-types/VLANNetworkReceptor/VLANNetworkReceptor.yml @@ -0,0 +1,14 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 +node_types: + org.openecomp.nodes.VLANNetworkReceptor: + derived_from: tosca.nodes.Root + capabilities: + routing_configuration_internal: + type: org.openecomp.capabilities.RoutingConfiguration + requirements: + - vlan_assignment: + occurrences: + - 1 + - UNBOUNDED + capability: org.openecomp.capabilities.VLANAssignment + relationship: org.openecomp.relationships.AssignsTo \ No newline at end of file diff --git a/catalog-be/src/main/resources/import/tosca/heat-types/VLANNetworkReceptor/VLANNetworkReceptor.zip b/catalog-be/src/main/resources/import/tosca/heat-types/VLANNetworkReceptor/VLANNetworkReceptor.zip new file mode 100644 index 0000000000..8ad09ed6b6 Binary files /dev/null and b/catalog-be/src/main/resources/import/tosca/heat-types/VLANNetworkReceptor/VLANNetworkReceptor.zip differ diff --git a/catalog-be/src/main/resources/import/tosca/heat-types/VRFEntry/VRFEntry.json b/catalog-be/src/main/resources/import/tosca/heat-types/VRFEntry/VRFEntry.json new file mode 100644 index 0000000000..ab28d03072 --- /dev/null +++ b/catalog-be/src/main/resources/import/tosca/heat-types/VRFEntry/VRFEntry.json @@ -0,0 +1,21 @@ +{ + "payloadName": "VRFEntry.yml", + "contactId": "jh0003", + "name": "VRF Entry Configuration", + "description": "VRF Entry configuration object", + "resourceIconPath": "pmc", + "resourceType": "Configuration", + "categories": [ + { + "name": "Configuration", + "subcategories": [ + { + "name": "Configuration" + } + ] + } +], + "tags": [ + "VRF Entry Configuration" + ] +} \ No newline at end of file diff --git a/catalog-be/src/main/resources/import/tosca/heat-types/VRFEntry/VRFEntry.yml b/catalog-be/src/main/resources/import/tosca/heat-types/VRFEntry/VRFEntry.yml new file mode 100644 index 0000000000..7cba5a84d7 --- /dev/null +++ b/catalog-be/src/main/resources/import/tosca/heat-types/VRFEntry/VRFEntry.yml @@ -0,0 +1,17 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 +node_types: + org.openecomp.nodes.VRFEntry: + derived_from: tosca.nodes.Root + requirements: + - routing_configuration_internal: + occurrences: + - 1 + - UNBOUNDED + capability: org.openecomp.capabilities.RoutingConfiguration + relationship: org.openecomp.relationships.RoutesTo + - routing_configuration_external: + occurrences: + - 1 + - UNBOUNDED + capability: org.openecomp.capabilities.RoutingConfiguration + relationship: org.openecomp.relationships.RoutesTo diff --git a/catalog-be/src/main/resources/import/tosca/heat-types/VRFEntry/VRFEntry.zip b/catalog-be/src/main/resources/import/tosca/heat-types/VRFEntry/VRFEntry.zip new file mode 100644 index 0000000000..fa6312e7f6 Binary files /dev/null and b/catalog-be/src/main/resources/import/tosca/heat-types/VRFEntry/VRFEntry.zip differ diff --git a/catalog-be/src/main/resources/import/tosca/heat-types/VRFObject/VRFObject.json b/catalog-be/src/main/resources/import/tosca/heat-types/VRFObject/VRFObject.json new file mode 100644 index 0000000000..2d3f5412e1 --- /dev/null +++ b/catalog-be/src/main/resources/import/tosca/heat-types/VRFObject/VRFObject.json @@ -0,0 +1,21 @@ +{ + "payloadName": "VRFObject.yml", + "contactId": "jh0003", + "name": "VRF Object Configuration", + "description": "VRF Object configuration object", + "resourceIconPath": "pmc", + "resourceType": "Configuration", + "categories": [ + { + "name": "Configuration", + "subcategories": [ + { + "name": "Configuration" + } + ] + } +], + "tags": [ + "VRF Object Configuration" + ] +} \ No newline at end of file diff --git a/catalog-be/src/main/resources/import/tosca/heat-types/VRFObject/VRFObject.yml b/catalog-be/src/main/resources/import/tosca/heat-types/VRFObject/VRFObject.yml new file mode 100644 index 0000000000..28f1d5287b --- /dev/null +++ b/catalog-be/src/main/resources/import/tosca/heat-types/VRFObject/VRFObject.yml @@ -0,0 +1,8 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 +node_types: + org.openecomp.nodes.VRFObject: + derived_from: tosca.nodes.Root + description: provides capability to connect WAN Transport Service Proxy to VRF Entry + capabilities: + routing_configuration_external: + type: org.openecomp.capabilities.RoutingConfiguration \ No newline at end of file diff --git a/catalog-be/src/main/resources/import/tosca/heat-types/VRFObject/VRFObject.zip b/catalog-be/src/main/resources/import/tosca/heat-types/VRFObject/VRFObject.zip new file mode 100644 index 0000000000..23287d625c Binary files /dev/null and b/catalog-be/src/main/resources/import/tosca/heat-types/VRFObject/VRFObject.zip differ diff --git a/catalog-be/src/main/resources/import/tosca/heat-types/abstractSubstitute/abstractSubstitute.yml b/catalog-be/src/main/resources/import/tosca/heat-types/abstractSubstitute/abstractSubstitute.yml index 7aa7edfe70..48db2b609a 100644 --- a/catalog-be/src/main/resources/import/tosca/heat-types/abstractSubstitute/abstractSubstitute.yml +++ b/catalog-be/src/main/resources/import/tosca/heat-types/abstractSubstitute/abstractSubstitute.yml @@ -1,4 +1,11 @@ tosca_definitions_version: tosca_simple_yaml_1_0_0 +metadata: + template_name: AbstractSubstituteGlobalTypes + template_version: 1.0.0 +description: Abstract Substitute Global Types +imports: + common_definitions: + file: CommonGlobalTypesServiceTemplate.yaml node_types: org.openecomp.resource.abstract.nodes.AbstractSubstitute: derived_from: tosca.nodes.Root diff --git a/catalog-be/src/main/resources/import/tosca/heat-types/cinderVolume/cinderVolume.yml b/catalog-be/src/main/resources/import/tosca/heat-types/cinderVolume/cinderVolume.yml index 87dfc313ae..fb69c6c3b7 100644 --- a/catalog-be/src/main/resources/import/tosca/heat-types/cinderVolume/cinderVolume.yml +++ b/catalog-be/src/main/resources/import/tosca/heat-types/cinderVolume/cinderVolume.yml @@ -1,4 +1,7 @@ tosca_definitions_version: tosca_simple_yaml_1_0_0 + +description: Contrail Virtual Network Global Types + node_types: org.openecomp.resource.vfc.nodes.heat.cinder.Volume: derived_from: org.openecomp.resource.vfc.nodes.volume diff --git a/catalog-be/src/main/resources/import/tosca/heat-types/configuration/configuration.json b/catalog-be/src/main/resources/import/tosca/heat-types/configuration/configuration.json new file mode 100644 index 0000000000..ea56a6b12d --- /dev/null +++ b/catalog-be/src/main/resources/import/tosca/heat-types/configuration/configuration.json @@ -0,0 +1,20 @@ +{ + "payloadName": "configuration.yml", + "contactId": "jh0003", + "name": "Configuration", + "description": "Root Configuration.", + "resourceIconPath": "defaulticon", + "categories": [ + { + "name": "Generic", + "subcategories": [ + { + "name": "Abstract" + } + ] + } + ], + "tags": [ + "Configuration" + ] + } \ No newline at end of file diff --git a/catalog-be/src/main/resources/import/tosca/heat-types/configuration/configuration.yml b/catalog-be/src/main/resources/import/tosca/heat-types/configuration/configuration.yml new file mode 100644 index 0000000000..88be651474 --- /dev/null +++ b/catalog-be/src/main/resources/import/tosca/heat-types/configuration/configuration.yml @@ -0,0 +1,18 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 +node_types: + org.openecomp.nodes.Configuration: + derived_from: tosca.nodes.Root + properties: + type: + type: string + description: The type of the node, the configuration will be defined for it. Ex.”SBC” + required: false + role: + type: string + description: The role of the node, the configuration will be defined for it. Ex. “Active”, “Standby” + required: false + function: + type: string + description: The function of the node, the configuration will be defined for it. Ex. “NAT Traversal” + required: false + diff --git a/catalog-be/src/main/resources/import/tosca/heat-types/configuration/configuration.zip b/catalog-be/src/main/resources/import/tosca/heat-types/configuration/configuration.zip new file mode 100644 index 0000000000..74f5048d05 Binary files /dev/null and b/catalog-be/src/main/resources/import/tosca/heat-types/configuration/configuration.zip differ diff --git a/catalog-be/src/main/resources/import/tosca/heat-types/contrailAbstractSubstitute/contrailAbstractSubstitute.yml b/catalog-be/src/main/resources/import/tosca/heat-types/contrailAbstractSubstitute/contrailAbstractSubstitute.yml index a1f40c5529..5bdee932a3 100644 --- a/catalog-be/src/main/resources/import/tosca/heat-types/contrailAbstractSubstitute/contrailAbstractSubstitute.yml +++ b/catalog-be/src/main/resources/import/tosca/heat-types/contrailAbstractSubstitute/contrailAbstractSubstitute.yml @@ -1,4 +1,11 @@ tosca_definitions_version: tosca_simple_yaml_1_0_0 +metadata: + template_name: ContrailAbstractSubstituteGlobalTypes + template_version: 1.0.0 +description: Contrail Abstract Substitute Global Types +imports: + common_definitions: + file: CommonGlobalTypesServiceTemplate.yaml node_types: org.openecomp.resource.abstract.nodes.contrail.AbstractSubstitute: derived_from: org.openecomp.resource.abstract.nodes.AbstractSubstitute diff --git a/catalog-be/src/main/resources/import/tosca/heat-types/contrailCompute/contrailCompute.yml b/catalog-be/src/main/resources/import/tosca/heat-types/contrailCompute/contrailCompute.yml index c2ba70e2d1..4ca0f04f6c 100644 --- a/catalog-be/src/main/resources/import/tosca/heat-types/contrailCompute/contrailCompute.yml +++ b/catalog-be/src/main/resources/import/tosca/heat-types/contrailCompute/contrailCompute.yml @@ -1,4 +1,13 @@ tosca_definitions_version: tosca_simple_yaml_1_0_0 +metadata: + template_name: ContrailComputeGlobalTypes + template_version: 1.0.0 +description: Contrail Compute TOSCA Global Types +imports: + ComputeGlobalTypes: + file: ComputeGlobalTypesServiceTemplate.yaml + common_definitions: + file: CommonGlobalTypesServiceTemplate.yaml node_types: org.openecomp.resource.vfc.nodes.heat.contrail.Compute: derived_from: org.openecomp.resource.vfc.nodes.Compute diff --git a/catalog-be/src/main/resources/import/tosca/heat-types/contrailNetworkRules/contrailNetworkRules.yml b/catalog-be/src/main/resources/import/tosca/heat-types/contrailNetworkRules/contrailNetworkRules.yml index 2f8228ac85..b9d61e7769 100644 --- a/catalog-be/src/main/resources/import/tosca/heat-types/contrailNetworkRules/contrailNetworkRules.yml +++ b/catalog-be/src/main/resources/import/tosca/heat-types/contrailNetworkRules/contrailNetworkRules.yml @@ -1,4 +1,11 @@ tosca_definitions_version: tosca_simple_yaml_1_0_0 +metadata: + template_name: ContrailNetworkRuleGlobalType + template_version: 1.0.0 +description: Contrail Network Rule Global Types +imports: + common_definitions: + file: CommonGlobalTypesServiceTemplate.yaml node_types: org.openecomp.resource.vfc.rules.nodes.heat.network.contrail.NetworkRules: derived_from: tosca.nodes.Root diff --git a/catalog-be/src/main/resources/import/tosca/heat-types/contrailPort/contrailPort.yml b/catalog-be/src/main/resources/import/tosca/heat-types/contrailPort/contrailPort.yml index ce99511bbe..84717a40c3 100644 --- a/catalog-be/src/main/resources/import/tosca/heat-types/contrailPort/contrailPort.yml +++ b/catalog-be/src/main/resources/import/tosca/heat-types/contrailPort/contrailPort.yml @@ -1,4 +1,13 @@ tosca_definitions_version: tosca_simple_yaml_1_0_0 +metadata: + template_name: ContrailPortGlobalTypes + template_version: 1.0.0 +description: Contrail Port TOSCA Global Types +imports: + common_definitions: + file: CommonGlobalTypesServiceTemplate.yaml + PortGlobalTypes: + file: PortGlobalTypesServiceTemplate.yaml node_types: org.openecomp.resource.cp.nodes.heat.network.contrail.Port: derived_from: org.openecomp.resource.cp.nodes.network.Port diff --git a/catalog-be/src/main/resources/import/tosca/heat-types/contrailV2NetworkRules/contrailV2NetworkRules.yml b/catalog-be/src/main/resources/import/tosca/heat-types/contrailV2NetworkRules/contrailV2NetworkRules.yml index ad4369ce40..ccc6d3a2ab 100644 --- a/catalog-be/src/main/resources/import/tosca/heat-types/contrailV2NetworkRules/contrailV2NetworkRules.yml +++ b/catalog-be/src/main/resources/import/tosca/heat-types/contrailV2NetworkRules/contrailV2NetworkRules.yml @@ -1,4 +1,11 @@ tosca_definitions_version: tosca_simple_yaml_1_0_0 +metadata: + template_name: ContrailV2NetworkRuleGlobalType + template_version: 1.0.0 +description: Contrail V2 Network Rule Global Types +imports: + common_definitions: + file: CommonGlobalTypesServiceTemplate.yaml node_types: org.openecomp.resource.vfc.rules.nodes.heat.network.contrailV2.NetworkRules: derived_from: tosca.nodes.Root diff --git a/catalog-be/src/main/resources/import/tosca/heat-types/contrailV2VLANSubInterfaceV2/contrailV2VLANSubInterfaceV2.json b/catalog-be/src/main/resources/import/tosca/heat-types/contrailV2VLANSubInterfaceV2/contrailV2VLANSubInterfaceV2.json new file mode 100644 index 0000000000..d6139b3c8a --- /dev/null +++ b/catalog-be/src/main/resources/import/tosca/heat-types/contrailV2VLANSubInterfaceV2/contrailV2VLANSubInterfaceV2.json @@ -0,0 +1,15 @@ +{ + "payloadName": "contrailV2VLANSubInterfaceV2.yml", + "contactId": "jh0003", + "name": "contrailV2VLANSubInterfaceV2", + "description": "VLAN sub-Interface is a logical port which must be binded to a port. Regular port may have 1…N VLAN Interfaces.It can connect to its own network (regardless of the network the parent port can connect)", + "resourceIconPath": "network", + "resourceType": "CP", + "categories": [{ + "name": "Generic", + "subcategories": [{ + "name": "Network Elements" + }] + }], + "tags": ["contrailV2VLANSubInterfaceV2"] +} \ No newline at end of file diff --git a/catalog-be/src/main/resources/import/tosca/heat-types/contrailV2VLANSubInterfaceV2/contrailV2VLANSubInterfaceV2.yml b/catalog-be/src/main/resources/import/tosca/heat-types/contrailV2VLANSubInterfaceV2/contrailV2VLANSubInterfaceV2.yml new file mode 100644 index 0000000000..a9a89e84bc --- /dev/null +++ b/catalog-be/src/main/resources/import/tosca/heat-types/contrailV2VLANSubInterfaceV2/contrailV2VLANSubInterfaceV2.yml @@ -0,0 +1,70 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 +node_types: + org.openecomp.resource.cp.nodes.heat.network.v2.contrailV2.VLANSubInterface: + derived_from: org.openecomp.resource.cp.nodes.network.v2.SubInterface + properties: + virtual_machine_interface_refs: + description: List of virtual machine interface. + type: list + status: SUPPORTED + entry_schema: + type: string + required: false + name: + description: Virtual Machine Sub Interface VLAN name + type: string + status: SUPPORTED + required: false + virtual_network_refs: + description: List of virtual networks. + type: list + status: SUPPORTED + entry_schema: + type: string + required: false + virtual_machine_interface_properties: + description: virtual machine interface properties. + type: org.openecomp.datatypes.heat.contrailV2.virtual.machine.subInterface.Properties + status: SUPPORTED + required: false + virtual_machine_interface_allowed_address_pairs: + description: Virtual Machine Sub Interface allowed address pairs. + type: org.openecomp.datatypes.heat.contrailV2.virtual.machine.subInterface.AddressPairs + status: SUPPORTED + required: false + virtual_machine_interface_mac_addresses: + description: List of mac addresses. + type: org.openecomp.datatypes.heat.contrailV2.virtual.machine.subInterface.MacAddress + status: SUPPORTED + required: false + security_group_refs: + description: List of security groups. + type: list + status: SUPPORTED + entry_schema: + type: string + required: false + port_tuple_refs: + description: List of port tuples. + type: list + status: SUPPORTED + entry_schema: + type: string + required: false + attributes: + fq_name: + description: The FQ name of the Virtual Network. + type: string + status: SUPPORTED + show: + description: All attributes. + type: string + status: SUPPORTED + requirements: + - binding: + capability: tosca.capabilities.network.Bindable + node: org.openecomp.resource.cp.nodes.network.Port + relationship: tosca.relationships.network.BindsTo + occurrences: + - 1 + - 1 \ No newline at end of file diff --git a/catalog-be/src/main/resources/import/tosca/heat-types/contrailV2VLANSubInterfaceV2/contrailV2VLANSubInterfaceV2.zip b/catalog-be/src/main/resources/import/tosca/heat-types/contrailV2VLANSubInterfaceV2/contrailV2VLANSubInterfaceV2.zip new file mode 100644 index 0000000000..cc65bf9f53 Binary files /dev/null and b/catalog-be/src/main/resources/import/tosca/heat-types/contrailV2VLANSubInterfaceV2/contrailV2VLANSubInterfaceV2.zip differ diff --git a/catalog-be/src/main/resources/import/tosca/heat-types/contrailV2VirtualMachineInterface/contrailV2VirtualMachineInterface.yml b/catalog-be/src/main/resources/import/tosca/heat-types/contrailV2VirtualMachineInterface/contrailV2VirtualMachineInterface.yml index a2179079b1..69e15ff488 100644 --- a/catalog-be/src/main/resources/import/tosca/heat-types/contrailV2VirtualMachineInterface/contrailV2VirtualMachineInterface.yml +++ b/catalog-be/src/main/resources/import/tosca/heat-types/contrailV2VirtualMachineInterface/contrailV2VirtualMachineInterface.yml @@ -62,4 +62,5 @@ node_types: - 0 - UNBOUNDED valid_source_types: - - org.openecomp.resources.cp.nodes.heat.network.contrailV2.VLANSubInterface \ No newline at end of file + - org.openecomp.resource.cp.nodes.heat.network.contrailV2.VLANSubInterface + - org.openecomp.resource.cp.nodes.heat.network.v2.contrailV2.VLANSubInterface \ No newline at end of file diff --git a/catalog-be/src/main/resources/import/tosca/heat-types/contrailV2VirtualMachineInterface/contrailV2VirtualMachineInterface.zip b/catalog-be/src/main/resources/import/tosca/heat-types/contrailV2VirtualMachineInterface/contrailV2VirtualMachineInterface.zip index 60950b65cc..856457979e 100644 Binary files a/catalog-be/src/main/resources/import/tosca/heat-types/contrailV2VirtualMachineInterface/contrailV2VirtualMachineInterface.zip and b/catalog-be/src/main/resources/import/tosca/heat-types/contrailV2VirtualMachineInterface/contrailV2VirtualMachineInterface.zip differ diff --git a/catalog-be/src/main/resources/import/tosca/heat-types/contrailV2VirtualNetwork/contrailV2VirtualNetwork.yml b/catalog-be/src/main/resources/import/tosca/heat-types/contrailV2VirtualNetwork/contrailV2VirtualNetwork.yml index 0fa7c94a63..cfff898077 100644 --- a/catalog-be/src/main/resources/import/tosca/heat-types/contrailV2VirtualNetwork/contrailV2VirtualNetwork.yml +++ b/catalog-be/src/main/resources/import/tosca/heat-types/contrailV2VirtualNetwork/contrailV2VirtualNetwork.yml @@ -1,4 +1,76 @@ tosca_definitions_version: tosca_simple_yaml_1_0_0 +metadata: + template_name: ContrailV2VirtualNetworkGlobalType + template_version: 1.0.0 +description: Contrail V2 Virtual Network Global Types +imports: + NetworkGlobalTypes: + file: NetworkGlobalTypesServiceTemplate.yaml + common_definitions: + file: CommonGlobalTypesServiceTemplate.yaml +data_types: + org.openecomp.datatypes.heat.contrailV2.virtual.network.rule.RefData: + derived_from: tosca.datatypes.Root + description: network policy refs data + properties: + network_policy_refs_data_sequence: + type: org.openecomp.datatypes.heat.contrailV2.virtual.network.rule.RefDataSequence + description: Network Policy ref data sequence + required: false + status: SUPPORTED + org.openecomp.datatypes.heat.contrailV2.virtual.network.rule.RefDataSequence: + derived_from: tosca.datatypes.Root + description: network policy refs data sequence + properties: + network_policy_refs_data_sequence_major: + type: integer + description: Network Policy ref data sequence Major + required: false + status: SUPPORTED + network_policy_refs_data_sequence_minor: + type: integer + description: Network Policy ref data sequence Minor + required: false + status: SUPPORTED + org.openecomp.datatypes.heat.contrailV2.virtual.network.rule.ref.data.IpamSubnet: + derived_from: tosca.datatypes.Root + description: Network Ipam Ref Data Subnet + properties: + network_ipam_refs_data_ipam_subnets_subnet_ip_prefix_len: + type: string + description: Network ipam refs data ipam subnets ip prefix len + required: false + status: SUPPORTED + network_ipam_refs_data_ipam_subnets_subnet_ip_prefix: + type: string + description: Network ipam refs data ipam subnets ip prefix + required: false + status: SUPPORTED + org.openecomp.datatypes.heat.contrailV2.virtual.network.rule.IpamRefData: + derived_from: tosca.datatypes.Root + description: Network Ipam Ref Data + properties: + network_ipam_refs_data_ipam_subnets: + type: list + description: Network ipam refs data ipam subnets + required: false + status: SUPPORTED + entry_schema: + type: org.openecomp.datatypes.heat.contrailV2.virtual.network.rule.ref.data.IpamSubnetList + org.openecomp.datatypes.heat.contrailV2.virtual.network.rule.ref.data.IpamSubnetList: + derived_from: tosca.datatypes.Root + description: Network Ipam Ref Data Subnet List + properties: + network_ipam_refs_data_ipam_subnets_subnet: + type: org.openecomp.datatypes.heat.contrailV2.virtual.network.rule.ref.data.IpamSubnet + description: Network ipam refs data ipam subnets + required: false + status: SUPPORTED + network_ipam_refs_data_ipam_subnets_addr_from_start: + type: string + description: Network ipam refs data ipam subnets addr from start + required: false + status: SUPPORTED node_types: org.openecomp.resource.vl.nodes.heat.network.contrailV2.VirtualNetwork: derived_from: org.openecomp.resource.vl.nodes.network.Network diff --git a/catalog-be/src/main/resources/import/tosca/heat-types/contrailVirtualNetwork/contrailVirtualNetwork.yml b/catalog-be/src/main/resources/import/tosca/heat-types/contrailVirtualNetwork/contrailVirtualNetwork.yml index c0d1f3dab2..f1ebbea138 100644 --- a/catalog-be/src/main/resources/import/tosca/heat-types/contrailVirtualNetwork/contrailVirtualNetwork.yml +++ b/catalog-be/src/main/resources/import/tosca/heat-types/contrailVirtualNetwork/contrailVirtualNetwork.yml @@ -1,4 +1,13 @@ tosca_definitions_version: tosca_simple_yaml_1_0_0 +metadata: + template_name: ContrailVirtualNetworkGlobalType + template_version: 1.0.0 +description: Contrail Virtual Network Global Types +imports: + NetworkGlobalTypes: + file: NetworkGlobalTypesServiceTemplate.yaml + common_definitions: + file: CommonGlobalTypesServiceTemplate.yaml node_types: org.openecomp.resource.vl.nodes.heat.network.contrail.VirtualNetwork: derived_from: org.openecomp.resource.vl.nodes.network.Network diff --git a/catalog-be/src/main/resources/import/tosca/heat-types/eline/eline.yml b/catalog-be/src/main/resources/import/tosca/heat-types/eline/eline.yml index 79876881cd..21241369c7 100644 --- a/catalog-be/src/main/resources/import/tosca/heat-types/eline/eline.yml +++ b/catalog-be/src/main/resources/import/tosca/heat-types/eline/eline.yml @@ -1,4 +1,5 @@ tosca_definitions_version: tosca_simple_yaml_1_0_0 + node_types: org.openecomp.resource.vl.ELine: derived_from: org.openecomp.resource.vl.VL diff --git a/catalog-be/src/main/resources/import/tosca/heat-types/eline/eline.zip b/catalog-be/src/main/resources/import/tosca/heat-types/eline/eline.zip index 8ba7cbceac..ea770f5042 100644 Binary files a/catalog-be/src/main/resources/import/tosca/heat-types/eline/eline.zip and b/catalog-be/src/main/resources/import/tosca/heat-types/eline/eline.zip differ diff --git a/catalog-be/src/main/resources/import/tosca/heat-types/extNeutronCP/extNeutronCP.yml b/catalog-be/src/main/resources/import/tosca/heat-types/extNeutronCP/extNeutronCP.yml index 35306f5b49..ad946fc8bd 100644 --- a/catalog-be/src/main/resources/import/tosca/heat-types/extNeutronCP/extNeutronCP.yml +++ b/catalog-be/src/main/resources/import/tosca/heat-types/extNeutronCP/extNeutronCP.yml @@ -135,6 +135,7 @@ node_types: type: tosca.capabilities.network.Bindable valid_source_types: - org.openecomp.resource.cp.nodes.heat.network.contrailV2.VLANSubInterface + - org.openecomp.resource.cp.nodes.heat.network.v2.contrailV2.VLANSubInterface occurrences: - 0 - UNBOUNDED \ No newline at end of file diff --git a/catalog-be/src/main/resources/import/tosca/heat-types/extNeutronCP/extNeutronCP.zip b/catalog-be/src/main/resources/import/tosca/heat-types/extNeutronCP/extNeutronCP.zip index 02b62a69da..944dfb71fc 100644 Binary files a/catalog-be/src/main/resources/import/tosca/heat-types/extNeutronCP/extNeutronCP.zip and b/catalog-be/src/main/resources/import/tosca/heat-types/extNeutronCP/extNeutronCP.zip differ diff --git a/catalog-be/src/main/resources/import/tosca/heat-types/extVirtualMachineInterfaceCP/extVirtualMachineInterfaceCP.json b/catalog-be/src/main/resources/import/tosca/heat-types/extVirtualMachineInterfaceCP/extVirtualMachineInterfaceCP.json new file mode 100644 index 0000000000..1e4e15fbe9 --- /dev/null +++ b/catalog-be/src/main/resources/import/tosca/heat-types/extVirtualMachineInterfaceCP/extVirtualMachineInterfaceCP.json @@ -0,0 +1,21 @@ +{ + "payloadName": "extVirtualMachineInterfaceCP.yml", + "contactId": "jh0003", + "name": "extVirtualMachineInterfaceCP", + "description": "External port for virtual machine interface", + "resourceIconPath": "network", + "resourceType": "CP", + "categories": [ + { + "name": "Generic", + "subcategories": [ + { + "name": "Network Elements" + } + ] + } + ], + "tags": [ + "extVirtualMachineInterfaceCP" + ] +} diff --git a/catalog-be/src/main/resources/import/tosca/heat-types/extVirtualMachineInterfaceCP/extVirtualMachineInterfaceCP.yml b/catalog-be/src/main/resources/import/tosca/heat-types/extVirtualMachineInterfaceCP/extVirtualMachineInterfaceCP.yml new file mode 100644 index 0000000000..6816e7b299 --- /dev/null +++ b/catalog-be/src/main/resources/import/tosca/heat-types/extVirtualMachineInterfaceCP/extVirtualMachineInterfaceCP.yml @@ -0,0 +1,67 @@ + +tosca_definitions_version: tosca_simple_yaml_1_0_0 +node_types: + org.openecomp.resource.cp.v2.extVirtualMachineInterfaceCP: + derived_from: org.openecomp.resource.cp.v2.extCP + properties: + name: + description: Virtual Machine Interface name + type: string + status: SUPPORTED + required: false + security_group_refs: + description: List of security groups. + type: list + status: SUPPORTED + entry_schema: + type: string + required: false + virtual_network_refs: + description: List of virtual networks. + type: list + status: SUPPORTED + entry_schema: + type: string + required: false + virtual_machine_interface_properties: + description: virtual machine interface properties. + type: org.openecomp.datatypes.heat.contrailV2.virtual.machine.interface.Properties + status: SUPPORTED + required: false + port_tuple_refs: + description: List of port tuples. + type: list + status: SUPPORTED + entry_schema: + type: string + required: false + virtual_machine_interface_mac_addresses: + description: List of mac addresses. + type: list + status: SUPPORTED + entry_schema: + type: string + required: false + virtual_machine_interface_allowed_address_pairs: + description: Virtual Machine Interface allowed address pairs. + type: org.openecomp.datatypes.heat.contrailV2.virtual.machine.subInterface.AddressPairs + status: SUPPORTED + required: false + attributes: + fq_name: + description: The FQ name of the Virtual Network. + type: string + status: SUPPORTED + show: + description: All attributes. + type: string + status: SUPPORTED + capabilities: + binding: + type: tosca.capabilities.network.Bindable + occurrences: + - 0 + - UNBOUNDED + valid_source_types: + - org.openecomp.resource.cp.nodes.heat.network.contrailV2.VLANSubInterface + - org.openecomp.resource.cp.nodes.heat.network.v2.contrailV2.VLANSubInterface \ No newline at end of file diff --git a/catalog-be/src/main/resources/import/tosca/heat-types/extVirtualMachineInterfaceCP/extVirtualMachineInterfaceCP.zip b/catalog-be/src/main/resources/import/tosca/heat-types/extVirtualMachineInterfaceCP/extVirtualMachineInterfaceCP.zip new file mode 100644 index 0000000000..4edd5b3314 Binary files /dev/null and b/catalog-be/src/main/resources/import/tosca/heat-types/extVirtualMachineInterfaceCP/extVirtualMachineInterfaceCP.zip differ diff --git a/catalog-be/src/main/resources/import/tosca/heat-types/fabricConfiguration/fabricConfiguration.json b/catalog-be/src/main/resources/import/tosca/heat-types/fabricConfiguration/fabricConfiguration.json new file mode 100644 index 0000000000..ee48a778a1 --- /dev/null +++ b/catalog-be/src/main/resources/import/tosca/heat-types/fabricConfiguration/fabricConfiguration.json @@ -0,0 +1,21 @@ +{ + "payloadName": "fabricConfiguration.yml", + "contactId": "jh0003", + "name": "Fabric Configuration", + "description": "A fabric Configuration object", + "resourceIconPath": "pmc", + "resourceType": "Configuration", + "categories": [ + { + "name": "Configuration", + "subcategories": [ + { + "name": "Configuration" + } + ] + } + ], + "tags": [ + "Fabric Configuration" + ] +} \ No newline at end of file diff --git a/catalog-be/src/main/resources/import/tosca/heat-types/fabricConfiguration/fabricConfiguration.yml b/catalog-be/src/main/resources/import/tosca/heat-types/fabricConfiguration/fabricConfiguration.yml new file mode 100644 index 0000000000..18658b916b --- /dev/null +++ b/catalog-be/src/main/resources/import/tosca/heat-types/fabricConfiguration/fabricConfiguration.yml @@ -0,0 +1,10 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 +node_types: + org.openecomp.nodes.FabricConfiguration: + derived_from: org.openecomp.nodes.Configuration + requirements: + - fabric_configuration_monitoring: + capability: org.openecomp.capabilities.FabricConfiguration + occurrences: + - 1 + - UNBOUNDED \ No newline at end of file diff --git a/catalog-be/src/main/resources/import/tosca/heat-types/fabricConfiguration/fabricConfiguration.zip b/catalog-be/src/main/resources/import/tosca/heat-types/fabricConfiguration/fabricConfiguration.zip new file mode 100644 index 0000000000..15088d9091 Binary files /dev/null and b/catalog-be/src/main/resources/import/tosca/heat-types/fabricConfiguration/fabricConfiguration.zip differ diff --git a/catalog-be/src/main/resources/import/tosca/heat-types/globalCompute/globalCompute.yml b/catalog-be/src/main/resources/import/tosca/heat-types/globalCompute/globalCompute.yml index 4ac9950ee2..ee7ced6a44 100644 --- a/catalog-be/src/main/resources/import/tosca/heat-types/globalCompute/globalCompute.yml +++ b/catalog-be/src/main/resources/import/tosca/heat-types/globalCompute/globalCompute.yml @@ -1,4 +1,11 @@ tosca_definitions_version: tosca_simple_yaml_1_0_0 +metadata: + template_name: ComputeGlobalTypes + template_version: 1.0.0 +description: Compute TOSCA Global Types +imports: + common_definitions: + file: CommonGlobalTypesServiceTemplate.yaml node_types: org.openecomp.resource.vfc.nodes.Compute: derived_from: tosca.nodes.Compute diff --git a/catalog-be/src/main/resources/import/tosca/heat-types/globalCompute/globalCompute.zip b/catalog-be/src/main/resources/import/tosca/heat-types/globalCompute/globalCompute.zip index 23a471f246..a04df59514 100644 Binary files a/catalog-be/src/main/resources/import/tosca/heat-types/globalCompute/globalCompute.zip and b/catalog-be/src/main/resources/import/tosca/heat-types/globalCompute/globalCompute.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 791a0b9a3b..c0fd672ee9 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 @@ -35,6 +35,11 @@ node_types: type: org.openecomp.datatypes.Naming subnetpoolid: type: string + subinterface_indicator: + description: identifies if Port is having Sub Interface + type: boolean + required: false + default: false capabilities: network.incoming.packets.rate: type: org.openecomp.capabilities.metric.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 efeafe824e..b0929ff6a0 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/heat-types/multiFlavorVFC/multiFlavorVFC.zip b/catalog-be/src/main/resources/import/tosca/heat-types/multiFlavorVFC/multiFlavorVFC.zip index d73488d0c0..9edb9f53c0 100644 Binary files a/catalog-be/src/main/resources/import/tosca/heat-types/multiFlavorVFC/multiFlavorVFC.zip and b/catalog-be/src/main/resources/import/tosca/heat-types/multiFlavorVFC/multiFlavorVFC.zip differ diff --git a/catalog-be/src/main/resources/import/tosca/heat-types/neutronNet/neutronNet.yml b/catalog-be/src/main/resources/import/tosca/heat-types/neutronNet/neutronNet.yml index 539e33991f..f5cf4fc642 100644 --- a/catalog-be/src/main/resources/import/tosca/heat-types/neutronNet/neutronNet.yml +++ b/catalog-be/src/main/resources/import/tosca/heat-types/neutronNet/neutronNet.yml @@ -1,4 +1,13 @@ tosca_definitions_version: tosca_simple_yaml_1_0_0 +metadata: + template_name: NeutronNetGlobalTypes + template_version: 1.0.0 +description: Neutron Network TOSCA Global Types +imports: + NetworkGlobalTypes: + file: NetworkGlobalTypesServiceTemplate.yaml + common_definitions: + file: CommonGlobalTypesServiceTemplate.yaml node_types: org.openecomp.resource.vl.nodes.heat.network.neutron.Net: derived_from: org.openecomp.resource.vl.nodes.network.Network diff --git a/catalog-be/src/main/resources/import/tosca/heat-types/neutronPort/neutronPort.yml b/catalog-be/src/main/resources/import/tosca/heat-types/neutronPort/neutronPort.yml index 34a74eb4c4..9451698add 100644 --- a/catalog-be/src/main/resources/import/tosca/heat-types/neutronPort/neutronPort.yml +++ b/catalog-be/src/main/resources/import/tosca/heat-types/neutronPort/neutronPort.yml @@ -1,4 +1,28 @@ tosca_definitions_version: tosca_simple_yaml_1_0_0 +metadata: + template_name: NeutronPortGlobalTypes + template_version: 1.0.0 +description: Neutron Port TOSCA Global Types +imports: + common_definitions: + file: CommonGlobalTypesServiceTemplate.yaml + PortGlobalTypes: + file: PortGlobalTypesServiceTemplate.yaml +data_types: + org.openecomp.datatypes.heat.neutron.port.FixedIps: + derived_from: tosca.datatypes.Root + description: subnet/ip_address + properties: + subnet: + type: string + description: Subnet in which to allocate the IP address for this port + required: false + status: SUPPORTED + ip_address: + type: string + description: IP address desired in the subnet for this port + required: false + status: SUPPORTED node_types: org.openecomp.resource.cp.nodes.heat.network.neutron.Port: derived_from: org.openecomp.resource.cp.nodes.network.Port @@ -131,6 +155,7 @@ node_types: type: tosca.capabilities.network.Bindable valid_source_types: - org.openecomp.resource.cp.nodes.heat.network.contrailV2.VLANSubInterface + - org.openecomp.resource.cp.nodes.heat.network.v2.contrailV2.VLANSubInterface occurrences: - 0 - UNBOUNDED \ No newline at end of file diff --git a/catalog-be/src/main/resources/import/tosca/heat-types/neutronPort/neutronPort.zip b/catalog-be/src/main/resources/import/tosca/heat-types/neutronPort/neutronPort.zip index e33365a8ca..5f33401e6b 100644 Binary files a/catalog-be/src/main/resources/import/tosca/heat-types/neutronPort/neutronPort.zip and b/catalog-be/src/main/resources/import/tosca/heat-types/neutronPort/neutronPort.zip differ diff --git a/catalog-be/src/main/resources/import/tosca/heat-types/novaServer/novaServer.yml b/catalog-be/src/main/resources/import/tosca/heat-types/novaServer/novaServer.yml index 2271c9cd06..1cbf98b1cd 100644 --- a/catalog-be/src/main/resources/import/tosca/heat-types/novaServer/novaServer.yml +++ b/catalog-be/src/main/resources/import/tosca/heat-types/novaServer/novaServer.yml @@ -1,4 +1,74 @@ tosca_definitions_version: tosca_simple_yaml_1_0_0 +metadata: + template_name: NovaServerGlobalTypes + template_version: 1.0.0 +description: Nova Server TOSCA Global Types +imports: + ComputeGlobalTypes: + file: ComputeGlobalTypesServiceTemplate.yaml + common_definitions: + file: CommonGlobalTypesServiceTemplate.yaml +data_types: + org.openecomp.datatypes.heat.novaServer.network.PortExtraProperties: + derived_from: tosca.datatypes.Root + description: Nova server network expand properties for port + properties: + port_security_enabled: + type: boolean + description: Flag to enable/disable port security on the port + required: false + status: SUPPORTED + mac_address: + type: string + description: MAC address to give to this port + required: false + status: SUPPORTED + admin_state_up: + type: boolean + description: The administrative state of this port + required: false + default: true + status: SUPPORTED + qos_policy: + type: string + description: The name or ID of QoS policy to attach to this port + required: false + status: SUPPORTED + allowed_address_pairs: + type: list + description: Additional MAC/IP address pairs allowed to pass through the port + required: false + status: SUPPORTED + entry_schema: + type: org.openecomp.datatypes.heat.network.AddressPair + binding:vnic_type: + type: string + description: The vnic type to be bound on the neutron port + required: false + status: SUPPORTED + constraints: + - valid_values: + - macvtap + - direct + - normal + value_specs: + type: map + description: Extra parameters to include in the request + required: false + default: { + } + status: SUPPORTED + entry_schema: + type: string + org.openecomp.datatypes.heat.novaServer.network.AddressInfo: + derived_from: tosca.datatypes.network.NetworkInfo + description: Network addresses with corresponding port id + properties: + port_id: + type: string + description: Port id + required: false + status: SUPPORTED node_types: org.openecomp.resource.vfc.nodes.heat.nova.Server: derived_from: org.openecomp.resource.vfc.nodes.Compute diff --git a/catalog-be/src/main/resources/import/tosca/heat-types/portMirroring/portMirroring.zip b/catalog-be/src/main/resources/import/tosca/heat-types/portMirroring/portMirroring.zip index cbed61fcf5..ca5650b8c9 100644 Binary files a/catalog-be/src/main/resources/import/tosca/heat-types/portMirroring/portMirroring.zip and b/catalog-be/src/main/resources/import/tosca/heat-types/portMirroring/portMirroring.zip differ diff --git a/catalog-be/src/main/resources/import/tosca/heat-types/portMirroringByPolicy/portMirroringByPolicy.zip b/catalog-be/src/main/resources/import/tosca/heat-types/portMirroringByPolicy/portMirroringByPolicy.zip index a11e4f7842..7a4ce51cfb 100644 Binary files a/catalog-be/src/main/resources/import/tosca/heat-types/portMirroringByPolicy/portMirroringByPolicy.zip and b/catalog-be/src/main/resources/import/tosca/heat-types/portMirroringByPolicy/portMirroringByPolicy.zip differ diff --git a/catalog-be/src/main/resources/import/tosca/heat-types/securityRules/securityRules.yml b/catalog-be/src/main/resources/import/tosca/heat-types/securityRules/securityRules.yml index 876b2f1388..8fd19097ef 100644 --- a/catalog-be/src/main/resources/import/tosca/heat-types/securityRules/securityRules.yml +++ b/catalog-be/src/main/resources/import/tosca/heat-types/securityRules/securityRules.yml @@ -1,4 +1,11 @@ tosca_definitions_version: tosca_simple_yaml_1_0_0 +metadata: + template_name: NeutronSecurityRulesGlobalTypes + template_version: 1.0.0 +description: Neutron Security Rules TOSCA Global Types +imports: + common_definitions: + file: CommonGlobalTypesServiceTemplate.yaml node_types: org.openecomp.resource.vfc.rules.nodes.heat.network.neutron.SecurityRules: derived_from: tosca.nodes.Root diff --git a/catalog-be/src/main/resources/import/tosca/heat-types/serviceProxy/serviceProxy.zip b/catalog-be/src/main/resources/import/tosca/heat-types/serviceProxy/serviceProxy.zip index 9f0b60d1df..55ffe94d99 100644 Binary files a/catalog-be/src/main/resources/import/tosca/heat-types/serviceProxy/serviceProxy.zip and b/catalog-be/src/main/resources/import/tosca/heat-types/serviceProxy/serviceProxy.zip differ diff --git a/catalog-be/src/main/resources/import/tosca/heat-types/subInterface/subInterface.yml b/catalog-be/src/main/resources/import/tosca/heat-types/subInterface/subInterface.yml index 2356f82995..6f2d26afb9 100644 --- a/catalog-be/src/main/resources/import/tosca/heat-types/subInterface/subInterface.yml +++ b/catalog-be/src/main/resources/import/tosca/heat-types/subInterface/subInterface.yml @@ -1,4 +1,11 @@ tosca_definitions_version: tosca_simple_yaml_1_0_0 +metadata: + template_name: SubInterfaceGlobalTypes + template_version: 1.0.0 +description: Sub Interafce TOSCA Global Types +imports: + common_definitions: + file: CommonGlobalTypesServiceTemplate.yaml node_types: org.openecomp.resource.cp.nodes.network.SubInterface: derived_from: tosca.nodes.network.Port \ No newline at end of file diff --git a/catalog-be/src/main/resources/import/tosca/heat-types/subInterfaceV2/subInterfaceV2.json b/catalog-be/src/main/resources/import/tosca/heat-types/subInterfaceV2/subInterfaceV2.json new file mode 100644 index 0000000000..2b7d98c171 --- /dev/null +++ b/catalog-be/src/main/resources/import/tosca/heat-types/subInterfaceV2/subInterfaceV2.json @@ -0,0 +1,15 @@ +{ + "payloadName": "subInterfaceV2.yml", + "contactId": "jh0003", + "name": "subInterfaceV2", + "description": "VLAN sub-Interface is a logical port which must be binded to a port. Regular port may have 1…N VLAN Interfaces.It can connect to its own network (regardless of the network the parent port can connect)", + "resourceIconPath": "network", + "resourceType": "CP", + "categories": [{ + "name": "Generic", + "subcategories": [{ + "name": "Network Elements" + }] + }], + "tags": ["subInterfaceV2"] +} \ No newline at end of file diff --git a/catalog-be/src/main/resources/import/tosca/heat-types/subInterfaceV2/subInterfaceV2.yml b/catalog-be/src/main/resources/import/tosca/heat-types/subInterfaceV2/subInterfaceV2.yml new file mode 100644 index 0000000000..7c19089242 --- /dev/null +++ b/catalog-be/src/main/resources/import/tosca/heat-types/subInterfaceV2/subInterfaceV2.yml @@ -0,0 +1,45 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 +node_types: + org.openecomp.resource.cp.nodes.network.v2.SubInterface: + derived_from: tosca.nodes.Root + properties: + ip_address: + description: Allow the user to set a fixed IP address. Note that this address is a request to the provider which they will attempt to fulfill but may not be able to dependent on the network the port is associated with. + type: string + required: false + order: + description: 'The order of the NIC on the compute instance (e.g. eth2). Note: + when binding more than one port to a single compute (aka multi vNICs) and + ordering is desired, it is *mandatory* that all ports will be set with an + order value and. The order values must represent a positive, arithmetic + progression that starts with 0 (e.g. 0, 1, 2, ..., n).' + type: integer + default: 0 + required: false + constraints: + - greater_or_equal: 0 + is_default: + description: Set is_default=true to apply a default gateway route on the running compute instance to the associated network gateway. Only one port that is associated to single compute node can set as default=true. + type: boolean + default: false + required: false + ip_range_start: + description: Defines the starting IP of a range to be allocated for the compute instances that are associated by this Port. Without setting this property the IP allocation is done from the entire CIDR block of the network. + type: string + required: false + ip_range_end: + description: Defines the ending IP of a range to be allocated for the compute instances that are associated by this Port. Without setting this property the IP allocation is done from the entire CIDR block of the network. + type: string + required: false + attributes: + ip_address: + description: The IP address would be assigned to the associated compute instance. + type: string + requirements: + - subinterface_link: + capability: tosca.capabilities.network.Linkable + relationship: tosca.relationships.network.LinksTo + - binding: + capability: tosca.capabilities.network.Bindable + relationship: tosca.relationships.network.BindsTo + diff --git a/catalog-be/src/main/resources/import/tosca/heat-types/subInterfaceV2/subInterfaceV2.zip b/catalog-be/src/main/resources/import/tosca/heat-types/subInterfaceV2/subInterfaceV2.zip new file mode 100644 index 0000000000..fc34ec54ff Binary files /dev/null and b/catalog-be/src/main/resources/import/tosca/heat-types/subInterfaceV2/subInterfaceV2.zip differ diff --git a/catalog-be/src/main/resources/import/tosca/heat-types/vnfConfiguration/vnfConfiguration.zip b/catalog-be/src/main/resources/import/tosca/heat-types/vnfConfiguration/vnfConfiguration.zip index 03a7d535f2..eb763dadf4 100644 Binary files a/catalog-be/src/main/resources/import/tosca/heat-types/vnfConfiguration/vnfConfiguration.zip and b/catalog-be/src/main/resources/import/tosca/heat-types/vnfConfiguration/vnfConfiguration.zip differ diff --git a/catalog-be/src/main/resources/import/tosca/interface-lifecycle-types/interfaceLifecycleTypes.zip b/catalog-be/src/main/resources/import/tosca/interface-lifecycle-types/interfaceLifecycleTypes.zip index 574a4844d3..f9894d68bf 100644 Binary files a/catalog-be/src/main/resources/import/tosca/interface-lifecycle-types/interfaceLifecycleTypes.zip and b/catalog-be/src/main/resources/import/tosca/interface-lifecycle-types/interfaceLifecycleTypes.zip differ diff --git a/catalog-be/src/main/resources/import/tosca/normative-types/loadBalancer/loadBalancer.zip b/catalog-be/src/main/resources/import/tosca/normative-types/loadBalancer/loadBalancer.zip index 3a847c6f56..3ae6e5d076 100644 Binary files a/catalog-be/src/main/resources/import/tosca/normative-types/loadBalancer/loadBalancer.zip and b/catalog-be/src/main/resources/import/tosca/normative-types/loadBalancer/loadBalancer.zip differ diff --git a/catalog-be/src/main/resources/import/tosca/policy-types/policyTypes.json b/catalog-be/src/main/resources/import/tosca/policy-types/policyTypes.json new file mode 100644 index 0000000000..9f97d5586b --- /dev/null +++ b/catalog-be/src/main/resources/import/tosca/policy-types/policyTypes.json @@ -0,0 +1,51 @@ +{ + "tosca.policies.Root": { + "displayName": "Root", + "icon": "policy-root" + }, + "tosca.policies.Placement": { + "displayName": "Placement", + "icon": "policy-placement" + }, + "tosca.policies.Scaling": { + "displayName": "Scaling", + "icon": "policy-scaling" + }, + "tosca.policies.Update": { + "displayName": "Update", + "icon": "policy-update" + }, + "tosca.policies.Performance": { + "displayName": "Performance", + "icon": "policy-performance" + }, + "org.openecomp.policies.placement.Antilocate": { + "displayName": "Placement Antilocate", + "icon": "policy-placement-antilocate" + }, + "org.openecomp.policies.placement.Colocate": { + "displayName": "Placement Colocate", + "icon": "policy-placement-colocate" + }, + "org.openecomp.policies.placement.valet.Diversity": { + "displayName": "Placement Valet Diversity", + "icon": "policy-placement-valet-diversity" + }, + "org.openecomp.policies.placement.valet.Exclusivity": { + "displayName": "Placement Valet Exclusivity", + "icon": "policy-placement-valet-exclusivity" + }, + "org.openecomp.policies.placement.valet.Affinity": { + "displayName": "Placement Valet Affinity", + "icon": "placement-valet-affinity" + }, + "org.openecomp.policies.scaling.Fixed": { + "displayName": "Scaling Fixed", + "icon": "policy-fixed" + }, + "org.openecomp.policies.External": { + "displayName": "External", + "icon": "policy-external" + } + +} \ No newline at end of file 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 fa4d5b7671..2ed8c0e785 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 @@ -1,106 +1,106 @@ - tosca.relationships.Root: - description: This is the default (root) TOSCA Relationship Type definition that all other TOSCA Relationship Types derive from. - attributes: - tosca_id: - description: A unique identifier of the realized instance of a Relationship Template that derives from any TOSCA normative type. - type: string - tosca_name: - description: This attribute reflects the name of the Relationship Template as defined in the TOSCA service template. This name is not unique to the realized instance model of corresponding deployed application as each template in the model can result in one or more instances (e.g., scaled) when orchestrated to a provider environment. - type: string - state: - description: The state of the relationship instance. - type: string - default: initial - interfaces: - Configure: - type: tosca.interfaces.relationship.Configure +tosca.relationships.Root: + description: This is the default (root) TOSCA Relationship Type definition that all other TOSCA Relationship Types derive from. + attributes: + tosca_id: + description: A unique identifier of the realized instance of a Relationship Template that derives from any TOSCA normative type. + type: string + tosca_name: + description: This attribute reflects the name of the Relationship Template as defined in the TOSCA service template. This name is not unique to the realized instance model of corresponding deployed application as each template in the model can result in one or more instances (e.g., scaled) when orchestrated to a provider environment. + type: string + state: + description: The state of the relationship instance. + type: string + default: initial + interfaces: + Configure: + type: tosca.interfaces.relationship.Configure - tosca.relationships.RoutesTo: - derived_from: tosca.relationships.ConnectsTo - description: This type represents an intentional network routing between two Endpoints in different networks. - valid_target_types: - - tosca.capabilities.Endpoint +tosca.relationships.RoutesTo: + derived_from: tosca.relationships.ConnectsTo + description: This type represents an intentional network routing between two Endpoints in different networks. + valid_target_types: + - tosca.capabilities.Endpoint - tosca.relationships.network.LinksTo: - derived_from: tosca.relationships.DependsOn - description: This relationship type represents an association relationship between Port and Network node types. - valid_target_types: - - tosca.capabilities.network.Linkable +tosca.relationships.network.LinksTo: + derived_from: tosca.relationships.DependsOn + description: This relationship type represents an association relationship between Port and Network node types. + valid_target_types: + - tosca.capabilities.network.Linkable - tosca.relationships.AttachesTo: - derived_from: tosca.relationships.Root - description: This type represents an attachment relationship between two nodes. For example, an AttachesTo relationship type would be used for attaching a storage node to a Compute node. - valid_target_types: - - tosca.capabilities.Attachment - properties: - location: - description: 'The relative location (e.g., path on the file system), which - provides the root location to address an attached node. e.g., a mount point - / path such as ''/usr/data''. Note: The user must provide it and it cannot - be "root".' - type: string - constraints: - - min_length: 1 - device: - description: The logical device name which for the attached device (which is represented by the target node in the model). e.g., '/dev/hda1'. - type: string - required: false - attributes: - device: - description: 'The logical name of the device as exposed to the instance. Note: - A runtime property that gets set when the model gets instantiated by the - orchestrator.' - type: string +tosca.relationships.AttachesTo: + derived_from: tosca.relationships.Root + description: This type represents an attachment relationship between two nodes. For example, an AttachesTo relationship type would be used for attaching a storage node to a Compute node. + valid_target_types: + - tosca.capabilities.Attachment + properties: + location: + description: 'The relative location (e.g., path on the file system), which + provides the root location to address an attached node. e.g., a mount point + / path such as ''/usr/data''. Note: The user must provide it and it cannot + be "root".' + type: string + constraints: + - min_length: 1 + device: + description: The logical device name which for the attached device (which is represented by the target node in the model). e.g., '/dev/hda1'. + type: string + required: false + attributes: + device: + description: 'The logical name of the device as exposed to the instance. Note: + A runtime property that gets set when the model gets instantiated by the + orchestrator.' + type: string - tosca.relationships.network.BindsTo: - derived_from: tosca.relationships.DependsOn - description: This type represents a network association relationship between Port and Compute node types. - valid_target_types: - - tosca.capabilities.network.Bindable +tosca.relationships.network.BindsTo: + derived_from: tosca.relationships.DependsOn + description: This type represents a network association relationship between Port and Compute node types. + valid_target_types: + - tosca.capabilities.network.Bindable - tosca.relationships.HostedOn: - derived_from: tosca.relationships.Root - description: This type represents a hosting relationship between two nodes. - valid_target_types: - - tosca.capabilities.Container +tosca.relationships.HostedOn: + derived_from: tosca.relationships.Root + description: This type represents a hosting relationship between two nodes. + valid_target_types: + - tosca.capabilities.Container - tosca.relationships.DependsOn: - derived_from: tosca.relationships.Root - description: This type represents a general dependency relationship between two nodes. - valid_target_types: - - tosca.capabilities.Node +tosca.relationships.DependsOn: + derived_from: tosca.relationships.Root + description: This type represents a general dependency relationship between two nodes. + valid_target_types: + - tosca.capabilities.Node - tosca.relationships.ConnectsTo: - derived_from: tosca.relationships.Root - description: This type represents a network connection relationship between two nodes. - valid_target_types: - - tosca.capabilities.Endpoint - properties: - credential: - type: tosca.datatypes.Credential - required: false +tosca.relationships.ConnectsTo: + derived_from: tosca.relationships.Root + description: This type represents a network connection relationship between two nodes. + valid_target_types: + - tosca.capabilities.Endpoint + properties: + credential: + type: tosca.datatypes.Credential + required: false - org.openecomp.relationships.VolumeAttachesTo: - derived_from: org.openecomp.relationships.AttachesTo - description: This type represents an attachment relationship for associating volume - properties: - volume_id: - description: The ID of the volume to be attached - type: string - status: SUPPORTED - required: true - instance_uuid: - description: The ID of the server to which the volume attaches - type: string - status: SUPPORTED - required: true - attributes: - show: - description: Detailed information about resource - type: string - status: SUPPORTED +org.openecomp.relationships.VolumeAttachesTo: + derived_from: org.openecomp.relationships.AttachesTo + description: This type represents an attachment relationship for associating volume + properties: + volume_id: + description: The ID of the volume to be attached + type: string + status: SUPPORTED + required: true + instance_uuid: + description: The ID of the server to which the volume attaches + type: string + status: SUPPORTED + required: true + attributes: + show: + description: Detailed information about resource + type: string + status: SUPPORTED - org.openecomp.relationships.AttachesTo: +org.openecomp.relationships.AttachesTo: derived_from: tosca.relationships.AttachesTo description: This type represents an attachment relationship properties: @@ -109,17 +109,21 @@ type: string status: SUPPORTED required: false - org.openecomp.relationships.ForwardsTo: +org.openecomp.relationships.ForwardsTo: + derived_from: tosca.relationships.Root + valid_target_types: [org.openecomp.capabilities.Forwarder] +org.openecomp.relationships.AssignsTo: derived_from: tosca.relationships.Root - valid_target_types: - - org.openecomp.capabilities.Forwarder +org.openecomp.relationships.RoutesTo: + derived_from: tosca.relationships.RoutesTo + description: This type represents an intentional network routing between internal and external network - tosca.relationships.nfv.VirtualBindsTo: +tosca.relationships.nfv.VirtualBindsTo: derived_from: tosca.relationships.DependsOn valid_target_types: - tosca.capabilities.nfv.VirtualBindable - tosca.relationships.nfv.VirtualLinksTo: +tosca.relationships.nfv.VirtualLinksTo: derived_from: tosca.relationships.DependsOn valid_target_types: - tosca.capabilities.nfv.VirtualLinkable \ 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 bc709874a0..5db20abb4d 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/importAnnotationTypes.py b/catalog-be/src/main/resources/scripts/import/tosca/importAnnotationTypes.py new file mode 100644 index 0000000000..5f0d4ad421 --- /dev/null +++ b/catalog-be/src/main/resources/scripts/import/tosca/importAnnotationTypes.py @@ -0,0 +1,35 @@ +import sys + +from importCommon import parse_cmd_line_params +from importNormativeElements import import_element + +IMPORT_ANNOTATION_URL = "/sdc2/rest/v1/catalog/uploadType/annotationtypes" +ANNOTATION_FILE_PATH = "../../../import/tosca/annotation-types/" +ANNOTATION_ZIP_FILE = "annotationTypesZip" +ANNOTATION_ELEMENT_NAME = "annotationTypes" + +##################################################################################################################################################################################### +# # +# Import tosca data types # +# # +# activation : # +# python importAnnotaionTypes.py [-s | --scheme= ] [-i | --ip=] [-p | --port= ] [-f | --ifile= ] # +# # +# shortest activation (be host = localhost, be port = 8080): # +# python importAnnotaionTypes.py [-f | --ifile= ] # +# # +##################################################################################################################################################################################### + + +def import_annotation_types(scheme, be_host, be_port, admin_user, exit_on_success): + import_element(scheme, be_host, be_port, admin_user, exit_on_success, ANNOTATION_FILE_PATH, IMPORT_ANNOTATION_URL, + ANNOTATION_ELEMENT_NAME, ANNOTATION_ZIP_FILE) + + +def main(argv): + scheme, be_host, be_port, admin_user = parse_cmd_line_params(argv) + import_annotation_types(scheme, be_host, be_port, admin_user, True) + + +if __name__ == "__main__": + main(sys.argv[1:]) 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 2f3237173c..9ef8b4a200 100644 --- a/catalog-be/src/main/resources/scripts/import/tosca/importCategoryTypes.py +++ b/catalog-be/src/main/resources/scripts/import/tosca/importCategoryTypes.py @@ -25,15 +25,15 @@ def usage(): 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]) - printFrameLine() + print_frame_line() + print_name_and_return_code(result[0], result[1]) + print_frame_line() if ( result[1] == None or result[1] not in [200, 201, 409] ): - errorAndExit(1, None) + error_and_exit(1, None) else: if (exitOnSuccess == True): - errorAndExit(0, None) + error_and_exit(0, None) def main(argv): print 'Number of arguments:', len(sys.argv), 'arguments.' @@ -47,7 +47,7 @@ def main(argv): opts, args = getopt.getopt(argv,"i:p:u:h:s:",["ip=","port=","user=","scheme="]) except getopt.GetoptError: usage() - errorAndExit(2, 'Invalid input') + error_and_exit(2, 'Invalid input') for opt, arg in opts: #print opt, arg diff --git a/catalog-be/src/main/resources/scripts/import/tosca/importCommon.py b/catalog-be/src/main/resources/scripts/import/tosca/importCommon.py index acdb067849..ed92ca8b3d 100644 --- a/catalog-be/src/main/resources/scripts/import/tosca/importCommon.py +++ b/catalog-be/src/main/resources/scripts/import/tosca/importCommon.py @@ -11,33 +11,79 @@ import copy debugFlag = True + def join_strings(lst): concat = "" for string in lst: - if (string != None): - if (type(string) == int): - string = str(string) - concat += (string + " ") + if string is not None: + if type(string) == int: + string = str(string) + concat += (string + " ") return concat + def debug(desc, *args): - 'print only if debug enabled' - if (debugFlag == True): - print desc, join_strings(args) + if debugFlag: + print desc, join_strings(args) + def log(desc, arg=None): - 'print log info' - print desc, arg + print desc, arg + + +def error_and_exit(error_code, error_desc): + if error_code > 0: + print "status={0}. {1}".format(error_code, '' if error_desc is None else error_desc) + else: + print "status={0}".format(error_code) + sys.exit(error_code) + + +def print_name_and_return_code(name, code): + print "{0:30} | {1:6}".format(name, code) + + +def print_frame_line(): + print "----------------------------------------" + + +def parse_cmd_line_params(argv): + print 'Number of arguments:', len(sys.argv), 'arguments.' + + be_host = 'localhost' + be_port = '8080' + admin_user = 'jh0003' + scheme = 'http' + + try: + opts, args = getopt.getopt(argv, "i:p:u:h:s:", ["ip=", "port=", "user=", "scheme="]) + except getopt.GetoptError: + usage() + error_and_exit(2, 'Invalid input') + + for opt, arg in opts: + # print opt, arg + if opt == '-h': + usage() + sys.exit(3) + elif opt in ("-i", "--ip"): + be_host = arg + elif opt in ("-p", "--port"): + be_port = arg + elif opt in ("-u", "--user"): + admin_user = arg + elif opt in ("-s", "--scheme"): + scheme = arg + + print 'scheme =', scheme, ', be host =', be_host, ', be port =', be_port, ', user =', admin_user -def errorAndExit(errorCode, errorDesc): - if ( errorCode > 0 ): - print "status={0}. {1}".format(errorCode, '' if errorDesc == None else errorDesc) - else: - print "status={0}".format(errorCode) - sys.exit(errorCode) + if be_host is None: + usage() + sys.exit(3) + return scheme, be_host, be_port, admin_user -def printNameAndReturnCode(name, code): - print "{0:30} | {1:6}".format(name, code) -def printFrameLine(): - print "----------------------------------------" +def usage(): + print sys.argv[ + 0], '[optional -s | --scheme=, default http ] [-i | --ip=] [-p ' \ + '| --port= ] [-u | --user= ] ' 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 ef51a907d5..bc68297383 100644 --- a/catalog-be/src/main/resources/scripts/import/tosca/importDataTypes.py +++ b/catalog-be/src/main/resources/scripts/import/tosca/importDataTypes.py @@ -25,15 +25,15 @@ def usage(): 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]) - printFrameLine() + print_frame_line() + print_name_and_return_code(result[0], result[1]) + print_frame_line() if ( result[1] == None or result[1] not in [200, 201, 409] ): - errorAndExit(1, None) + error_and_exit(1, None) else: if (exitOnSuccess == True): - errorAndExit(0, None) + error_and_exit(0, None) def main(argv): print 'Number of arguments:', len(sys.argv), 'arguments.' @@ -47,7 +47,7 @@ def main(argv): opts, args = getopt.getopt(argv,"i:p:u:h:s:",["ip=","port=","user=","scheme="]) except getopt.GetoptError: usage() - errorAndExit(2, 'Invalid input') + error_and_exit(2, 'Invalid input') for opt, arg in opts: #print opt, arg 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 9daa990fc5..0a94bbef95 100644 --- a/catalog-be/src/main/resources/scripts/import/tosca/importGroupTypes.py +++ b/catalog-be/src/main/resources/scripts/import/tosca/importGroupTypes.py @@ -1,11 +1,10 @@ -import pycurl -import sys, getopt -from StringIO import StringIO -import json -import copy -from importNormativeElements import createNormativeElement +import getopt +import sys from importCommon import * +from importNormativeElements import createNormativeElement + + ##################################################################################################################################################################################### # # # Import tosca data types # @@ -19,59 +18,61 @@ from importCommon import * ##################################################################################################################################################################################### def usage(): - print sys.argv[0], '[optional -s | --scheme=, default http ] [-i | --ip=] [-p | --port= ] [-u | --user= ]' + print sys.argv[ + 0], '[optional -s | --scheme=, default http ] [-i | --ip=] [-p | --port= ] [-u | --user= ]' + +def importGroupTypes(scheme, be_host, be_port, admin_user, exit_on_success, file_dir): + result = createNormativeElement(scheme, be_host, be_port, admin_user, file_dir, + "/sdc2/rest/v1/catalog/uploadType/grouptypes", "groupTypes", "groupTypesZip", True) -def importGroupTypes(scheme, beHost, bePort, adminUser, exitOnSuccess, fileDir): - result = createNormativeElement(scheme, beHost, bePort, adminUser, fileDir, "/sdc2/rest/v1/catalog/uploadType/grouptypes", "groupTypes", "groupTypesZip") + print_frame_line() + print_name_and_return_code(result[0], result[1]) + print_frame_line() - printFrameLine() - printNameAndReturnCode(result[0], result[1]) - printFrameLine() + if result[1] is None or result[1] not in [200, 201, 409]: + error_and_exit(1, None) + else: + if exit_on_success: + error_and_exit(0, None) - if ( result[1] == None or result[1] not in [200, 201, 409] ): - errorAndExit(1, None) - else: - if (exitOnSuccess == True): - errorAndExit(0, None) def main(argv): - print 'Number of arguments:', len(sys.argv), 'arguments.' - - beHost = 'localhost' - bePort = '8080' - adminUser = 'jh0003' - scheme = 'http' - - try: - opts, args = getopt.getopt(argv,"i:p:u:h:s:",["ip=","port=","user=","scheme="]) - except getopt.GetoptError: - usage() - errorAndExit(2, 'Invalid input') - - for opt, arg in opts: - #print opt, arg - if opt == '-h': - usage() - sys.exit(3) - elif opt in ("-i", "--ip"): - beHost = arg - elif opt in ("-p", "--port"): - bePort = arg - elif opt in ("-u", "--user"): - adminUser = arg - elif opt in ("-s", "--scheme"): - scheme = arg - - print 'scheme =',scheme,', be host =',beHost,', be port =', bePort,', user =', adminUser - - if ( beHost == None ): - usage() - sys.exit(3) - - importGroupTypes(scheme, beHost, bePort, adminUser, True, "../../../import/tosca/group-types/") + print 'Number of arguments:', len(sys.argv), 'arguments.' + be_host = 'localhost' + be_port = '8080' + admin_user = 'jh0003' + scheme = 'http' -if __name__ == "__main__": - main(sys.argv[1:]) + try: + opts, args = getopt.getopt(argv, "i:p:u:h:s:", ["ip=", "port=", "user=", "scheme="]) + except getopt.GetoptError: + usage() + error_and_exit(2, 'Invalid input') + for opt, arg in opts: + # print opt, arg + if opt == '-h': + usage() + sys.exit(3) + elif opt in ("-i", "--ip"): + be_host = arg + elif opt in ("-p", "--port"): + be_port = arg + elif opt in ("-u", "--user"): + admin_user = arg + elif opt in ("-s", "--scheme"): + scheme = arg + + print 'scheme =', scheme, ', be host =', be_host, ', be port =', be_port, ', user =', admin_user + + if be_host is None: + usage() + sys.exit(3) + + importGroupTypes(scheme, be_host, be_port, admin_user, True, "../../../import/tosca/group-types/") + + +if __name__ == "__main__": + main(sys.argv[1:]) 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 4490fec61a..74ecf71784 100644 --- a/catalog-be/src/main/resources/scripts/import/tosca/importHeatTypes.py +++ b/catalog-be/src/main/resources/scripts/import/tosca/importHeatTypes.py @@ -59,7 +59,15 @@ def importHeatTypes(scheme, beHost, bePort, adminUser, fileDir, updateversion): "extNeutronCP", "extContrailCP", "portMirroringByPolicy", - "forwardingPath" + "forwardingPath", + "VRFObject", + "extVirtualMachineInterfaceCP", + "VLANNetworkReceptor", + "VRFEntry", + "subInterfaceV2", + "contrailV2VLANSubInterfaceV2", + "configuration", + "fabricConfiguration" ] responseCodes = [200, 201] @@ -89,7 +97,7 @@ def main(argv): opts, args = getopt.getopt(argv,"i:p:u:v:h:s:",["ip=","port=","user=","updateversion=","scheme="]) except getopt.GetoptError: usage() - errorAndExit(2, 'Invalid input') + error_and_exit(2, 'Invalid input') for opt, arg in opts: #print opt, arg @@ -128,9 +136,9 @@ def main(argv): failedNormatives = filter(lambda x: x[1] == None or x[1] not in responseCodes, results) if (len(failedNormatives) > 0): - errorAndExit(1, None) + error_and_exit(1, None) else: - errorAndExit(0, None) + error_and_exit(0, None) if __name__ == "__main__": diff --git a/catalog-be/src/main/resources/scripts/import/tosca/importNfvTypes.py b/catalog-be/src/main/resources/scripts/import/tosca/importNfvTypes.py index 8e63d86140..3de471935e 100644 --- a/catalog-be/src/main/resources/scripts/import/tosca/importNfvTypes.py +++ b/catalog-be/src/main/resources/scripts/import/tosca/importNfvTypes.py @@ -68,7 +68,7 @@ def main(argv): opts, args = getopt.getopt(argv,"i:p:u:v:h:",["ip=","port=","user=","updateversion="]) except getopt.GetoptError: usage() - errorAndExit(2, 'Invalid input') + error_and_exit(2, 'Invalid input') for opt, arg in opts: #print opt, arg @@ -107,9 +107,9 @@ def main(argv): failedNormatives = filter(lambda x: x[1] == None or x[1] not in responseCodes, results) if (len(failedNormatives) > 0): - errorAndExit(1, None) + error_and_exit(1, None) else: - errorAndExit(0, None) + error_and_exit(0, None) if __name__ == "__main__": 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 7d0b7c526a..24218b6a73 100644 --- a/catalog-be/src/main/resources/scripts/import/tosca/importNodeType.py +++ b/catalog-be/src/main/resources/scripts/import/tosca/importNodeType.py @@ -95,7 +95,7 @@ def main(argv): 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') + error_and_exit(2, 'Invalid input') for opt, arg in opts: #print opt, arg @@ -153,9 +153,9 @@ def main(argv): if ( result[1] == None or result[1] not in [200, 201] ) : print "Failed creating normative type " + element + ". " + str(result[1]) - errorAndExit(1, None) + error_and_exit(1, None) - errorAndExit(0, None) + error_and_exit(0, None) if __name__ == "__main__": main(sys.argv[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 d57c3d6ce4..8a8329027f 100644 --- a/catalog-be/src/main/resources/scripts/import/tosca/importNormativeAll.py +++ b/catalog-be/src/main/resources/scripts/import/tosca/importNormativeAll.py @@ -4,20 +4,20 @@ from StringIO import StringIO import json import copy import time -#from importNormativeElements import createNormativeElement -from importNormativeElements import * +from importNormativeElements import * from importNormativeTypes import importNormativeTypes from importHeatTypes import importHeatTypes -from importOnapTypes import importOnapTypes from importNormativeCapabilities import importNormativeCapabilities from importCategoryTypes import importCategories from importNormativeInterfaceLifecycleTypes import importNormativeInterfaceLifecycleType from importDataTypes import importDataTypes from importGroupTypes import importGroupTypes from importPolicyTypes import importPolicyTypes +from importAnnotationTypes import import_annotation_types from importCommon import * import importCommon + ################################################################################################################################################################################################################################# # # # Import all users from a given file # @@ -32,108 +32,114 @@ import importCommon ################################################################################################################################################################################################################################# def usage(): - print sys.argv[0], '[optional -s | --scheme=, default http] [-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() - for result in results: - printNameAndReturnCode(result[0], result[1]) - printFrameLine() - - responseCodes = [200, 201] - - if(updateversion == 'false'): - responseCodes = [200, 201, 409] - - failedResults = filter(lambda x: x[1] == None or x[1] not in responseCodes, results) - if (len(failedResults) > 0): - errorAndExit(1, None) + print_frame_line() + for result in results: + print_name_and_return_code(result[0], result[1]) + print_frame_line() + + responseCodes = [200, 201] + + if (updateversion == 'false'): + responseCodes = [200, 201, 409] + + failedResults = filter(lambda x: x[1] == None or x[1] not in responseCodes, results) + if (len(failedResults) > 0): + error_and_exit(1, None) + def main(argv): - print 'Number of arguments:', len(sys.argv), 'arguments.' - - beHost = 'localhost' - bePort = '8080' - adminUser = 'jh0003' - debugf = None - updateversion = 'true' - importCommon.debugFlag = False - scheme = 'http' - - try: - 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') - - for opt, arg in opts: - #print opt, arg - if opt == '-h': - usage() - sys.exit(3) - elif opt in ("-i", "--ip"): - beHost = arg - elif opt in ("-p", "--port"): - bePort = arg - elif opt in ("-u", "--user"): - adminUser = arg - elif opt in ("-s", "--scheme"): - scheme = arg - elif opt in ("-d", "--debug"): - print arg - debugf = bool(arg.lower() == "true" or arg.lower() == "yes") - elif opt in ("-v", "--updateversion"): - print arg - if (arg.lower() == "false" or arg.lower() == "no"): - updateversion = 'false' - - 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) - importCommon.debugFlag = debugf - - if ( beHost == None ): - usage() - sys.exit(3) - - print sys.argv[0] - pathdir = os.path.dirname(os.path.realpath(sys.argv[0])) - debug("path dir =" + pathdir) - - baseFileLocation = pathdir + "/../../../import/tosca/" - - fileLocation = baseFileLocation + "data-types/" - importDataTypes(scheme, beHost, bePort, adminUser, False, fileLocation) - - print 'sleep until data type cache is updated' - time.sleep( 70 ) - - fileLocation = baseFileLocation + "capability-types/" - importNormativeCapabilities(scheme, beHost, bePort, adminUser, False, fileLocation) - - fileLocation = baseFileLocation + "interface-lifecycle-types/" - importNormativeInterfaceLifecycleType(scheme, beHost, bePort, adminUser, False, fileLocation) - - fileLocation = baseFileLocation + "categories/" - importCategories(scheme, beHost, bePort, adminUser, False, fileLocation) - - fileLocation = baseFileLocation + "normative-types/" - results = importNormativeTypes(scheme, beHost, bePort, adminUser, fileLocation, updateversion) - handleResults(results, updateversion) - - fileLocation = baseFileLocation + "heat-types/" - resultsHeat = importHeatTypes(scheme, beHost, bePort, adminUser, fileLocation, updateversion) - handleResults(resultsHeat, updateversion) - - fileLocation = baseFileLocation + "group-types/" - importGroupTypes(scheme, beHost, bePort, adminUser, False, fileLocation) - - fileLocation = baseFileLocation + "policy-types/" - importPolicyTypes(scheme, beHost, bePort, adminUser, False, fileLocation) - - errorAndExit(0, None) + print 'Number of arguments:', len(sys.argv), 'arguments.' + + beHost = 'localhost' + bePort = '8080' + adminUser = 'jh0003' + debugf = None + updateversion = 'true' + importCommon.debugFlag = False + scheme = 'http' + + try: + opts, args = getopt.getopt(argv, "i:p:u:d:v:h:s:", + ["ip=", "port=", "user=", "debug=", "updateversion=", "scheme="]) + except getopt.GetoptError: + usage() + error_and_exit(2, 'Invalid input') + + for opt, arg in opts: + # print opt, arg + if opt == '-h': + usage() + sys.exit(3) + elif opt in ("-i", "--ip"): + beHost = arg + elif opt in ("-p", "--port"): + bePort = arg + elif opt in ("-u", "--user"): + adminUser = arg + elif opt in ("-s", "--scheme"): + scheme = arg + elif opt in ("-d", "--debug"): + print arg + debugf = bool(arg.lower() == "true" or arg.lower() == "yes") + elif opt in ("-v", "--updateversion"): + print arg + if (arg.lower() == "false" or arg.lower() == "no"): + updateversion = 'false' + + 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) + importCommon.debugFlag = debugf + + if (beHost == None): + usage() + sys.exit(3) + + print sys.argv[0] + pathdir = os.path.dirname(os.path.realpath(sys.argv[0])) + debug("path dir =" + pathdir) + + baseFileLocation = pathdir + "/../../../import/tosca/" + + fileLocation = baseFileLocation + "data-types/" + importDataTypes(scheme, beHost, bePort, adminUser, False, fileLocation) + + print 'sleep until data type cache is updated' + time.sleep(70) + + fileLocation = baseFileLocation + "capability-types/" + importNormativeCapabilities(scheme, beHost, bePort, adminUser, False, fileLocation) + + fileLocation = baseFileLocation + "interface-lifecycle-types/" + importNormativeInterfaceLifecycleType(scheme, beHost, bePort, adminUser, False, fileLocation) + + fileLocation = baseFileLocation + "categories/" + importCategories(scheme, beHost, bePort, adminUser, False, fileLocation) + + fileLocation = baseFileLocation + "normative-types/" + results = importNormativeTypes(scheme, beHost, bePort, adminUser, fileLocation, updateversion) + handleResults(results, updateversion) + + fileLocation = baseFileLocation + "heat-types/" + resultsHeat = importHeatTypes(scheme, beHost, bePort, adminUser, fileLocation, updateversion) + handleResults(resultsHeat, updateversion) + + fileLocation = baseFileLocation + "group-types/" + importGroupTypes(scheme, beHost, bePort, adminUser, False, fileLocation) + + fileLocation = baseFileLocation + "policy-types/" + importPolicyTypes(scheme, beHost, bePort, adminUser, False, fileLocation) + + import_annotation_types(scheme, beHost, bePort, adminUser, False) + + error_and_exit(0, None) -if __name__ == "__main__": - main(sys.argv[1:]) +if __name__ == "__main__": + main(sys.argv[1:]) 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 e4f92139c2..e0f5c40ac9 100644 --- a/catalog-be/src/main/resources/scripts/import/tosca/importNormativeCapabilities.py +++ b/catalog-be/src/main/resources/scripts/import/tosca/importNormativeCapabilities.py @@ -27,15 +27,15 @@ def usage(): 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]) - printFrameLine() + print_frame_line() + print_name_and_return_code(result[0], result[1]) + print_frame_line() if ( result[1] == None or result[1] not in [200, 201, 409] ): - importCommon.errorAndExit(1, None) + importCommon.error_and_exit(1, None) else: if (exitOnSuccess == True): - importCommon.errorAndExit(0, None) + importCommon.error_and_exit(0, None) def main(argv): @@ -50,7 +50,7 @@ def main(argv): opts, args = getopt.getopt(argv,"i:p:u:h:s:",["ip=","port=","user=","scheme="]) except getopt.GetoptError: usage() - importCommon.errorAndExit(2, 'Invalid input') + importCommon.error_and_exit(2, 'Invalid input') for opt, arg in opts: #print opt, arg 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 c28bbfb143..f9f5cd5320 100644 --- a/catalog-be/src/main/resources/scripts/import/tosca/importNormativeElements.py +++ b/catalog-be/src/main/resources/scripts/import/tosca/importNormativeElements.py @@ -1,9 +1,10 @@ import pycurl -import sys, getopt from StringIO import StringIO import json import copy from importCommon import * + + ################################################################################################################################################################################# # # # Import all users from a given file # @@ -15,55 +16,86 @@ from importCommon import * # python importUsers.py [-f | --ifile= ] # # # ################################################################################################################################################################################# +def import_element(scheme, be_host, be_port, admin_user, exit_on_success, file_dir, url_suffix, element_name, element_form_name, + with_metadata=False): + result = createNormativeElement(scheme, be_host, be_port, admin_user, file_dir, url_suffix, element_name, element_form_name, with_metadata) + print_frame_line() + print_name_and_return_code(result[0], result[1]) + print_frame_line() + + if result[1] is None or result[1] not in [200, 201, 409]: + error_and_exit(1, None) + else: + if exit_on_success: + error_and_exit(0, None) + + +def createNormativeElement(scheme, be_host, be_port, admin_user, file_dir, url_suffix, element_name, element_form_name, + with_metadata=False): + try: + log("in create normative element ", element_name) + buffer = StringIO() + c = pycurl.Curl() + + url = scheme + '://' + be_host + ':' + be_port + url_suffix + c.setopt(c.URL, url) + c.setopt(c.POST, 1) + + admin_header = 'USER_ID: ' + admin_user + c.setopt(pycurl.HTTPHEADER, [admin_header]) + + type_file_name = file_dir + "/" + element_name + + multi_part_form_data = create_multipart_form_data(element_form_name, type_file_name, with_metadata) + + c.setopt(pycurl.HTTPPOST, multi_part_form_data) + c.setopt(c.WRITEFUNCTION, buffer.write) -def createNormativeElement(scheme, beHost, bePort, adminUser, fileDir, urlSuffix, ELEMENT_NAME, elementFormName): - - try: - log("in create normative element ", ELEMENT_NAME) + if scheme == 'https': + c.setopt(c.SSL_VERIFYPEER, 0) - buffer = StringIO() - c = pycurl.Curl() + c.perform() - url = scheme + '://' + beHost + ':' + bePort + urlSuffix - c.setopt(c.URL, url) - c.setopt(c.POST, 1) + http_res = c.getinfo(c.RESPONSE_CODE) + if http_res is not None: + debug("http response=", http_res) + debug("response buffer", buffer.getvalue()) + c.close() + return (element_name, http_res, buffer.getvalue()) - adminHeader = 'USER_ID: ' + adminUser - #c.setopt(pycurl.HTTPHEADER, ['Content-Type: application/json', 'Accept: application/json', adminHeader]) - c.setopt(pycurl.HTTPHEADER, [adminHeader]) + except Exception as inst: + print("ERROR=" + str(inst)) + return (element_name, None, None) - - path = fileDir + "/" + ELEMENT_NAME + ".zip" - debug(path) - send = [(elementFormName, (pycurl.FORM_FILE, path))] - debug(send) - c.setopt(pycurl.HTTPPOST, send) +def create_multipart_form_data(element_form_name, type_file_name, with_metadata): + tosca_type_zip_part = create_zip_file_multi_part(element_form_name, type_file_name) + multi_part_form_data = [tosca_type_zip_part] + if with_metadata: + metadata_type_part = create_metadata_multipart(type_file_name) + multi_part_form_data.append(metadata_type_part) + debug(multi_part_form_data) + return multi_part_form_data - #data = json.dumps(user) - #c.setopt(c.POSTFIELDS, data) - #c.setopt(c.WRITEFUNCTION, lambda x: None) - c.setopt(c.WRITEFUNCTION, buffer.write) +def create_metadata_multipart(type_file_name): + metadata = create_json_metadata_str(type_file_name) + return ("toscaTypeMetadata", metadata) - if scheme == 'https': - c.setopt(c.SSL_VERIFYPEER, 0) - #print("before perform") - res = c.perform() - - #print("Before get response code") - httpRes = c.getinfo(c.RESPONSE_CODE) - if (httpRes != None): - debug("http response=", httpRes) - #print('Status: ' + str(responseCode)) - debug("response buffer", buffer.getvalue()) - c.close() +def create_zip_file_multi_part(element_form_name, type_file_name): + tosca_type_zip_path = type_file_name + ".zip" + tosca_type_zip_part = (element_form_name, (pycurl.FORM_FILE, tosca_type_zip_path)) + return tosca_type_zip_part - return (ELEMENT_NAME, httpRes, buffer.getvalue()) - except Exception as inst: - print("ERROR=" + str(inst)) - return (ELEMENT_NAME, None, None) +def create_json_metadata_str(file_name): + type_metadata_json_file = file_name + ".json" + debug(type_metadata_json_file) + json_file = open(type_metadata_json_file) + debug("before load json") + json_data = json.load(json_file, strict=False) + debug(json_data) + return json.dumps(json_data) 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 a6ab5741e4..89862f7df6 100644 --- a/catalog-be/src/main/resources/scripts/import/tosca/importNormativeInterfaceLifecycleTypes.py +++ b/catalog-be/src/main/resources/scripts/import/tosca/importNormativeInterfaceLifecycleTypes.py @@ -25,15 +25,15 @@ def usage(): 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]) - printFrameLine() + print_frame_line() + print_name_and_return_code(result[0], result[1]) + print_frame_line() if ( result[1] == None or result[1] not in [200, 201, 409] ): - errorAndExit(1, None) + error_and_exit(1, None) else: if (exitOnSuccess == True): - errorAndExit(0, None) + error_and_exit(0, None) def main(argv): @@ -48,7 +48,7 @@ def main(argv): opts, args = getopt.getopt(argv,"i:p:u:h:s:",["ip=","port=","user=","scheme="]) except getopt.GetoptError: usage() - errorAndExit(2, 'Invalid input') + error_and_exit(2, 'Invalid input') for opt, arg in opts: #print opt, arg 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 1061df862c..c288d550f7 100644 --- a/catalog-be/src/main/resources/scripts/import/tosca/importNormativeNoHeatAndNormativeTypes.py +++ b/catalog-be/src/main/resources/scripts/import/tosca/importNormativeNoHeatAndNormativeTypes.py @@ -34,10 +34,10 @@ def usage(): print sys.argv[0], '[optional -s | --scheme=, default http] [-i | --ip=] [-p | --port= ] [-u | --user= ] [-d | --debug=] [-v | --updateversion=]' def handleResults(results, updateversion): - printFrameLine() + print_frame_line() for result in results: - printNameAndReturnCode(result[0], result[1]) - printFrameLine() + print_name_and_return_code(result[0], result[1]) + print_frame_line() responseCodes = [200, 201] @@ -46,7 +46,7 @@ def handleResults(results, updateversion): failedResults = filter(lambda x: x[1] == None or x[1] not in responseCodes, results) if (len(failedResults) > 0): - errorAndExit(1, None) + error_and_exit(1, None) def main(argv): print 'Number of arguments:', len(sys.argv), 'arguments.' @@ -63,7 +63,7 @@ def main(argv): 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') + error_and_exit(2, 'Invalid input') for opt, arg in opts: #print opt, arg @@ -131,7 +131,7 @@ def main(argv): fileLocation = baseFileLocation + "policy-types/" importPolicyTypes(scheme, beHost, bePort, adminUser, False, fileLocation) - errorAndExit(0, None) + error_and_exit(0, None) if __name__ == "__main__": main(sys.argv[1:]) 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 5b7b52d0a1..51d36586bc 100644 --- a/catalog-be/src/main/resources/scripts/import/tosca/importNormativeTypes.py +++ b/catalog-be/src/main/resources/scripts/import/tosca/importNormativeTypes.py @@ -116,7 +116,7 @@ def main(argv): opts, args = getopt.getopt(argv,"i:p:u:v:h:s:",["ip=","port=","user=","updateversion=","scheme="]) except getopt.GetoptError: usage() - errorAndExit(2, 'Invalid input') + error_and_exit(2, 'Invalid input') for opt, arg in opts: #print opt, arg @@ -155,9 +155,9 @@ def main(argv): failedNormatives = filter(lambda x: x[1] == None or x[1] not in responseCodes, results) if (len(failedNormatives) > 0): - errorAndExit(1, None) + error_and_exit(1, None) else: - errorAndExit(0, None) + error_and_exit(0, None) if __name__ == "__main__": 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 6144d69104..ef1fe4d3b9 100644 --- a/catalog-be/src/main/resources/scripts/import/tosca/importONAPNormativeAll.py +++ b/catalog-be/src/main/resources/scripts/import/tosca/importONAPNormativeAll.py @@ -37,19 +37,20 @@ def usage(): print sys.argv[0], '[-s | --scheme= ] [-i | --ip=] [-p | --port= ] [-u | --user= ] [-d | --debug=] [-v | --updateversion=]' def handleResults(results, updateversion): - printFrameLine() - for result in results: - printNameAndReturnCode(result[0], result[1]) - printFrameLine() - - responseCodes = [200, 201] - - if(updateversion == 'false'): - responseCodes = [200, 201, 409] - - failedResults = filter(lambda x: x[1] == None or x[1] not in responseCodes, results) - if (len(failedResults) > 0): - errorAndExit(1, None) + if results is not None: + print_frame_line() + for result in results: + print_name_and_return_code(result[0], result[1]) + print_frame_line() + + responseCodes = [200, 201] + + if(updateversion == 'false'): + responseCodes = [200, 201, 409] + + failedResults = filter(lambda x: x[1] == None or x[1] not in responseCodes, results) + if (len(failedResults) > 0): + error_and_exit(1, None) def main(argv): print 'Number of arguments:', len(sys.argv), 'arguments.' @@ -66,7 +67,7 @@ def main(argv): opts, args = getopt.getopt(argv,"i:p:u:d:v:h",["ip=","port=","user=","debug=","updateversion="]) except getopt.GetoptError: usage() - errorAndExit(2, 'Invalid input') + error_and_exit(2, 'Invalid input') for opt, arg in opts: #print opt, arg @@ -146,7 +147,7 @@ def main(argv): fileLocation = baseFileLocation + "policy-types/" importPolicyTypes(scheme, beHost, bePort, adminUser, False, fileLocation) - errorAndExit(0, None) + error_and_exit(0, None) if __name__ == "__main__": main(sys.argv[1:]) 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 f703b4b4ac..395b42d696 100644 --- a/catalog-be/src/main/resources/scripts/import/tosca/importOnapTypes.py +++ b/catalog-be/src/main/resources/scripts/import/tosca/importOnapTypes.py @@ -51,7 +51,7 @@ def main(argv): opts, args = getopt.getopt(argv,"i:p:u:v:h:",["ip=","port=","user=","updateversion="]) except getopt.GetoptError: usage() - errorAndExit(2, 'Invalid input') + error_and_exit(2, 'Invalid input') for opt, arg in opts: #print opt, arg @@ -90,9 +90,9 @@ def main(argv): failedNormatives = filter(lambda x: x[1] == None or x[1] not in responseCodes, results) if (len(failedNormatives) > 0): - errorAndExit(1, None) + error_and_exit(1, None) else: - errorAndExit(0, None) + error_and_exit(0, None) if __name__ == "__main__": 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 103ad2d1da..1bd6befbf7 100644 --- a/catalog-be/src/main/resources/scripts/import/tosca/importPolicyTypes.py +++ b/catalog-be/src/main/resources/scripts/import/tosca/importPolicyTypes.py @@ -1,11 +1,10 @@ -import pycurl -import sys, getopt -from StringIO import StringIO -import json -import copy -from importNormativeElements import createNormativeElement +import getopt +import sys from importCommon import * +from importNormativeElements import createNormativeElement + + ##################################################################################################################################################################################### # # # Import tosca data types # @@ -19,59 +18,62 @@ from importCommon import * ##################################################################################################################################################################################### def usage(): - print sys.argv[0], '[optional -s | --scheme=, default http] [-i | --ip=] [-p | --port= ] [-u | --user= ]' + print sys.argv[ + 0], '[optional -s | --scheme=, default http] [-i | --ip=] [-p | --port= ] [-u | --user= ]' + +def importPolicyTypes(scheme, be_host, be_port, admin_user, exit_on_success, file_dir): + result = createNormativeElement(scheme, be_host, be_port, admin_user, file_dir, + "/sdc2/rest/v1/catalog/uploadType/policytypes", "policyTypes", "policyTypesZip", + True) -def importPolicyTypes(scheme, beHost, bePort, adminUser, exitOnSuccess, fileDir): - result = createNormativeElement(scheme, beHost, bePort, adminUser, fileDir, "/sdc2/rest/v1/catalog/uploadType/policytypes", "policyTypes", "policyTypesZip") + print_frame_line() + print_name_and_return_code(result[0], result[1]) + print_frame_line() - printFrameLine() - printNameAndReturnCode(result[0], result[1]) - printFrameLine() + if result[1] is None or result[1] not in [200, 201, 409]: + error_and_exit(1, None) + else: + if exit_on_success: + error_and_exit(0, None) - if ( result[1] == None or result[1] not in [200, 201, 409] ): - errorAndExit(1, None) - else: - if (exitOnSuccess == True): - errorAndExit(0, None) def main(argv): - print 'Number of arguments:', len(sys.argv), 'arguments.' - - beHost = 'localhost' - bePort = '8080' - adminUser = 'jh0003' - scheme = 'http' - - try: - opts, args = getopt.getopt(argv,"i:p:u:h:s:",["ip=","port=","user=", "scheme="]) - except getopt.GetoptError: - usage() - errorAndExit(2, 'Invalid input') - - for opt, arg in opts: - #print opt, arg - if opt == '-h': - usage() - sys.exit(3) - elif opt in ("-i", "--ip"): - beHost = arg - elif opt in ("-p", "--port"): - bePort = arg - elif opt in ("-u", "--user"): - adminUser = arg - elif opt in ("-s", "--scheme"): - scheme = arg - - print 'scheme =',scheme,', be host =',beHost,', be port =', bePort,', user =', adminUser - - if ( beHost == None ): - usage() - sys.exit(3) - - importPolicyTypes(scheme, beHost, bePort, adminUser, True, "../../../import/tosca/policy-types/") + print 'Number of arguments:', len(sys.argv), 'arguments.' + be_host = 'localhost' + be_port = '8080' + admin_user = 'jh0003' + scheme = 'http' -if __name__ == "__main__": - main(sys.argv[1:]) + try: + opts, args = getopt.getopt(argv, "i:p:u:h:s:", ["ip=", "port=", "user=", "scheme="]) + except getopt.GetoptError: + usage() + error_and_exit(2, 'Invalid input') + for opt, arg in opts: + # print opt, arg + if opt == '-h': + usage() + sys.exit(3) + elif opt in ("-i", "--ip"): + be_host = arg + elif opt in ("-p", "--port"): + be_port = arg + elif opt in ("-u", "--user"): + admin_user = arg + elif opt in ("-s", "--scheme"): + scheme = arg + + print 'scheme =', scheme, ', be host =', be_host, ', be port =', be_port, ', user =', admin_user + + if be_host is None: + usage() + sys.exit(3) + + importPolicyTypes(scheme, be_host, be_port, admin_user, True, "../../../import/tosca/policy-types/") + + +if __name__ == "__main__": + main(sys.argv[1:]) diff --git a/catalog-be/src/main/resources/scripts/import/tosca/importSolTypes.py b/catalog-be/src/main/resources/scripts/import/tosca/importSolTypes.py index 0015a26655..24479c4f6b 100644 --- a/catalog-be/src/main/resources/scripts/import/tosca/importSolTypes.py +++ b/catalog-be/src/main/resources/scripts/import/tosca/importSolTypes.py @@ -51,7 +51,7 @@ def main(argv): opts, args = getopt.getopt(argv,"i:p:u:v:h:",["ip=","port=","user=","updateversion="]) except getopt.GetoptError: usage() - errorAndExit(2, 'Invalid input') + error_and_exit(2, 'Invalid input') for opt, arg in opts: #print opt, arg @@ -90,9 +90,9 @@ def main(argv): failedNormatives = filter(lambda x: x[1] == None or x[1] not in responseCodes, results) if (len(failedNormatives) > 0): - errorAndExit(1, None) + error_and_exit(1, None) else: - errorAndExit(0, None) + error_and_exit(0, None) 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 8e69ffcf49..23e854bcb8 100644 --- a/catalog-be/src/main/resources/scripts/import/tosca/importUsersFromYaml.py +++ b/catalog-be/src/main/resources/scripts/import/tosca/importUsersFromYaml.py @@ -129,7 +129,7 @@ def createUser(scheme, beHost, bePort, user, adminUser): return (userId, None) -def errorAndExit(errorCode, errorDesc): +def error_and_exit(errorCode, errorDesc): if ( errorCode > 0 ): print("status=" + str(errorCode) + ". " + errorDesc) else: @@ -153,7 +153,7 @@ def main(argv): opts, args = getopt.getopt(argv,"i:p:f:h:s:",["ip=","port=","ifile=","scheme="]) except getopt.GetoptError: usage() - errorAndExit(2, 'Invalid input') + error_and_exit(2, 'Invalid input') for opt, arg in opts: #print opt, arg @@ -204,7 +204,7 @@ def main(argv): if ( len(result) > 0 ): #print("ERROR: Failed to load the users " + ', '.join(map(lambda x: x[0],result))) - errorAndExit(3, "Failed to load the users " + ', '.join(map(lambda x: x[0],result))) + error_and_exit(3, "Failed to load the users " + ', '.join(map(lambda x: x[0],result))) g = lambda x: x[1] == 409 result = filter(g, resultTable) @@ -222,7 +222,7 @@ def main(argv): print("Loaded users: " + ', '.join(map(lambda x: x[0],result))) print("-------------------------------------------") - errorAndExit(0, None) + error_and_exit(0, None) if __name__ == "__main__": 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 7ea3dd4eda..1ea8f98925 100644 --- a/catalog-be/src/main/resources/scripts/import/tosca/typesToUpgrade.json +++ b/catalog-be/src/main/resources/scripts/import/tosca/typesToUpgrade.json @@ -1,6 +1,7 @@ { "heat": [ - "Generic_CR" + "configuration", + "fabricConfiguration" ], "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 5a1d1046b9..265bf33f9a 100644 --- a/catalog-be/src/main/resources/scripts/import/tosca/upgradeHeatAndNormativeTypes.py +++ b/catalog-be/src/main/resources/scripts/import/tosca/upgradeHeatAndNormativeTypes.py @@ -65,7 +65,7 @@ def main(argv): opts, args = getopt.getopt(argv, "i:p:u:v:h:s:", ["ip=", "port=", "user=", "updateversion=","scheme="]) except getopt.GetoptError: usage() - errorAndExit(2, 'Invalid input') + error_and_exit(2, 'Invalid input') for opt, arg in opts: # print opt, arg @@ -104,9 +104,9 @@ def main(argv): failedNormatives = filter(lambda x: x[1] == None or x[1] not in responseCodes, results) if (len(failedNormatives) > 0): - errorAndExit(1, None) + error_and_exit(1, None) else: - errorAndExit(0, None) + error_and_exit(0, None) if __name__ == "__main__": 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 5cb0ca3b0c..4f254f26fe 100644 --- a/catalog-be/src/main/resources/scripts/import/tosca/upgradeHeatTypes1707.py +++ b/catalog-be/src/main/resources/scripts/import/tosca/upgradeHeatTypes1707.py @@ -69,7 +69,7 @@ def main(argv): opts, args = getopt.getopt(argv,"i:p:u:v:h:s:",["ip=","port=","user=","updateversion=","scheme="]) except getopt.GetoptError: usage() - errorAndExit(2, 'Invalid input') + error_and_exit(2, 'Invalid input') for opt, arg in opts: #print opt, arg @@ -108,9 +108,9 @@ def main(argv): failedNormatives = filter(lambda x: x[1] == None or x[1] not in responseCodes, results) if (len(failedNormatives) > 0): - errorAndExit(1, None) + error_and_exit(1, None) else: - errorAndExit(0, None) + error_and_exit(0, None) if __name__ == "__main__": diff --git a/catalog-be/src/main/resources/scripts/import/tosca/upgradeNfvTypes.py b/catalog-be/src/main/resources/scripts/import/tosca/upgradeNfvTypes.py index 66d82f9e91..cb7628e974 100644 --- a/catalog-be/src/main/resources/scripts/import/tosca/upgradeNfvTypes.py +++ b/catalog-be/src/main/resources/scripts/import/tosca/upgradeNfvTypes.py @@ -55,7 +55,7 @@ def main(argv): opts, args = getopt.getopt(argv, "i:p:u:v:h:s:", ["ip=", "port=", "user=", "updateversion=","scheme="]) except getopt.GetoptError: usage() - errorAndExit(2, 'Invalid input') + error_and_exit(2, 'Invalid input') for opt, arg in opts: # print opt, arg @@ -94,9 +94,9 @@ def main(argv): failedNormatives = filter(lambda x: x[1] == None or x[1] not in responseCodes, results) if (len(failedNormatives) > 0): - errorAndExit(1, None) + error_and_exit(1, None) else: - errorAndExit(0, None) + error_and_exit(0, None) if __name__ == "__main__": 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 573e05b46a..bbeb3d6972 100644 --- a/catalog-be/src/main/resources/scripts/import/tosca/upgradeNormative.py +++ b/catalog-be/src/main/resources/scripts/import/tosca/upgradeNormative.py @@ -11,7 +11,7 @@ from importPolicyTypes import importPolicyTypes from importGroupTypes import importGroupTypes from importNormativeCapabilities import importNormativeCapabilities from importNormativeInterfaceLifecycleTypes import importNormativeInterfaceLifecycleType -from importOnapTypes import importOnapTypes +from importAnnotationTypes import import_annotation_types from importCommon import * @@ -31,93 +31,95 @@ import importCommon ################################################################################################################################################################################################################################# def usage(): - print sys.argv[0], '[optional -s | --scheme=, default http] [-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() - for result in results: - printNameAndReturnCode(result[0], result[1]) - printFrameLine() + print_frame_line() + for result in results: + print_name_and_return_code(result[0], result[1]) + print_frame_line() - failedResults = filter(lambda x: x[1] == None or x[1] not in [200, 201, 409], results) - if (len(failedResults) > 0): - errorAndExit(1, None) + failedResults = filter(lambda x: x[1] == None or x[1] not in [200, 201, 409], results) + if (len(failedResults) > 0): + error_and_exit(1, None) def main(argv): - print 'Number of arguments:', len(sys.argv), 'arguments.' - - beHost = 'localhost' - bePort = '8080' - adminUser = 'jh0003' - debugf = None - updateversion = 'true' - importCommon.debugFlag = False - scheme = 'http' - - try: - opts, args = getopt.getopt(argv,"i:p:u:d:h:s:",["ip=","port=","user=","debug=","scheme="]) - except getopt.GetoptError: - usage() - errorAndExit(2, 'Invalid input') - - for opt, arg in opts: - #print opt, arg - if opt == '-h': - usage() - sys.exit(3) - elif opt in ("-i", "--ip"): - beHost = arg - elif opt in ("-p", "--port"): - bePort = arg - elif opt in ("-u", "--user"): - adminUser = arg - elif opt in ("-s", "--scheme"): - scheme = arg - elif opt in ("-d", "--debug"): - print arg - debugf = bool(arg.lower() == "true" or arg.lower() == "yes") - - print 'scheme =',scheme,', be host =',beHost,', be port =', bePort,', user =', adminUser, ', debug =', debugf - - if (debugf != None): - print 'set debug mode to ' + str(debugf) - importCommon.debugFlag = debugf - - if ( beHost == None ): - usage() - sys.exit(3) - - print sys.argv[0] - pathdir = os.path.dirname(os.path.realpath(sys.argv[0])) - debug("path dir =" + pathdir) - - baseFileLocation = pathdir + "/../../../import/tosca/" - - fileLocation = baseFileLocation + "categories/" - importCategories(scheme, beHost, bePort, adminUser, False, fileLocation) - - fileLocation = baseFileLocation + "data-types/" - importDataTypes(scheme, beHost, bePort, adminUser, False, fileLocation) - - fileLocation = baseFileLocation + "policy-types/" - importPolicyTypes(scheme, beHost, bePort, adminUser, False, fileLocation) - - fileLocation = baseFileLocation + "capability-types/" - importNormativeCapabilities(scheme, beHost, bePort, adminUser, False, fileLocation) - - fileLocation = baseFileLocation + "group-types/" - importGroupTypes(scheme, beHost, bePort, adminUser, False, fileLocation) - - fileLocation = baseFileLocation + "interface-lifecycle-types/" - importNormativeInterfaceLifecycleType(scheme, beHost, bePort, adminUser, False, fileLocation) - - print 'sleep until data type cache is updated' - time.sleep( 70 ) - - resultsHeat = upgradeTypesPerConfigFile(scheme, beHost, bePort, adminUser, baseFileLocation, updateversion) - handleResults(resultsHeat, 'false') - - errorAndExit(0, None) + print 'Number of arguments:', len(sys.argv), 'arguments.' + + beHost = 'localhost' + bePort = '8080' + adminUser = 'jh0003' + debugf = None + updateversion = 'true' + importCommon.debugFlag = False + scheme = 'http' + + try: + opts, args = getopt.getopt(argv,"i:p:u:d:h:s:",["ip=","port=","user=","debug=","scheme="]) + except getopt.GetoptError: + usage() + error_and_exit(2, 'Invalid input') + + for opt, arg in opts: + #print opt, arg + if opt == '-h': + usage() + sys.exit(3) + elif opt in ("-i", "--ip"): + beHost = arg + elif opt in ("-p", "--port"): + bePort = arg + elif opt in ("-u", "--user"): + adminUser = arg + elif opt in ("-s", "--scheme"): + scheme = arg + elif opt in ("-d", "--debug"): + print arg + debugf = bool(arg.lower() == "true" or arg.lower() == "yes") + + print 'scheme =',scheme,', be host =',beHost,', be port =', bePort,', user =', adminUser, ', debug =', debugf + + if (debugf != None): + print 'set debug mode to ' + str(debugf) + importCommon.debugFlag = debugf + + if ( beHost == None ): + usage() + sys.exit(3) + + print sys.argv[0] + pathdir = os.path.dirname(os.path.realpath(sys.argv[0])) + debug("path dir =" + pathdir) + + baseFileLocation = pathdir + "/../../../import/tosca/" + + fileLocation = baseFileLocation + "categories/" + importCategories(scheme, beHost, bePort, adminUser, False, fileLocation) + + fileLocation = baseFileLocation + "data-types/" + importDataTypes(scheme, beHost, bePort, adminUser, False, fileLocation) + + fileLocation = baseFileLocation + "policy-types/" + importPolicyTypes(scheme, beHost, bePort, adminUser, False, fileLocation) + + fileLocation = baseFileLocation + "capability-types/" + importNormativeCapabilities(scheme, beHost, bePort, adminUser, False, fileLocation) + + fileLocation = baseFileLocation + "group-types/" + importGroupTypes(scheme, beHost, bePort, adminUser, False, fileLocation) + + fileLocation = baseFileLocation + "interface-lifecycle-types/" + importNormativeInterfaceLifecycleType(scheme, beHost, bePort, adminUser, False, fileLocation) + + import_annotation_types(scheme, beHost, bePort, adminUser, False) + + print 'sleep until data type cache is updated' + time.sleep( 70 ) + + resultsHeat = upgradeTypesPerConfigFile(scheme, beHost, bePort, adminUser, baseFileLocation, updateversion) + handleResults(resultsHeat, 'false') + + error_and_exit(0, None) if __name__ == "__main__": main(sys.argv[1:]) 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 958416da33..c6fa1c9cab 100644 --- a/catalog-be/src/main/resources/scripts/import/tosca/upgradeNormativeVersion.py +++ b/catalog-be/src/main/resources/scripts/import/tosca/upgradeNormativeVersion.py @@ -24,14 +24,14 @@ def usage(): print sys.argv[0], '[optional -s | --scheme=, default http] [-i | --ip=] [-p | --port= ] [-u | --user= ] [-d | --debug=]' def handleResults(results, updateversion): - printFrameLine() + print_frame_line() for result in results: - printNameAndReturnCode(result[0], result[1]) - printFrameLine() + print_name_and_return_code(result[0], result[1]) + print_frame_line() failedResults = filter(lambda x: x[1] == None or x[1] not in [200, 201, 409], results) if (len(failedResults) > 0): - errorAndExit(1, None) + error_and_exit(1, None) def main(argv): print 'Number of arguments:', len(sys.argv), 'arguments.' @@ -48,7 +48,7 @@ def main(argv): opts, args = getopt.getopt(argv,"i:p:u:d:h:s:",["ip=","port=","user=","debug=","scheme="]) except getopt.GetoptError: usage() - errorAndExit(2, 'Invalid input') + error_and_exit(2, 'Invalid input') for opt, arg in opts: #print opt, arg @@ -103,7 +103,7 @@ def main(argv): handleResults(results, 'false') - errorAndExit(0, None) + error_and_exit(0, None) if __name__ == "__main__": main(sys.argv[1:]) 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 805d012298..32045513b8 100644 --- a/catalog-be/src/main/resources/scripts/import/tosca/upgradeNormativeVersionAll.py +++ b/catalog-be/src/main/resources/scripts/import/tosca/upgradeNormativeVersionAll.py @@ -13,10 +13,10 @@ def usage(): print sys.argv[0], '[optional -s | --scheme=, default http] [-i | --ip=] [-p | --port= ] [-u | --user= ] [-d | --debug=] [-v | --updateversion=]' def handleResults(results, updateversion): - printFrameLine() + print_frame_line() for result in results: - printNameAndReturnCode(result[0], result[1]) - printFrameLine() + print_name_and_return_code(result[0], result[1]) + print_frame_line() responseCodes = [200, 201] @@ -25,7 +25,7 @@ def handleResults(results, updateversion): failedResults = filter(lambda x: x[1] == None or x[1] not in responseCodes, results) if (len(failedResults) > 0): - errorAndExit(1, None) + error_and_exit(1, None) def main(argv): print 'Number of arguments:', len(sys.argv), 'arguments.' @@ -42,7 +42,7 @@ def main(argv): 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') + error_and_exit(2, 'Invalid input') for opt, arg in opts: #print opt, arg @@ -93,7 +93,7 @@ def main(argv): resultsOnap = importOnapTypes(beHost, bePort, adminUser, fileLocation, updateversion) handleResults(resultsOnap, updateversion) - errorAndExit(0, None) + error_and_exit(0, None) if __name__ == "__main__": main(sys.argv[1:]) 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 c75966cfc9..972d792b20 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 @@ -24,14 +24,14 @@ def usage(): print sys.argv[0], '[optional -s | --scheme=, default http] [-i | --ip=] [-p | --port= ] [-u | --user= ] [-d | --debug=]' def handleResults(results, updateversion): - printFrameLine() + print_frame_line() for result in results: - printNameAndReturnCode(result[0], result[1]) - printFrameLine() + print_name_and_return_code(result[0], result[1]) + print_frame_line() failedResults = filter(lambda x: x[1] == None or x[1] not in [200, 201, 409], results) if (len(failedResults) > 0): - errorAndExit(1, None) + error_and_exit(1, None) def main(argv): print 'Number of arguments:', len(sys.argv), 'arguments.' @@ -48,7 +48,7 @@ def main(argv): opts, args = getopt.getopt(argv,"i:p:u:d:h:s:",["ip=","port=","user=","debug=","scheme="]) except getopt.GetoptError: usage() - errorAndExit(2, 'Invalid input') + error_and_exit(2, 'Invalid input') for opt, arg in opts: #print opt, arg @@ -125,7 +125,7 @@ def main(argv): handleResults(results, 'false') - errorAndExit(0, None) + error_and_exit(0, None) if __name__ == "__main__": main(sys.argv[1:]) 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 289678b369..bebba6c2cb 100644 --- a/catalog-be/src/main/resources/scripts/import/tosca/upgradeONAPNormative.py +++ b/catalog-be/src/main/resources/scripts/import/tosca/upgradeONAPNormative.py @@ -37,15 +37,15 @@ def usage(): def handleResults(results): if results is not None: - printFrameLine() + print_frame_line() for result in results: - printNameAndReturnCode(result[0], result[1]) + print_name_and_return_code(result[0], result[1]) - printFrameLine() + print_frame_line() failedResults = filter(lambda x: x[1] == None or x[1] not in [200, 201, 409], results) if (len(failedResults) > 0): - errorAndExit(1, None) + error_and_exit(1, None) def main(argv): print 'Number of arguments:', len(sys.argv), 'arguments.' @@ -63,7 +63,7 @@ def main(argv): opts, args = getopt.getopt(argv,"i:p:u:d:h",["ip=","port=","user=","debug="]) except getopt.GetoptError: usage() - errorAndExit(2, 'Invalid input') + error_and_exit(2, 'Invalid input') for opt, arg in opts: #print opt, arg @@ -131,7 +131,7 @@ def main(argv): resultsHeat = upgradeSolTypesPerConfigFile(scheme, beHost, bePort, adminUser, baseFileLocation, updateOnapVersion) handleResults(resultsHeat) - errorAndExit(0, None) + error_and_exit(0, None) if __name__ == "__main__": main(sys.argv[1:]) diff --git a/catalog-be/src/main/resources/scripts/import/tosca/upgradeONAPTypes.py b/catalog-be/src/main/resources/scripts/import/tosca/upgradeONAPTypes.py index edf5a194f6..24a7b0e5b3 100644 --- a/catalog-be/src/main/resources/scripts/import/tosca/upgradeONAPTypes.py +++ b/catalog-be/src/main/resources/scripts/import/tosca/upgradeONAPTypes.py @@ -55,7 +55,7 @@ def main(argv): opts, args = getopt.getopt(argv, "i:p:u:v:h:s:", ["ip=", "port=", "user=", "updateversion=","scheme="]) except getopt.GetoptError: usage() - errorAndExit(2, 'Invalid input') + error_and_exit(2, 'Invalid input') for opt, arg in opts: # print opt, arg @@ -94,9 +94,9 @@ def main(argv): failedNormatives = filter(lambda x: x[1] == None or x[1] not in responseCodes, results) if (len(failedNormatives) > 0): - errorAndExit(1, None) + error_and_exit(1, None) else: - errorAndExit(0, None) + error_and_exit(0, None) if __name__ == "__main__": diff --git a/catalog-be/src/main/resources/scripts/import/tosca/upgradeSolTypes.py b/catalog-be/src/main/resources/scripts/import/tosca/upgradeSolTypes.py index 25d9b4d1fc..d3e5a4b2da 100644 --- a/catalog-be/src/main/resources/scripts/import/tosca/upgradeSolTypes.py +++ b/catalog-be/src/main/resources/scripts/import/tosca/upgradeSolTypes.py @@ -55,7 +55,7 @@ def main(argv): opts, args = getopt.getopt(argv, "i:p:u:v:h:s:", ["ip=", "port=", "user=", "updateversion=","scheme="]) except getopt.GetoptError: usage() - errorAndExit(2, 'Invalid input') + error_and_exit(2, 'Invalid input') for opt, arg in opts: # print opt, arg @@ -94,9 +94,9 @@ def main(argv): failedNormatives = filter(lambda x: x[1] == None or x[1] not in responseCodes, results) if (len(failedNormatives) > 0): - errorAndExit(1, None) + error_and_exit(1, None) else: - errorAndExit(0, None) + error_and_exit(0, None) if __name__ == "__main__":