src/dpdk: Enable building of vhost-user in src/dpdk.
[vswitchperf.git] / core / vswitch_controller_pvp.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
15 """VSwitch controller for Physical to VM to Physical deployment
16 """
17
18 import logging
19
20 from core.vswitch_controller import IVswitchController
21
22 class VswitchControllerPVP(IVswitchController):
23     """VSwitch controller for PVP deployment scenario.
24
25     Attributes:
26         _vswitch_class: The vSwitch class to be used.
27         _vswitch: The vSwitch object controlled by this controller
28         _deployment_scenario: A string describing the scenario to set-up in the
29             constructor.
30     """
31     def __init__(self, vswitch_class):
32         """Initializes up the prerequisites for the PVP deployment scenario.
33
34         :vswitch_class: the vSwitch class to be used.
35         """
36         self._logger = logging.getLogger(__name__)
37         self._vswitch_class = vswitch_class
38         self._vswitch = vswitch_class()
39         self._deployment_scenario = "PVP"
40         self._logger.debug('Creation using ' + str(self._vswitch_class))
41
42     def setup(self):
43         """
44         Sets up the switch for the particular deployment scenario passed in to
45         the constructor.
46         """
47         # TODO call IVSwitch methods to configure VSwitch for PVP scenario.
48         self._logger.debug('Setup using ' + str(self._vswitch_class))
49
50     def stop(self):
51         """
52         Tears down the switch created in setup().
53         """
54         # TODO call IVSwitch methods to stop VSwitch for PVP scenario.
55         self._logger.debug('Stop using ' + str(self._vswitch_class))
56
57     def get_vswitch(self):
58         """See IVswitchController for description
59         """
60         return self._vswitch
61
62     def get_ports_info(self):
63         """See IVswitchController for description
64         """
65         self._logger.debug('get_ports_info  using ' + str(self._vswitch_class))
66         return []
67
68
69