muhammad-rafi/restconf-cli

Python module or Linux Module!

Opened this issue · 4 comments

This seems more like a linux module, rather than a python module. Is there a way we can run this inside of our .py file ?

This is a python module (unlike curl which is a linux module) not linux module and this module is meant to be run via cli command as the name suggests, you better be using requests library in your python scripts rather than this module because your will require os module to run this as command inside the python script but there is no point since requests lib is already available.

Hope this helps.

Ok. I actually thought the "cli" meant like the switches' (cisco NXOS/IOS) CLI. I was looking for a way to convert restconf YANG commands to routers' CLI commands, which I don't think this does.

Can you please give me an example what you are trying to do exactly ? I may be able to suggest you something

So I am trying to push the CLI commands through a restconf like plugin. Similar to how pyeapi (Aristas) work.

connection = pyeapi.client.connect(host=device_ip,username=username,password=password,
transport='https',port=443,timeout=120)
device = pyeapi.client.Node(connection)
device.enable_authentication(password)
response = device.run_commands('show version')

I want this way because it will be easier for our Operations team to look at the automation logs and understand CLI commands rather than restconf YANG commands.