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