1 Star 0 Fork 0

Admin / openflow-bandwidth

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

OpenFlow Bandwidth

A modification of a the ryu (http://osrg.github.io/ryu/) simple learning switch controller app to report and enforce bandwidth. Reporting by monotring the maximum passive throughput and enforcing using OpenFlow meters, both on a per port and per flow basis. The controller runs a JSON-RPC server for interfacing. Procedures shown below.

Compatability

HP OpenFlow 1.3 switches
Bandwidth reporting - Confirmed
Bandwidth enforcing - Confirmed

Open vSwitch
Bandwidth reporting - Confirmed
Bandwidth enforcing - Failed (Incomplete support for enforcing meters on OvS)

Quick start

Install Ryu - simple pip installation has requirements

% git clone git://github.com/osrg/ryu.git 
% cd ryu  
% sudo pip install -r tools/pip-requires
% python ./setup.py install

Pull

% git pull http://github.com/birrdy/openflow_bandwidth

Run bandwidth_control_simple_switch_13.py as a Ryu app

% ryu-manager bandwidth_control_simple_switch_13.py

By default the RPC server is running on http://localhost:4000/jsonrpc

JSON RPC interface

The JSON-RPC server is a HTTP server. The following examples would be used to develop a python application using the python-jspnrpc library (https://pypi.python.org/pypi/python-jsonrpc), but procedures can be called using any JSON-RPC method.

Install

% pip install python-jsonrpc

Import

import pyjsonrpc

Connection

http_client = pyjsonrpc.HttpClient(url = "http://localhost:4000/jsonrpc")

Procedure calling.

# Direct call
result = http_client.call("<procedure>", arg1, arg2)

# Use the *method* name as *attribute* name
result = http_client.procedure(arg1, arg2)

# Notifcations send messages to the serevr without reply
http_client.notify("<procedure>", arg1, arg2)

Procedures

report_port
Reports the maximum seen throughput of a specific port on a specific switch.
Params: [<switch_id>, <port_no>]
Result: [upload B/s, download B/s]

--> {"jsonrpc": "2.0", "method": "report_port", "params": [<switch_id>, <port_no>], "id": 1}
<-- {"jsonrpc": "2.0", "result": [<upload B/s>, <download B/s>], "id": 1}

report_flow - Not implemented
Reports the throughout of a specific flow on a specific switch.
Params: [<switch_id>, <flow_id>]
Result: <B/s>

report_switch_ports
Reports the throughput of all ports on a specific switch.
Params: <switch_id>
Result: JSON formatted port list

{
  <port_no>:[<upload B/s>, <download B/s>],
  ...
  <port_no>:[<upload B/s>, <download B/s>]
}

report_switch_flows - Not implemented
Reports the througput of all flows on a specific switch.
Params: <switch_id>
Result: JSON formatted flow list

{
  <flow_id>:<B/s>,
  ...
  <flow_id>:<B/s>
}

report_all_ports
Report the throughput of all ports on all switches under the control of the controller.
Result: JSON formatted switch & port list

{
  <switch_id>:{
    <port_no>:[<upload B/s>, download B/s],
    ...
    <port_no>:[<upload B/s>, download B/s]
  },
  ...
  <switch_id>:{
    <port_no>:[<upload B/s>, <download B/s>],
    ...
    <port_no>:[<upload B/s>, <download B/s>]
  }
}

report_all_flows
Report the throughput of all flows on all switches under the control of the controller.
Result: JSON formatted switch & flow list

{
  <switch_id>:{
    <flow_id>:<B/s>,
    ...
    <flow_id>:<B/s>
  },
  ...
  <switch_id>:{
    <flow_id>:<B/s>,
    ...
    <flow_id>:<B/s>
  }
}

reset_port - Notification
Resets the throughput of a specific port. To be recalculated.
Params: [<switch_id>, <port_no>]

reset_flow - Notification - Not implemented
Resets the throughput of a specific flow. To be recalculated.
Params: [<switch_id>, <flow_id>]

reset_switch_ports - Notification
Resets all recorder throughputs of all ports on a specific switch.
Params: <switch_id>

reset_switch_flows - Notification
Resets all recorder throughputs of all ports on a specific switch.
Params: <switch_id>

reset_all_ports - Notification
Resets all recorder throughputs of all ports on all swtiches under the control of the controller.

reset_all_flows - Notification
Resets all recorder throughputs of all flows on all swtiches under the control of the controller.

Enforce procedures in progress

enforce_port_outbound - Notification
Enforces an outbound bandwidth restriction on a specific port. Any previous enforcements will be replaced.
Params: [<switch_id>, <port_no>, <speed B/s>]

enforce_port_inbound - Notification
Enforces an inbound bandwidth restriction on a specific port. Any previous enforcements will be replaced.
Params: [<switch_id>, <port_no>, <speed B/s>]

enforce_flow - Notification - Not implemented
Enforces a bandwidth restricion on an existing flow. Any previous enforcements will be replaced.
Params:[<switch_id>, <flow_id>]

enfore_service
Enforces a bandwith restricting on a service donated by the source and destination address pair.
Params: [<switch_id>, <src_addr>, <dst_addr>, <speed B/s>]

CLI - In progress

report_throughput.py - Only port based for now

Show everything

% python report_througput.py -a

Show all ports on a switch

% python report_throughput.py -s <switch_id>

Show specifc port on a switch

% python report_throughput.py -s <switch_id> -p <port_no>

enforce_throughput_port.py

% python enforce_throughput_port.py <switch_id> <port_no> <speed B/s>

enforce_throughput_service.py

% python enforce_throughput_service.py <switch_id> <src_ip> <dst_ip> <speed B/s>

空文件

简介

取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/cool_c0de/openflow-bandwidth.git
git@gitee.com:cool_c0de/openflow-bandwidth.git
cool_c0de
openflow-bandwidth
openflow-bandwidth
master

搜索帮助