ipfabric


Nameipfabric JSON
Version 7.2.2 PyPI version JSON
download
home_pagehttps://gitlab.com/ip-fabric/integrations/python-ipfabric
SummaryPython package for interacting with IP Fabric
upload_time2025-07-08 14:43:38
maintainerNone
docs_urlNone
authorSolution Architecture
requires_python<4.0,>=3.9
licenseMIT
keywords ipfabric ip-fabric community-fabric
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # IP Fabric 

IPFabric is a Python module for connecting to and communicating against an IP Fabric instance.

***For full documentation please see [IP Fabric Documentation Portal](https://docs.ipfabric.io/main/integrations/python/).***

## IP Fabric

[IP Fabric](https://ipfabric.io) is a vendor-neutral network assurance platform that automates the 
holistic discovery, verification, visualization, and documentation of 
large-scale enterprise networks, reducing the associated costs and required 
resources whilst improving security and efficiency.

It supports your engineering and operations teams, underpinning migration and 
transformation projects. IP Fabric will revolutionize how you approach network 
visibility and assurance, security assurance, automation, multi-cloud 
networking, and trouble resolution.

**Integrations or scripts should not be installed directly on the IP Fabric VM unless directly communicated from the
IP Fabric Support or Solution Architect teams.  Any action on the Command-Line Interface (CLI) using the root, osadmin,
or autoboss account may cause irreversible, detrimental changes to the product and can render the system unusable.**

## Bugs

A bug has been identified when ~2,000 requests are being made to the API.  The underlining issue seems to be with the
implementation of `http2`. The workaround is to set `http2=False` in the `IPFClient` class.  Example error:

`httpx.RemoteProtocolError: <ConnectionTerminated error_code:ErrorCodes.NO_ERROR, last_stream_id:1999, additional_data:None>`

## Upcoming Deprecation Notices

### v7.2.x

**In `ipfabric>=v7.2.x` Python 3.8 will be removed as a supported version as it is now 
[End of Life](https://devguide.python.org/versions/) as of 2024-10-07.**

Some changes to Vendor API models have been implemented in order for being able to model all settings.

### v7.3.x

#### Login IP Column Change

**In `ipfabric>=v7.3.x` new columns `loginIpv4` and `loginIpv6` have been introduced to replace `loginIp`.**

* Inventory > Devices: `tables/inventory/devices`
* Discovery Snapshot > Connectivity Report: `tables/reports/discovery-tasks`
* Management > Discovery History: `tables/inventory/discovery-history`
* Management > Changes: 
  * `tables/management/changes/devices`
  * `tables/management/changes/managed-devs`
* Management > Saved Config Consistency: `tables/management/configuration/saved`
* Technology > Management > Telnet access: `tables/security/enabled-telnet`

SDK Device Model will be updated to reflect this change and will include the following properties:

* `login_ipv4` - Python `ipaddress.IPv4Address` object.
* `login_ipv6` - Python `ipaddress.IPv6Address` object.
* `login_ip` - No change until the next major release.


### v7.5.x

#### Restore Intents
With the introduction of the IP Fabric **Configuration Import/Export** Feature in version `7.2` 
`ipfabric.tools.restore_intents.RestoreIntents()` will be removed.  Please utilize the new 
`IPFClient().settings.appliance_configuration` methods.

### v8.0.x

#### Moved Models

The following Models have moved and old locations removed in 8.0:

* `ipfabric.settings.vendor_api_models.*` -> `ipfabric.models.vendor_api`
* `ipfabric.settings.discovery.Networks` -> `ipfabric.models.discovery.Networks`
* `ipfabric.settings.seeds.SeedList` -> `ipfabric.models.discovery.SeedList`
* `ipfabric.settings.authentication.[Credential, CredentialList, Privilege, PrivilegeList]` -> `ipfabric.models.authentication`

#### Login IP Columns Removed

**In `ipfabric>=v7.3.x` column `loginIp` was replaced with `loginIpv4` and `loginIpv6` and in `v8.0.x` it will be removed.**

The current `loginIp` column are removed from these tables:

* Inventory > Devices: `tables/inventory/devices`
* Discovery Snapshot > Connectivity Report: `tables/reports/discovery-tasks`
* Management > Discovery History: `tables/inventory/discovery-history`
* Management > Changes: 
  * `tables/management/changes/devices`
  * `tables/management/changes/managed-devs`
* Management > Saved Config Consistency: `tables/management/configuration/saved`
* Technology > Management > Telnet access: `tables/security/enabled-telnet`

**SDK Device Model `login_ip` will be replaced with by returning `login_ipv4` or the `login_ipv6` property.  Previously 
it was a Python `ipaddress.IPv4Interface` object but now will return `ipaddress.IPv4Address` or `ipaddress.IPv6Address`.**


## Versioning

Semantic Versioning: `Major.Minor.Patch`

Starting with IP Fabric version 5.0.x the `ipfabric` SDK is recommended to match your IP Fabric major and minor version.  
We will try to keep some backwards compatability (SDK version `6.9.x` should work with IP Fabric API `6.8`) however new 
features may break some functionality.  By ensuring that your `ipfabric` SDK's match your IP Fabric major and minor  
version will ensure compatibility and will continue to work.

The Patch version of the SDK is used for bug fixes and new features that are compatible with the major and minor version.

## Defaulted to Streaming Data

See [Notices](NOTICES.md) for full information.

* GET URL is limited to 4096 characters.
  * Complex queries and filters could go over this limit; however in testing it was very difficult to reach this.
* CSV Export
  * Only supported with a streaming GET request and return a bytes string of data in the Python SDK.
  * It will also convert times to human-readable format.
  * **`reports` (returning Intent Check data) is not supported with CSV export, however is required when filtering based on Intents (colors).**

```python
from ipfabric import IPFClient
ipf = IPFClient(streaming=True)

dev = ipf.inventory.devices.all()
print(type(dev))  # list 

dev_csv = ipf.fetch_all('tables/inventory/devices', export='csv')
print(type(dev_csv))  # bytes 

# Timezone can be changed for CSV export; see `ipfabric.tools.shared.TIMEZONES`
dev_csv_tz = ipf.inventory.devices.all(export='csv', csv_tz='UTC')

# If specifying to return reports and CSV request will drop reports input and use GET
dev_csv_reports = ipf.fetch_all('tables/inventory/devices', reports=True, export='csv')
"""CSV export does not return reports, parameter has been excluded."""
print(type(dev_csv_reports))  # bytes

# If URL exceeds 4096 characters the following exception will be raised:
# raise InvalidURL(f"URL exceeds max character limit of 4096: length={len(url)}.")
```

## Installation

```
pip install ipfabric
```

To use `export='df'` on some methods please install `pandas` with `ipfabric`

```
pip install ipfabric[pd]
```

## Introduction

Please take a look at [API Programmability - Part 1: The Basics](https://ipfabric.io/blog/api-programmability-part-1/)
for instructions on creating an API token.

Most of the methods and features can be located in [Examples](examples) to show how to use this package. 
Another great introduction to this package can be found at [API Programmability - Part 2: Python](https://ipfabric.io/blog/api-programmability-python/)

## Authentication

### Username/Password

Supply in client:
```python
from ipfabric import IPFClient
ipf = IPFClient('https://demo3.ipfabric.io/', auth=('user', 'pass'))
```

### Token

```python
from ipfabric import IPFClient
ipf = IPFClient('https://demo3.ipfabric.io/', auth='token')
```

### Environment 

The easiest way to use this package is with a `.env` file.  You can copy the sample and edit it with your environment variables. 

```commandline
cp sample.env .env
```

This contains the following variables which can also be set as environment variables instead of a .env file.
```
IPF_URL="https://demo3.ipfabric.io"
IPF_TOKEN=TOKEN
IPF_VERIFY=true
```

Or if using Username/Password:
```
IPF_URL="https://demo3.ipfabric.io"
IPF_USERNAME=USER
IPF_PASSWORD=PASS
```

## Development

### Poetry Installation

IPFabric uses [Poetry](https://pypi.org/project/poetry/) to make setting up a virtual environment with all dependencies
installed quick and easy.

Install poetry globally:
```
pip install poetry
```

To install a virtual environment run the following command in the root of this directory.

```
poetry install
```

To run examples, install extras:
```
poetry install ipfabric -E examples
```

### Test and Build

```
poetry run pytest
poetry build
```

Prior to pushing changes run:
```
poetry run black ipfabric
poetry update
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://gitlab.com/ip-fabric/integrations/python-ipfabric",
    "name": "ipfabric",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.9",
    "maintainer_email": null,
    "keywords": "ipfabric, ip-fabric, community-fabric",
    "author": "Solution Architecture",
    "author_email": "solution.architecture@ipfabric.io",
    "download_url": "https://files.pythonhosted.org/packages/61/1b/fe6310c61e4defed7b7edd7ab8188e9174dad0607a5e684ae632045be49f/ipfabric-7.2.2.tar.gz",
    "platform": null,
    "description": "# IP Fabric \n\nIPFabric is a Python module for connecting to and communicating against an IP Fabric instance.\n\n***For full documentation please see [IP Fabric Documentation Portal](https://docs.ipfabric.io/main/integrations/python/).***\n\n## IP Fabric\n\n[IP Fabric](https://ipfabric.io) is a vendor-neutral network assurance platform that automates the \nholistic discovery, verification, visualization, and documentation of \nlarge-scale enterprise networks, reducing the associated costs and required \nresources whilst improving security and efficiency.\n\nIt supports your engineering and operations teams, underpinning migration and \ntransformation projects. IP Fabric will revolutionize how you approach network \nvisibility and assurance, security assurance, automation, multi-cloud \nnetworking, and trouble resolution.\n\n**Integrations or scripts should not be installed directly on the IP Fabric VM unless directly communicated from the\nIP Fabric Support or Solution Architect teams.  Any action on the Command-Line Interface (CLI) using the root, osadmin,\nor autoboss account may cause irreversible, detrimental changes to the product and can render the system unusable.**\n\n## Bugs\n\nA bug has been identified when ~2,000 requests are being made to the API.  The underlining issue seems to be with the\nimplementation of `http2`. The workaround is to set `http2=False` in the `IPFClient` class.  Example error:\n\n`httpx.RemoteProtocolError: <ConnectionTerminated error_code:ErrorCodes.NO_ERROR, last_stream_id:1999, additional_data:None>`\n\n## Upcoming Deprecation Notices\n\n### v7.2.x\n\n**In `ipfabric>=v7.2.x` Python 3.8 will be removed as a supported version as it is now \n[End of Life](https://devguide.python.org/versions/) as of 2024-10-07.**\n\nSome changes to Vendor API models have been implemented in order for being able to model all settings.\n\n### v7.3.x\n\n#### Login IP Column Change\n\n**In `ipfabric>=v7.3.x` new columns `loginIpv4` and `loginIpv6` have been introduced to replace `loginIp`.**\n\n* Inventory > Devices: `tables/inventory/devices`\n* Discovery Snapshot > Connectivity Report: `tables/reports/discovery-tasks`\n* Management > Discovery History: `tables/inventory/discovery-history`\n* Management > Changes: \n  * `tables/management/changes/devices`\n  * `tables/management/changes/managed-devs`\n* Management > Saved Config Consistency: `tables/management/configuration/saved`\n* Technology > Management > Telnet access: `tables/security/enabled-telnet`\n\nSDK Device Model will be updated to reflect this change and will include the following properties:\n\n* `login_ipv4` - Python `ipaddress.IPv4Address` object.\n* `login_ipv6` - Python `ipaddress.IPv6Address` object.\n* `login_ip` - No change until the next major release.\n\n\n### v7.5.x\n\n#### Restore Intents\nWith the introduction of the IP Fabric **Configuration Import/Export** Feature in version `7.2` \n`ipfabric.tools.restore_intents.RestoreIntents()` will be removed.  Please utilize the new \n`IPFClient().settings.appliance_configuration` methods.\n\n### v8.0.x\n\n#### Moved Models\n\nThe following Models have moved and old locations removed in 8.0:\n\n* `ipfabric.settings.vendor_api_models.*` -> `ipfabric.models.vendor_api`\n* `ipfabric.settings.discovery.Networks` -> `ipfabric.models.discovery.Networks`\n* `ipfabric.settings.seeds.SeedList` -> `ipfabric.models.discovery.SeedList`\n* `ipfabric.settings.authentication.[Credential, CredentialList, Privilege, PrivilegeList]` -> `ipfabric.models.authentication`\n\n#### Login IP Columns Removed\n\n**In `ipfabric>=v7.3.x` column `loginIp` was replaced with `loginIpv4` and `loginIpv6` and in `v8.0.x` it will be removed.**\n\nThe current `loginIp` column are removed from these tables:\n\n* Inventory > Devices: `tables/inventory/devices`\n* Discovery Snapshot > Connectivity Report: `tables/reports/discovery-tasks`\n* Management > Discovery History: `tables/inventory/discovery-history`\n* Management > Changes: \n  * `tables/management/changes/devices`\n  * `tables/management/changes/managed-devs`\n* Management > Saved Config Consistency: `tables/management/configuration/saved`\n* Technology > Management > Telnet access: `tables/security/enabled-telnet`\n\n**SDK Device Model `login_ip` will be replaced with by returning `login_ipv4` or the `login_ipv6` property.  Previously \nit was a Python `ipaddress.IPv4Interface` object but now will return `ipaddress.IPv4Address` or `ipaddress.IPv6Address`.**\n\n\n## Versioning\n\nSemantic Versioning: `Major.Minor.Patch`\n\nStarting with IP Fabric version 5.0.x the `ipfabric` SDK is recommended to match your IP Fabric major and minor version.  \nWe will try to keep some backwards compatability (SDK version `6.9.x` should work with IP Fabric API `6.8`) however new \nfeatures may break some functionality.  By ensuring that your `ipfabric` SDK's match your IP Fabric major and minor  \nversion will ensure compatibility and will continue to work.\n\nThe Patch version of the SDK is used for bug fixes and new features that are compatible with the major and minor version.\n\n## Defaulted to Streaming Data\n\nSee [Notices](NOTICES.md) for full information.\n\n* GET URL is limited to 4096 characters.\n  * Complex queries and filters could go over this limit; however in testing it was very difficult to reach this.\n* CSV Export\n  * Only supported with a streaming GET request and return a bytes string of data in the Python SDK.\n  * It will also convert times to human-readable format.\n  * **`reports` (returning Intent Check data) is not supported with CSV export, however is required when filtering based on Intents (colors).**\n\n```python\nfrom ipfabric import IPFClient\nipf = IPFClient(streaming=True)\n\ndev = ipf.inventory.devices.all()\nprint(type(dev))  # list \n\ndev_csv = ipf.fetch_all('tables/inventory/devices', export='csv')\nprint(type(dev_csv))  # bytes \n\n# Timezone can be changed for CSV export; see `ipfabric.tools.shared.TIMEZONES`\ndev_csv_tz = ipf.inventory.devices.all(export='csv', csv_tz='UTC')\n\n# If specifying to return reports and CSV request will drop reports input and use GET\ndev_csv_reports = ipf.fetch_all('tables/inventory/devices', reports=True, export='csv')\n\"\"\"CSV export does not return reports, parameter has been excluded.\"\"\"\nprint(type(dev_csv_reports))  # bytes\n\n# If URL exceeds 4096 characters the following exception will be raised:\n# raise InvalidURL(f\"URL exceeds max character limit of 4096: length={len(url)}.\")\n```\n\n## Installation\n\n```\npip install ipfabric\n```\n\nTo use `export='df'` on some methods please install `pandas` with `ipfabric`\n\n```\npip install ipfabric[pd]\n```\n\n## Introduction\n\nPlease take a look at [API Programmability - Part 1: The Basics](https://ipfabric.io/blog/api-programmability-part-1/)\nfor instructions on creating an API token.\n\nMost of the methods and features can be located in [Examples](examples) to show how to use this package. \nAnother great introduction to this package can be found at [API Programmability - Part 2: Python](https://ipfabric.io/blog/api-programmability-python/)\n\n## Authentication\n\n### Username/Password\n\nSupply in client:\n```python\nfrom ipfabric import IPFClient\nipf = IPFClient('https://demo3.ipfabric.io/', auth=('user', 'pass'))\n```\n\n### Token\n\n```python\nfrom ipfabric import IPFClient\nipf = IPFClient('https://demo3.ipfabric.io/', auth='token')\n```\n\n### Environment \n\nThe easiest way to use this package is with a `.env` file.  You can copy the sample and edit it with your environment variables. \n\n```commandline\ncp sample.env .env\n```\n\nThis contains the following variables which can also be set as environment variables instead of a .env file.\n```\nIPF_URL=\"https://demo3.ipfabric.io\"\nIPF_TOKEN=TOKEN\nIPF_VERIFY=true\n```\n\nOr if using Username/Password:\n```\nIPF_URL=\"https://demo3.ipfabric.io\"\nIPF_USERNAME=USER\nIPF_PASSWORD=PASS\n```\n\n## Development\n\n### Poetry Installation\n\nIPFabric uses [Poetry](https://pypi.org/project/poetry/) to make setting up a virtual environment with all dependencies\ninstalled quick and easy.\n\nInstall poetry globally:\n```\npip install poetry\n```\n\nTo install a virtual environment run the following command in the root of this directory.\n\n```\npoetry install\n```\n\nTo run examples, install extras:\n```\npoetry install ipfabric -E examples\n```\n\n### Test and Build\n\n```\npoetry run pytest\npoetry build\n```\n\nPrior to pushing changes run:\n```\npoetry run black ipfabric\npoetry update\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Python package for interacting with IP Fabric",
    "version": "7.2.2",
    "project_urls": {
        "Changelog": "https://gitlab.com/ip-fabric/integrations/python-ipfabric/-/blob/main/CHANGELOG.md",
        "Homepage": "https://gitlab.com/ip-fabric/integrations/python-ipfabric",
        "IP Fabric": "https://ipfabric.io/",
        "Repository": "https://gitlab.com/ip-fabric/integrations/python-ipfabric"
    },
    "split_keywords": [
        "ipfabric",
        " ip-fabric",
        " community-fabric"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "75e2066d2e90b8a18acf079c86c77644cc5604722b7f57c5873cf590ae5c2b5c",
                "md5": "ee1433487be3d7900c712152520792fb",
                "sha256": "36c8633e38a1bcb57d8c55e124d644244bf0f145ce24abfd44fd19ee519f4416"
            },
            "downloads": -1,
            "filename": "ipfabric-7.2.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ee1433487be3d7900c712152520792fb",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.9",
            "size": 352456,
            "upload_time": "2025-07-08T14:43:35",
            "upload_time_iso_8601": "2025-07-08T14:43:35.843658Z",
            "url": "https://files.pythonhosted.org/packages/75/e2/066d2e90b8a18acf079c86c77644cc5604722b7f57c5873cf590ae5c2b5c/ipfabric-7.2.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "611bfe6310c61e4defed7b7edd7ab8188e9174dad0607a5e684ae632045be49f",
                "md5": "fdb9a61f5e56a71c2ad48d80112c7ed0",
                "sha256": "10190350d64cc8b8dc13af7b058336de660866bb9e8ed790df67382d4c634f63"
            },
            "downloads": -1,
            "filename": "ipfabric-7.2.2.tar.gz",
            "has_sig": false,
            "md5_digest": "fdb9a61f5e56a71c2ad48d80112c7ed0",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.9",
            "size": 310487,
            "upload_time": "2025-07-08T14:43:38",
            "upload_time_iso_8601": "2025-07-08T14:43:38.193597Z",
            "url": "https://files.pythonhosted.org/packages/61/1b/fe6310c61e4defed7b7edd7ab8188e9174dad0607a5e684ae632045be49f/ipfabric-7.2.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-08 14:43:38",
    "github": false,
    "gitlab": true,
    "bitbucket": false,
    "codeberg": false,
    "gitlab_user": "ip-fabric",
    "gitlab_project": "integrations",
    "lcname": "ipfabric"
}
        
Elapsed time: 0.48298s