diff --git a/utils/p4runtime_switch.py b/utils/p4runtime_switch.py index 18ec0ecb..542b41c4 100644 --- a/utils/p4runtime_switch.py +++ b/utils/p4runtime_switch.py @@ -94,6 +94,10 @@ def __init__(self, name, sw_path = None, json_path = None, if "cpu_port" in kwargs: self.cpu_port = kwargs["cpu_port"] + self.priority_queues = None + if "priority_queues" in kwargs: + self.priority_queues = kwargs["priority_queues"] + def check_switch_started(self, pid): for _ in range(SWITCH_START_TIMEOUT * 2): @@ -129,6 +133,8 @@ def start(self, controllers): args.append("-- --grpc-server-addr 0.0.0.0:" + str(self.grpc_port)) if self.cpu_port: args.append("--cpu-port " + str(self.cpu_port)) + if self.priority_queues: + args.append("--priority-queues " + str(self.priority_queues)) cmd = ' '.join(args) info(cmd + "\n") print(cmd + "\n") diff --git a/utils/run_exercise.py b/utils/run_exercise.py index a2169fe9..4c0d8fbc 100755 --- a/utils/run_exercise.py +++ b/utils/run_exercise.py @@ -92,10 +92,17 @@ def __init__(self, hosts, switches, links, log_dir, bmv2_exe, pcap_dir, **opts): else: # add default switch switchClass = None - if "cpu_port" in params: - self.addSwitch(sw, log_file="%s/%s.log" %(log_dir, sw), cpu_port=params["cpu_port"], cls=switchClass) - else: - self.addSwitch(sw, log_file="%s/%s.log" %(log_dir, sw), cls=switchClass) + + switch_opts = { + "log_file": "%s/%s.log" % (log_dir, sw), + "cls": switchClass + } + + for key in ("cpu_port", "priority_queues"): + if key in params: + switch_opts[key] = params[key] + + self.addSwitch(sw, **switch_opts) for link in host_links: host_name = link['node1']