projects
/
osm
/
RO.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
bug 684: database order of interfaces are lost
[osm/RO.git]
/
osm_ro
/
wim
/
engine.py
diff --git
a/osm_ro/wim/engine.py
b/osm_ro/wim/engine.py
index
6ff2b4f
..
eecf10f
100644
(file)
--- a/
osm_ro/wim/engine.py
+++ b/
osm_ro/wim/engine.py
@@
-322,16
+322,16
@@
class WimEngine(object):
tenant (str): UUID of the OSM tenant
Returns:
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)
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,
instance_scenario_id, sce_net_id,
def derive_wan_link(self,
wim_usage,
instance_scenario_id, sce_net_id,
- networks, tenant):
+ networks, tenant
, related=None
):
"""Create a instance_wim_nets record for the given information"""
if sce_net_id in wim_usage:
account_id = wim_usage[sce_net_id]
"""Create a instance_wim_nets record for the given information"""
if sce_net_id in wim_usage:
account_id = wim_usage[sce_net_id]
@@
-347,7
+347,8
@@
class WimEngine(object):
'instance_scenario_id': instance_scenario_id,
'sce_net_id': sce_net_id,
'wim_id': wim_id,
'instance_scenario_id': instance_scenario_id,
'sce_net_id': sce_net_id,
'wim_id': wim_id,
- 'wim_account_id': account['uuid']
+ 'wim_account_id': account['uuid'],
+ related: related
}
def derive_wan_links(self, wim_usage, networks, tenant=None):
}
def derive_wan_links(self, wim_usage, networks, tenant=None):
@@
-356,7
+357,7
@@
class WimEngine(object):
(NSR).
Arguments:
(NSR).
Arguments:
- wim_usage(dict): Mapping between sce_net_id and wim_id
+ wim_usage(dict): Mapping between sce_net_id and wim_id
. If wim_id is False, means not create wam_links
networks(list): Dicts containing the information about the networks
that will be instantiated to materialize a Network Service
(scenario) instance.
networks(list): Dicts containing the information about the networks
that will be instantiated to materialize a Network Service
(scenario) instance.
@@
-366,6
+367,9
@@
class WimEngine(object):
list: list of WAN links to be written to the database
"""
# Group networks by key=(instance_scenario_id, sce_net_id)
list: list of WAN links to be written to the database
"""
# Group networks by key=(instance_scenario_id, sce_net_id)
+ related = None
+ if networks:
+ related = networks[0].get("related")
filtered = _filter_multi_vim(networks)
grouped_networks = _group_networks(filtered)
datacenters_per_group = _count_datacenters(grouped_networks)
filtered = _filter_multi_vim(networks)
grouped_networks = _group_networks(filtered)
datacenters_per_group = _count_datacenters(grouped_networks)
@@
-374,11
+378,11
@@
class WimEngine(object):
wan_groups = [key
for key, counter in datacenters_per_group
if counter > 1]
wan_groups = [key
for key, counter in datacenters_per_group
if counter > 1]
-
+ # Keys are tuples(instance_scenario_id, sce_net_id)
return [
self.derive_wan_link(wim_usage,
return [
self.derive_wan_link(wim_usage,
- key[0], key[1], grouped_networks[key], tenant)
- for key in wan_groups
+ key[0], key[1], grouped_networks[key], tenant
, related
)
+ for key in wan_groups
if wim_usage.get(key[1]) is not False
]
def create_action(self, wan_link):
]
def create_action(self, wan_link):
@@
-511,7
+515,7
@@
def _group_networks(networks):
(scenario) instance.
Returns:
dict: Keys are tuples (instance_scenario_id, sce_net_id) and values
(scenario) instance.
Returns:
dict: Keys are tuples (instance_scenario_id, sce_net_id) and values
- are li
ts
of networks.
+ are li
st
of networks.
"""
criteria = itemgetter('instance_scenario_id', 'sce_net_id')
"""
criteria = itemgetter('instance_scenario_id', 'sce_net_id')