virl2-client icon indicating copy to clipboard operation
virl2-client copied to clipboard

pyats testbed issue

Open tzarski0 opened this issue 1 year ago • 3 comments

With pyats 25.1 installed, when running the run_command function, warnings are getting generated. Example code:

from virl2_client import ClientLibrary
from virl2_client.models.cl_pyats import ClPyats

cml_ip = ...
cml_username = ...
cml_password = ...

node_label = "edge"

cml = ClientLibrary(cml_ip, cml_username, cml_password, ssl_verify=False)

lab = cml.find_labs_by_title("pyatstest")[0]
pylab = ClPyats(lab)
pylab.sync_testbed(cml_username, cml_password)
pylab._testbed.devices[node_label].credentials.default.username = "admin"
pylab._testbed.devices[node_label].credentials.default.password = "admin"

running_config = pylab.run_command(node_label, "show sdwan run")
print(running_config)

The following code generates warnings:

Could not find details in testbed for server terminal_server.
Could not find details in testbed for server terminal_server.
No details found in testbed for hostname terminal_server.
Could not find details in testbed for server terminal_server.
Could not find details in testbed for server terminal_server.
No details found in testbed for hostname terminal_server.

I assume there's something wrong with the testbed object that virl2_client generates. Ask is to fix it so no warnings are generated on run_command function.

tzarski0 avatar Feb 19 '25 17:02 tzarski0

testbed:
  name: TESTBED
  servers:                <<
    terminal_server:      <<
      type: server        <<
devices:
  terminal_server:
    os: linux
    type: server 

I found adding servers under testbed makes the warnings go away

sgherdao avatar Feb 19 '25 19:02 sgherdao

This is caused by PyATS now eagerly trying to convert each proxy name from a server to a device, even if we already define it as a device in the first place and that new try block is therefore misplaced. SG may choose to raise this with unicon devs, to also fix other corner case mishandled by the new code there.

virlos avatar Feb 20 '25 10:02 virlos

The issue was reported to the PyATS developers by the reporter alongside a code fix; it is up to them to accept and release a fix for this.

virlos avatar Jun 23 '25 12:06 virlos