Beispiel #1
0
    def __init__(self, *args, **kwargs):
        #default implentation provided in ryu to initialize the queues at switches
        super(QoSSwitch, self).__init__(*args, **kwargs)
        self.datapaths = {}
        CONF = cfg.CONF
        CONF.register_opts([
            cfg.IntOpt('congestion avoidence', default=0, help = ('Congestion avoidence')),
            cfg.IntOpt('link bandwidth', default=5000, help = ('bandwidth'))])
        self.logger.info(CONF)
        self.mac_to_port = {}
        self.PORT_SPEED = 100 * 1000000    
        self.TCP_RATE = CONF.link_bandwidth * 1000   
        self.congestion_control = CONF.congestion_control
        self.logger.info("INITIAL VALUES OF RATE %s  link rate %s, Congestion avoidence %s",  self.PORT_SPEED , CONF.link_bandwidth, self.congestion_control)

        self.TCP_QUEUE_INDEX = 0
        self.queue_list = [0]
        self.queue_list[self.TCP_QUEUE_INDEX] = {"maximum  rate allowed in the queue": str(self.TCP_RATE), "minimum rate set": "0"}
        #self.queue_list[self.UDP_QUEUE_INDEX] = {"max-rate": str(self.UDP_RATE), "min-rate": "0"}
        self.monitor_thread = hub.spawn(self._monitor)
        self.topology_api_app = self
        self.topodiscovery_thread = hub.spawn(self.topo_detection)
        # corresponding to each switch these given variables are initialzed
        self.hosts = []
        self.links = []
        self.switches = []
Beispiel #2
0
    def __init__(self, *args, **kwargs):
        #do not delete or comment this print
        print 'State Time Src_IP'

        global number_of_queues
        global priority_buffer
        global total_buffers_length
        global list_of_priority_users
        global max_threshold

        super(SimpleSwitch14, self).__init__(*args, **kwargs)
        self.mac_to_port = {}

        CONF = cfg.CONF
        CONF.register_opts([
            cfg.IntOpt('NoQueues', default=3),
            cfg.IntOpt('TotalBuffLength', default=10),
            cfg.IntOpt('Threshold', default=5)
        ])

        number_of_queues = CONF.NoQueues
        total_buffers_length = CONF.TotalBuffLength
        max_threshold = CONF.Threshold

        sem_priority_buffer.acquire()
        for i in range(1, number_of_queues + 1):
            priority_buffer[i] = []
        sem_priority_buffer.release()

        try:
            thread.start_new_thread(self.serving_requests)
            thread.start_new_thread(self.time_slot)
        except:
            print "Error: unable to start thread"
Beispiel #3
0
    def __init__(self, *args, **kwargs):
        super(QoSSwitch, self).__init__(*args, **kwargs)
        self.datapaths = {}
        CONF = cfg.CONF
        CONF.register_opts([
            cfg.IntOpt('congestion_control', default=0, help = ('Congestion Control')),
            cfg.IntOpt('link_bandwidth', default=5000, help = ('tcp bandwidth in Kbps')),
            ])
        self.logger.info(CONF)
        self.mac_to_port = {}
        self.PORT_SPEED = 100 * 1000000    # 100 Mbps
        self.TCP_RATE = CONF.link_bandwidth * 1000    #convert in to bits 
        self.congestion_control = CONF.congestion_control
        self.logger.info("Application starts with PORT_Bandwidth %s  link_bandwidth %s, Congestion-Control %s",  self.PORT_SPEED , CONF.link_bandwidth, self.congestion_control)

        self.TCP_QUEUE_INDEX = 0
        #self.UDP_QUEUE_INDEX = 1

        #self.queues = [0,0]
        self.queues = [0]
        self.queues[self.TCP_QUEUE_INDEX] = {"max-rate": str(self.TCP_RATE), "min-rate": "0"}
        if CONGESTION_CONTROL:
            self.monitor_thread = hub.spawn(self._monitor)

        self.topology_api_app = self
        self.topodiscovery_thread = hub.spawn(self._tdiscovery)    
        self.hosts = []
        self.links = []
        self.switches = []
Beispiel #4
0
    def __init__(self, *args, **kwargs):
        super(SurgeMonitor, self).__init__(*args, **kwargs)
        self.switches = {}

        CONF = cfg.CONF
        CONF.register_opts([
            cfg.FloatOpt(
                'POLLING_INTERVAL',
                default=1.0,
                help='The interval at which switch statistics will be fetched'
            ),
            cfg.IntOpt(
                'TRAFFIC_THRESHOLD',
                default=196,
                help=
                'If a switch recieves traffic higher than this, it is classified as a surge'
            ),
            cfg.StrOpt(
                'LOG_PATH',
                default='/home/mininet/surge_monitor/logs/traffic_history/',
                help='Path where log files will be stored')
        ])
        self.conf = CONF

        SwitchStats.polling_interval = CONF.POLLING_INTERVAL
        SwitchStats.surge_threshold = CONF.TRAFFIC_THRESHOLD

        self.monitor_thread = hub.spawn(
            lambda: self._monitor(CONF.POLLING_INTERVAL))
Beispiel #5
0
    def __init__(self, *args, **kwargs):
        super(MEController, self).__init__(*args, **kwargs)
        self.init_db()
        self.cpt = 0
        self.datapaths = {}
        self.bdy = []

        CONF = cfg.CONF
        CONF.register_opts([
            cfg.IntOpt('IDLE_TIMEOUT'),
            cfg.IntOpt('HARD_TIMEOUT'),
            cfg.StrOpt('MAC_GW'),
            cfg.StrOpt('MAC_MEC'),
            cfg.IntOpt('PORT_GW'),
            cfg.IntOpt('PORT_ENB'),
            cfg.IntOpt('PORT_MEC'),
            cfg.IntOpt('table_0'),
            cfg.IntOpt('table_1')
        ])

        self.IDLE_TIMEOUT = CONF.IDLE_TIMEOUT
        self.HARD_TIMEOUT = CONF.HARD_TIMEOUT
        self.MAC_GW = CONF.MAC_GW
        self.MAC_MEC = CONF.MAC_MEC
        self.PORT_GW = CONF.PORT_GW
        self.PORT_ENB = CONF.PORT_ENB
        self.PORT_MEC = CONF.PORT_MEC
        self.table_0 = CONF.table_0
        self.table_1 = CONF.table_1
Beispiel #6
0
    def __init__(self, *args, **kwargs):
        super(Monitor2, self).__init__(*args, **kwargs)
        self.mac_to_port = {}
        self.package_count = 0
        self.backend_reached_count = 0

        CONF = cfg.CONF
        CONF.register_opts([
            cfg.IntOpt('front_end_testers', default=4, help=('Number of Front End Testers')),
            cfg.IntOpt('back_end_servers', default=2, help=('Number of Back End Testers')),
            cfg.StrOpt('virtual_ip', default='10.0.0.10', help=('Virtual IP address'))
        ])

        self.front_end_testers = CONF.front_end_testers
        self.back_end_servers = CONF.back_end_servers
        self.virtual_ip = CONF.virtual_ip
        self.next_out = self.front_end_testers
        self.known_routes = {}
    def __init__(self, *args, **kwargs):
        super(SimpleSwitch13, self).__init__(*args, **kwargs)
        self.mac_to_port = {}
        self.datapaths = {}

        self.CONF = cfg.CONF
        self.CONF.register_opts(
            [cfg.IntOpt('INTERVAL', default=10, help=('Monitoring Interval'))])
        self.logger.info("Interval value %d ", self.CONF.INTERVAL)
        self.monitor_thread = hub.spawn(self.monitor)
Beispiel #8
0
    def __init__(self, *args, **kwargs):
        super(L2Switch, self).__init__(*args, **kwargs)

        cfg.CONF.register_opts(
            [cfg.IntOpt('udp_port', default=12345, help=('udp port'))])
        self.ips_dict = {
            '10.0.0.1': ('10.0.0.2', '00:00:00:00:00:02'),
            '10.0.0.2': ('10.0.0.3', '00:00:00:00:00:03'),
            '10.0.0.3': ('10.0.0.1', '00:00:00:00:00:01')
        }
Beispiel #9
0
    def __init__(self, *args, **kwargs):
        super(SimpleSwitch13, self).__init__(*args, **kwargs)

        CONF = cfg.CONF
        CONF.register_opts([
            cfg.IntOpt('mirror_port',
                       default=0,
                       help=('mirror port on the vfc')),
            cfg.IntOpt('mirror_dpid',
                       default=0,
                       help=('mirror dpid of the vfc'))
        ])

        self.logger.info('mirror_port = {}'.format(CONF.mirror_port))
        self.logger.info('mirror_dpid = {}'.format(CONF.mirror_dpid))

        self.mirror_port = CONF.mirror_port
        self.mirror_dpid = CONF.mirror_dpid
        self.mac_to_port = {}
Beispiel #10
0
    def __init__(self, *args, **kwargs):
        super(PBCE, self).__init__(*args, **kwargs)

        self.CONF = cfg.CONF
        self.CONF.register_opts([
            cfg.IntOpt('lower', default=20),
            cfg.IntOpt('upper', default=30),
            cfg.FloatOpt('dc', default=0.5),
            cfg.FloatOpt('weight', default=0.5),
            cfg.FloatOpt('debounce', default=5.0),
            cfg.FloatOpt('timeout', default=10.0)])

        self.logger.info("parameters:\n"
                         " lower: %s\n"
                         " upper: %s\n"
                         " dc: %s\n"
                         " weight: %s\n"
                         " debounce: %s\n"
                         " timeout: %s",
                         self.CONF.lower,
                         self.CONF.upper,
                         self.CONF.dc,
                         self.CONF.weight,
                         self.CONF.debounce,
                         self.CONF.timeout)

        self.dpset = kwargs['dpset']
        self.topo = nx.DiGraph()
        self.host = {}

        self.evports = {}
        self.rewrite = None

        self.arp = {}
        self.debounce = {}

        self.monitor_thread = hub.spawn(self._monitor)

        self.prev_util = {}
        self.util = {}
        self.count_arrv = {}
        self.arrv = {}
Beispiel #11
0
    def __init__(self, *args, **kwargs):
        super(monitor, self).__init__(*args, **kwargs)
        CONF = cfg.CONF
        print(CONF)
        CONF.register_opts([
            cfg.IntOpt('front_end_testers', default=0, help = ('Number of Front End Machines')),
            cfg.IntOpt('back_end_servers', default=0, help = ('Number of Back End Machines')),
            cfg.StrOpt('virtual_ip', default='default', help = ('Virtual IP'))])

        # Get the values from the config file
        self.num_front_end = CONF.front_end_testers
        self.num_back_end = CONF.back_end_servers
        self.virtual_ip = CONF.virtual_ip
        
        # If num_front_end == 0, assume there was no config file,
        # and set values to the dafault topology
        if (self.num_front_end == 0):
            self.num_front_end = 4
            self.num_back_end = 2
            self.virtual_ip = '10.0.0.10'
        
        # Initiate lists to hold the back end IP addresses, MAC addresses, and ports
        self.back_end_physical_addresses = []
        self.back_end_mac_addresses = []
        self.back_end_ports = []
        
        # Fill the lists with the appropriate information for the back ends
        for i in range(self.num_back_end):
            server_number = i + self.num_front_end + 1
            self.back_end_physical_addresses.append('10.0.0.' + str(server_number))
            if server_number < 16:
                self.back_end_mac_addresses.append('00:00:00:00:00:0' + hex(server_number)[2:])
            else:
                self.back_end_mac_addresses.append('00:00:00:00:00:' + hex(server_number)[2:])
            self.back_end_ports.append(server_number)
                
        # Initiate a list to keep track of Host Mac Addresses
        # that have already been assigned to back end servers
        self.front_end_macs_served = []

        # Keep track of which back end server to assign the host to
        self.next_server_address_index = 0
    def __init__(self, *args, **kwargs):
        super(ScramblingP2P, self).__init__(*args, **kwargs)

        self.peers_list = []
        self.ip_to_mac = {}
        self.mac_to_port = {}
        self.rounds_shuffle_counter = 0

        cfg.CONF.register_opts([
            cfg.IntOpt('team_size', default=8, help=('Size of the team')),
            cfg.IntOpt('port', default=12345, help=('UDP port for all')),
            cfg.IntOpt('rounds_to_shuffle',
                       default=1,
                       help=('Rounds to shuffle')),
            cfg.IntOpt('extra_peers', default=0, help=('Peers out of the SDN'))
        ])
        self.rounds_to_shuffle = cfg.CONF.rounds_to_shuffle
        self.splitter = "172.31.31." + str(cfg.CONF.team_size + 1)

        self.members = {}
        self.members[1] = [self.splitter]
        self.members[2] = []
        hosts = cfg.CONF.team_size + 1
        for h in range(0, hosts // 2):
            self.peers_list.append(("10.0.0." + str(h + 1), cfg.CONF.port))
            self.members[2].append(("10.0.0." + str(h + 1), cfg.CONF.port))
        self.members[3] = []
        for h in range(hosts // 2, hosts - 1):
            self.peers_list.append(("11.0.0." + str(h + 1), cfg.CONF.port))
            self.members[3].append(("11.0.0." + str(h + 1), cfg.CONF.port))

        for h in range(hosts, hosts + cfg.CONF.extra_peers):
            # self.peers_list.append(("172.31.31."+str(h+1), cfg.CONF.port))
            self.members[1].append(("172.31.31." + str(h + 1), cfg.CONF.port))

        self.packet_log = []

        self.logger.info("List of the team:\n{}".format(self.peers_list))
        self.scrambling_list = self.scramble(self.peers_list)
        self.logger.info("Scrambling List:\n{}".format(self.scrambling_list))
        self.logger.info("List per device:\n{}".format(self.members))
Beispiel #13
0
    def __init__(self, *args, **kwargs):
        super(RpcVRRPManager, self).__init__(*args, **kwargs)
        self.CONF.register_opts([
            cfg.IntOpt('vrrp-rpc-port', default=VRRP_RPC_PORT,
                       help='port for vrrp rpc interface')])

        self._args = args
        self._kwargs = kwargs
        self._peers = []
        self._rpc_events = hub.Queue(128)
        self.server_thread = hub.spawn(self._peer_accept_thread)
        self.event_thread = hub.spawn(self._rpc_request_loop_thread)
Beispiel #14
0
    def __init__(self, *args, **kwargs):
        '''
        Init method that calls the super init method of U1071673.
        :param args: Init arguments
        :param kwargs: Init KW arguments
        '''
        super(U1071673, self).__init__(*args, **kwargs)
        self.ip_to_port = {}
        self.client_to_server = {}
        self.mac_port_from_ip = {}

        # Number of ARP and ICMP packet protocols received (received packets counter)
        self.pkts_received = 0

        # Inspired by https://stackoverflow.com/questions/17424905/passing-own-arguments-to-ryu-proxy-app
        CONF = cfg.CONF
        CONF.register_opts([
            cfg.IntOpt('front_end_testers',
                       default=4,
                       help=('Number of Front End Testers')),
            cfg.IntOpt('back_end_servers',
                       default=2,
                       help=('Number of Back End Testers')),
            cfg.StrOpt('virtual_ip',
                       default='10.0.0.10',
                       help=('Virtual IP address'))
        ])

        # Using config file variables.
        self.front_end_testers = CONF.front_end_testers
        self.back_end_servers = CONF.back_end_servers
        self.virtual_ip = CONF.virtual_ip
        self.next_out = self.front_end_testers + 1

        self.logger.info(
            "Configured for %s testers and %s servers located at %s virtual ip address.",
            self.front_end_testers, self.back_end_servers, self.virtual_ip)
        self.logger.info("First server located at port %s", self.next_out)
Beispiel #15
0
    def __init__(self, *args, **kwargs):
        super(MupiMcastProxy, self).__init__(*args, **kwargs)

        self.logger.info('--------------------------------------')
        self.logger.info('-- MupiMcastProxy.__init__ called')
        # Variable initialization
        self.mac_to_port = {}
        self._to_hosts = {}
        self.murt = McastUpstreamRoutingTable.MURT(self.logger)

        # Read config params from DEFAULT section
        cfg.CONF.register_opts([
            #cfg.StrOpt('mac_to_port', default='Not configured', help = ('A string')),
            #cfg.StrOpt('to_hosts', default='Not configured', help = ('A string')),
            cfg.IntOpt('test_param1', default='0', help=('A integer'))
        ])
        #self.mac_to_port = json.loads(cfg.CONF.mac_to_port)
        #self._to_hosts = json.loads(cfg.CONF.to_hosts)
        test_param1 = cfg.CONF.test_param1
        #print('mac_to_port={}'.format(self.mac_to_port))
        #print('to_hosts={}'.format(self._to_hosts))
        self.logger.debug(f'test_param1={test_param1}')

        # Create and configure murt (Multicast Upstream Routing Table)
        # by reading murt_entry lines from config file
        murt_group = cfg.oslo_config.cfg.OptGroup(name='murt')
        murt_opts = [
            cfg.MultiStrOpt('murt_entry',
                            default='',
                            help='Multicast upstream routing table')
        ]
        cfg.CONF.register_group(murt_group)
        cfg.CONF.register_opts(murt_opts, group=murt_group)
        murt_cfg = cfg.CONF.murt.murt_entry

        for l in murt_cfg:
            #print(f'{l}')
            f = l.split(',')
            #print( '{:17} {:17} {:17} {:12} {:8}'.format(f[0].strip(), f[1].strip(), f[2].strip(), f[3].strip(), f[4].strip()) )
            e = [
                f[0].strip(), f[1].strip(), f[2].strip(),
                int(f[3].strip()),
                int(f[4].strip())
            ]
            #print (e)
            id = self.murt.add_entry(e)
            if id:
                self.logger.debug('Added entry {}'.format(id))
        self.logger.info('--------------------------------------')
        self.murt.print_mcast_table(self.murt.mcast_upstream_routing, False)
Beispiel #16
0
    def __init__(self, *args, **kwargs):
        super(ScramblingP2P, self).__init__(*args, **kwargs)

        self.peers_list = []
        self.ip_to_mac = {}
        self.mac_to_port = {}
        self.rounds_shuffle_counter = 0

        cfg.CONF.register_opts([
            cfg.IntOpt('team_size', default=8,
                       help=('Size of the team')),
            cfg.IntOpt('port', default=12345,
                       help=('UDP port for all')),
            cfg.IntOpt('rounds_to_shuffle', default=1,
                       help=('Rounds to shuffle'))
        ])
        self.rounds_to_shuffle = cfg.CONF.rounds_to_shuffle
        self.splitter = "10.0.0."+str(cfg.CONF.team_size+1)
        for h in range(0, cfg.CONF.team_size):
            self.peers_list.append(("10.0.0."+str(h+1), cfg.CONF.port))
        self.logger.info("List of the team:\n{}".format(self.peers_list))
        self.scrambling_list = self.scramble(self.peers_list)
        self.logger.info("Scrambling List:\n{}".format(self.scrambling_list))
    def __init__(self, *args, **kwargs):
        super(TrafficMonitor, self).__init__(*args, **kwargs)
        self.datapaths = {}
        self.switch_traffic_stats = {}
    
        CONF = cfg.CONF
        CONF.register_opts([
            cfg.FloatOpt('MAX_POLLING_INTERVAL', default=5.0, help='The interval at which switch statistics will be fetched'),
            cfg.IntOpt('TRAFFIC_THRESHOLD', default=100, help='If a switch recieves traffic higher than this, it is classified as a surge'),
        ])

        self.traffic_threshold = CONF.TRAFFIC_THRESHOLD
        self.polling_interval = CONF.MAX_POLLING_INTERVAL

        self.monitor_thread = hub.spawn(self._monitor)
Beispiel #18
0
def get_config():
    """
    Load configuration.
    """
    import sys
    from ryu import cfg

    conf = cfg.CONF
    conf.register_opts([
        cfg.StrOpt("cfg_path", default="/etc/fabricflow/fibc.d"),
        cfg.StrOpt("api_addr", default="127.0.0.1"),
        cfg.IntOpt("api_port", default=50051),
    ])
    conf(sys.argv[1:])
    return conf
Beispiel #19
0
    def __init__(self, *args, **kwargs):

        super(Intent, self).__init__(*args, **kwargs)

        conf = cfg.CONF
        conf.register_opts([
            cfg.StrOpt('empower_ip',
                       default='127.0.0.1',
                       help=('The Empower Runtime controller ip')),
            cfg.IntOpt('empower_port',
                       default=4444,
                       help=('The Empower Runtime controller port'))
        ])

        self.endpoints = {}
        self.rules = {}
        self.lvnf_info = OrderedDict()
        self.LSwitches = {}
        self.mutex = Lock()
        self._vlan_id = 1000

        self.agent = start_agent(conf.empower_ip, conf.empower_port, 2, self)
Beispiel #20
0
    def set_para(self):
        CONF = cfg.CONF
        CONF.register_opts([
            cfg.StrOpt('pathPre', default="./", help=("Path prefix")),
            cfg.StrOpt('topoName', default="Cer", help=("Topology name")),
            cfg.StrOpt('scheme', default="SP", help=("Scheme name")),
            cfg.StrOpt('monitorPeriod', default="2.5",
                       help=("Monitor period")),
            cfg.StrOpt('maxUpdateCount',
                       default="20",
                       help=("Maximum update count")),
            cfg.StrOpt('logging_stamp',
                       default="test",
                       help=("Logging directory name")),
            cfg.IntOpt('failureFlag', default=0, help=("Failure flag"))
        ])

        self.path_pre = CONF.pathPre
        self.topo_name = CONF.topoName
        self.scheme = CONF.scheme
        self.failure_flag = CONF.failureFlag
        print("Topology: ", self.topo_name)
        print("Scheme: ", self.scheme)

        if self.scheme == "SMORE" or self.scheme == "LB" or self.scheme == "DATE":
            self.path_type = "racke"
        elif self.scheme == "SP":
            self.path_type = "sp"
        elif self.scheme == "OR":
            self.path_type = "or"
            self.routing_file = "%sinputs/routing/%s_or_routing.txt" % (
                self.path_pre, self.topo_name)
        else:
            self.path_type = "racke"
        self.rule_priority = 4
        self.monitor_period = float(CONF.monitorPeriod)  # 2.5
        self.scale_ratio = 20.0  # capacity scale para
        self.max_update_count = int(CONF.maxUpdateCount)  # 288*2*2 + 20 # 20
        self.logging_stamp = CONF.logging_stamp  # "Test"
Beispiel #21
0
def load_switch_measurement_config(configure_file="./switch_controller/switch_measurement/switch_measurement.json"):
    CONF = cfg.CONF
    CONF.register_opts([
        cfg.StrOpt('cluster_configuration', default="./conf/cluster_conf.json"),
        cfg.StrOpt('rule_template_directory', default="./switch_controller/quanta/config/te_test/"),
        cfg.IntOpt('sender', default=36),
        cfg.IntOpt('receiver', default=32),
        cfg.IntOpt('transceiver_speed', default=10),
        cfg.IntOpt('num_reconfig', default=50),
        cfg.IntOpt('reconfig_interval', default=3),
        # cfg.IntOpt('notify_port', default=10033),
        cfg.IntOpt('num_concurrent', default=20),
        cfg.StrOpt('control_output_directory', default='./switch_controller/switch_measurement/switching_record/'),
        cfg.StrOpt('control_output_filename', default='./switching_time'),
        # cfg.StrOpt('testing_switch', default='eps')
    ])
    CONF_file = json.load(open(configure_file))

    for config in CONF_file.keys():
        CONF.__setattr__(config, CONF_file[config])

    return CONF
Beispiel #22
0
"""
global flags
"""

from ryu import cfg

CONF = cfg.CONF

CONF.register_cli_opts([
    # app/quantum_adapter
    cfg.StrOpt('neutron-url',
               default='http://localhost:9696',
               help='URL for connecting to neutron',
               deprecated_name='quantum-url'),
    cfg.IntOpt('neutron-url-timeout',
               default=30,
               help='timeout value for connecting to neutron in seconds',
               deprecated_name='quantum-url-timeout'),
    cfg.StrOpt('neutron-admin-username',
               default='neutron',
               help='username for connecting to neutron in admin context',
               deprecated_name='quantum-admin-username'),
    cfg.StrOpt('neutron-admin-password',
               default='service_password',
               help='password for connecting to neutron in admin context',
               deprecated_name='quantum-admin-password'),
    cfg.StrOpt('neutron-admin-tenant-name',
               default='service',
               help='tenant name for connecting to neutron in admin context',
               deprecated_name='quantum-admin-tenant-name'),
    cfg.StrOpt('neutron-admin-auth-url',
               default='http://localhost:5000/v2.0',
Beispiel #23
0
# License for the specific language governing permissions and limitations
# under the License.

# This is a collector instance for NetFlow V5. OpenVirtualSwitch doesn't
# support NetFlow V9 for getting MPLS headers from the packets.

from ryu import cfg
from ryu.base import app_manager
from ryu.lib import hub
from ryu.lib.xflow import netflow

opts = [
    cfg.StrOpt('address',
               default='127.0.0.1',
               help='NetFlow Collector bind address'),
    cfg.IntOpt('port', default=3000, help='NetFlow Collector port'),
    cfg.IntOpt('max_udp_msg_size',
               default=1472,
               help='Maximum size of UDP messages')
]

cfg.CONF.register_opts(opts, 'plow')


class NetFlow(app_manager.RyuApp):
    def __init__(self, *args, **kwargs):
        super(NetFlow, self).__init__(*args, **kwargs)
        self._address = self.CONF.plow.address
        self._port = self.CONF.plow.port
        self._udp_msg_size = self.CONF.plow.max_udp_msg_size
        self._udp_sock = None
Beispiel #24
0
from ryu.ofproto import ofproto_protocol
from ryu.ofproto import ofproto_v1_0
from ryu.ofproto import nx_match

from ryu.controller import handler
from ryu.controller import ofp_event

from ryu.lib.dpid import dpid_to_str

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

CONF = cfg.CONF
CONF.register_cli_opts([
    cfg.StrOpt('ofp-listen-host', default='', help='openflow listen host'),
    cfg.IntOpt('ofp-tcp-listen-port',
               default=ofproto_common.OFP_TCP_PORT,
               help='openflow tcp listen port'),
    cfg.IntOpt('ofp-ssl-listen-port',
               default=ofproto_common.OFP_SSL_PORT,
               help='openflow ssl listen 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.FloatOpt(
        'socket-timeout',
        default=5.0,
        help='Time, in seconds, to await completion of socket operations.')
])


class OpenFlowController(object):
Beispiel #25
0
# limitations under the License.
"""
global flags
"""

from ryu import cfg

CONF = cfg.CONF

CONF.register_cli_opts([
    # app/quantum_adapter
    cfg.StrOpt('neutron-url', default='http://localhost:9696',
               help='URL for connecting to neutron',
               deprecated_name='quantum-url'),
    cfg.IntOpt('neutron-url-timeout', default=30,
               help='timeout value for connecting to neutron in seconds',
               deprecated_name='quantum-url-timeout'),
    cfg.StrOpt('neutron-admin-username', default='neutron',
               help='username for connecting to neutron in admin context',
               deprecated_name='quantum-admin-username'),
    cfg.StrOpt('neutron-admin-password', default='service_password',
               help='password for connecting to neutron in admin context',
               deprecated_name='quantum-admin-password'),
    cfg.StrOpt('neutron-admin-tenant-name', default='service',
               help='tenant name for connecting to neutron in admin context',
               deprecated_name='quantum-admin-tenant-name'),
    cfg.StrOpt('neutron-admin-auth-url', default='http://localhost:5000/v2.0',
               help='auth url for connecting to neutron in admin context',
               deprecated_name='quantum-admin-auth-url'),
    cfg.StrOpt('neutron-auth-strategy', default='keystone',
               help='auth strategy for connecting to neutron in admin'
Beispiel #26
0
slimmed down version of OVSBridge in quantum agent
"""

import functools
from ryu import cfg
import logging

import ryu.exception as ryu_exc
import ryu.lib.dpid as dpid_lib
import ryu.lib.ovs.vsctl as ovs_vsctl

LOG = logging.getLogger(__name__)

CONF = cfg.CONF
CONF.register_opts([
    cfg.IntOpt('ovsdb-timeout', default=2, help='ovsdb timeout')
])


class OVSBridgeNotFound(ryu_exc.RyuException):
    message = 'no bridge for datapath_id %(datapath_id)s'


class VifPort(object):

    def __init__(self, port_name, ofport, vif_id, vif_mac, switch):
        super(VifPort, self).__init__()
        self.port_name = port_name
        self.ofport = ofport
        self.vif_id = vif_id
        self.vif_mac = vif_mac
Beispiel #27
0
from routes.util import URLGenerator

import ryu.contrib
ryu.contrib.update_module_path()
from tinyrpc.server import RPCServer
from tinyrpc.dispatch import RPCDispatcher
from tinyrpc.dispatch import public as rpc_public
from tinyrpc.protocols.jsonrpc import JSONRPCProtocol
from tinyrpc.transports import ServerTransport, ClientTransport
from tinyrpc.client import RPCClient
ryu.contrib.restore_module_path()

CONF = cfg.CONF
CONF.register_cli_opts([
    cfg.StrOpt('wsapi-host', default='', help='webapp listen host'),
    cfg.IntOpt('wsapi-port', default=8080, help='webapp listen 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,
            'methods': methods,
            'requirements': requirements,
        }
        return controller_method
 def __init__(self, *args, **kwargs):
     super(ProjectOne, self).__init__(*args, **kwargs)
     # USed for learning switch functioning
     self.CONF = cfg.CONF
     self.CONF.register_opts([
         cfg.IntOpt('onefourbandwidth', default=10),
         cfg.IntOpt('onethreebandwidth', default=10),
         cfg.IntOpt('onetwobandwidth', default=10),
         cfg.IntOpt('twofourbandwidth', default=10),
         cfg.IntOpt('twothreebandwidth', default=10),
         cfg.IntOpt('threefourbandwidth', default=10),
         cfg.IntOpt('onefourlatency', default=10),
         cfg.IntOpt('onethreelatency', default=10),
         cfg.IntOpt('onetwolatency', default=10),
         cfg.IntOpt('twofourlatency', default=10),
         cfg.IntOpt('twothreelatency', default=10),
         cfg.IntOpt('threefourlatency', default=10)
     ])
     self.mac_to_port = {}
     # Holds the topology data and structure
     self.topo_raw_switches = []
     self.topo_raw_links = []
     self.net = nx.DiGraph()
     self.datapaths = {}
     self.monitor_thread = hub.spawn(self._monitor)
     self.flows_packets = []
Beispiel #29
0
from webob.request import Request as webob_Request
from webob.response import Response as webob_Response

from ryu import cfg
from ryu.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,
            'methods': methods,
            'requirements': requirements,
        }
Beispiel #30
0
from ryu.lib.dpid import dpid_to_str
from ryu.lib import ip

LOG = logging.getLogger('ryu.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=[],
                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,