Skip to content

Commit 9eb27bd

Browse files
committed
Enable retry for eos command
1 parent dde98b7 commit 9eb27bd

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

tests/common/devices/eos.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
import os
66

77
from tests.common.devices.base import AnsibleHostBase
8+
from tests.common.errors import RunAnsibleModuleFail
9+
from retry import retry
810

911
logger = 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

Comments
 (0)