1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
|
Example
Pre-requisite
Netbox running: https://github.com/netbox-community/netbox-docker
NETCONF capable device (JUNOS use in this example, but templates could be changed for another OS)
Blueprint processor micro-service runnint
CDS SQL database, populated with reference data as bellow:
CREATE TABLE `demo` (
`id` text DEFAULT NULL,
`value` text DEFAULT NULL
);
INSERT INTO `demo` VALUES ('1','vsn'),('2','vpg'),('3','vfw');
resources
Bellow a table of the resource used within this example, and how this resource
are resolved.
The resources are used in the context of device configuration. These shouldn't be
confused with SDC model resources.
name | resolve through
------------------------------------------------------
prefix-id | default
vfw_interface_ip | rest (through Netbox)
hostname | input
vf-module-number | default
vf-module-type | database
unit-number | input
interface-name | input
interface-description | capability (python script)
4 workflows
resource-assignment
Ability to resolve templates with their mappings and provide the result as output.
Example provide one templates: vf-module-1
Input:
Nothing specific to pass as input to the request. The resolution will use SQL and script to
resolve all the parameters.
Output:
{
"resource-assignment-response": {
"meshed-template": {
"vf-module-1": "<interface>\n <description>This is the Virtual Firewall entity</description>\n <vfw>10.10.10.69/24</vfw>\n</interface>"
}
}
}
config-assign (dry-run)
Ability to resolve templates with their mappings and provide the result as output.
Example provide one templates: hostname
This action uses the same functionality as resource-assignment, and in addition,
store the resulting meshed-template to be used later.
Input
resolution-key: To identify the configlet saved in the DB
hostname: Value defined to be result trough input in the hostname mapping file
interface-name: Name of the interface to configure
unit-number: Unit to configure for the interface
{
"config-assign-request": {
"resolution-key": "config-assign-demo-123",
"config-assign-properties": {
"hostname": "blah"
}
}
}
Output:
"config-assign-response": {
"dry-run": {
"hostname": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<configuration xmlns:junos=\"http://xml.juniper.net/junos/17.4R1/junos\">\n <system xmlns=\"http://yang.juniper.net/junos-qfx/conf/system\">\n <host-name operation=\"delete\" />\n <host-name operation=\"create\">blah</host-name>\n </system>\n</configuration>\n",
"vfw-interface": "<configuration>\n <interfaces>\n <interface>\n <name>ge-0/0/7</name>\n <unit operation=\"create\">\n <name>0</name>\n <description>This is the Virtual Firewall entity</description>\n <family>\n <inet>\n <address>\n <name>10.0.101.17/24</name>\n </address>\n </inet>\n </family>\n </unit>\n </interface>\n </interfaces>\n</configuration>"
}
}
config-deploy
This action will run a python script that will retrieved the resolved template
from previous step using the resolution-key.
This action will push these resolved templates into a device (JUNOS) using NETCONF.
The python script will make use of utilities classes provided by the platform:
resolution helper and netconf client.
Information about the device is modelled as a requirement of this action, specifying that
username, password and ip of the device should be provided as input.
Note: you could resolve those information using the resource resolution framework, if need be.
Input:
resolution-key: To identify the configlet saved in the DB in previous step
username: NETCONF device user
password: NETCONF device password
ip: NETCONF device ip
{
"config-deploy-request": {
"resolution-key": "config-assign-demo-123",
"username": "admin",
"password": "passwd",
"ip": "10.198.1.35"
}
}
Output:
No specific output beside success or failure.
rollback
This action will rollback the last committed config on the device, using NETCONF and device
specific RPC. To do so, a python script will be used, similar as in previous action, to dynamically
resolve the rollback template payload, and send the RPC to the device.
Information about the NETCONF device is provided in a similar fashion as previous step.
Input:
username: NETCONF device user
password: NETCONF device password
ip: NETCONF device ip
{
"rollback-request": {
"username": "admin",
"password": "passwd",
"ip": "10.198.1.35",
"rollback-properties": {
}
}
}
Output:
No specific output beside success or failure.
Postman collection used for this example. 5 requests are provided one per workflow to execute, and 1 to load the CBA in the runtime environment.
https://www.getpostman.com/collections/d68b12a60fd6ed336059
|