Exemple #1
0
from os_ken import flags
from os_ken import __version__ as version
from os_ken.base.app_manager import AppManager
from os_ken.controller import controller
from os_ken.topology import switches

CONF = cfg.CONF
CONF.register_cli_opts([
    cfg.ListOpt('app-lists', default=[],
                help='application module name to run'),
    cfg.MultiStrOpt('app',
                    positional=True,
                    default=[],
                    help='application module name to run'),
    cfg.StrOpt('pid-file', default=None, help='pid file name'),
    cfg.BoolOpt('enable-debugger',
                default=False,
                help='don\'t overwrite Python standard threading library'
                '(use only for debugging)'),
    cfg.StrOpt('user-flags',
               default=None,
               help='Additional flags file for user applications'),
])


def _parse_user_flags():
    """
    Parses user-flags file and loads it to register user defined options.
    """
    try:
Exemple #2
0
import os
import sys

try:
    import ConfigParser
except ImportError:
    import configparser as ConfigParser

CONF = cfg.CONF

CONF.register_cli_opts([
    cfg.IntOpt('default-log-level', default=None, help='default log level'),
    cfg.BoolOpt('verbose', default=False, help='show debug output'),
    cfg.BoolOpt('use-stderr', default=True, help='log to standard error'),
    cfg.BoolOpt('use-syslog', default=False, help='output to syslog'),
    cfg.StrOpt('log-dir', default=None, help='log file directory'),
    cfg.StrOpt('log-file', default=None, help='log file name'),
    cfg.StrOpt('log-file-mode',
               default='0644',
               help='default log file permission'),
    cfg.StrOpt('log-config-file',
               default=None,
               help='Path to a logging config file to use')
])

_EARLY_LOG_HANDLER = None


def early_init_log(level=None):
    global _EARLY_LOG_HANDLER
    _EARLY_LOG_HANDLER = logging.StreamHandler(sys.stderr)
Exemple #3
0
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import ssl
import socket

from os_ken import cfg
from os_ken.base import app_manager
from os_ken.lib import hub
from os_ken.lib import ip
from os_ken.services.protocols.ovsdb import client
from os_ken.services.protocols.ovsdb import event
from os_ken.controller import handler

opts = (cfg.StrOpt('address', default='0.0.0.0', help='OVSDB address'),
        cfg.IntOpt('port', default=6640, help='OVSDB port'),
        cfg.IntOpt('probe-interval', help='OVSDB reconnect probe interval'),
        cfg.IntOpt('min-backoff',
                   help=('OVSDB reconnect minimum milliseconds between '
                         'connection attemps')),
        cfg.IntOpt('max-backoff',
                   help=('OVSDB reconnect maximum milliseconds between '
                         'connection attemps')),
        cfg.StrOpt('mngr-privkey', default=None, help='manager private key'),
        cfg.StrOpt('mngr-cert', default=None, help='manager certificate'),
        cfg.ListOpt('whitelist',
                    default=[],
                    help='Whitelist of address to allow to connect'),
        cfg.ListOpt('schema-tables',
                    default=[],
Exemple #4
0
from os_ken.controller import ofp_event
from os_ken.controller.handler import HANDSHAKE_DISPATCHER, DEAD_DISPATCHER

from os_ken.lib.dpid import dpid_to_str
from os_ken.lib import ip

LOG = logging.getLogger('os_ken.controller.controller')

DEFAULT_OFP_HOST = '0.0.0.0'
DEFAULT_OFP_SW_CON_INTERVAL = 1

CONF = cfg.CONF
CONF.register_cli_opts([
    cfg.StrOpt('ofp-listen-host',
               default=DEFAULT_OFP_HOST,
               help='openflow listen host (default %s)' % DEFAULT_OFP_HOST),
    cfg.IntOpt('ofp-tcp-listen-port',
               default=None,
               help='openflow tcp listen port '
               '(default: %d)' % ofproto_common.OFP_TCP_PORT),
    cfg.IntOpt('ofp-ssl-listen-port',
               default=None,
               help='openflow ssl listen port '
               '(default: %d)' % ofproto_common.OFP_SSL_PORT),
    cfg.StrOpt('ctl-privkey', default=None, help='controller private key'),
    cfg.StrOpt('ctl-cert', default=None, help='controller certificate'),
    cfg.StrOpt('ca-certs', default=None, help='CA certificates'),
    cfg.ListOpt('ofp-switch-address-list',
                item_type=str,
                default=[],
Exemple #5
0
from tinyrpc.client import RPCClient
import webob.dec
import webob.exc
from webob.request import Request as webob_Request
from webob.response import Response as webob_Response

from os_ken import cfg
from os_ken.lib import hub

DEFAULT_WSGI_HOST = '0.0.0.0'
DEFAULT_WSGI_PORT = 8080

CONF = cfg.CONF
CONF.register_cli_opts([
    cfg.StrOpt('wsapi-host',
               default=DEFAULT_WSGI_HOST,
               help='webapp listen host (default %s)' % DEFAULT_WSGI_HOST),
    cfg.IntOpt('wsapi-port',
               default=DEFAULT_WSGI_PORT,
               help='webapp listen port (default %s)' % DEFAULT_WSGI_PORT),
])

HEX_PATTERN = r'0x[0-9a-z]+'
DIGIT_PATTERN = r'[1-9][0-9]*'


def route(name, path, methods=None, requirements=None):
    def _route(controller_method):
        controller_method.routing_info = {
            'name': name,
            'path': path,
Exemple #6
0
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""
global flags
"""

from distutils.version import LooseVersion

from os_ken import cfg

CONF = cfg.CONF

CONF.register_cli_opts([
    # tests/switch/tester
    cfg.StrOpt('target', default='0000000000000001', help='target sw dp-id'),
    cfg.StrOpt('tester', default='0000000000000002', help='tester sw dp-id'),
    cfg.IntOpt('target_recv_port', default=1,
               help='target sw receiving port '
               '(default: 1)'),
    cfg.IntOpt('target_send_port_1', default=2,
               help='target sw sending port 1 '
               '(default: 2)'),
    cfg.IntOpt('target_send_port_2', default=3,
               help='target sw sending port 2  '
               '(default: 3)'),
    cfg.IntOpt('tester_send_port', default=1,
               help='tester sw sending port '
               '(default: 1)'),
    cfg.IntOpt('tester_recv_port_1', default=2,
               help='tester sw receiving port 1 '
Exemple #7
0
import socket
import sys
import termios

from os_ken import cfg
from os_ken.lib import rpc

CONF = cfg.CONF
CONF.register_cli_opts([
    cfg.ListOpt('peers',
                default=[],
                help='List of peers, separated by commas. '
                '(e.g., "hoge=localhost:9998,fuga=localhost:9999")'),
    cfg.StrOpt('command',
               short='c',
               default=None,
               help='Command to be executed as single command. '
               'The default is None and opens interactive console.'),
])


class Peer(object):
    def __init__(self, name, addr):
        self._name = name
        self._addr = addr
        self.socket = None
        self.client = None
        try:
            self.connect()
        except ConnectionError as e:
            print('Exception when connecting to peer "%s": %s' % (name, e))