Skip to main content

Cisco Identity Services Engine Platform SDK

Project description

ciscoisesdk is a community developed Python library for working with the Identity Services Engine APIs. Our goal is to make working with Cisco Identity Services Engine in Python a native and natural experience!

from ciscoisesdk import IdentityServicesEngineAPI
from ciscoisesdk.exceptions import ApiError

# Create a IdentityServicesEngineAPI connection object;
# it uses ISE custom URL, username, and password, with ISE API version 3.3_patch_1
# and its API Gateway enabled,
# verify=True to verify the server's TLS certificate
# with debug logs disabled
# and without using the CSRF token
api = IdentityServicesEngineAPI(username='admin',
                                password='C1sco12345',
                                uses_api_gateway=True,
                                base_url='https://198.18.133.27',
                                version='3.3_patch_1',
                                verify=True,
                                debug=False,
                                uses_csrf_token=False)
# NOTE: This collection assumes that the ERS APIs and OpenAPIs are enabled.

# Get allowed protocols (first page)
search_result = api.allowed_protocols.get_all().response.SearchResult
if search_result and search_result.resources:
  for resource in search_result.resources:
    resource_detail = api.allowed_protocols.get_by_id(
                        resource.id
                      ).response.AllowedProtocols
    print("Id {}\nName {}\nallowChap {}\n".format(resource_detail.id,
                                                  resource_detail.name,
                                                  resource_detail.allowChap))
print("----------")

# Handle pagination with a generator
allowed_protols_gen = api.allowed_protocols.get_all_generator()
for allowed_protocols_page_resp in allowed_protols_gen:
  allowed_protols_result = allowed_protocols_page_resp.response.SearchResult
  for resource in allowed_protols_result.resources:
    resource_detail = api.allowed_protocols.get_by_id(
                        resource.id
                      ).response.AllowedProtocols
    print("Id {}\nName {}\nallowChap {}\n".format(resource_detail.id,
                                                  resource_detail.name,
                                                  resource_detail.allowChap))

# Create network device
try:
    network_device_response = api.network_device.create(
                                name='ISE_EST_Local_Host_19',
                                network_device_iplist=[{"ipaddress": "127.35.0.1", "mask": 32}])
    print("Created, new Location {}".format(network_device_response.headers.Location))
except ApiError as e:
    print(e)

# Filter network device
device_list_response = api.network_device.get_all(filter='name.EQ.ISE_EST_Local_Host_19')
device_responses = device_list_response.response.SearchResult.resources
if len(device_responses) > 0:
    device_response = device_responses[0]

    # Get network device detail
    device_response_detail = api.network_device.get_by_id(device_response.id).response.NetworkDevice

# Advance usage example using Custom Caller functions
## Define a Custom caller named function
## Call them with:
##    get_created_result(network_device_response.headers.Location)
def get_created_result(location):
    return api.custom_caller.call_api('GET', location)

## Define the get_created_result function
## under the custom_caller wrapper.
## Call them with:
##    api.custom_caller.get_created_result(network_device_response.headers.Location)
def setup_custom():
    api.custom_caller.add_api('get_created_result',
                                lambda location:
                                api.custom_caller.call_api('GET', location)
                              )

# Add the custom API calls to the connection object under the custom_caller wrapper
setup_custom()

# Call the newly added functions
created_device_1 = get_created_result(network_device_response.headers.Location)
created_device_2 = api.custom_caller.get_created_result(network_device_response.headers.Location)
print(created_device_1.response == created_device_2.response)

if len(device_responses) > 0:
    device_response = device_responses[0]

    # Delete network device
    delete_device = api.network_device.delete_by_id(device_response.id)

Introduction

Installation

Installing and upgrading ciscoisesdk is easy:

Install via PIP

$ pip install ciscoisesdk

Upgrading to the latest Version

$ pip install ciscoisesdk --upgrade

Compatibility matrix

The following table shows the supported versions.

Cisco ISE version

Python “ciscoisesdk” version

3.1.0

1.2.0

3.1_Patch_1

2.0.12

3.2_beta

2.1.2

3.3_patch_1

2.2.3

If your SDK is older please consider updating it first.

Documentation

Excellent documentation is now available at: https://ciscoisesdk.readthedocs.io

Check out the Quickstart to dive in and begin using ciscoisesdk.

Release Notes

Please see the releases page for release notes on the incremental functionality and bug fixes incorporated into the published releases.

Questions, Support & Discussion

ciscoisesdk is a community developed and community supported project. If you experience any issues using this package, please report them using the issues page.

Contribution

ciscoisesdk is a community development projects. Feedback, thoughts, ideas, and code contributions are welcome! Please see the Contributing guide for more information.

Inspiration

This library is inspired by the webexteamssdk library

Change log

All notable changes to this project will be documented in the CHANGELOG file.

The development team may make additional name changes as the library evolves with the ISE APIs.

Copyright (c) 2021 Cisco and/or its affiliates.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ciscoisesdk-2.2.3.tar.gz (2.2 MB view details)

Uploaded Source

Built Distribution

ciscoisesdk-2.2.3-py3-none-any.whl (4.8 MB view details)

Uploaded Python 3

File details

Details for the file ciscoisesdk-2.2.3.tar.gz.

File metadata

  • Download URL: ciscoisesdk-2.2.3.tar.gz
  • Upload date:
  • Size: 2.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.4 Darwin/23.2.0

File hashes

Hashes for ciscoisesdk-2.2.3.tar.gz
Algorithm Hash digest
SHA256 2e96fe31659358d39edfddd1fd802fbf1b5c8b53ca1907b9e55ed7f5ae869793
MD5 84418c4fce562d54bcbfb641283465d3
BLAKE2b-256 b0fd9d62eef3f5cb3aa0956e019872a78c84ebe34c4d1442ebc2df487e04a569

See more details on using hashes here.

File details

Details for the file ciscoisesdk-2.2.3-py3-none-any.whl.

File metadata

  • Download URL: ciscoisesdk-2.2.3-py3-none-any.whl
  • Upload date:
  • Size: 4.8 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.4 Darwin/23.2.0

File hashes

Hashes for ciscoisesdk-2.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 cefcfd86e541bd56129b9a25ddd3d70727ff13e4cb49f9c8b63e2fcfbd0011ee
MD5 658c335792f051494ec5fa9db6f1af2c
BLAKE2b-256 b215e6b783afc2d4f2a9226697ed421b262a30111f589d4e46cbb7cb38e9d9bc

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page