Skip to content

Commit

Permalink
Refactor initFromFbWhoAmI
Browse files Browse the repository at this point in the history
Summary:
Currently we have a bit complicated logic to decide platform product name and fabricLocation by first comparing the network layers and then modelName, which is a bit overdone to me. The reason is we only need to set the fabric location for galaxy line card and all the rest platforms should have the same process.
Besides, there're 4 different places define fruid path, and they're using different location. Therefore, I decided to move the define in our "fboss/agent/platforms/wedge/WedgeProductInfo.cpp".

Differential Revision: D10209630

fbshipit-source-id: d55f637a8db9dd0fdac55eb8786f033eb49e7b5a
  • Loading branch information
Joseph Wu authored and facebook-github-bot committed Oct 9, 2018
1 parent ca32aa1 commit 346e30c
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 10 deletions.
4 changes: 0 additions & 4 deletions fboss/agent/platforms/wedge/WedgePlatformInit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@
#include "fboss/agent/platforms/wedge/Wedge40Platform.h"
#include "fboss/agent/platforms/wedge/Wedge100Platform.h"

DEFINE_string(fruid_filepath,
"/var/facebook/fboss/fruid.json",
"File for storing the fruid data");

namespace facebook { namespace fboss {

std::unique_ptr<WedgePlatform> chooseWedgePlatform() {
Expand Down
6 changes: 5 additions & 1 deletion fboss/agent/platforms/wedge/WedgeProductInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ constexpr auto kFabricLocationRight = "RIGHT";

DEFINE_string(mode, "",
"The mode the FBOSS controller is running as, wedge, lc, or fc");
DEFINE_string(fruid_filepath,
"/var/facebook/fboss/fruid.json",
"File for storing the fruid data");

namespace facebook { namespace fboss {

Expand All @@ -64,7 +67,8 @@ void WedgeProductInfo::initialize() {
folly::readFile(path_.str().c_str(), data);
parse(data);
} catch (const std::exception& err) {
XLOG(ERR) << err.what();
XLOG(ERR) << "Failed initializing WedgeProductInfo from " << path_
<< ", fall back to use fbwhoami: " << err.what();
// if fruid info fails fall back to fbwhoami
initFromFbWhoAmI();
}
Expand Down
2 changes: 2 additions & 0 deletions fboss/agent/platforms/wedge/WedgeProductInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
#include "fboss/agent/if/gen-cpp2/ctrl_types.h"
#include <folly/Range.h>

DECLARE_string(fruid_filepath);

namespace facebook { namespace fboss {

enum class WedgePlatformMode {
Expand Down
5 changes: 0 additions & 5 deletions fboss/qsfp_service/platforms/wedge/WedgeManagerInit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@
#include "fboss/qsfp_service/platforms/wedge/Wedge40Manager.h"
#include "fboss/qsfp_service/platforms/wedge/Wedge100Manager.h"

DEFINE_string(
fruid_filepath,
"/dev/shm/fboss/fruid.json",
"File for storing the fruid data");

namespace facebook { namespace fboss {

std::unique_ptr<TransceiverManager> createTransceiverManager() {
Expand Down

0 comments on commit 346e30c

Please sign in to comment.