Permalink
Browse files

driver/xenadriver: Add driver to interact with Xena network testing e…

…quipment

Using the xenacalkyrie interface library to interact with the Xena test equipment.

Signed-off-by: Kasper Revsbech <krev@triax.com>
  • Loading branch information...
Kasper Revsbech authored and jluebbe committed Aug 9, 2018
1 parent 03a16f2 commit 010e137bb0ff5f2b7a1d10233a07ac4e2d8a40e6
View
@@ -10,4 +10,5 @@ yapf==0.20.1
-r crossbar-requirements.txt
-r onewire-requirements.txt
-r modbus-requirements.txt
-r snmp-requirements.txt
-r snmp-requirements.txt
-r xena-requirements.txt
View
@@ -468,6 +468,19 @@ NetworkUSBTMC
A :any:`NetworkUSBTMC` resource describes a :any:`USBTMC` resource available
on a remote computer.
XenaManager
~~~~~~~~~~~
A XenaManager resource describe a Xena Manager instance which is the instance the
Xena Driver must connect to in order to configure a Xena chassis.
.. code-block:: yaml
XenaManager:
hostname: "example.computer"
Used by:
- `XenaDriver`_
RemotePlace
~~~~~~~~~~~
A RemotePlace describes a set of resources attached to a labgrid remote place.
@@ -1312,6 +1325,18 @@ but more devices can be added by extending `on_activate()` in
``labgrid/driver/usbtmcdriver.py`` and writing a corresponding backend in
``labgrid/driver/usbtmc/``.
XenaDriver
~~~~~~~~~~
The XenaDriver allows to use Xena networking tests equipment. Using the xenavalkyrie library
a full API to control the tester is available.
Binds to:
xena_manager:
- `XenaManager`_
The driver is supposed to work with all Xena products from the "Valkyrie Layer 2-3 Test platform"
Currently tested on a `XenaCompact` chassis equipped with a `1 GE test module`.
Strategies
----------
@@ -24,3 +24,4 @@
from .networkusbstoragedriver import NetworkUSBStorageDriver
from .resetdriver import DigitalOutputResetDriver
from .serialdigitaloutput import SerialPortDigitalOutputDriver
from .xenadriver import XenaDriver
@@ -0,0 +1,35 @@
import logging
from importlib import import_module
import attr
from ..factory import target_factory
from .common import Driver
from ..resource.xenamanager import XenaManager
@target_factory.reg_driver
@attr.s(cmp=False)
class XenaDriver(Driver):
"""
Xena Driver
"""
bindings = {"xena_manager": XenaManager}
def __attrs_post_init__(self):
super().__attrs_post_init__()
self._xena_app = import_module('xenavalkyrie.xena_app')
self._tgn_utils = import_module('trafficgenerator.tgn_utils')
self._logger = logging.getLogger("{}".format(self))
self._xm = None
def on_activate(self):
self._xm = self._xena_app.init_xena(self._tgn_utils.ApiType.socket, self._logger, 'labgrid')
self._xm.session.add_chassis(self.xena_manager.hostname)
def on_deactivate(self):
if self._xm:
self._xm.session.disconnect()
self._xm = None
@Driver.check_active
def get_session(self):
return self._xm.session
@@ -11,3 +11,4 @@
from .udev import USBPowerPort
from .common import Resource, ResourceManager, ManagedResource
from .ykushpowerport import YKUSHPowerPort
from .xenamanager import XenaManager
@@ -0,0 +1,10 @@
import attr
from ..factory import target_factory
from .common import Resource
@target_factory.reg_resource
@attr.s(cmp=False)
class XenaManager(Resource):
""" Hostname/IP identifying the manageent address of the xena tester """
hostname = attr.ib(validator=attr.validators.instance_of(str))
View
@@ -0,0 +1 @@
xenavalkyrie==1.1.2

0 comments on commit 010e137

Please sign in to comment.