Skip to content

Commit 8f53236

Browse files
authored
Merge pull request #66 from opsmill/bkr-update-python-packages-2025-03-04
Add flags to Config, Params to REST API and some misc tasks
2 parents 1eb9a19 + 1d829d9 commit 8f53236

File tree

37 files changed

+874
-513
lines changed

37 files changed

+874
-513
lines changed

docs/docs/adapters/ipfabric.mdx

Lines changed: 16 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,22 @@ A network model of gathered data reconstructs the topologies for each switching
1313

1414
Dependencies and dependents are calculated for each network element, allowing analysis to represent each aspect of the network in the context of productivity impact on downstream hosts and network devices. The immediate productivity impact of performance and capacity is also calculated for each user and every element.
1515

16-
## Sync direction
16+
## Requirements
1717

18-
IP Fabric → Infrahub
18+
This Adapter uses [IP Fabric SDK](https://pypi.org/project/ipfabric).
19+
You will need to install it beforehand.
20+
21+
## Sync directions supported
22+
23+
- IP Fabric → Infrahub
24+
25+
:::info
1926

20-
:::note
2127
Currently, the IP Fabric adapter supports only **one-way synchronization** from IP Fabric to Infrahub.
2228
Syncing data back into IP Fabric is not yet supported.
2329

2430
Although IP Fabric data cannot be edited, additional information such as **`Device Attributes`** and **`Site Separation`** rules can be updated from Infrahub data.
31+
2532
:::
2633

2734
## Schema
@@ -35,7 +42,7 @@ This schema follows best practices for Infrahub, **but it does not map the IP Fa
3542

3643
To install the example schema into Infrahub, follow these steps:
3744

38-
```shell
45+
```bash
3946
mkdir ipfabric-sync
4047
cd ipfabric-sync
4148
curl -o schema.yml https://raw.githubusercontent.com/opsmill/infrahub/refs/heads/stable/models/examples/ipfabric/ipfabric.yml
@@ -50,7 +57,7 @@ infrahubctl schema load schema.yml
5057

5158
To download the example `config.yml`
5259

53-
```shell
60+
```bash
5461
curl https://raw.githubusercontent.com/opsmill/infrahub-sync/refs/heads/main/examples/ipfabric_to_infrahub/config.yml > config.yml
5562
```
5663

@@ -78,8 +85,8 @@ source:
7885
The configuration file allows mapping tables from IP Fabric into Infrahub models.
7986
Below is an example showing how to:
8087
81-
- Set the destination model (`InfraDevice`)
82-
- Map source data from IP Fabric’s `tables/inventory/devices`
88+
- Set the destination Infrahub model (`InfraDevice`)
89+
- Map source data from IP Fabric’s Path (`tables/inventory/devices`)
8390
- Specify field mappings between IP Fabric and Infrahub models
8491

8592
```yaml
@@ -110,34 +117,5 @@ schema_mapping:
110117
reference: InfraNOSVersion
111118
```
112119

113-
This configuration specifies:
114-
115-
- The destination model is `InfraDevice`.
116-
- The source table being synced from IP Fabric is `tables/inventory/devices`.
117-
- The table URI can be found by selecting `Table Description` in any IP Fabric table and copying everything after the version in the URL description.
118-
119-
For more details, refer to the [IP Fabric API Docs](https://docs.ipfabric.io/latest/IP_Fabric_API/?h=api+doc#technology-table-endpoints).
120-
121-
#### Important notes
122-
123-
- The `name` key in the destination model corresponds to the Infrahub attribute.
124-
- The `mapping` key in the destination model corresponds to the key in the IP Fabric payload to use.
125-
- If `reference` is used, it links to a model that has been synchronized prior to this model.
126-
127-
## Generating the models
128-
129-
`infrahub-sync` relies on additional Python files, but these can be generated automatically from `config.yml`.
130-
131-
To generate the necessary models, run:
132-
133-
```shell
134-
infrahub-sync generate --name from-ipfabric --directory ipfabric-sync
135-
```
136-
137-
## Running the sync
138-
139-
To synchronize data from IP Fabric to Infrahub, use the following command:
140-
141-
```shell
142-
infrahub-sync sync --name from-ipfabric --directory ipfabric-sync
143-
```
120+
The table URI can be found by selecting `Table Description` in any IP Fabric table and copying everything after the version in the URL description.
121+
For more details regarding, refer to the [IP Fabric API Docs](https://docs.ipfabric.io/latest/IP_Fabric_API/?h=api+doc#technology-table-endpoints).

docs/docs/adapters/librenms.mdx

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
title: LibreNMS adapter
3+
---
4+
5+
import ReferenceLink from "../../src/components/Card";
6+
import Tabs from '@theme/Tabs';
7+
import TabItem from '@theme/TabItem';
8+
9+
<!-- vale off -->
10+
## What is LibreNMS?
11+
<!-- vale on -->
12+
13+
LibreNMS is an open-source network monitoring system that automatically discovers, monitors, and alerts on your network devices using pre-configured setups, providing comprehensive insights for proactive network management.
14+
15+
## Sync directions supported
16+
17+
- LibreNMS Infrahub
18+
19+
:::info
20+
21+
Currently, the LibreNMS adapter supports only **one-way synchronization** from LibreNMS to Infrahub.
22+
Syncing data back into LibreNMS is not yet supported.
23+
24+
:::
25+
26+
:::warning Under Construction
27+
:::

docs/docs/adapters/nautobot.mdx

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
---
2+
title: Nautobot adapter
3+
---
4+
5+
import ReferenceLink from "../../src/components/Card";
6+
import Tabs from '@theme/Tabs';
7+
import TabItem from '@theme/TabItem';
8+
9+
<!-- vale off -->
10+
## What is Nautobot?
11+
<!-- vale on -->
12+
13+
Nautobot is an open-source network source of truth and automation platform, offering extended customization, plugin support, and enhanced functionality to simplify network documentation and operations.
14+
15+
## Requirements
16+
17+
This Adapter uses [Nautobot SDK](https://pypi.org/project/pynautobot).
18+
You will need to install it beforehand.
19+
20+
## Sync directions supported
21+
22+
- Nautobot Infrahub
23+
24+
:::info
25+
26+
Currently, the Nautobot adapter supports only **one-way synchronization** from Nautobot to Infrahub.
27+
Syncing data back into Nautobot is not yet supported.
28+
29+
## Schema
30+
31+
Our `infrahub` repository contains an **example schema** that serves as a starting point for syncing Nautobot data into Infrahub.
32+
This schema follows best practices for Infrahub, **but it does not map the Nautobot data model one-to-one** since Infrahub may have additional use cases.
33+
34+
To reflect the breaking changes introduced in Nautobot v2, there is not one but two schemas. You can explore them to see the difference.
35+
36+
<Tabs>
37+
<TabItem value="Nautobot v1">
38+
<ReferenceLink title="Schema V1" url="https://github.com/opsmill/infrahub/blob/stable/models/examples/nautobot/nautobot-v1.yml" openInNewTab />
39+
</TabItem>
40+
<TabItem value="Nautobot v2">
41+
<ReferenceLink title="Schema V2" url="https://github.com/opsmill/infrahub/blob/stable/models/examples/nautobot/nautobot-v2.yml" openInNewTab />
42+
</TabItem>
43+
</Tabs>
44+
45+
### Installing the example schema
46+
47+
To install the example schema into Infrahub, follow these steps:
48+
49+
<Tabs>
50+
<TabItem value="Nautobot v1">
51+
52+
```bash
53+
mkdir nautobot-sync
54+
cd nautobot-sync
55+
curl -o schema.yml https://raw.githubusercontent.com/opsmill/infrahub/refs/heads/stable/models/examples/nautobot/nautobot-v1.yml
56+
infrahubctl schema load schema.yml
57+
```
58+
59+
</TabItem>
60+
<TabItem value="Nautobot v2">
61+
62+
```bash
63+
mkdir nautobot-sync
64+
cd nautobot-sync
65+
curl -o schema.yml https://raw.githubusercontent.com/opsmill/infrahub/refs/heads/stable/models/examples/nautobot/nautobot-v2.yml
66+
infrahubctl schema load schema.yml
67+
```
68+
69+
</TabItem>
70+
</Tabs>
71+
72+
## Configuration
73+
74+
`infrahub-sync` allows defining what gets synchronized from a source to a destination. Included in the examples is a config.yml file that matches the example schema.
75+
76+
<Tabs>
77+
<TabItem value="Nautobot v1">
78+
<ReferenceLink title="config.yml" url="https://github.com/opsmill/infrahub-sync/blob/main/examples/nautobot-v1_to_infrahub/config.yml" openInNewTab />
79+
</TabItem>
80+
<TabItem value="Nautobot v2">
81+
<ReferenceLink title="config.yml" url="https://github.com/opsmill/infrahub-sync/blob/main/examples/nautobot-v2_to_infrahub/config.yml" openInNewTab />
82+
</TabItem>
83+
</Tabs>
84+
85+
To download the example `config.yml`
86+
87+
<Tabs>
88+
<TabItem value="Nautobot v1">
89+
90+
```bash
91+
curl https://raw.githubusercontent.com/opsmill/infrahub-sync/refs/heads/main/examples/nautobot-v1_to_infrahub/config.yml > config.yml
92+
```
93+
94+
</TabItem>
95+
<TabItem value="Nautobot v2">
96+
97+
```bash
98+
curl https://raw.githubusercontent.com/opsmill/infrahub-sync/refs/heads/main/examples/nautobot-v2_to_infrahub/config.yml > config.yml
99+
```
100+
101+
</TabItem>
102+
</Tabs>
103+
104+
### Configuration parameters
105+
106+
The configuration file allows mapping Nautobot data to the Infrahub schema, which has been designed to loosely align with the Nautobot data model.
107+
Below is an example showing how to:
108+
109+
- Set the destination Infrahub model (`OrganizationGeneric` and `InfraPlatform`)
110+
- Map source data from Nautobot (`dcim.manufacturers`, and `dcim.platforms`)
111+
- Specify field mappings between Nautobot and Infrahub models
112+
113+
As you can see in this example, we can map several paths to the same Infrahub Model.
114+
115+
```yaml
116+
- name: OrganizationGeneric
117+
mapping: dcim.manufacturers
118+
identifiers: ["name"]
119+
fields:
120+
- name: name
121+
mapping: name
122+
- name: description
123+
mapping: description
124+
- name: type
125+
static: "Manufacturer"
126+
127+
- name: InfraPlatform
128+
mapping: dcim.platforms
129+
identifiers: ["name", "manufacturer"]
130+
fields:
131+
- name: name
132+
mapping: name
133+
- name: description
134+
mapping: description
135+
- name: napalm_driver
136+
mapping: napalm_driver
137+
- name: manufacturer
138+
mapping: manufacturer
139+
reference: OrganizationGeneric
140+
```
141+
142+
The models available on Nautobot can be find in the `/api/schema/swagger-ui` of your instance.
143+
144+
<ReferenceLink title="Nautobot API Docs" url="https://demo.nautobot.com/api/docs" openInNewTab />

docs/docs/adapters/netbox.mdx

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
---
2+
title: NetBox adapter
3+
---
4+
5+
import ReferenceLink from "../../src/components/Card";
6+
import Tabs from '@theme/Tabs';
7+
import TabItem from '@theme/TabItem';
8+
9+
<!-- vale off -->
10+
## What is NetBox?
11+
<!-- vale on -->
12+
13+
NetBox is an open-source infrastructure resource management tool that centralizes and documents your network's devices, IP addresses, circuits, and connections using pre-configured models and automation for streamlined operations.
14+
15+
## Requirements
16+
17+
This Adapter uses [Netbox SDK](https://pypi.org/project/pynetbox).
18+
You will need to install it beforehand.
19+
20+
## Sync directions supported
21+
22+
- NetBox Infrahub
23+
24+
:::info
25+
26+
Currently, the Netbox adapter supports only **one-way synchronization** from Netbox to Infrahub.
27+
Syncing data back into Netbox is not yet supported.
28+
29+
### Configuration parameters
30+
31+
:::
32+
33+
## Schema
34+
35+
Our `infrahub` repository contains an **example schema** that serves as a starting point for syncing Netbox data into Infrahub.
36+
This schema follows best practices for Infrahub, **but it does not map the Netbox data model one-to-one** since Infrahub may have additional use cases.
37+
38+
<ReferenceLink title="Schema" url="https://github.com/opsmill/infrahub/blob/stable/models/examples/netbox/netbox.yml" openInNewTab />
39+
40+
### Installing the example schema
41+
42+
To install the example schema into Infrahub, follow these steps:
43+
44+
```bash
45+
mkdir netbox-sync
46+
cd netbox-sync
47+
curl -o schema.yml https://raw.githubusercontent.com/opsmill/infrahub/refs/heads/stable/models/examples/netbox/netbox.yml
48+
infrahubctl schema load schema.yml
49+
```
50+
51+
## Configuration
52+
53+
`infrahub-sync` allows defining what gets synchronized from a source to a destination. Included in the examples is a config.yml file that matches the example schema.
54+
55+
<ReferenceLink title="config.yml" url="https://github.com/opsmill/infrahub-sync/blob/main/examples/netbox_to_infrahub/config.yml" openInNewTab />
56+
57+
To download the example `config.yml`
58+
59+
```bash
60+
curl https://raw.githubusercontent.com/opsmill/infrahub-sync/refs/heads/main/examples/netbox_to_infrahub/config.yml > config.yml
61+
```
62+
63+
### Configuration parameters
64+
65+
The configuration file allows mapping Netbox data to the Infrahub schema, which has been designed to loosely align with the Netbox data model.
66+
Below is an example showing how to:
67+
68+
- Set the destination Infrahub model (`BuiltinTag` and `LocationGeneric`)
69+
- Map source data from Netbox (`extras.tags`, `dcim.regions`, and `dcim.sites`)
70+
- Specify field mappings between Netbox and Infrahub models
71+
72+
As you can see in this example, we can map several paths to the same Infrahub Model.
73+
74+
```yaml
75+
- name: BuiltinTag
76+
mapping: extras.tags
77+
identifiers: ["name"]
78+
fields:
79+
- name: name
80+
mapping: name
81+
- name: description
82+
mapping: description
83+
84+
- name: LocationGeneric
85+
mapping: dcim.regions
86+
fields:
87+
- name: name
88+
mapping: slug
89+
- name: description
90+
mapping: name
91+
- name: type
92+
static: "Region"
93+
- name: tags
94+
mapping: tags
95+
reference: BuiltinTag
96+
97+
- name: LocationGeneric
98+
mapping: dcim.sites
99+
fields:
100+
- name: name
101+
mapping: slug
102+
- name: description
103+
mapping: name
104+
- name: type
105+
static: "Site"
106+
- name: tags
107+
mapping: tags
108+
reference: BuiltinTag
109+
```
110+
111+
The models available on Netbox can be find in the `/api/schema/swagger-ui` of your instance.
112+
113+
<ReferenceLink title="Netbox API Swagger" url="https://demo.netbox.dev/api/schema/swagger-ui" openInNewTab />

0 commit comments

Comments
 (0)