unicon.bases.linux package¶
Submodules¶
unicon.bases.linux.connection module¶
- Module:
unicon.bases.linux.connection
- Authors:
ATS TEAM (ats-dev@cisco.com, CSG( STEP) - India)
- Description:
Defines the Connection Base classes for Linux Servers. It defines the work flow of unicon connection and services initialization
- class unicon.bases.linux.connection.BaseLinuxConnection(*args, os=None, os_flavor=None, platform=None, model=None, chassis_type=None, **kwargs)¶
Bases:
ConnectionBase class for linux connections
This does the following
Spawns a connection to the device
Creates a State Machine instance for this device
- Provides method to connect, initialize the devices
and perform services
Initializes SingleRP connection
- chassis_type = None¶
- property connection_type¶
Returns Linux
- disconnect()¶
provides mechanism to disconnect to the device by duck typing connection provider’s disconnect method
- property hostname¶
Returns this connection’s hostname
- property is_ha¶
Attribute to check if this is a HA connection
- logout()¶
- os = None¶
- platform = None¶
- setup_connection()¶
Creates a Session and spawns a connection
unicon.bases.linux.connection_provider module¶
- Module:
unicon.bases.linux.connection_provider
- Author:
ATS Team (ats-dev@cisco.com)
- Description:
The connection class for any platform depends on connection provider class for providing two essential methods, namely,
connectanddisconnect. As the name suggests their role is to let the application connect and disconnect to the linux box.- Dependencies:
connection providers are passed the whole connection object. By the time it is instantiated, it is also imperative that, our connection class contains the following objects:
* spawn objects are created. * state machine objects are created.
It is also expected that all the other vital attributes are present like settings, logs etc.
- Exceptions:
All the classes in this module should raise ConnectionError, in case exceptions are caught.
Example
Examples are provided in class documentation.
- class unicon.bases.linux.connection_provider.BaseLinuxConnectionProvider(connection)¶
Bases:
objectConnection provider for Linux box
Initializes
- connect(*args, **kwargs)¶
Performs the device connection and initialization
- disconnect()¶
Disconnect from the device
- establish_connection()¶
Reads the device state and brings it to the right state
- execute_init_commands()¶
- get_connection_dialog()¶
Creates and returns Dialog, for processing device connection
By default connection provided uses state machine’s dialog for any connection processing. If any additional dialog required has to be updated here
- init_connection()¶
Bring device to initialized state
- init_handle()¶
Executes the init commands on the device after bringing to enable state
- logout()¶
- set_init_commands()¶
unicon.bases.linux.services module¶
- Module:
unicon.bases.service.services
- Authors:
ATS TEAM (ats-dev@cisco.com, CSG( STEP) - India)
- Description:
Contains service base classes related to routers
- class unicon.bases.linux.services.BaseService(connection, context, **kwargs)¶
Bases:
objectBase class for all linux services.
- Parameters:
connection – Device connection object
context – connection context
- call_service(*args, **kwargs)¶
Actual services implementation code
- get_service_result()¶
Common result procedure for all Services
- classmethod platform_check(*args, **kwargs)¶
Verifies whether the service is applicable for a given platform
- Returns:
If the service is applicable for a given platform False: If service is not applicable for the given platform
- Return type:
True
- post_service(*args, **kwargs)¶
Common post_service procedure for all Services
- pre_service(*args, **kwargs)¶
Common pre_service procedure for all Services