Help us understand the problem. What is going on with this article?

SnapRoute / FlexSwitch on Vagrant インストールメモ

More than 3 years have passed since last update.

SnapRoute 概要

Appleの巨大データセンター内で、Apple Store, iTunes, Siri, Map 等々のトラフィックをハンドルするために内製されていた、WhiteBox Switch上で動作する L2/L3 Network Stack が "SnapRoute" として独立、オープンソースとして公開された。なお、SnapRouteが企業名、FlexSwitchが製品名、OpenSnapRouteがオープンソースとしての名前?と思われる。

動作環境:(Source Codeから推定)

  • 対応ASIC
    • Broadcom Trident II
    • Mellanox Spectrum Ethernet Switch IC
  • 対応WhiteBoxスイッチ
    • Celestica Redstone XP (48x10Gbps + 6x40Gbps)
    • Accton AS5712-54X (48x10Gbps + 6x40Gbps)
    • OCP Facebook Wedge (16x40Gbps)
    • Mellanox SN2700 (32x100Gbps)

Cavium, Barefoot もドキュメントに記載されているため、将来対応予定と予想

Source Codeやドキュメントの場所:

インストール環境

  • Windows 10
  • VirtualBox for Windows
  • Vagrant for Windows

Hyper-V が有効になっている場合、VirtualBox で VT-x を使う事ができず、vagrant up した時にエラーとなり起動できません。必ず無効にしてある事を確認してから作業を進めてください。

インストール手順

  1. VirtualBox のインストール
  2. Vagrant のインストール
  3. Vagrant.exe へのパスを環境変数に設定(必要に応じて)
    • C:\HashiCorp\Vagrant\bin
  4. 作業フォルダを作成(任意の場所)
    • c:/Workspace/vagrant/srBox/
  5. FlexSwitchのファイルを保存
  6. vagrant box の追加および起動
    • vagrant box add SnapRoute112 snaproute.box
    • vagrant up
  7. ssh でログイン(Tera Termで試しました)
    • Host: localhost, Port: 2222
    • UserID/Password = vagrant/vagrant

動作確認

インターフェースの確認

SSHでログイン後 ip a で確認すると、eth0 / eth1 の2つのインターフェースが確認できます。

vagrant@vagrant-ubuntu-trusty-64:~$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 08:00:27:8f:dc:e2 brd ff:ff:ff:ff:ff:ff
    inet 10.0.2.15/24 brd 10.0.2.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::a00:27ff:fe8f:dce2/64 scope link
       valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 08:00:27:98:93:ad brd ff:ff:ff:ff:ff:ff
    inet 192.168.10.9/24 brd 192.168.10.255 scope global eth1
       valid_lft forever preferred_lft forever
    inet6 2408:82:3fff:9b6:a00:27ff:fe98:93ad/64 scope global dynamic
       valid_lft 2591886sec preferred_lft 604686sec
    inet6 fe80::a00:27ff:fe98:93ad/64 scope link
       valid_lft forever preferred_lft forever
4: dummy0: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN group default
    link/ether 8e:61:00:a9:32:5e brd ff:ff:ff:ff:ff:ff

利用可能なREST APIの表示

http://<vagrant-box-ip-addr>:8080/api-docs/ で利用可能なAPIが表示されます。
例: http://192.168.10.9:8080/api-docs/
20160703-snaproute-02.PNG

REST APIの利用

  • サンプル:Loopback Intefaceの追加・確認
$ curl -H "Content-Type: application/json" -d '{"Name":"lo1", "Type":"Loopback"}' \
> http://localhost:8080/public/v1/config/LogicalIntf
{"ObjectId":"d34c77af-d9cd-48c0-7bf6-5c46acb77290","Error":""}

$ curl -H "Content-Type: application/json" \
> 'http://localhost:8080/public/v1/config/LogicalIntfs' | python -m json.tool
{
    "CurrentMarker": 0,
    "MoreExist": false,
    "NextMarker": 0,
    "ObjCount": 1,
    "Objects": [
        {
            "Object": {
                "Name": "lo1",
                "Type": "Loopback"
            },
            "ObjectId": "d34c77af-d9cd-48c0-7bf6-5c46acb77290"
        }
    ]
}
  • サンプル:System Statusの取得
$ curl -X GET -H "Content-Type: application/json" "http://localhost:8080/public/v1/state/SystemStatus" | python -m json.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  3160    0  3160    0     0   105k      0 --:--:-- --:--:-- --:--:--  106k
{
    "Object": {
        "FlexDaemons": [
            {
                "Enable": true,
                "KeepAlive": "Received 2 keepalives",
                "Name": "fMgrd",
                "Reason": "None",
                "RestartCount": 0,
                "RestartReason": "",
                "RestartTime": "",
                "StartTime": "2016-07-03 12:09:43.574148537 +0000 UTC",
                "State": "up"
            },
            {
                "Enable": true,
                "KeepAlive": "Received 2 keepalives",
                "Name": "confd",
                "Reason": "None",
                "RestartCount": 0,
                "RestartReason": "",
                "RestartTime": "",
                "StartTime": "2016-07-03 12:09:44.27881753 +0000 UTC",
                "State": "up"
            },
 ... 省略 ...
            {
                "Enable": true,
                "KeepAlive": "Received 2 keepalives",
                "Name": "asicd",
                "Reason": "None",
                "RestartCount": 0,
                "RestartReason": "",
                "RestartTime": "",
                "StartTime": "2016-07-03 12:09:43.27777507 +0000 UTC",
                "State": "up"
            }
        ],
        "Name": "vagrant-ubuntu-trusty-64",
        "NumActionCalls": "Total 0 Success 0",
        "NumCreateCalls": "Total 6 Success 3",
        "NumDeleteCalls": "Total 0 Success 0",
        "NumGetCalls": "Total 39 Success 21",
        "NumUpdateCalls": "Total 0 Success 0",
        "Ready": true,
        "Reason": "None",
        "UpTime": "2h50m30.840160721s"
    },
    "ObjectId": ""
}

参考リンク

以上

ebiken
Interested in Virtualization, IP networking and performance tuning. But most of the time drinking wine or Belgian beer.
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした