Hi Dumitru, Thanks for improving the tool.
On Tue, Nov 12, 2019 at 8:47 AM Dumitru Ceara <[email protected]> wrote: > > The script was never parsing the first cookie in the input. Also, add a > check to make sure that the cookie refers to a Logical_Flow before > trying to print the record. > > Signed-off-by: Dumitru Ceara <[email protected]> > --- > utilities/ovn-detrace.in | 24 ++++++++++++++---------- > 1 file changed, 14 insertions(+), 10 deletions(-) > > diff --git a/utilities/ovn-detrace.in b/utilities/ovn-detrace.in > index 9471e37..34b6b0e 100755 > --- a/utilities/ovn-detrace.in > +++ b/utilities/ovn-detrace.in > @@ -188,22 +188,26 @@ def main(): > cookie = None > while True: > line = sys.stdin.readline() > + > + if line == '': > + break > + > + line = line.strip() > + > if cookie: > # print lflow info when the current flow block ends > - if regex_table_id.match(line) or line.strip() == '': > + if regex_table_id.match(line): > lflow = get_lflow_from_cookie(ovsdb_ovnsb, cookie) > - print_lflow(lflow, " * ") > - print_lflow_nb_hint(lflow, " * ", ovsdb_ovnnb) > - cookie = None > + if lflow: > + print_lflow(lflow, " * ") > + print_lflow_nb_hint(lflow, " * ", ovsdb_ovnnb) > + cookie = None > > - print line.strip() > - if line == "": > - break > + print line > > m = regex_cookie.match(line) > - if not m: > - continue > - cookie = m.group(1) > + if m: > + cookie = m.group(1) > > > if __name__ == "__main__": > Maybe I missed something here, but the original logic seems to be correct to me. It always parses the current line - if there is a cookie, it is parsed. And then it prints the previous logical flow information using the last cookie that was parsed when a *new* flow or line break is encountered. And finally, it ensures the last logical flow information is printed because the "break" is AFTER the "if cookie" block. Now with the change, it seems the last logical flow (related to the last cookie) may not be printed, if it happens to be the last line. (although it is not a problem if the last line doesn't has cookie) Thanks, Han _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
