Skip to content

Get rid of api v1

Created by: edvgui

Some behavior of the api v1 interfere with containerlab. When containerlab creates the container, it will also create interfaces in it, and rename them. If this happen when the server tries to get all the interfaces, we will get this exception:

Device "clab-0029ac55" does not exist.
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/local/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/user/nfv-test-api/src/nfv_test_api/main.py", line 517, in <module>
    main()
  File "/home/user/nfv-test-api/env/lib/python3.6/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/home/user/nfv-test-api/env/lib/python3.6/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/home/user/nfv-test-api/env/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/user/nfv-test-api/env/lib/python3.6/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/home/user/nfv-test-api/src/nfv_test_api/main.py", line 511, in main
    setup_namespaces()
  File "/home/user/nfv-test-api/src/nfv_test_api/util.py", line 244, in setup_namespaces
    mac_lookup = {x["mac"]: x for x in util.list_all_interfaces()}
  File "/home/user/nfv-test-api/src/nfv_test_api/util.py", line 80, in list_all_interfaces
    mac = get_mac(intf)
  File "/home/user/nfv-test-api/src/nfv_test_api/util.py", line 97, in get_mac
    output = subprocess.check_output(["ip", "-j", "link", "show", "dev", interface])
  File "/usr/local/lib/python3.6/subprocess.py", line 356, in check_output
    **kwargs).stdout
  File "/usr/local/lib/python3.6/subprocess.py", line 438, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['ip', '-j', 'link', 'show', 'dev', 'clab-0029ac55']' returned non-zero exit status 1.

We don't actually need that part anymore, so the idea is to get rid of it, and make a major version bump.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information