@@ -9,12 +9,13 @@ Feature Profile (Policy Object)
99.. code-block :: python
1010
1111 def get_feature_profile_id (client : ApiClient, feature_profile_name : str ) -> str :
12- results = client.v1.feature_profile.sdwan.get_sdwan_feature_profile_by_sdwan_family ()
12+ results = client.v1.feature_profile.sdwan.get ()
1313 for result in results:
1414 if result.profile_name == feature_profile_name:
1515 profile_id = result.profile_id
1616 return profile_id
1717
18+
1819 Group of Interest
1920-----------------
2021
@@ -38,17 +39,18 @@ In this example, we will create an Application List for Policy Object Feature Pr
3839 data = app_list.m.Data(entries = entries),
3940 )
4041 # Create AppList
41- parcel_id = app_list.create_data_prefix_profile_parcel_for_security_policy_object (
42+ parcel_id = app_list.post (
4243 policy_object_profile_id, payload
4344 ).parcel_id
4445 return parcel_id
4546
4647
4748 def delete_app_list (client : ApiClient, policy_object_id : str , app_list_id : str ):
48- client.v1.feature_profile.sdwan.policy_object.delete_data_prefix_profile_parcel_for_policy_object (
49+ client.v1.feature_profile.sdwan.policy_object.delete (
4950 policy_object_id, policy_object_list_type = " app-list" , list_object_id = app_list_id
5051 )
5152
53+
5254 Embedded Security Profile
5355-------------------------
5456
@@ -58,28 +60,27 @@ Embedded Security Profile
5860 es_api = client.v1.feature_profile.sdwan.embedded_security
5961 # Define Embedded Security Profile
6062 es = es_api.m.CreateSdwanEmbeddedSecurityFeatureProfilePostRequest(
61- name = " TEST_EMBEDDED_SECURITY " , description = " TEST_EMBEDDED_SECURITY "
63+ name = " DEMO_NGFW_EMBEDDED_SECURITY " , description = " EmbeddedSecurity_Test "
6264 )
6365 # Create Embedded Security Profile
64- es_response = es_api.create_sdwan_embedded_security_feature_profile (es)
66+ es_response = es_api.post (es)
6567 return es_response.id
6668
6769
6870 def delete_embedded_security_profile (client : ApiClient, es_profile_id : str ):
69- # Detaching or removing a Policy Group may be needed first.
7071 es_api = client.v1.feature_profile.sdwan.embedded_security
71- es_api.delete_sdwan_embedded_security_feature_profile (es_profile_id)
72+ es_api.delete (es_profile_id)
7273
7374
7475 def copy_embedded_security_profile (client : ApiClient, es_profile_id : str ) -> str :
7576 es_api = client.v1.feature_profile.sdwan.embedded_security
7677 es = es_api.m.CreateSdwanEmbeddedSecurityFeatureProfilePostRequest(
7778 name = " TEST_EMBEDDED_SECURITY2" ,
7879 description = " TEST_EMBEDDED_SECURITY2" ,
79- # Id of a source Feature Profile
8080 from_feature_profile = es_api.m.FromFeatureProfileDef(copy = es_profile_id),
8181 )
82- return es_api.create_sdwan_embedded_security_feature_profile(es).id
82+ return es_api.post(es).id
83+
8384
8485 NGFW Parcel
8586-----------
@@ -93,31 +94,45 @@ In this example we will create an NGFW Parcel for Embedded Security Profile
9394 m = ngfw_api.m
9495 # Define NGFW Parcel
9596 ngfw_parcel = m.CreateNgfirewallProfileParcelPostRequest(
96- name = " TEST_NGFW_PARCEL" ,
97- description = " TEST_NGFW_PARCEL" ,
98- data = m.Data(
99- default_action_type = m.OneOfDefaultActionTypeOptionsDef(value = " pass" , option_type = " global" ),
97+ name = " DEMO_NGFW_NGFW_PARCEL" ,
98+ description = " NGFW_TEST" ,
99+ data = m.UnifiedNgfirewallData(
100+ default_action_type = m.OneOfDefaultActionTypeOptionsDef(
101+ value = " pass" , option_type = " global"
102+ ),
100103 sequences = [
101104 m.Sequences(
102105 actions = [],
103- sequence_id = m.OneOfSequencesSequenceIdOptionsDef(value = " 1" , option_type = " global" ),
104- sequence_name = m.OneOfSequencesSequenceNameOptionsDef(value = " Rule1" , option_type = " global" ),
105- sequence_type = m.OneOfSequencesSequenceTypeOptionsDef(option_type = " global" , value = " ngfirewall" ),
106- base_action = m.OneOfSequencesBaseActionOptionsDef(value = " pass" , option_type = " global" ),
106+ sequence_id = m.OneOfSequencesSequenceIdOptionsDef(
107+ value = " 1" , option_type = " global"
108+ ),
109+ sequence_name = m.OneOfSequencesSequenceNameOptionsDef(
110+ value = " Rule1" , option_type = " global"
111+ ),
112+ sequence_type = m.OneOfSequencesSequenceTypeOptionsDef(
113+ option_type = " global" , value = " ngfirewall"
114+ ),
115+ base_action = m.OneOfSequencesBaseActionOptionsDef(
116+ value = " pass" , option_type = " global"
117+ ),
107118 disable_sequence = m.OneOfdisableSequenceDef(value = False , option_type = " global" ),
108119 # Keep in mind: each Entries model may contain only a single rule. To add another rule, append
109120 # another Entries object to the list.
110121 match_ = m.Match(
111122 entries = [
112123 m.Entries(
113124 source_ip = m.Ipv4MatchDef(
114- ipv4_value = m.Ipv4InputDef1(option_type = " global" , value = [" 12.0.0.0/8" ])
125+ ipv4_value = m.Ipv4InputDef1(
126+ option_type = " global" , value = [" 12.0.0.0/8" ]
127+ )
115128 )
116129 ),
117130 m.Entries(
118131 # You can also use a device variable, to set the value later.
119132 destination_ip = m.Ipv4MatchDef(
120- ipv4_value = m.Ipv4InputDef2(option_type = " variable" , value = " {{ test}} " )
133+ ipv4_value = m.Ipv4InputDef2(
134+ option_type = " variable" , value = " {{ destination_ip_var}} "
135+ )
121136 )
122137 ),
123138 ]
@@ -127,17 +142,16 @@ In this example we will create an NGFW Parcel for Embedded Security Profile
127142 ),
128143 )
129144 # Create NGFW Parcel
130- ngfw_response = (
131- client.v1.feature_profile.sdwan.embedded_security.unified.ngfirewall.create_ngfirewall_profile_parcel(
132- es_profile_id, payload = ngfw_parcel
133- )
145+ ngfw_response = client.v1.feature_profile.sdwan.embedded_security.unified.ngfirewall.post(
146+ es_profile_id, payload = ngfw_parcel
134147 )
135148 return ngfw_response.parcel_id
136149
137150
138151 def delete_ngfw_parcel (client : ApiClient, es_profile_id : str , ngfw_id : str ):
139152 ngfw_api = client.v1.feature_profile.sdwan.embedded_security.unified.ngfirewall
140- ngfw_api.delete_ngfirewall_profile_parcel(es_profile_id, ngfw_id)
153+ ngfw_api.delete(es_profile_id, ngfw_id)
154+
141155
142156 Security Policy
143157---------------
@@ -151,11 +165,13 @@ In this example, we will create a Security Policy for Embedded Security Profile,
151165 m = po_api.m
152166 # Define Security Policy
153167 policy = m.CreateEmbeddedSecurityProfileParcelPostRequest(
154- name = " TEST_SECURITY_POLICY " ,
168+ name = " DEMO_NGFW_SECURITY_POLICY " ,
155169 description = " desc" ,
156- data = m.Data (
170+ data = m.EmbeddedSecurityPolicyData (
157171 settings = m.Settings(
158- security_logging = m.NetworkSettingsOptionTypeObjectDef(option_type = " network-settings" , value = True )
172+ security_logging = m.NetworkSettingsOptionTypeObjectDef(
173+ option_type = " network-settings" , value = True
174+ )
159175 ),
160176 assembly = [
161177 m.Assembly2(
@@ -173,13 +189,14 @@ In this example, we will create a Security Policy for Embedded Security Profile,
173189 ),
174190 )
175191 # Create Security Policy Parcel
176- response = po_api.create_embedded_security_profile_parcel (es_profile_id, policy)
192+ response = po_api.post (es_profile_id, policy)
177193 return response.parcel_id
178194
179195
180196 def delete_security_policy (client : ApiClient, es_profile_id : str , security_policy_id : str ):
181197 po_api = client.v1.feature_profile.sdwan.embedded_security.policy
182- po_api.delete_security_profile_parcel_1(es_profile_id, security_policy_id)
198+ po_api.delete(es_profile_id, security_policy_id)
199+
183200
184201 Policy Group
185202------------
@@ -194,18 +211,17 @@ In this example, we will create a Policy Group with Embedded Security Profile at
194211 profiles = [pg_api.m.ProfileIdObjDef(id = id ) for id in [policy_object_id, embedded_security_id]]
195212 # Define Policy Group
196213 policy_group = pg_api.m.CreatePolicyGroupPostRequest(
197- name = " TEST_POLICY_GROUP " , description = " descr" , solution = " sdwan" , profiles = profiles
214+ name = " DEMO_NGFW_POLICY_GROUP " , description = " descr" , solution = " sdwan" , profiles = profiles
198215 )
199216 # Create Policy Group
200- policy_group_id = pg_api.create_policy_group (payload = policy_group).id
217+ policy_group_id = pg_api.post (payload = policy_group).id
201218
202219 return policy_group_id
203220
204221
205222 def delete_policy_group (client : ApiClient, policy_group_id : str ):
206- # You may need to delete device associations first (see Associate Device example)
207223 pg_api = client.v1.policy_group
208- pg_api.delete_policy_group (policy_group_id)
224+ pg_api.delete (policy_group_id)
209225
210226
211227 def copy_policy_group (client : ApiClient, policy_group_id : str ) -> str :
@@ -216,20 +232,22 @@ In this example, we will create a Policy Group with Embedded Security Profile at
216232 solution = " sdwan" ,
217233 from_policy_group = pg_api.m.FromPolicyGroupDef(copy = policy_group_id),
218234 )
219- return pg_api.create_policy_group(payload = policy_group).id
235+ return pg_api.post(payload = policy_group).id
236+
220237
221238 Get Device id
222239-------------
223240
224241.. code-block :: python
225242
226243 def get_device_id (client : ApiClient, hostname : str ) -> str :
227- devices = client.device.list_all_devices()
244+ devices = client.device.get()
245+ print ([d.host_name for d in devices])
228246 # You find desired device by filtering with different fields, as well.
229247 device = [device for device in devices if device.host_name == hostname][0 ]
230-
231248 return device.uuid
232249
250+
233251 Associate Device with Policy Group
234252----------------------------------
235253
@@ -239,27 +257,33 @@ Associate Device with Policy Group
239257 pg_api = client.v1.policy_group
240258 m = pg_api.device.associate.m
241259 payload = m.CreatePolicyGroupAssociationPostRequest(devices = [m.DeviceIdDef(id = device_id)])
242- pg_api.device.associate.create_policy_group_association (policy_group_id, payload)
260+ pg_api.device.associate.post (policy_group_id, payload)
243261
244262
245263 def delete_association (client : ApiClient, policy_group_id : str , device_id : str ):
246264 pg_api = client.v1.policy_group
247265 m = pg_api.device.associate.m
248- payload = m.CreatePolicyGroupAssociationPostRequest(devices = [m.DeviceIdDef(id = device_id)])
249- client.v1.policy_group.device.associate.delete_policy_group_association(policy_group_id, payload)
266+ payload = m.DeletePolicyGroupAssociationDeleteRequest(devices = [m.DeviceAssociateDeviceIdDef(id = device_id)])
267+ client.v1.policy_group.device.associate.delete(
268+ policy_group_id, payload
269+ )
270+
250271
251272 Policy Group Variables
252273----------------------
253274
254275.. code-block :: python
255276
277+
256278 def set_variable_values (client : ApiClient, policy_group_id : str , device_id : str ):
257279 variables_api = client.v1.policy_group.device.variables
258280 m = variables_api.m
259281
260282 # Fetch variables
261- fetch_variables_payload = m.FetchPolicyGroupDeviceVariablesPostRequest(device_ids = [device_id], suggestions = True )
262- device_variables = variables_api.fetch_policy_group_device_variables(
283+ fetch_variables_payload = m.FetchPolicyGroupDeviceVariablesPostRequest(
284+ device_ids = [device_id], suggestions = True
285+ )
286+ device_variables = variables_api.post(
263287 policy_group_id, fetch_variables_payload
264288 ).devices
265289
@@ -274,8 +298,11 @@ Policy Group Variables
274298 current_variables.append(m.Variables(variable.name, [value]))
275299 if current_variables:
276300 set_variables_payload.append(m.Devices(device_id, current_variables))
277- payload = m.CreatePolicyGroupDeviceVariablesPutRequest(devices = set_variables_payload, solution = " sdwan" )
278- variables_api.create_policy_group_device_variables(policy_group_id, payload)
301+ payload = m.CreatePolicyGroupDeviceVariablesPutRequest(
302+ devices = set_variables_payload, solution = " sdwan"
303+ )
304+ variables_api.put(policy_group_id, payload)
305+
279306
280307 Deploy Policy Group
281308---------------------------------
@@ -287,9 +314,10 @@ Deploy Policy Group
287314 m = pg_api.m
288315
289316 payload = m.DeployPolicyGroupPostRequest(devices = [m.DeviceIdDef(id = device_id)])
290- response = pg_api.deploy_policy_group (policy_group_id, payload)
317+ response = pg_api.post (policy_group_id, payload)
291318 return response.parent_task_id
292319
320+
293321 Check Policy Group Deploy Task Status
294322-------------------------------------
295323
@@ -300,7 +328,8 @@ Check Policy Group Deploy Task Status
300328 def check_status (client : ApiClient, task_id : str ) -> bool :
301329 status_api = client.device.action.status
302330 while True :
303- response = status_api.find_status(task_id)
331+ response = status_api.get(task_id)
332+ print (response)
304333 statuses = [status[" status" ] for status in response]
305334 if " In progress" in statuses:
306335 print (" In progress...\n " )
@@ -310,6 +339,7 @@ Check Policy Group Deploy Task Status
310339 else :
311340 return True
312341
342+
313343 Policy Group with NGFW flow
314344---------------------------
315345
0 commit comments