1 # Copyright 2015 Intel Corporation.
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
7 # http://www.apache.org/licenses/LICENSE-2.0
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
19 from core.vnf_controller import IVnfController
21 class VnfControllerPVP(IVnfController):
22 """VNF controller for the PVP scenario.
24 Used to set-up and control a VNF provider for the PVP scenario.
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
30 _vnfs: A list of vnfs controlled by the controller.
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.
37 :param vnf_class: The VNF class to be used.
39 self._logger = logging.getLogger(__name__)
40 self._vnf_class = vnf_class()
41 self._deployment_scenario = "PVP"
42 self._vnfs = [vnf_class(deployment=self._deployment_scenario)]
43 self._logger.debug('__init__ with ' + str(self._vnfs[0]))
44 #TODO call vnf.xxx to carry out the required setup
47 """See IVnfController for description
49 self._logger.debug('get_vnfs with ' + str(self._vnfs[0]))
53 """See IVnfController for description
55 self._logger.debug('start with ' + str(self._vnfs[0]))
56 for vnf in self._vnfs:
60 """See IVnfController for description
62 self._logger.debug('stop with ' + str(self._vnfs[0]))
68 def __exit__(self, type_, value, traceback):