From eaf9e352e87e571d5ef56940c9644d1ce53b7a3f Mon Sep 17 00:00:00 2001 From: Sander Vrijders Date: Tue, 23 Oct 2018 18:32:17 +0200 Subject: prototypes: ouroboros: Retry connecting IPCP A connect IPCP command might fail in Ouroboros if the routing has not converged yet. This will retry to connect the IPCP 3 times before giving up. --- rumba/prototypes/ouroboros.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/rumba/prototypes/ouroboros.py b/rumba/prototypes/ouroboros.py index 03f94eb..97abb21 100644 --- a/rumba/prototypes/ouroboros.py +++ b/rumba/prototypes/ouroboros.py @@ -267,8 +267,20 @@ class Experiment(mod.Experiment): for e in el: ipcp = e['src'] cmd = "irm i conn n " + ipcp.name + " dst " + e['dst'].name - - ipcp.node.execute_command(cmd, time_out=None) + retry = 0 + max_retries = 3 + while retry < max_retries: + time.sleep(retry * 5) + try: + ipcp.node.execute_command(cmd, time_out=None) + break + except Exception as e: + retry += 1 + logger.error('Failed to connect IPCP, retrying: ' + + str(retry) + '/' + str(max_retries) + + ' retries') + if retry == max_retries: + raise Exception('Failed to connect IPCP') def _install_prototype(self): logger.info("Installing Ouroboros...") -- cgit v1.2.3