def __init__(self, config=None):
     if config is None:
         self.config = conf.read_conf()
     else:
         self.config = config
     self.endpoint = self.config.ipmi_url
     self.http_client = httplib2.Http()
     self.http_client.force_exception_to_status_code = True
from ryu.base import app_manager
from ryu.controller import dpset, ofp_event
from ryu.controller.handler import set_ev_cls, CONFIG_DISPATCHER, MAIN_DISPATCHER
from ryu.lib import dpid as dpid_lib
from ryu.lib import port_no as port_no_lib
from ryu.lib.packet import packet, ethernet
from ryu.ofproto import ofproto_v1_0, ofproto_v1_3
#from ryu.topology.switches import get_switch, get_link
from operator import attrgetter

from api.service import SwitchController
from common import conf, log, define
from client.ofpm import OfpmClient
from stats.stats import OfpStats

GONFIG = conf.read_conf()
LOG = log.getLogger(__name__)

OFP_VERSION_13 = ofproto_v1_3.OFP_VERSION
OFP_VERSION_10 = ofproto_v1_0.OFP_VERSION
CURRENT_OFP_VERSION = OFP_VERSION_13

class OfPatchOfc(app_manager.RyuApp):
	OFP_VERSIONS = [CURRENT_OFP_VERSION]
	_CONTEXTS = { 'dpset':dpset.DPSet, 'wsgi':WSGIApplication, }

	def __init__(self, *args, **kwargs):
		LOG.debug("START")
		LOG.debug(" CURRENT_OFP_VERSION = " + str(CURRENT_OFP_VERSION) + ", Note! ofproto_v1_x.OFP_VERSION")

		super(OfPatchOfc, self).__init__(*args, **kwargs)
#
#   Unless required by applicable law or agreed to in writing, software
#   distributed under the License is distributed on an "AS IS" BASIS,
#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#   See the License for the specific language governing permissions and
#   limitations under the License.

import json
import cgi
from ryu.app.wsgi import ControllerBase, WSGIApplication, route
from webob import Response

from common import conf, log, define

LOG = log.getLogger(__name__)
CONF = conf.read_conf()

# switch controll crass
class SwitchController(ControllerBase):

	def __init__(self, req, link, data, **config):
		super(SwitchController, self).__init__(req, link, data, **config)
		self.switch_ctrl_spp = data[define.OFP_OFC_INSTANCE_NAME]

	@route('switch_ctrl', CONF.service_url, methods=['POST'])
	def post_flow(self, req, **kwargs):
		LOG.debug("START ***** POST ***** : url = " + CONF.service_url)
		LOG.debug("body = " + req.body)

		reqBody = eval(req.body)
		dpid = None
from ryu.app.wsgi import WSGIApplication
from ryu.base import app_manager
from ryu.controller import dpset, ofp_event
from ryu.controller.handler import set_ev_cls, CONFIG_DISPATCHER, MAIN_DISPATCHER
from ryu.lib import dpid as dpid_lib
from ryu.lib import port_no as port_no_lib
from ryu.lib.packet import packet, ethernet
from ryu.ofproto import ofproto_v1_0, ofproto_v1_3
from operator import attrgetter

from api.service import SwitchController
from common import conf, log, define
from client.ofpm import OfpmClient
from stats.stats import OfpStats

GONFIG = conf.read_conf()
LOG = log.getLogger(__name__)

OFP_VERSION_13 = ofproto_v1_3.OFP_VERSION
OFP_VERSION_10 = ofproto_v1_0.OFP_VERSION
CURRENT_OFP_VERSION = OFP_VERSION_13

class OfPatchOfc(app_manager.RyuApp):
	OFP_VERSIONS = [CURRENT_OFP_VERSION]
	_CONTEXTS = { 'dpset':dpset.DPSet, 'wsgi':WSGIApplication, }

	def __init__(self, *args, **kwargs):
		LOG.debug("START")
		LOG.debug(" CURRENT_OFP_VERSION = " + str(CURRENT_OFP_VERSION) + ", Note! ofproto_v1_x.OFP_VERSION")
		LOG.debug(" OF-PATCH CONTROLLER VERSION = " + str(define.MAJOR_VERSION) + "." + str(define.MINOR_VERSION) + "." + str(define.BUILD_VERSION))
示例#5
0
#
#       http://www.apache.org/licenses/LICENSE-2.0
#
#   Unless required by applicable law or agreed to in writing, software
#   distributed under the License is distributed on an "AS IS" BASIS,
#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#   See the License for the specific language governing permissions and
#   limitations under the License.

import logging
import os
import traceback

from common import conf

CONF = conf.read_conf()


def _get_log_file_path():
    logfile = CONF.log_file
    logdir = CONF.log_dir

    if logfile and not logdir:
        return logfile

    if logfile and logdir:
        return os.path.join(logdir, logfile)

    return None