Skip to content
This repository has been archived by the owner on Sep 25, 2024. It is now read-only.

Enhancement to Device Group and Device Functions #152

Merged
merged 16 commits into from
May 22, 2021

Conversation

hpreston
Copy link

@hpreston hpreston commented May 5, 2021

First, thanks for putting work together on this library. As I was diving into my first Cisco ISE programmability project I was happy to find a library that had much of what I needed already worked out. There were a handful of features/functions that were missing for my project. I went ahead and added them to the library, trying to stick with the general style and functionality of the library.

Here's what I think is a summary of the features/changes included here:

Fleshing out the CRUD for Device Groups

  1. A function to add_device_group that adds a new device group
  2. A function to update_device_group that, you guessed it, updates a device group.
  3. A function to delete_device_group. I bet you can guess what this does

And putting the "U" into CRUD for devices

  1. A new function for update_device to allow updating a device. This one was complicated to support the variety of update options for a device.

In addition to the new functions, I enhanced a couple of existing functions

  1. Updates to get_device_group that looks up a device group from ISE given a group ID, name, or partial name.
  2. Updates to add_device to make all the attributes configurable as function parameters. I also provided an alternative option of providing a device payload as a single dictionary rather than individual attributes.

Let me know any questions or requests for tweaks to the PR. I'd love to contribute back into the library for others to take advantage of.

@falkowich
Copy link
Owner

Hi, great PR!
Going to check it out this weekend
Real life work is taking a toll for the moment :)

--
Regards Falk

@falkowich
Copy link
Owner

Arrh, I must reinstall my ISE dev env.
Both 2.7 and 3.0..
So this is this Friday evening fun :)

@falkowich falkowich merged commit 8f867b9 into falkowich:master May 22, 2021
@falkowich
Copy link
Owner

Thanks for the PR, that was really great work!
If you want to make more changes, you are more than welcome!

Again, thanks for your time!

--
Regards Falk

@falkowich falkowich mentioned this pull request May 22, 2021
@hpreston
Copy link
Author

Thanks for merging it in, I was glad to contribute back. And Ill be happy to switch and use the upstream option from pypi rather than my fork.

If I get into any more enhancements I’ll certainly send them upstream as well.

And one last question/thought. Have you considered submitting the repo to DevNet’s Code Exchange (https://developer.cisco.com/codeexchange)? It would fit very well as a community Python library for ISE.

@falkowich
Copy link
Owner

I'll check codeexchange out today :)

@falkowich
Copy link
Owner

done :)

@falkowich
Copy link
Owner

  1. A new function for update_device to allow updating a device. This one was complicated to support the variety of update options for a device.

Let me know any questions or requests for tweaks to the PR. I'd love to contribute back into the library for others to take advantage of.

When doing some unittesting i get some inconsistance in update_device. I think that the radius problem is the culprit.

First time I use update_device to change name on the device it changes some values by default.
But the second time and after i get the expected result.

(ise) falk@broekn-home ~/dev/ise (dev ✭ ✔) » python test/temp_update_test.py 
{'NetworkDeviceGroupList': ['Device Type#All Device Types',
                            'Location#All Locations',
                            'IPSEC#Is IPSEC Device#No'],
 'NetworkDeviceIPList': [{'ipaddress': '1.1.1.1', 'mask': '32'}],
 'coaPort': '1700',
 'description': 'test-description',
 'name': 'test-name',
 'profileName': 'Cisco'}

------------ First device_update ------------

{'updatedField': [{'field': 'DtlsRequired', 'newValue': 'false'},
                  {'field': 'AuthenticationSettings.EnableKeyWrap',
                   'newValue': 'false'},
                  {'field': 'Name',
                   'newValue': 'new-test-name',
                   'oldValue': 'test-name'},
                  {'field': 'AuthenticationSettings.NetworkProtocol',
                   'newValue': 'RADIUS'},
                  {'field': 'AuthenticationSettings.KeyInputFormat',
                   'newValue': 'ascii'}]}

------------ Second device_update ------------

{'updatedField': [{'field': 'Name',
                   'newValue': 'test-name',
                   'oldValue': 'new-test-name'}]}

------------ Third device_update ------------

{'updatedField': [{'field': 'Name',
                   'newValue': 'new-test-name',

Is this by design?
The temp_update_test.py is in both master and dev if you want to see for your self?

--
Kind Regards Falk

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants