Skip to content

Commit

Permalink
[dvs] Update tests to use correct command to bring up interfaces (#1260)
Browse files Browse the repository at this point in the history
* [dvs] Update tests to use correct command to bring up interfaces

Signed-off-by: Danny Allen <daall@microsoft.com>
  • Loading branch information
daall authored Apr 16, 2020
1 parent 53ee2e3 commit aa116f4
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 42 deletions.
20 changes: 10 additions & 10 deletions tests/test_crm.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def test_CrmIpv4Route(self, dvs, testlog):
fvs = swsscommon.FieldValuePairs([("NULL","NULL")])
intf_tbl.set("Ethernet0", fvs)
intf_tbl.set("Ethernet0|10.0.0.0/31", fvs)
dvs.runcmd("ifconfig Ethernet0 up")
dvs.runcmd("config interface startup Ethernet0")

dvs.runcmd("crm config polling interval 1")

Expand Down Expand Up @@ -205,7 +205,7 @@ def test_CrmIpv6Route(self, dvs, testlog):
fvs = swsscommon.FieldValuePairs([("NULL","NULL")])
intf_tbl.set("Ethernet0", fvs)
intf_tbl.set("Ethernet0|fc00::1/126", fvs)
dvs.runcmd("ifconfig Ethernet0 up")
dvs.runcmd("config interface startup Ethernet0")

dvs.servers[0].runcmd("ifconfig eth0 inet6 add fc00::2/126")
dvs.servers[0].runcmd("ip -6 route add default via fc00::1")
Expand Down Expand Up @@ -271,7 +271,7 @@ def test_CrmIpv4Nexthop(self, dvs, testlog):
fvs = swsscommon.FieldValuePairs([("NULL","NULL")])
intf_tbl.set("Ethernet0|10.0.0.0/31", fvs)
intf_tbl.set("Ethernet0", fvs)
dvs.runcmd("ifconfig Ethernet0 up")
dvs.runcmd("config interface startup Ethernet0")

dvs.runcmd("crm config polling interval 1")

Expand Down Expand Up @@ -330,7 +330,7 @@ def test_CrmIpv6Nexthop(self, dvs, testlog):
fvs = swsscommon.FieldValuePairs([("NULL","NULL")])
intf_tbl.set("Ethernet0", fvs)
intf_tbl.set("Ethernet0|fc00::1/126", fvs)
dvs.runcmd("ifconfig Ethernet0 up")
dvs.runcmd("config interface startup Ethernet0")

dvs.runcmd("crm config polling interval 1")

Expand Down Expand Up @@ -385,7 +385,7 @@ def test_CrmIpv4Neighbor(self, dvs, testlog):
fvs = swsscommon.FieldValuePairs([("NULL","NULL")])
intf_tbl.set("Ethernet0", fvs)
intf_tbl.set("Ethernet0|10.0.0.0/31", fvs)
dvs.runcmd("ifconfig Ethernet0 up")
dvs.runcmd("config interface startup Ethernet0")

dvs.runcmd("crm config polling interval 1")

Expand Down Expand Up @@ -444,7 +444,7 @@ def test_CrmIpv6Neighbor(self, dvs, testlog):
fvs = swsscommon.FieldValuePairs([("NULL","NULL")])
intf_tbl.set("Ethernet0", fvs)
intf_tbl.set("Ethernet0|fc00::1/126", fvs)
dvs.runcmd("ifconfig Ethernet0 up")
dvs.runcmd("config interface startup Ethernet0")

dvs.runcmd("crm config polling interval 1")

Expand Down Expand Up @@ -501,8 +501,8 @@ def test_CrmNexthopGroup(self, dvs, testlog):
intf_tbl.set("Ethernet4", fvs)
intf_tbl.set("Ethernet0|10.0.0.0/31", fvs)
intf_tbl.set("Ethernet4|10.0.0.2/31", fvs)
dvs.runcmd("ifconfig Ethernet0 up")
dvs.runcmd("ifconfig Ethernet4 up")
dvs.runcmd("config interface startup Ethernet0")
dvs.runcmd("config interface startup Ethernet4")

dvs.runcmd("crm config polling interval 1")

Expand Down Expand Up @@ -576,8 +576,8 @@ def test_CrmNexthopGroupMember(self, dvs, testlog):
intf_tbl.set("Ethernet4", fvs)
intf_tbl.set("Ethernet0|10.0.0.0/31", fvs)
intf_tbl.set("Ethernet4|10.0.0.2/31", fvs)
dvs.runcmd("ifconfig Ethernet0 up")
dvs.runcmd("ifconfig Ethernet4 up")
dvs.runcmd("config interface startup Ethernet0")
dvs.runcmd("config interface startup Ethernet4")

dvs.runcmd("crm config polling interval 1")

Expand Down
1 change: 0 additions & 1 deletion tests/test_fdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,4 +382,3 @@ def test_FdbAddedAfterMemberCreated(self, dvs, testlog):
dvs.runcmd("sonic-clear fdb all")
dvs.remove_vlan_member("2", "Ethernet0")
dvs.remove_vlan("2")

4 changes: 2 additions & 2 deletions tests/test_nat.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ def set_interfaces(self, dvs):
self.config_db.create_entry("INTERFACE", "Ethernet4|18.18.18.1/24", fvs)
self.config_db.create_entry("INTERFACE", "Ethernet0", fvs)
self.config_db.create_entry("INTERFACE", "Ethernet4", fvs)
dvs.runcmd("ifconfig Ethernet0 up")
dvs.runcmd("ifconfig Ethernet4 up")
dvs.runcmd("config interface startup Ethernet0")
dvs.runcmd("config interface startup Ethernet4")

dvs.servers[0].runcmd("ip link set down dev eth0")
dvs.servers[0].runcmd("ip link set up dev eth0")
Expand Down
6 changes: 3 additions & 3 deletions tests/test_nhg.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ def test_route_nhg(self, dvs, testlog):
intf_tbl.set("Ethernet0|10.0.0.0/31", fvs)
intf_tbl.set("Ethernet4|10.0.0.2/31", fvs)
intf_tbl.set("Ethernet8|10.0.0.4/31", fvs)
dvs.runcmd("ifconfig Ethernet0 up")
dvs.runcmd("ifconfig Ethernet4 up")
dvs.runcmd("ifconfig Ethernet8 up")
dvs.runcmd("config interface startup Ethernet0")
dvs.runcmd("config interface startup Ethernet4")
dvs.runcmd("config interface startup Ethernet8")

dvs.runcmd("arp -s 10.0.0.1 00:00:00:00:00:01")
dvs.runcmd("arp -s 10.0.0.3 00:00:00:00:00:02")
Expand Down
12 changes: 8 additions & 4 deletions tests/test_port.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@ def test_PortMtu(self, dvs, testlog):
assert fv[1] == "9100"

def test_PortNotification(self, dvs, testlog):
dvs.runcmd("config interface startup Ethernet0")
dvs.runcmd("config interface ip add Ethernet0 10.0.0.0/31")

dvs.runcmd("ifconfig Ethernet0 10.0.0.0/31 up") == 0
dvs.runcmd("ifconfig Ethernet4 10.0.0.2/31 up") == 0
dvs.runcmd("config interface startup Ethernet4")
dvs.runcmd("config interface ip add Ethernet4 10.0.0.2/31")

dvs.servers[0].runcmd("ip link set down dev eth0") == 0

Expand Down Expand Up @@ -69,9 +71,11 @@ def test_PortNotification(self, dvs, testlog):
assert oper_status == "up"

def test_PortFec(self, dvs, testlog):
dvs.runcmd("config interface startup Ethernet0")
dvs.runcmd("config interface ip add Ethernet0 10.0.0.0/31")

dvs.runcmd("ifconfig Ethernet0 10.0.0.0/31 up") == 0
dvs.runcmd("ifconfig Ethernet4 10.0.0.2/31 up") == 0
dvs.runcmd("config interface startup Ethernet4")
dvs.runcmd("config interface ip add Ethernet4 10.0.0.2/31")

dvs.servers[0].runcmd("ip link set down dev eth0") == 0

Expand Down
44 changes: 22 additions & 22 deletions tests/test_warm_reboot.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,8 @@ def test_PortSyncdWarmRestart(self, dvs, testlog):

dvs.runcmd("config warm_restart enable swss")

dvs.runcmd("ifconfig Ethernet16 up")
dvs.runcmd("ifconfig Ethernet20 up")
dvs.runcmd("config interface startup Ethernet16")
dvs.runcmd("config interface startup Ethernet20")

time.sleep(1)

Expand All @@ -256,8 +256,8 @@ def test_PortSyncdWarmRestart(self, dvs, testlog):
intf_tbl.set("Ethernet20|11.0.0.9/29", fvs)
intf_tbl.set("Ethernet16", fvs)
intf_tbl.set("Ethernet20", fvs)
dvs.runcmd("ifconfig Ethernet16 up")
dvs.runcmd("ifconfig Ethernet20 up")
dvs.runcmd("config interface startup Ethernet16")
dvs.runcmd("config interface startup Ethernet20")

dvs.servers[4].runcmd("ip link set down dev eth0") == 0
dvs.servers[4].runcmd("ip link set up dev eth0") == 0
Expand Down Expand Up @@ -315,7 +315,7 @@ def test_PortSyncdWarmRestart(self, dvs, testlog):

check_port_oper_status(appl_db, "Ethernet16", "up")
check_port_oper_status(appl_db, "Ethernet20", "up")
check_port_oper_status(appl_db, "Ethernet24", "up")
check_port_oper_status(appl_db, "Ethernet24", "down")


swss_app_check_RestoreCount_single(state_db, restore_count, "portsyncd")
Expand All @@ -336,8 +336,8 @@ def test_VlanMgrdWarmRestart(self, dvs, testlog):
dvs.runcmd("ifconfig Ethernet16 0")
dvs.runcmd("ifconfig Ethernet20 0")

dvs.runcmd("ifconfig Ethernet16 up")
dvs.runcmd("ifconfig Ethernet20 up")
dvs.runcmd("config interface startup Ethernet16 ")
dvs.runcmd("config interface startup Ethernet20 ")

time.sleep(1)

Expand Down Expand Up @@ -384,8 +384,8 @@ def test_VlanMgrdWarmRestart(self, dvs, testlog):
intf_tbl.set("Vlan20|11.0.0.9/29", fvs)
intf_tbl.set("Vlan16", fvs)
intf_tbl.set("Vlan20", fvs)
dvs.runcmd("ifconfig Vlan16 up")
dvs.runcmd("ifconfig Vlan20 up")
dvs.runcmd("config interface startup Vlan16")
dvs.runcmd("config interface startup Vlan20")

dvs.servers[4].runcmd("ifconfig eth0 11.0.0.2/29")
dvs.servers[4].runcmd("ip route add default via 11.0.0.1")
Expand Down Expand Up @@ -478,8 +478,8 @@ def test_swss_neighbor_syncup(self, dvs, testlog):
intf_tbl.set("{}".format(intfs[1]), fvs)
intf_tbl.set("{}".format(intfs[0]), fvs)
intf_tbl.set("{}".format(intfs[1]), fvs)
dvs.runcmd("ifconfig {} up".format(intfs[0]))
dvs.runcmd("ifconfig {} up".format(intfs[1]))
dvs.runcmd("config interface startup {}".format(intfs[0]))
dvs.runcmd("config interface startup {}".format(intfs[1]))

ips = ["24.0.0.2", "24.0.0.3", "28.0.0.2", "28.0.0.3"]
v6ips = ["2400::2", "2400::3", "2800::2", "2800::3"]
Expand Down Expand Up @@ -831,8 +831,8 @@ def test_OrchagentWarmRestartReadyCheck(self, dvs, testlog):
intf_tbl.set("Ethernet4|10.0.0.2/31", fvs)
intf_tbl.set("Ethernet0", fvs)
intf_tbl.set("Ethernet4", fvs)
dvs.runcmd("ifconfig Ethernet0 up")
dvs.runcmd("ifconfig Ethernet4 up")
dvs.runcmd("config interface startup Ethernet0")
dvs.runcmd("config interface startup Ethernet4")

dvs.servers[0].runcmd("ifconfig eth0 10.0.0.1/31")
dvs.servers[0].runcmd("ip route add default via 10.0.0.0")
Expand Down Expand Up @@ -904,9 +904,9 @@ def test_swss_port_state_syncup(self, dvs, testlog):
intf_tbl.set("Ethernet0", fvs)
intf_tbl.set("Ethernet4", fvs)
intf_tbl.set("Ethernet8", fvs)
dvs.runcmd("ifconfig Ethernet0 up")
dvs.runcmd("ifconfig Ethernet4 up")
dvs.runcmd("ifconfig Ethernet8 up")
dvs.runcmd("config interface startup Ethernet0")
dvs.runcmd("config interface startup Ethernet4")
dvs.runcmd("config interface startup Ethernet8")

dvs.runcmd("arp -s 10.0.0.1 00:00:00:00:00:01")
dvs.runcmd("arp -s 10.0.0.3 00:00:00:00:00:02")
Expand Down Expand Up @@ -1075,9 +1075,9 @@ def test_routing_WarmRestart(self, dvs, testlog):
intf_tbl.set("{}".format(intfs[1]), fvs)
intf_tbl.set("{}".format(intfs[2]), fvs)
intf_tbl.set("{}".format(intfs[2]), fvs)
dvs.runcmd("ip link set {} up".format(intfs[0]))
dvs.runcmd("ip link set {} up".format(intfs[1]))
dvs.runcmd("ip link set {} up".format(intfs[2]))
dvs.runcmd("config interface startup {}".format(intfs[0]))
dvs.runcmd("config interface startup {}".format(intfs[1]))
dvs.runcmd("config interface startup {}".format(intfs[2]))

time.sleep(1)

Expand Down Expand Up @@ -1835,7 +1835,7 @@ def test_system_warmreboot_neighbor_syncup(self, dvs, testlog):
intf_tbl.set("Ethernet{}|{}00::1/64".format(i*4, i*4), fvs)
intf_tbl.set("Ethernet{}".format(i*4, i*4), fvs)
intf_tbl.set("Ethernet{}".format(i*4, i*4), fvs)
dvs.runcmd("ip link set Ethernet{} up".format(i*4, i*4))
dvs.runcmd("config interface startup Ethernet{}".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 @@ -2082,8 +2082,8 @@ def test_VrfMgrdWarmRestart(self, dvs, testlog):
dvs.runcmd("config warm_restart enable swss")

# bring up interface
dvs.runcmd("ifconfig Ethernet0 up")
dvs.runcmd("ifconfig Ethernet4 up")
dvs.runcmd("config interface startup Ethernet0 ")
dvs.runcmd("config interface startup Ethernet4 ")

# create vrf
create_entry_tbl(conf_db, "VRF", "Vrf_1", [('empty', 'empty')])
Expand Down

0 comments on commit aa116f4

Please sign in to comment.