Hi,

If you want to match packets, you must satisfy the prerequisites.
For example, if you want to match packet based on source IPv4 address,
you must specify "eth_type" as the prerequisite (in OpenFlow V1.0, "dl_type").

In the OpenFlow Spec, you can see the prerequisites for each match field:
With OpenFlow v1.3.5, for example, you can see them in the "Header match fields details." table.
https://www.opennetworking.org/images/stories/downloads/sdn-resources/onf-specifications/openflow/openflow-switch-v1.3.5.pdf

So, the code below works as you want:
    match = parser.OFPMatch(ipv4_src="10.0.0.1", eth_type=0x0800)


Thanks,
Fujimoto


On 2017年03月20日 16:15, Priyesh Kumar wrote:
Hi,

I am trying to match packet only based on source IPv4 address


Using Internal calls, no flow is added and no error OFPError message

actions = [parser.OFPActionSetQueue(2)]
inst = [parser.OFPInstructionActions(ofproto.OFPIT_APPLY_ACTIONS, actions),
                    parser.OFPInstructionGotoTable(3)]

match = parser.OFPMatch(ipv4_src="10.0.0.1")
flow = parser.OFPFlowMod(datapath=datapath, priority=200, match=match, instructions=inst, table_id=1)
flow.datapath = datapath
datapath.send_msg(flow)

But when I change match field to anything else line eth_src, in_port, flow is added successfully.


Using REST api, successfully added flow

{
    "dpid":1,
    "table_id": 1,
         "match": {
        "dl_type": 2048,
        "nw_src": "10.0.0.2"
      },
    "actions": [
        {
            "type":"GOTO_TABLE",
            "table_id":3
        },
        {
            "type":"SET_QUEUE",
            "queue_id":2
        }
    ]
}

Flow is added successfully


How to add flow with match field only based on IPv4.


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot


_______________________________________________
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to