Skip to content

Commit

Permalink
[vstest]: Revert back to 2 sec, and check if we got more than expecte…
Browse files Browse the repository at this point in the history
…d number of syslogs (sonic-net#1091)
  • Loading branch information
prsunny authored and lguohan committed Oct 14, 2019
1 parent 80b2ace commit 629c9d3
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions tests/test_crm.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def setReadOnlyAttr(dvs, obj, attr, val):

def check_syslog(dvs, marker, err_log, expected_cnt):
(exitcode, num) = dvs.runcmd(['sh', '-c', "awk \'/%s/,ENDFILE {print;}\' /var/log/syslog | grep \"%s\" | wc -l" % (marker, err_log)])
assert num.strip() == str(expected_cnt)
assert num.strip() >= str(expected_cnt)

class TestCrm(object):
def test_CrmFdbEntry(self, dvs, testlog):
Expand Down Expand Up @@ -120,10 +120,10 @@ def test_CrmFdbEntry(self, dvs, testlog):
assert new_avail_counter == avail_counter

marker = dvs.add_log_marker()
dvs.runcmd("crm config polling interval 3")
dvs.runcmd("crm config polling interval 2")
dvs.runcmd("crm config thresholds fdb high 90")
dvs.runcmd("crm config thresholds fdb type free")
time.sleep(3)
time.sleep(2)
check_syslog(dvs, marker, "FDB_ENTRY THRESHOLD_EXCEEDED for TH_FREE", 1)

# enable ipv6 on server 2
Expand Down Expand Up @@ -183,10 +183,10 @@ def test_CrmIpv4Route(self, dvs, testlog):
assert new_avail_counter == avail_counter

marker = dvs.add_log_marker()
dvs.runcmd("crm config polling interval 3")
dvs.runcmd("crm config polling interval 2")
dvs.runcmd("crm config thresholds ipv4 route high 90")
dvs.runcmd("crm config thresholds ipv4 route type free")
time.sleep(3)
time.sleep(2)
check_syslog(dvs, marker, "IPV4_ROUTE THRESHOLD_EXCEEDED for TH_FREE",1)

intf_tbl._del("Ethernet0|10.0.0.0/31")
Expand Down Expand Up @@ -253,10 +253,10 @@ def test_CrmIpv6Route(self, dvs, testlog):
assert new_avail_counter == avail_counter

marker = dvs.add_log_marker()
dvs.runcmd("crm config polling interval 3")
dvs.runcmd("crm config polling interval 2")
dvs.runcmd("crm config thresholds ipv6 route high 90")
dvs.runcmd("crm config thresholds ipv6 route type free")
time.sleep(3)
time.sleep(2)
check_syslog(dvs, marker, "IPV6_ROUTE THRESHOLD_EXCEEDED for TH_FREE",1)

intf_tbl._del("Ethernet0|fc00::1/126")
Expand Down Expand Up @@ -308,10 +308,10 @@ def test_CrmIpv4Nexthop(self, dvs, testlog):
assert new_avail_counter == avail_counter

marker = dvs.add_log_marker()
dvs.runcmd("crm config polling interval 3")
dvs.runcmd("crm config polling interval 2")
dvs.runcmd("crm config thresholds ipv4 nexthop high 90")
dvs.runcmd("crm config thresholds ipv4 nexthop type free")
time.sleep(3)
time.sleep(2)
check_syslog(dvs, marker, "IPV4_NEXTHOP THRESHOLD_EXCEEDED for TH_FREE",1)

intf_tbl._del("Ethernet0|10.0.0.0/31")
Expand Down Expand Up @@ -367,10 +367,10 @@ def test_CrmIpv6Nexthop(self, dvs, testlog):
assert new_avail_counter == avail_counter

marker = dvs.add_log_marker()
dvs.runcmd("crm config polling interval 3")
dvs.runcmd("crm config polling interval 2")
dvs.runcmd("crm config thresholds ipv6 nexthop high 90")
dvs.runcmd("crm config thresholds ipv6 nexthop type free")
time.sleep(3)
time.sleep(2)
check_syslog(dvs, marker, "IPV6_NEXTHOP THRESHOLD_EXCEEDED for TH_FREE",1)

intf_tbl._del("Ethernet0|fc00::1/126")
Expand Down Expand Up @@ -422,10 +422,10 @@ def test_CrmIpv4Neighbor(self, dvs, testlog):
assert new_avail_counter == avail_counter

marker = dvs.add_log_marker()
dvs.runcmd("crm config polling interval 3")
dvs.runcmd("crm config polling interval 2")
dvs.runcmd("crm config thresholds ipv4 neighbor high 90")
dvs.runcmd("crm config thresholds ipv4 neighbor type free")
time.sleep(3)
time.sleep(2)
check_syslog(dvs, marker, "IPV4_NEIGHBOR THRESHOLD_EXCEEDED for TH_FREE",1)

intf_tbl._del("Ethernet0|10.0.0.0/31")
Expand Down Expand Up @@ -481,10 +481,10 @@ def test_CrmIpv6Neighbor(self, dvs, testlog):
assert new_avail_counter == avail_counter

marker = dvs.add_log_marker()
dvs.runcmd("crm config polling interval 3")
dvs.runcmd("crm config polling interval 2")
dvs.runcmd("crm config thresholds ipv6 neighbor high 90")
dvs.runcmd("crm config thresholds ipv6 neighbor type free")
time.sleep(3)
time.sleep(2)
check_syslog(dvs, marker, "IPV6_NEIGHBOR THRESHOLD_EXCEEDED for TH_FREE",1)

intf_tbl._del("Ethernet0|fc00::1/126")
Expand Down Expand Up @@ -549,10 +549,10 @@ def test_CrmNexthopGroup(self, dvs, testlog):
assert new_avail_counter == avail_counter

marker = dvs.add_log_marker()
dvs.runcmd("crm config polling interval 3")
dvs.runcmd("crm config polling interval 2")
dvs.runcmd("crm config thresholds nexthop group member high 90")
dvs.runcmd("crm config thresholds nexthop group object type free")
time.sleep(3)
time.sleep(2)
check_syslog(dvs, marker, "NEXTHOP_GROUP THRESHOLD_EXCEEDED for TH_FREE",1)

intf_tbl._del("Ethernet0|10.0.0.0/31")
Expand Down Expand Up @@ -624,10 +624,10 @@ def test_CrmNexthopGroupMember(self, dvs, testlog):
assert new_avail_counter == avail_counter

marker = dvs.add_log_marker()
dvs.runcmd("crm config polling interval 3")
dvs.runcmd("crm config polling interval 2")
dvs.runcmd("crm config thresholds nexthop group member high 90")
dvs.runcmd("crm config thresholds nexthop group member type free")
time.sleep(3)
time.sleep(2)
check_syslog(dvs, marker, "NEXTHOP_GROUP_MEMBER THRESHOLD_EXCEEDED for TH_FREE",1)

intf_tbl._del("Ethernet0|10.0.0.0/31")
Expand Down

0 comments on commit 629c9d3

Please sign in to comment.