實驗4:開源控制器實踐——OpenDaylight


實驗4:開源控制器實踐——OpenDaylight

搭建拓撲

sudo mn --topo=single,3 --mac --controller=remote,ip=127.0.0.1,port=6633 --switch ovsk,protocols=OpenFlow13

執行pingall,后在ODL中查看拓撲,截圖如下

image-20210929200849402

Postman下發流表

通過Postman請求Restful API,進行流表下發

url:http://127.0.0.1:8181/restconf/config/opendaylight-inventory:nodes/node/openflow:1/flow-node-inventory:table/0/flow/1

json:

{
    "flow": [
        {
            "id": "1",
            "match": {
                "in-port": "1",
                "ethernet-match": {
                    "ethernet-type": {
                        "type": "0x0800"
                    }
                },
                "ipv4-destination": "10.0.0.3/32"
            },
            "instructions": {
                "instruction": [
                    {
                        "order": "0",
                        "apply-actions": {
                            "action": [
                                {
                                    "order": "0",
                                    "drop-action": {}
                                }
                            ]
                        }
                    }
                ]
            },
            "flow-name": "flow1",
            "priority": "65535",
            "hard-timeout": "10",
            "cookie": "2",
            "table_id": "0"
        }
    ]
}

檢查h1和h3連通性,截圖如下:

image-20210929201959665

整理和記錄主要API文檔

獲取拓撲的交換機

url:http://127.0.0.1:8181/apidoc/explorer/index.html#!/network-topology(2013-10-21)/GET_network_topology_get_183

image-20210929204348319

流表 增刪改查

url:http://127.0.0.1:8181/apidoc/explorer/index.html#!/opendaylight-inventory(2013-08-19)/GET_flow_get_204

image-20210929205441366

獲取特定交換機端口的狀態

url:http://127.0.0.1:8181/apidoc/explorer/index.html#!/opendaylight-port-statistics(2013-12-14)/get_node_connector_statistics_post_0

image-20210929204824999

獲取指定交換機信息

url:http://127.0.0.1:8181/apidoc/explorer/index.html#!/opendaylight-inventory(2013-08-19)/GET_node_get_5

image-20210929205952549

總結

這次實驗的難度主要在於Java和ODL的環境安裝,遇到一些bug,如直接粘貼老師的命令,被吞掉一個空格而不能成功安裝;pip使用國外源網絡斷開導致安裝失敗,修改使用清華鏡像源,最后安裝Ryu成功。在實驗中,通過總結以往解決問題的經驗,加上搜索一些資料,做到較快的問題的定位,提高自己解決問題的能力。經過實驗觀察到ODL十分消耗CPU的資源,在虛擬機運行ODL時,主機變得十分卡頓,所以實驗宜快速完成,避免因為操作不暢而導致效率降低。在之后的實驗,要考慮如何使用Java進行編程。通過ODL實現網絡的可編程。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM