muhammad-rafi / restconf-cli

Other
8 stars 3 forks source link

Python module or Linux Module! #2

Open sindhujit1 opened 1 year ago

sindhujit1 commented 1 year ago

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 ?

muhammad-rafi commented 1 year ago

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.

sindhujit1 commented 1 year ago

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.

muhammad-rafi commented 1 year ago

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

sindhujit1 commented 1 year ago

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.