src/dpdk: Enable building of vhost-user in src/dpdk.
[vswitchperf.git] / core / vnf_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 """VNF Controller for the PVP scenario
15 """
16
17 import logging
18
19 from core.vnf_controller import IVnfController
20
21 class VnfControllerPVP(IVnfController):
22     """VNF controller for the PVP scenario.
23
24     Used to set-up and control a VNF provider for the PVP scenario.
25
26     Attributes:
27         _vnf_class: A class object representing the VNF to be used.
28         _deployment_scenario: A string describing the scenario to set-up in the
29             constructor.
30         _vnfs: A list of vnfs controlled by the controller.
31     """
32
33     #TODO: Decide on contextmanager or __enter/exit__ strategy <MH 2015-05-01>
34     def __init__(self, vnf_class):
35         """Sets up the VNF infrastructure for the PVP deployment scenario.
36
37         :param vnf_class: The VNF class to be used.
38         """
39         self._logger = logging.getLogger(__name__)
40         self._vnf_class = vnf_class
41         self._deployment_scenario = "PVP"
42         self._vnfs = []
43         self._logger.debug('__init__ with ' + str(self._vnf_class))
44         #TODO call vnf.xxx to carry out the required setup
45
46     def get_vnfs(self):
47         """See IVnfController for description
48         """
49         self._logger.debug('get_vnfs with ' + str(self._vnf_class))
50         return self._vnfs
51
52     def start(self):
53         """See IVnfController for description
54         """
55         self._logger.debug('start with ' + str(self._vnf_class))
56
57     def stop(self):
58         """See IVnfController for description
59         """
60         self._logger.debug('stop with ' + str(self._vnf_class))