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
Branches
Tags
No related merge requests found
...@@ -5,8 +5,7 @@ import queue ...@@ -5,8 +5,7 @@ import queue
import subprocess import subprocess
import os import os
import json import json
import numpy as np # import numpy as np
# import matplotlib.pyplot as plt # 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", "") 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(): ...@@ -46,7 +45,7 @@ def generate_and_send_traffic_matrix():
mean_rate = 1000 mean_rate = 1000
else: else:
mean_rate = round((f * A[i] * P_values[j]) / sum(P_values) + ((1 - f) * A[j] * P_values[i]) / sum(P_values)) 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 traffic_matrix[point_ip_send][point_ip_recv] = mean_rate
...@@ -56,9 +55,10 @@ def generate_and_send_traffic_matrix(): ...@@ -56,9 +55,10 @@ def generate_and_send_traffic_matrix():
if src_ip != dest_ip: if src_ip != dest_ip:
with open(file_path, "w") as file: with open(file_path, "w") as file:
dest_port = listen_port_map[dest_ip] 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 listen_port_map[dest_ip] += 1
file.write(f"{src_ip} {command}\n") file.write(f"{src_ip} {command}\n")
print(command)
if dest_ip not in trace_receive: if dest_ip not in trace_receive:
trace_receive[dest_ip] = 0 trace_receive[dest_ip] = 0
...@@ -162,7 +162,7 @@ def main(): ...@@ -162,7 +162,7 @@ def main():
A[i] += rate A[i] += rate
A[j] += rate A[j] += rate
scale_factor = 5000 / max(A) scale_factor = 6500 / max(A)
for i in range(len(A)): for i in range(len(A)):
A[i] *= scale_factor A[i] *= scale_factor
print(f"A[{i}]", A[i]) 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