unicon.core package


unicon.core.errors module




ATS TEAM (ats-dev@cisco.com, CSG( STEP) - India)


This module defines all Unicon Exceptions

exception unicon.core.errors.ConnectionError

Bases: Exception

raised when it fails to connect to the device

exception unicon.core.errors.ConnectionInfraError

Bases: Exception

raised when there is any incompatibility or setup issue in connection class

exception unicon.core.errors.ConnectionValidationError

Bases: Exception

Raised when Vailidation Connection Class fails

exception unicon.core.errors.CopyBadNetworkError

Bases: Exception

raised when copy fails due to bad network or connectivity

exception unicon.core.errors.CredentialsExhaustedError(creds_tried, *args)

Bases: Exception

Raised when all credentials have been tried without success.

exception unicon.core.errors.EOF

Bases: Exception

raised when spawn connection closed or not available.

exception unicon.core.errors.SessionConnectionError

Bases: Exception

session connection error

exception unicon.core.errors.SessionError

Bases: Exception

generic session error

exception unicon.core.errors.SpawnInitError

Bases: Exception

error while constricting spawn

exception unicon.core.errors.StateMachineError

Bases: Exception

raised when device comes to unexpected state.

exception unicon.core.errors.StatementValidationError

Bases: Exception

raised when Statements fail to compile

exception unicon.core.errors.SubCommandFailure

Bases: Exception

raised when there is a failure while executing subcommand.

exception unicon.core.errors.TimeoutError

Bases: TimeoutError

raised when expect function times out

exception unicon.core.errors.UniconAuthenticationError

Bases: Exception

Authentication error

unicon.core.manager module

unicon.core.manager.connection(*args, type=None, **kwargs)

This is a factory for connection library. It provides suitable

unicon.core.pluginmanager module




ATS TEAM (ats-dev@cisco.com, CSG( STEP) - India)


This module provides 1. Methods for identifying and loading plugin implementations 2. Methods for validating and accessing platform implementation

class unicon.core.pluginmanager.PluginManager

Bases: object

Loads all plugin implementation, provides API’s for accessing plugins


static discover_builtin_plugins()

loads all plugins

static discover_external_plugins()

discover external plugins defined that users pip installed.

get_plugin(os=None, platform=None, model=None, chassis_type='single_rp')

This method returns the connection class based on the input details provided

property plugins

Plugin list getter

print_tree(data, output='plugin')

This Method print the plugin list in tree structure

Sample Tree Structure:

|__ generic
   |__ data
     |__ dual_rp
     |  |__ cls = <class 'unicon.plugins.generic.GenericDualRPConnection'>
     |  |__ path = /Users/unicon/plugins/generic/__init__.py
     |__ single_rp
        |__ cls = <class 'unicon.plugins.generic.GenericSingleRpConnection'>
        |__ path = /Users/mohamoha/myvenv/plugins/generic/__init__.py
register_plugin(cls, os=None, platform=None, model=None, chassis_type='single_rp')

This method registers all the implementation plugin(i.e connection class) to the unicon plugin manager

It takes OS, platform, MODEL information and based on that registers it

cls refer to the connection class chassis_type indicates if the connection class is for single_rp or dual_rp or stack(default single_rp)

unregister_plugin(os=None, platform=None, model=None, chassis_type=None)

This method unregister a particular implementations from the internal database

validate_arguments(os, platform, model, chassis_type)

Validates the input arguments provided


Validate chassis

validate_model(os, platform, model)

Validates Model


Validates OS

validate_platform(os, platform)

Validates platform

Module contents