Skip to content

Commit

Permalink
avoid creating ports twice
Browse files Browse the repository at this point in the history
  • Loading branch information
melvinw committed May 18, 2017
1 parent 595c92e commit 36f8f4b
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions generator/generator_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ def get_all_stats(cli, sess, port):
for port in ports:
sess = cli.get_session(port)
last[port] = get_all_stats(cli, sess, port)
print(port, last[port])

try:
while True:
time.sleep(1)
Expand Down Expand Up @@ -509,10 +509,13 @@ def start(cli, tx_port, rx_port, mode, spec):
tx_port_args['driver'], tx_port_args['name'],
arg=tx_port_args['arg'])
tx_port = ret.name
ret = cli.bess.create_port(
rx_port_args['driver'], rx_port_args['name'],
arg=rx_port_args['arg'])
rx_port = ret.name
if rx_port != tx_port:
ret = cli.bess.create_port(
rx_port_args['driver'], rx_port_args['name'],
arg=rx_port_args['arg'])
rx_port = ret.name
else:
rx_port = tx_port

if spec is not None and 'src_mac' not in spec:
spec['src_mac'] = ret.mac_addr
Expand Down

0 comments on commit 36f8f4b

Please sign in to comment.