Unverified Commit bea47589 authored by Jialin Li's avatar Jialin Li Committed by GitHub
Browse files

bmv2: move p4 path to a BMV2Net parameter



Allow users to specify custom paths to p4.
Co-authored-by: default avatarAntoine Kaufmann <antoinek@mpi-sws.org>
parent d7d3abd8
...@@ -915,6 +915,7 @@ class BMV2Net(NetSim): ...@@ -915,6 +915,7 @@ class BMV2Net(NetSim):
def __init__(self): def __init__(self):
super().__init__() super().__init__()
self.sync = False self.sync = False
self.p4_path = 'sims/net/p4/basic.json'
def run_cmd(self, env): def run_cmd(self, env):
cmd = ( cmd = (
...@@ -932,7 +933,11 @@ class BMV2Net(NetSim): ...@@ -932,7 +933,11 @@ class BMV2Net(NetSim):
for _, n in self.connect_sockets(env): for _, n in self.connect_sockets(env):
cmd += f' -i {port}@{n}' cmd += f' -i {port}@{n}'
port += 1 port += 1
cmd += ' ' + env.repodir + '/sims/net/p4/basic.json'
if self.p4_path.startswith('/'):
cmd += f' {self.p4_path}'
else:
cmd += f' {env.repodir}/{self.p4_path}'
print(cmd) print(cmd)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment