55import os
66
77from tests .common .devices .base import AnsibleHostBase
8+ from tests .common .errors import RunAnsibleModuleFail
9+ from retry import retry
810
911logger = logging .getLogger (__name__ )
1012
@@ -81,6 +83,7 @@ def __str__(self):
8183 def __repr__ (self ):
8284 return self .__str__ ()
8385
86+ @retry (RunAnsibleModuleFail , tries = 3 , delay = 5 )
8487 def shutdown (self , interface_name ):
8588 out = self .eos_config (
8689 lines = ['shutdown' ],
@@ -92,6 +95,7 @@ def shutdown_multiple(self, interfaces):
9295 intf_str = ',' .join (interfaces )
9396 return self .shutdown (intf_str )
9497
98+ @retry (RunAnsibleModuleFail , tries = 3 , delay = 5 )
9599 def no_shutdown (self , interface_name ):
96100 out = self .eos_config (
97101 lines = ['no shutdown' ],
@@ -222,18 +226,21 @@ def kill_bgpd(self):
222226 out = self .eos_config (lines = ['agent {} shutdown' .format (agent )])
223227 return out
224228
229+ @retry (RunAnsibleModuleFail , tries = 3 , delay = 5 )
225230 def start_bgpd (self ):
226231 agent = 'Bgp' if self .is_multiagent () else 'Rib'
227232 out = self .eos_config (lines = ['no agent {} shutdown' .format (agent )])
228233 return out
229234
235+ @retry (RunAnsibleModuleFail , tries = 3 , delay = 5 )
230236 def no_shutdown_bgp (self , asn ):
231237 out = self .eos_config (
232238 lines = ['no shut' ],
233239 parents = ['router bgp {}' .format (asn )])
234240 logging .info ('No shut BGP [%s]' % asn )
235241 return out
236242
243+ @retry (RunAnsibleModuleFail , tries = 3 , delay = 5 )
237244 def no_shutdown_bgp_neighbors (self , asn , neighbors = []):
238245 if not neighbors :
239246 return
0 commit comments