summaryrefslogtreecommitdiffstats
path: root/testsuites/vstf/vstf_scripts/vstf/agent/env/driver_plugins
diff options
context:
space:
mode:
Diffstat (limited to 'testsuites/vstf/vstf_scripts/vstf/agent/env/driver_plugins')
-rw-r--r--testsuites/vstf/vstf_scripts/vstf/agent/env/driver_plugins/__init__.py8
-rw-r--r--testsuites/vstf/vstf_scripts/vstf/agent/env/driver_plugins/manager.py46
-rw-r--r--testsuites/vstf/vstf_scripts/vstf/agent/env/driver_plugins/model.py42
-rw-r--r--testsuites/vstf/vstf_scripts/vstf/agent/env/driver_plugins/origin_driver.py50
4 files changed, 0 insertions, 146 deletions
diff --git a/testsuites/vstf/vstf_scripts/vstf/agent/env/driver_plugins/__init__.py b/testsuites/vstf/vstf_scripts/vstf/agent/env/driver_plugins/__init__.py
deleted file mode 100644
index 83b8d15d..00000000
--- a/testsuites/vstf/vstf_scripts/vstf/agent/env/driver_plugins/__init__.py
+++ /dev/null
@@ -1,8 +0,0 @@
-##############################################################################
-# Copyright (c) 2015 Huawei Technologies Co.,Ltd and others.
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
diff --git a/testsuites/vstf/vstf_scripts/vstf/agent/env/driver_plugins/manager.py b/testsuites/vstf/vstf_scripts/vstf/agent/env/driver_plugins/manager.py
deleted file mode 100644
index e20b5dd5..00000000
--- a/testsuites/vstf/vstf_scripts/vstf/agent/env/driver_plugins/manager.py
+++ /dev/null
@@ -1,46 +0,0 @@
-##############################################################################
-# Copyright (c) 2015 Huawei Technologies Co.,Ltd and others.
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
-
-import stevedore
-
-
-class DriverPluginManager(object):
-
- def __init__(self):
- self.plugins = {}
- self.mgr = stevedore.extension.ExtensionManager(
- namespace="drivers.plugins", invoke_on_load=True)
-
- def load(self, drivers):
- plugin = self.determine_driver_type(drivers)
- ext = self.mgr[plugin]
- ext.obj.load(drivers)
- return True
-
- def clean(self):
- self.mgr.map(self._clean)
- return True
-
- def _clean(self, ext, *args, **kwargs):
- ext.obj.clean()
-
- def get_all_supported_drivers(self):
- if not self.plugins:
- for ext_name in self.mgr.names():
- ext = self.mgr[ext_name]
- self.plugins[ext_name] = ext.obj.get_supported_drivers()
- return self.plugins
-
- def determine_driver_type(self, drivers):
- s = set(drivers)
- for plugin, supported in self.get_all_supported_drivers().items():
- if not (s - set(supported)):
- return plugin
- else:
- raise Exception('unspported drivers: %s' % drivers)
diff --git a/testsuites/vstf/vstf_scripts/vstf/agent/env/driver_plugins/model.py b/testsuites/vstf/vstf_scripts/vstf/agent/env/driver_plugins/model.py
deleted file mode 100644
index 807143f0..00000000
--- a/testsuites/vstf/vstf_scripts/vstf/agent/env/driver_plugins/model.py
+++ /dev/null
@@ -1,42 +0,0 @@
-##############################################################################
-# Copyright (c) 2015 Huawei Technologies Co.,Ltd and others.
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
-
-from abc import ABCMeta
-from abc import abstractmethod
-
-
-class DriverPlugin:
- __metaclass__ = ABCMeta
-
- @abstractmethod
- def __init__(self):
- """don't pass in any args for __init__.
- """
-
- @abstractmethod
- def clean(self):
- """implement this clean function to clean environment before and after calling any other functions.
-
- """
- pass
-
- @abstractmethod
- def load(self, drivers):
- """load driver modules.
-
- :param list drivers:list of modules to be inserted. for example:[ixgbe,vhost_net]
-
- """
- pass
-
- @abstractmethod
- def get_supported_drivers(self):
- """return a list of supported driver modules.
- """
- pass
diff --git a/testsuites/vstf/vstf_scripts/vstf/agent/env/driver_plugins/origin_driver.py b/testsuites/vstf/vstf_scripts/vstf/agent/env/driver_plugins/origin_driver.py
deleted file mode 100644
index 2004b8e8..00000000
--- a/testsuites/vstf/vstf_scripts/vstf/agent/env/driver_plugins/origin_driver.py
+++ /dev/null
@@ -1,50 +0,0 @@
-##############################################################################
-# Copyright (c) 2015 Huawei Technologies Co.,Ltd and others.
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
-
-from vstf.agent.env.driver_plugins import model
-from vstf.common.utils import check_and_rmmod, check_call
-
-
-class OriginDriverPlugin(model.DriverPlugin):
- """
- implement for operating linux origin driver modules.
- """
-
- def __init__(self):
- """
- list all origin drivers in self.origin_drivers
- """
- self.origin_drivers = ['ixgbe', 'bnx2x', 'i40e', 'be2net', 'vhost_net']
-
- def clean(self):
- """clean drivers list in self.origin_drivers.
-
- """
- for mod in self.origin_drivers:
- check_and_rmmod(mod)
-
- check_and_rmmod('tun')
- return True
-
- def load(self, drivers):
- """insmod drivers
-
- :param list drivers:list of drivers link ['ixgbe','vhost_net']
- """
- # load implicit 'tun' module dependency for vhost_net
- if 'vhost_net' in drivers:
- check_call("modprobe tun", shell=True)
-
- for drv in drivers:
- check_call("modprobe %s" % drv, shell=True)
-
- return True
-
- def get_supported_drivers(self):
- return self.origin_drivers