PackeTsar / freeztp

An Open-Source Zero-Touch Provisioning System for Cisco IOS.
GNU General Public License v3.0
216 stars 27 forks source link

Request // Command to query external-keystore; ztp query <keystore_id> #28

Closed derek-shnosh closed 5 years ago

derek-shnosh commented 6 years ago

I'm interested in a new command from ZTP: ztp query _keystore_id_

Where the result would be like grepping the external-keystore-test function for a _keystoreid in the csv file; e.g. ztp request external-keystore-test _store_name_ | grep _keystore_id_

Example output for the external keystore (csv) ACCESS and the keystore_id (or serial number) FDO1234567890.

derek@freeztp:~$ ztp query FDO12346789

Would output the same as...

derek@freeztp:~$ ztp request external-keystore-test ACCESS | grep FDO12346789
ztp set keystore FDO12346789 keystore_id FDO12346789
ztp set keystore FDO12346789 distsw_mod 1
ztp set keystore FDO12346789 distsw_int 5
ztp set keystore FDO12346789 mgmt_subnet 10.10.10.
ztp set keystore FDO12346789 mgmt_addr 5
ztp set keystore FDO12346789 enable_sec <omitted>
ztp set keystore FDO12346789 user_name <omitted>
ztp set keystore FDO12346789 user_sec <omitted>
ztp set association id FDO12346789 template ACCESS
PackeTsar commented 6 years ago

What if we make this ztp request external-keystore-test <store_name> id <id>? Then it will search the external keystore and give you your example output. Will that do what you are looking for?

derek-shnosh commented 6 years ago

Given that this is an enhancement request, I wouldn't turn my nose at it. Especially since I can't code my preference on my own.

But my ultimate goal would be to have it query all external (or simply all) keystores until found, ACL-esque... return a 'not found' if, well, not found. Maybe specifying the keystore <store_name> after the serial number <id> to define a smaller search scope.

e.g. ztp query <id> <store_name> _where storename is optional.

Reasoning is that of the 500+ switches we're putting this to work on, over half are 3850's that are going to spread across three or four different external keystores and associated templates... so not having to specify the keystore name when searching a serial number for what its valid variables should be, would be nice.

PackeTsar commented 5 years ago

Yea I think this feature makes sense to implement. I think the syntax will be ztp lookup (external-keystore ) where the external keystore part will be optional and ZTP will search all keystores if it is not defined. I'm changing the action from query to lookup as it seems more descriptive.

I think the syntax will be ztp request lookup <id> (external-keystore <exkeystore_name>)

PackeTsar commented 5 years ago

Added to enhancement list. Closing