Skip to content

Commit

Permalink
make mac and vni request string
Browse files Browse the repository at this point in the history
  • Loading branch information
Shi Su committed Nov 9, 2021
1 parent d50d59c commit 0bb8275
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
18 changes: 10 additions & 8 deletions orchagent/vnetorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1320,8 +1320,8 @@ bool VNetRouteOrch::handleTunnel(const Request& request)
SWSS_LOG_ENTER();

vector<IpAddress> ip_list;
vector<MacAddress> mac_list;
vector<uint64_t> vni_list;
vector<string> mac_list;
vector<string> vni_list;

for (const auto& name: request.getAttrFieldNames())
{
Expand All @@ -1331,11 +1331,13 @@ bool VNetRouteOrch::handleTunnel(const Request& request)
}
else if (name == "vni")
{
vni_list = request.getAttrUintList(name);
string vni_str = request.getAttrString(name);
vni_list = tokenize(vni_str, ',');
}
else if (name == "mac_address")
{
mac_list = request.getAttrMacAddressList(name);
string mac_str = request.getAttrString(name);
mac_list = tokenize(mac_str, ',');
}
else
{
Expand Down Expand Up @@ -1369,14 +1371,14 @@ bool VNetRouteOrch::handleTunnel(const Request& request)
IpAddress ip = ip_list[idx_ip];
MacAddress mac;
uint32_t vni = 0;
if (!vni_list.empty())
if (!vni_list.empty() && vni_list[idx_ip] != "")
{
vni = static_cast<uint32_t>(vni_list[idx_ip]);
vni = (uint32_t)stoul(vni_list[idx_ip]);
}

if (!mac_list.empty())
if (!mac_list.empty() && mac_list[idx_ip] != "")
{
mac = mac_list[idx_ip];
mac = MacAddress(mac_list[idx_ip]);
}

NextHopKey nh(ip, mac, vni, true);
Expand Down
6 changes: 3 additions & 3 deletions orchagent/vnetorch.h
Original file line number Diff line number Diff line change
Expand Up @@ -250,9 +250,9 @@ const request_description_t vnet_route_description = {
{ "endpoint", REQ_T_IP_LIST },
{ "ifname", REQ_T_STRING },
{ "nexthop", REQ_T_STRING },
{ "vni", REQ_T_UINT_LIST },
{ "mac_address", REQ_T_MAC_ADDRESS_LIST },
{ "endpoint_monitor", REQ_T_IP_LIST },
{ "vni", REQ_T_STRING },
{ "mac_address", REQ_T_STRING },
{ "endpoint_monitor", REQ_T_STRING },
},
{ }
};
Expand Down

0 comments on commit 0bb8275

Please sign in to comment.