Hi All,

Encountered the following bug with OVS/OVN 2.9.0:

```bash
# ovs-dpctl-top
Traceback (most recent call last):
  File "/usr/bin/ovs-dpctl-top", line 1290, in <module>
    sys.exit(main())
  File "/usr/bin/ovs-dpctl-top", line 1282, in main
    flows_top(args)
  File "/usr/bin/ovs-dpctl-top", line 1191, in flows_top
    flows_read(ihdl, flow_db)
  File "/usr/bin/ovs-dpctl-top", line 593, in flows_read
    flow_db.flow_line_add(line)
  File "/usr/bin/ovs-dpctl-top", line 988, in flow_line_add
    self.flow_event(fields_dict, stats_old_dict, stats_dict)
  File "/usr/bin/ovs-dpctl-top", line 1080, in flow_event
    matches = flow_aggregate(fields_dict, stats_new_dict)
  File "/usr/bin/ovs-dpctl-top", line 576, in flow_aggregate
    field, stats_dict)
  File "/usr/bin/ovs-dpctl-top", line 250, in element_ipv4_get
    element_show = fmt % (field_type, element["src"], element["dst"])
KeyError: 'src'
````

When troubleshooted, pprinted the following:

```
pprint.pprint(field_type);
pprint.pprint(element);
pprint.pprint(stats_dict);

'ipv4'
{'frag': 'no'}
{'bytes': '22344', 'packets': '228', 'used': '0.706s'}
```

The elements comes in with a single "frag" key only.

The flows are:

```bash
# ovs-dpctl dump-flows
recirc_id(0),in_port(2),eth(src=00:00:00:00:00:00/01:00:00:00:00:00,dst=02:55:e6:cd:c0:3b),eth_type(0x0800),ipv4(frag=no),
 packets:535, bytes:52430, used:0.792s, actions:3
recirc_id(0),in_port(3),eth(src=00:00:00:00:00:00/01:00:00:00:00:00,dst=02:34:2c:78:a6:51),eth_type(0x0800),ipv4(frag=no),
 packets:535, bytes:52430, used:0.792s, actions:2
recirc_id(0),in_port(3),eth(src=02:55:e6:cd:c0:3b,dst=02:34:2c:78:a6:51),eth_type(0x0806),arp(sip=10.1.1.35,tip=10.1.1.34,op=1/0xff,sha=02:55:e6:cd:c0:3b,tha=00:00:00:00:00:00),
 packets:0, bytes:0, used:never, 
actions:userspace(pid=4294962559,slow_path(action))
```

One way to overcome the error is:

```python
def element_ipv4_get(field_type, element, stats_dict):
    """ Extract src and dst from a dump-flow element."""
    fmt = "%s(src=%s,dst=%s)"

    if "src" not in element:
        element["src"] = "unknown"
    if "dst" not in element:
        element["dst"] = "unknown"
```
_______________________________________________
discuss mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-discuss

Reply via email to