Skip to content

Commit 1e6376c

Browse files
committed
Add exampele3 with pynautobot
1 parent 3c3060f commit 1e6376c

File tree

7 files changed

+1963
-0
lines changed

7 files changed

+1963
-0
lines changed

examples/example3/README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
2+
# Example 3
3+
4+
This is a simple example to show how DiffSync can be used to compare and synchronize data with a remote system like via a REST API like Nautobot.
5+
6+
For this example, we have a shared model for Region and Country defined in `models.py`.
7+
A Country must be associated with a Region and can be part of a Subregion too.
8+
9+
The comparison and synchronization of dataset is done between a local JSON file and the [public instance of Nautobot](https://demo.nautobot.com).
10+
11+
12+
## Install the requirements
13+
14+
to use this example you must have some dependencies installed, please make sure to run
15+
```
16+
pip install -r requirements.txt
17+
```
18+
19+
## Try the example
20+
21+
The first time a lot of changes should be reported between Nautobot and the local data because by default the demo instance doesn't have the subregion define.
22+
After the first sync, the diff should show no difference.
23+
At this point, Diffsync will be able to identify and fix all changes in Nautobot. You can try to add/update or delete any country in Nautobot and DiffSync will automatically catch it and it will fix it with running in sync mode.
24+
25+
```
26+
### DIFF Compare the data between Nautobot and the local JSON file.
27+
main.py --diff
28+
29+
### SYNC Update the list of country in Nautobot.
30+
main.py --sync
31+
```
32+

0 commit comments

Comments
 (0)