Skip to content

Commit

Permalink
[saisubmodule] Update SAI submodule (#1409)
Browse files Browse the repository at this point in the history
* Update SAI submodule

* Update NVDAMBF2H536C/dashapis.rec

* Run new DASH VS tests

Signed-off-by: Lawrence Lee <lawlee@microsoft.com>

---------

Signed-off-by: Lawrence Lee <lawlee@microsoft.com>
Co-authored-by: Lawrence Lee <lawlee@microsoft.com>
  • Loading branch information
jimmyzhai and theasianpianist authored Sep 6, 2024
1 parent 45ff42c commit dbcba69
Show file tree
Hide file tree
Showing 13 changed files with 151 additions and 85 deletions.
2 changes: 1 addition & 1 deletion .azure-pipelines/test-docker-sonic-vs-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ jobs:
params='--graceful-stop'
fi
all_tests=$(ls test_*.py)
all_tests="${all_tests} p4rt"
all_tests="${all_tests} p4rt dash"
RETRY=3
IMAGE_NAME=docker-sonic-vs:$(Build.DefinitionName).$(Build.BuildNumber).asan-${{ parameters.asan }}
echo $all_tests | xargs -n 1 | xargs -P 8 -I TEST_MODULE sudo ./run-tests.sh "$IMAGE_NAME" "$params" "TEST_MODULE" "$RETRY"
Expand Down
4 changes: 2 additions & 2 deletions meta/MetaKeyHasher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ static bool operator==(
{
// SWSS_LOG_ENTER(); // disabled for performance reasons

return a.switch_id == b.switch_id && a.eni_id == b.eni_id && a.destination == b.destination;
return a.switch_id == b.switch_id && a.destination == b.destination && a.outbound_routing_group_id == b.outbound_routing_group_id;
}

static bool operator==(
Expand Down Expand Up @@ -673,8 +673,8 @@ static inline std::size_t sai_get_hash(
// SWSS_LOG_ENTER(); // disabled for performance reasons

std::size_t hash = 0;
boost::hash_combine(hash, oe.eni_id);
boost::hash_combine(hash, sai_get_hash(oe.destination));
boost::hash_combine(hash, oe.outbound_routing_group_id);

return hash;
}
Expand Down
4 changes: 2 additions & 2 deletions meta/SaiSerialize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1822,8 +1822,8 @@ std::string sai_serialize_outbound_routing_entry(
json j;

j["switch_id"] = sai_serialize_object_id(outbound_routing_entry.switch_id);
j["eni_id"] = sai_serialize_object_id(outbound_routing_entry.eni_id);
j["destination"] = sai_serialize_ip_prefix(outbound_routing_entry.destination);
j["outbound_routing_group_id"] = sai_serialize_object_id(outbound_routing_entry.outbound_routing_group_id);

return j.dump();
}
Expand Down Expand Up @@ -4703,8 +4703,8 @@ void sai_deserialize_outbound_routing_entry(
json j = json::parse(s);

sai_deserialize_object_id(j["switch_id"], outbound_routing_entry.switch_id);
sai_deserialize_object_id(j["eni_id"], outbound_routing_entry.eni_id);
sai_deserialize_ip_prefix(j["destination"], outbound_routing_entry.destination);
sai_deserialize_object_id(j["outbound_routing_group_id"], outbound_routing_entry.outbound_routing_group_id);
}

void sai_deserialize_outbound_ca_to_pa_entry(
Expand Down
8 changes: 4 additions & 4 deletions saiplayer/SaiPlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -880,7 +880,7 @@ sai_status_t SaiPlayer::handle_dash_outbound_routing(
sai_deserialize_outbound_routing_entry(str_object_id, entry);

entry.switch_id = translate_local_to_redis(entry.switch_id);
entry.eni_id = translate_local_to_redis(entry.eni_id);
entry.outbound_routing_group_id = translate_local_to_redis(entry.outbound_routing_group_id);

switch (api)
{
Expand Down Expand Up @@ -1796,7 +1796,7 @@ sai_status_t SaiPlayer::handle_bulk_entry(
sai_deserialize_outbound_routing_entry(object_ids[it], entries[it]);

entries[it].switch_id = translate_local_to_redis(entries[it].switch_id);
entries[it].eni_id = translate_local_to_redis(entries[it].eni_id);
entries[it].outbound_routing_group_id = translate_local_to_redis(entries[it].outbound_routing_group_id);
}

CALL_BULK_CREATE_API_WITH_TIMER("outbound_routing_entry");
Expand Down Expand Up @@ -1991,7 +1991,7 @@ sai_status_t SaiPlayer::handle_bulk_entry(
sai_deserialize_outbound_routing_entry(object_ids[it], entries[it]);

entries[it].switch_id = translate_local_to_redis(entries[it].switch_id);
entries[it].eni_id = translate_local_to_redis(entries[it].eni_id);
entries[it].outbound_routing_group_id = translate_local_to_redis(entries[it].outbound_routing_group_id);
}

CALL_BULK_REMOVE_API_WITH_TIMER("outbound_routing_entry");
Expand Down Expand Up @@ -2193,7 +2193,7 @@ sai_status_t SaiPlayer::handle_bulk_entry(
sai_deserialize_outbound_routing_entry(object_ids[it], entries[it]);

entries[it].switch_id = translate_local_to_redis(entries[it].switch_id);
entries[it].eni_id = translate_local_to_redis(entries[it].eni_id);
entries[it].outbound_routing_group_id = translate_local_to_redis(entries[it].outbound_routing_group_id);
}

CALL_BULK_SET_API_WITH_TIMER("outbound_routing_entry");
Expand Down
1 change: 1 addition & 0 deletions syncd/SwitchNotifications.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ namespace syncd
.on_switch_asic_sdk_health_event = &Slot<context>::onSwitchAsicSdkHealthEvent,
.on_port_host_tx_ready = &Slot<context>::onPortHostTxReady,
.on_twamp_session_event = &Slot<context>::onTwampSessionEvent,
.on_icmp_echo_session_state_change = nullptr,
.on_ha_set_event = nullptr,
.on_ha_scope_event = nullptr,
}) { }
Expand Down
4 changes: 2 additions & 2 deletions syncd/Syncd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1239,7 +1239,7 @@ sai_status_t Syncd::processBulkCreateEntry(
sai_deserialize_outbound_routing_entry(objectIds[it], entries[it]);

entries[it].switch_id = m_translator->translateVidToRid(entries[it].switch_id);
entries[it].eni_id = m_translator->translateVidToRid(entries[it].eni_id);
entries[it].outbound_routing_group_id = m_translator->translateVidToRid(entries[it].outbound_routing_group_id);
}

status = m_vendorSai->bulkCreate(
Expand Down Expand Up @@ -1525,7 +1525,7 @@ sai_status_t Syncd::processBulkRemoveEntry(
sai_deserialize_outbound_routing_entry(objectIds[it], entries[it]);

entries[it].switch_id = m_translator->translateVidToRid(entries[it].switch_id);
entries[it].eni_id = m_translator->translateVidToRid(entries[it].eni_id);
entries[it].outbound_routing_group_id = m_translator->translateVidToRid(entries[it].outbound_routing_group_id);
}

status = m_vendorSai->bulkRemove(
Expand Down
40 changes: 31 additions & 9 deletions syncd/tests/TestSyncdNvdaBf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,28 @@ void SyncdNvdaBfTest::RemoveEni(sai_object_id_t eni)
EXPECT_EQ(SAI_STATUS_SUCCESS, m_sairedis->remove((sai_object_type_t)SAI_OBJECT_TYPE_ENI, eni));
}

sai_object_id_t SyncdNvdaBfTest::CreateOutboundRoutingGroup(bool disabled)
{
SWSS_LOG_ENTER();

sai_object_id_t oid;
sai_attribute_t attr;

attr.id = SAI_OUTBOUND_ROUTING_GROUP_ATTR_DISABLED;
attr.value.booldata = disabled;

EXPECT_EQ(SAI_STATUS_SUCCESS, m_sairedis->create((sai_object_type_t)SAI_OBJECT_TYPE_OUTBOUND_ROUTING_GROUP, &oid, m_switchId, 1, &attr));

return oid;
}

void SyncdNvdaBfTest::RemoveOutboundRoutingGroup(sai_object_id_t outbound_routing_group)
{
SWSS_LOG_ENTER();

EXPECT_EQ(SAI_STATUS_SUCCESS, m_sairedis->remove((sai_object_type_t)SAI_OBJECT_TYPE_OUTBOUND_ROUTING_GROUP, outbound_routing_group));
}

TEST_F(SyncdNvdaBfTest, dashDirectionLookup)
{
sai_attribute_t attr;
Expand Down Expand Up @@ -1100,15 +1122,15 @@ TEST_F(SyncdNvdaBfTest, dashOutboundRoutingEntry)

sai_object_id_t counter = CreateCounter();
sai_object_id_t vnet = CreateVnet(101);
sai_object_id_t eni = CreateEni(vnet);
sai_object_id_t outbound_routing_group = CreateOutboundRoutingGroup(false);

sai_ip_address_t oip6;
oip6.addr_family = SAI_IP_ADDR_FAMILY_IPV6;
inet_pton(AF_INET6, "ffff::", &oip6.addr);

sai_outbound_routing_entry_t entry0;
entry0.switch_id = m_switchId;
entry0.eni_id = eni;
entry0.outbound_routing_group_id = outbound_routing_group;
entry0.destination.addr_family = SAI_IP_ADDR_FAMILY_IPV4;
inet_pton(AF_INET, "192.168.1.0", &entry0.destination.addr.ip4);
inet_pton(AF_INET, "255.255.255.0", &entry0.destination.mask.ip4);
Expand Down Expand Up @@ -1140,7 +1162,7 @@ TEST_F(SyncdNvdaBfTest, dashOutboundRoutingEntry)

EXPECT_EQ(SAI_STATUS_SUCCESS, m_sairedis->remove(&entry0));

RemoveEni(eni);
RemoveOutboundRoutingGroup(outbound_routing_group);
RemoveVnet(vnet);
RemoveCounter(counter);
}
Expand All @@ -1161,8 +1183,8 @@ TEST_F(SyncdNvdaBfTest, dashOutboundRoutingEntryBulk)

sai_object_id_t vnet0 = CreateVnet(101);
sai_object_id_t vnet1 = CreateVnet(102);
sai_object_id_t eni0 = CreateEni(vnet0);
sai_object_id_t eni1 = CreateEni(vnet1);
sai_object_id_t outbound_routing_group0 = CreateOutboundRoutingGroup(false);
sai_object_id_t outbound_routing_group1 = CreateOutboundRoutingGroup(false);

sai_ip_prefix_t dst0 = {};
sai_ip_prefix_t dst1 = {};
Expand Down Expand Up @@ -1196,8 +1218,8 @@ TEST_F(SyncdNvdaBfTest, dashOutboundRoutingEntryBulk)
sai_status_t statuses[entries_count] = {};

sai_outbound_routing_entry_t entries[entries_count] = {
{ .switch_id = m_switchId, .eni_id = eni0, .destination = dst0},
{ .switch_id = m_switchId, .eni_id = eni1, .destination = dst1},
{ .switch_id = m_switchId, .destination = dst0, .outbound_routing_group_id = outbound_routing_group0},
{ .switch_id = m_switchId, .destination = dst1, .outbound_routing_group_id = outbound_routing_group1},
};

EXPECT_EQ(SAI_STATUS_SUCCESS, m_sairedis->bulkCreate(entries_count, entries, attr_count, attr_list, SAI_BULK_OP_ERROR_MODE_STOP_ON_ERROR, statuses));
Expand All @@ -1210,8 +1232,8 @@ TEST_F(SyncdNvdaBfTest, dashOutboundRoutingEntryBulk)
EXPECT_EQ(SAI_STATUS_SUCCESS, statuses[i]);
}

RemoveEni(eni0);
RemoveEni(eni1);
RemoveOutboundRoutingGroup(outbound_routing_group0);
RemoveOutboundRoutingGroup(outbound_routing_group1);
RemoveVnet(vnet0);
RemoveVnet(vnet1);
RemoveCounter(counter0);
Expand Down
3 changes: 3 additions & 0 deletions syncd/tests/TestSyncdNvdaBf.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ class SyncdNvdaBfTest : public ::testing::Test
sai_object_id_t CreateEni(sai_object_id_t vnet);
void RemoveEni(sai_object_id_t eni);

sai_object_id_t CreateOutboundRoutingGroup(bool disabled);
void RemoveOutboundRoutingGroup(sai_object_id_t outbound_routing_group);

protected:
std::shared_ptr<std::thread> m_worker;
std::shared_ptr<sairedis::Sai> m_sairedis;
Expand Down
Loading

0 comments on commit dbcba69

Please sign in to comment.