- raise NsWorkerExceptionNotFound(
- "Network not found with this criteria: '{}'".format(
- task.get("find_params")
+ # If there is mgmt-network in the descriptor,
+ # there is no mapping of that network to a VIM network in the descriptor,
+ # also there is no mapping in the "--config" parameter or at VIM creation;
+ # that mgmt-network will be created.
+ if mgmtnet and not mgmtnet_defined_in_vim:
+ net_name = (
+ vim_filter.get("name")
+ if vim_filter.get("name")
+ else vim_filter.get("id")[:16]
+ )
+ vim_net_id, created_items = target_vim.new_network(
+ net_name, None
+ )
+ self.logger.debug(
+ "Created mgmt network vim_net_id: {}".format(vim_net_id)
+ )
+ created = True
+ else:
+ raise NsWorkerExceptionNotFound(
+ "Network not found with this criteria: '{}'".format(
+ task.get("find_params")
+ )