Merge "testcase: execution time"
[vswitchperf.git] / core / vswitch_controller.py
1 # Copyright 2015 Intel Corporation.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #   http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14 """Interface for deployment specific vSwitch controllers
15 """
16
17 class IVswitchController(object):
18     """Abstract class which defines a vSwitch controller object
19
20     This interface is used to setup and control a vSwitch provider for a
21     particular deployment scenario.
22     """
23     def __enter__(self):
24         """Sets up the switch for the particular deployment scenario
25         """
26         raise NotImplementedError(
27             "The VswitchController does not implement the \"setup\" function.")
28
29     def __exit__(self, type_, value, traceback):
30         """Tears down the switch created in setup()
31         """
32         raise NotImplementedError(
33             "The VswitchController does not implement the \"stop\" function.")
34
35     def get_vswitch(self):
36         """Get the controlled vSwitch
37
38         :return: The controlled IVswitch
39         """
40         raise NotImplementedError(
41             "The VswitchController does not implement the \"get_vswitch\" "
42             "function.")
43
44     def get_ports_info(self):
45         """Returns a dictionary describing all ports on the vSwitch.
46
47         See IVswitch for dictionary structure details
48         """
49         raise NotImplementedError(
50             "The VswitchController does not implement the \"get_ports_info\" "
51             "function.")
52
53     def dump_vswitch_flows(self):
54         """ Dumps flows from vswitch
55         """
56         raise NotImplementedError(
57             "The VswitchController does not implement the "
58             "\"dump_vswitch_flows\" function.")