a4d8b3b5b83c9658b75d8dba7689f63f0eb8197a
[bottlenecks.git] / vstf / vstf / agent / env / vswitch_plugins / model.py
1 """
2 Created on 2015-9-15
3
4 @author: y00228926
5 """
6 from abc import ABCMeta
7 from abc import abstractmethod
8
9
10 class VswitchPlugin:
11     __metaclass__ = ABCMeta
12
13     @abstractmethod
14     def clean(self):
15         """implement this clean function to clean environment before and after calling any other functions.
16
17         """
18         pass
19
20     @abstractmethod
21     def init(self):
22         """implements this init function to setup necessary Preconditions.
23
24         """
25         pass
26
27     @abstractmethod
28     def create_br(self, br_cfg):
29         """Create a bridge(virtual switch). Return True for success, return False for failure.
30
31         :param dict    br_cfg: configuration for bridge creation like
32                 {
33                     "type": "ovs",
34                     "name": "ovs1",
35                     "uplinks": [
36                         {
37                             "bdf": "04:00.0",
38                             "vlan_mode": "access",
39                             "vlan_id": "1"
40                         }
41                     ],
42                     "vtep": {},
43                 }
44
45         """
46         pass
47
48     @abstractmethod
49     def set_tap_vid(self, tap_cfg):
50         """set vlan id or vxlan id for tap device(virtual nic for vm).
51
52         :param dict    tap_cfg: dictionary config for tap device like
53                         {
54                             "tap_name": "tap_in",
55                             "vlan_mode": "access",
56                             "vlan_id": "1"
57                         }
58
59         """
60         pass
61
62     def set_fastlink(self, br_cfg):
63         return True