Skip to content

Commit

Permalink
Revert back to SAI version 1 15 (#1481)
Browse files Browse the repository at this point in the history
Need to keep master branch at SAI header version 1.15 until 202411 branch is cut.

2dbaca8 2024-12-05 | Revert "[submodule] Update SAI to lates origin master ([submodule] Update SAI to latest origin master #1466)" (HEAD -> 202411, yingfork/revert-back-to-1-15) [Ying Xie]
064a3a8 2024-12-05 | Revert "[meta] Use metadata to check port notification port_id type ([meta] Use metadata to check port notification port_id type #1469)" [Ying Xie]
0383740 2024-12-05 | Revert "[syncd] Add attribute version check feature ([syncd] Add attribute version check feature #1470)" [Ying Xie]
0901dd7 2024-12-05 | Revert "[syncd] Introduce VendorSaiOptions class ([syncd] Introduce VendorSaiOptions class #1472)" [Ying Xie]
  • Loading branch information
yxieca authored Dec 6, 2024
1 parent 8ba9448 commit 4f7eed0
Show file tree
Hide file tree
Showing 30 changed files with 30 additions and 697 deletions.
86 changes: 16 additions & 70 deletions meta/Meta.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@

#include <inttypes.h>

#include <boost/algorithm/string/join.hpp>

#include <set>

// TODO add validation for all oids belong to the same switch
Expand Down Expand Up @@ -3156,25 +3154,6 @@ sai_status_t Meta::meta_sai_validate_meter_bucket_entry(
return SAI_STATUS_NOT_IMPLEMENTED;
}

sai_status_t Meta::meta_sai_validate_prefix_compression_entry(
_In_ const sai_prefix_compression_entry_t* prefix_compression_entry,
_In_ bool create,
_In_ bool get)
{
SWSS_LOG_ENTER();

if (prefix_compression_entry == NULL)
{
SWSS_LOG_ERROR("prefix_compression_entry pointer is NULL");

return SAI_STATUS_INVALID_PARAMETER;
}

// TODO FIX ME

return SAI_STATUS_NOT_IMPLEMENTED;
}

sai_status_t Meta::meta_generic_validation_create(
_In_ const sai_object_meta_key_t& meta_key,
_In_ sai_object_id_t switch_id,
Expand Down Expand Up @@ -6696,14 +6675,24 @@ void Meta::meta_sai_on_port_state_change_single(

auto ot = objectTypeQuery(data.port_id);

bool valid = isPortObjectIdValid(ot);
bool valid = false;

if (!valid)
switch (ot)
{
SWSS_LOG_ERROR("data.port_id %s has unexpected type: %s, expected: %s",
sai_serialize_object_id(data.port_id).c_str(),
sai_serialize_object_type(ot).c_str(),
boost::algorithm::join(getValidPortObjectTypes(), ",").c_str());
// TODO hardcoded types, must advance SAI repository commit to get metadata for this
case SAI_OBJECT_TYPE_PORT:
case SAI_OBJECT_TYPE_BRIDGE_PORT:
case SAI_OBJECT_TYPE_LAG:

valid = true;
break;

default:

SWSS_LOG_ERROR("data.port_id %s has unexpected type: %s, expected PORT, BRIDGE_PORT or LAG",
sai_serialize_object_id(data.port_id).c_str(),
sai_serialize_object_type(ot).c_str());
break;
}

if (valid && !m_oids.objectReferenceExists(data.port_id))
Expand Down Expand Up @@ -7123,46 +7112,3 @@ void Meta::populate(
}
}
}

bool Meta::isPortObjectIdValid(
_In_ sai_object_type_t object_type)
{
SWSS_LOG_ENTER();

auto members = sai_metadata_struct_members_sai_port_oper_status_notification_t;

for (size_t i = 0; members[i]; i++)
{
auto* mb = members[i];

if (mb->membername != std::string("port_id"))
continue;

for (size_t idx = 0; idx < mb->allowedobjecttypeslength; idx++)
{
if (mb->allowedobjecttypes[idx] == object_type)
return true;
}

return false;
}

SWSS_LOG_THROW("port_id member not found on sai_port_oper_status_notification");
}

std::vector<std::string> Meta::getValidPortObjectTypes()
{
SWSS_LOG_ENTER();

auto md = sai_metadata_enum_sai_object_type_t;

std::vector<std::string> v;

for (size_t i = 0; i < md.valuescount; i++)
{
if (isPortObjectIdValid((sai_object_type_t)md.values[i]))
v.push_back(md.valuesshortnames[i]);
}

return v;
}
10 changes: 0 additions & 10 deletions meta/Meta.h
Original file line number Diff line number Diff line change
Expand Up @@ -315,11 +315,6 @@ namespace saimeta
static bool is_ipv6_mask_valid(
_In_ const uint8_t* mask);

static bool isPortObjectIdValid(
_In_ sai_object_type_t object_type);

static std::vector<std::string> getValidPortObjectTypes();

private: // unit tests helpers

bool meta_unittests_get_and_erase_set_readonly_flag(
Expand Down Expand Up @@ -568,11 +563,6 @@ namespace saimeta
_In_ bool create,
_In_ bool get = false);

sai_status_t meta_sai_validate_prefix_compression_entry(
_In_ const sai_prefix_compression_entry_t* prefix_compression_entry,
_In_ bool create,
_In_ bool get = false);

public:

/*
Expand Down
17 changes: 0 additions & 17 deletions meta/SaiInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -378,20 +378,3 @@ sai_status_t SaiInterface::clearStats(

return SAI_STATUS_NOT_IMPLEMENTED;
}

std::shared_ptr<SaiOptions> SaiInterface::getOptions(
_In_ const std::string& key)
{
SWSS_LOG_ENTER();

return m_optionsMap[key];
}

void SaiInterface::setOptions(
_In_ const std::string& key,
_In_ std::shared_ptr<SaiOptions> options)
{
SWSS_LOG_ENTER();

m_optionsMap[key] = options;
}
19 changes: 0 additions & 19 deletions meta/SaiInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@ extern "C" {
#include "saimetadata.h"
}

#include "SaiOptions.h"

#include <map>
#include <memory>
#include <string>

#define SAIREDIS_DECLARE_EVERY_ENTRY(_X) \
SAI_METADATA_DECLARE_EVERY_ENTRY(_X)

Expand Down Expand Up @@ -346,18 +340,5 @@ namespace sairedis

virtual sai_log_level_t logGet(
_In_ sai_api_t api);

public: // non SAI API - options helper

std::shared_ptr<SaiOptions> getOptions(
_In_ const std::string& key);

void setOptions(
_In_ const std::string& key,
_In_ std::shared_ptr<SaiOptions> options);

private:

std::map<std::string, std::shared_ptr<SaiOptions>> m_optionsMap;
};
}
11 changes: 0 additions & 11 deletions meta/SaiOptions.h

This file was deleted.

35 changes: 0 additions & 35 deletions meta/SaiSerialize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -975,20 +975,6 @@ std::string sai_serialize_meter_bucket_entry(
return j.dump();
}

std::string sai_serialize_prefix_compression_entry(
_In_ const sai_prefix_compression_entry_t &prefix_compression_entry)
{
SWSS_LOG_ENTER();

json j;

j["switch_id"] = sai_serialize_object_id(prefix_compression_entry.switch_id);
j["prefix_table_id"] = sai_serialize_object_id(prefix_compression_entry.prefix_table_id);
j["prefix"] = sai_serialize_ip_prefix(prefix_compression_entry.prefix);

return j.dump();
}

std::string sai_serialize_flow_entry(
_In_ const sai_flow_entry_t &flow_entry)
{
Expand Down Expand Up @@ -2684,10 +2670,6 @@ static bool sai_serialize_object_entry(
key = sai_serialize_mcast_fdb_entry(key_entry.mcast_fdb_entry);
return true;

case SAI_OBJECT_TYPE_PREFIX_COMPRESSION_ENTRY:
key = sai_serialize_prefix_compression_entry(key_entry.prefix_compression_entry);
return true;

default:
return false;
}
Expand Down Expand Up @@ -4477,19 +4459,6 @@ void sai_deserialize_meter_bucket_entry(
sai_deserialize_number(j["meter_class"], meter_bucket_entry.meter_class);
}

void sai_deserialize_prefix_compression_entry(
_In_ const std::string& s,
_Out_ sai_prefix_compression_entry_t& prefix_compression_entry)
{
SWSS_LOG_ENTER();

json j = json::parse(s);

sai_deserialize_object_id(j["switch_id"], prefix_compression_entry.switch_id);
sai_deserialize_object_id(j["prefix_table_id"], prefix_compression_entry.prefix_table_id);
sai_deserialize_ip_prefix(j["prefix"], prefix_compression_entry.prefix);
}

void sai_deserialize_flow_entry(
_In_ const std::string& s,
_Out_ sai_flow_entry_t &flow_entry)
Expand Down Expand Up @@ -4941,10 +4910,6 @@ bool sai_deserialize_object_entry(
sai_deserialize_mcast_fdb_entry(object_id, meta_key.objectkey.key.mcast_fdb_entry);
return true;

case SAI_OBJECT_TYPE_PREFIX_COMPRESSION_ENTRY:
sai_deserialize_prefix_compression_entry(object_id, meta_key.objectkey.key.prefix_compression_entry);
return true;

default:
return false;
}
Expand Down
7 changes: 0 additions & 7 deletions meta/sai_serialize.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,6 @@ std::string sai_serialize_fdb_entry(
std::string sai_serialize_meter_bucket_entry(
_In_ const sai_meter_bucket_entry_t &meter_bucket_entry);

std::string sai_serialize_prefix_compression_entry(
_In_ const sai_prefix_compression_entry_t &prefix_compression_entry);

std::string sai_serialize_flow_entry(
_In_ const sai_flow_entry_t &flow_entry);

Expand Down Expand Up @@ -446,10 +443,6 @@ void sai_deserialize_meter_bucket_entry(
_In_ const std::string& s,
_Out_ sai_meter_bucket_entry_t& meter_bucket_entry);

void sai_deserialize_prefix_compression_entry(
_In_ const std::string& s,
_Out_ sai_prefix_compression_entry_t& prefix_compression_entry);

void sai_deserialize_flow_entry(
_In_ const std::string& s,
_Out_ sai_flow_entry_t &flow_entry);
Expand Down
107 changes: 0 additions & 107 deletions syncd/AttrVersionChecker.cpp

This file was deleted.

Loading

0 comments on commit 4f7eed0

Please sign in to comment.