when executing a VCA primitive, parameter values are always a
string (defined at yang model), but key 'data-type' can indicate
that this is a STRING, INTEGER or BOOLEAN. In case of not a string
data is converted to the target type
Change-Id: I77babb1859b99df9290373deb3568686663d2015
Signed-off-by: tierno <alfonso.tiernosepulveda@telefonica.com>
width=256)
elif isinstance(calculated_params[param_name], str) and calculated_params[param_name].startswith("!!yaml "):
calculated_params[param_name] = calculated_params[param_name][7:]
+ if parameter.get("data-type") == "INTEGER":
+ try:
+ calculated_params[param_name] = int(calculated_params[param_name])
+ except ValueError: # error converting string to int
+ raise LcmException(
+ "Parameter {} of primitive {} must be integer".format(param_name, primitive_desc["name"]))
+ elif parameter.get("data-type") == "BOOLEAN":
+ calculated_params[param_name] = not ((str(calculated_params[param_name])).lower() == 'false')
# add always ns_config_info if primitive name is config
if primitive_desc["name"] == "config":