Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions orchagent/intfsorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,14 @@ void IntfsOrch::doTask(Consumer &consumer)
continue;
}

/* Wait for the Interface entry first */
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to wait in intfmgr as well?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

intfmgr does two tasks of setting IP address and enslaving interface to VRF, which are independent from one another

auto it_intfs = m_syncdIntfses.find(alias);
if (ip_prefix_in_key && it_intfs == m_syncdIntfses.end())
{
it++;
continue;
}

Port port;
if (!gPortsOrch->getPort(alias, port))
{
Expand Down
1 change: 1 addition & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -690,6 +690,7 @@ def add_ip_address(self, interface, ip):
tbl = swsscommon.Table(self.cdb, tbl_name)
fvs = swsscommon.FieldValuePairs([("NULL", "NULL")])
tbl.set(interface + "|" + ip, fvs)
tbl.set(interface, fvs)
time.sleep(1)

def add_neighbor(self, interface, ip, mac):
Expand Down
10 changes: 10 additions & 0 deletions tests/test_crm.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ def test_CrmIpv4Route(dvs, testlog):
config_db = swsscommon.DBConnector(swsscommon.CONFIG_DB, dvs.redis_sock, 0)
intf_tbl = swsscommon.Table(config_db, "INTERFACE")
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")

Expand Down Expand Up @@ -163,6 +164,7 @@ def test_CrmIpv6Route(dvs, testlog):
config_db = swsscommon.DBConnector(swsscommon.CONFIG_DB, dvs.redis_sock, 0)
intf_tbl = swsscommon.Table(config_db, "INTERFACE")
fvs = swsscommon.FieldValuePairs([("NULL","NULL")])
intf_tbl.set("Ethernet0", fvs)
intf_tbl.set("Ethernet0|fc00::1/126", fvs)
dvs.runcmd("ifconfig Ethernet0 up")

Expand Down Expand Up @@ -223,6 +225,7 @@ def test_CrmIpv4Nexthop(dvs, testlog):
intf_tbl = swsscommon.Table(config_db, "INTERFACE")
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("crm config polling interval 1")
Expand Down Expand Up @@ -274,6 +277,7 @@ def test_CrmIpv6Nexthop(dvs, testlog):
config_db = swsscommon.DBConnector(swsscommon.CONFIG_DB, dvs.redis_sock, 0)
intf_tbl = swsscommon.Table(config_db, "INTERFACE")
fvs = swsscommon.FieldValuePairs([("NULL","NULL")])
intf_tbl.set("Ethernet0", fvs)
intf_tbl.set("Ethernet0|fc00::1/126", fvs)
dvs.runcmd("ifconfig Ethernet0 up")

Expand Down Expand Up @@ -322,6 +326,7 @@ def test_CrmIpv4Neighbor(dvs, testlog):
config_db = swsscommon.DBConnector(swsscommon.CONFIG_DB, dvs.redis_sock, 0)
intf_tbl = swsscommon.Table(config_db, "INTERFACE")
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")

Expand Down Expand Up @@ -374,6 +379,7 @@ def test_CrmIpv6Neighbor(dvs, testlog):
config_db = swsscommon.DBConnector(swsscommon.CONFIG_DB, dvs.redis_sock, 0)
intf_tbl = swsscommon.Table(config_db, "INTERFACE")
fvs = swsscommon.FieldValuePairs([("NULL","NULL")])
intf_tbl.set("Ethernet0", fvs)
intf_tbl.set("Ethernet0|fc00::1/126", fvs)
dvs.runcmd("ifconfig Ethernet0 up")

Expand Down Expand Up @@ -422,6 +428,8 @@ def test_CrmNexthopGroup(dvs, testlog):
config_db = swsscommon.DBConnector(swsscommon.CONFIG_DB, dvs.redis_sock, 0)
intf_tbl = swsscommon.Table(config_db, "INTERFACE")
fvs = swsscommon.FieldValuePairs([("NULL","NULL")])
intf_tbl.set("Ethernet0", fvs)
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")
Expand Down Expand Up @@ -489,6 +497,8 @@ def test_CrmNexthopGroupMember(dvs, testlog):
config_db = swsscommon.DBConnector(swsscommon.CONFIG_DB, dvs.redis_sock, 0)
intf_tbl = swsscommon.Table(config_db, "INTERFACE")
fvs = swsscommon.FieldValuePairs([("NULL","NULL")])
intf_tbl.set("Ethernet0", fvs)
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")
Expand Down
1 change: 1 addition & 0 deletions tests/test_dirbcast.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ def test_DirectedBroadcast(dvs, testlog):
# create vlan interface in config db
tbl = swsscommon.Table(db, "VLAN_INTERFACE")
fvs = swsscommon.FieldValuePairs([("family", "IPv4")])
tbl.set("Vlan100", fvs)
tbl.set("Vlan100|192.169.0.1/27", fvs)

time.sleep(1)
Expand Down
3 changes: 3 additions & 0 deletions tests/test_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@ def add_ip_address(self, interface, ip):
tbl = swsscommon.Table(self.cdb, "INTERFACE")
fvs = swsscommon.FieldValuePairs([("NULL", "NULL")])
tbl.set(interface + "|" + ip, fvs)
tbl.set(interface, fvs)
time.sleep(2) # IPv6 netlink message needs longer time

def remove_ip_address(self, interface, ip):
tbl = swsscommon.Table(self.cdb, "INTERFACE")
tbl._del(interface + "|" + ip);
tbl._del(interface);
time.sleep(1)

def set_mtu(self, interface, mtu):
Expand Down Expand Up @@ -243,6 +245,7 @@ def add_ip_address(self, interface, ip):
tbl = swsscommon.Table(self.cdb, "PORTCHANNEL_INTERFACE")
fvs = swsscommon.FieldValuePairs([("NULL", "NULL")])
tbl.set(interface + "|" + ip, fvs)
tbl.set(interface, fvs)
time.sleep(1)

def remove_ip_address(self, interface, ip):
Expand Down
2 changes: 2 additions & 0 deletions tests/test_mirror.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ def add_ip_address(self, interface, ip):
tbl = swsscommon.Table(self.cdb, tbl_name)
fvs = swsscommon.FieldValuePairs([("NULL", "NULL")])
tbl.set(interface + "|" + ip, fvs)
tbl.set(interface, fvs)
time.sleep(1)

def remove_ip_address(self, interface, ip):
Expand All @@ -48,6 +49,7 @@ def remove_ip_address(self, interface, ip):
tbl_name = "INTERFACE"
tbl = swsscommon.Table(self.cdb, tbl_name)
tbl._del(interface + "|" + ip)
tbl._del(interface)
time.sleep(1)

def add_neighbor(self, interface, ip, mac):
Expand Down
3 changes: 3 additions & 0 deletions tests/test_nhg.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ def test_route_nhg(dvs, testlog):
config_db = swsscommon.DBConnector(swsscommon.CONFIG_DB, dvs.redis_sock, 0)
intf_tbl = swsscommon.Table(config_db, "INTERFACE")
fvs = swsscommon.FieldValuePairs([("NULL","NULL")])
intf_tbl.set("Ethernet0", fvs)
intf_tbl.set("Ethernet4", fvs)
intf_tbl.set("Ethernet8", fvs)
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)
Expand Down
2 changes: 2 additions & 0 deletions tests/test_route.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ def test_RouteAdd(dvs, testlog):
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)
intf_tbl.set("Ethernet0", fvs)
intf_tbl.set("Ethernet4", fvs)
dvs.runcmd("ifconfig Ethernet0 up")
dvs.runcmd("ifconfig Ethernet4 up")

Expand Down
48 changes: 48 additions & 0 deletions tests/test_warm_reboot.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ def test_PortSyncdWarmRestart(dvs, testlog):
fvs = swsscommon.FieldValuePairs([("NULL","NULL")])
intf_tbl.set("Ethernet16|11.0.0.1/29", fvs)
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")

Expand Down Expand Up @@ -190,6 +192,8 @@ def test_PortSyncdWarmRestart(dvs, testlog):

intf_tbl._del("Ethernet16|11.0.0.1/29")
intf_tbl._del("Ethernet20|11.0.0.9/29")
intf_tbl._del("Ethernet16")
intf_tbl._del("Ethernet20")
time.sleep(2)


Expand Down Expand Up @@ -248,6 +252,8 @@ def test_VlanMgrdWarmRestart(dvs, testlog):
fvs = swsscommon.FieldValuePairs([("NULL","NULL")])
intf_tbl.set("Vlan16|11.0.0.1/29", fvs)
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")

Expand Down Expand Up @@ -303,6 +309,8 @@ def test_VlanMgrdWarmRestart(dvs, testlog):

intf_tbl._del("Vlan16|11.0.0.1/29")
intf_tbl._del("Vlan20|11.0.0.9/29")
intf_tbl._del("Vlan16")
intf_tbl._del("Vlan20")
time.sleep(2)

def stop_neighsyncd(dvs):
Expand Down Expand Up @@ -407,6 +415,10 @@ def test_swss_neighbor_syncup(dvs, testlog):
intf_tbl.set("{}|28.0.0.9/24".format(intfs[1]), fvs)
intf_tbl.set("{}|2400::1/64".format(intfs[0]), fvs)
intf_tbl.set("{}|2800::1/64".format(intfs[1]), fvs)
intf_tbl.set("{}".format(intfs[0]), fvs)
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]))

Expand Down Expand Up @@ -739,6 +751,10 @@ def test_swss_neighbor_syncup(dvs, testlog):
intf_tbl._del("{}|28.0.0.9/24".format(intfs[1]))
intf_tbl._del("{}|2400::1/64".format(intfs[0]))
intf_tbl._del("{}|2800::1/64".format(intfs[1]))
intf_tbl._del("{}".format(intfs[0]))
intf_tbl._del("{}".format(intfs[1]))
intf_tbl._del("{}".format(intfs[0]))
intf_tbl._del("{}".format(intfs[1]))
time.sleep(2)


Expand All @@ -754,6 +770,8 @@ def test_OrchagentWarmRestartReadyCheck(dvs, testlog):
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)
intf_tbl.set("Ethernet0", fvs)
intf_tbl.set("Ethernet4", fvs)
dvs.runcmd("ifconfig Ethernet0 up")
dvs.runcmd("ifconfig Ethernet4 up")

Expand Down Expand Up @@ -797,6 +815,8 @@ def test_OrchagentWarmRestartReadyCheck(dvs, testlog):

intf_tbl._del("Ethernet0|10.0.0.0/31")
intf_tbl._del("Ethernet4|10.0.0.2/31")
intf_tbl._del("Ethernet0")
intf_tbl._del("Ethernet4")
time.sleep(2)

# recover for test cases after this one.
Expand All @@ -822,6 +842,9 @@ def test_swss_port_state_syncup(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)
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")
Expand Down Expand Up @@ -854,6 +877,9 @@ def test_swss_port_state_syncup(dvs, testlog):
intf_tbl._del("Ethernet0|10.0.0.0/31")
intf_tbl._del("Ethernet4|10.0.0.2/31")
intf_tbl._del("Ethernet8|10.0.0.4/31")
intf_tbl._del("Ethernet0")
intf_tbl._del("Ethernet4")
intf_tbl._del("Ethernet8")
time.sleep(2)

dvs.stop_swss()
Expand All @@ -880,6 +906,9 @@ def test_swss_port_state_syncup(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)
intf_tbl.set("Ethernet0", fvs)
intf_tbl.set("Ethernet4", fvs)
intf_tbl.set("Ethernet8", fvs)
time.sleep(3)

for i in [0, 1, 2]:
Expand Down Expand Up @@ -929,6 +958,9 @@ def test_swss_port_state_syncup(dvs, testlog):
intf_tbl._del("Ethernet0|10.0.0.0/31")
intf_tbl._del("Ethernet4|10.0.0.2/31")
intf_tbl._del("Ethernet8|10.0.0.4/31")
intf_tbl._del("Ethernet0")
intf_tbl._del("Ethernet4")
intf_tbl._del("Ethernet8")
time.sleep(2)


Expand Down Expand Up @@ -987,6 +1019,12 @@ def test_routing_WarmRestart(dvs, testlog):
intf_tbl.set("{}|1220::1/64".format(intfs[1]), fvs)
intf_tbl.set("{}|133.0.0.1/24".format(intfs[2]), fvs)
intf_tbl.set("{}|1330::1/64".format(intfs[2]), fvs)
intf_tbl.set("{}".format(intfs[0]), fvs)
intf_tbl.set("{}".format(intfs[0]), fvs)
intf_tbl.set("{}".format(intfs[1]), fvs)
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]))
Expand Down Expand Up @@ -1578,6 +1616,12 @@ def test_routing_WarmRestart(dvs, testlog):
intf_tbl._del("{}|1220::1/64".format(intfs[1]))
intf_tbl._del("{}|133.0.0.1/24".format(intfs[2]))
intf_tbl._del("{}|1330::1/64".format(intfs[2]))
intf_tbl._del("{}".format(intfs[0]))
intf_tbl._del("{}".format(intfs[0]))
intf_tbl._del("{}".format(intfs[1]))
intf_tbl._del("{}".format(intfs[1]))
intf_tbl._del("{}".format(intfs[2]))
intf_tbl._del("{}".format(intfs[2]))
time.sleep(2)


Expand Down Expand Up @@ -1661,6 +1705,8 @@ def test_system_warmreboot_neighbor_syncup(dvs, testlog):
dvs.runcmd("ip addr flush dev Ethernet{}".format(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)
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.servers[i].runcmd("ip link set up dev eth0")
dvs.servers[i].runcmd("ip addr flush dev eth0")
Expand Down Expand Up @@ -1895,4 +1941,6 @@ def test_system_warmreboot_neighbor_syncup(dvs, testlog):
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))
intf_tbl._del("Ethernet{}".format(i*4, i*4))
intf_tbl._del("Ethernet{}".format(i*4, i*4))