Implementing CLI
alireza-ghasemi opened this issue · comments
I want to implement CLI module for napalm-ros. it can get several commands and return result from Mikrotik.
I can develop several method input commands and export results.
-
in input commands , two items can get
- same as API like
('/ping',{'address': '8.8.8.8' ,'count': '3','ttl':'255','size':'150'})
- same as Mikroitk Terminal like
ping address=8.8.8.8 count=3 ttl=255 size=150
- same as API like
-
also in output result , two type can show
- return as dict
'/ping': ({'avg-rtt': '87ms', 'host': '8.8.8.8', 'max-rtt': '87ms', 'min-rtt': '87ms', 'packet-loss': 0, 'received': 1, 'sent': 1, 'seq': 0, 'size': 56, 'time': '87ms', 'ttl': 114}, {'avg-rtt': '85ms', 'host': '8.8.8.8', 'max-rtt': '87ms', 'min-rtt': '83ms', 'packet-loss': 0, 'received': 2, 'sent': 2, 'seq': 1, 'size': 56, 'time': '83ms', 'ttl': 114}, {'avg-rtt': '84ms', 'host': '8.8.8.8', 'max-rtt': '87ms', 'min-rtt': '83ms', 'packet-loss': 0, 'received': 3, 'sent': 3, 'seq': 2, 'size': 56, 'time': '83ms', 'ttl': 114})}
- return as human readable
seq host size ttl time sent received packet-loss min-rtt avg-rtt max-rtt
0 8.8.8.8 56 114 87ms 1 1 0 87ms 87ms 87ms
1 8.8.8.8 56 114 85ms 2 2 0 85ms 86ms 87ms
2 8.8.8.8 56 114 101ms 3 3 0 85ms 91ms 101ms
- return as dict
I want to implement CLI module for napalm-ros. it can get several commands and return result from Mikrotik.
What do you mean by "it can get several commands"
You can already issue command with e.g. librouteros
I get list of commands and return result in dict.
api command in librouteros get one command as just API. I can get terminal command (human readable) and return dict or string.
napalm-ros depends on API. There is no way to send multiple commands at once and return a "human readable" response.