OpendayLight:如何指定流表的目标IP地址

时间:2017-09-07 17:14:12

标签: json docker sdn openflow opendaylight

我正在使用OpendayLight Carbon SR1 )将流表发送到交换机,除了使用set-nw-dst-action-case指令外,一切正常。一旦我使用此指令,流量就无法设置为正确切换(通过http://opendaylight_ip:8181/restconf/operational/opendaylight-inventory:nodes/node/openflow:1/flow-node-inventory:table/0检查) 这是我设置流程的json代码:

{
    "flow": [
        {
            "id": "test",
            "match": {
                "ethernet-match": {
                    "ethernet-destination": {
                        "address": "02:42:4a:46:fc:02"
                    }
                }
            },
            "instructions": {
                "instruction": [
                    {
                        "order": "0",
                        "apply-actions": {
                            "action": [
                                {
                                    "order": "0",
                                    "set-nw-dst-action": {
                                        "_Opps": "Remove this action goes normal"
                                        "ipv4-address": "192.168.1.3/32"
                                    }
                                },
                                {
                                    "order": "1",
                                    "set-dl-dst-action": {
                                        "address": "02:42:4a:46:fc:03"
                                    }
                                },
                                {
                                    "order": "2",
                                    "output-action": {
                                        "output-node-connector": "3",
                                        "max-length": "65535"
                                    }
                                }
                            ]
                        }
                    }
                ]
            },
            "priority": "16",
            "table_id": "0"
        }
    ]
}

上面的json代码遵循OpendayLight规范,但我在Open vSwitch日志中找到了此消息:

2017-09-07T16:35:26.713Z|00103|ofp_actions|WARN|set_field ip_dst lacks correct prerequisities

This问题类似于我的问题。我尝试使用ovs-ofctl工具添加流程并成功,有没有办法在set-nw-dst-action-case中使用OpendayLight指令添加流程?

p.s。 ovs-ofctl命令让:

ovs-ofctl add-flow s1 "table=0,dl_dst=02:42:4a:46:fc:02,priority=12,action=mod_dl_dst:02:42:4a:46:fc:03,mod_nw_dst:192.168.1.3,output:3"

编辑(2017-9-8 21:14 GMT + 8)
我试图匹配ip标准和ovs日志抱怨这个:

2017-09-08T12:49:30.567Z|00032|nx_match|WARN|Rejecting NXM/OXM entry 0:32768:12:1:8 with 1-bits in value for bits wildcarded by the mask.
2017-09-08T12:49:30.567Z|00033|ofp_actions|WARN|bad action at offset 0 (OFPBMC_BAD_WILDCARDS):
00000000  00 19 00 10 80 00 19 08-0a 00 00 03 ff 00 00 00
2017-09-08T12:49:30.567Z|00034|connmgr|INFO|s1<->tcp:192.168.43.171:6633: sending OFPBMC_BAD_WILDCARDS error reply to OFPT_FLOW_MOD message
2017-09-08T12:49:30.567Z|00035|ofp_actions|WARN|set_field ip_dst lacks correct prerequisities

我使用这个json代码(OpendayLight Yang UI传递):

{
    "flow": [
        {
            "id": "bwt",
            "match": {
                "ethernet-match": {
                    "ethernet-destination": {
                        "address": "02:42:4a:46:fc:02"
                    }
                },
                "ipv4-destination": "192.168.1.2/32"
            },
            "instructions": {
                "instruction": [
                    {
                        "order": "0",
                        "apply-actions": {
                            "action": [
                                {
                                    "order": "0",
                                    "set-dl-dst-action": {
                                        "address": "02:42:4a:46:fc:03"
                                    }
                                },
                                {
                                    "order": "1",
                                    "set-nw-src-action": {
                                        "ipv4-address": "192.168.1.3/32"
                                    }
                                },
                                {
                                    "order": "2",
                                    "output-action": {
                                        "output-node-connector": "3",
                                        "max-length": "65535"
                                    }
                                }
                            ]
                        }
                    }
                ]
            },
            "priority": "12",
            "table_id": "0"
        }
    ]
}

编辑(2017-9-9 23:48 GMT + 8)
问题已经解决,请参阅我的回答。

2 个答案:

答案 0 :(得分:0)

结帐openflow spec第7.2.3.8节,表格:13(OXM_OF_IPV4_DST),以及ovs日志中描述的错误,您需要在设置操作目标ip之前匹配ipv4的数据包类型。

样本流程

ovs-ofctl add-flow s1 -O OpenFlow13 "table=0,ip,dl_dst=02:42:4a:46:fc:02,priority=12,action=set_field:02:42:4a:46:fc:03->eth_dst,set_field:192.168.1.3->ip_dst,output:3"

答案 1 :(得分:0)

规范

根据OpenFlow Switch Specification Version 1.3.5 ( Protocol version 0x04 )第7.2.3.6节流匹配字段先决条件和第7.2.3.8节标题匹配字段,修改IP地址的流程(< em> dst_ip 或 src_ip )必须:
 1.将lines.add(new Patron(s.next())); 设置为 ff:ff:ff:ff:ff:ff
 2. ethernet-destination-mask 0x0800
 3. ipv4的掩码应为 255.255.255.255 ip_addr / 32

代码

OpendayLight平台中的有效流程ethernet-type-type代码如下( Carbon SR1 opendaylight-inventory rev.2013-08-19 ):

json

确认

感谢 Karthik Prasad 指导我阅读规范和 Peder Zickler ,他们遇到了与我相同的问题。