Capstone: Automation Mini-Project
CCNP ENCOR 350-401 v1.2 EVE-NG / GNS3
مقصدObjectiveObjective
اس capstone میں آپ ایک مکمل آٹومیشن پراجیکٹ بنائیں گے — EEM سے خودکار بیک اپ، Python + RESTCONF سے مانیٹرنگ۔ تھیوری اب عمل میں۔Is capstone mein aap ek mukammal automation project banayenge — EEM se khudkaar backup, Python + RESTCONF se monitoring. Theory ab amal mein.In this capstone you will build a complete automation mini-project — automatic backup with EEM, monitoring with Python + RESTCONF. Theory now in practice.
آسان مثالSimple AnalogySimple Analogy
اب آپ کے پاس روبوٹ اسسٹنٹ ہے جو رات کو خود بیک اپ لیتا ہے اور صبح رپورٹ دیتا ہے۔ آپ سوتے ہیں، نیٹ ورک خود سنبھلتا ہے — یہی نیٹ ورک آٹومیشن کا خواب ہے۔Ab aap ke paas robot assistant hai jo raat ko khud backup leta hai aur subah report deta hai. Aap sote hain, network khud sambhalta hai — yehi network automation ka khwab hai.Now you have a robot assistant that takes backups by itself at night and gives a report in the morning. You sleep while the network manages itself — that is the dream of network automation.
سیٹ اپLab SetupLab Setup
R1-R2 (OSPF core)، TFTP سرور 192.168.10.100، Python والا PC۔ ڈیوائسز: 2x روٹر 2911 (R1, R2)، 1x پی سی (Python)، 1x TFTP سرور۔R1-R2 (OSPF core), TFTP server 192.168.10.100, Python wala PC. Devices: 2x Router 2911 (R1, R2), 1x PC (Python), 1x TFTP server.R1-R2 (OSPF core), TFTP server 192.168.10.100, PC with Python. Devices: 2x Router 2911 (R1, R2), 1x PC (Python), 1x TFTP server.
اقداماتStepsSteps
Step 1
پراجیکٹ کا ہدف لکھیں: (1) ہر رات 2 بجے دونوں روٹرز کا config بیک اپ۔ (2) Python اسکرپٹ سے انٹرفیس status چیک اور ڈاؤن انٹرفیس کی رپورٹ۔Project ka hadaf likho: (1) Har raat 2 baje dono routers ka config backup. (2) Python script se interface status check aur down interface ki report.Write the project goal: (1) config backup of both routers every night at 2 AM. (2) A Python script that checks interface status and reports down interfaces.
Step 2
R1 اور R2 پر EEM applet لگائیں — cron پر چلے، config اٹھا کر TFTP پر رکھے۔ R2 پر فائل کا نام R2-backup.cfg ہو۔R1 aur R2 par EEM applet lagao — cron par chale, config utha kar TFTP par rakhe. R2 par file ka naam R2-backup.cfg ho.Configure the EEM applet on R1 and R2 — runs on cron, picks up the config and puts it on TFTP. On R2 the file should be named R2-backup.cfg.
enable configure terminal event manager applet BACKUP-CONFIG event timer cron cron-entry "0 2 * * *" action 1.0 cli command "enable" action 2.0 cli command "copy running-config tftp://192.168.10.100/R1-backup.cfg" exit exit
Step 3
Python اسکرپٹ لکھیں جو RESTCONF سے interfaces لے اور جو down ہوں ان کے نام print کرے۔ یہی اسکرپٹ روز چلائیں (cron/scheduler سے)۔Python script likho jo RESTCONF se interfaces le aur jo down hon un ke naam print kare. Yehi script roz chalao (cron/scheduler se).Write a Python script that fetches interfaces via RESTCONF and prints the names of those that are down. Run this script daily (via cron/scheduler).
import urllib.request, json
url = "https://192.168.10.1/restconf/data/ietf-interfaces:interfaces"
req = urllib.request.Request(url)
req.add_header("Accept", "application/yang-data+json")
data = json.loads(urllib.request.urlopen(req).read())
for i in data["ietf-interfaces:interfaces"]["interface"]:
if not i.get("enabled", True):
print("DOWN:", i["name"])Step 4
ٹیسٹ: event manager run BACKUP-CONFIG سے applet ابھی چلائیں اور TFTP سرور پر فائل دیکھیں۔ Python اسکرپٹ چلا کر آؤٹ پٹ دیکھیں۔Test: event manager run BACKUP-CONFIG se applet abhi chalao aur TFTP server par file dekho. Python script chala kar output dekho.Test: run the applet now with event manager run BACKUP-CONFIG and check the file on the TFTP server. Run the Python script and view the output.
event manager run BACKUP-CONFIG show event manager history events
Step 5
آگے بڑھائیں: syslog میں 'DOWN' آئے تو EEM سے الرٹ، یا Python سے Catalyst Center API کو رپورٹ بھیجیں۔ اچھا پراجیکٹ کبھی ختم نہیں ہوتا۔Aage barhao: syslog mein 'DOWN' aaye to EEM se alert, ya Python se Catalyst Center API ko report bhejo. Achha project kabhi khatam nahi hota.Extend it: send an alert via EEM when 'DOWN' appears in syslog, or send a report to the Catalyst Center API from Python. A good project never ends.
Step 6
حتمی جائزہ: بیک اپ فائل سرور پر ہے؟ اسکرپٹ ڈاؤن انٹرفیس پکڑتا ہے؟ دونوں ہاں ہوں تو mini-project مکمل — یہی آپ کا پہلا آٹومیشن پورٹ فولیو ہے۔Hatmi jaiza: backup file server par hai? Script down interface pakarta hai? Dono haan hon to mini-project mukammal — yehi aap ka pehla automation portfolio hai.Final review: is the backup file on the server? Does the script catch down interfaces? If both are yes, the mini-project is complete — this is your first automation portfolio piece.
show event manager policy registered
تصدیقVerifyVerify
TFTP سرور پر دونوں بیک اپ فائلز ہوں اور اسکرپٹ ڈاؤن انٹرفیس رپورٹ کرے تو پراجیکٹ مکمل۔TFTP server par dono backup files hon aur script down interface report kare to project mukammal.If both backup files are on the TFTP server and the script reports down interfaces, the project is complete.
show event manager policy registered show event manager history events
خرابی دور کرناTroubleshootingTroubleshooting
⚠️ بیک اپ فائل TFTP سرور پر نہیں بن رہی۔Backup file TFTP server par nahi ban rahi.The backup file is not being created on the TFTP server.
✅ سرور reachable ہو اور TFTP service چل رہی ہو۔ copy کمانڈ میں IP اور فائل کا نام درست ہو۔Server reachable ho aur TFTP service chal rahi ho. copy command mein IP aur file ka naam durust ho.The server must be reachable and the TFTP service running. The IP and filename in the copy command must be correct.
⚠️ Python اسکرپٹ SSL error دے رہا ہے۔Python script SSL error de raha hai.The Python script gives an SSL error.
✅ لیب ڈیوائس کا certificate self-signed ہوتا ہے — ٹیسٹ کے لیے SSL verify بند کریں یا certificate انسٹال کریں۔Lab device ka certificate self-signed hota hai — test ke liye SSL verify band karo ya certificate install karo.A lab device's certificate is self-signed — for testing, disable SSL verification or install the certificate.
انٹرویو سوالاتInterview Q&AInterview Q&A
❓ EEM اور Python میں سے کون کب استعمال کریں گے؟EEM aur Python mein se kaun kab istemal karenge?When would you use EEM vs Python?
EEM ڈیوائس کے اندر چھوٹے خودکار کاموں کے لیے (بیک اپ، الرٹ)۔ Python باہر سے بڑے کاموں کے لیے (کئی ڈیوائسز، رپورٹس، APIs)۔EEM device ke andar chhote khudkaar kaamon ke liye (backup, alert). Python bahar se bare kaamon ke liye (kai devices, reports, APIs).EEM for small automatic tasks inside the device (backup, alerts). Python for bigger tasks from outside (many devices, reports, APIs).
❓ اس پراجیکٹ میں RESTCONF کا کیا کردار ہے؟Is project mein RESTCONF ka kya kirdar hai?What is RESTCONF's role in this project?
RESTCONF ڈیوائس کا ڈیٹا (interfaces) ایک معیاری شکل (JSON/YANG) میں دیتا ہے تاکہ Python اسے آسانی سے پڑھ سکے۔RESTCONF device ka data (interfaces) ek mayari shakal (JSON/YANG) mein deta hai taake Python usay aasani se parh sake.RESTCONF gives the device's data (interfaces) in a standard form (JSON/YANG) so Python can read it easily.