Updated stage 5
### Chapter 5 - Closed loop automation with JET
-In this stage, we try to combine what we have learnt previously to demonstrate a closed-loop automation script.
+In this lesson, we are going to combine what we have learnt previously to create a closed-loop automation script.
-We use JET notification services to listen for new IFA event and if the configured IP address is a public IP address, we use gRPC service to provision a firewall filter to protect the vQFX device.
+The objective of this lesson is to use JET notification services to listen for any new interface addresses configured(IFA events). If the configured IP address is a public one, we use gRPC service to provision a firewall filter on the corresponding interface to protect the vQFX device.
-Here, we put the JET firewall API code in stage 4 in a separate file `add_firewall_filter.py`. Try to view the code now.
+#### Create the close loop automation script
+To save time, we have already put the JET firewall API code we created in stage 4 in a file `add_firewall_filter.py`. Let's take a look on the code:
```
cd /antidote/lessons/lesson-25
@@ -33,7 +34,7 @@ from add_firewall_filter import add_firewall_filter
```
<button type="button" class="btn btn-primary btn-sm" onclick="runSnippetInTab('linux', 1)">Run this snippet</button>
-Same as stage 2, we create the MQTT client and define `on_connect` callback function to subscribe the IFA add event once clients connect to the JET MQTT broker.
+Then same as stage 2, we create a MQTT client and define `on_connect` callback function to subscribe to the topic "IFA add events" once the client connect to the JET MQTT broker.
```
client = mqtt.Client()
@@ -66,9 +67,10 @@ client.loop_forever()
```
<button type="button" class="btn btn-primary btn-sm" onclick="runSnippetInTab('linux', 3)">Run this snippet</button>
-Here, We simulate another neighboring device by creating one more routing instance in the vQFX. Interface xe-0/0/2 and xe-0/0/3 is connected together, and a public IP address `20.1.1.2/24` is pre-configured on xe-0/0/3 which is in routing instance `VR2`
+#### Testing the close loop automation
+To validate our automation, We simulate another neighboring device by creating one more routing instance in the vQFX. Interface xe-0/0/2 and xe-0/0/3 is connected together, and a public IP address `20.1.1.2/24` is pre-configured on xe-0/0/3 which is in routing instance `VR2`
-Now, let's create IP address on xe-0/0/2 interface.
+Now, let's create an IP address on xe-0/0/2 interface.
```
configure
@@ -87,4 +89,8 @@ show firewall log
```
<button type="button" class="btn btn-primary btn-sm" onclick="runSnippetInTab('vqfx', 5)">Run this snippet</button>
-This concludes our closed-loop automation using JET services.
+The firewall log should capture the ping traffic. This verifies a firewall filter can be automatically provisioned to the interface dynamically without modifying the Junos configuration.
+
+This JET API automation capability opens up a whole new world to design and develop business logics within the network, such as customized traffic engineering, dynamic network protection, and so on.
+
+This concludes our introduction to closed-loop automation using JET services and we hope you enjoy this course!
