From d064bdca8d04c5a7c6b6b5d791ad1d3426b9cb9a Mon Sep 17 00:00:00 2001
From: thl-cmk <thl-cmk@outlook.com>
Date: Wed, 22 Feb 2023 15:47:25 +0100
Subject: [PATCH] updated for isr4451-x-k9

---
 pnp/configs/DEFAULT.cfg | 48 +++++++++++++++++------------------------
 pnp/images.toml         |  8 ++++++-
 pnp/open-pnp.py         | 10 +++++++--
 3 files changed, 35 insertions(+), 31 deletions(-)

diff --git a/pnp/configs/DEFAULT.cfg b/pnp/configs/DEFAULT.cfg
index 8aab374..3643f1f 100644
--- a/pnp/configs/DEFAULT.cfg
+++ b/pnp/configs/DEFAULT.cfg
@@ -1,32 +1,24 @@
 version 17.6
 
-aaa new-model
-username admin privilege 15  algorithm-type scrypt secret admin
+event manager applet remove_inactive authorization bypass
+  description remove inactive firmware after reload, rest-config
+  event timer cron cron-entry "@reboot" maxrun 600 name REMOVE-INACTIVE
+  ! event timer countdown time 60 maxrun 600 name REMOVE-INACTIVE
+  action 0000.00 cli command "enable"
+  action 0000.10 syslog facility "EEM" msg "remove inactive images"
+  action 0000.15 cli command "terminal length 0"
+  action 0000.20 cli command "terminal width 0"
+  !
+  action 0010.00 syslog facility "EEM" msg "reset configuration (no reload) START"
+  action 0010.10 cli command "pnp service reset no-reload" pattern "\[yes/no\]"
+  action 0010.15 cli command "y"
+  action 0010.99 syslog facility "EEM" msg "reset configuration (no reload) DONE"
+  !
+  action 0020.00 syslog facility "EEM" msg "remove inactive images start"
+  action 0020.05 cli command "install remove inactive" pattern "\[y/n\]"
+  action 0020.10 cli command "y"
+  action 0020.99 syslog facility "EEM" msg "remove inactive images done"
+  !
+exit
 
-aaa authentication login default local
-aaa authorization exec default local
-aaa authorization console
-
-crypto key generate rsa modulus 4096 label SSH-KEY
-ip ssh version 2
-ip ssh rsa keypair-name SSH-KEY
-
-interface gi0/0/0
- no ip dhcp client client-id
- ip address dhcp
- no shutdown
-!
-interface vlan 1
- ip address dhcp
- no shutdown
-!
-line con 0
-  logging synchronous
-  width 0
-!
-line vty 0 15
-  logging synchronous
-  width 0
-  transport input ssh
-!
 end
diff --git a/pnp/images.toml b/pnp/images.toml
index 1ab3379..54809d1 100644
--- a/pnp/images.toml
+++ b/pnp/images.toml
@@ -50,4 +50,10 @@ models = []
 version = "17.6.1a"
 md5 = "492f47e99136de9e0982c755ac1e1972"
 size = 634708372
-models = ["IR1101-K9"]
\ No newline at end of file
+models = ["IR1101-K9"]
+
+["isr4400-universalk9.17.06.04.SPA.bin"]
+version = "17.6.4"
+md5 = "a7e8ff2f05678db21a5c795d711beec7"
+size = 794317769 
+models = ["ISR4451-X/K9"]
diff --git a/pnp/open-pnp.py b/pnp/open-pnp.py
index 7001321..8f1ec27 100755
--- a/pnp/open-pnp.py
+++ b/pnp/open-pnp.py
@@ -529,8 +529,14 @@ def pnp_bye(udi: str, correlator: str) -> str:
 
 
 def create_new_device(udi: str, src_add: str):
-    serial_num_re = re_compile(r'PID:(?P<product_id>\w+(?:-\w+)*),VID:(?P<hw_version>\w+),SN:(?P<serial_number>\w+)')
-    platform, hw_rev, serial = serial_num_re.findall(udi)[0]
+    # serial_num_re = re_compile(r'PID:(?P<product_id>\w+(?:-\w+)*),VID:(?P<hw_version>\w+),SN:(?P<serial_number>\w+)')
+    # PID:ISR4451-X/K9,VID:V08,SN:FCZ230640AB
+    _udi = udi.split(',')
+    platform = _udi[0].split(':')[1]
+    hw_rev = _udi[1].split(':')[1]
+    serial = _udi[2].split(':')[1]
+    # print(udi)
+    # platform, hw_rev, serial = serial_num_re.findall(udi)[0]
     devices[udi] = Device(
         udi=udi,
         first_seen=strftime(SETTINGS.time_format),
-- 
GitLab