scrapli / scrapligo

scrapli, but in go!
MIT License
258 stars 42 forks source link

Update huawei_vrp.yaml to support configuration functions #201

Closed Vaalen closed 2 weeks ago

Vaalen commented 1 month ago

Changed the privilege-levels name for system-view to configuration and the name to configuration to work seamlessly with existing functions.
Also added special characters that's common in the NE40 VRP platform to match prompt more consistently. Have tested this on my end towards actual routers and it seems to work fine.

carlmontanari commented 1 month ago

I wont merge this because this would break things for whoever is using "system-view". you are more than welcome to load your own platforms anyway, so you dont need this merged in order to use it. if / when there is a 1.0 and there is consensus from at least a handful of Huawei users about what the "right" (obviously this is subjective!) privilege levels are we can set stuff however the general group wants at that time.

Vaalen commented 4 weeks ago

Totally fair. However the extra special characters in the regex is probably good to add, since it can't find the prompt without them. Quote: "In two-phase validation mode, if any configurations are not submitted in the system, * is used for identification in the view. If all configurations have been submitted in the system, ~ is used for identification in the view." See doc: https://support.huawei.com/enterprise/en/doc/EDOC1100278537/89dde2b2/command-line-interface-configuration

I have another thought on how you might be able to solve this for this case and other potential future cases as well, but that probably involves bigger changes, but I'll just throw this idea out here. Instead of looking for the specific privilege level called "configuration" can you add another field in the yamls that's called something like: " default-configuration-privilege-level: 'system-view' " and use that specified privilege level for configurations. This will make other systems that have different "names" for these views work as well, making the system a bit more agnostic. This is just a thought, you do as you will with it :)

Edit: Added the line about special characters Edit2: Added link to Huawei NE40 VRP documentation

carlmontanari commented 4 weeks ago

However the extra special characters in the regex is probably good to add, since it can't find the prompt without them.

yeah that sounds good to me -- if ya wanna update this one or close this one and make a new pr w/ that we can for sure get that merged.

have another thought on how you might be able to solve this for this case and other potential future cases as well

yeah, this is a pretty good idea. we can for sure keep this in mind for a future 1.0 kinda thing if/whenever that happens!

wangxin688 commented 4 weeks ago

seems configuration is not support in all platform. it's totally a breaking change and not compatible for huawei products

carlmontanari commented 2 weeks ago

sounds good. ill close this then. if you wanna add a pr to expand the pattern as you mentioned before that would be most welcome. thanks @wangxin688 !