# table interfaces (internal/external interfaces)
cp_name2iface_uuid = {}
cp_name2vm_uuid = {}
+ cp_name2db_interface = {}
# for iface in chain(vdu.get("internal-interface").itervalues(), vdu.get("external-interface").itervalues()):
for iface in vdu.get("interface").itervalues():
iface_uuid = str(uuid4())
db_interface["external_name"] = get_str(cp, "name", 255)
cp_name2iface_uuid[db_interface["external_name"]] = iface_uuid
cp_name2vm_uuid[db_interface["external_name"]] = vm_uuid
+ cp_name2db_interface[db_interface["external_name"]] = db_interface
for cp_descriptor in vnfd_descriptor["connection-point"]:
if cp_descriptor["name"] == db_interface["external_name"]:
break
HTTP_Bad_Request)
mgmt_access["vm_id"] = cp_name2vm_uuid[vnfd["mgmt-interface"]["cp"]]
mgmt_access["interface_id"] = cp_name2iface_uuid[vnfd["mgmt-interface"]["cp"]]
+ # mark this interface as of type mgmt
+ cp_name2db_interface[vnfd["mgmt-interface"]["cp"]]["type"] = "mgmt"
+
default_user = get_str(vnfd.get("vnf-configuration", {}).get("config-access", {}).get("ssh-access", {}),
"default-user", 64)
create_network = True
lookfor_network = False
- if lookfor_network and create_network:
- # TODO create two tasks FIND + CREATE with their relationship
- task_action = "FIND"
- task_params = (lookfor_filter,)
- # task_action = "CREATE"
- # task_params = (net_vim_name, net_type, sce_net.get('ip_profile', None))
- # task
+ task_extra = {}
+ if create_network:
+ task_action = "CREATE"
+ task_extra["params"] = (net_vim_name, net_type, sce_net.get('ip_profile', None))
+ if lookfor_network:
+ task_extra["find"] = (lookfor_filter,)
elif lookfor_network:
task_action = "FIND"
- task_params = (lookfor_filter,)
- elif create_network:
- task_action = "CREATE"
- task_params = (net_vim_name, net_type, sce_net.get('ip_profile', None))
+ task_extra["params"] = (lookfor_filter,)
# fill database content
net_uuid = str(uuid4())
"action": task_action,
"item": "instance_nets",
"item_id": net_uuid,
- "extra": yaml.safe_dump({"params": task_params}, default_flow_style=True, width=256)
+ "extra": yaml.safe_dump(task_extra, default_flow_style=True, width=256)
}
net2task_id['scenario'][sce_net['uuid']][datacenter_id] = task_index
task_index += 1