Skip to content

Define lacp key to make possible creation of two lacp channels between couple of switches #1180

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

Closed
Closed
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: 7 additions & 1 deletion cfgmgr/teammgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ pid_t TeamMgr::getTeamPid(const string &alias)
{
SWSS_LOG_WARN("The LAG PID file: %s is empty", file.c_str());
}
else
else
{
/*Store the PID value */
pid = stoi(line, nullptr, 10);
Expand Down Expand Up @@ -541,6 +541,8 @@ task_process_status TeamMgr::addLag(const string &alias, int min_links, bool fal
return task_need_retry;
}

m_lagKeys[alias] = m_lacp_key++;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I need to make lacp_key from portchannel name, otherwise after warm reboot we might got wrong lacp_key


SWSS_LOG_NOTICE("Start port channel %s with teamd", alias.c_str());

return task_success;
Expand All @@ -556,6 +558,8 @@ bool TeamMgr::removeLag(const string &alias)
cmd << TEAMD_CMD << " -k -t " << shellquote(alias);
EXEC_WITH_ERROR_THROW(cmd.str(), res);

m_lagKeys.erase(alias);

SWSS_LOG_NOTICE("Stop port channel %s", alias.c_str());

return true;
Expand All @@ -582,6 +586,8 @@ task_process_status TeamMgr::addLagMember(const string &lag, const string &membe
// ip link set dev <member> down;
// teamdctl <port_channel_name> port add <member>;
cmd << IP_CMD << " link set dev " << shellquote(member) << " down; ";
cmd << TEAMDCTL_CMD << " " << shellquote(lag) << " port config update " << shellquote(member) << " ";
cmd << "'{\"prio\": 255, \"link_watch\": { \"name\": \"ethtool\" }, \"lacp_key\": "<< m_lagKeys[lag] <<"}';";
cmd << TEAMDCTL_CMD << " " << shellquote(lag) << " port add " << shellquote(member);

if (exec(cmd.str(), res) != 0)
Expand Down
3 changes: 3 additions & 0 deletions cfgmgr/teammgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ class TeamMgr : public Orch

MacAddress m_mac;

unsigned short m_lacp_key = 0;
std::map<std::string, unsigned short> m_lagKeys;

void doTask(Consumer &consumer);
void doLagTask(Consumer &consumer);
void doLagMemberTask(Consumer &consumer);
Expand Down