def walk_phynetset(key,value,walk,save): for weak_phynet in value.set.dataset(): try: phynetobj = walk(weak_phynet.getkey()) except KeyError: pass else: phynetmapkey = PhysicalNetworkMap.default_key(phynetobj.id) try: phynetmapobj = walk(phynetmapkey) except KeyError: pass else: save(phynetmapobj.getkey()) saved_phymap_keys.append(phynetmapobj.getkey()) saved_physicalnetworkmap_to_logicalnetwork[phynetmapobj.getkey()] = [] for lgnet in phynetmapobj.logicnetworks.dataset(): try: lgnetobj = walk(lgnet.getkey()) except KeyError: pass else: if not lgnetobj: save(lgnet.getkey()) saved_lgnet_keys.append(lgnet.getkey()) saved_physicalnetworkmap_to_logicalnetwork[phynetmapobj.getkey()]\ .append(lgnet.getkey())
def walker(walk, write, timestamp, parameters_dict): for key, parameters in reorder_dict(parameters_dict): try: value = walk(key) except KeyError: pass else: id_ = parameters['id'] try: phy_map = walk(PhysicalNetworkMap.default_key(id_)) except KeyError: pass else: check_processor(value, phy_map, walk, write, parameters=parameters) write(phy_map.getkey(), None) try: phynetset = walk(PhysicalNetworkSet.default_key()) except KeyError: pass else: phynetset.set.dataset().discard( value.create_weakreference()) write(phynetset.getkey(), phynetset) write(key, None)
def walker(walk, write, timestamp, parameters_dict): for key, parameters in reorder_dict(parameters_dict): try: value = walk(key) except KeyError: pass else: id_ = parameters['id'] new_network = create_new(PhysicalNetwork, value, id_) new_network.type = type create_processor(new_network, walk, write, parameters=parameters) write(key, new_network) new_networkmap = PhysicalNetworkMap.create_instance(id_) new_networkmap.network = new_network.create_weakreference() write(new_networkmap.getkey(), new_networkmap) # Save into network set try: physet = walk(PhysicalNetworkSet.default_key()) except KeyError: pass else: physet.set.dataset().add( new_network.create_weakreference()) write(physet.getkey(), physet)
def walk_phynetset(key, value, walk, save): for weak_phynet in value.set.dataset(): try: phynetobj = walk(weak_phynet.getkey()) except KeyError: pass else: phynetmapkey = PhysicalNetworkMap.default_key(phynetobj.id) try: phynetmapobj = walk(phynetmapkey) except KeyError: pass else: save(phynetmapobj.getkey()) saved_phymap_keys.append(phynetmapobj.getkey()) saved_physicalnetworkmap_to_logicalnetwork[ phynetmapobj.getkey()] = [] for lgnet in phynetmapobj.logicnetworks.dataset(): try: lgnetobj = walk(lgnet.getkey()) except KeyError: pass else: if not lgnetobj: save(lgnet.getkey()) saved_lgnet_keys.append(lgnet.getkey()) saved_physicalnetworkmap_to_logicalnetwork[phynetmapobj.getkey()]\ .append(lgnet.getkey())
def update_physicalnetwork_processor(physicalnetwork, walk, write, *, parameters): if 'vnirange' in parameters: _check_vnirange(parameters['vnirange']) try: phymap = walk(PhysicalNetworkMap.default_key(physicalnetwork.id)) except WalkKeyNotRetrieved: pass else: _check_vnirange_allocation(parameters['vnirange'], phymap.network_allocation) return default_processor(physicalnetwork, parameters=parameters, disabled=('type',))
def walk_phynetset(key,value,walk,save): del saved_lgnet_keys[:] del saved_phymap_keys[:] saved_physicalnetworkmap_to_logicalnetwork.clear() for weak_phynet in value.set.dataset(): with suppress(WalkKeyNotRetrieved): phynetobj = walk(weak_phynet.getkey()) phynetmapkey = PhysicalNetworkMap.default_key(phynetobj.id) phynetmapobj = walk(phynetmapkey) save(phynetmapobj.getkey()) saved_phymap_keys.append(phynetmapobj.getkey()) saved_physicalnetworkmap_to_logicalnetwork[phynetmapobj.getkey()] = [] for lgnet in phynetmapobj.logicnetworks.dataset(): with suppress(WalkKeyNotRetrieved): lgnetobj = walk(lgnet.getkey()) if not lgnetobj: save(lgnet.getkey()) saved_lgnet_keys.append(lgnet.getkey()) saved_physicalnetworkmap_to_logicalnetwork[phynetmapobj.getkey()]\ .append(lgnet.getkey())
def update_physicalnetwork_keys(id_, parameters): if 'vlanrange' in parameters: return (PhysicalNetworkMap.default_key(id_), ) else: return ()
def update_logicalnetwork_keys(id_, parameters): if 'vlanid' in parameters: return (PhysicalNetwork.default_key(id_), PhysicalNetworkMap.default_key(id_)) else: return ()
def default_physicalnetwork_update_keys(id_, parameters): return (PhysicalNetworkMap.default_key(id_), )
def default_physicalnetwork_keys(id_, parameters): return (PhysicalNetworkMap.default_key(id_), PhysicalNetworkSet.default_key())
def default_logicalnetwork_keys(phynet_id, parameters): return (PhysicalNetwork.default_key(phynet_id), PhysicalNetworkMap.default_key(phynet_id), LogicalNetworkSet.default_key(), LogicalNetworkMap.default_key(parameters['id']))
def default_physicalport_keys(phynet_id, parameters): return (PhysicalNetwork.default_key(phynet_id), PhysicalNetworkMap.default_key(phynet_id), PhysicalPortSet.default_key())