Skip to content

Commit ec5e1e8

Browse files
committed
Update test_syslog_source_ip.py
1 parent 5097f0c commit ec5e1e8

File tree

2 files changed

+23
-15
lines changed

2 files changed

+23
-15
lines changed

tests/syslog/syslog_utils.py

-1
Original file line numberDiff line numberDiff line change
@@ -156,4 +156,3 @@ def capture_syslog_packets(dut, tcpdump_cmd, logging_data):
156156
# fetch pcap file from dut to mgmt
157157
dut.fetch(src=dut_pcap_filepath, dest=syslogUtilsConst.DOCKER_TMP_PATH)
158158
return sonic_mgmt_pcap_filepath
159-

tests/syslog/test_syslog_source_ip.py

+23-14
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,15 @@
6969
"vrf_set_source_set_800"]
7070
SYSLOG_DEFAULT_PORT = 514
7171
TEST_FORWARD_FLAGS_AND_MSGS = {
72-
"default": ('', ''),
73-
"teamd_": ("-t teamd_", "teamd_"),
74-
"bgp0#frr": ("-t bgp0#frr", "bgp0#frr"),
75-
"bgp0#zebra": ("-t bgp0#zebra", "bgp0#zebra"),
76-
"bgp0#staticd": ("-t bgp0#staticd", "bgp0#staticd"),
77-
"bgp0#watchfrr": ("-t bgp0#watchfrr", "bgp0#watchfrr"),
78-
"bgp0#bgpd": ("-t bgp0#bgpd", "bgp0#bgpd"),
79-
"gnmi-native": ("-t gnmi-native", "gnmi-native"),
80-
"telemetry": ("-t telemetry", "telemetry"),
72+
"default": ('', ''),
73+
"teamd_": ("-t teamd_", "teamd_"),
74+
"bgp0#frr": ("-t bgp0#frr", "bgp0#frr"),
75+
"bgp0#zebra": ("-t bgp0#zebra", "bgp0#zebra"),
76+
"bgp0#staticd": ("-t bgp0#staticd", "bgp0#staticd"),
77+
"bgp0#watchfrr": ("-t bgp0#watchfrr", "bgp0#watchfrr"),
78+
"bgp0#bgpd": ("-t bgp0#bgpd", "bgp0#bgpd"),
79+
"gnmi-native": ("-t gnmi-native", "gnmi-native"),
80+
"telemetry": ("-t telemetry", "telemetry"),
8181
"dialout": ("-t dialout", "dialout")}
8282

8383
SYSLOG_THREAD_TIMEOUT = 50
@@ -592,7 +592,10 @@ def gen_tcpdump_cmd_and_capture_syslog_packets(self, routed_interfaces, port, vr
592592
else:
593593
tcpdump_interface = vrf
594594
tcpdump_file_name = syslogUtilsConst.DUT_PCAP_FILEPATH.format(vrf=vrf + '_neg' if neg else vrf)
595-
tcpdump_cmd = f"sudo timeout {syslogUtilsConst.TCPDUMP_CAPTURE_TIME} tcpdump -i {tcpdump_interface} port {port if port else SYSLOG_DEFAULT_PORT} -w {tcpdump_file_name}"
595+
tcpdump_cmd = (
596+
f"sudo timeout {syslogUtilsConst.TCPDUMP_CAPTURE_TIME} tcpdump -i {tcpdump_interface}"
597+
f"port {port if port else SYSLOG_DEFAULT_PORT} -w {tcpdump_file_name}"
598+
)
596599
tcpdump_file = capture_syslog_packets(self.duthost, tcpdump_cmd, logging_data)
597600
return tcpdump_file
598601

@@ -835,8 +838,11 @@ def test_syslog_protocol_filter_severity(self, duthosts, enum_rand_one_per_hwsku
835838
with allure.step("Configure include filter and verify"):
836839
filter_regex = 'sonic'
837840
logging_data = [(logger_flags, filter_regex)]
838-
self.duthost.shell('sonic-db-cli CONFIG_DB hset "SYSLOG_SERVER|{0}" '
839-
'"filter_type" "include" "filter_regex" {1}'.format(default_vrf_rsyslog_ip, filter_regex))
841+
self.duthost.shell(
842+
'sonic-db-cli CONFIG_DB hset "SYSLOG_SERVER|{0}" '
843+
'"filter_type" "include" "filter_regex" {1}'
844+
.format(default_vrf_rsyslog_ip, filter_regex)
845+
)
840846

841847
with allure.step("Check interface of {} send syslog msg with include regex".format(routed_interfaces[0])):
842848
self.check_syslog_msg_is_sent(routed_interfaces, mgmt_interface, port, vrf_list=vrf_list,
@@ -853,8 +859,11 @@ def test_syslog_protocol_filter_severity(self, duthosts, enum_rand_one_per_hwsku
853859

854860
with allure.step("Configure exclude filter and verify"):
855861
filter_regex = 'aa'
856-
self.duthost.shell('sonic-db-cli CONFIG_DB hset'
857-
' "SYSLOG_SERVER|{0}" "filter_type" "exclude" "filter_regex" {1}'.format(default_vrf_rsyslog_ip, filter_regex))
862+
self.duthost.shell(
863+
'sonic-db-cli CONFIG_DB hset'
864+
' "SYSLOG_SERVER|{0}" "filter_type" "exclude" "filter_regex" {1}'
865+
.format(default_vrf_rsyslog_ip, filter_regex)
866+
)
858867

859868
with allure.step("Check interface of {} will not send syslog msg with exclude".format(routed_interfaces[0])):
860869
logging_data = [(logger_flags, filter_regex)]

0 commit comments

Comments
 (0)