ニューTrema 5つのポイント

Post on 18-Aug-2015

270 Views

Category:

Technology

3 Downloads

Preview:

Click to see full reader

Transcript

ニューTrema 5つのポイント

高宮安仁 @yasuhito

OpenFlow1.3.4#1

$ trema run my_controller_rb --openflow13 -c my.conf

match = Match.new(ether_type: 0x86dd, ipv6_source_address: ‘2001:db8:bd05:1d2:288a:1fc0:1:10ee', ipv6_source_address_mask: ‘ffff:ffff:ffff:ffff::’)

send_flow_mod_add(dpid, match: match, instructions: [Apply.new(SendOutPort.new(1)), GotoTable.new(10)])

詳しくは、パケットライブラリ trema/pio を参照

Ruby化#2

旧Trema

Trema

0 12500 25000 37500 50000

コードの変化

C+Ruby

Ruby

インストールが簡単に

$ sudo apt-get install openvswitch-vswitch

$ git clone https://github.com/trema/topology.git

$ cd topology

$ bundle install --binstubs

C

旧 新

Pryでデバッグ

コントローラ連携#3

コントローラ連携

• 既存のコントローラを

• 組み合わせて高機能なコントローラを作る

• 拡張して独自の機能を追加する

• ちょっとしたRubyコードでできます

trema/routing_switch

Routing Switch

PathManager

Topologytrema/topology

trema/ routing_switch

class RoutingSwitch < Trema::Controller extend Forwardable

def_delegators :@topology, :switch_ready … def packet_in(dpid, message) @topology.packet_in(dpid, message) return if message.lldp? @path_manager.packet_in(dpid, message) end

RoutingSwitch PathManager

Topology

class RoutingSwitch < Trema::Controller … def start_topology topology = TopologyController.new topology.start [] topology.add_observer @path_manager end

PathManager

Topology

Routing Switch

Sliceable Switch

Topology

PathManager

親クラス

<

class SliceableSwitch < PathManager def start super @slices = {} end

def add_slice(name) # … end

def delete_slice(name) # … end

#4テストフレームワーク

コントローラ

INPUT

OUTPUT

$ cat trema.conf vswitch { datapath_id 0xabc } $ ./bin/trema run ./lib/hello_trema.rb -c trema.conf Trema started. Hello 0xabc! ^C% $ cat /tmp/HelloTrema.log # Logfile created on 2015-08-07 21:42:26 +0900 by logger.rb/41954 I, [2015-08-07T21:42:26.484872 #7287] INFO -- : Trema started. I, [2015-08-07T21:42:26.745980 #7287] INFO -- : Hello 0xabc!

hello_trema

Then the output should contain: """ Hello, World! """

When I trema run "foo.rb" with the configuration "bar.conf"

Then the number of packets received by "host1" should be: | source | #packets | | 192.168.0.2 | 2 |

When I trema send_packets as follows: | source | destination | #packets | | 192.168.0.1 | 192.168.0.2 | 10 |

Given a file named "trema.conf" with: """ vswitch('learning') { datapath_id 0xabc } """

Given I use OpenFlow 1.3

ドキュメント#5

https://twitter.com/sashim1343/status/626675434831282176

近日中に原稿を公開

Trema本「はじめに」

1. バグ報告 2. パッチのPR 3. 新しいアプリ 4. Trema本レビュー

top related