Thanks Kyriakos Zarifis

I think this is you mean
http://noxrepo.org/manual/core-api.html
--------------------------------------------------------------------------------------------------------------
// only call on TCP packets
Packet_expr expr;
uint32_t val = ethernet::IP;
expr.set_field(Packet_expr::DL_TYPE,  &val);
val = ip_::proto::TCP;
expr.set_field(Packet_expr::NW_PROTO, &val);
register_handler_on_match(100,
                          expr,
                          boost::bind(&Example::tcp_packet_handler, this, _1));

----------------------------------------------------------------------------------------------------------------

I got it, but about the nox have pure filter for python?
And in pyswitch.py,
I print the ' forward_l2_packet() ' -> ' actions ' , I get this " [[0,[0,1]]] "
And same to ' forward_l2_packet() ' -> ' packet.type ' , I get this " 2054 "

So, what it mean about the information?

Thanks a lot.

在 2010年5月3日上午6:41,Kyriakos Zarifis <[email protected]> 寫道:
> Hi,
> it is mentioned somewhere in the specification that if there are no actions
> specified for a flow entry, a matching packet is dropped.
> So you would need to describe your flow (set nw_proto, ip_proto, dst_port),
> and leave the action set empty. Give that a try..
>
> 2010/5/2 曾毓元 <[email protected]>
>>
>> Thank you Kyriakos Zarifis
>>
>> About the pyswitch.py information that I try to understand his function
>> work.
>> And the core.py, there have a lot of function can use.
>> But I have no idea about the "actions". In the spec that has this
>> structure
>>
>>
>> ------------------------------------------------------------------------------------------------------------------
>> enum ofp_action_type {
>> OFPAT_OUTPUT, /* Output to switch port. */
>> OFPAT_SET_VLAN_VID, /* Set the 802.1q VLAN id. */
>> OFPAT_SET_VLAN_PCP, /* Set the 802.1q priority. */
>> OFPAT_STRIP_VLAN, /* Strip the 802.1q header. */
>> OFPAT_SET_DL_SRC, /* Ethernet source address. */
>> OFPAT_SET_DL_DST, /* Ethernet destination address. */
>> OFPAT_SET_NW_SRC, /* IP source address. */
>> OFPAT_SET_NW_DST, /* IP destination address. */
>> OFPAT_SET_NW_TOS, /* IP ToS (DSCP field, 6 bits). */
>> OFPAT_SET_TP_SRC, /* TCP/UDP source port. */
>> OFPAT_SET_TP_DST, /* TCP/UDP destination port. */
>> OFPAT_ENQUEUE, /* Output to queue. */
>> OFPAT_VENDOR = 0xffff
>> };
>>
>> -------------------------------------------------------------------------------------------------------------------
>>
>> If I want to filter TCP or port 22
>> how to do that?
>>
>>
>>
>> 2010/4/28 Kyriakos Zarifis <[email protected]>:
>> > Hi,
>> >
>> > in order to see an example of setting up flows programmatically through
>> > a
>> > NOX component written in python, you can look at
>> > /src/nox/coreapps/examples/pyswitch.py
>> > The idea is that you need to construct the openflow packet manually,
>> > filling
>> > out the flow description and the actions, and then send it to the
>> > desired
>> > switch
>> > When you say "add/delete/drop" flows, you actually cover 2 disparate
>> > things:
>> > add/delete refers to the type of the OF message (add/delete flow entry),
>> > but
>> > dropping a flow is described in the 'action' part (drop is an action,
>> > like
>> > 'forward to port 1, or send to controller). These are described in
>> > openflow's specification.
>> >
>> > It's a good idea to use wireshark with the OF dissector plugin, in order
>> > to
>> > monitor the packet you construct, and also see what the ones send out
>> > by,
>> > e.g. pyswitch, look like.
>> >
>> > (the process is the same in a C++ component, just the API differs a bit.
>> > Also you can manually setup flows using the 'dpctl' tool, but I'm
>> > assuming
>> > you were asking how one does it using NOX)
>> >
>> > On Wed, Apr 28, 2010 at 12:08 AM, 曾毓元 <[email protected]> wrote:
>> >>
>> >> Dear all:
>> >> Sorry to bother you.
>> >> I want to try to do the table control, like add/delete/drop flows
>> >> But, I don't know how to start it.
>> >>
>> >> Have any manner can provide?
>> >> or sample source code?
>> >>
>> >>
>> >> Regards
>> >> Ian
>> >>
>> >> _______________________________________________
>> >> nox-dev mailing list
>> >> [email protected]
>> >> http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org
>> >
>> >
>
>

_______________________________________________
nox-dev mailing list
[email protected]
http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org

Reply via email to