Comment 0 for bug 1906779

Revision history for this message
Ayumu Ueha (ueha) wrote :

According to SOL001(*1) "A.6.1 ScalingAspect and InstantiationLevels policies with uniform delta",
number_of_instance of deltas in `VduScalingAspectDeltas` is able to have different value even if aspect_id and delta_id are the same as follows:
```
  policies
    ...
    - vdu_1_scaling_aspect_deltas:
        type: tosca.policies.nfv.VduScalingAspectDeltas
        properties:
          aspect: database // aspect_id
          deltas:
            delta_1: // delta_id
              number_of_instances: 2
        targets: [ vdu_1 ]
    ...
    - vdu_2_scaling_aspect_deltas:
        type: tosca.policies.nfv.VduScalingAspectDeltas
        properties:
          aspect: database // same aspect_id as vdu1
          deltas:
            delta_1: // same delta_id as vdu1
              number_of_instances: 3 // !! another number !!
        targets: [ vdu_2 ]
    ...
```

But in current implementation of tacker, extract policies information using tosca_utils._extract_policy_info(*2) method as follows (Excerpt from VduScalingAspectDeltas):

```
    if tosca_policies is not []:
        for p in tosca_policies:
            if p.type == ETSI_SCALING_ASPECT_DELTA:
                vdu_list = p.targets
                aspect_id = p.properties['aspect']
                deltas = p.properties['deltas']
                delta_id_dict = {}
                for delta_id, delta_val in deltas.items():
                    delta_num = delta_val['number_of_instances']
                    delta_id_dict[delta_id] = delta_num
                aspect_delta_dict[aspect_id] = delta_id_dict // !! Overwrite if the same aspect_id !!
                aspect_vdu_dict[aspect_id] = vdu_list
```
If it is the same aspect_id and delta_id, it will be overwritten by the value of the later one (overwrite by number_of_instance: 3 of vdu_2_scaling_aspect_deltas in case of the SOL001 definition example).

refs:
*1) SOL001: https://www.etsi.org/deliver/etsi_gs/NFV-SOL/001_099/001/02.06.01_60/gs_nfv-sol001v020601p.pdf
*2) _extract_policy_info(): https://opendev.org/openstack/tacker/src/branch/master/tacker/tosca/utils.py#L839-L885