Closed
Description
Proposal: eAPI connection plugin
Author: Nathaniel Case <@Qalthos>
Date: 2018-03-27
- Status: New
- Proposal type: network
- Targeted Release: 2.6
- Estimated time to implement: 4 weeks?
Motivation
Implement eAPI as a first order connection plugin like connection: network_cli
& connection: netconf
Allows deprecation of connection: local
& provider:
for Arista devices
Problems
- As a user, I want to manage Arista devices that can only be accessed via eAPI
- As a user, I want to connect to an Arista device over eAPI without using
connection: local
andprovider
so I can use basic Ansible connection options instead, including specifying http(s) port and encrypted or non-encrypted transport type (HTTP/HTTPS) - As a user, I want existing playbooks using
connection: local
to continue to function as before without user intervention - As a user, I want to securely connect to eos devices via a proxy
- As a user, I want to securely connect using using username & password or a certificate
- As a user, I want to have enough information to debug when the connection/authentication fails
- As a user, I want to be able to control my operating mode (such as privilege mode)
- As a user, I want to be able to reset the connection using the Ansible meta handler reset_connection
Solution proposal
This connection plugin works like the existing network_cli
and netconf
plugins, and should have the following properties
- When the connection is created
- builds endpoint URI from connection options
- check that
network_os
is set and load appropriatecliconf
plugin
- When
_connect(self)
is called, ensure socket_path is valid close(self)
is a no-opput_file
,fetch_file
, andexec_command
all redirect to an internallocal
connection, to allow non-networking modules to function on the local host, as is done in existing network connection plugins.- When
send(self, command)
is called- a JSON-RPC request is built from the command
- This will either be done in the connection or sent to an api request builder plugin based on
network_os
depending on applicability with nxapi
- This will either be done in the connection or sent to an api request builder plugin based on
- The request is sent to the URI built earlier
- The response from the device is unpacked
- If the response indicates an error occurred, raise AnsibleConnectionFailure with the details
- Return the response
- a JSON-RPC request is built from the command
Testing
- Add eAPI connection case to existing eos integration tests
- Move all
connection: local
tests to single test covering both transports - Each user story should be defended
- High code coverage for new code
Documentation
- EOS docs fragments need to be updated to remove mentions of "This option is only required if you are using eAPI" with reference to
connection: local
- EOS platform specific page needs to be altered to replace any reference to
connection: local
with the new connection type - The network section of the
become
guide should be updated to include the new connection type