From bd4bc7cb24111bca92a9f1d11712a8f4330627b8 Mon Sep 17 00:00:00 2001 From: Ronan Fourneuve Date: Thu, 27 Nov 2025 14:06:29 +0100 Subject: [PATCH] Fin Projet avant bonus --- fastprod_backend/fastprod/api.py | 29 ++- .../fastprod/services/snapshots.py | 35 ++++ .../R1-CPE-BAT-A_20251127134858.conf | 168 ++++++++++++++++++ .../R1-CPE-BAT-A_20251127135113.conf | 168 ++++++++++++++++++ .../R1-CPE-BAT-A_20251127135221.conf | 168 ++++++++++++++++++ .../R1-CPE-BAT-A_20251127135248.conf | 168 ++++++++++++++++++ .../R1-CPE-BAT-A_20251127135309.conf | 168 ++++++++++++++++++ .../R1-CPE-BAT-A_20251127135329.conf | 168 ++++++++++++++++++ .../R1-CPE-BAT-A_20251127135524.conf | 168 ++++++++++++++++++ fastprod_backend/nornir.log | 15 ++ 10 files changed, 1254 insertions(+), 1 deletion(-) create mode 100644 fastprod_backend/fastprod/services/snapshots.py create mode 100644 fastprod_backend/fastprod/snapshots/R1-CPE-BAT-A_20251127134858.conf create mode 100644 fastprod_backend/fastprod/snapshots/R1-CPE-BAT-A_20251127135113.conf create mode 100644 fastprod_backend/fastprod/snapshots/R1-CPE-BAT-A_20251127135221.conf create mode 100644 fastprod_backend/fastprod/snapshots/R1-CPE-BAT-A_20251127135248.conf create mode 100644 fastprod_backend/fastprod/snapshots/R1-CPE-BAT-A_20251127135309.conf create mode 100644 fastprod_backend/fastprod/snapshots/R1-CPE-BAT-A_20251127135329.conf create mode 100644 fastprod_backend/fastprod/snapshots/R1-CPE-BAT-A_20251127135524.conf diff --git a/fastprod_backend/fastprod/api.py b/fastprod_backend/fastprod/api.py index a45e19b..de6f75f 100644 --- a/fastprod_backend/fastprod/api.py +++ b/fastprod_backend/fastprod/api.py @@ -1,4 +1,4 @@ -from flask import Flask,jsonify,request,abort, make_response +from flask import Flask,jsonify,request,abort, make_response,send_file from werkzeug.exceptions import HTTPException from nornir import InitNornir import os @@ -24,6 +24,7 @@ app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER from services.devices import ( get_inventory, add_device,get_device_by_name,delete_device,get_device_interfaces,get_device_interfaces_ip,get_device_technical_info) from services.config import (get_config_by_device,run_config_from_file_by_device) from services.tasks import (run_show_commands_by_device,run_config_commands_by_device) +from services.snapshots import (get_snapshot_by_name,create_snapshot_by_device,get_snapshots_by_device) init_nornir() @app.route("/") @@ -100,6 +101,32 @@ def get_config(device_name): result = run_config_commands_by_device(device, commands=commands) return jsonify(result=result, commands=commands) +@app.route("/devices//snapshots", methods=['GET','POST']) +def snapshot(device_name): + device = get_device_by_name(device_name) + print(device) + if request.method == 'GET': + data = get_snapshots_by_device(device) + return jsonify({ + "result": True, + "data": data + }) + if request.method == 'POST': + snapshot_path = create_snapshot_by_device(device) + return jsonify({ + "result": True, + "data": { + "snapshot_path": snapshot_path + } + }) + +@app.route("/snapshots/", methods=['GET']) +def snapshot_by_name(filename): + if request.method == 'GET': + try: + return send_file('snapshots/'+filename) + except FileNotFoundError: + abort(make_response(jsonify(message="snapshot not found"), 404)) @app.errorhandler(HTTPException) def handle_exception(e): diff --git a/fastprod_backend/fastprod/services/snapshots.py b/fastprod_backend/fastprod/services/snapshots.py new file mode 100644 index 0000000..046a66e --- /dev/null +++ b/fastprod_backend/fastprod/services/snapshots.py @@ -0,0 +1,35 @@ +import os +from datetime import datetime +from api import app +from services.config import get_config_by_device +from flask import Flask,jsonify,request,abort, make_response +snapshot_directory = 'fastprod/snapshots' + + +def get_snapshot_by_name(name): + files = os.listdir() + snapshots = [] + for file in files: + file_device_name = file.split('_')[0] + if name == file: + snapshots.append(dict(file=file, path=snapshot_directory, at=file.split('_')[1].split('.')[0])) + return snapshots +def create_snapshot_by_device(device=None): + nr = app.config.get('nr') + config = get_config_by_device(device) + + timestamp = datetime.now().strftime('%Y%m%d%H%M%S') + + file_path = os.path.join(snapshot_directory, f"{device.get('name')}_{timestamp}.conf") + with open(file_path, 'w') as file: + file.write(config.get('running')) + return file_path + +def get_snapshots_by_device(device): + files = os.listdir(snapshot_directory) + snapshots = [] + for file in files: + file_device_name = file.split('_')[0] + if file_device_name == device.get('name'): + snapshots.append(dict(file=file, path=snapshot_directory, at=file.split('_')[1].split('.')[0])) + return snapshots \ No newline at end of file diff --git a/fastprod_backend/fastprod/snapshots/R1-CPE-BAT-A_20251127134858.conf b/fastprod_backend/fastprod/snapshots/R1-CPE-BAT-A_20251127134858.conf new file mode 100644 index 0000000..7a37fbe --- /dev/null +++ b/fastprod_backend/fastprod/snapshots/R1-CPE-BAT-A_20251127134858.conf @@ -0,0 +1,168 @@ +! +upgrade fpd auto +version 12.4 +service timestamps debug datetime msec +service timestamps log datetime msec +no service password-encryption +! +hostname R1-CPE-BAT-A +! +boot-start-marker +boot-end-marker +! +logging message-counter syslog +! +no aaa new-model +ip source-route +no ip icmp rate-limit unreachable +ip cef +! +! +! +! +no ip domain lookup +ip domain name r1.cpe.local +no ipv6 cef +! +multilink bundle-name authenticated +! +! +! +! +! +! +! +! +! +! +! +! +! +! +! +! +file prompt quiet +username cisco privilege 15 password 0 cisco +archive + log config + hidekeys +! +! +! +! +! +ip tcp synwait-time 5 +ip ssh version 2 +ip scp server enable +! +! +! +! +interface Loopback1 + description Loopback pour R1-CPE-BAT-A + ip address 1.1.1.1 255.255.255.255 +! +interface Loopback2 + description Loopback2 pour R1-CPE-BAT-A + ip address 1.1.1.2 255.255.255.255 +! +interface Loopback10 + description created from config file uploaded from postman + ip address 10.10.10.10 255.255.255.255 +! +interface FastEthernet0/0 + ip address 172.16.100.62 255.255.255.192 + duplex half +! +interface Serial1/0 + no ip address + shutdown + serial restart-delay 0 +! +interface Serial1/1 + ip address 10.1.1.1 255.255.255.252 + shutdown + serial restart-delay 0 +! +interface Serial1/2 + no ip address + shutdown + serial restart-delay 0 +! +interface Serial1/3 + no ip address + shutdown + serial restart-delay 0 +! +interface GigabitEthernet2/0 + no ip address + negotiation auto +! +interface GigabitEthernet2/0.10 + description "Gateway for teacher vlan" + encapsulation dot1Q 10 + ip address 172.16.10.253 255.255.255.0 + vrrp 10 ip 172.16.10.252 +! +interface GigabitEthernet2/0.20 + description "Gateway for student vlan" + encapsulation dot1Q 20 + ip address 172.16.20.253 255.255.255.0 + vrrp 20 ip 172.16.20.252 +! +interface GigabitEthernet2/0.99 + encapsulation dot1Q 99 + ip address 172.16.100.125 255.255.255.192 + vrrp 99 ip 172.16.100.124 +! +router ospf 1 + router-id 1.1.1.1 + log-adjacency-changes + passive-interface FastEthernet0/0 + passive-interface GigabitEthernet2/0.99 + network 10.1.1.0 0.0.0.3 area 0 + network 172.16.10.0 0.0.0.255 area 0 + network 172.16.20.0 0.0.0.255 area 0 + network 172.16.100.0 0.0.0.63 area 0 + network 172.16.100.64 0.0.0.63 area 0 +! +ip forward-protocol nd +no ip http server +no ip http secure-server +! +! +! +no cdp log mismatch duplex +! +! +! +! +! +! +control-plane +! +! +! +! +! +! +! +gatekeeper + shutdown +! +! +line con 0 + exec-timeout 0 0 + privilege level 15 + logging synchronous + stopbits 1 +line aux 0 + exec-timeout 0 0 + privilege level 15 + logging synchronous + stopbits 1 +line vty 0 4 + login local + transport input ssh +! +end \ No newline at end of file diff --git a/fastprod_backend/fastprod/snapshots/R1-CPE-BAT-A_20251127135113.conf b/fastprod_backend/fastprod/snapshots/R1-CPE-BAT-A_20251127135113.conf new file mode 100644 index 0000000..7a37fbe --- /dev/null +++ b/fastprod_backend/fastprod/snapshots/R1-CPE-BAT-A_20251127135113.conf @@ -0,0 +1,168 @@ +! +upgrade fpd auto +version 12.4 +service timestamps debug datetime msec +service timestamps log datetime msec +no service password-encryption +! +hostname R1-CPE-BAT-A +! +boot-start-marker +boot-end-marker +! +logging message-counter syslog +! +no aaa new-model +ip source-route +no ip icmp rate-limit unreachable +ip cef +! +! +! +! +no ip domain lookup +ip domain name r1.cpe.local +no ipv6 cef +! +multilink bundle-name authenticated +! +! +! +! +! +! +! +! +! +! +! +! +! +! +! +! +file prompt quiet +username cisco privilege 15 password 0 cisco +archive + log config + hidekeys +! +! +! +! +! +ip tcp synwait-time 5 +ip ssh version 2 +ip scp server enable +! +! +! +! +interface Loopback1 + description Loopback pour R1-CPE-BAT-A + ip address 1.1.1.1 255.255.255.255 +! +interface Loopback2 + description Loopback2 pour R1-CPE-BAT-A + ip address 1.1.1.2 255.255.255.255 +! +interface Loopback10 + description created from config file uploaded from postman + ip address 10.10.10.10 255.255.255.255 +! +interface FastEthernet0/0 + ip address 172.16.100.62 255.255.255.192 + duplex half +! +interface Serial1/0 + no ip address + shutdown + serial restart-delay 0 +! +interface Serial1/1 + ip address 10.1.1.1 255.255.255.252 + shutdown + serial restart-delay 0 +! +interface Serial1/2 + no ip address + shutdown + serial restart-delay 0 +! +interface Serial1/3 + no ip address + shutdown + serial restart-delay 0 +! +interface GigabitEthernet2/0 + no ip address + negotiation auto +! +interface GigabitEthernet2/0.10 + description "Gateway for teacher vlan" + encapsulation dot1Q 10 + ip address 172.16.10.253 255.255.255.0 + vrrp 10 ip 172.16.10.252 +! +interface GigabitEthernet2/0.20 + description "Gateway for student vlan" + encapsulation dot1Q 20 + ip address 172.16.20.253 255.255.255.0 + vrrp 20 ip 172.16.20.252 +! +interface GigabitEthernet2/0.99 + encapsulation dot1Q 99 + ip address 172.16.100.125 255.255.255.192 + vrrp 99 ip 172.16.100.124 +! +router ospf 1 + router-id 1.1.1.1 + log-adjacency-changes + passive-interface FastEthernet0/0 + passive-interface GigabitEthernet2/0.99 + network 10.1.1.0 0.0.0.3 area 0 + network 172.16.10.0 0.0.0.255 area 0 + network 172.16.20.0 0.0.0.255 area 0 + network 172.16.100.0 0.0.0.63 area 0 + network 172.16.100.64 0.0.0.63 area 0 +! +ip forward-protocol nd +no ip http server +no ip http secure-server +! +! +! +no cdp log mismatch duplex +! +! +! +! +! +! +control-plane +! +! +! +! +! +! +! +gatekeeper + shutdown +! +! +line con 0 + exec-timeout 0 0 + privilege level 15 + logging synchronous + stopbits 1 +line aux 0 + exec-timeout 0 0 + privilege level 15 + logging synchronous + stopbits 1 +line vty 0 4 + login local + transport input ssh +! +end \ No newline at end of file diff --git a/fastprod_backend/fastprod/snapshots/R1-CPE-BAT-A_20251127135221.conf b/fastprod_backend/fastprod/snapshots/R1-CPE-BAT-A_20251127135221.conf new file mode 100644 index 0000000..7a37fbe --- /dev/null +++ b/fastprod_backend/fastprod/snapshots/R1-CPE-BAT-A_20251127135221.conf @@ -0,0 +1,168 @@ +! +upgrade fpd auto +version 12.4 +service timestamps debug datetime msec +service timestamps log datetime msec +no service password-encryption +! +hostname R1-CPE-BAT-A +! +boot-start-marker +boot-end-marker +! +logging message-counter syslog +! +no aaa new-model +ip source-route +no ip icmp rate-limit unreachable +ip cef +! +! +! +! +no ip domain lookup +ip domain name r1.cpe.local +no ipv6 cef +! +multilink bundle-name authenticated +! +! +! +! +! +! +! +! +! +! +! +! +! +! +! +! +file prompt quiet +username cisco privilege 15 password 0 cisco +archive + log config + hidekeys +! +! +! +! +! +ip tcp synwait-time 5 +ip ssh version 2 +ip scp server enable +! +! +! +! +interface Loopback1 + description Loopback pour R1-CPE-BAT-A + ip address 1.1.1.1 255.255.255.255 +! +interface Loopback2 + description Loopback2 pour R1-CPE-BAT-A + ip address 1.1.1.2 255.255.255.255 +! +interface Loopback10 + description created from config file uploaded from postman + ip address 10.10.10.10 255.255.255.255 +! +interface FastEthernet0/0 + ip address 172.16.100.62 255.255.255.192 + duplex half +! +interface Serial1/0 + no ip address + shutdown + serial restart-delay 0 +! +interface Serial1/1 + ip address 10.1.1.1 255.255.255.252 + shutdown + serial restart-delay 0 +! +interface Serial1/2 + no ip address + shutdown + serial restart-delay 0 +! +interface Serial1/3 + no ip address + shutdown + serial restart-delay 0 +! +interface GigabitEthernet2/0 + no ip address + negotiation auto +! +interface GigabitEthernet2/0.10 + description "Gateway for teacher vlan" + encapsulation dot1Q 10 + ip address 172.16.10.253 255.255.255.0 + vrrp 10 ip 172.16.10.252 +! +interface GigabitEthernet2/0.20 + description "Gateway for student vlan" + encapsulation dot1Q 20 + ip address 172.16.20.253 255.255.255.0 + vrrp 20 ip 172.16.20.252 +! +interface GigabitEthernet2/0.99 + encapsulation dot1Q 99 + ip address 172.16.100.125 255.255.255.192 + vrrp 99 ip 172.16.100.124 +! +router ospf 1 + router-id 1.1.1.1 + log-adjacency-changes + passive-interface FastEthernet0/0 + passive-interface GigabitEthernet2/0.99 + network 10.1.1.0 0.0.0.3 area 0 + network 172.16.10.0 0.0.0.255 area 0 + network 172.16.20.0 0.0.0.255 area 0 + network 172.16.100.0 0.0.0.63 area 0 + network 172.16.100.64 0.0.0.63 area 0 +! +ip forward-protocol nd +no ip http server +no ip http secure-server +! +! +! +no cdp log mismatch duplex +! +! +! +! +! +! +control-plane +! +! +! +! +! +! +! +gatekeeper + shutdown +! +! +line con 0 + exec-timeout 0 0 + privilege level 15 + logging synchronous + stopbits 1 +line aux 0 + exec-timeout 0 0 + privilege level 15 + logging synchronous + stopbits 1 +line vty 0 4 + login local + transport input ssh +! +end \ No newline at end of file diff --git a/fastprod_backend/fastprod/snapshots/R1-CPE-BAT-A_20251127135248.conf b/fastprod_backend/fastprod/snapshots/R1-CPE-BAT-A_20251127135248.conf new file mode 100644 index 0000000..7a37fbe --- /dev/null +++ b/fastprod_backend/fastprod/snapshots/R1-CPE-BAT-A_20251127135248.conf @@ -0,0 +1,168 @@ +! +upgrade fpd auto +version 12.4 +service timestamps debug datetime msec +service timestamps log datetime msec +no service password-encryption +! +hostname R1-CPE-BAT-A +! +boot-start-marker +boot-end-marker +! +logging message-counter syslog +! +no aaa new-model +ip source-route +no ip icmp rate-limit unreachable +ip cef +! +! +! +! +no ip domain lookup +ip domain name r1.cpe.local +no ipv6 cef +! +multilink bundle-name authenticated +! +! +! +! +! +! +! +! +! +! +! +! +! +! +! +! +file prompt quiet +username cisco privilege 15 password 0 cisco +archive + log config + hidekeys +! +! +! +! +! +ip tcp synwait-time 5 +ip ssh version 2 +ip scp server enable +! +! +! +! +interface Loopback1 + description Loopback pour R1-CPE-BAT-A + ip address 1.1.1.1 255.255.255.255 +! +interface Loopback2 + description Loopback2 pour R1-CPE-BAT-A + ip address 1.1.1.2 255.255.255.255 +! +interface Loopback10 + description created from config file uploaded from postman + ip address 10.10.10.10 255.255.255.255 +! +interface FastEthernet0/0 + ip address 172.16.100.62 255.255.255.192 + duplex half +! +interface Serial1/0 + no ip address + shutdown + serial restart-delay 0 +! +interface Serial1/1 + ip address 10.1.1.1 255.255.255.252 + shutdown + serial restart-delay 0 +! +interface Serial1/2 + no ip address + shutdown + serial restart-delay 0 +! +interface Serial1/3 + no ip address + shutdown + serial restart-delay 0 +! +interface GigabitEthernet2/0 + no ip address + negotiation auto +! +interface GigabitEthernet2/0.10 + description "Gateway for teacher vlan" + encapsulation dot1Q 10 + ip address 172.16.10.253 255.255.255.0 + vrrp 10 ip 172.16.10.252 +! +interface GigabitEthernet2/0.20 + description "Gateway for student vlan" + encapsulation dot1Q 20 + ip address 172.16.20.253 255.255.255.0 + vrrp 20 ip 172.16.20.252 +! +interface GigabitEthernet2/0.99 + encapsulation dot1Q 99 + ip address 172.16.100.125 255.255.255.192 + vrrp 99 ip 172.16.100.124 +! +router ospf 1 + router-id 1.1.1.1 + log-adjacency-changes + passive-interface FastEthernet0/0 + passive-interface GigabitEthernet2/0.99 + network 10.1.1.0 0.0.0.3 area 0 + network 172.16.10.0 0.0.0.255 area 0 + network 172.16.20.0 0.0.0.255 area 0 + network 172.16.100.0 0.0.0.63 area 0 + network 172.16.100.64 0.0.0.63 area 0 +! +ip forward-protocol nd +no ip http server +no ip http secure-server +! +! +! +no cdp log mismatch duplex +! +! +! +! +! +! +control-plane +! +! +! +! +! +! +! +gatekeeper + shutdown +! +! +line con 0 + exec-timeout 0 0 + privilege level 15 + logging synchronous + stopbits 1 +line aux 0 + exec-timeout 0 0 + privilege level 15 + logging synchronous + stopbits 1 +line vty 0 4 + login local + transport input ssh +! +end \ No newline at end of file diff --git a/fastprod_backend/fastprod/snapshots/R1-CPE-BAT-A_20251127135309.conf b/fastprod_backend/fastprod/snapshots/R1-CPE-BAT-A_20251127135309.conf new file mode 100644 index 0000000..7a37fbe --- /dev/null +++ b/fastprod_backend/fastprod/snapshots/R1-CPE-BAT-A_20251127135309.conf @@ -0,0 +1,168 @@ +! +upgrade fpd auto +version 12.4 +service timestamps debug datetime msec +service timestamps log datetime msec +no service password-encryption +! +hostname R1-CPE-BAT-A +! +boot-start-marker +boot-end-marker +! +logging message-counter syslog +! +no aaa new-model +ip source-route +no ip icmp rate-limit unreachable +ip cef +! +! +! +! +no ip domain lookup +ip domain name r1.cpe.local +no ipv6 cef +! +multilink bundle-name authenticated +! +! +! +! +! +! +! +! +! +! +! +! +! +! +! +! +file prompt quiet +username cisco privilege 15 password 0 cisco +archive + log config + hidekeys +! +! +! +! +! +ip tcp synwait-time 5 +ip ssh version 2 +ip scp server enable +! +! +! +! +interface Loopback1 + description Loopback pour R1-CPE-BAT-A + ip address 1.1.1.1 255.255.255.255 +! +interface Loopback2 + description Loopback2 pour R1-CPE-BAT-A + ip address 1.1.1.2 255.255.255.255 +! +interface Loopback10 + description created from config file uploaded from postman + ip address 10.10.10.10 255.255.255.255 +! +interface FastEthernet0/0 + ip address 172.16.100.62 255.255.255.192 + duplex half +! +interface Serial1/0 + no ip address + shutdown + serial restart-delay 0 +! +interface Serial1/1 + ip address 10.1.1.1 255.255.255.252 + shutdown + serial restart-delay 0 +! +interface Serial1/2 + no ip address + shutdown + serial restart-delay 0 +! +interface Serial1/3 + no ip address + shutdown + serial restart-delay 0 +! +interface GigabitEthernet2/0 + no ip address + negotiation auto +! +interface GigabitEthernet2/0.10 + description "Gateway for teacher vlan" + encapsulation dot1Q 10 + ip address 172.16.10.253 255.255.255.0 + vrrp 10 ip 172.16.10.252 +! +interface GigabitEthernet2/0.20 + description "Gateway for student vlan" + encapsulation dot1Q 20 + ip address 172.16.20.253 255.255.255.0 + vrrp 20 ip 172.16.20.252 +! +interface GigabitEthernet2/0.99 + encapsulation dot1Q 99 + ip address 172.16.100.125 255.255.255.192 + vrrp 99 ip 172.16.100.124 +! +router ospf 1 + router-id 1.1.1.1 + log-adjacency-changes + passive-interface FastEthernet0/0 + passive-interface GigabitEthernet2/0.99 + network 10.1.1.0 0.0.0.3 area 0 + network 172.16.10.0 0.0.0.255 area 0 + network 172.16.20.0 0.0.0.255 area 0 + network 172.16.100.0 0.0.0.63 area 0 + network 172.16.100.64 0.0.0.63 area 0 +! +ip forward-protocol nd +no ip http server +no ip http secure-server +! +! +! +no cdp log mismatch duplex +! +! +! +! +! +! +control-plane +! +! +! +! +! +! +! +gatekeeper + shutdown +! +! +line con 0 + exec-timeout 0 0 + privilege level 15 + logging synchronous + stopbits 1 +line aux 0 + exec-timeout 0 0 + privilege level 15 + logging synchronous + stopbits 1 +line vty 0 4 + login local + transport input ssh +! +end \ No newline at end of file diff --git a/fastprod_backend/fastprod/snapshots/R1-CPE-BAT-A_20251127135329.conf b/fastprod_backend/fastprod/snapshots/R1-CPE-BAT-A_20251127135329.conf new file mode 100644 index 0000000..7a37fbe --- /dev/null +++ b/fastprod_backend/fastprod/snapshots/R1-CPE-BAT-A_20251127135329.conf @@ -0,0 +1,168 @@ +! +upgrade fpd auto +version 12.4 +service timestamps debug datetime msec +service timestamps log datetime msec +no service password-encryption +! +hostname R1-CPE-BAT-A +! +boot-start-marker +boot-end-marker +! +logging message-counter syslog +! +no aaa new-model +ip source-route +no ip icmp rate-limit unreachable +ip cef +! +! +! +! +no ip domain lookup +ip domain name r1.cpe.local +no ipv6 cef +! +multilink bundle-name authenticated +! +! +! +! +! +! +! +! +! +! +! +! +! +! +! +! +file prompt quiet +username cisco privilege 15 password 0 cisco +archive + log config + hidekeys +! +! +! +! +! +ip tcp synwait-time 5 +ip ssh version 2 +ip scp server enable +! +! +! +! +interface Loopback1 + description Loopback pour R1-CPE-BAT-A + ip address 1.1.1.1 255.255.255.255 +! +interface Loopback2 + description Loopback2 pour R1-CPE-BAT-A + ip address 1.1.1.2 255.255.255.255 +! +interface Loopback10 + description created from config file uploaded from postman + ip address 10.10.10.10 255.255.255.255 +! +interface FastEthernet0/0 + ip address 172.16.100.62 255.255.255.192 + duplex half +! +interface Serial1/0 + no ip address + shutdown + serial restart-delay 0 +! +interface Serial1/1 + ip address 10.1.1.1 255.255.255.252 + shutdown + serial restart-delay 0 +! +interface Serial1/2 + no ip address + shutdown + serial restart-delay 0 +! +interface Serial1/3 + no ip address + shutdown + serial restart-delay 0 +! +interface GigabitEthernet2/0 + no ip address + negotiation auto +! +interface GigabitEthernet2/0.10 + description "Gateway for teacher vlan" + encapsulation dot1Q 10 + ip address 172.16.10.253 255.255.255.0 + vrrp 10 ip 172.16.10.252 +! +interface GigabitEthernet2/0.20 + description "Gateway for student vlan" + encapsulation dot1Q 20 + ip address 172.16.20.253 255.255.255.0 + vrrp 20 ip 172.16.20.252 +! +interface GigabitEthernet2/0.99 + encapsulation dot1Q 99 + ip address 172.16.100.125 255.255.255.192 + vrrp 99 ip 172.16.100.124 +! +router ospf 1 + router-id 1.1.1.1 + log-adjacency-changes + passive-interface FastEthernet0/0 + passive-interface GigabitEthernet2/0.99 + network 10.1.1.0 0.0.0.3 area 0 + network 172.16.10.0 0.0.0.255 area 0 + network 172.16.20.0 0.0.0.255 area 0 + network 172.16.100.0 0.0.0.63 area 0 + network 172.16.100.64 0.0.0.63 area 0 +! +ip forward-protocol nd +no ip http server +no ip http secure-server +! +! +! +no cdp log mismatch duplex +! +! +! +! +! +! +control-plane +! +! +! +! +! +! +! +gatekeeper + shutdown +! +! +line con 0 + exec-timeout 0 0 + privilege level 15 + logging synchronous + stopbits 1 +line aux 0 + exec-timeout 0 0 + privilege level 15 + logging synchronous + stopbits 1 +line vty 0 4 + login local + transport input ssh +! +end \ No newline at end of file diff --git a/fastprod_backend/fastprod/snapshots/R1-CPE-BAT-A_20251127135524.conf b/fastprod_backend/fastprod/snapshots/R1-CPE-BAT-A_20251127135524.conf new file mode 100644 index 0000000..7a37fbe --- /dev/null +++ b/fastprod_backend/fastprod/snapshots/R1-CPE-BAT-A_20251127135524.conf @@ -0,0 +1,168 @@ +! +upgrade fpd auto +version 12.4 +service timestamps debug datetime msec +service timestamps log datetime msec +no service password-encryption +! +hostname R1-CPE-BAT-A +! +boot-start-marker +boot-end-marker +! +logging message-counter syslog +! +no aaa new-model +ip source-route +no ip icmp rate-limit unreachable +ip cef +! +! +! +! +no ip domain lookup +ip domain name r1.cpe.local +no ipv6 cef +! +multilink bundle-name authenticated +! +! +! +! +! +! +! +! +! +! +! +! +! +! +! +! +file prompt quiet +username cisco privilege 15 password 0 cisco +archive + log config + hidekeys +! +! +! +! +! +ip tcp synwait-time 5 +ip ssh version 2 +ip scp server enable +! +! +! +! +interface Loopback1 + description Loopback pour R1-CPE-BAT-A + ip address 1.1.1.1 255.255.255.255 +! +interface Loopback2 + description Loopback2 pour R1-CPE-BAT-A + ip address 1.1.1.2 255.255.255.255 +! +interface Loopback10 + description created from config file uploaded from postman + ip address 10.10.10.10 255.255.255.255 +! +interface FastEthernet0/0 + ip address 172.16.100.62 255.255.255.192 + duplex half +! +interface Serial1/0 + no ip address + shutdown + serial restart-delay 0 +! +interface Serial1/1 + ip address 10.1.1.1 255.255.255.252 + shutdown + serial restart-delay 0 +! +interface Serial1/2 + no ip address + shutdown + serial restart-delay 0 +! +interface Serial1/3 + no ip address + shutdown + serial restart-delay 0 +! +interface GigabitEthernet2/0 + no ip address + negotiation auto +! +interface GigabitEthernet2/0.10 + description "Gateway for teacher vlan" + encapsulation dot1Q 10 + ip address 172.16.10.253 255.255.255.0 + vrrp 10 ip 172.16.10.252 +! +interface GigabitEthernet2/0.20 + description "Gateway for student vlan" + encapsulation dot1Q 20 + ip address 172.16.20.253 255.255.255.0 + vrrp 20 ip 172.16.20.252 +! +interface GigabitEthernet2/0.99 + encapsulation dot1Q 99 + ip address 172.16.100.125 255.255.255.192 + vrrp 99 ip 172.16.100.124 +! +router ospf 1 + router-id 1.1.1.1 + log-adjacency-changes + passive-interface FastEthernet0/0 + passive-interface GigabitEthernet2/0.99 + network 10.1.1.0 0.0.0.3 area 0 + network 172.16.10.0 0.0.0.255 area 0 + network 172.16.20.0 0.0.0.255 area 0 + network 172.16.100.0 0.0.0.63 area 0 + network 172.16.100.64 0.0.0.63 area 0 +! +ip forward-protocol nd +no ip http server +no ip http secure-server +! +! +! +no cdp log mismatch duplex +! +! +! +! +! +! +control-plane +! +! +! +! +! +! +! +gatekeeper + shutdown +! +! +line con 0 + exec-timeout 0 0 + privilege level 15 + logging synchronous + stopbits 1 +line aux 0 + exec-timeout 0 0 + privilege level 15 + logging synchronous + stopbits 1 +line vty 0 4 + login local + transport input ssh +! +end \ No newline at end of file diff --git a/fastprod_backend/nornir.log b/fastprod_backend/nornir.log index 7055b09..536db61 100644 --- a/fastprod_backend/nornir.log +++ b/fastprod_backend/nornir.log @@ -53,3 +53,18 @@ TypeError: expected string or bytes-like object, got 'list' 2025-11-27 13:16:50,900 - nornir.core - INFO - run() - Running task 'netmiko_send_config' with args {'config_file': 'fastprod/upload_files/R1-CPE-BAT-A_loopback.conf'} on 1 hosts 2025-11-27 13:18:50,146 - nornir.core - INFO - run() - Running task 'netmiko_send_config' with args {'config_file': 'fastprod/upload_files/R1-CPE-BAT-A_loopback.conf'} on 1 hosts +2025-11-27 13:37:51,507 - nornir.core - INFO - run() - Running task 'napalm_get' with args {'getters': ['get_config']} on 1 hosts +2025-11-27 13:38:36,507 - nornir.core - INFO - run() - Running task 'napalm_get' with args {'getters': ['get_config']} on 1 hosts +2025-11-27 13:39:25,827 - nornir.core - INFO - run() - Running task 'napalm_get' with args {'getters': ['get_config']} on 1 hosts +2025-11-27 13:41:20,882 - nornir.core - INFO - run() - Running task 'napalm_get' with args {'getters': ['get_config']} on 1 hosts +2025-11-27 13:47:08,252 - nornir.core - INFO - run() - Running task 'napalm_get' with args {'getters': ['get_config']} on 1 hosts +2025-11-27 13:47:38,160 - nornir.core - INFO - run() - Running task 'napalm_get' with args {'getters': ['get_config']} on 1 hosts +2025-11-27 13:47:55,759 - nornir.core - INFO - run() - Running task 'napalm_get' with args {'getters': ['get_config']} on 1 hosts +2025-11-27 13:48:27,889 - nornir.core - INFO - run() - Running task 'napalm_get' with args {'getters': ['get_config']} on 1 hosts +2025-11-27 13:48:56,963 - nornir.core - INFO - run() - Running task 'napalm_get' with args {'getters': ['get_config']} on 1 hosts +2025-11-27 13:51:12,137 - nornir.core - INFO - run() - Running task 'napalm_get' with args {'getters': ['get_config']} on 1 hosts +2025-11-27 13:52:20,289 - nornir.core - INFO - run() - Running task 'napalm_get' with args {'getters': ['get_config']} on 1 hosts +2025-11-27 13:52:47,032 - nornir.core - INFO - run() - Running task 'napalm_get' with args {'getters': ['get_config']} on 1 hosts +2025-11-27 13:53:07,676 - nornir.core - INFO - run() - Running task 'napalm_get' with args {'getters': ['get_config']} on 1 hosts +2025-11-27 13:53:27,844 - nornir.core - INFO - run() - Running task 'napalm_get' with args {'getters': ['get_config']} on 1 hosts +2025-11-27 13:55:22,325 - nornir.core - INFO - run() - Running task 'napalm_get' with args {'getters': ['get_config']} on 1 hosts