Skip to content

New connection plugin for Arista eAPI #102

Closed
@Qalthos

Description

@Qalthos

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 and provider 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 appropriate cliconf plugin
  • When _connect(self) is called, ensure socket_path is valid
  • close(self) is a no-op
  • put_file, fetch_file, and exec_command all redirect to an internal local 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_osdepending on applicability with nxapi
    • 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

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions