diff --git a/src/opserver/alarmgen.py b/src/opserver/alarmgen.py
index 093f2b5f6b3..9e3be6c4f12 100644
--- a/src/opserver/alarmgen.py
+++ b/src/opserver/alarmgen.py
@@ -276,10 +276,10 @@ def _get_json_value(self, val):
return val
# end _get_json_value
- def _get_json_vars(self, uve, exp, operand1_val,
- operand2_val, is_operand2_json_val):
+ def _get_json_variables(self, uve, exp, operand1_val,
+ operand2_val, is_operand2_json_val):
json_vars = {}
- for var in exp.vars:
+ for var in exp.variables:
# If var and operand1/operand2 are at the same hirerarchy in
# the uve struture, then get the value of var from parent_attr of
# the corresponding operand_val
@@ -295,7 +295,7 @@ def _get_json_vars(self, uve, exp, operand1_val,
var_val = self._get_operand_value(uve, var)['value']
json_vars[var] = self._get_json_value(var_val)
return json_vars
- # end _get_json_vars
+ # end _get_json_variables
def _compare_operand_vals(self, val1, val2, operation):
try:
@@ -334,7 +334,7 @@ def _compare_operand_vals(self, val1, val2, operation):
def _get_alarm_match(self, uve, exp, operand1_val, operand2_val,
is_operand2_json_val):
- json_vars = self._get_json_vars(uve, exp, operand1_val,
+ json_vars = self._get_json_variables(uve, exp, operand1_val,
operand2_val, is_operand2_json_val)
json_operand1_val = self._get_json_value(operand1_val['value'])
if not is_operand2_json_val:
@@ -352,7 +352,8 @@ def _get_alarm_condition_match(self, uve, exp, operand1_val, operand2_val,
operand2_val, is_operand2_json_val)]
return AlarmConditionMatch(
condition=AlarmCondition(operation=exp.operation,
- operand1=exp.operand1, operand2=exp.operand2, vars=exp.vars),
+ operand1=exp.operand1, operand2=exp.operand2,
+ vars=exp.variables),
match=match_list)
# end _get_alarm_condition_match
diff --git a/src/opserver/alarmgen_config_handler.py b/src/opserver/alarmgen_config_handler.py
index c6209c51a76..384a692a6a7 100644
--- a/src/opserver/alarmgen_config_handler.py
+++ b/src/opserver/alarmgen_config_handler.py
@@ -7,7 +7,7 @@
from vnc_api.gen.resource_client import Alarm
from vnc_api.gen.resource_xsd import IdPermsType, AlarmExpression, \
- AlarmAndList, AlarmOrList
+ AlarmAndList, AlarmOrList, UveKeysType
from pysandesh.gen_py.sandesh.ttypes import SandeshLevel
from config_handler import ConfigHandler
from opserver_util import camel_case_to_hyphen, inverse_dict
@@ -90,7 +90,7 @@ def _create_inbuilt_alarms_config(self):
extn.obj.__class__.__name__)
if self._inbuilt_alarms.has_key(alarm_name):
uve_keys = self._inbuilt_alarms[alarm_name].get_uve_keys()
- uve_keys.append(_INVERSE_UVE_MAP[table])
+ uve_keys.uve_key.append(_INVERSE_UVE_MAP[table])
self._inbuilt_alarms[alarm_name].set_uve_keys(uve_keys)
else:
alarm_or_list = None
@@ -103,7 +103,7 @@ def _create_inbuilt_alarms_config(self):
operation=exp['operation'],
operand1=exp['operand1'],
operand2=exp['operand2'],
- vars=exp.get('vars')))
+ variables=exp.get('variables')))
alarm_or_list.append(AlarmAndList(alarm_and_list))
desc = ' '.join([l.strip() \
for l in extn.obj.__doc__.splitlines()])
@@ -112,7 +112,7 @@ def _create_inbuilt_alarms_config(self):
'fq_name': ['default-global-system-config',
alarm_name]}
self._inbuilt_alarms[alarm_name] = Alarm(name=alarm_name,
- uve_keys=[_INVERSE_UVE_MAP[table]],
+ uve_keys=UveKeysType([_INVERSE_UVE_MAP[table]]),
alarm_severity=extn.obj.severity(),
alarm_rules=AlarmOrList(alarm_or_list),
id_perms=id_perms, **kwargs)
@@ -139,25 +139,27 @@ def _handle_config_update(self, config_type, fq_name, config_obj,
alarm_config = self._config_db[config_type].get(fq_name)
if alarm_config is None:
alarm_config_change_map = self._update_alarm_config_table(
- fq_name, config_obj, config_obj.uve_keys, 'CREATE')
+ fq_name, config_obj, config_obj.uve_keys.uve_key,
+ 'CREATE')
else:
# If the alarm config already exists, then check for
- # addition/deletion of elements from uve_keys[] and
+ # addition/deletion of elements from uve_keys and
# update the alarm_config_db appropriately.
- add_uve_keys = set(config_obj.uve_keys) - \
- set(alarm_config.uve_keys)
+ add_uve_keys = set(config_obj.uve_keys.uve_key) - \
+ set(alarm_config.uve_keys.uve_key)
if add_uve_keys:
alarm_config_change_map.update(
self._update_alarm_config_table(
fq_name, config_obj, add_uve_keys, 'CREATE'))
- del_uve_keys = set(alarm_config.uve_keys) - \
- set(config_obj.uve_keys)
+ del_uve_keys = set(alarm_config.uve_keys.uve_key) - \
+ set(config_obj.uve_keys.uve_key)
if del_uve_keys:
alarm_config_change_map.update(
self._update_alarm_config_table(
fq_name, None, del_uve_keys, 'DELETE'))
- upd_uve_keys = set(config_obj.uve_keys).intersection(
- set(alarm_config.uve_keys))
+ upd_uve_keys = \
+ set(config_obj.uve_keys.uve_key).intersection(
+ set(alarm_config.uve_keys.uve_key))
if upd_uve_keys:
alarm_config_change_map.update(
self._update_alarm_config_table(
@@ -168,7 +170,7 @@ def _handle_config_update(self, config_type, fq_name, config_obj,
if config_obj is not None:
if config_type == 'alarm':
alarm_config_change_map = self._update_alarm_config_table(
- fq_name, None, config_obj.uve_keys, 'DELETE')
+ fq_name, None, config_obj.uve_keys.uve_key, 'DELETE')
del self._config_db[config_type][fq_name]
if not len(self._config_db[config_type]):
del self._config_db[config_type]
diff --git a/src/opserver/plugins/alarm_disk_usage/main.py b/src/opserver/plugins/alarm_disk_usage/main.py
index 4a4672a2372..79a522745ce 100644
--- a/src/opserver/plugins/alarm_disk_usage/main.py
+++ b/src/opserver/plugins/alarm_disk_usage/main.py
@@ -14,7 +14,8 @@ class DiskUsage(AlarmBase):
'percentage_partition_space_used',
'operation': '>=',
'operand2': '90',
- 'vars': ['NodeStatus.disk_usage_info.partition_name']
+ 'variables': \
+ ['NodeStatus.disk_usage_info.partition_name']
}
]
}
diff --git a/src/opserver/plugins/alarm_process_connectivity/main.py b/src/opserver/plugins/alarm_process_connectivity/main.py
index 49603618a77..7778bb70ad3 100644
--- a/src/opserver/plugins/alarm_process_connectivity/main.py
+++ b/src/opserver/plugins/alarm_process_connectivity/main.py
@@ -22,7 +22,7 @@ class ProcessConnectivity(AlarmBase):
'operand1': 'NodeStatus.process_status.state',
'operation': '!=',
'operand2': '"Functional"',
- 'vars': ['NodeStatus.process_status.module_id',
+ 'variables': ['NodeStatus.process_status.module_id',
'NodeStatus.process_status.instance_id']
}
]
diff --git a/src/opserver/plugins/alarm_process_status/main.py b/src/opserver/plugins/alarm_process_status/main.py
index 762d5a770f9..765aa91a6c9 100644
--- a/src/opserver/plugins/alarm_process_status/main.py
+++ b/src/opserver/plugins/alarm_process_status/main.py
@@ -22,7 +22,7 @@ class ProcessStatus(AlarmBase):
'operand1': 'NodeStatus.process_info.process_state',
'operation': '!=',
'operand2': '"PROCESS_STATE_RUNNING"',
- 'vars': ['NodeStatus.process_info.process_name']
+ 'variables': ['NodeStatus.process_info.process_name']
}
]
}
diff --git a/src/opserver/plugins/alarm_storage/main.py b/src/opserver/plugins/alarm_storage/main.py
index 9ce5c59d1b4..05892426a82 100644
--- a/src/opserver/plugins/alarm_storage/main.py
+++ b/src/opserver/plugins/alarm_storage/main.py
@@ -13,7 +13,8 @@ class StorageClusterState(AlarmBase):
'operand1': 'StorageCluster.info_stats.status',
'operation': '!=',
'operand2': '0',
- 'vars': ['StorageCluster.info_stats.health_summary']
+ 'variables': \
+ ['StorageCluster.info_stats.health_summary']
}
]
}
diff --git a/src/opserver/plugins/alarm_vrouter_interface/main.py b/src/opserver/plugins/alarm_vrouter_interface/main.py
index bb6e3e6fcbc..3c70af65366 100644
--- a/src/opserver/plugins/alarm_vrouter_interface/main.py
+++ b/src/opserver/plugins/alarm_vrouter_interface/main.py
@@ -13,8 +13,8 @@ class VrouterInterface(AlarmBase):
'operand1': 'VrouterAgent.down_interface_count',
'operation': '>=',
'operand2': '1',
- 'vars': ['VrouterAgent.error_intf_list', \
- 'VrouterAgent.no_config_intf_list']
+ 'variables': ['VrouterAgent.error_intf_list', \
+ 'VrouterAgent.no_config_intf_list']
},
]
}
diff --git a/src/opserver/test/test_alarm.py b/src/opserver/test/test_alarm.py
index 7f4089f34b3..c8717e1dff2 100755
--- a/src/opserver/test/test_alarm.py
+++ b/src/opserver/test/test_alarm.py
@@ -20,7 +20,7 @@
from vnc_api.gen.resource_client import Alarm
from vnc_api.gen.resource_xsd import AlarmExpression, AlarmAndList, \
- AlarmOrList
+ AlarmOrList, UveKeysType
from pysandesh.util import UTCTimestampUsec
from pysandesh.gen_py.sandesh_alarm.ttypes import SandeshAlarmAckRequest, \
SandeshAlarmAckResponseCode
@@ -321,10 +321,10 @@ def get_alarm_config_object(self, config_dict):
operation=exp['operation'],
operand1=exp['operand1'],
operand2=exp['operand2'],
- vars=exp.get('vars')))
+ variables=exp.get('variables')))
alarm_or_list.append(AlarmAndList(alarm_and_list))
return Alarm(name=config_dict['name'],
- uve_keys=config_dict['uve_keys'],
+ uve_keys=UveKeysType(config_dict['uve_keys']),
alarm_severity=config_dict['alarm_severity'],
alarm_rules=AlarmOrList(alarm_or_list),
**config_dict['kwargs'])
@@ -877,7 +877,7 @@ def test_05_evaluate_uve_for_alarms(self):
'operand1': 'A.B',
'operation': '<=',
'operand2': 'A.C.D',
- 'vars': ['A.C.N']
+ 'variables': ['A.C.N']
}
]
}
@@ -903,13 +903,13 @@ def test_05_evaluate_uve_for_alarms(self):
'operand1': 'A.B',
'operation': '<=',
'operand2': 'A.C.D',
- 'vars': ['A.C.N']
+ 'variables': ['A.C.N']
},
{
'operand1': 'A.B',
'operation': '>=',
'operand2': 'A.C.E',
- 'vars': ['A.C.N']
+ 'variables': ['A.C.N']
}
]
}
diff --git a/src/opserver/test/test_alarm_plugins.py b/src/opserver/test/test_alarm_plugins.py
index 20c1813f7c8..7c1f0d81de2 100644
--- a/src/opserver/test/test_alarm_plugins.py
+++ b/src/opserver/test/test_alarm_plugins.py
@@ -58,7 +58,8 @@ def get_alarm_config(self, plugin):
for exp in and_list['and_list']:
alarm_and_list.append(AlarmExpression(
operation=exp['operation'], operand1=exp['operand1'],
- operand2=exp['operand2'], vars=exp.get('vars')))
+ operand2=exp['operand2'],
+ variables=exp.get('variables')))
alarm_or_list.append(AlarmAndList(alarm_and_list))
alarm_name = camel_case_to_hyphen(plugin.__class__.__name__)
kwargs = {'parent_type': 'global-system-config',
diff --git a/src/opserver/test/test_alarmgen_config_handler.py b/src/opserver/test/test_alarmgen_config_handler.py
index 8a885205938..5af4e4c364c 100644
--- a/src/opserver/test/test_alarmgen_config_handler.py
+++ b/src/opserver/test/test_alarmgen_config_handler.py
@@ -12,7 +12,7 @@
from vnc_api.gen.resource_client import GlobalSystemConfig, Alarm
from vnc_api.gen.resource_xsd import AlarmExpression, \
- AlarmAndList, AlarmOrList
+ AlarmAndList, AlarmOrList, UveKeysType
from pysandesh.sandesh_logger import SandeshLogger
from opserver.plugins.alarm_base import AlarmBase
from opserver.alarmgen_config_handler import AlarmGenConfigHandler
@@ -48,10 +48,10 @@ def _get_config_object(self, config_type, config_dict):
operation=exp['operation'],
operand1=exp['operand1'],
operand2=exp['operand2'],
- vars=exp.get('vars')))
+ variables=exp.get('variables')))
alarm_or_list.append(AlarmAndList(alarm_and_list))
return Alarm(name=config_dict['name'],
- uve_keys=config_dict['uve_keys'],
+ uve_keys=UveKeysType(config_dict['uve_keys']),
alarm_severity=config_dict['alarm_severity'],
alarm_rules=AlarmOrList(alarm_or_list),
**config_dict['kwargs'])
diff --git a/src/schema/alarm.xsd b/src/schema/alarm.xsd
index 61ee4dcc831..dfd45c58c6a 100644
--- a/src/schema/alarm.xsd
+++ b/src/schema/alarm.xsd
@@ -22,7 +22,7 @@
-
+
@@ -45,6 +45,12 @@
+
+
+
+
+
+
-
+
+ 'List of UVE tables where this alarm config should be applied. For example, rules based on NodeStatus UVE can be applied to multiple object types such as analytics-node, config-node, control-node, etc.,') -->