bd37be8b3a5a44c76d96ec952e225f359e403fd6
[osm/RO.git] / RO-SDN-floodlight_openflow / osm_rosdn_floodlightof / sdnconn_floodlightof.py
1 ##
2 # Copyright 2019 Telefonica Investigacion y Desarrollo, S.A.U.
3 # All Rights Reserved.
4 #
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 # http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
14 # implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
17 #
18 ##
19 """The SdnConnectorFloodLightOf connector is responsible for creating services using pro active operflow rules.
20 """
21
22 import logging
23 from osm_ro_plugin.openflow_conn import SdnConnectorOpenFlow
24 from .floodlight_of import OfConnFloodLight
25
26
27 class SdnConnectorFloodLightOf(SdnConnectorOpenFlow):
28 def __init__(self, wim, wim_account, config=None, logger=None):
29 """Creates a connectivity based on pro-active openflow rules"""
30 self.logger = logging.getLogger("ro.sdn.floodlightof")
31 super().__init__(wim, wim_account, config, logger)
32 of_params = {
33 "of_url": wim["wim_url"],
34 "of_dpid": config.get("dpid") or config.get("switch_id"),
35 "of_user": wim_account["user"],
36 "of_password": wim_account["password"],
37 }
38 self.openflow_conn = OfConnFloodLight(of_params)
39 super().__init__(wim, wim_account, config, logger, self.openflow_conn)