Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions tests/common/devices/eos.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import os

from tests.common.devices.base import AnsibleHostBase
from tests.common.errors import RunAnsibleModuleFail
from retry import retry

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -81,6 +83,7 @@ def __str__(self):
def __repr__(self):
return self.__str__()

@retry(RunAnsibleModuleFail, tries=3, delay=5)
def shutdown(self, interface_name):
out = self.eos_config(
lines=['shutdown'],
Expand All @@ -92,6 +95,7 @@ def shutdown_multiple(self, interfaces):
intf_str = ','.join(interfaces)
return self.shutdown(intf_str)

@retry(RunAnsibleModuleFail, tries=3, delay=5)
def no_shutdown(self, interface_name):
out = self.eos_config(
lines=['no shutdown'],
Expand Down Expand Up @@ -222,18 +226,21 @@ def kill_bgpd(self):
out = self.eos_config(lines=['agent {} shutdown'.format(agent)])
return out

@retry(RunAnsibleModuleFail, tries=3, delay=5)
def start_bgpd(self):
agent = 'Bgp' if self.is_multiagent() else 'Rib'
out = self.eos_config(lines=['no agent {} shutdown'.format(agent)])
return out

@retry(RunAnsibleModuleFail, tries=3, delay=5)
def no_shutdown_bgp(self, asn):
out = self.eos_config(
lines=['no shut'],
parents=['router bgp {}'.format(asn)])
logging.info('No shut BGP [%s]' % asn)
return out

@retry(RunAnsibleModuleFail, tries=3, delay=5)
def no_shutdown_bgp_neighbors(self, asn, neighbors=[]):
if not neighbors:
return
Expand Down
Loading