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