Fix monitoring of TOSCA VNFDs
Change-Id: I428bc68bfad90a80a43ba07f1632b39a10509fa3 Implements: bp/tosca-parser-integration
This commit is contained in:
parent
4d24e2cdb7
commit
7647465914
@ -20,11 +20,11 @@ topology_template:
|
||||
monitoring_policy:
|
||||
name: http_ping
|
||||
parameters:
|
||||
retry: "5"
|
||||
timeout: "10"
|
||||
port: "8000"
|
||||
retry: 5
|
||||
timeout: 10
|
||||
port: 8000
|
||||
actions:
|
||||
- {trigger: failure, action: respawn}
|
||||
failure: respawn
|
||||
|
||||
CP1:
|
||||
type: tosca.nodes.nfv.CP.Tacker
|
||||
|
@ -20,12 +20,12 @@ topology_template:
|
||||
monitoring_policy:
|
||||
name: ping
|
||||
parameters:
|
||||
monitoring_delay: "45"
|
||||
count: "3"
|
||||
interval: "0.5"
|
||||
timeout: "2"
|
||||
monitoring_delay: 45
|
||||
count: 3
|
||||
interval: 1
|
||||
timeout: 2
|
||||
actions:
|
||||
- {trigger: failure, action: respawn}
|
||||
failure: respawn
|
||||
|
||||
CP1:
|
||||
type: tosca.nodes.nfv.CP.Tacker
|
||||
|
@ -19,11 +19,11 @@ topology_template:
|
||||
mgmt_driver: openwrt
|
||||
monitoring_policy:
|
||||
name: ping
|
||||
actions:
|
||||
- {trigger: failure, action: respawn}
|
||||
parameters:
|
||||
count: "3"
|
||||
interval: "10"
|
||||
count: 3
|
||||
interval: 10
|
||||
actions:
|
||||
failure: respawn
|
||||
|
||||
CP1:
|
||||
type: tosca.nodes.nfv.CP.Tacker
|
||||
|
@ -22,10 +22,10 @@ topology_template:
|
||||
monitoring_policy:
|
||||
name: ping
|
||||
actions:
|
||||
- {trigger: failure, action: respawn}
|
||||
failure: respawn
|
||||
parameters:
|
||||
count: "3"
|
||||
interval: "10"
|
||||
count: 3
|
||||
interval: 10
|
||||
|
||||
CP1:
|
||||
type: tosca.nodes.nfv.CP.Tacker
|
||||
|
@ -23,10 +23,10 @@ topology_template:
|
||||
monitoring_policy:
|
||||
name: ping
|
||||
actions:
|
||||
- {trigger: failure, action: respawn}
|
||||
failure: respawn
|
||||
parameters:
|
||||
count: "3"
|
||||
interval: "10"
|
||||
count: 3
|
||||
interval: 10
|
||||
CP1:
|
||||
type: tosca.nodes.nfv.CP.Tacker
|
||||
properties:
|
||||
|
@ -20,10 +20,10 @@ topology_template:
|
||||
monitoring_policy:
|
||||
name: ping
|
||||
actions:
|
||||
- {trigger: failure, action: respawn}
|
||||
failure: respawn
|
||||
parameters:
|
||||
count: "3"
|
||||
interval: "10"
|
||||
count: 3
|
||||
interval: 10
|
||||
CP1:
|
||||
type: tosca.nodes.nfv.CP.Tacker
|
||||
properties:
|
||||
|
@ -22,10 +22,10 @@ topology_template:
|
||||
monitoring_policy:
|
||||
name: ping
|
||||
actions:
|
||||
- {trigger: failure, action: respawn}
|
||||
failure: respawn
|
||||
parameters:
|
||||
count: "3"
|
||||
interval: "10"
|
||||
count: 3
|
||||
interval: 10
|
||||
CP1:
|
||||
type: tosca.nodes.nfv.CP.Tacker
|
||||
properties:
|
||||
|
@ -20,10 +20,10 @@ topology_template:
|
||||
monitoring_policy:
|
||||
name: ping
|
||||
actions:
|
||||
- {trigger: failure, action: respawn}
|
||||
failure: respawn
|
||||
parameters:
|
||||
count: "3"
|
||||
interval: "10"
|
||||
count: 3
|
||||
interval: 10
|
||||
|
||||
CP1:
|
||||
type: tosca.nodes.nfv.CP.Tacker
|
||||
|
@ -20,10 +20,10 @@ topology_template:
|
||||
monitoring_policy:
|
||||
name: ping
|
||||
actions:
|
||||
- {trigger: failure, action: respawn}
|
||||
failure: respawn
|
||||
parameters:
|
||||
count: "3"
|
||||
interval: "10"
|
||||
count: 3
|
||||
interval: 10
|
||||
|
||||
CP1:
|
||||
type: tosca.nodes.nfv.CP.Tacker
|
||||
@ -42,14 +42,3 @@ topology_template:
|
||||
network_name: existing_network_1
|
||||
vendor: ACME
|
||||
|
||||
# policies:
|
||||
# - monitor_policy:
|
||||
# type: tosca.policies.tacker.Monitoring.Ping
|
||||
# description: Apply monitoring policy to VDUs
|
||||
# targets: [ VDU1 ]
|
||||
# properties:
|
||||
# parameters:
|
||||
# count: "3"
|
||||
# interval: "10"
|
||||
# actions:
|
||||
# - {trigger: failure, action: respawn}
|
||||
|
@ -30,7 +30,7 @@ topology_template:
|
||||
monitoring_policy:
|
||||
name: ping
|
||||
actions:
|
||||
- {trigger: failure, action: respawn}
|
||||
failure: respawn
|
||||
parameters:
|
||||
count: "3"
|
||||
interval: "10"
|
||||
count: 3
|
||||
interval: 10
|
||||
|
@ -38,7 +38,7 @@ topology_template:
|
||||
monitoring_policy:
|
||||
name: ping
|
||||
actions:
|
||||
- {trigger: failure, action: respawn}
|
||||
failure: respawn
|
||||
parameters:
|
||||
count: "3"
|
||||
interval: "10"
|
||||
count: 3
|
||||
interval: 10
|
||||
|
@ -28,7 +28,7 @@ topology_template:
|
||||
monitoring_policy:
|
||||
name: ping
|
||||
actions:
|
||||
- {trigger: failure, action: respawn}
|
||||
failure: respawn
|
||||
parameters:
|
||||
count: "3"
|
||||
interval: "10"
|
||||
count: 3
|
||||
interval: 10
|
||||
|
@ -23,7 +23,7 @@ topology_template:
|
||||
monitoring_policy:
|
||||
name: ping
|
||||
actions:
|
||||
- {trigger: failure, action: respawn}
|
||||
failure: respawn
|
||||
parameters:
|
||||
count: "3"
|
||||
interval: "10"
|
||||
count: 3
|
||||
interval: 10
|
||||
|
@ -31,7 +31,7 @@ topology_template:
|
||||
monitoring_policy:
|
||||
name: ping
|
||||
actions:
|
||||
- {trigger: failure, action: respawn}
|
||||
failure: respawn
|
||||
parameters:
|
||||
count: "3"
|
||||
interval: "10"
|
||||
count: 3
|
||||
interval: 10
|
||||
|
@ -32,7 +32,7 @@ topology_template:
|
||||
monitoring_policy:
|
||||
name: ping
|
||||
actions:
|
||||
- {trigger: failure, action: respawn}
|
||||
failure: respawn
|
||||
parameters:
|
||||
count: "3"
|
||||
interval: "10"
|
||||
count: 3
|
||||
interval: 10
|
||||
|
@ -17,10 +17,10 @@ topology_template:
|
||||
monitoring_policy:
|
||||
name: ping
|
||||
actions:
|
||||
- {trigger: failure, action: respawn}
|
||||
failure: respawn
|
||||
parameters:
|
||||
count: "3"
|
||||
interval: "10"
|
||||
count: 3
|
||||
interval: 10
|
||||
config: |
|
||||
param0: key1
|
||||
param1: key2
|
||||
@ -54,4 +54,4 @@ topology_template:
|
||||
type: tosca.nodes.nfv.VL
|
||||
properties:
|
||||
network_name: net0
|
||||
vendor: Tacker
|
||||
vendor: Tacker
|
||||
|
@ -17,10 +17,10 @@ topology_template:
|
||||
monitoring_policy:
|
||||
name: ping
|
||||
actions:
|
||||
- {trigger: failure, action: respawn}
|
||||
failure: respawn
|
||||
parameters:
|
||||
count: "3"
|
||||
interval: "10"
|
||||
count: 3
|
||||
interval: 10
|
||||
config: |
|
||||
param0: key1
|
||||
param1: key2
|
||||
@ -55,4 +55,4 @@ topology_template:
|
||||
type: tosca.nodes.nfv.VL
|
||||
properties:
|
||||
network_name: sr3010
|
||||
vendor: Tacker
|
||||
vendor: Tacker
|
||||
|
@ -17,10 +17,10 @@ topology_template:
|
||||
monitoring_policy:
|
||||
name: ping
|
||||
actions:
|
||||
- {trigger: failure, action: respawn}
|
||||
failure: respawn
|
||||
parameters:
|
||||
count: "3"
|
||||
interval: "10"
|
||||
count: 3
|
||||
interval: 10
|
||||
config: |
|
||||
param0: key1
|
||||
param1: key2
|
||||
@ -55,4 +55,4 @@ topology_template:
|
||||
type: tosca.nodes.nfv.VL
|
||||
properties:
|
||||
network_name: net0
|
||||
vendor: Tacker
|
||||
vendor: Tacker
|
||||
|
@ -217,10 +217,11 @@ class TestDeviceHeat(base.TestCase):
|
||||
'description': u'OpenWRT with services',
|
||||
'attributes': {'heat_template': tosca_hw_dict,
|
||||
'monitoring_policy': '{"vdus": {"VDU1":'
|
||||
' {"name": "ping", "actions": [{"trigger":'
|
||||
' "failure", "action": "respawn"}],'
|
||||
' "parameters": {"count": "3", "interval": "10"'
|
||||
'}}}}',
|
||||
' {"ping": {"name": "ping",'
|
||||
' "actions": {"failure": "respawn"},'
|
||||
' "parameters": {"count": 3, "interval": 10'
|
||||
'}, "monitoring_params": {"count": 3, '
|
||||
'"interval": 10}}}}}',
|
||||
'param_values': ''},
|
||||
'id': 'eb84260e-5ff7-4332-b032-50a14d6c1123',
|
||||
'instance_id': None, 'mgmt_url': None, 'name': u'test_openwrt',
|
||||
|
@ -53,12 +53,14 @@ class TestToscaUtils(testtools.TestCase):
|
||||
self.assertEqual(mgmt_driver, expected_mgmt_driver)
|
||||
|
||||
def test_get_vdu_monitoring(self):
|
||||
expected_monitoring = {'vdus': {'VDU1': {'actions':
|
||||
[{'action': 'respawn',
|
||||
'trigger': 'failure'}],
|
||||
expected_monitoring = {'vdus': {'VDU1': {'ping': {
|
||||
'actions':
|
||||
{'failure': 'respawn'},
|
||||
'name': 'ping',
|
||||
'parameters': {'count': '3',
|
||||
'interval': '10'}}}}
|
||||
'parameters': {'count': 3,
|
||||
'interval': 10},
|
||||
'monitoring_params': {'count': 3,
|
||||
'interval': 10}}}}}
|
||||
monitoring = toscautils.get_vdu_monitoring(self.tosca)
|
||||
self.assertEqual(monitoring, expected_monitoring)
|
||||
|
||||
|
@ -109,8 +109,9 @@ class DeviceHeat(abstract_driver.DeviceAbstractDriver):
|
||||
device_template_dict['description'] == ''):
|
||||
device_template_dict['description'] = vnfd_dict.get(
|
||||
'description', '')
|
||||
if (('name' not in device_template_dict or not
|
||||
len(device_template_dict['name'])) and ('metadata' in vnfd_dict)):
|
||||
if (('name' not in device_template_dict or
|
||||
not len(device_template_dict['name'])) and
|
||||
'metadata' in vnfd_dict):
|
||||
device_template_dict['name'] = vnfd_dict['metadata'].get(
|
||||
'template_name', '')
|
||||
|
||||
|
@ -12,19 +12,30 @@ data_types:
|
||||
entry_schema:
|
||||
type: string
|
||||
|
||||
tosca.datatypes.tacker.MonitoringParams:
|
||||
properties:
|
||||
monitoring_delay:
|
||||
type: int
|
||||
count:
|
||||
type: int
|
||||
interval:
|
||||
type: int
|
||||
timeout:
|
||||
type: int
|
||||
retry:
|
||||
type: int
|
||||
port:
|
||||
type: int
|
||||
|
||||
tosca.datatypes.tacker.MonitoringType:
|
||||
properties:
|
||||
name:
|
||||
type: string
|
||||
required: true
|
||||
actions:
|
||||
type: list
|
||||
entry_schema:
|
||||
type: tosca.datatypes.tacker.ActionMap
|
||||
parameters:
|
||||
type: map
|
||||
entry_schema:
|
||||
type: string
|
||||
parameters:
|
||||
type: tosca.datatypes.tacker.MonitoringParams
|
||||
|
||||
tosca.datatypes.compute_properties:
|
||||
properties:
|
||||
|
@ -26,7 +26,8 @@ node_types:
|
||||
|
||||
monitoring_policy:
|
||||
# type: tosca.policies.tacker.Monitoring
|
||||
type: tosca.datatypes.tacker.MonitoringType
|
||||
# type: tosca.datatypes.tacker.MonitoringType
|
||||
type: map
|
||||
|
||||
config:
|
||||
type: string
|
||||
|
@ -106,7 +106,11 @@ def get_vdu_monitoring(template):
|
||||
# mon_data = {mon_policy['name']: {'actions': {'failure':
|
||||
# 'respawn'}}}
|
||||
if mon_policy != 'noop':
|
||||
monitoring_dict['vdus'][nt.name] = mon_policy
|
||||
if 'parameters' in mon_policy:
|
||||
mon_policy['monitoring_params'] = mon_policy['parameters']
|
||||
monitoring_dict['vdus'][nt.name] = {}
|
||||
monitoring_dict['vdus'][nt.name][mon_policy['name']] = \
|
||||
mon_policy
|
||||
return monitoring_dict
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user