Skip to content

Commit

Permalink
Fix test_system_warmreboot_neighbor_syncup and test_routing_WarmRestart
Browse files Browse the repository at this point in the history
Signed-off-by: Marian Pritsak <marianp@mellanox.com>
  • Loading branch information
marian-pritsak committed Dec 11, 2018
1 parent 166c4d2 commit e7f1c4e
Showing 1 changed file with 32 additions and 16 deletions.
48 changes: 32 additions & 16 deletions tests/test_warm_reboot.py
Original file line number Diff line number Diff line change
Expand Up @@ -798,8 +798,7 @@ def test_swss_port_state_syncup(dvs, testlog):
restore_count = swss_get_RestoreCount(dvs, state_db)

# update port admin state
config_db = swsscommon.DBConnector(swsscommon.CONFIG_DB, dvs.redis_sock, 0)
intf_tbl = swsscommon.Table(config_db, "INTERFACE")
intf_tbl = swsscommon.Table(conf_db, "INTERFACE")
fvs = swsscommon.FieldValuePairs([("NULL","NULL")])
intf_tbl.set("Ethernet0|10.0.0.0/31", fvs)
intf_tbl.set("Ethernet4|10.0.0.2/31", fvs)
Expand Down Expand Up @@ -962,20 +961,23 @@ def test_routing_WarmRestart(dvs, testlog):
# Enable ipv6 on docker
dvs.runcmd("sysctl net.ipv6.conf.all.disable_ipv6=0")

dvs.runcmd("ip -4 addr add 111.0.0.1/24 dev {}".format(intfs[0]))
dvs.runcmd("ip -6 addr add 1110::1/64 dev {}".format(intfs[0]))
dvs.runcmd("ip link set {} up".format(intfs[0]))

dvs.runcmd("ip -4 addr add 122.0.0.1/24 dev {}".format(intfs[1]))
dvs.runcmd("ip -6 addr add 1220::1/64 dev {}".format(intfs[1]))
dvs.runcmd("ip link set {} up".format(intfs[1]))

dvs.runcmd("ip -4 addr add 133.0.0.1/24 dev {}".format(intfs[2]))
dvs.runcmd("ip -6 addr add 1330::1/64 dev {}".format(intfs[2]))
dvs.runcmd("ip link set {} up".format(intfs[2]))
# Defining create neighbor entries (4 ipv4 and 4 ip6, two each on each interface) in linux kernel
intf_tbl = swsscommon.Table(conf_db, "INTERFACE")
fvs = swsscommon.FieldValuePairs([("NULL","NULL")])
intf_tbl.set("Ethernet0|111.0.0.1/24", fvs)
intf_tbl.set("Ethernet0|1110::1/64", fvs)
intf_tbl.set("Ethernet4|122.0.0.1/24", fvs)
intf_tbl.set("Ethernet4|1220::1/64", fvs)
intf_tbl.set("Ethernet8|133.0.0.1/24", fvs)
intf_tbl.set("Ethernet8|1330::1/64", fvs)
dvs.runcmd("ip link set Ethernet0 up")
dvs.runcmd("ip link set Ethernet4 up")
dvs.runcmd("ip link set Ethernet8 up")

time.sleep(1)

dvs.runcmd("ip link show")
dvs.runcmd("ip route show")
#
# Setting peer's ip-addresses and associated neighbor-entries
#
Expand Down Expand Up @@ -1556,6 +1558,14 @@ def test_routing_WarmRestart(dvs, testlog):
rt_key = json.loads(addobjs[0]['key'])
assert rt_key['dest'] == "192.168.100.0/24"

intf_tbl._del("Ethernet0|111.0.0.1/24")
intf_tbl._del("Ethernet0|1110::1/64")
intf_tbl._del("Ethernet4|122.0.0.1/24")
intf_tbl._del("Ethernet4|1220::1/64")
intf_tbl._del("Ethernet8|133.0.0.1/24")
intf_tbl._del("Ethernet8|1330::1/64")
time.sleep(2)


# 'ip neigh flush all' won't remove failed entries if number of neighs less than gc_threshold1
# Also it takes time to remove them completly.
Expand Down Expand Up @@ -1589,15 +1599,17 @@ def test_system_warmreboot_neighbor_syncup(dvs, testlog):
NUM_NEIGH_PER_INTF = 64 #128
NUM_OF_NEIGHS = (NUM_INTF*NUM_NEIGH_PER_INTF)
macs = []
intf_tbl = swsscommon.Table(conf_db, "INTERFACE")
fvs = swsscommon.FieldValuePairs([("NULL","NULL")])
for i in range(8, 8+NUM_INTF):
# set timeout to be the same as real HW
# set ip on server facing interfaces
# bring servers' interface up, save the macs
dvs.runcmd("sysctl -w net.ipv4.neigh.Ethernet{}.base_reachable_time_ms=1800000".format(i*4))
dvs.runcmd("sysctl -w net.ipv6.neigh.Ethernet{}.base_reachable_time_ms=1800000".format(i*4))
dvs.runcmd("ip addr flush dev Ethernet{}".format(i*4))
dvs.runcmd("ifconfig Ethernet{} {}.0.0.1/24 up".format(i*4, i*4))
dvs.runcmd("ip -6 addr add {}00::1/64 dev Ethernet{}".format(i*4,i*4))
intf_tbl.set("Ethernet{}|{}.0.0.1/24".format(i*4, i*4), fvs)
intf_tbl.set("Ethernet{}|{}00::1/64".format(i*4, i*4), fvs)
dvs.runcmd("ip link set Ethernet{} up".format(i*4, i*4))
dvs.servers[i].runcmd("ip link set up dev eth0")
dvs.servers[i].runcmd("ip addr flush dev eth0")
#result = dvs.servers[i].runcmd_output("ifconfig eth0 | grep HWaddr | awk '{print $NF}'")
Expand Down Expand Up @@ -1840,3 +1852,7 @@ def test_system_warmreboot_neighbor_syncup(dvs, testlog):
# disable system warm restart
dvs.runcmd("config warm_restart disable system")

for i in range(8, 8+NUM_INTF):
intf_tbl._del("Ethernet{}|{}.0.0.1/24".format(i*4, i*4))
intf_tbl._del("Ethernet{}|{}00::1/64".format(i*4, i*4))

0 comments on commit e7f1c4e

Please sign in to comment.