diff options
author | Sander Vrijders <sander.vrijders@ugent.be> | 2018-10-23 18:32:17 +0200 |
---|---|---|
committer | Sander Vrijders <sander.vrijders@ugent.be> | 2018-10-23 18:32:17 +0200 |
commit | eaf9e352e87e571d5ef56940c9644d1ce53b7a3f (patch) | |
tree | e42741f3b4269fcdbffc1641fd307ab4b2fddf7e | |
parent | 18226d17d99da246d65a9a248ea01ce088a71f2c (diff) | |
download | rumba-eaf9e352e87e571d5ef56940c9644d1ce53b7a3f.tar.gz rumba-eaf9e352e87e571d5ef56940c9644d1ce53b7a3f.zip |
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.
-rw-r--r-- | rumba/prototypes/ouroboros.py | 16 |
1 files 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...") |