--- /dev/null
+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
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
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:
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
type: string
required: true
tosca.datatypes.nfv.L2AddressData:
- derived_from: tosca.datatypes.Root
- properties:
+ properties:
mac_address_assignment:
type: boolean
required: true
flavourId:
type: string
tosca.datatypes.nfv.ext.AddressPairs:
- properties:
+ properties:
ip:
type: string
required: false
type: string
required: false
tosca.datatypes.nfv.ext.FloatingIP:
- properties:
+ properties:
external_network:
type: string
required: false
type: string
required: false
tosca.datatypes.nfv.ext.LocationInfo:
- properties:
+ properties:
availability_zone:
type: string
required: false
type: string
required: false
tosca.datatypes.nfv.ext.HostRouteInfo:
- properties:
+ properties:
destination:
type: string
required: false
type: string
required: false
tosca.datatypes.nfv.ext.InjectData:
- properties:
+ properties:
file_name:
type: string
required: false
type: string
required: false
tosca.datatypes.nfv.ext.zte.WatchDog:
- properties:
+ properties:
enable_delay:
type: integer
required: false
type: string
required: false
tosca.datatypes.nfv.ext.LocalAffinityOrAntiAffinityRule:
- properties:
+ properties:
scope:
type: string
required: false
--- /dev/null
+{
+ "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
node_types:
org.openecomp.resource.abstract.nodes.service:
derived_from: tosca.nodes.Root
-
\ No newline at end of file
--- /dev/null
+{
+ "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
--- /dev/null
+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
--- /dev/null
+{
+ "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
--- /dev/null
+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
--- /dev/null
+{
+ "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
--- /dev/null
+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
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
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
--- /dev/null
+{
+ "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
--- /dev/null
+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
+
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
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
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
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
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
--- /dev/null
+{
+ "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
--- /dev/null
+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
- 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
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
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
tosca_definitions_version: tosca_simple_yaml_1_0_0
+
node_types:
org.openecomp.resource.vl.ELine:
derived_from: org.openecomp.resource.vl.VL
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
--- /dev/null
+{
+ "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"
+ ]
+}
--- /dev/null
+
+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
--- /dev/null
+{
+ "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
--- /dev/null
+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
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
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
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
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
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
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
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
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
--- /dev/null
+{
+ "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
--- /dev/null
+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
+
--- /dev/null
+{
+ "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
- 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
--- /dev/null
+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:])
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.'
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
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> ] '
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.'
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
-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 #
#####################################################################################################################################################################################
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:])
"extNeutronCP",
"extContrailCP",
"portMirroringByPolicy",
- "forwardingPath"
+ "forwardingPath",
+ "VRFObject",
+ "extVirtualMachineInterfaceCP",
+ "VLANNetworkReceptor",
+ "VRFEntry",
+ "subInterfaceV2",
+ "contrailV2VLANSubInterfaceV2",
+ "configuration",
+ "fabricConfiguration"
]
responseCodes = [200, 201]
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
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__":
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
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__":
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
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:])
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 #
#################################################################################################################################################################################################################################
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:])
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):
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
import pycurl
-import sys, getopt
from StringIO import StringIO
import json
import copy
from importCommon import *
+
+
#################################################################################################################################################################################
# #
# Import all users from a given file #
# 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)
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):
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
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]
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.'
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
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:])
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
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__":
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.'
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
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:])
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
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__":
-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 #
#####################################################################################################################################################################################
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:])
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
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__":
return (userId, None)
-def errorAndExit(errorCode, errorDesc):
+def error_and_exit(errorCode, errorDesc):
if ( errorCode > 0 ):
print("status=" + str(errorCode) + ". " + errorDesc)
else:
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
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)
print("Loaded users: " + ', '.join(map(lambda x: x[0],result)))
print("-------------------------------------------")
- errorAndExit(0, None)
+ error_and_exit(0, None)
if __name__ == "__main__":
{
"heat": [
- "Generic_CR"
+ "configuration",
+ "fabricConfiguration"
],
"normative": [
]
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
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__":
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
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__":
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
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__":
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 *
#################################################################################################################################################################################################################################
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:])
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.'
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
handleResults(results, 'false')
- errorAndExit(0, None)
+ error_and_exit(0, None)
if __name__ == "__main__":
main(sys.argv[1:])
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]
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.'
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
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:])
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.'
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
handleResults(results, 'false')
- errorAndExit(0, None)
+ error_and_exit(0, None)
if __name__ == "__main__":
main(sys.argv[1:])
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.'
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
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:])
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
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__":
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
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__":