framework: Add reworked framework to repo
[vswitchperf.git] / core / vnf_controller_p2p.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 P2P scenario
15 """
16
17 import logging
18
19 from core.vnf_controller import IVnfController
20
21 class VnfControllerP2P(IVnfController):
22     """VNF controller for the P2P scenario.
23
24     Does nothing as there is no VNF in P2P
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 P2P deployment scenario.
36
37         :param vnf_class: The VNF class to be used, this is mostly ignored.
38         """
39         self._logger = logging.getLogger(__name__)
40         self._vnf_class = vnf_class
41         self._deployment_scenario = "P2P"
42         self._logger.debug('__init__ with ' + str(self._vnf_class))
43
44     def get_vnfs(self):
45         """Returns an empty list of vnfs.
46         """
47         self._logger.debug('get_vnfs with ' + str(self._vnf_class))
48         return []
49
50     def start(self):
51         """Starts nothing.
52         """
53         self._logger.debug('start with ' + str(self._vnf_class))
54
55     def stop(self):
56         """Stops nothing.
57         """
58         self._logger.debug('stop with ' + str(self._vnf_class))