VTL: Don't swallow exceptions from syslog_rfc5424_parser
Change-Id: I4e93073ceb7b75476e847ae8d56301770c8b264f Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
This commit is contained in:
parent
d870ce4412
commit
d753209888
@ -1043,6 +1043,10 @@ class MethodHolder(VppTestCase):
|
||||
message = data.decode('utf-8')
|
||||
try:
|
||||
message = SyslogMessage.parse(message)
|
||||
except ParseError as e:
|
||||
self.logger.error(e)
|
||||
raise
|
||||
else:
|
||||
self.assertEqual(message.severity, SyslogSeverity.info)
|
||||
self.assertEqual(message.appname, 'NAT')
|
||||
self.assertEqual(message.msgid, 'APMADD' if is_add else 'APMDEL')
|
||||
@ -1057,13 +1061,15 @@ class MethodHolder(VppTestCase):
|
||||
self.assertEqual(sd_params.get('PROTO'), "%d" % IP_PROTOS.tcp)
|
||||
self.assertTrue(sd_params.get('SSUBIX') is not None)
|
||||
self.assertEqual(sd_params.get('SVLAN'), '0')
|
||||
except ParseError as e:
|
||||
self.logger.error(e)
|
||||
|
||||
def verify_syslog_sess(self, data, is_add=True, is_ip6=False):
|
||||
message = data.decode('utf-8')
|
||||
try:
|
||||
message = SyslogMessage.parse(message)
|
||||
except ParseError as e:
|
||||
self.logger.error(e)
|
||||
raise
|
||||
else:
|
||||
self.assertEqual(message.severity, SyslogSeverity.info)
|
||||
self.assertEqual(message.appname, 'NAT')
|
||||
self.assertEqual(message.msgid, 'SADD' if is_add else 'SDEL')
|
||||
@ -1085,8 +1091,6 @@ class MethodHolder(VppTestCase):
|
||||
self.assertEqual(sd_params.get('XDADDR'), self.pg1.remote_ip4)
|
||||
self.assertEqual(sd_params.get('XDPORT'),
|
||||
"%d" % self.tcp_external_port)
|
||||
except ParseError as e:
|
||||
self.logger.error(e)
|
||||
|
||||
def verify_mss_value(self, pkt, mss):
|
||||
"""
|
||||
@ -8165,6 +8169,9 @@ class TestDSlite(MethodHolder):
|
||||
message = data.decode('utf-8')
|
||||
try:
|
||||
message = SyslogMessage.parse(message)
|
||||
except ParseError as e:
|
||||
self.logger.error(e)
|
||||
else:
|
||||
self.assertEqual(message.severity, SyslogSeverity.info)
|
||||
self.assertEqual(message.appname, 'NAT')
|
||||
self.assertEqual(message.msgid, 'APMADD')
|
||||
@ -8179,8 +8186,6 @@ class TestDSlite(MethodHolder):
|
||||
self.assertEqual(sd_params.get('PROTO'), "%d" % proto)
|
||||
self.assertTrue(sd_params.get('SSUBIX') is not None)
|
||||
self.assertEqual(sd_params.get('SV6ENC'), sv6enc)
|
||||
except ParseError as e:
|
||||
self.logger.error(e)
|
||||
|
||||
def test_dslite(self):
|
||||
""" Test DS-Lite """
|
||||
|
@ -18,7 +18,7 @@ class TestSyslog(VppTestCase):
|
||||
super(TestSyslog, cls).setUpClass()
|
||||
|
||||
try:
|
||||
cls.create_pg_interfaces(range(1))
|
||||
cls.pg0, = cls.create_pg_interfaces(range(1))
|
||||
cls.pg0.admin_up()
|
||||
cls.pg0.config_ip4()
|
||||
cls.pg0.resolve_arp()
|
||||
@ -35,7 +35,7 @@ class TestSyslog(VppTestCase):
|
||||
:param facility: facility value
|
||||
:param severity: severity level
|
||||
:param appname: application name that originate message
|
||||
:param msgid: message indetifier
|
||||
:param msgid: message identifier
|
||||
:param sd: structured data (optional)
|
||||
:param msg: free-form message (optional)
|
||||
"""
|
||||
@ -71,7 +71,7 @@ class TestSyslog(VppTestCase):
|
||||
:param facility: facility value
|
||||
:param severity: severity level
|
||||
:param appname: application name that originate message
|
||||
:param msgid: message indetifier
|
||||
:param msgid: message identifier
|
||||
:param sd: structured data (optional)
|
||||
:param msg: free-form message (optional)
|
||||
"""
|
||||
@ -80,6 +80,10 @@ class TestSyslog(VppTestCase):
|
||||
sd = {}
|
||||
try:
|
||||
message = SyslogMessage.parse(message)
|
||||
except ParseError as e:
|
||||
self.logger.error(e)
|
||||
raise
|
||||
else:
|
||||
self.assertEqual(message.facility, facility)
|
||||
self.assertEqual(message.severity, severity)
|
||||
self.assertEqual(message.appname, appname)
|
||||
@ -88,8 +92,6 @@ class TestSyslog(VppTestCase):
|
||||
self.assertEqual(message.sd, sd)
|
||||
self.assertEqual(message.version, 1)
|
||||
self.assertEqual(message.hostname, self.pg0.local_ip4)
|
||||
except ParseError as e:
|
||||
self.logger.error(e)
|
||||
|
||||
def test_syslog(self):
|
||||
""" Syslog Protocol test """
|
||||
|
Loading…
x
Reference in New Issue
Block a user