-
Notifications
You must be signed in to change notification settings - Fork 580
Adding HaOrch
for smartswitch dpu
#3550
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
/azp run |
Azure Pipelines will not run the associated pipelines, because the pull request was updated after the run command was issued. Review the pull request again and issue a new run command. |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
orchagent/dash/dashhaorch.cpp
Outdated
extern sai_dash_eni_api_t* sai_dash_eni_api; | ||
extern sai_object_id_t gSwitchId; | ||
|
||
static std::map<dash::types::HaRole, std::string> ha_role_to_str_map = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it necessary to explicitly define these maps? Might be simpler to use dash::types::HaRole_Name
and dash::types::HaRole_Parse
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addressed
orchagent/dash/dashhaorch.cpp
Outdated
{dash::types::HA_SCOPE_ROLE_SWITCHING_TO_ACTIVE, "HA_SCOPE_ROLE_SWITCHING_TO_ACTIVE"} | ||
}; | ||
|
||
static std::map<dash::types::HaScope, std::string> ha_set_scope_to_str_map = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addressed
orchagent/dash/dashhaorch.cpp
Outdated
} | ||
} | ||
|
||
sai_ip_address_t DashHaOrch::covertPbIpaddrToSaiIpaddr(const dash::types::IpAddress &ipaddr) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use pbutils.cpp::to_sai
instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addressed
return parseHandleSaiStatusFailure(handle_status); | ||
} | ||
} | ||
m_ha_set_entries[key] = HaSetEntry {sai_ha_set_oid, entry}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the expected scale/how many entries do we expect per DPU?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 ha set per DPU.
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
orchagent/dash/dashhaorch.cpp
Outdated
if (ha_scope_it->second.metadata.ha_role() != entry.ha_role()) | ||
{ | ||
return setHaScopeHaRole(key, entry); | ||
} | ||
|
||
if (entry.flow_reconcile_requested() == true) | ||
{ | ||
return setHaScopeFlowReconcileRequest(key); | ||
} | ||
|
||
if (entry.activate_role_requested() == true) | ||
{ | ||
return setHaScopeActivateRoleRequest(key); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these three attributes mutually exclusive, or is it possible for more than one to be changed in a single update?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed.
orchagent/dash/dashhaorch.cpp
Outdated
|
||
// TODO: add ha_role to attribute value enum | ||
ha_scope_attrs[1].id = SAI_HA_SCOPE_ATTR_DASH_HA_ROLE; | ||
ha_scope_attrs[1].value.u16 = static_cast<sai_uint16_t>(entry.ha_role()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to do entry.ha_role() + 1
here? In the SAI enum, value 0 for sai_dash_ha_role_t
is SAI_DASH_HA_ROLE_DEAD
, but in the protobuf enum value 0 is HA_SCOPE_ROLE_UNSPECIFIED
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed.
orchagent/dash/dashhaorch.cpp
Outdated
|
||
sai_attribute_t ha_scope_attr; | ||
ha_scope_attr.id = SAI_HA_SCOPE_ATTR_DASH_HA_ROLE; | ||
ha_scope_attr.value.u32 = entry.ha_role(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same concern as above about SAI/protobuf enum off-by-one
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed.
|
||
|
||
|
||
#define DEFINE_SAI_GENERIC_APIS_MOCK(sai_api_name, ...) \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the difference between this macro and DEFINE_SAI_GENERIC_API_MOCK
, is it just allow mocking multiple APIs with one macro call?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, we have ha_set
and ha_scope
in the same sai_dash_ha_api
, that's why I need this macro.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah I see. This should also still work for mocking just a single object type right? Can you add a comment above the old DEFINE_SAI_GENERIC_API_MOCK
macro to deprecate it and use your new macro instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed.
|
||
void CreateHaSet() | ||
{ | ||
auto consumer = unique_ptr<Consumer>(new Consumer( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just curious, why not use swss::Table
and m_dashHaOrch->addExistingData
like existing tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No particular reason. Is addExistingData
preferred?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it makes a difference functionally but it might be better to keep thing consistent across UTs, plus it needs less boilerplate
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed this consumer
and addToSync
are also commonly used in UTs, I think the benefit is we can explicitly set the operation
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Table
has del
which should allow us to choose the op. But I didn't realize that we used addToSync
so much, I think it's fine to leave this as-is then.
{ | ||
it++; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you also add changes to write result of operations back to DPU_APPL_STATE_DB? Refer sonic-net/SONiC#1759 and #3490
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed.
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
HLD:
https://github.com/sonic-net/DASH/blob/main/documentation/high-avail/ha-api-hld.md
https://github.com/sonic-net/SONiC/blob/master/doc/smart-switch/high-availability/smart-switch-ha-detailed-design.md
Requires:
sonic-net/sonic-swss-common#985
sonic-net/sonic-dash-api#33
How did I verify?
UTs:
TODO:
2.
add support to set ha_scope attribute ha_role3. event notifications handling (new PR)
4. Bulk create/remove (new PR)
5. Ha stats (new PR)
sign-off: Jing Zhang [email protected]