Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def setUp(self):
pyeapi.client.load_config(filename=get_fixture('dut.conf'))
config = pyeapi.client.config
self.duts = list()
for name in config.sections():
if name.startswith('connection:') and 'localhost' not in name:
name = name.split(':')[1]
self.duts.append(pyeapi.client.connect_to(name))
def test_execute_with_autocomplete(self):
# There are some versions of EOS before 4.17.x that have the
# autocomplete feature available. If system tests are run on one of
# those version of EOS this system test will fail.
for dut in self.duts:
version = self._dut_eos_version(dut)
version = version.split('.')
if int(version[0]) >= 4 and int(version[1]) >= 17:
result = dut.connection.execute(['sh ver'], encoding='json',
autoComplete=True)
self.assertIn('version', result['result'][0])
else:
# Verify exception thrown for EOS version that does not
# support autoComplete parameter with EAPI
with self.assertRaises(pyeapi.eapilib.CommandError):
dut.connection.execute(['sh ver'], encoding='json',
autoComplete=True)
def setUp(self):
pyeapi.client.load_config(filename=get_fixture('dut.conf'))
config = pyeapi.client.config
self.duts = list()
for name in config.sections():
if name.startswith('connection:') and 'localhost' not in name:
name = name.split(':')[1]
dut = pyeapi.client.connect_to(name)
self.duts.append(dut)
if dut._enablepwd is not None:
# If enable password defined for dut, set the
# enable password on the dut and clear it on tearDown
dut.config("enable secret %s" % dut._enablepwd)
def wrapper(self, protocol):
api = pyeapi.connect(transport="http", host=protocol.host, port=protocol.conf["http"],
username=protocol.username, password=protocol.password, return_node=True)
test(self, protocol, api)
def setUp(self):
pyeapi.client.load_config(filename=get_fixture('dut.conf'))
config = pyeapi.client.config
self.duts = list()
for name in config.sections():
if name.startswith('connection:') and 'localhost' not in name:
name = name.split(':')[1]
self.duts.append(pyeapi.client.connect_to(name))
def setUp(self):
pyeapi.client.load_config(filename=get_fixture('dut.conf'))
config = pyeapi.client.config
self.duts = list()
for name in config.sections():
if name.startswith('connection:') and 'localhost' not in name:
name = name.split(':')[1]
dut = pyeapi.client.connect_to(name)
self.duts.append(dut)
if dut._enablepwd is not None:
# If enable password defined for dut, set the
# enable password on the dut and clear it on tearDown
dut.config("enable secret %s" % dut._enablepwd)
def setUp(self):
pyeapi.client.load_config(filename=get_fixture('dut.conf'))
config = pyeapi.client.config
self.duts = list()
for name in config.sections():
if name.startswith('connection:') and 'localhost' not in name:
name = name.split(':')[1]
self.duts.append(pyeapi.client.connect_to(name))
def setUp(self):
pyeapi.client.load_config(filename=get_fixture('dut.conf'))
config = pyeapi.client.config
self.duts = list()
for name in config.sections():
if name.startswith('connection:') and 'localhost' not in name:
name = name.split(':')[1]
dut = pyeapi.client.connect_to(name)
self.duts.append(dut)
if dut._enablepwd is not None:
# If enable password defined for dut, set the
# enable password on the dut and clear it on tearDown
dut.config("enable secret %s" % dut._enablepwd)
def test_node_hasattr_connection(self):
node = pyeapi.client.Node(None)
self.assertTrue(hasattr(node, 'connection'))
def setUp(self):
self.node = Node(None)
self.node._running_config = self.config
self.mock_config = Mock(name='node.config')
self.node.config = self.mock_config
self.mock_enable = Mock(name='node.enable')
self.node.enable = self.mock_enable
self.assertIsNotNone(self.instance)
self.instance.node = self.node