Skip to content
This repository has been archived by the owner on Apr 14, 2024. It is now read-only.

Commit

Permalink
Initiate ARP/NDP resolve during session open
Browse files Browse the repository at this point in the history
The current implementation won't work for all cases. See the notes added
in the code.

Updates #311
  • Loading branch information
pstavirs committed Jun 9, 2022
1 parent de90181 commit c030381
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions client/portgroup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1111,8 +1111,11 @@ void PortGroup::processStreamIdList(int portIndex, PbRpcController *controller)
// * modify (new) deviceGroups
// * add (new) stream ids
// * modify (new) streams
// * resolve neighbors
// * build packets
// XXX: This assumes getDeviceGroupIdList() was invoked before
// getStreamIdList() - if the order changes this code will break!
// XXX: See resolve/build notes below

// XXX: same name as input param, but shouldn't cause any problem
PbRpcController *controller;
Expand Down Expand Up @@ -1153,6 +1156,7 @@ void PortGroup::processStreamIdList(int portIndex, PbRpcController *controller)
}

// add/modify deviceGroups
bool resolve = false;
if (newPortContent->device_groups_size())
{
OstProto::DeviceGroupIdList *deviceGroupIdList
Expand Down Expand Up @@ -1184,6 +1188,7 @@ void PortGroup::processStreamIdList(int portIndex, PbRpcController *controller)
deviceGroupConfigList, ack,
NewCallback(this, &PortGroup::processModifyDeviceGroupAck,
portIndex, controller));
resolve = true;
}

// add/modify streams
Expand Down Expand Up @@ -1214,6 +1219,26 @@ void PortGroup::processStreamIdList(int portIndex, PbRpcController *controller)
serviceStub->modifyStream(controller, streamConfigList, ack,
NewCallback(this, &PortGroup::processModifyStreamAck,
portIndex, controller));
resolve = true;
}

// XXX: Ideally resolve and build should be called after **all**
// ports and portgroups are configured. As of now, any resolve
// replied to by ports/portgroups configured later in the open
// session sequence will fail.
// However, to do that, we may need to rethink the open session
// implementation - so going with this for now
if (resolve)
{
OstProto::PortIdList *portIdList = new OstProto::PortIdList;
portIdList->add_port_id()->set_id(portId);
OstProto::Ack *ack = new OstProto::Ack;
controller = new PbRpcController(portIdList, ack);
serviceStub->resolveDeviceNeighbors(controller, portIdList, ack,
NewCallback(this,
&PortGroup::processResolveDeviceNeighborsAck,
controller));
resolve = false;
}

// build packets using the new config
Expand Down

0 comments on commit c030381

Please sign in to comment.