cancel
Showing results forĀ 
Search instead forĀ 
Did you mean:Ā 

API, Python or other way to check command syntax and ability to execute

API, Python or other way to check command syntax and ability to execute

Tomasz
Valued Contributor II
Hello,

I'm about to do some initial steps with Python for EXOS. I want to write kind of an intermediate shell that would work on user input (CLI commands) before ultimate execution.
Walked through Python Getting Started Guide (some old PDF) and the API reference (https://api.extremenetworks.com/EXOS/ProgramInterfaces/PYTHONAPI/) but I've no idea if I can achieve some ready-to-go syntax check (e.g. 'crete veelan Data tag 20') and validity check (e.g. 'conf vlan Data add port 20 tagged' when Data doesn't exist), or should I attempt to create these checks from the scratch. Would CM Backend be useful here?

Kind regards,
Tomasz
1 ACCEPTED SOLUTION

AdrianO
Contributor
If you have your current config as rollback.xsf, it might not necessarily roll things back. If your config.xsf had "create vlan Data tag 20" and your rollback.xsf doesn't, it will not remove the vlan Data. With that in mind you could do.

You're right. It would reapply the rollback config but wouldn't unconfigure anything.

Check command syntax (e.g. 'cerate veelan Data'), most likely right at the time of being provided by user
Check command validity

To do this right for the full command catalog it would require a lexical, syntactic and semantic analyzers. Additionally we would have to update them with changes in commands. I dont want to be the party popper but its a huge undertaking. Maybe we can leverage the capacity in the OS of the switch to do this somehow.

Engine that will create contrary commands for a rollback, seems to be massive pain in the bottom but least complicated.

Maybe this is more approachable thanks to the configure/unconfigure, add/delete, etc structure, although I think that not always you can substitute one for the other for rollback, like in:

enable sharing 1:1 grouping 1:1 lacp
disable sharing 1:1 grouping 1:1 lacp -> its not correct

I donĀ“t think I have so much free time, but I could collaborate on some parts maybe. If someone from extreme sees this and can push for it with the engineers it can be a feature request. I really think that it should be a integrated feature in exos, but I dont know if it is feasible with scripts or the best way is integration in exos.

Great thread by the way.

View solution in original post

6 REPLIES 6

Tomasz
Valued Contributor II
Hi B-rad,

I don't want to recall any similar feature from the market here, but the idea is about buffering the commands before doing actual commit (like in WiNG), but with option of a timeout, so if the commit is not confirmed within that time window, it will revert the commands (configuration comes back to pre-commit shape).
The easy path is to buffer all the commands and after issuing 'commit' current config could be backed up, and in case of no confirmation the switch could do 'use configuration commitbackup.cfg' and reboot, the hard path is to build some dictionary of opposite commands (no reboot needed - no prolonged outage in case of doing something wrong by commiting the changes).
But for such commit to be successful without any gaps, syntax and relevance checks should be possible I believe.

Not a business-related feature request, but I was thinking on it for last few years, recently I've spoken to several people and got some morale boost to spend my free time on that. šŸ™‚
And it seems to be a nice starting point to play with Python for EXOS, as this is a feature I'd like to have (motivation kicks in).

Kind regards,
Tomasz

BradP
Extreme Employee
Hi Tomasz,

Just curious--what is the ultimate end goal here?

Thanks
Brad
GTM-P2G8KFN