Skip to content
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

Mux/IPTunnel orchagent changes #1497

Merged
merged 11 commits into from
Dec 23, 2020
Merged

Mux/IPTunnel orchagent changes #1497

merged 11 commits into from
Dec 23, 2020

Conversation

prsunny
Copy link
Collaborator

@prsunny prsunny commented Nov 6, 2020

What I did

  1. Introduce TunnelMgr Daemon
  2. Introduce Mux orchagent
  3. Added support to enable/disable neighbors via NeighOrch
  4. Added support to create/remove nexthop tunnels via decapOrch
  5. Added support for ACL handling

Why I did it
Support Mux state transitions in orchagent

How I verified it
Manual test/verification in-progress

Details if related

@prsunny prsunny marked this pull request as ready for review November 26, 2020 00:13
@prsunny
Copy link
Collaborator Author

prsunny commented Nov 30, 2020

retest this please

}
else if (op == DEL_COMMAND)
{
/* TODO: Handle Tunnel delete for other tunnel types */
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add a check for value == "IPINIP" before calling doIpInIpTunnelTask(t)? This way it is in parity with how the "SET_COMMAND" is handled that do check for the tunnel type.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

In the del operation we will not get the value

tunnelmgrd_SOURCES = tunnelmgrd.cpp tunnelmgr.cpp $(top_srcdir)/orchagent/orch.cpp $(top_srcdir)/orchagent/request_parser.cpp shellcmd.h
tunnelmgrd_CFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON) $(CFLAGS_SAI)
tunnelmgrd_CPPFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON) $(CFLAGS_SAI)
tunnelmgrd_LDADD = -lswsscommon
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: missing EOL

using namespace swss;

/* select() function timeout retry time, in millisecond */
#define SELECT_TIMEOUT 1000
Copy link
Contributor

Choose a reason for hiding this comment

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

What about the time unit to the name SELECT_TIMEOUT_MSEC

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is the default value for all mgrs, keeping it for consistency


TunnelMgr tunnelmgr(&cfgDb, &appDb, cfg_tunnel_tables);

std::vector<Orch *> cfgOrchList = {&tunnelmgr};
Copy link
Contributor

Choose a reason for hiding this comment

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

curious cfg_tunnel_tables is a list of one and cfgOrchList is a list of one. Why not use variable?

nit: style mismatch camelCase vs hyphened_variables.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Addressed

return false;
}

if (!aclHandler(port.m_port_id))
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are we not removing the routes here as per other failure cases above?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

ret = s.select(&sel, SELECT_TIMEOUT);
if (ret == Select::ERROR)
{
SWSS_LOG_NOTICE("Error: %s!", strerror(errno));
Copy link
Contributor

Choose a reason for hiding this comment

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

Any reason not to use SWSS_LOG_ERROR instead of NOTICE here for the error handling?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Same for all managers, keeping for consistency

sai_status_t status = sai_route_api->create_route_entry(&route_entry, (uint32_t)attrs.size(), attrs.data());
if (status != SAI_STATUS_SUCCESS)
{
SWSS_LOG_ERROR("Failed to create tunnel route %s, rv:%d",
Copy link
Contributor

Choose a reason for hiding this comment

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

To ease debug you may want to consider also capture nh oid in the syslog when create route failed.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Addressed

const request_description_t mux_cfg_request_description = {
{ REQ_T_STRING },
{
{ "server_ipv4", REQ_T_IP_PREFIX },
Copy link
Contributor

Choose a reason for hiding this comment

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

missing state field.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

const request_description_t mux_cable_request_description = {
{ REQ_T_STRING },
{
{ "state", REQ_T_STRING },
Copy link
Contributor

Choose a reason for hiding this comment

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

missing read_side and active_side fields

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done for the State entry

extern sai_router_interface_api_t* sai_router_intfs_api;

/* Constants */
#define MUX_TUNNEL "MUX_TUNNEL0"
Copy link
Contributor

Choose a reason for hiding this comment

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

Tunnel name: MuxTunnel0

daall
daall previously approved these changes Dec 14, 2020
Copy link
Contributor

@daall daall left a comment

Choose a reason for hiding this comment

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

ACL changes LGTM

tahmed-dev
tahmed-dev previously approved these changes Dec 22, 2020
if (op == SET_COMMAND)
{
m_appIpInIpTunnelTable.set(TunnelName, kfvFieldsValues(t));

Copy link
Contributor

Choose a reason for hiding this comment

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

nit: extra line

class TunnelMgr : public Orch
{
public:
TunnelMgr(DBConnector *cfgDb, DBConnector *appDb, std::string tableName);
Copy link
Contributor

Choose a reason for hiding this comment

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

What about explicitly deleting the default and copy constructor. Also, calling destructor as default

mux_cb_orch_ = gDirectory.get<MuxCableOrch*>();
mux_state_orch_ = gDirectory.get<MuxStateOrch*>();

nbr_handler_ = unique_ptr<MuxNbrHandler> (new MuxNbrHandler());
Copy link
Contributor

Choose a reason for hiding this comment

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

std::make_unique<>() ?

return false;
}

mux_cable_tb_[port_name] = std::unique_ptr<MuxCable>
Copy link
Contributor

Choose a reason for hiding this comment

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

make_unique<MuxCable>(...)

}

MuxOrch::MuxOrch(DBConnector *db, const std::vector<std::string> &tables, TunnelDecapOrch* decapOrch, NeighOrch* neighOrch)
: Orch2(db, tables, request_), decap_orch_(decapOrch), neigh_orch_(neighOrch)
Copy link
Contributor

Choose a reason for hiding this comment

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

initializer list element on separate lines to match other files.

// Mux ACL Handler for adding/removing ACLs
class MuxAclHandler
{
public:
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: indentation is off compared to other header files.

return (state_ == MuxState::MUX_STATE_ACTIVE);
}

typedef pair<MuxStateChange, bool (MuxCable::*)()> handler_pair;
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: using?

@gechiang
Copy link
Contributor

@prsunny VS test has 27 failures. Can you address them? Also some branch conflicts needs to be resolved...

@prsunny
Copy link
Collaborator Author

prsunny commented Dec 22, 2020

retest this please

@prsunny
Copy link
Collaborator Author

prsunny commented Dec 23, 2020

@gechiang , resolved conflicts..

@prsunny prsunny merged commit c39a4b1 into sonic-net:master Dec 23, 2020
EdenGri pushed a commit to EdenGri/sonic-swss that referenced this pull request Feb 28, 2022
…r Extensions (sonic-net#1497)

Changes when reading system EEPROM values from State DB (`decode-syseeprom -d`):
- Display CRC-32
- Display all present vendor extensions
- Display hex TLV code with lower-case `x` to match the output when reading directly from EEPROM
- If a TLV code is not available, omit it from the output rather than displaying 'N/A' for all fields
EdenGri pushed a commit to EdenGri/sonic-swss that referenced this pull request Feb 28, 2022
…r Extensions (sonic-net#1497)

Changes when reading system EEPROM values from State DB (`decode-syseeprom -d`):
- Display CRC-32
- Display all present vendor extensions
- Display hex TLV code with lower-case `x` to match the output when reading directly from EEPROM
- If a TLV code is not available, omit it from the output rather than displaying 'N/A' for all fields
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants