Skip to content
Snippets Groups Projects
Commit 01415d04 authored by NGUYEN Do Duc Anh's avatar NGUYEN Do Duc Anh
Browse files

test udp traffic

parent 693fedcf
No related branches found
No related tags found
No related merge requests found
......@@ -5,8 +5,7 @@ import queue
import subprocess
import os
import json
import numpy as np
# import numpy as np
# import matplotlib.pyplot as plt
os.environ["LD_LIBRARY_PATH"] = "/home/osboxes/D-ITG-2.8.1-r1023-src/D-ITG-2.8.1-r1023/bin:" + os.environ.get("LD_LIBRARY_PATH", "")
......@@ -46,7 +45,7 @@ def generate_and_send_traffic_matrix():
mean_rate = 1000
else:
mean_rate = round((f * A[i] * P_values[j]) / sum(P_values) + ((1 - f) * A[j] * P_values[i]) / sum(P_values))
print(f"{i}->{j}", "mean_rate", mean_rate, "Ai", A[i], "P_values j", P_values[j], "P_values i", P_values[i], "Aj", A[j], "f", f)
# print(f"{i}->{j}", "mean_rate", mean_rate, "Ai", A[i], "P_values j", P_values[j], "P_values i", P_values[i], "Aj", A[j], "f", f)
traffic_matrix[point_ip_send][point_ip_recv] = mean_rate
......@@ -56,9 +55,10 @@ def generate_and_send_traffic_matrix():
if src_ip != dest_ip:
with open(file_path, "w") as file:
dest_port = listen_port_map[dest_ip]
command = f"-T UDP -a {dest_ip} -rp {dest_port} -O {mean_rate} -t 120000"
command = f"-T UDP -a {dest_ip} -rp {dest_port} -O {mean_rate} -t 3600000"
listen_port_map[dest_ip] += 1
file.write(f"{src_ip} {command}\n")
print(command)
if dest_ip not in trace_receive:
trace_receive[dest_ip] = 0
......@@ -162,7 +162,7 @@ def main():
A[i] += rate
A[j] += rate
scale_factor = 5000 / max(A)
scale_factor = 6500 / max(A)
for i in range(len(A)):
A[i] *= scale_factor
print(f"A[{i}]", A[i])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment