Make bgp_server_test more robust

Terminate the BgpSessionManager when BgpServer is destroyed instead
of calling ClearSessions directly from ~BgpSessionManager. Doing so
takes care of a deadlock wherein ClearSessions could get called when
a session is being destroyed from a call to DeleteSession.

Make sure that BgpSessionManager does not accept any sessions after
it has called ClearSessions.  Otherwise those sessions get added to
the SessionSet and prevent BgpSessionManager from getting deleted.

Do not delete a BgpPeer till the state machine WorkQueue has been
drained completely.  This prevents an EvTcpDleteSession event from
getting deleted without being processed, hence preventing a leak of
the BgpSession.  The session would otherwise get deleted only when
the BgpSessionManager itself is terminated.

Fix an issue in state machine wherein a BgpOpen received on a stale
session caused a FSM error. A BgpOpen should cause a FSM error only
if it's received on the session currently being used by Established
peer.

Add a few more tests to bgp_server_test. Cleanup to consistently use
counts >= 3 in all tests that wait for specific counters to go up.

Sprinkle const in order make WorkQueue::IsQueueEmpty a const method.

Change-Id: Id1761667d68fe293ab0ddc099db1f508f8504769
Merge "Make bgp_server_test more robust"