实验4:开源控制器实践——OpenDaylight

搭建拓扑

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

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"
        }
    ]
}

整理和记录主要API文档

心得

  1. 一开始ODL的UI界面打不开,百度了下发现是防火墙拦截了端口号,关掉防火墙就好了
  2. 一开始pingall是失败的,请教了同学的做法,同学推荐了一个解决的博客,mininet下建立拓扑时关于远程控制器的一个小问题
  3. 此次还是有一定难度,主要是以上提到的两个bug,还好都能找到解决方案,然后还有工具使用不太熟练,只有postman之前有用过,不过老师的文档非常详细,入手很方便,不过做的时候有些图片忘记保存, 最后重新来了一次
原文地址:https://www.cnblogs.com/xiao-qingjiang/p/15367717.html