pass
-class LcmExceptionNoMgmtIP(LcmException):
- pass
-
-
class LcmExceptionExit(LcmException):
pass
return version, namespace, helm_id
+def vld_to_ro_ip_profile(source_data):
+ if source_data:
+ return {
+ "ip_version": "IPv4"
+ if "v4" in source_data.get("ip-version", "ipv4")
+ else "IPv6",
+ "subnet_address": source_data.get("cidr")
+ or source_data.get("subnet-address"),
+ "gateway_address": source_data.get("gateway-ip")
+ or source_data.get("gateway-address"),
+ "dns_address": ";".join(
+ [v["address"] for v in source_data["dns-server"] if v.get("address")]
+ )
+ if source_data.get("dns-server")
+ else None,
+ "dhcp_enabled": source_data.get("dhcp-params", {}).get("enabled", False)
+ or source_data.get("dhcp-enabled", False),
+ "dhcp_start_address": source_data["dhcp-params"].get("start-address")
+ if source_data.get("dhcp-params")
+ else None,
+ "dhcp_count": source_data["dhcp-params"].get("count")
+ if source_data.get("dhcp-params")
+ else None,
+ "ipv6_address_mode": source_data["ipv6-address-mode"]
+ if "ipv6-address-mode" in source_data
+ else None,
+ }
+
+
class LcmBase:
def __init__(self, msg, logger):
"""
Returns:
hex digest (str): The hash of the charm file
"""
- filehash = hashlib.md5()
+ filehash = hashlib.sha256()
with open(zipped_file, mode="rb") as file:
contents = file.read()
filehash.update(contents)
"""
Cancel all active tasks of a concrete ns, nsi, vim_account, sdn identified for _id. If op_id is supplied only
this is cancelled, and the same with task_name
+ :return: cancelled task to be awaited if needed
"""
if not self.task_registry[topic].get(_id):
return
for op_id in reversed(self.task_registry[topic][_id]):
if target_op_id and target_op_id != op_id:
continue
- for task_name, task in self.task_registry[topic][_id][op_id].items():
+ for task_name, task in list(self.task_registry[topic][_id][op_id].items()):
if target_task_name and target_task_name != task_name:
continue
# result =
task.cancel()
+ yield task
# if result:
# self.logger.debug("{} _id={} order_id={} task={} cancelled".format(topic, _id, op_id, task_name))