16
たくさんのスイッチを 制御する 高宮安仁 @yasuhito

たくさんのスイッチを 制御する - GitHub Pageshandai-trema.github.io/deck/week7/routing_switch.pdfRoutingSwitch Topology PathManager PacketOut 最短路パスを作る

  • Upload
    others

  • View
    0

  • Download
    0

Embed Size (px)

Citation preview

Page 1: たくさんのスイッチを 制御する - GitHub Pageshandai-trema.github.io/deck/week7/routing_switch.pdfRoutingSwitch Topology PathManager PacketOut 最短路パスを作る

たくさんのスイッチを 制御する

高宮安仁 @yasuhito

Page 2: たくさんのスイッチを 制御する - GitHub Pageshandai-trema.github.io/deck/week7/routing_switch.pdfRoutingSwitch Topology PathManager PacketOut 最短路パスを作る

HelloWorld

スイッチルータ

トポロジディスカバリ

ルーティングスイッチ

仮想NW

Page 3: たくさんのスイッチを 制御する - GitHub Pageshandai-trema.github.io/deck/week7/routing_switch.pdfRoutingSwitch Topology PathManager PacketOut 最短路パスを作る

仮想L2スイッチ

Page 4: たくさんのスイッチを 制御する - GitHub Pageshandai-trema.github.io/deck/week7/routing_switch.pdfRoutingSwitch Topology PathManager PacketOut 最短路パスを作る

ルーティングの仕組み

Page 5: たくさんのスイッチを 制御する - GitHub Pageshandai-trema.github.io/deck/week7/routing_switch.pdfRoutingSwitch Topology PathManager PacketOut 最短路パスを作る

どう書く? コントローラ

• スイッチとの接続 • トポロジ探索 • 最短路 • フローエントリの管理

Page 6: たくさんのスイッチを 制御する - GitHub Pageshandai-trema.github.io/deck/week7/routing_switch.pdfRoutingSwitch Topology PathManager PacketOut 最短路パスを作る

RoutingSwitch

Topology

PathPathManager

小さなクラスに分ける!

Page 7: たくさんのスイッチを 制御する - GitHub Pageshandai-trema.github.io/deck/week7/routing_switch.pdfRoutingSwitch Topology PathManager PacketOut 最短路パスを作る

パケットを送信すると…

PacketIn

FlowMod PacketOut

宛先ホスト

Page 8: たくさんのスイッチを 制御する - GitHub Pageshandai-trema.github.io/deck/week7/routing_switch.pdfRoutingSwitch Topology PathManager PacketOut 最短路パスを作る

RoutingSwitch

Topology

PathManager

PacketOut

最短路パスを作る

PacketIn

Path

Path.create

FlowMod (下流から)

トポロジ情報

Page 9: たくさんのスイッチを 制御する - GitHub Pageshandai-trema.github.io/deck/week7/routing_switch.pdfRoutingSwitch Topology PathManager PacketOut 最短路パスを作る

処理のカプセル化

•Path.create(path, packet_in)パスに沿って下流からFlowModAdd

•Path.destroy(path)パスに沿って上流からFlowModDel

•Path.select do |each| each.link?(port_a, port_b)end.each(&:destroy) ポートa⇔ポートbのリンクをすべて消す

Page 10: たくさんのスイッチを 制御する - GitHub Pageshandai-trema.github.io/deck/week7/routing_switch.pdfRoutingSwitch Topology PathManager PacketOut 最短路パスを作る

リンクが切れたら…

宛先ホスト

PortDownFlowModDel

Page 11: たくさんのスイッチを 制御する - GitHub Pageshandai-trema.github.io/deck/week7/routing_switch.pdfRoutingSwitch Topology PathManager PacketOut 最短路パスを作る

RoutingSwitch

Topology

PathManager

無効なパスを消す

PortDown

Path

delete_link イベント

Path.destroy

FlowMod(上流から)

Page 12: たくさんのスイッチを 制御する - GitHub Pageshandai-trema.github.io/deck/week7/routing_switch.pdfRoutingSwitch Topology PathManager PacketOut 最短路パスを作る

オブザーバパターン

トポロジイベントをPathManagerへ

イベントハンドラでパスを消す

Page 13: たくさんのスイッチを 制御する - GitHub Pageshandai-trema.github.io/deck/week7/routing_switch.pdfRoutingSwitch Topology PathManager PacketOut 最短路パスを作る

RoutingSwitch

Topology

PathManager

メッセージの振り分け

OpenFlow メッセージ

Path

トポロジ

関係

PacketInのみ

Page 14: たくさんのスイッチを 制御する - GitHub Pageshandai-trema.github.io/deck/week7/routing_switch.pdfRoutingSwitch Topology PathManager PacketOut 最短路パスを作る

ハンドラの委譲トポロジ関連メッセージ→Topologyへ

PacketIn→TopologyとPathManagerへ

Page 15: たくさんのスイッチを 制御する - GitHub Pageshandai-trema.github.io/deck/week7/routing_switch.pdfRoutingSwitch Topology PathManager PacketOut 最短路パスを作る
Page 16: たくさんのスイッチを 制御する - GitHub Pageshandai-trema.github.io/deck/week7/routing_switch.pdfRoutingSwitch Topology PathManager PacketOut 最短路パスを作る

• 小さいクラスを組み合わせよう • 部品 (トポロジ) の再利用 • コードの見通しを良くする • 必要なのはOOPの基本テク • カプセル化、委譲など

まとめ