UWNetworksLab / netcov

NetCov: test coverage for network configurations
Apache License 2.0
39 stars 5 forks source link

Exception when using the `routes` question #13

Closed rickdonato closed 1 year ago

rickdonato commented 2 years ago

Hi, I'm getting the following when trying to look up routes and then looking at the netcov result. Thanks in advance.

>>> bf.q.routes().answer().frame()
           Node      VRF          Network                       Next_Hop     Next_Hop_IP  Next_Hop_Interface   Protocol Metric Admin_Distance   Tag
0   ios-access2  default  0.0.0.0/0        ip 172.29.133.254              172.29.133.254  dynamic             static     0      1              None
1   ios-access2  default  172.29.133.0/24  interface GigabitEthernet0/0   AUTO/NONE(-1l)  GigabitEthernet0/0  connected  0      0              None
2   ios-access2  default  172.29.133.6/32  interface GigabitEthernet0/0   AUTO/NONE(-1l)  GigabitEthernet0/0  local      0      0              None
3   nxos-aggr1   default  10.1.1.0/24      interface Ethernet1/4          AUTO/NONE(-1l)  Ethernet1/4         connected  0      0              0   
4   nxos-aggr1   default  10.1.1.2/32      interface Ethernet1/4          AUTO/NONE(-1l)  Ethernet1/4         local      0      0              0   
..         ...       ...          ...                        ...                     ...          ...           ...     ..     ..             ..   
91  server2      default  10.2.20.0/24     interface eth0                 AUTO/NONE(-1l)  eth0                connected  0      0              None
92  server2      default  10.2.20.1/32     interface eth0                 AUTO/NONE(-1l)  eth0                local      0      0              None
93  server3      default  0.0.0.0/0        interface eth0 ip 10.2.30.254  10.2.30.254     eth0                static     0      1              None
94  server3      default  10.2.30.0/24     interface eth0                 AUTO/NONE(-1l)  eth0                connected  0      0              None
95  server3      default  10.2.30.1/32     interface eth0                 AUTO/NONE(-1l)  eth0                local      0      0              None

[96 rows x 10 columns]
>>> bf.cov.result()
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/home/rick/development/tech-sessions/2022-11-netcov/.venv/lib/python3.8/site-packages/netcov/coverage.py", line 67, in result
    covered_lines = control_plane_coverage(self.model, tested_nodes)
  File "/home/rick/development/tech-sessions/2022-11-netcov/.venv/lib/python3.8/site-packages/netcov/algorithm/coverage.py", line 41, in control_plane_coverage
    dfs(node)
  File "/home/rick/development/tech-sessions/2022-11-netcov/.venv/lib/python3.8/site-packages/netcov/algorithm/coverage.py", line 36, in dfs
    dfs(pred)
  File "/home/rick/development/tech-sessions/2022-11-netcov/.venv/lib/python3.8/site-packages/netcov/algorithm/coverage.py", line 35, in dfs
    for (pred, _) in node.pred:
AttributeError: 'NoneType' object has no attribute 'pred'
ratulm commented 2 years ago

@rickdonato - This looks like some invalid assumption in how NetCov is parsing routes. It'll help if you can provide a repro - the snapshot used and any relevant setup before you ran the routes query above.

xieyangxu commented 1 year ago

This was caused by the same underlying problem as in #12. Fixed now.