1 ##############################################################################
2 # Copyright (c) 2015 Huawei Technologies Co.,Ltd and others.
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
8 ##############################################################################
10 from vstf.agent.env.driver_plugins import model
11 from vstf.common.utils import check_and_rmmod, check_call
14 class OriginDriverPlugin(model.DriverPlugin):
16 implement for operating linux origin driver modules.
21 list all origin drivers in self.origin_drivers
23 self.origin_drivers = ['ixgbe', 'bnx2x', 'i40e', 'be2net', 'vhost_net']
26 """clean drivers list in self.origin_drivers.
29 for mod in self.origin_drivers:
32 check_and_rmmod('tun')
35 def load(self, drivers):
38 :param list drivers:list of drivers link ['ixgbe','vhost_net']
40 # load implicit 'tun' module dependency for vhost_net
41 if 'vhost_net' in drivers:
42 check_call("modprobe tun", shell=True)
45 check_call("modprobe %s" % drv, shell=True)
49 def get_supported_drivers(self):
50 return self.origin_drivers