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

[VS] Fix context config guid on RealObjectIdManager #847

Merged
merged 1 commit into from
Jul 13, 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
6 changes: 3 additions & 3 deletions vslib/inc/VirtualSwitchSaiInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

#include "SwitchStateBase.h"
#include "WarmBootState.h"
#include "SwitchConfigContainer.h"
#include "RealObjectIdManager.h"
#include "SwitchStateBase.h"
#include "EventQueue.h"
#include "EventPayloadPacket.h"
#include "EventPayloadNetLinkMsg.h"
#include "ContextConfig.h"

#include "lib/inc/SaiInterface.h"

Expand Down Expand Up @@ -70,7 +70,7 @@ namespace saivs
public:

VirtualSwitchSaiInterface(
_In_ const std::shared_ptr<SwitchConfigContainer> scc);
_In_ std::shared_ptr<ContextConfig> contextConfig);

virtual ~VirtualSwitchSaiInterface();

Expand Down Expand Up @@ -394,7 +394,7 @@ namespace saivs

std::map<sai_object_id_t, WarmBootState> m_warmBootState;

std::shared_ptr<SwitchConfigContainer> m_switchConfigContainer;
std::shared_ptr<ContextConfig> m_contextConfig;

std::shared_ptr<RealObjectIdManager> m_realObjectIdManager;

Expand Down
2 changes: 1 addition & 1 deletion vslib/src/Sai.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ sai_status_t Sai::initialize(

// TODO move to Context class

m_vsSai = std::make_shared<VirtualSwitchSaiInterface>(scc);
m_vsSai = std::make_shared<VirtualSwitchSaiInterface>(contextConfig);

m_meta = std::make_shared<saimeta::Meta>(m_vsSai);

Expand Down
11 changes: 6 additions & 5 deletions vslib/src/VirtualSwitchSaiInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,14 @@ using namespace saimeta;
using namespace sairediscommon;

VirtualSwitchSaiInterface::VirtualSwitchSaiInterface(
_In_ const std::shared_ptr<SwitchConfigContainer> scc)
_In_ std::shared_ptr<ContextConfig> contextConfig):
m_contextConfig(contextConfig)
{
SWSS_LOG_ENTER();

m_realObjectIdManager = std::make_shared<RealObjectIdManager>(0, scc); // TODO fix global context

m_switchConfigContainer = scc;
m_realObjectIdManager = std::make_shared<RealObjectIdManager>(
m_contextConfig->m_guid,
m_contextConfig->m_scc);
}

VirtualSwitchSaiInterface::~VirtualSwitchSaiInterface()
Expand Down Expand Up @@ -625,7 +626,7 @@ sai_status_t VirtualSwitchSaiInterface::create(
{
auto switchIndex = RealObjectIdManager::getSwitchIndex(switchId);

auto config = m_switchConfigContainer->getConfig(switchIndex);
auto config = m_contextConfig->m_scc->getConfig(switchIndex);

if (config == nullptr)
{
Expand Down