atlanticwave-sdx / pce

Path Computation Element for AtlanticWave SDX.
https://www.atlanticwave-sdx.net
0 stars 3 forks source link

Remove/replace asserts #241

Closed sajith closed 2 weeks ago

sajith commented 2 weeks ago

Spinning this off https://github.com/atlanticwave-sdx/sdx-controller/issues/350.

We have a fair number of assert statements that are/were useful during development, but they are not fit to be used in production or even demo usage:

$ grep -rn assert src/
src/sdx_pce/topology/temanager.py:357:                assert isinstance(link, ConnectionPath)
src/sdx_pce/topology/temanager.py:360:                assert src_node is not None
src/sdx_pce/topology/temanager.py:363:                assert dst_node is not None
src/sdx_pce/topology/temanager.py:434:                assert isinstance(link, ConnectionPath)
src/sdx_pce/topology/temanager.py:437:                assert src_node is not None
src/sdx_pce/topology/temanager.py:440:                assert dst_node is not None
src/sdx_pce/topology/temanager.py:624:        assert isinstance(tagged_breakdown, VlanTaggedBreakdowns)
src/sdx_pce/topology/temanager.py:642:        assert isinstance(link, ConnectionPath)
src/sdx_pce/topology/temanager.py:655:        assert n1 == node1
src/sdx_pce/topology/temanager.py:656:        assert n2 == node2
src/sdx_pce/topology/temanager.py:886:        assert False, "Not implemented"
src/sdx_pce/topology/temanager.py:896:        assert False, "Not implemented"
src/sdx_pce/load_balancing/te_solver.py:54:        assert isinstance(graph, nx.Graph)
src/sdx_pce/load_balancing/te_solver.py:55:        assert isinstance(tm, TrafficMatrix)

In general they deal with validation of external data. They should be replaced by validation code and log statements.