From 5f78086280502a0d2ed19c941e36180dc3064c36 Mon Sep 17 00:00:00 2001 From: Simon Bitterli Date: Wed, 9 May 2018 21:58:47 +0200 Subject: [PATCH 1/6] Enhance INTERFACE_DOWN for IOS --- napalm_logs/config/ios/init.yml | 8 ++++---- .../ios/INTERFACE_DOWN/time_synchronized/syslog.msg | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) create mode 100644 tests/config/ios/INTERFACE_DOWN/time_synchronized/syslog.msg diff --git a/napalm_logs/config/ios/init.yml b/napalm_logs/config/ios/init.yml index bab7955e..14f7e20d 100644 --- a/napalm_logs/config/ios/init.yml +++ b/napalm_logs/config/ios/init.yml @@ -6,19 +6,19 @@ prefixes: values: messageId: (\d+) host: ([^ ]+) - date: (\w+\s?\d+) + date: \*?(\w+\s?\W?\d+) time: (\d\d:\d\d:\d\d) milliseconds: (\d\d\d) tag: ([\w-]+) # some messages contain a process number (eg. OSPF related messages) processId: (\d+) - line: '{messageId}: {host}: *{date} {time}.{milliseconds}: %{tag}: Process {processId}, ' + line: '{messageId}: {host}: {date} {time}.{milliseconds}: %{tag}: Process {processId}, ' - time_format: "%b %d %H:%M:%S" values: messageId: (\d+) host: ([^ ]+) - date: (\w+\s?\d+) + date: \*?(\w+\s?\W?\d+) time: (\d\d:\d\d:\d\d) milliseconds: (\d+) tag: ([\w-]+) - line: '{messageId}: {host}: *{date} {time}.{milliseconds}: %{tag}: ' + line: '{messageId}: {host}: {date} {time}.{milliseconds}: %{tag}: ' diff --git a/tests/config/ios/INTERFACE_DOWN/time_synchronized/syslog.msg b/tests/config/ios/INTERFACE_DOWN/time_synchronized/syslog.msg new file mode 100644 index 00000000..3630899b --- /dev/null +++ b/tests/config/ios/INTERFACE_DOWN/time_synchronized/syslog.msg @@ -0,0 +1 @@ +<189>117: NetAuto_CSRv-03: May 9 12:49:27.098: %LINK-5-CHANGED: Interface GigabitEthernet2, changed state to administratively down \ No newline at end of file From a3a905936a2bc2f9c58df9d95e1e034f4dfb5c2f Mon Sep 17 00:00:00 2001 From: Simon Bitterli Date: Thu, 10 May 2018 11:08:25 +0200 Subject: [PATCH 2/6] yang.json added --- .../time_synchronized/yang.json | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 tests/config/ios/INTERFACE_DOWN/time_synchronized/yang.json diff --git a/tests/config/ios/INTERFACE_DOWN/time_synchronized/yang.json b/tests/config/ios/INTERFACE_DOWN/time_synchronized/yang.json new file mode 100644 index 00000000..eab85a44 --- /dev/null +++ b/tests/config/ios/INTERFACE_DOWN/time_synchronized/yang.json @@ -0,0 +1,33 @@ +{ + "yang_message": { + "interfaces": { + "interface": { + "GigabitEthernet2": { + "state": { + "admin_status": "DOWN" + } + } + } + } + }, + "message_details": { + "facility": 23, + "time": "08:30:56", + "pri": "189", + "host": "router1", + "tag": "LINK-5-CHANGED", + "messageId": "521", + "date": "Nov 14", + "message": "Interface GigabitEthernet2, changed state to administratively down", + "milliseconds": "699", + "severity": 5 + }, + "host": "router1", + "timestamp": 1510648256, + "error": "INTERFACE_DOWN", + "ip": "127.0.0.1", + "facility": 23, + "os": "ios", + "yang_model": "openconfig-interfaces", + "severity": 5 +} \ No newline at end of file From 0b44e7f6fc8c67563feab0ea9074e95970890b01 Mon Sep 17 00:00:00 2001 From: Simon Bitterli Date: Thu, 10 May 2018 11:44:34 +0200 Subject: [PATCH 3/6] yang.json changed --- .../time_synchronized/yang.json | 62 +++++++++---------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/tests/config/ios/INTERFACE_DOWN/time_synchronized/yang.json b/tests/config/ios/INTERFACE_DOWN/time_synchronized/yang.json index eab85a44..db56a971 100644 --- a/tests/config/ios/INTERFACE_DOWN/time_synchronized/yang.json +++ b/tests/config/ios/INTERFACE_DOWN/time_synchronized/yang.json @@ -1,33 +1,33 @@ { - "yang_message": { - "interfaces": { - "interface": { - "GigabitEthernet2": { - "state": { - "admin_status": "DOWN" - } - } - } - } - }, - "message_details": { - "facility": 23, - "time": "08:30:56", - "pri": "189", - "host": "router1", - "tag": "LINK-5-CHANGED", - "messageId": "521", - "date": "Nov 14", - "message": "Interface GigabitEthernet2, changed state to administratively down", - "milliseconds": "699", - "severity": 5 - }, - "host": "router1", - "timestamp": 1510648256, - "error": "INTERFACE_DOWN", - "ip": "127.0.0.1", - "facility": 23, - "os": "ios", - "yang_model": "openconfig-interfaces", - "severity": 5 + "yang_message": { + "interfaces": { + "interface": { + "GigabitEthernet2": { + "state": { + "admin_status": "DOWN" + } + } + } + } + }, + "message_details": { + "severity": 5, + "facility": 23, + "messageId": "117", + "pri": "189", + "host": "NetAuto_CSRv-03", + "tag": "LINK-5-CHANGED", + "time": "12:49:27", + "date": "May 9", + "message": "Interface GigabitEthernet2, changed state to administratively down", + "milliseconds": "098" + }, + "facility": 23, + "ip": "127.0.0.1", + "error": "INTERFACE_DOWN", + "host": "NetAuto_CSRv-03", + "yang_model": "openconfig-interfaces", + "timestamp": 1525870167, + "os": "ios", + "severity": 5 } \ No newline at end of file From e2c454d7092f07e44e94e6cc7004621ca1848682 Mon Sep 17 00:00:00 2001 From: Simon Bitterli Date: Thu, 10 May 2018 12:01:16 +0200 Subject: [PATCH 4/6] multiple whitespaces allowed between month and day --- napalm_logs/config/ios/init.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/napalm_logs/config/ios/init.yml b/napalm_logs/config/ios/init.yml index 14f7e20d..4428b214 100644 --- a/napalm_logs/config/ios/init.yml +++ b/napalm_logs/config/ios/init.yml @@ -6,7 +6,7 @@ prefixes: values: messageId: (\d+) host: ([^ ]+) - date: \*?(\w+\s?\W?\d+) + date: \*?(\w+\s*\d+) time: (\d\d:\d\d:\d\d) milliseconds: (\d\d\d) tag: ([\w-]+) @@ -17,7 +17,7 @@ prefixes: values: messageId: (\d+) host: ([^ ]+) - date: \*?(\w+\s?\W?\d+) + date: \*?(\w+\s*\d+) time: (\d\d:\d\d:\d\d) milliseconds: (\d+) tag: ([\w-]+) From e1efb8ffe0519504991435311021607370b4674a Mon Sep 17 00:00:00 2001 From: Simon Bitterli Date: Thu, 10 May 2018 12:07:34 +0200 Subject: [PATCH 5/6] 1 or more whitespaces allowed between month and day --- napalm_logs/config/ios/init.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/napalm_logs/config/ios/init.yml b/napalm_logs/config/ios/init.yml index 4428b214..94047879 100644 --- a/napalm_logs/config/ios/init.yml +++ b/napalm_logs/config/ios/init.yml @@ -6,7 +6,7 @@ prefixes: values: messageId: (\d+) host: ([^ ]+) - date: \*?(\w+\s*\d+) + date: \*?(\w+\s+\d+) time: (\d\d:\d\d:\d\d) milliseconds: (\d\d\d) tag: ([\w-]+) @@ -17,7 +17,7 @@ prefixes: values: messageId: (\d+) host: ([^ ]+) - date: \*?(\w+\s*\d+) + date: \*?(\w+\s+\d+) time: (\d\d:\d\d:\d\d) milliseconds: (\d+) tag: ([\w-]+) From 9be0462d2ef37b4cda01509e658723fa8bc2a42e Mon Sep 17 00:00:00 2001 From: Simon Bitterli Date: Fri, 11 May 2018 09:08:43 +0200 Subject: [PATCH 6/6] 2nd space added to the date in yang.json --- tests/config/ios/INTERFACE_DOWN/time_synchronized/yang.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/config/ios/INTERFACE_DOWN/time_synchronized/yang.json b/tests/config/ios/INTERFACE_DOWN/time_synchronized/yang.json index db56a971..f36caafc 100644 --- a/tests/config/ios/INTERFACE_DOWN/time_synchronized/yang.json +++ b/tests/config/ios/INTERFACE_DOWN/time_synchronized/yang.json @@ -18,7 +18,7 @@ "host": "NetAuto_CSRv-03", "tag": "LINK-5-CHANGED", "time": "12:49:27", - "date": "May 9", + "date": "May 9", "message": "Interface GigabitEthernet2, changed state to administratively down", "milliseconds": "098" },