summaryrefslogtreecommitdiffstats
path: root/vstf/vstf/agent/env/vswitch_plugins/model.py
diff options
context:
space:
mode:
Diffstat (limited to 'vstf/vstf/agent/env/vswitch_plugins/model.py')
-rwxr-xr-xvstf/vstf/agent/env/vswitch_plugins/model.py63
1 files changed, 63 insertions, 0 deletions
diff --git a/vstf/vstf/agent/env/vswitch_plugins/model.py b/vstf/vstf/agent/env/vswitch_plugins/model.py
new file mode 100755
index 00000000..a4d8b3b5
--- /dev/null
+++ b/vstf/vstf/agent/env/vswitch_plugins/model.py
@@ -0,0 +1,63 @@
+"""
+Created on 2015-9-15
+
+@author: y00228926
+"""
+from abc import ABCMeta
+from abc import abstractmethod
+
+
+class VswitchPlugin:
+ __metaclass__ = ABCMeta
+
+ @abstractmethod
+ def clean(self):
+ """implement this clean function to clean environment before and after calling any other functions.
+
+ """
+ pass
+
+ @abstractmethod
+ def init(self):
+ """implements this init function to setup necessary Preconditions.
+
+ """
+ pass
+
+ @abstractmethod
+ def create_br(self, br_cfg):
+ """Create a bridge(virtual switch). Return True for success, return False for failure.
+
+ :param dict br_cfg: configuration for bridge creation like
+ {
+ "type": "ovs",
+ "name": "ovs1",
+ "uplinks": [
+ {
+ "bdf": "04:00.0",
+ "vlan_mode": "access",
+ "vlan_id": "1"
+ }
+ ],
+ "vtep": {},
+ }
+
+ """
+ pass
+
+ @abstractmethod
+ def set_tap_vid(self, tap_cfg):
+ """set vlan id or vxlan id for tap device(virtual nic for vm).
+
+ :param dict tap_cfg: dictionary config for tap device like
+ {
+ "tap_name": "tap_in",
+ "vlan_mode": "access",
+ "vlan_id": "1"
+ }
+
+ """
+ pass
+
+ def set_fastlink(self, br_cfg):
+ return True \ No newline at end of file