I have the following function check_overload(...)
where I check my links if they get overload or not using the parameters shown below.
def check_overload(SR_path, Router_1, Router_2, Router_3, Router_4, step, capacity):
iterations_array = number_iteration_tunnels(SR_path)
load_tunnels = bandwidth_tunnel(SR_path, Router_1, Router_2, Router_3, Router_4)
global overload_point
overload_point = np.zeros(len(iterations_array))
for i in range(len(iterations_array)):
if load_tunnels[i] >= capacity - (iterations_array[i][1] * step):
print "Link is overloaded"
overload_point = load_tunnels[i] - step
return overload_point
else:
print "Link is not overloaded"
return 0
First of all, I calculate number of iteration for each element of SR_path
in the function number_iteration_tunnels(..)
. Then, using the array created by this function iterations_array
, I do a loop to navigate that array.
I aim to return in each iteration the overload_point
if the condition is met, otherwise, I return 0. The problem that I am facing is that using this implementation, the function returns only ones which is obvious. I could not find a way where to do it as my aim is.