In addition to what Reid said it also looks like you are running this
against a hardware switch.What switch are you using? Does dpctl print
additional info to stdout? I've never looked to see if it does error
handling or even returns anything other than 0. It would probably be
helpful if you changed your script to dump out the flow table after each
flow added to find out what's going wrong.

Aaron

On Wed, Sep 5, 2012 at 11:24 AM, Reid Price <reid.pr...@gmail.com> wrote:

> <dropping openflow-dev>
>
> Your script looks generic enough.  I would still check your logs for
> warning messages about normalization, as you have IP masks in your nw
> addresses.
>
> Information that would make debugging this much more simple:
>
> - initial state (list flows)
> - list of (add flows) commands run
> - expected output of list flows
> - actual output of list flows
>
> Even more helpful would be to do a little work to attempt to minimize the
> add flow commands required to exhibit this behavior, binary search or just
> dumping the number of flows after each add should make this straightforward.
>
>
> On Wed, Sep 5, 2012 at 7:22 AM, changhe <changhe...@126.com> wrote:
>
>>  Reid,
>>
>>  Thank you first.
>> But I think it is not the reason in my situation.
>> The flow entries to be added are in the attachment.(89 entries altogether)
>> and this file is one successful result. I think the 'rewriting' is
>> impossible in my situation.
>>
>> and part of my script is below:
>>
>>    * if flow_iter != None :*
>> *        for flow in flow_iter :*
>> *            srcip = flow.find("srcip")*
>> *            if srcip != None :*
>> *                tsrcip = srcip.text*
>> *                match += 'nw_src=' + tsrcip + ','*
>> *            dstip = flow.find("dstip")*
>> *            if dstip != None :*
>> *                tdstip = dstip.text*
>> *                match += 'nw_dst=' + tdstip + ','*
>> *            tpproto = flow.find("tpproto")*
>> *            if tpproto != None :*
>> *                ttpproto = tpproto.text*
>> *                match += 'nw_proto=' + ttpprot + ','*
>> *            srcport = flow.find("srcport")*
>> *            if srcport != None :*
>> *                tsrcport = srcport.text*
>> *                match += 'tp_src=' + tsrcport + ','*
>> *            dstport = flow.find("dstport")*
>> *            if dstport != None :*
>> *                tdstport = dstport.text*
>> *                match += 'tp_dst=' + tdstport + ','*
>> *            # trim the last comma*
>> *            match = match[:len(match)-1]*
>> *
>> *
>> *            if pif.pif_info.has_key(toutif) :*
>> *                action = 'actions=mod_dl_src:' +
>> str(ifi.if_mac[toutif]) + ',mod_dl_dst:' + pif.pif_info[toutif][1] +
>> ',output:' + str(config.IF_OFPORT[toutif])*
>> *            else:*
>> *                print 'Cannot find peer MAC of', toutif.upper(), ', add
>> flow entry without modifing MAC.' *
>> *                action = 'actions=mod_dl_src:' +
>> str(ifi.if_mac[toutif]) + ',output:' + str(config.IF_OFPORT[toutif])*
>> *            flb.add(match, action, priority, idle_timeout)*
>> *
>> *
>> *
>> *
>> *def add(match, actions, priority=None, idle_timeout=None,
>> hard_timeout=None):*
>> *    '''*
>> *    Add a flow entry*
>> *    '''*
>> *    if match == None or actions == None:*
>> *        return - 1*
>> *    cmd = dpctl + 'add-flow' + dp*
>> *    if priority != None :*
>> *        cmd = cmd + 'priority=' + str(priority) + ','*
>> *    if idle_timeout != None:*
>> *        cmd = cmd + 'idle_timeout=' + str(idle_timeout) + ','*
>> *    if hard_timeout != None:*
>> *        cmd = cmd + 'hard_timeout=' + str(hard_timeout) + ','*
>> *    cmd = cmd + match + ',' + actions*
>> *    rt = os.system(cmd)*
>> *    return rt*
>>
>>  -
>> 常  贺
>> Tel:(+86)1381-138-9007
>>
>>
>> 在 2012-09-05 11:13:16,"Reid Price" <reid.pr...@gmail.com> 写道:
>> >(You would have to be much more specific for me to know whether this
>> >guess is close to being on the right track, but here is my guess)
>> >
>> >You are probably adding flows that are identical from openflow's 
>> >perspective.
>> >The reference implementation normalizes portions of the flow that do not
>> >make sense given a (lack of) context.
>> >
>> >For example, all these flows would overwrite each other (last would 
>> >survive):
>> >
>> >  in_port=1,tp_dst=100, actions=1
>> >  in_port=1,tp_dst=200, actions=2
>> >  in_port=1,tp_src=500, actions=drop
>> >
>> >This is because tp_src/dst doesn't mean anything to openflow without
>> >some context (ip/udp/tcp), so all it sees is:
>> >
>> >  in_port=1, actions=<~>
>> >
>> >Perhaps this will help, otherwise provide more information on the actual
>> >calls that you are making, implementation of openflow you are using, etc.
>> >
>> >  -Reid
>> >
>> >On Tue, Sep 4, 2012 at 7:17 PM, changhe <changhe...@126.com> wrote:
>> >> hi, all
>> >>
>> >> I wrote a python script to manipulate the flow table by calling
>> >> os.system('dpctl ...') (in standard openflow 1.0).
>> >> The script adds 100 entries in order.
>> >> When excute the script, sometimes a few entries may not be added, and 
>> >> these
>> >> fail entries are uncertain, impossible to reproduce.
>> >> I print out the return value in the python script when call dpctl, and the
>> >> value is always 0.
>> >> It makes me confused.
>> >> Can anybody give me some advice to check out  this problem? Is it a bug in
>> >> openflow or dpctl, or something wrong by me?
>> >>
>> >>  Thanks!
>> >> --
>> >> 常  贺
>> >> Tel:(+86)1381-138-9007
>>
>> >>
>> >>
>> >>
>> >> _______________________________________________
>> >> openflow-discuss mailing list
>> >> openflow-discuss@lists.stanford.edu
>> >> https://mailman.stanford.edu/mailman/listinfo/openflow-discuss
>> >>
>>
>>
>>
>>
>
> _______________________________________________
> openflow-discuss mailing list
> openflow-discuss@lists.stanford.edu
> https://mailman.stanford.edu/mailman/listinfo/openflow-discuss
>
>
_______________________________________________
openflow-discuss mailing list
openflow-discuss@lists.stanford.edu
https://mailman.stanford.edu/mailman/listinfo/openflow-discuss

Reply via email to