__author__ = "Alfonso Tierno, Gerardo Garcia, Pablo Montes"
__date__ = "$26-aug-2014 11:09:29$"
-__version__ = "0.6.04"
+__version__ = "0.6.05"
version_date = "Jan 2019"
database_version = 36 # expected database schema version
# --> WIM
# TODO: use this information during network creation
- wim_account_id = None
+ wim_account_id = wim_account_name = None
if len(involved_datacenters) > 1 and 'uuid' in sce_net:
# OBS: sce_net without uuid are used internally to VNFs
# and the assumption is that VNFs will not be split among
# different datacenters
- wim_account_id = wim_engine.find_suitable_wim_account(
+ wim_account = wim_engine.find_suitable_wim_account(
involved_datacenters, tenant_id)
+ wim_account_id = wim_account['uuid']
+ wim_account_name = wim_account['name']
wim_usage[sce_net['uuid']] = wim_account_id
# <-- WIM
task_extra = {}
if create_network:
task_action = "CREATE"
- task_extra["params"] = (net_vim_name, net_type, sce_net.get('ip_profile', None))
+ task_extra["params"] = (net_vim_name, net_type, sce_net.get('ip_profile', None), wim_account_name)
if lookfor_network:
task_extra["find"] = (lookfor_filter,)
elif lookfor_network:
pci = port.get("pci")
element["switch_port"] = port.get("switch_port")
element["switch_mac"] = port.get("switch_mac")
- if not pci or not (element["switch_port"] or element["switch_mac"]):
- raise NfvoException ("The mapping must contain the 'pci' and at least one of the elements 'switch_port'"
- " or 'switch_mac'", httperrors.Bad_Request)
+ if not element["switch_port"] and not element["switch_mac"]:
+ raise NfvoException ("The mapping must contain 'switch_port' or 'switch_mac'", httperrors.Bad_Request)
for pci_expanded in utils.expand_brackets(pci):
element["pci"] = pci_expanded
maps.append(dict(element))
"items": {
"type": "object",
"properties": {
- "pci": pci_extended_schema, # pci_schema,
+ "pci": {"OneOf": [{"type": "null"}, pci_extended_schema]}, # pci_schema,
"switch_port": nameshort_schema,
"switch_mac": mac_schema
},
:param text:
:return:
"""
+ if text is None:
+ return (None, )
start = text.find("[")
end = text.find("]")
if start < 0 or end < 0:
vim_config['datacenter_tenant_id'] = vim.get('datacenter_tenant_id')
vim_config['datacenter_id'] = vim.get('datacenter_id')
+ # get port_mapping
+ vim_config["wim_external_ports"] = self.ovim.get_of_port_mappings(
+ db_filter={"region": vim_config['datacenter_id'], "pci": None})
+
self.vim = vim_module[vim["type"]].vimconnector(
uuid=vim['datacenter_id'], name=vim['datacenter_name'],
tenant_id=vim['vim_tenant_id'], tenant_name=vim['vim_tenant_name'],
# CREATE
params = task["params"]
action_text = "creating VIM"
- vim_net_id = self.vim.new_network(*params)
+ vim_net_id = self.vim.new_network(*params[0:2])
net_name = params[0]
net_type = params[1]
+ wim_account_name = params[3]
sdn_controller = self.vim.config.get('sdn-controller')
if sdn_controller and (net_type == "data" or net_type == "ptp"):
action_text = "creating SDN"
with self.db_lock:
sdn_net_id = self.ovim.new_network(network)
+
+ if wim_account_name and self.vim.config["wim_external_ports"]:
+ # add external port to connect WIM. Try with compute node __WIM:wim_name and __WIM
+ action_text = "attaching external port to ovim network"
+ sdn_port_name = sdn_net_id + "." + task["vim_id"]
+ sdn_port_name = sdn_port_name[:63]
+ sdn_port_data = {
+ "compute_node": "__WIM:" + wim_account_name[0:58],
+ "pci": None,
+ "vlan": network["vlan"],
+ "net_id": sdn_net_id,
+ "region": self.vim["config"]["datacenter_id"],
+ "name": sdn_port_name,
+ }
+ try:
+ sdn_external_port_id = self.ovim.new_external_port(sdn_port_data)
+ except ovimException:
+ sdn_port_data["compute_node"] = "__WIM"
+ sdn_external_port_id = self.ovim.new_external_port(sdn_port_data)
+ self.logger.debug("Added sdn_external_port {} to sdn_network {}".format(sdn_external_port_id,
+ sdn_net_id))
+
task["status"] = "DONE"
task["extra"]["vim_info"] = {}
task["extra"]["sdn_net_id"] = sdn_net_id
tenant (str): UUID of the OSM tenant
Returns:
- str: UUID of the WIM account that is able to connect all the
+ object with the WIM account that is able to connect all the
datacenters.
"""
wim_id = self.find_common_wim(datacenter_ids, tenant)
- return self.persist.get_wim_account_by(wim_id, tenant)['uuid']
+ return self.persist.get_wim_account_by(wim_id, tenant)
def derive_wan_link(self,
wim_usage,