def lock_resources_used_by_neighbor_v6(neighbor): locks_name = list() locks_name.append(LOCK_NEIGHBOR_V6 % neighbor.id) locks_name.append(LOCK_PEER_GROUP % neighbor.peer_group_id) locks_name.append(LOCK_ROUTE_MAP % neighbor.peer_group.route_map_in_id) locks_name.append(LOCK_ROUTE_MAP % neighbor.peer_group.route_map_out_id) for route_map_entry in neighbor.peer_group.route_map_in.route_map_entries: locks_name.append(LOCK_ROUTE_MAP_ENTRY % route_map_entry.id) locks_name.append(LOCK_LIST_CONFIG_BGP % route_map_entry.list_config_bgp_id) for route_map_entry in neighbor.peer_group.route_map_out.route_map_entries: locks_name.append(LOCK_ROUTE_MAP_ENTRY % route_map_entry.id) locks_name.append(LOCK_LIST_CONFIG_BGP % route_map_entry.list_config_bgp_id) # Remove duplicates locks locks_name = list(set(locks_name)) return create_lock_with_blocking(locks_name)
def lock_resources_used_by_neighbor_v6(neighbor): locks_name = list() locks_name.append(LOCK_NEIGHBOR_V6 % neighbor.id) locks_name.append(LOCK_PEER_GROUP % neighbor.peer_group_id) locks_name.append(LOCK_ROUTE_MAP % neighbor.peer_group.route_map_in_id) locks_name.append(LOCK_ROUTE_MAP % neighbor.peer_group.route_map_out_id) for route_map_entry in neighbor.peer_group.route_map_in.route_map_entries: locks_name.append(LOCK_ROUTE_MAP_ENTRY % route_map_entry.id) locks_name.append(LOCK_LIST_CONFIG_BGP % route_map_entry.list_config_bgp_id) for route_map_entry in neighbor.peer_group.route_map_out.route_map_entries: locks_name.append(LOCK_ROUTE_MAP_ENTRY % route_map_entry.id) locks_name.append(LOCK_LIST_CONFIG_BGP % route_map_entry.list_config_bgp_id) # Remove duplicates locks locks_name = list(set(locks_name)) return create_lock_with_blocking(locks_name)
raise ValidationAPIException(e.detail) except Exception, e: raise NetworkAPIException(str(e)) else: # lock network id to prevent multiple requests to same id locks_name = list() locks_name.append(LOCK_NETWORK_IPV4 % netv4_obj.id) locks_name.append(LOCK_VLAN % netv4_obj.vlan.id) for equipment in routers: lock_name = LOCK_EQUIPMENT_DEPLOY_CONFIG_NETWORK_SCRIPT % \ (equipment.id) locks_name.append(lock_name) locks_list = create_lock_with_blocking(locks_name) try: if netv4_obj.active == 0: return 'Network already not active. Nothing to do.' # load dict with all equipment attributes dict_ips = get_dict_v4_to_use_in_configuration_deploy( user, netv4_obj, routers) status_deploy = dict() # TODO implement threads for equipment in routers: # generate config file
raise ValidationAPIException(e.detail) except Exception, e: raise NetworkAPIException(str(e)) else: # lock network id to prevent multiple requests to same id locks_name = list() locks_name.append(LOCK_NETWORK_IPV4 % netv4_obj.id) locks_name.append(LOCK_VLAN % netv4_obj.vlan.id) for equipment in routers: lock_name = LOCK_EQUIPMENT_DEPLOY_CONFIG_NETWORK_SCRIPT % \ (equipment.id) locks_name.append(lock_name) locks_list = create_lock_with_blocking(locks_name) try: if netv4_obj.active == 0: return 'Network already not active. Nothing to do.' # load dict with all equipment attributes dict_ips = get_dict_v4_to_use_in_configuration_deploy( user, netv4_obj, routers) status_deploy = dict() # TODO implement threads for equipment in routers: # generate config file