# python
Python 3.8.5 (default, Jul 28 2020, 12:59:40)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from pyats.topology import loader
d('testbeds/testbed-17_1.yaml')
device = testbed.devices['N9K-C9508-SPINE-01']
device.connect(alias='nxapi',>>> testbed = loader.load('testbeds/testbed-17_1.yaml')
via='vty')
device.rest.connected
<stdin>:1: DeprecationWarning: Device N9K-C9508-SPINE-01 'tacacs.username' is deprecated in the testbed YAML. This key has been moved to device 'credentials'.
<stdin>:1: DeprecationWarning: Device N9K-C9508-SPINE-01 'passwords.linux' is deprecated in the testbed YAML. Use 'credentials' instead.
>>> device = testbed.devices['N9K-C9508-SPINE-01']
>>> device.connect(alias='nxapi', via='vty')
Traceback (most recent call last):
File "/venv/lib/python3.8/site-packages/urllib3/connectionpool.py", line 597, in urlopen
httplib_response = self._make_request(conn, method, url,
File "/venv/lib/python3.8/site-packages/urllib3/connectionpool.py", line 384, in _make_request
six.raise_from(e, None)
File "<string>", line 2, in raise_from
File "/venv/lib/python3.8/site-packages/urllib3/connectionpool.py", line 380, in _make_request
httplib_response = conn.getresponse()
File "/usr/lib/python3.8/http/client.py", line 1347, in getresponse
response.begin()
File "/usr/lib/python3.8/http/client.py", line 307, in begin
version, status, reason = self._read_status()
File "/usr/lib/python3.8/http/client.py", line 276, in _read_status
raise RemoteDisconnected("Remote end closed connection without"
http.client.RemoteDisconnected: Remote end closed connection without response
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/venv/lib/python3.8/site-packages/requests/adapters.py", line 439, in send
resp = conn.urlopen(
File "/venv/lib/python3.8/site-packages/urllib3/connectionpool.py", line 637, in urlopen
retries = retries.increment(method, url, error=e, _pool=self,
File "/venv/lib/python3.8/site-packages/urllib3/util/retry.py", line 368, in increment
raise six.reraise(type(error), error, _stacktrace)
File "/venv/lib/python3.8/site-packages/urllib3/packages/six.py", line 685, in reraise
raise value.with_traceback(tb)
File "/venv/lib/python3.8/site-packages/urllib3/connectionpool.py", line 597, in urlopen
httplib_response = self._make_request(conn, method, url,
File "/venv/lib/python3.8/site-packages/urllib3/connectionpool.py", line 384, in _make_request
six.raise_from(e, None)
File "<string>", line 2, in raise_from
File "/venv/lib/python3.8/site-packages/urllib3/connectionpool.py", line 380, in _make_request
httplib_response = conn.getresponse()
File "/usr/lib/python3.8/http/client.py", line 1347, in getresponse
response.begin()
File "/usr/lib/python3.8/http/client.py", line 307, in begin
version, status, reason = self._read_status()
File "/usr/lib/python3.8/http/client.py", line 276, in _read_status
raise RemoteDisconnected("Remote end closed connection without"
urllib3.exceptions.ProtocolError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "src/pyats/connections/manager.py", line 339, in pyats.connections.manager.ConnectionManager.connect
File "src/pyats/async_/synchronize.py", line 117, in pyats.async_.synchronize.Lockable.locked._wrapped
File "/venv/lib/python3.8/site-packages/rest/connector/libs/nxos/implementation.py", line 138, in connect
response = self.session.post(login_url, data=_data, timeout=timeout)
File "/venv/lib/python3.8/site-packages/requests/sessions.py", line 578, in post
return self.request('POST', url, data=data, json=json, **kwargs)
File "/venv/lib/python3.8/site-packages/requests/sessions.py", line 530, in request
resp = self.send(prep, **send_kwargs)
File "/venv/lib/python3.8/site-packages/requests/sessions.py", line 643, in send
r = adapter.send(request, **kwargs)
File "/venv/lib/python3.8/site-packages/requests/adapters.py", line 498, in send
raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))
>>> device.rest.connected
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "src/pyats/topology/device.py", line 518, in pyats.topology.device.Device.__getattr__
AttributeError: 'Device' object has no attribute 'rest'
>>>