falkowich / pyise-ers Goto Github PK
View Code? Open in Web Editor NEWPython module to manage Cisco ISE via the ERS API
License: GNU General Public License v2.0
Python module to manage Cisco ISE via the ERS API
License: GNU General Public License v2.0
Change "all" output to f-strings.
Attempting to get a list of all network devices (to then enumerate the location for each of them).
But i can't find any information on expanding or even paging the results.
TIA
Hi,
I am having some real life time issues for the moment ™️
Work is taking almost all my "free time" as well.
And there are so many good PR's that has been merged, and many waiting to be merged.
So if anyone out there wish to help out, I would be really thankful.
It would be great to have a core group of maintainers to get this up to speed.
Make it a community project more, with community discussions and descisions.
But one step at a time :)
--
Kind Regards Falk
To fit my usual workflow I will try too replace pipenv with poetry.
get_device_groups should support the filter variable.
Cisco ISE supports contains and ncontains as filters.
Searching for Network Device Groups by name, can only use the 'contains' or 'ncontains' filters
`def get_device_groups(self, filter=None):
"""
Get a list tuples of device groups.
:return:
"""
return self._get_groups(
"{0}/config/networkdevicegroup".format(self.url_base),
filter=filter
)`
Hey,
I’m porting 2.1 to 2.4 - will this work on both?
Update the README.md before the release.
https://developer.cisco.com/docs/identity-services-engine/#!pxgrid-node/approve-node
this would help us with our DNA Workflows project; https://github.com/cunningr/dna_workflows
Create a release to PyPI with 0.3.x
This library doesn't include the timeout attribute when self.ise.get() is called. Timeout is only used for self.ise.request() in the internal _request() function. That function also includes an earlier call to self.ise.get() without a timeout before calling self.ise.request() with a timeout. Thus, the configured timeout seldom has any effect that I have seen.
The argument "timeout=self.timeout" should be added to every self.ise.get() call
Working on this https://github.com/falkowich/pyise-ers/tree/codecov
Clean up docstrings with google or pypy style as guide.
Seems like a regression.
(ise) falk@broekn-home:~/dev/ise$ /home/falk/.local/share/virtualenvs/ise-B3LG4bZL/bin/python /home/falk/dev/ise/test/test_ers.py
{'success': False, 'response': '', 'error': ''} <Response [401]>
<Response [401]>
Traceback (most recent call last):
File "/home/falk/dev/ise/test/test_ers.py", line 187, in <module>
add_endpoint(endpoint)
File "/home/falk/dev/ise/test/test_ers.py", line 24, in add_endpoint
test = ise.add_endpoint(endpoint['name'], endpoint['mac'], endpoint['group-id']) # noqa: E501
File "./ise.py", line 353, in add_endpoint
return ERS._pass_ersresponse(result, resp)
File "./ise.py", line 77, in _pass_ersresponse
print(resp.json())
File "/home/falk/.local/share/virtualenvs/ise-B3LG4bZL/lib/python3.7/site-packages/requests/models.py", line 898, in json
return complexjson.loads(self.text, **kwargs)
File "/usr/lib/python3.7/json/__init__.py", line 348, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.7/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.7/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Hello, I am not sure if this is an issue or not, but I have a need to query around 2000 devices. There seems to be a page/size option that you can specify:
device_list_1 = ise.get_devices(size=20, page=1)['response']
I believe the max size is 100, so to get to 2000, I'd make requests for 20 pages. Is there another mechanism to follow the next page?
For example, using Postman to make a request, I see this at the end of the output:
"nextPage": {
"rel": "next",
"href": "https://x.x.x.x:9060/ers/config/networkdevice?size=45&page=2",
"type": "application/json"
However, in the output of using ise.get request, the output never shows the next page.
Thanks
Tried to do this tonight..
Remembered that it isn't implemented yet.
Method: GET
URI: https://servername:9060/ers/config/endpoint/name/{name}
Create a PyPi package for simple usage.
create test cases with pytest or such.
Hi,
Great module, really helped to bring up the connection.
Need to support bulk endpoint addition, any plans for it ?
Thanks, @falkowich !
(pyise-ers) falk@broekn-home ~/dev/pyise-ers (master ✭ ✗) » pytest --record-mode=rewrite
========================== test session starts =========================
platform linux -- Python 3.7.12, pytest-6.2.5, py-1.10.0, pluggy-1.0.0
rootdir: /home/falk/dev/pyise-ers, configfile: pytest.ini
plugins: cov-3.0.0, recording-0.12.0
collected 188 items
test/test_ise_27.py .............................................................................................. [ 50%]
test/test_ise_30.py F............................................................................................. [100%]
========================= FAILURES =========================
___________________________________________________________________________________________ test_fail_connection_401 ___________________________________________________________________________________________
@pytest.mark.vcr
def test_fail_connection_401(): # noqa D103
r1 = fail_ise.add_endpoint(endpoint["name"], endpoint["mac"], endpoint["group-id"])
assert r1["response"] == "Unauthorized"
E AssertionError: assert '' == 'Unauthorized'
E - Unauthorized
test/test_ise_30.py:50: AssertionError
========================= short test summary info =========================
FAILED test/test_ise_30.py::test_fail_connection_401 - AssertionError: assert '' == 'Unauthorized'
=========================1 failed, 187 passed in 59.39s =========================
Hi,
Thanks for the library, I was going over documentation and found a naive way to do things. I want to improve the performance of what I want to accomplish so wondering if any of you can suggest something. Thank you very much:
I see we could update the metadata affiliated i.e identity group for endpoint by using PUT request, example: https://ciscoisesdk.readthedocs.io/en/latest/_modules/ciscoisesdk/api/v3_1_0/endpoint.html#Endpoint.update_endpoint_by_id
and it works,
After an suggestion to publish this library in the Cisco DevNet community I have started a discussion with Github Support to defork from the original forks. And mpenning had no concerns about that » discussion here
But the libraryname is sadly to generic today to get it published in DevNet, so there if we shall publish it there the repo must change name. Perhaps to something like easy like iselibrary, iselib or suggestions. All the names I can come up with is.. perhaps not so enterprisy. :)
Like SNISEL (SuperNextgenerationISELibrary) :D
Any Ideas about namechange, reponame and such. Pls comment or reach out to me in a DM .
Plan as of 2021-10-20..
--
Regards Falk
Remove the size and page variables for the _get_groups and _get_objects functions and add dynamic pagination in the library itself.
This will avoid users of the library to make duplicate code to paginate the endpoints themselves.
It's even written in the library as a TODO :)
# TODO add dynamic paging?
Hi there,
First, thanks for this great library, it's useful!
After that, I would like to comment that the function "add_device" doesn't work for ISE 3.0. I found that the parameter "dev_group" isn't necessary.
These lines are in https://github.com/falkowich/ise/blob/master/ise.py#L1289, https://github.com/falkowich/ise/blob/master/ise.py#L1305, and https://github.com/falkowich/ise/blob/master/ise.py#L1343.
Regards,
MO.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.