Fix monitoring issue for multiple VDUs
Tacker failed to support monitoring for multiple VDUs. In addtiion, multi-vdu testing have not been mentioned in unit test. This patch will fixed the above issues. Change-Id: Ib4497a530439110bf149f1104c74ba4bdc96ba0a Closes-bug: #1668587
This commit is contained in:
parent
324a443806
commit
73384e4db3
|
@ -0,0 +1,193 @@
|
|||
tosca_definitions_version: tosca_simple_profile_for_nfv_1_0_0
|
||||
|
||||
description: Monitoring for multiple vdus
|
||||
|
||||
metadata:
|
||||
template_name: tosca-vnfd-monitoir-multi-vdu
|
||||
|
||||
topology_template:
|
||||
node_templates:
|
||||
VDU1:
|
||||
type: tosca.nodes.nfv.VDU.Tacker
|
||||
capabilities:
|
||||
nfv_compute:
|
||||
properties:
|
||||
num_cpus: 1
|
||||
mem_size: 512 MB
|
||||
disk_size: 1 GB
|
||||
properties:
|
||||
image: cirros-0.3.5-x86_64-disk
|
||||
availability_zone: nova
|
||||
mgmt_driver: noop
|
||||
config: |
|
||||
param0: key1
|
||||
param1: key2
|
||||
monitoring_policy:
|
||||
name: ping
|
||||
parameters:
|
||||
monitoring_delay: 45
|
||||
count: 3
|
||||
interval: 1
|
||||
timeout: 2
|
||||
actions:
|
||||
failure: respawn
|
||||
|
||||
|
||||
CP11:
|
||||
type: tosca.nodes.nfv.CP.Tacker
|
||||
properties:
|
||||
management: true
|
||||
order: 0
|
||||
anti_spoofing_protection: false
|
||||
requirements:
|
||||
- virtualLink:
|
||||
node: VL1
|
||||
- virtualBinding:
|
||||
node: VDU1
|
||||
|
||||
CP12:
|
||||
type: tosca.nodes.nfv.CP.Tacker
|
||||
properties:
|
||||
order: 1
|
||||
anti_spoofing_protection: false
|
||||
requirements:
|
||||
- virtualLink:
|
||||
node: VL2
|
||||
- virtualBinding:
|
||||
node: VDU1
|
||||
|
||||
CP13:
|
||||
type: tosca.nodes.nfv.CP.Tacker
|
||||
properties:
|
||||
order: 2
|
||||
anti_spoofing_protection: false
|
||||
requirements:
|
||||
- virtualLink:
|
||||
node: VL3
|
||||
- virtualBinding:
|
||||
node: VDU1
|
||||
|
||||
VDU2:
|
||||
type: tosca.nodes.nfv.VDU.Tacker
|
||||
properties:
|
||||
image: cirros-0.3.5-x86_64-disk
|
||||
flavor: m1.medium
|
||||
availability_zone: nova
|
||||
mgmt_driver: noop
|
||||
config: |
|
||||
param0: key1
|
||||
param1: key2
|
||||
monitoring_policy:
|
||||
name: ping
|
||||
parameters:
|
||||
monitoring_delay: 45
|
||||
count: 3
|
||||
interval: 1
|
||||
timeout: 2
|
||||
actions:
|
||||
failure: respawn
|
||||
|
||||
|
||||
CP21:
|
||||
type: tosca.nodes.nfv.CP.Tacker
|
||||
properties:
|
||||
management: true
|
||||
order: 0
|
||||
requirements:
|
||||
- virtualLink:
|
||||
node: VL1
|
||||
- virtualBinding:
|
||||
node: VDU2
|
||||
|
||||
CP22:
|
||||
type: tosca.nodes.nfv.CP.Tacker
|
||||
properties:
|
||||
order: 1
|
||||
anti_spoofing_protection: false
|
||||
requirements:
|
||||
- virtualLink:
|
||||
node: VL2
|
||||
- virtualBinding:
|
||||
node: VDU2
|
||||
|
||||
CP23:
|
||||
type: tosca.nodes.nfv.CP.Tacker
|
||||
properties:
|
||||
order: 2
|
||||
anti_spoofing_protection: false
|
||||
requirements:
|
||||
- virtualLink:
|
||||
node: VL3
|
||||
- virtualBinding:
|
||||
node: VDU2
|
||||
|
||||
VDU3:
|
||||
type: tosca.nodes.nfv.VDU.Tacker
|
||||
properties:
|
||||
image: cirros-0.3.5-x86_64-disk
|
||||
flavor: m1.tiny
|
||||
availability_zone: nova
|
||||
mgmt_driver: noop
|
||||
config: |
|
||||
param0: key1
|
||||
param1: key2
|
||||
monitoring_policy:
|
||||
name: ping
|
||||
parameters:
|
||||
monitoring_delay: 45
|
||||
count: 3
|
||||
interval: 1
|
||||
timeout: 2
|
||||
actions:
|
||||
failure: respawn
|
||||
|
||||
CP31:
|
||||
type: tosca.nodes.nfv.CP.Tacker
|
||||
properties:
|
||||
management: true
|
||||
order: 0
|
||||
requirements:
|
||||
- virtualLink:
|
||||
node: VL1
|
||||
- virtualBinding:
|
||||
node: VDU3
|
||||
|
||||
CP32:
|
||||
type: tosca.nodes.nfv.CP.Tacker
|
||||
properties:
|
||||
order: 1
|
||||
anti_spoofing_protection: false
|
||||
requirements:
|
||||
- virtualLink:
|
||||
node: VL2
|
||||
- virtualBinding:
|
||||
node: VDU3
|
||||
|
||||
CP33:
|
||||
type: tosca.nodes.nfv.CP.Tacker
|
||||
properties:
|
||||
order: 2
|
||||
anti_spoofing_protection: false
|
||||
requirements:
|
||||
- virtualLink:
|
||||
node: VL3
|
||||
- virtualBinding:
|
||||
node: VDU3
|
||||
|
||||
VL1:
|
||||
type: tosca.nodes.nfv.VL
|
||||
properties:
|
||||
network_name: net_mgmt
|
||||
vendor: Tacker
|
||||
|
||||
VL2:
|
||||
type: tosca.nodes.nfv.VL
|
||||
properties:
|
||||
network_name: net0
|
||||
vendor: Tacker
|
||||
|
||||
VL3:
|
||||
type: tosca.nodes.nfv.VL
|
||||
properties:
|
||||
network_name: net1
|
||||
vendor: Tacker
|
|
@ -18,6 +18,15 @@ topology_template:
|
|||
param0: key1
|
||||
param1: key2
|
||||
mgmt_driver: noop
|
||||
monitoring_policy:
|
||||
name: ping
|
||||
actions:
|
||||
failure: respawn
|
||||
parameters:
|
||||
count: 3
|
||||
interval: 10
|
||||
monitoring_delay: 45
|
||||
timeout: 2
|
||||
|
||||
CP11:
|
||||
type: tosca.nodes.nfv.CP.Tacker
|
||||
|
@ -60,6 +69,15 @@ topology_template:
|
|||
config: |
|
||||
param0: key1
|
||||
param1: key2
|
||||
monitoring_policy:
|
||||
name: ping
|
||||
actions:
|
||||
failure: respawn
|
||||
parameters:
|
||||
count: 3
|
||||
interval: 10
|
||||
monitoring_delay: 45
|
||||
timeout: 2
|
||||
|
||||
CP21:
|
||||
type: tosca.nodes.nfv.CP.Tacker
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
heat_template_version: 2013-05-23
|
||||
description: 'Monitoring for multiple VDUs
|
||||
|
||||
'
|
||||
outputs:
|
||||
mgmt_ip-VDU1:
|
||||
value:
|
||||
get_attr: [CP1, fixed_ips, 0, ip_address]
|
||||
mgmt_ip-VDU2:
|
||||
value:
|
||||
get_attr: [CP2, fixed_ips, 0, ip_address]
|
||||
|
||||
parameters: {}
|
||||
resources:
|
||||
VDU1:
|
||||
properties:
|
||||
availability_zone: nova
|
||||
config_drive: false
|
||||
flavor: m1.tiny
|
||||
image: cirros-0.3.5-x86_64-disk
|
||||
networks:
|
||||
- port: {get_resource: CP1}
|
||||
user_data_format: SOFTWARE_CONFIG
|
||||
type: OS::Nova::Server
|
||||
|
||||
CP1:
|
||||
properties: {network: net_mgmt, port_security_enabled: false}
|
||||
type: OS::Neutron::Port
|
||||
|
||||
VDU2:
|
||||
properties:
|
||||
availability_zone: nova
|
||||
config_drive: false
|
||||
flavor: m1.tiny
|
||||
image: cirros-0.3.5-x86_64-disk
|
||||
networks:
|
||||
- port: {get_resource: CP2}
|
||||
user_data_format: SOFTWARE_CONFIG
|
||||
type: OS::Nova::Server
|
||||
|
||||
CP2:
|
||||
properties: {network: net_mgmt, port_security_enabled: false}
|
||||
type: OS::Neutron::Port
|
|
@ -0,0 +1,74 @@
|
|||
tosca_definitions_version: tosca_simple_profile_for_nfv_1_0_0
|
||||
|
||||
description: Monitoring for multiple VDUs
|
||||
|
||||
metadata:
|
||||
template_name: sample-tosca-vnfd
|
||||
|
||||
topology_template:
|
||||
node_templates:
|
||||
VDU1:
|
||||
type: tosca.nodes.nfv.VDU.Tacker
|
||||
properties:
|
||||
image: cirros-0.3.5-x86_64-disk
|
||||
flavor: m1.tiny
|
||||
availability_zone: nova
|
||||
mgmt_driver: noop
|
||||
config: |
|
||||
param0: key1
|
||||
param1: key2
|
||||
monitoring_policy:
|
||||
name: ping
|
||||
actions:
|
||||
failure: respawn
|
||||
parameters:
|
||||
count: 3
|
||||
interval: 10
|
||||
|
||||
CP1:
|
||||
type: tosca.nodes.nfv.CP.Tacker
|
||||
properties:
|
||||
management: true
|
||||
order: 0
|
||||
anti_spoofing_protection: false
|
||||
requirements:
|
||||
- virtualLink:
|
||||
node: VL1
|
||||
- virtualBinding:
|
||||
node: VDU1
|
||||
|
||||
VDU2:
|
||||
type: tosca.nodes.nfv.VDU.Tacker
|
||||
properties:
|
||||
image: cirros-0.3.5-x86_64-disk
|
||||
flavor: m1.tiny
|
||||
availability_zone: nova
|
||||
mgmt_driver: noop
|
||||
config: |
|
||||
param0: key1
|
||||
param1: key2
|
||||
monitoring_policy:
|
||||
name: ping
|
||||
actions:
|
||||
failure: respawn
|
||||
parameters:
|
||||
count: 3
|
||||
interval: 10
|
||||
|
||||
CP2:
|
||||
type: tosca.nodes.nfv.CP.Tacker
|
||||
properties:
|
||||
management: true
|
||||
order: 0
|
||||
anti_spoofing_protection: false
|
||||
requirements:
|
||||
- virtualLink:
|
||||
node: VL1
|
||||
- virtualBinding:
|
||||
node: VDU2
|
||||
|
||||
VL1:
|
||||
type: tosca.nodes.nfv.VL
|
||||
properties:
|
||||
network_name: net_mgmt
|
||||
vendor: Tacker
|
|
@ -196,7 +196,8 @@ class TestOpenStack(base.TestCase):
|
|||
tosca_tpl_name,
|
||||
hot_tpl_name,
|
||||
param_values='',
|
||||
is_monitor=True):
|
||||
is_monitor=True,
|
||||
multi_vdus=False):
|
||||
tosca_tpl = _get_template(tosca_tpl_name)
|
||||
exp_tmpl = self._get_expected_vnfd(tosca_tpl)
|
||||
tosca_hw_dict = yaml.safe_load(_get_template(hot_tpl_name))
|
||||
|
@ -216,14 +217,33 @@ class TestOpenStack(base.TestCase):
|
|||
'vnfd_id': u'eb094833-995e-49f0-a047-dfb56aaf7c4e',
|
||||
'tenant_id': u'ad7ebc56538745a08ef7c5e97f8bd437'
|
||||
}
|
||||
# Add montitoring attributes for those yaml, which are having it
|
||||
# Add monitoring attributes for those yaml, which are having it
|
||||
if is_monitor:
|
||||
dvc['attributes'].update(
|
||||
{'monitoring_policy': '{"vdus": {"VDU1": {"ping": {"name": '
|
||||
'"ping", "actions": {"failure": '
|
||||
'"respawn"}, "parameters": {"count": 3, '
|
||||
'"interval": 10}, "monitoring_params": '
|
||||
'{"count": 3, "interval": 10}}}}}'})
|
||||
if multi_vdus:
|
||||
dvc['attributes'].update(
|
||||
{'monitoring_policy': '{"vdus": {"VDU1": {"ping": '
|
||||
'{"name": "ping", "actions": '
|
||||
'{"failure": "respawn"}, '
|
||||
'"parameters": {"count": 3, '
|
||||
'"interval": 10}, '
|
||||
'"monitoring_params": '
|
||||
'{"count": 3, "interval": 10}}}, '
|
||||
'"VDU2": {"ping": {"name": "ping", '
|
||||
'"actions": {"failure": "respawn"}, '
|
||||
'"parameters": {"count": 3, '
|
||||
'"interval": 10}, '
|
||||
'"monitoring_params": {"count": 3, '
|
||||
'"interval": 10}}}}}'})
|
||||
else:
|
||||
dvc['attributes'].update(
|
||||
{'monitoring_policy': '{"vdus": {"VDU1": {"ping": '
|
||||
'{"name": "ping", "actions": '
|
||||
'{"failure": "respawn"}, '
|
||||
'"parameters": {"count": 3, '
|
||||
'"interval": 10}, '
|
||||
'"monitoring_params": '
|
||||
'{"count": 3, '
|
||||
'"interval": 10}}}}}'})
|
||||
|
||||
return dvc
|
||||
|
||||
|
@ -243,14 +263,16 @@ class TestOpenStack(base.TestCase):
|
|||
hot_tpl_name,
|
||||
input_params='',
|
||||
files=None,
|
||||
is_monitor=True):
|
||||
is_monitor=True,
|
||||
multi_vdus=False):
|
||||
vnf = self._get_dummy_tosca_vnf(tosca_tpl_name, input_params)
|
||||
expected_result = '4a4c2d44-8a52-4895-9a75-9d1c76c3e738'
|
||||
expected_fields = self._get_expected_fields_tosca(hot_tpl_name)
|
||||
expected_vnf = self._get_expected_tosca_vnf(tosca_tpl_name,
|
||||
hot_tpl_name,
|
||||
input_params,
|
||||
is_monitor)
|
||||
is_monitor,
|
||||
multi_vdus)
|
||||
result = self.infra_driver.create(plugin=None, context=self.context,
|
||||
vnf=vnf,
|
||||
auth_attr=utils.get_vim_auth_obj())
|
||||
|
@ -426,3 +448,10 @@ class TestOpenStack(base.TestCase):
|
|||
'hot_tosca_alarm_metadata.yaml',
|
||||
is_monitor=False
|
||||
)
|
||||
|
||||
def test_create_tosca_monitoring_multi_vdus(self):
|
||||
self._test_assert_equal_for_tosca_templates(
|
||||
'tosca_monitoring_multi_vdu.yaml',
|
||||
'hot_tosca_monitoring_multi_vdu.yaml',
|
||||
multi_vdus=True
|
||||
)
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import collections
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
|
@ -138,19 +139,19 @@ def check_for_substitution_mappings(template, params):
|
|||
|
||||
@log.log
|
||||
def get_vdu_monitoring(template):
|
||||
monitoring_dict = {}
|
||||
monitoring_dict = dict()
|
||||
policy_dict = dict()
|
||||
policy_dict['vdus'] = collections.OrderedDict()
|
||||
for nt in template.nodetemplates:
|
||||
if nt.type_definition.is_derived_from(TACKERVDU):
|
||||
mon_policy = nt.get_property_value('monitoring_policy') or 'noop'
|
||||
# mon_data = {mon_policy['name']: {'actions': {'failure':
|
||||
# 'respawn'}}}
|
||||
if mon_policy != 'noop':
|
||||
if 'parameters' in mon_policy:
|
||||
mon_policy['monitoring_params'] = mon_policy['parameters']
|
||||
monitoring_dict['vdus'] = {}
|
||||
monitoring_dict['vdus'][nt.name] = {}
|
||||
monitoring_dict['vdus'][nt.name][mon_policy['name']] = \
|
||||
mon_policy
|
||||
policy_dict['vdus'][nt.name] = {}
|
||||
policy_dict['vdus'][nt.name][mon_policy['name']] = mon_policy
|
||||
if policy_dict.get('vdus'):
|
||||
monitoring_dict = policy_dict
|
||||
return monitoring_dict
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue