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

[cfgmgr]: Integrate MACsecMGR with sonic-buildimage #1627

Merged
merged 3 commits into from
Feb 4, 2021
Merged
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
23 changes: 15 additions & 8 deletions cfgmgr/macsecmgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,10 @@
using namespace std;
using namespace swss;

#define WPA_SUPPLICANT_CMD "./wpa_supplicant"
#define WPA_CLI_CMD "./wpa_cli"
#define WPA_CONF "./wpa.conf"
// #define SOCK_DIR "/var/run/macsec/"
#define SOCK_DIR "./"
#define WPA_SUPPLICANT_CMD "/sbin/wpa_supplicant"
#define WPA_CLI_CMD "/sbin/wpa_cli"
#define WPA_CONF "/etc/wpa_supplicant.conf"
#define SOCK_DIR "/var/run/"

constexpr std::uint64_t RETRY_TIME = 30;

Expand Down Expand Up @@ -64,13 +63,21 @@ static bool get_value(
auto value_opt = swss::fvsGetValue(ta, field, true);
if (!value_opt)
{
SWSS_LOG_WARN("Cannot find field : %s", field.c_str());
SWSS_LOG_DEBUG("Cannot find field : %s", field.c_str());
return false;
}

lexical_convert(*value_opt, value);
try
{
lexical_convert(*value_opt, value);
}
catch(const boost::bad_lexical_cast &e)
{
SWSS_LOG_ERROR("Cannot convert value(%s) in field(%s)", value_opt->c_str(), field.c_str());
return false;
}

return false;
return true;
}

static void wpa_cli_commands(std::ostringstream & ostream)
Expand Down
2 changes: 1 addition & 1 deletion cfgmgr/macsecmgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class MACsecMgr : public Orch
using TaskArgs = std::vector<FieldValueTuple>;
struct MACsecProfile
{
std::uint8_t priority;
std::uint32_t priority;
std::string cipher_suite;
std::string primary_cak;
std::string primary_ckn;
Expand Down
2 changes: 1 addition & 1 deletion cfgmgr/macsecmgrd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ int main(int argc, char **argv)

try
{
// Logger::linkToDbNative("macsecmgrd");
Logger::linkToDbNative("macsecmgrd");
SWSS_LOG_NOTICE("--- Starting macsecmgrd ---");

swss::DBConnector cfgDb("CONFIG_DB", 0);
Expand Down