Package onep :: Package core :: Package util :: Module Version :: Class Version
[frames] | no frames]

Class Version



Version class represents the version of a onePK component. 
The component could be the client-side package version or the 
server-side version. 
For onePK applications to work, the server-side and the client-side
versioning have to be compatible.

onePK has foundation package and optional packages (e.g. LISP, VTY etc)
Each of these packages have a server side which resides
on the Network Element and a client side which resides in the
application in any of the hosting models. The client side
corresponds to the SDK package used by application.

The onePK server side as well as client-side versions are identified 
with a version number in the form of:  "<b><i>major.minor.maintenance</i></b>"
Any "major" release upgrade is not backward compatible, whereas any "minor"
or "maintenance" release upgrade is backward compatible. 

- Major version number reflects the main version of the package
and changes only when API signatures changes in non-compatible way. 
- Minor version numbers changes when new functionalities are added, such
as addition of new API, or addition of a new parameter to an API in
backward-compatible way.
- Maintenance version numbers changes with bug fixes, document changes or
support library changes.

The usage of versioning by applications is described below.
Consider the case where the application client side is running a higher 
minor version than the server side.

Case 1:

Application does no version checking. 
In this case calling a method not supported on the connected Network Element will result in 
application runtime fault (application will receive exception 
specifying the method is not supported, causing it to abort).

Case 2:

Application checks versions and exits gracefully. 
In this case there is no runtime fault and application can exit gracefully.

Case 3:

Application checks versions, and continues. 
When Application knows that it only uses Network Element-supported methods 
there is no problem. 
When Application uses methods not supported on the connected Network Element, it would need to 
set a condition that causes the application to synthesize the missing 
functionality using only the Network Element supported methods instead.

Instance Methods
 
__init__(self, major, minor, maintenance)
Constructor for internal use only.
 
check_major(self, major)
This method checks if the Version instance matches a given specific major number.
 
check_minor(self, minor)
This method checks if the Version instance matches a given specific minor number.
 
check_maintenance(self, maintenance)
This method checks if the Version instance matches a given specific maintenance number.
 
check_exact(self, major, minor, maintenance)
This method checks if this Version instance matches a given specific major, minor and maintenance number.
 
__str__(self)
str(x)

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __subclasshook__

Class Methods
 
get_package_version(cls, ssName)
This method gets the package (Service Set) version which this client program is currently using.
 
get_element_version(cls, element, ssName)
This method gets the Service Set version of the given Network Element.
 
version_check(cls, element, ssName)
This method checks version compatibility between the a given Network Element and this client program.
Class Variables
  VersionCompare = enum('ONEP_VERSION_NCP', 'ONEP_VERSION_MATCH'...
The VersionCompare enum describes the comparison values when the * versions of SDK and Network Element are compared using the * version check methods in Version class.
Instance Variables
  major
Major version of the Version object
  minor
Minor version of the Version object
  maintenance
Maintenance version of the Version object
Properties

Inherited from object: __class__

Method Details

__init__(self, major, minor, maintenance)
(Constructor)

 

Constructor for internal use only.

Overrides: object.__init__

get_package_version(cls, ssName)
Class Method

 

This method gets the package (Service Set) version which this client program is currently using.

Parameters:
  • ssName - Specifies the Service Set whose version is requested.
Returns:
Version object for the Service Set. If the input service set name is null or unsupported, null will be returned.

get_element_version(cls, element, ssName)
Class Method

 

This method gets the Service Set version of the given Network Element.

Parameters:
  • element - The Network Element to get the version from.
  • ssName - Specifies the Service Set whose version is requested.
Returns:
Version object for the Service Set. If any of the input parameters is null or unsupported, null will be returned.
Raises:

version_check(cls, element, ssName)
Class Method

 

This method checks version compatibility between the a given Network Element and this client program. The result of the compatibility check is provided in the form of VersionCompare enum values. The specified Network Element should be in the connected state for the API to validate the compatibility check.

The results of the comparison should be interpreted as follows:

  • ONEP_VERSION_NCP: The client side and Network Element versions are not compatible for the given package
  • ONEP_VERSION_GT: The client side version is greater than NE version for the given package
  • ONEP_VERSION_LT: The client side version is less than Network Element version for the given package
  • ONEP_VERSION_MATCH: The client side and Network Element versions are exact match
Parameters:
  • element - The Network Element with which the applications version compatibility check needs to be done for the specified package.
  • ssName - Specifies the Service Set to be checked.
Returns:
The result of version check is returned as value of VersionCompare enum. If any of the input parameters is null or unsupported, null will be returned.
Raises:

check_major(self, major)

 

This method checks if the Version instance matches a given specific major number.

Parameters:
  • major - Integer representing the major number.
Returns:
True if the major version have exact match; false otherwise.

check_minor(self, minor)

 

This method checks if the Version instance matches a given specific minor number.

Parameters:
  • minor - Integer representing the major number.
Returns:
True if the minor version have exact match; false otherwise.

check_maintenance(self, maintenance)

 

This method checks if the Version instance matches a given specific maintenance number.

Parameters:
  • maintenance - Integer representing the maintenance number.
Returns:
True if the maintenance versions have exact match; false otherwise.

check_exact(self, major, minor, maintenance)

 

This method checks if this Version instance matches a given specific major, minor and maintenance number.

Parameters:
  • major - Integer representing the major number.
  • minor - Integer representing the minor number.
  • maintenance - Integer representing the maintenance number.
Returns:
True if the major, minor and maintenance version have exact match; false otherwise.

__str__(self)
(Informal representation operator)

 

str(x)

Overrides: object.__str__
(inherited documentation)

Class Variable Details

VersionCompare


The VersionCompare enum describes the comparison values when the 
   * versions of SDK and Network Element are compared using the
   * version check methods in Version class.

Value:
enum('ONEP_VERSION_NCP', 'ONEP_VERSION_MATCH', 'ONEP_VERSION_GT', 'ONE\
P_VERSION_LT')