Align normatives and scripts 29/56929/1
authorTal Gitelman <tg851x@intl.att.com>
Thu, 19 Jul 2018 15:25:12 +0000 (18:25 +0300)
committerTal Gitelman <tg851x@intl.att.com>
Thu, 19 Jul 2018 15:28:04 +0000 (18:28 +0300)
Change-Id: I5e15e3c5adaf13a5b785613d20411f5d0e42e264
Issue-ID: SDC-1544
Signed-off-by: Tal Gitelman <tg851x@intl.att.com>
97 files changed:
catalog-be/src/main/resources/import/tosca/annotation-types/annotationTypes.yml [new file with mode: 0644]
catalog-be/src/main/resources/import/tosca/annotation-types/annotationTypes.zip [new file with mode: 0644]
catalog-be/src/main/resources/import/tosca/capability-types/capabilityTypes.yml
catalog-be/src/main/resources/import/tosca/capability-types/capabilityTypes.zip
catalog-be/src/main/resources/import/tosca/data-types/dataTypes.yml
catalog-be/src/main/resources/import/tosca/group-types/groupTypes.json [new file with mode: 0644]
catalog-be/src/main/resources/import/tosca/heat-types/Generic_Service/Generic_Service.yml
catalog-be/src/main/resources/import/tosca/heat-types/Generic_Service/Generic_Service.zip
catalog-be/src/main/resources/import/tosca/heat-types/VLANNetworkReceptor/VLANNetworkReceptor.json [new file with mode: 0644]
catalog-be/src/main/resources/import/tosca/heat-types/VLANNetworkReceptor/VLANNetworkReceptor.yml [new file with mode: 0644]
catalog-be/src/main/resources/import/tosca/heat-types/VLANNetworkReceptor/VLANNetworkReceptor.zip [new file with mode: 0644]
catalog-be/src/main/resources/import/tosca/heat-types/VRFEntry/VRFEntry.json [new file with mode: 0644]
catalog-be/src/main/resources/import/tosca/heat-types/VRFEntry/VRFEntry.yml [new file with mode: 0644]
catalog-be/src/main/resources/import/tosca/heat-types/VRFEntry/VRFEntry.zip [new file with mode: 0644]
catalog-be/src/main/resources/import/tosca/heat-types/VRFObject/VRFObject.json [new file with mode: 0644]
catalog-be/src/main/resources/import/tosca/heat-types/VRFObject/VRFObject.yml [new file with mode: 0644]
catalog-be/src/main/resources/import/tosca/heat-types/VRFObject/VRFObject.zip [new file with mode: 0644]
catalog-be/src/main/resources/import/tosca/heat-types/abstractSubstitute/abstractSubstitute.yml
catalog-be/src/main/resources/import/tosca/heat-types/cinderVolume/cinderVolume.yml
catalog-be/src/main/resources/import/tosca/heat-types/configuration/configuration.json [new file with mode: 0644]
catalog-be/src/main/resources/import/tosca/heat-types/configuration/configuration.yml [new file with mode: 0644]
catalog-be/src/main/resources/import/tosca/heat-types/configuration/configuration.zip [new file with mode: 0644]
catalog-be/src/main/resources/import/tosca/heat-types/contrailAbstractSubstitute/contrailAbstractSubstitute.yml
catalog-be/src/main/resources/import/tosca/heat-types/contrailCompute/contrailCompute.yml
catalog-be/src/main/resources/import/tosca/heat-types/contrailNetworkRules/contrailNetworkRules.yml
catalog-be/src/main/resources/import/tosca/heat-types/contrailPort/contrailPort.yml
catalog-be/src/main/resources/import/tosca/heat-types/contrailV2NetworkRules/contrailV2NetworkRules.yml
catalog-be/src/main/resources/import/tosca/heat-types/contrailV2VLANSubInterfaceV2/contrailV2VLANSubInterfaceV2.json [new file with mode: 0644]
catalog-be/src/main/resources/import/tosca/heat-types/contrailV2VLANSubInterfaceV2/contrailV2VLANSubInterfaceV2.yml [new file with mode: 0644]
catalog-be/src/main/resources/import/tosca/heat-types/contrailV2VLANSubInterfaceV2/contrailV2VLANSubInterfaceV2.zip [new file with mode: 0644]
catalog-be/src/main/resources/import/tosca/heat-types/contrailV2VirtualMachineInterface/contrailV2VirtualMachineInterface.yml
catalog-be/src/main/resources/import/tosca/heat-types/contrailV2VirtualMachineInterface/contrailV2VirtualMachineInterface.zip
catalog-be/src/main/resources/import/tosca/heat-types/contrailV2VirtualNetwork/contrailV2VirtualNetwork.yml
catalog-be/src/main/resources/import/tosca/heat-types/contrailVirtualNetwork/contrailVirtualNetwork.yml
catalog-be/src/main/resources/import/tosca/heat-types/eline/eline.yml
catalog-be/src/main/resources/import/tosca/heat-types/eline/eline.zip
catalog-be/src/main/resources/import/tosca/heat-types/extNeutronCP/extNeutronCP.yml
catalog-be/src/main/resources/import/tosca/heat-types/extNeutronCP/extNeutronCP.zip
catalog-be/src/main/resources/import/tosca/heat-types/extVirtualMachineInterfaceCP/extVirtualMachineInterfaceCP.json [new file with mode: 0644]
catalog-be/src/main/resources/import/tosca/heat-types/extVirtualMachineInterfaceCP/extVirtualMachineInterfaceCP.yml [new file with mode: 0644]
catalog-be/src/main/resources/import/tosca/heat-types/extVirtualMachineInterfaceCP/extVirtualMachineInterfaceCP.zip [new file with mode: 0644]
catalog-be/src/main/resources/import/tosca/heat-types/fabricConfiguration/fabricConfiguration.json [new file with mode: 0644]
catalog-be/src/main/resources/import/tosca/heat-types/fabricConfiguration/fabricConfiguration.yml [new file with mode: 0644]
catalog-be/src/main/resources/import/tosca/heat-types/fabricConfiguration/fabricConfiguration.zip [new file with mode: 0644]
catalog-be/src/main/resources/import/tosca/heat-types/globalCompute/globalCompute.yml
catalog-be/src/main/resources/import/tosca/heat-types/globalCompute/globalCompute.zip
catalog-be/src/main/resources/import/tosca/heat-types/globalPort/globalPort.yml
catalog-be/src/main/resources/import/tosca/heat-types/globalPort/globalPort.zip
catalog-be/src/main/resources/import/tosca/heat-types/multiFlavorVFC/multiFlavorVFC.zip
catalog-be/src/main/resources/import/tosca/heat-types/neutronNet/neutronNet.yml
catalog-be/src/main/resources/import/tosca/heat-types/neutronPort/neutronPort.yml
catalog-be/src/main/resources/import/tosca/heat-types/neutronPort/neutronPort.zip
catalog-be/src/main/resources/import/tosca/heat-types/novaServer/novaServer.yml
catalog-be/src/main/resources/import/tosca/heat-types/portMirroring/portMirroring.zip
catalog-be/src/main/resources/import/tosca/heat-types/portMirroringByPolicy/portMirroringByPolicy.zip
catalog-be/src/main/resources/import/tosca/heat-types/securityRules/securityRules.yml
catalog-be/src/main/resources/import/tosca/heat-types/serviceProxy/serviceProxy.zip
catalog-be/src/main/resources/import/tosca/heat-types/subInterface/subInterface.yml
catalog-be/src/main/resources/import/tosca/heat-types/subInterfaceV2/subInterfaceV2.json [new file with mode: 0644]
catalog-be/src/main/resources/import/tosca/heat-types/subInterfaceV2/subInterfaceV2.yml [new file with mode: 0644]
catalog-be/src/main/resources/import/tosca/heat-types/subInterfaceV2/subInterfaceV2.zip [new file with mode: 0644]
catalog-be/src/main/resources/import/tosca/heat-types/vnfConfiguration/vnfConfiguration.zip
catalog-be/src/main/resources/import/tosca/interface-lifecycle-types/interfaceLifecycleTypes.zip
catalog-be/src/main/resources/import/tosca/normative-types/loadBalancer/loadBalancer.zip
catalog-be/src/main/resources/import/tosca/policy-types/policyTypes.json [new file with mode: 0644]
catalog-be/src/main/resources/import/tosca/relationship-types/relationshipTypes.yml
catalog-be/src/main/resources/import/tosca/relationship-types/relationshipTypes.zip
catalog-be/src/main/resources/scripts/import/tosca/importAnnotationTypes.py [new file with mode: 0644]
catalog-be/src/main/resources/scripts/import/tosca/importCategoryTypes.py
catalog-be/src/main/resources/scripts/import/tosca/importCommon.py
catalog-be/src/main/resources/scripts/import/tosca/importDataTypes.py
catalog-be/src/main/resources/scripts/import/tosca/importGroupTypes.py
catalog-be/src/main/resources/scripts/import/tosca/importHeatTypes.py
catalog-be/src/main/resources/scripts/import/tosca/importNfvTypes.py
catalog-be/src/main/resources/scripts/import/tosca/importNodeType.py
catalog-be/src/main/resources/scripts/import/tosca/importNormativeAll.py
catalog-be/src/main/resources/scripts/import/tosca/importNormativeCapabilities.py
catalog-be/src/main/resources/scripts/import/tosca/importNormativeElements.py
catalog-be/src/main/resources/scripts/import/tosca/importNormativeInterfaceLifecycleTypes.py
catalog-be/src/main/resources/scripts/import/tosca/importNormativeNoHeatAndNormativeTypes.py
catalog-be/src/main/resources/scripts/import/tosca/importNormativeTypes.py
catalog-be/src/main/resources/scripts/import/tosca/importONAPNormativeAll.py
catalog-be/src/main/resources/scripts/import/tosca/importOnapTypes.py
catalog-be/src/main/resources/scripts/import/tosca/importPolicyTypes.py
catalog-be/src/main/resources/scripts/import/tosca/importSolTypes.py
catalog-be/src/main/resources/scripts/import/tosca/importUsersFromYaml.py
catalog-be/src/main/resources/scripts/import/tosca/typesToUpgrade.json
catalog-be/src/main/resources/scripts/import/tosca/upgradeHeatAndNormativeTypes.py
catalog-be/src/main/resources/scripts/import/tosca/upgradeHeatTypes1707.py
catalog-be/src/main/resources/scripts/import/tosca/upgradeNfvTypes.py
catalog-be/src/main/resources/scripts/import/tosca/upgradeNormative.py
catalog-be/src/main/resources/scripts/import/tosca/upgradeNormativeVersion.py
catalog-be/src/main/resources/scripts/import/tosca/upgradeNormativeVersionAll.py
catalog-be/src/main/resources/scripts/import/tosca/upgradeNormativeVersionProd1702_3537.py
catalog-be/src/main/resources/scripts/import/tosca/upgradeONAPNormative.py
catalog-be/src/main/resources/scripts/import/tosca/upgradeONAPTypes.py
catalog-be/src/main/resources/scripts/import/tosca/upgradeSolTypes.py

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 (file)
index 0000000..edd20e7
--- /dev/null
@@ -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 (file)
index 0000000..5783c97
Binary files /dev/null and b/catalog-be/src/main/resources/import/tosca/annotation-types/annotationTypes.zip differ
index 56da214..9a6bc09 100644 (file)
@@ -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: 
index dce4bf7..8304553 100644 (file)
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
index c5555a5..b3635dc 100644 (file)
@@ -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 (file)
index 0000000..caea6a8
--- /dev/null
@@ -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
index 902cf0c..3652ae4 100644 (file)
@@ -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
index 060dec1..f1e3fdd 100644 (file)
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 (file)
index 0000000..157b62a
--- /dev/null
@@ -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 (file)
index 0000000..6d78186
--- /dev/null
@@ -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 (file)
index 0000000..8ad09ed
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 (file)
index 0000000..ab28d03
--- /dev/null
@@ -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 (file)
index 0000000..7cba5a8
--- /dev/null
@@ -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 (file)
index 0000000..fa6312e
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 (file)
index 0000000..2d3f541
--- /dev/null
@@ -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 (file)
index 0000000..28f1d52
--- /dev/null
@@ -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 (file)
index 0000000..23287d6
Binary files /dev/null and b/catalog-be/src/main/resources/import/tosca/heat-types/VRFObject/VRFObject.zip differ
index 7aa7edf..48db2b6 100644 (file)
@@ -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
index 87dfc31..fb69c6c 100644 (file)
@@ -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 (file)
index 0000000..ea56a6b
--- /dev/null
@@ -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 (file)
index 0000000..88be651
--- /dev/null
@@ -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 (file)
index 0000000..74f5048
Binary files /dev/null and b/catalog-be/src/main/resources/import/tosca/heat-types/configuration/configuration.zip differ
index a1f40c5..5bdee93 100644 (file)
@@ -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
index c2ba70e..4ca0f04 100644 (file)
@@ -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
index 2f8228a..b9d61e7 100644 (file)
@@ -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
index ce99511..84717a4 100644 (file)
@@ -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
index ad4369c..ccc6d3a 100644 (file)
@@ -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 (file)
index 0000000..d6139b3
--- /dev/null
@@ -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 (file)
index 0000000..a9a89e8
--- /dev/null
@@ -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 (file)
index 0000000..cc65bf9
Binary files /dev/null and b/catalog-be/src/main/resources/import/tosca/heat-types/contrailV2VLANSubInterfaceV2/contrailV2VLANSubInterfaceV2.zip differ
index a217907..69e15ff 100644 (file)
@@ -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
index 60950b6..8564579 100644 (file)
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
index 0fa7c94..cfff898 100644 (file)
@@ -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
index c0d1f3d..f1ebbea 100644 (file)
@@ -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
index 7987688..2124136 100644 (file)
@@ -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
index 8ba7cbc..ea770f5 100644 (file)
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
index 35306f5..ad946fc 100644 (file)
@@ -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
index 02b62a6..944dfb7 100644 (file)
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 (file)
index 0000000..1e4e15f
--- /dev/null
@@ -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 (file)
index 0000000..6816e7b
--- /dev/null
@@ -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 (file)
index 0000000..4edd5b3
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 (file)
index 0000000..ee48a77
--- /dev/null
@@ -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 (file)
index 0000000..18658b9
--- /dev/null
@@ -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 (file)
index 0000000..15088d9
Binary files /dev/null and b/catalog-be/src/main/resources/import/tosca/heat-types/fabricConfiguration/fabricConfiguration.zip differ
index 4ac9950..ee7ced6 100644 (file)
@@ -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
index 23a471f..a04df59 100644 (file)
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
index 791a0b9..c0fd672 100644 (file)
@@ -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
index efeafe8..b0929ff 100644 (file)
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
index d73488d..9edb9f5 100644 (file)
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
index 539e339..f5cf4fc 100644 (file)
@@ -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
index 34a74eb..9451698 100644 (file)
@@ -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
index e33365a..5f33401 100644 (file)
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
index 2271c9c..1cbf98b 100644 (file)
@@ -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
index cbed61f..ca5650b 100644 (file)
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
index a11e4f7..7a4ce51 100644 (file)
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
index 876b2f1..8fd1909 100644 (file)
@@ -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
index 9f0b60d..55ffe94 100644 (file)
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
index 2356f82..6f2d26a 100644 (file)
@@ -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 (file)
index 0000000..2b7d98c
--- /dev/null
@@ -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 (file)
index 0000000..7c19089
--- /dev/null
@@ -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 (file)
index 0000000..fc34ec5
Binary files /dev/null and b/catalog-be/src/main/resources/import/tosca/heat-types/subInterfaceV2/subInterfaceV2.zip differ
index 03a7d53..eb763da 100644 (file)
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
index 574a484..f9894d6 100644 (file)
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
index 3a847c6..3ae6e5d 100644 (file)
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 (file)
index 0000000..9f97d55
--- /dev/null
@@ -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
index fa4d5b7..2ed8c0e 100644 (file)
-  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:
         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
index bc70987..5db20ab 100644 (file)
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 (file)
index 0000000..5f0d4ad
--- /dev/null
@@ -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> | --scheme=<scheme> ] [-i <be host> | --ip=<be host>] [-p <be port> | --port=<be port> ] [-f <input file> | --ifile=<input file> ]  #
+#                                                                                                                                                                                                                                                                                                                                                                      #
+# shortest activation (be host = localhost, be port = 8080):                                                                                                                                                                                                                                           #
+#              python importAnnotaionTypes.py [-f <input file> | --ifile=<input file> ]                                                                                                                                                                                                #
+#                                                                                                                                                                                                                                                                                                                                                              #
+#####################################################################################################################################################################################
+
+
+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:])
index 2f32371..9ef8b4a 100644 (file)
@@ -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
index acdb067..ed92ca8 100644 (file)
@@ -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> | --scheme=<scheme>, default http ] [-i <be host> | --ip=<be host>] [-p <be port> ' \
+            '| --port=<be port> ] [-u <user userId> | --user=<user userId> ] '
index ef51a90..bc68297 100644 (file)
@@ -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
index 9daa990..0a94bbe 100644 (file)
@@ -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> | --scheme=<scheme>, default http ] [-i <be host> | --ip=<be host>] [-p <be port> | --port=<be port> ] [-u <user userId> | --user=<user userId> ]'
+    print sys.argv[
+        0], '[optional -s <scheme> | --scheme=<scheme>, default http ] [-i <be host> | --ip=<be host>] [-p <be port> | --port=<be port> ] [-u <user userId> | --user=<user userId> ]'
+
 
+def 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:])
index 4490fec..74ecf71 100644 (file)
@@ -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__":
index 8e63d86..3de4719 100644 (file)
@@ -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__":
index 7d0b7c5..24218b6 100644 (file)
@@ -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:])
index d57c3d6..8a83290 100644 (file)
@@ -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> | --scheme=<scheme>, default http] [-i <be host> | --ip=<be host>] [-p <be port> | --port=<be port> ] [-u <user userId> | --user=<user userId> ] [-d <true|false> | --debug=<true|false>] [-v <true|false> | --updateversion=<true|false>]'
+    print sys.argv[
+        0], '[optional -s <scheme> | --scheme=<scheme>, default http] [-i <be host> | --ip=<be host>] [-p <be port> | --port=<be port> ] [-u <user userId> | --user=<user userId> ] [-d <true|false> | --debug=<true|false>] [-v <true|false> | --updateversion=<true|false>]'
+
 
 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:])
index e4f9213..e0f5c40 100644 (file)
@@ -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
index c28bbfb..f9f5cd5 100644 (file)
@@ -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 <input file> | --ifile=<input file> ]                                                                                                                                                                                                         #
 #                                                                                                                                                                                                                                                                                                                                                      #
 #################################################################################################################################################################################
+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)
index a6ab574..89862f7 100644 (file)
@@ -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
index 1061df8..c288d55 100644 (file)
@@ -34,10 +34,10 @@ def usage():
        print sys.argv[0], '[optional -s <scheme> | --scheme=<scheme>, default http] [-i <be host> | --ip=<be host>] [-p <be port> | --port=<be port> ] [-u <user userId> | --user=<user userId> ] [-d <true|false> | --debug=<true|false>] [-v <true|false> | --updateversion=<true|false>]'
 
 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:])
index 5b7b52d..51d3658 100644 (file)
@@ -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__":
index 6144d69..ef1fe4d 100644 (file)
@@ -37,19 +37,20 @@ def usage():
        print sys.argv[0], '[-s <scheme> | --scheme=<scheme> ] [-i <be host> | --ip=<be host>] [-p <be port> | --port=<be port> ] [-u <user userId> | --user=<user userId> ] [-d <true|false> | --debug=<true|false>] [-v <true|false> | --updateversion=<true|false>]'
 
 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:])
index f703b4b..395b42d 100644 (file)
@@ -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__":
index 103ad2d..1bd6bef 100644 (file)
@@ -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> | --scheme=<scheme>, default http] [-i <be host> | --ip=<be host>] [-p <be port> | --port=<be port> ] [-u <user userId> | --user=<user userId> ]'
+    print sys.argv[
+        0], '[optional -s <scheme> | --scheme=<scheme>, default http] [-i <be host> | --ip=<be host>] [-p <be port> | --port=<be port> ] [-u <user userId> | --user=<user userId> ]'
+
 
+def 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:])
index 0015a26..24479c4 100644 (file)
@@ -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__":
index 8e69ffc..23e854b 100644 (file)
@@ -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__":
index 5a1d104..265bf33 100644 (file)
@@ -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__":
index 5cb0ca3..4f254f2 100644 (file)
@@ -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__":
index 66d82f9..cb7628e 100644 (file)
@@ -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__":
index 573e05b..bbeb3d6 100644 (file)
@@ -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> | --scheme=<scheme>, default http] [-i <be host> | --ip=<be host>] [-p <be port> | --port=<be port> ] [-u <user userId> | --user=<user userId> ] [-d <true|false> | --debug=<true|false>]'
+    print sys.argv[0], '[optional -s <scheme> | --scheme=<scheme>, default http] [-i <be host> | --ip=<be host>] [-p <be port> | --port=<be port> ] [-u <user userId> | --user=<user userId> ] [-d <true|false> | --debug=<true|false>]'
 
 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:])
index 958416d..c6fa1c9 100644 (file)
@@ -24,14 +24,14 @@ def usage():
        print sys.argv[0], '[optional -s <scheme> | --scheme=<scheme>, default http] [-i <be host> | --ip=<be host>] [-p <be port> | --port=<be port> ] [-u <user userId> | --user=<user userId> ] [-d <true|false> | --debug=<true|false>]'
 
 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:])
index 805d012..3204551 100644 (file)
@@ -13,10 +13,10 @@ def usage():
        print sys.argv[0], '[optional -s <scheme> | --scheme=<scheme>, default http] [-i <be host> | --ip=<be host>] [-p <be port> | --port=<be port> ] [-u <user userId> | --user=<user userId> ] [-d <true|false> | --debug=<true|false>] [-v <true|false> | --updateversion=<true|false>]'
 
 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:])
index c75966c..972d792 100644 (file)
@@ -24,14 +24,14 @@ def usage():
        print sys.argv[0], '[optional -s <scheme> | --scheme=<scheme>, default http] [-i <be host> | --ip=<be host>] [-p <be port> | --port=<be port> ] [-u <user userId> | --user=<user userId> ] [-d <true|false> | --debug=<true|false>]'
 
 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:])
index 289678b..bebba6c 100644 (file)
@@ -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:])
index edf5a19..24a7b0e 100644 (file)
@@ -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__":
index 25d9b4d..d3e5a4b 100644 (file)
@@ -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__":