[WIP] affectedVirtualStorages should not be set

affectedVirtualStorages should be absent in
notification when vnfd does not contain virtual
storage

Implemented a check during populating
affectedVirtualStorages, affectedVirtualLinks,
affectedVnfcs in notification

Closes-Bug: #1973372
Change-Id: Ic83359553fb256de83f8cf1578656f842945b6d0
This commit is contained in:
Pooja Singla 2022-05-13 19:30:24 +00:00
parent ca4fd02f45
commit 1e0c430ca4
16 changed files with 2888 additions and 15 deletions

View File

@ -326,13 +326,15 @@ class VnfLcmController(wsgi.Controller):
if operation_state in (fields.LcmOccsOperationState.FAILED,
fields.LcmOccsOperationState.FAILED_TEMP):
vnf_lcm_op_occs_id = vnf_lcm_op_occs.id
notification['affectedVnfcs'] = affected_resources.get(
'affectedVnfcs', [])
notification['affectedVirtualLinks'] = affected_resources.get(
'affectedVirtualLinks', [])
notification['affectedVirtualStorages'] = affected_resources.get(
'affectedVirtualStorages', [])
if affected_resources.get("affectedVnfcs"):
notification['affectedVnfcs'] = affected_resources.get(
'affectedVnfcs')
if affected_resources.get("affectedVirtualLinks"):
notification['affectedVirtualLinks'] = affected_resources.get(
'affectedVirtualLinks')
if affected_resources.get("affectedVirtualStorages"):
notification['affectedVirtualStorages'] = \
affected_resources.get('affectedVirtualStorages')
notification['error'] = str(vnf_lcm_op_occs.error)
else:

View File

@ -1724,12 +1724,15 @@ class Conductor(manager.Manager, v2_hook.ConductorV2Hook):
vnf_lcm_op_occ.changed_ext_connectivity = (
changed_ext_connectivity)
vnf_lcm_op_occ.save()
notification_data['affectedVnfcs'] = \
affected_resources.get('affectedVnfcs', [])
notification_data['affectedVirtualLinks'] = \
affected_resources.get('affectedVirtualLinks', [])
notification_data['affectedVirtualStorages'] = \
affected_resources.get('affectedVirtualStorages', [])
if affected_resources.get('affectedVnfcs'):
notification_data['affectedVnfcs'] = \
affected_resources.get('affectedVnfcs')
if affected_resources.get('affectedVirtualLinks'):
notification_data['affectedVirtualLinks'] = \
affected_resources.get('affectedVirtualLinks')
if affected_resources.get('affectedVirtualStorages'):
notification_data['affectedVirtualStorages'] = \
affected_resources.get('affectedVirtualStorages')
notification_data['notificationStatus'] = \
fields.LcmOccsNotificationStatus.RESULT
notification_data['changedExtConnectivity'] = \

View File

@ -0,0 +1,110 @@
heat_template_version: 2013-05-23
description: 'Simple Base HOT for Sample VNF'
parameters:
nfv:
type: json
resources:
VDU1_scale:
type: OS::Heat::AutoScalingGroup
properties:
min_size: 1
max_size: 3
desired_capacity: 1
resource:
type: VDU1.yaml
properties:
flavor: { get_param: [ nfv, VDU, VDU1, flavor ] }
image: { get_param: [ nfv, VDU, VDU1, image ] }
zone: { get_param: [ nfv, vdu, VDU1, zone ] }
net1: { get_param: [ nfv, CP, VDU1_CP1, network ] }
net2: { get_param: [ nfv, CP, VDU1_CP2, network ] }
net3: { get_resource: internalVL1 }
net4: { get_resource: internalVL2 }
net5: { get_resource: internalVL3 }
subnet: { get_param: [nfv, CP, VDU1_CP2, fixed_ips, 0, subnet]}
VDU1_scale_scale_out:
type: OS::Heat::ScalingPolicy
properties:
cooldown: 300
scaling_adjustment: 1
auto_scaling_group_id:
get_resource: VDU1_scale
adjustment_type: change_in_capacity
VDU1_scale_scale_in:
type: OS::Heat::ScalingPolicy
properties:
cooldown: 300
scaling_adjustment: -1
auto_scaling_group_id:
get_resource: VDU1_scale
adjustment_type: change_in_capacity
VDU2_scale:
type: OS::Heat::AutoScalingGroup
properties:
cooldown: 300
min_size: 1
max_size: 1
desired_capacity: 1
resource:
type: VDU2.yaml
properties:
flavor: { get_param: [ nfv, VDU, VDU2, flavor ] }
image: { get_param: [ nfv, VDU, VDU2, image ] }
zone: { get_param: [ nfv, vdu, VDU2, zone ] }
net1: { get_param: [ nfv, CP, VDU2_CP1, network ] }
net2: { get_param: [ nfv, CP, VDU2_CP2, network ] }
net3: { get_resource: internalVL1 }
net4: { get_resource: internalVL2 }
net5: { get_resource: internalVL3 }
ip1: { get_param: [nfv, CP, VDU2_CP2, fixed_ips, 0, ip_address]}
subnet: { get_param: [nfv, CP, VDU2_CP2, fixed_ips, 0, subnet]}
VDU2_scale_scale_out:
type: OS::Heat::ScalingPolicy
properties:
cooldown: 300
scaling_adjustment: 1
auto_scaling_group_id:
get_resource: VDU2_scale
adjustment_type: change_in_capacity
VDU2_scale_scale_in:
type: OS::Heat::ScalingPolicy
properties:
cooldown: 300
scaling_adjustment: -1
auto_scaling_group_id:
get_resource: VDU2_scale
adjustment_type: change_in_capacity
extmanageNW_1:
type: OS::Neutron::Net
extmanageNW_2:
type: OS::Neutron::Net
internalVL1:
type: OS::Neutron::Net
internalVL2:
type: OS::Neutron::Net
internalVL3:
type: OS::Neutron::Net
internalVL1_subnet:
type: OS::Neutron::Subnet
properties:
ip_version: 4
network:
get_resource: internalVL1
cidr: 192.168.3.0/24
internalVL2_subnet:
type: OS::Neutron::Subnet
properties:
ip_version: 4
network:
get_resource: internalVL2
cidr: 192.168.4.0/24
internalVL3_subnet:
type: OS::Neutron::Subnet
properties:
ip_version: 4
network:
get_resource: internalVL3
cidr: 192.168.5.0/24
outputs: {}

View File

@ -0,0 +1,64 @@
heat_template_version: 2013-05-23
description: 'VDU1 HOT for Sample VNF'
parameters:
flavor:
type: string
image:
type: string
zone:
type: string
net1:
type: string
net2:
type: string
net3:
type: string
net4:
type: string
net5:
type: string
subnet:
type: string
resources:
VDU1:
type: OS::Nova::Server
properties:
flavor: { get_param: flavor }
image: { get_param: image }
name: VDU1
networks:
- port:
get_resource: VDU1_CP1
- port:
get_resource: VDU1_CP2
- port:
get_resource: VDU1_CP3
- port:
get_resource: VDU1_CP4
- port:
get_resource: VDU1_CP5
availability_zone: { get_param: zone }
VDU1_CP1:
type: OS::Neutron::Port
properties:
network: { get_param: net1 }
VDU1_CP2:
type: OS::Neutron::Port
properties:
network: { get_param: net2 }
fixed_ips:
- subnet: { get_param: subnet}
VDU1_CP3:
type: OS::Neutron::Port
properties:
network: { get_param: net3 }
VDU1_CP4:
type: OS::Neutron::Port
properties:
network: { get_param: net4 }
VDU1_CP5:
type: OS::Neutron::Port
properties:
network: { get_param: net5 }

View File

@ -0,0 +1,68 @@
heat_template_version: 2013-05-23
description: 'VDU2 HOT for Sample VNF'
parameters:
flavor:
type: string
image:
type: string
zone:
type: string
net1:
type: string
net2:
type: string
net3:
type: string
net4:
type: string
net5:
type: string
ip1:
type: string
subnet:
type: string
resources:
VDU2:
type: OS::Nova::Server
properties:
flavor: { get_param: flavor }
name: VDU2
image: { get_param: image }
networks:
- port:
get_resource: VDU2_CP1
- port:
get_resource: VDU2_CP2
- port:
get_resource: VDU2_CP3
- port:
get_resource: VDU2_CP4
- port:
get_resource: VDU2_CP5
availability_zone: { get_param: zone }
VDU2_CP1:
type: OS::Neutron::Port
properties:
network: { get_param: net1 }
VDU2_CP2:
type: OS::Neutron::Port
properties:
network: { get_param: net2 }
fixed_ips:
- ip_address: { get_param: ip1}
subnet: { get_param: subnet}
VDU2_CP3:
type: OS::Neutron::Port
properties:
network: { get_param: net3 }
VDU2_CP4:
type: OS::Neutron::Port
properties:
network: { get_param: net4 }
VDU2_CP5:
type: OS::Neutron::Port
properties:
network: { get_param: net5 }

View File

@ -0,0 +1,259 @@
capability_types:
tosca.capabilities.nfv.VirtualLinkable:
derived_from: tosca.capabilities.Node
description: A node type that includes the VirtualLinkable capability indicates
that it can be pointed by tosca.relationships.nfv.VirtualLinksTo relationship
type
data_types:
tosca.datatypes.nfv.AddressData:
derived_from: tosca.datatypes.Root
description: Describes information about the addressing scheme and parameters
applicable to a CP
properties:
address_type:
constraints:
- valid_values:
- mac_address
- ip_address
description: Describes the type of the address to be assigned to a connection
point. The content type shall be aligned with the address type supported
by the layerProtocol property of the connection point
required: true
type: string
l2_address_data:
description: Provides the information on the MAC addresses to be assigned
to a connection point.
required: false
type: tosca.datatypes.nfv.L2AddressData
l3_address_data:
description: Provides the information on the IP addresses to be assigned to
a connection point
required: false
type: tosca.datatypes.nfv.L3AddressData
tosca.datatypes.nfv.ConnectivityType:
derived_from: tosca.datatypes.Root
description: describes additional connectivity information of a virtualLink
properties:
flow_pattern:
constraints:
- valid_values:
- line
- tree
- mesh
description: Identifies the flow pattern of the connectivity
required: false
type: string
layer_protocols:
description: Identifies the protocol a virtualLink gives access to (ethernet,
mpls, odu2, ipv4, ipv6, pseudo-wire).The top layer protocol of the virtualLink
protocol stack shall always be provided. The lower layer protocols may be
included when there are specific requirements on these layers.
entry_schema:
constraints:
- valid_values:
- ethernet
- mpls
- odu2
- ipv4
- ipv6
- pseudo-wire
type: string
required: true
type: list
tosca.datatypes.nfv.CpProtocolData:
derived_from: tosca.datatypes.Root
description: Describes and associates the protocol layer that a CP uses together
with other protocol and connection point information
properties:
address_data:
description: Provides information on the addresses to be assigned to the CP
entry_schema:
type: tosca.datatypes.nfv.AddressData
required: false
type: list
associated_layer_protocol:
constraints:
- valid_values:
- ethernet
- mpls
- odu2
- ipv4
- ipv6
- pseudo-wire
description: One of the values of the property layer_protocols of the CP
required: true
type: string
tosca.datatypes.nfv.L2AddressData:
derived_from: tosca.datatypes.Root
description: Describes the information on the MAC addresses to be assigned to
a connection point.
properties:
mac_address_assignment:
description: Specifies if the address assignment is the responsibility of
management and orchestration function or not. If it is set to True, it is
the management and orchestration function responsibility
required: true
type: boolean
tosca.datatypes.nfv.L3AddressData:
derived_from: tosca.datatypes.Root
description: Provides information about Layer 3 level addressing scheme and parameters
applicable to a CP
properties:
floating_ip_activated:
description: Specifies if the floating IP scheme is activated on the Connection
Point or not
required: true
type: boolean
ip_address_assignment:
description: Specifies if the address assignment is the responsibility of
management and orchestration function or not. If it is set to True, it is
the management and orchestration function responsibility
required: true
type: boolean
ip_address_type:
constraints:
- valid_values:
- ipv4
- ipv6
description: Defines address type. The address type should be aligned with
the address type supported by the layer_protocols properties of the parent
VnfExtCp
required: false
type: string
number_of_ip_address:
constraints:
- greater_than: 0
description: Minimum number of IP addresses to be assigned
required: false
type: integer
tosca.datatypes.nfv.LinkBitrateRequirements:
derived_from: tosca.datatypes.Root
description: describes the requirements in terms of bitrate for a virtual link
properties:
leaf:
constraints:
- greater_or_equal: 0
description: Specifies the throughput requirement in bits per second of leaf
connections to the link when applicable to the connectivity type (e.g. for
E-Tree and E LAN branches).
required: false
type: integer
root:
constraints:
- greater_or_equal: 0
description: Specifies the throughput requirement in bits per second of the
link (e.g. bitrate of E-Line, root bitrate of E-Tree, aggregate capacity
of E-LAN).
required: true
type: integer
tosca.datatypes.nfv.Qos:
derived_from: tosca.datatypes.Root
description: describes QoS data for a given VL used in a VNF deployment flavour
properties:
latency:
constraints:
- greater_than: 0 s
description: Specifies the maximum latency
required: true
type: scalar-unit.time
packet_delay_variation:
constraints:
- greater_or_equal: 0 s
description: Specifies the maximum jitter
required: true
type: scalar-unit.time
packet_loss_ratio:
constraints:
- in_range:
- 0.0
- 1.0
description: Specifies the maximum packet loss ratio
required: false
type: float
tosca.datatypes.nfv.VnfProfile:
derived_from: tosca.datatypes.Root
description: describes a profile for instantiating VNFs of a particular NS DF
according to a specific VNFD and VNF DF.
properties:
instantiation_level:
description: Identifier of the instantiation level of the VNF DF to be used
for instantiation. If not present, the default instantiation level as declared
in the VNFD shall be used.
required: false
type: string
max_number_of_instances:
constraints:
- greater_or_equal: 0
description: Maximum number of instances of the VNF based on this VNFD that
is permitted to exist for this VnfProfile.
required: true
type: integer
min_number_of_instances:
constraints:
- greater_or_equal: 0
description: Minimum number of instances of the VNF based on this VNFD that
is permitted to exist for this VnfProfile.
required: true
type: integer
description: ETSI NFV SOL 001 common types definitions version 2.6.1
metadata:
template_author: ETSI_NFV
template_name: etsi_nfv_sol001_common_types
template_version: 2.6.1
node_types:
tosca.nodes.nfv.Cp:
derived_from: tosca.nodes.Root
description: Provides information regarding the purpose of the connection point
properties:
description:
description: Provides human-readable information on the purpose of the connection
point
required: false
type: string
layer_protocols:
description: Identifies which protocol the connection point uses for connectivity
purposes
entry_schema:
constraints:
- valid_values:
- ethernet
- mpls
- odu2
- ipv4
- ipv6
- pseudo-wire
type: string
required: true
type: list
protocol:
description: Provides information on the addresses to be assigned to the connection
point(s) instantiated from this Connection Point Descriptor
entry_schema:
type: tosca.datatypes.nfv.CpProtocolData
required: false
type: list
role:
constraints:
- valid_values:
- root
- leaf
description: Identifies the role of the port in the context of the traffic
flow patterns in the VNF or parent NS
required: false
type: string
trunk_mode:
description: Provides information about whether the CP instantiated from this
Cp is in Trunk mode (802.1Q or other), When operating in "trunk mode", the
Cp is capable of carrying traffic for several VLANs. Absence of this property
implies that trunkMode is not configured for the Cp i.e. It is equivalent
to boolean value "false".
required: false
type: boolean
relationship_types:
tosca.relationships.nfv.VirtualLinksTo:
derived_from: tosca.relationships.DependsOn
description: Represents an association relationship between the VduCp and VnfVirtualLink
node types
valid_target_types:
- tosca.capabilities.nfv.VirtualLinkable
tosca_definitions_version: tosca_simple_yaml_1_2

View File

@ -0,0 +1,396 @@
tosca_definitions_version: tosca_simple_yaml_1_2
description: Simple deployment flavour for Sample VNF
imports:
- etsi_nfv_sol001_common_types.yaml
- etsi_nfv_sol001_vnfd_types.yaml
- helloworld3_types.yaml
topology_template:
inputs:
descriptor_id:
type: string
descriptor_version:
type: string
provider:
type: string
product_name:
type: string
software_version:
type: string
vnfm_info:
type: list
entry_schema:
type: string
flavour_id:
type: string
flavour_description:
type: string
substitution_mappings:
node_type: company.provider.VNF
properties:
flavour_id: simple
requirements:
virtual_link_external1_1: [ VDU1_CP1, virtual_link ]
virtual_link_external1_2: [ VDU2_CP1, virtual_link ]
virtual_link_external2_1: [ VDU1_CP2, virtual_link ]
virtual_link_external2_2: [ VDU2_CP2, virtual_link ]
node_templates:
VNF:
type: company.provider.VNF
properties:
flavour_description: A simple flavour
interfaces:
Vnflcm:
instantiate: []
instantiate_start: []
instantiate_end: []
terminate: []
terminate_start: []
terminate_end: []
modify_information: []
modify_information_start: []
modify_information_end: []
VDU1:
type: tosca.nodes.nfv.Vdu.Compute
properties:
name: VDU1
description: VDU1 compute node
vdu_profile:
min_number_of_instances: 1
max_number_of_instances: 3
sw_image_data:
name: cirros-0.5.2-x86_64-disk
version: '0.5.2'
checksum:
algorithm: sha-256
hash: 932fcae93574e242dc3d772d5235061747dfe537668443a1f0567d893614b464
container_format: bare
disk_format: qcow2
min_disk: 0 GB
min_ram: 256 MB
size: 12 GB
capabilities:
virtual_compute:
properties:
requested_additional_capabilities:
properties:
requested_additional_capability_name: m1.tiny
support_mandatory: true
target_performance_parameters:
entry_schema: test
virtual_memory:
virtual_mem_size: 512 MB
virtual_cpu:
num_virtual_cpu: 1
virtual_local_storage:
- size_of_storage: 3 GB
VDU2:
type: tosca.nodes.nfv.Vdu.Compute
properties:
name: VDU2
description: VDU2 compute node
vdu_profile:
min_number_of_instances: 1
max_number_of_instances: 1
sw_image_data:
name: cirros-0.5.2-x86_64-disk
version: '0.5.2'
checksum:
algorithm: sha-256
hash: 932fcae93574e242dc3d772d5235061747dfe537668443a1f0567d893614b464
container_format: bare
disk_format: qcow2
min_disk: 0 GB
min_ram: 256 MB
size: 12 GB
capabilities:
virtual_compute:
properties:
requested_additional_capabilities:
properties:
requested_additional_capability_name: m1.tiny
support_mandatory: true
target_performance_parameters:
entry_schema: test
virtual_memory:
virtual_mem_size: 512 MB
virtual_cpu:
num_virtual_cpu: 1
virtual_local_storage:
- size_of_storage: 3 GB
VDU1_CP1:
type: tosca.nodes.nfv.VduCp
properties:
layer_protocols: [ ipv4 ]
order: 0
requirements:
- virtual_binding: VDU1
VDU1_CP2:
type: tosca.nodes.nfv.VduCp
properties:
layer_protocols: [ ipv4 ]
order: 1
requirements:
- virtual_binding: VDU1
VDU1_CP3:
type: tosca.nodes.nfv.VduCp
properties:
layer_protocols: [ ipv4 ]
order: 2
requirements:
- virtual_binding: VDU1
- virtual_link: internalVL1
VDU1_CP4:
type: tosca.nodes.nfv.VduCp
properties:
layer_protocols: [ ipv4 ]
order: 3
requirements:
- virtual_binding: VDU1
- virtual_link: internalVL2
VDU1_CP5:
type: tosca.nodes.nfv.VduCp
properties:
layer_protocols: [ ipv4 ]
order: 4
requirements:
- virtual_binding: VDU1
- virtual_link: internalVL3
VDU2_CP1:
type: tosca.nodes.nfv.VduCp
properties:
layer_protocols: [ ipv4 ]
order: 0
requirements:
- virtual_binding: VDU2
VDU2_CP2:
type: tosca.nodes.nfv.VduCp
properties:
layer_protocols: [ ipv4 ]
order: 1
requirements:
- virtual_binding: VDU2
VDU2_CP3:
type: tosca.nodes.nfv.VduCp
properties:
layer_protocols: [ ipv4 ]
order: 2
requirements:
- virtual_binding: VDU2
- virtual_link: internalVL1
VDU2_CP4:
type: tosca.nodes.nfv.VduCp
properties:
layer_protocols: [ ipv4 ]
order: 3
requirements:
- virtual_binding: VDU2
- virtual_link: internalVL2
VDU2_CP5:
type: tosca.nodes.nfv.VduCp
properties:
layer_protocols: [ ipv4 ]
order: 4
requirements:
- virtual_binding: VDU2
- virtual_link: internalVL3
internalVL1:
type: tosca.nodes.nfv.VnfVirtualLink
properties:
connectivity_type:
layer_protocols: [ ipv4 ]
description: External Managed Virtual link in the VNF
vl_profile:
max_bitrate_requirements:
root: 1048576
leaf: 1048576
min_bitrate_requirements:
root: 1048576
leaf: 1048576
virtual_link_protocol_data:
- associated_layer_protocol: ipv4
l3_protocol_data:
ip_version: ipv4
cidr: 33.33.0.0/24
internalVL2:
type: tosca.nodes.nfv.VnfVirtualLink
properties:
connectivity_type:
layer_protocols: [ ipv4 ]
description: External Managed Virtual link in the VNF
vl_profile:
max_bitrate_requirements:
root: 1048576
leaf: 1048576
min_bitrate_requirements:
root: 1048576
leaf: 1048576
virtual_link_protocol_data:
- associated_layer_protocol: ipv4
l3_protocol_data:
ip_version: ipv4
cidr: 33.34.0.0/24
internalVL3:
type: tosca.nodes.nfv.VnfVirtualLink
properties:
connectivity_type:
layer_protocols: [ ipv4 ]
description: Internal Virtual link in the VNF
vl_profile:
max_bitrate_requirements:
root: 1048576
leaf: 1048576
min_bitrate_requirements:
root: 1048576
leaf: 1048576
virtual_link_protocol_data:
- associated_layer_protocol: ipv4
l3_protocol_data:
ip_version: ipv4
cidr: 33.35.0.0/24
policies:
- scaling_aspects:
type: tosca.policies.nfv.ScalingAspects
properties:
aspects:
VDU1_scale:
name: VDU1_scale
description: VDU1 scaling aspect
max_scale_level: 2
step_deltas:
- delta_1
- VDU1_initial_delta:
type: tosca.policies.nfv.VduInitialDelta
properties:
initial_delta:
number_of_instances: 1
targets: [ VDU1 ]
- VDU2_initial_delta:
type: tosca.policies.nfv.VduInitialDelta
properties:
initial_delta:
number_of_instances: 1
targets: [ VDU2 ]
- VDU1_scaling_aspect_deltas:
type: tosca.policies.nfv.VduScalingAspectDeltas
properties:
aspect: VDU1_scale
deltas:
delta_1:
number_of_instances: 1
targets: [ VDU1 ]
- instantiation_levels:
type: tosca.policies.nfv.InstantiationLevels
properties:
levels:
instantiation_level_1:
description: Smallest size
scale_info:
VDU1_scale:
scale_level: 0
instantiation_level_2:
description: Largest size
scale_info:
VDU1_scale:
scale_level: 2
default_level: instantiation_level_1
- VDU1_instantiation_levels:
type: tosca.policies.nfv.VduInstantiationLevels
properties:
levels:
instantiation_level_1:
number_of_instances: 1
instantiation_level_2:
number_of_instances: 3
targets: [ VDU1 ]
- VDU2_instantiation_levels:
type: tosca.policies.nfv.VduInstantiationLevels
properties:
levels:
instantiation_level_1:
number_of_instances: 1
instantiation_level_2:
number_of_instances: 1
targets: [ VDU2 ]
- internalVL1_instantiation_levels:
type: tosca.policies.nfv.VirtualLinkInstantiationLevels
properties:
levels:
instantiation_level_1:
bitrate_requirements:
root: 1048576
leaf: 1048576
instantiation_level_2:
bitrate_requirements:
root: 1048576
leaf: 1048576
targets: [ internalVL1 ]
- internalVL2_instantiation_levels:
type: tosca.policies.nfv.VirtualLinkInstantiationLevels
properties:
levels:
instantiation_level_1:
bitrate_requirements:
root: 1048576
leaf: 1048576
instantiation_level_2:
bitrate_requirements:
root: 1048576
leaf: 1048576
targets: [ internalVL2 ]
- internalVL3_instantiation_levels:
type: tosca.policies.nfv.VirtualLinkInstantiationLevels
properties:
levels:
instantiation_level_1:
bitrate_requirements:
root: 1048576
leaf: 1048576
instantiation_level_2:
bitrate_requirements:
root: 1048576
leaf: 1048576
targets: [ internalVL3 ]
- policy_antiaffinity_vdu1:
type: tosca.policies.nfv.AntiAffinityRule
targets: [ VDU1 ]
properties:
scope: zone
- policy_antiaffinity_vdu2:
type: tosca.policies.nfv.AntiAffinityRule
targets: [ VDU2 ]
properties:
scope: zone

View File

@ -0,0 +1,31 @@
tosca_definitions_version: tosca_simple_yaml_1_2
description: Sample VNF
imports:
- etsi_nfv_sol001_common_types.yaml
- etsi_nfv_sol001_vnfd_types.yaml
- helloworld3_types.yaml
- helloworld3_df_simple.yaml
topology_template:
inputs:
selected_flavour:
type: string
description: VNF deployment flavour selected by the consumer. It is provided in the API
node_templates:
VNF:
type: company.provider.VNF
properties:
flavour_id: { get_input: selected_flavour }
descriptor_id: ebed82b2-3bb1-421a-a065-40cf5a5f8381
provider: Company
product_name: Sample VNF
software_version: '1.0'
descriptor_version: '1.0'
vnfm_info:
- Tacker
requirements:
#- virtual_link_external # mapped in lower-level templates
#- virtual_link_internal # mapped in lower-level templates

View File

@ -0,0 +1,55 @@
tosca_definitions_version: tosca_simple_yaml_1_2
description: VNF type definition
imports:
- etsi_nfv_sol001_common_types.yaml
- etsi_nfv_sol001_vnfd_types.yaml
node_types:
company.provider.VNF:
derived_from: tosca.nodes.nfv.VNF
properties:
descriptor_id:
type: string
constraints: [ valid_values: [ ebed82b2-3bb1-421a-a065-40cf5a5f8381 ] ]
default: ebed82b2-3bb1-421a-a065-40cf5a5f8381
descriptor_version:
type: string
constraints: [ valid_values: [ '1.0' ] ]
default: '1.0'
provider:
type: string
constraints: [ valid_values: [ 'Company' ] ]
default: 'Company'
product_name:
type: string
constraints: [ valid_values: [ 'Sample VNF' ] ]
default: 'Sample VNF'
software_version:
type: string
constraints: [ valid_values: [ '1.0' ] ]
default: '1.0'
vnfm_info:
type: list
entry_schema:
type: string
constraints: [ valid_values: [ Tacker ] ]
default: [ Tacker ]
flavour_id:
type: string
constraints: [ valid_values: [ simple ] ]
default: simple
flavour_description:
type: string
default: "falvour"
requirements:
- virtual_link_external1:
capability: tosca.capabilities.nfv.VirtualLinkable
- virtual_link_external2:
capability: tosca.capabilities.nfv.VirtualLinkable
- virtual_link_internal:
capability: tosca.capabilities.nfv.VirtualLinkable
interfaces:
Vnflcm:
type: tosca.interfaces.nfv.Vnflcm

View File

@ -0,0 +1,4 @@
TOSCA-Meta-File-Version: 1.0
CSAR-Version: 1.1
Created-by: Onboarding portal
Entry-Definitions: Definitions/helloworld3_top.vnfd.yaml

View File

@ -0,0 +1,35 @@
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from tacker.vnfm.lcm_user_data.abstract_user_data import AbstractUserData
import tacker.vnfm.lcm_user_data.utils as UserDataUtil
class SampleUserData(AbstractUserData):
@staticmethod
def instantiate(base_hot_dict=None,
vnfd_dict=None,
inst_req_info=None,
grant_info=None):
api_param = UserDataUtil.get_diff_base_hot_param_from_api(
base_hot_dict, inst_req_info)
initial_param_dict = \
UserDataUtil.create_initial_param_server_port_dict(
base_hot_dict)
vdu_flavor_dict = \
UserDataUtil.create_vdu_flavor_capability_name_dict(vnfd_dict)
vdu_image_dict = UserDataUtil.create_sw_image_dict(vnfd_dict)
cpd_vl_dict = UserDataUtil.create_network_dict(
inst_req_info, initial_param_dict)
final_param_dict = UserDataUtil.create_final_param_dict(
initial_param_dict, vdu_flavor_dict, vdu_image_dict, cpd_vl_dict)
return {**final_param_dict, **api_param}

View File

@ -219,6 +219,116 @@ class VnfLcmWithUserDataTest(vnflcm_base.BaseVnfLcmTest):
resp, _ = self._show_subscription(subscription_id)
self.assertEqual(404, resp.status_code)
def test_notification_no_virtual_storage(self):
"""Test affectedVirtualStorages is absent from
notification data when Virtual Storage does
not exist in VNFD.
In this test case, we do following steps.
- Create subscription.
- Create VNF package.
- Upload VNF package.
- Create VNF instance.
- Instantiate VNF.
- Terminate VNF
- Delete VNF
- Delete subscription
"""
# Create subscription and register it.
callback_url = os.path.join(vnflcm_base.MOCK_NOTIFY_CALLBACK_URL,
self._testMethodName)
request_body = fake_vnflcm.Subscription.make_create_request_body(
'http://localhost:{}{}'.format(
vnflcm_base.FAKE_SERVER_MANAGER.SERVER_PORT,
callback_url))
resp, response_body = self._register_subscription(request_body)
self.assertEqual(201, resp.status_code)
self.assert_http_header_location_for_subscription(resp.headers)
self.assert_notification_get(callback_url)
subscription_id = response_body.get('id')
self.addCleanup(
self._delete_subscription,
subscription_id)
# Pre Setting: Create vnf package.
sample_name = 'user_data_sample_virtual_storage_missing'
csar_package_path = os.path.abspath(
os.path.join(
os.path.dirname(__file__),
"../../../etc/samples/etsi/nfv",
sample_name))
tempname, _ = vnflcm_base._create_csar_with_unique_vnfd_id(
csar_package_path)
# upload vnf package
vnf_package_id, vnfd_id = vnflcm_base._create_and_upload_vnf_package(
self.tacker_client, user_defined_data={
"key": sample_name}, temp_csar_path=tempname)
# Post Setting: Reserve deleting vnf package.
self.addCleanup(vnflcm_base._delete_vnf_package, self.tacker_client,
vnf_package_id)
# Create vnf instance
resp, vnf_instance = self._create_vnf_instance_from_body(
fake_vnflcm.VnfInstances.make_create_request_body(vnfd_id))
vnf_instance_id = vnf_instance['id']
self._wait_lcm_done(vnf_instance_id=vnf_instance_id)
self.assert_create_vnf(resp, vnf_instance, vnf_package_id)
self.addCleanup(self._delete_vnf_instance, vnf_instance_id)
# Instantiate vnf instance
request_body = fake_vnflcm.VnfInstances. \
make_inst_request_body_include_num_dynamic(
self.vim['tenant_id'], self.ext_networks,
self.ext_mngd_networks, self.ext_link_ports, self.ext_subnets)
resp, _ = self._instantiate_vnf_instance(vnf_instance_id, request_body)
self._wait_lcm_done('COMPLETED', vnf_instance_id=vnf_instance_id)
# Show vnf instance
resp, vnf_instance = self._show_vnf_instance(vnf_instance_id)
self.assertEqual(200, resp.status_code)
self.assertEqual(vnf_instance["instantiationState"],
"INSTANTIATED")
callback_url = os.path.join(
vnflcm_base.MOCK_NOTIFY_CALLBACK_URL,
self._testMethodName)
notify_mock_responses = vnflcm_base.FAKE_SERVER_MANAGER.get_history(
callback_url)
vnflcm_base.FAKE_SERVER_MANAGER.clear_history(
callback_url)
self.assertNotIn("affectedVirtualStorages",
str(notify_mock_responses[2].request_body))
# Terminate VNF
stack = self._get_heat_stack(vnf_instance_id)
resources_list = self._get_heat_resource_list(stack.id)
resource_name_list = [r.resource_name for r in resources_list]
glance_image_id_list = self._get_glance_image_list_from_stack_resource(
stack.id, resource_name_list)
terminate_req_body = fake_vnflcm.VnfInstances.make_term_request_body()
resp, _ = self._terminate_vnf_instance(
vnf_instance_id, terminate_req_body)
self._wait_lcm_done('COMPLETED', vnf_instance_id=vnf_instance_id)
self.assert_terminate_vnf(resp, vnf_instance_id, stack.id,
resource_name_list, glance_image_id_list,
vnf_package_id)
# Delete VNF
resp, _ = self._delete_vnf_instance(vnf_instance_id)
self._wait_lcm_done(vnf_instance_id=vnf_instance_id)
self.assert_delete_vnf(resp, vnf_instance_id, vnf_package_id)
# Subscription delete
resp, response_body = self._delete_subscription(subscription_id)
self.assertEqual(204, resp.status_code)
resp, _ = self._show_subscription(subscription_id)
self.assertEqual(404, resp.status_code)
def test_stack_update_in_scaling(self):
"""Test basic life cycle operations with sample VNFD.

View File

@ -830,6 +830,8 @@ class TestConductor(SqlTestCase, unit_base.FixturedTestCase):
'._change_vnf_status')
@mock.patch('tacker.conductor.conductor_server.Conductor'
'._build_instantiated_vnf_info')
@mock.patch('tacker.conductor.conductor_server.Conductor'
'.send_notification')
@mock.patch.object(objects.VnfLcmOpOcc, "save")
@mock.patch.object(coordination.Coordinator, 'get_lock')
@mock.patch.object(objects.LccnSubscriptionRequest,
@ -843,7 +845,8 @@ class TestConductor(SqlTestCase, unit_base.FixturedTestCase):
self, mock_res, mock_vnf_by_id, mock_log,
mock_des, mock_vnfd_dict,
mock_vnf_lcm_subscriptions_get,
mock_get_lock, mock_save, mock_build_info,
mock_get_lock, mock_save,
mock_send_notification, mock_build_info,
mock_change_vnf_status,
mock_update_vnf_attributes):
lcm_op_occs_data = fakes.get_lcm_op_occs_data()
@ -875,6 +878,12 @@ class TestConductor(SqlTestCase, unit_base.FixturedTestCase):
instantiate_vnf_req, vnf_lcm_op_occs_id)
self.vnflcm_driver.instantiate_vnf.assert_called_once_with(
self.context, vnf_instance, vnf_dict, instantiate_vnf_req)
self.assertNotIn("affectedVnfcs",
str(mock_send_notification.call_args[0][1]))
self.assertNotIn("affectedVirtualLinks",
str(mock_send_notification.call_args[0][1]))
self.assertNotIn("affectedVirtualStorages",
str(mock_send_notification.call_args[0][1]))
mock_change_vnf_status.assert_called_with(self.context,
vnf_instance.id, mock.ANY, 'ERROR')
mock_update_vnf_attributes.assert_called_once()

View File

@ -3435,6 +3435,7 @@ class TestController(base.TestCase):
self.assertEqual(http_client.INTERNAL_SERVER_ERROR, resp.status_code)
@mock.patch.object(vnf_lcm_rpc.VNFLcmRPCAPI, "send_notification")
@mock.patch.object(controller.VnfLcmController,
"_update_vnf_fail_status")
@mock.patch.object(objects.VnfInstance, "save")
@ -3444,12 +3445,19 @@ class TestController(base.TestCase):
def test_fail_lcm_op_occs(self, mock_lcm_get_by_id,
mock_lcm_save, mock_vnf_get_by_id,
mock_vnf_save,
mock_update):
mock_update,
mock_send_notification):
req = fake_request.HTTPRequest.blank(
'/vnf_lcm_op_occs/%s/fail' % constants.UUID)
mock_lcm_get_by_id.return_value = fakes.vnflcm_fail_insta()
res_dict = self.controller.fail(req, constants.UUID)
self.assertEqual('FAILED', res_dict['operationState'])
self.assertNotIn("affectedVnfcs",
str(mock_send_notification.call_args[0][1]))
self.assertNotIn("affectedVirtualLinks",
str(mock_send_notification.call_args[0][1]))
self.assertNotIn("affectedVirtualStorages",
str(mock_send_notification.call_args[0][1]))
@mock.patch.object(objects.VnfInstance, "get_by_id")
@mock.patch.object(objects.VnfLcmOpOcc, "get_by_id")