Skip to content

Commit

Permalink
Add support for remove hostif when using tap device (sonic-net#533)
Browse files Browse the repository at this point in the history
  • Loading branch information
kcudnik authored and lguohan committed Nov 20, 2019
1 parent 667f744 commit 53190de
Show file tree
Hide file tree
Showing 3 changed files with 308 additions and 44 deletions.
23 changes: 20 additions & 3 deletions vslib/inc/sai_vs_state.h
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,15 @@ class SwitchState
m_ifname_to_port_id_map[ifname] = port_id;
}


void removeIfNameToPortId(
_In_ const std::string& ifname)
{
SWSS_LOG_ENTER();

m_ifname_to_port_id_map.erase(ifname);
}

sai_object_id_t getPortIdFromIfName(
_In_ const std::string& ifname) const
{
Expand All @@ -253,15 +262,23 @@ class SwitchState
return it->second;
}

void setTapNameToPortId(
_In_ const std::string& tapname,
_In_ sai_object_id_t port_id)
void setPortIdToTapName(
_In_ sai_object_id_t port_id,
_In_ const std::string& tapname)
{
SWSS_LOG_ENTER();

m_port_id_to_tapname[port_id] = tapname;
}

void removePortIdToTapName(
_In_ sai_object_id_t port_id)
{
SWSS_LOG_ENTER();

m_port_id_to_tapname.erase(port_id);
}

bool getTapNameFromPortId(
_In_ const sai_object_id_t port_id,
_Out_ std::string& if_name)
Expand Down
Loading

0 comments on commit 53190de

Please sign in to comment.