from os_ken import cfg import logging from os_ken import log log.early_init_log(logging.DEBUG) 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'), ])
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=[], help='Tables in the OVSDB schema to configure'), cfg.ListOpt('schema-exclude-columns', default=[], help='Table columns in the OVSDB schema to filter out. ' 'Values should be in the format: <table>.<column>.' 'Ex: Bridge.netflow,Interface.statistics')) cfg.CONF.register_opts(opts, 'ovsdb') class OVSDB(app_manager.OSKenApp): _EVENTS = [
from __future__ import print_function import cmd import sys import lxml.etree as ET from ncclient.operations.rpc import RPCError from os_ken import cfg from os_ken.lib import of_config from os_ken.lib.of_config import capable_switch import os_ken.lib.of_config.classes as ofc CONF = cfg.CONF CONF.register_cli_opts( [cfg.ListOpt('peers', default=[], help='list of peers')]) class Peer(capable_switch.OFCapableSwitch): def __init__(self, name, host, port, username, password): self._name = name super(Peer, self).__init__(host=host, port=port, username=username, password=password, unknown_host_cb=lambda host, fingeprint: True) peers = {}
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=[], help='list of IP address and port pairs (default empty). ' 'e.g., "127.0.0.1:6653,[::1]:6653"'), cfg.IntOpt('ofp-switch-connect-interval', default=DEFAULT_OFP_SW_CON_INTERVAL, help='interval in seconds to connect to switches ' '(default %d)' % DEFAULT_OFP_SW_CON_INTERVAL), ]) CONF.register_opts([ cfg.FloatOpt( 'socket-timeout', default=5.0, help='Time, in seconds, to await completion of socket operations.'), cfg.FloatOpt( 'echo-request-interval', default=15.0,
# (Cmd) import ast import cmd import signal 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