Send port_mod message even if features_reply contains no ports
since basic.PortConfigModErr deliberately uses a bogus port number anyway
diff --git a/src/python/oftest/testutils.py b/src/python/oftest/testutils.py
index 480604d..e395c03 100644
--- a/src/python/oftest/testutils.py
+++ b/src/python/oftest/testutils.py
@@ -338,17 +338,19 @@
if reply is None:
return -1
logging.debug(reply.show())
+ p = None
for idx in range(len(reply.ports)):
if reply.ports[idx].port_no == port_no:
+ p = reply.ports[idx]
break
- if idx >= len(reply.ports):
- return -1
mod = message.port_mod()
mod.port_no = port_no
- mod.hw_addr = reply.ports[idx].hw_addr
+ if p:
+ mod.hw_addr = p.hw_addr
mod.config = config
mod.mask = mask
- mod.advertise = reply.ports[idx].advertised
+ if p:
+ mod.advertise = p.advertised
controller.message_send(mod)
return 0