1 # Copyright 2015-2016 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.
15 """VSwitch controller for basic initialization of vswitch
20 from core.vswitch_controller import IVswitchController
22 class VswitchControllerClean(IVswitchController):
23 """VSwitch controller for Clean deployment scenario.
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
31 def __init__(self, vswitch_class, traffic):
32 """Initializes up the prerequisites for the Clean deployment scenario.
34 :vswitch_class: the vSwitch class to be used.
36 self._logger = logging.getLogger(__name__)
37 self._vswitch_class = vswitch_class
38 self._vswitch = vswitch_class()
39 self._deployment_scenario = "Clean"
40 self._logger.debug('Creation using %s', str(self._vswitch_class))
41 self._traffic = traffic.copy()
44 """Sets up the switch for Clean.
46 self._logger.debug('Setup using %s', str(self._vswitch_class))
55 """Tears down the switch created in setup().
57 self._logger.debug('Stop using %s', str(self._vswitch_class))
63 def __exit__(self, type_, value, traceback):
66 def get_vswitch(self):
67 """See IVswitchController for description
71 def get_ports_info(self):
72 """See IVswitchController for description
76 def dump_vswitch_flows(self):
77 """See IVswitchController for description