10.Introduction to Design Builder
Nikos Kallergis
51 steps
3 minutes
Localhost
1
In the VSCode instance with the git repo, expand on the "jobs" folder
2
Open "simple"
3
Click "__init__.py"
4
Here you may see the structure for a very simple Design Job with a single input: "manufacturer"
5
Let's take a look into the nested "designs" folder now...
6
Double-click "0000_simpledesign.yaml.j2"
7
This is probably the simplest design possible. It will only create a Manufacturer object in Nautobot using the user input from before
8
To deploy this design, click "Jobs"
9
Click "Jobs"
10
Click here.
11
Click the "New manufacturer name" field.
12
Type "Cisco"
13
Click "Run Job Now"
14
You may see that the manufacturer was created. Click on its name to see it in more detail
15
Here it is! What if we run the design again though? To find out what happens, click "Jobs"
16
Click here.
17
Click the "New manufacturer name" field.
18
Type "Cisco" again
19
Click "Run Job Now"
20
As you see, an error occurs: "Manufacturer with this Name already exists."
21
To make the design idempotent, prepend the name of the manufacturer with "!create_or_update:name"
22
Save your changes and go to Source Control
23
Type a commit message and click on the "Commit" button
24
Click "Sync Changes"
25
Back in Nautobot, click "Extensibility"
26
Click "Git Repositories"
27
Click here to sync the repo changes
28
Click "Jobs"
29
Click "Jobs"
30
Click here.
31
Click the "New manufacturer name" field.
32
Type "Cisco"
33
Click "Run Job Now"
34
As you can see, the design was successfully deployed in an idempotent manner
35
Let's add some more stuff to our design. What about a platform for our manufacturer? You may see here that, using the dunder, we can dig into nested attributes
36
Before committing our changes, let's see what Jinja2 can do for us here. Imagine that I want three sites in Athens, under Region Greece. Sure, I could add them one by one but what if they were 1,000 sites? For loop to the rescue!
37
Save your changes and go to Source Control
38
Type a commit message and click on "Commit"
39
Click "Sync Changes"
40
Let's sync these last changes to Nautobot. Click "Extensibility"
41
Click "Git Repositories"
42
Click here.
43
Click "Jobs"
44
Click "Jobs"
45
Run the "Simple Design" job one last time
46
Click the "New manufacturer name" field.
47
Type "Cisco"
48
Click "Run Job Now"
49
As you can see, the top-level entry (location Greece) has been created
50
Click "Greece"
51
Along with the location Greece, we also have the 3 sites ATH0x that we defined in our Jinja2 for loop :- )
10.Introduction to Design Builder
Nikos Kallergis
51 steps
3 minutes
Localhost
1
In the VSCode instance with the git repo, expand on the "jobs" folder
2
Open "simple"
3
Click "__init__.py"
4
Here you may see the structure for a very simple Design Job with a single input: "manufacturer"
5
Let's take a look into the nested "designs" folder now...
6
Double-click "0000_simpledesign.yaml.j2"
7
This is probably the simplest design possible. It will only create a Manufacturer object in Nautobot using the user input from before
8
To deploy this design, click "Jobs"
9
Click "Jobs"
10
Click here.
11
Click the "New manufacturer name" field.
12
Type "Cisco"
13
Click "Run Job Now"
14
You may see that the manufacturer was created. Click on its name to see it in more detail
15
Here it is! What if we run the design again though? To find out what happens, click "Jobs"
16
Click here.
17
Click the "New manufacturer name" field.
18
Type "Cisco" again
19
Click "Run Job Now"
20
As you see, an error occurs: "Manufacturer with this Name already exists."
21
To make the design idempotent, prepend the name of the manufacturer with "!create_or_update:name"
22
Save your changes and go to Source Control
23
Type a commit message and click on the "Commit" button
24
Click "Sync Changes"
25
Back in Nautobot, click "Extensibility"
26
Click "Git Repositories"
27
Click here to sync the repo changes
28
Click "Jobs"
29
Click "Jobs"
30
Click here.
31
Click the "New manufacturer name" field.
32
Type "Cisco"
33
Click "Run Job Now"
34
As you can see, the design was successfully deployed in an idempotent manner
35
Let's add some more stuff to our design. What about a platform for our manufacturer? You may see here that, using the dunder, we can dig into nested attributes
36
Before committing our changes, let's see what Jinja2 can do for us here. Imagine that I want three sites in Athens, under Region Greece. Sure, I could add them one by one but what if they were 1,000 sites? For loop to the rescue!
37
Save your changes and go to Source Control
38
Type a commit message and click on "Commit"
39
Click "Sync Changes"
40
Let's sync these last changes to Nautobot. Click "Extensibility"
41
Click "Git Repositories"
42
Click here.
43
Click "Jobs"
44
Click "Jobs"
45
Run the "Simple Design" job one last time
46
Click the "New manufacturer name" field.
47
Type "Cisco"
48
Click "Run Job Now"
49
As you can see, the top-level entry (location Greece) has been created
50
Click "Greece"
51
Along with the location Greece, we also have the 3 sites ATH0x that we defined in our Jinja2 for loop :- )