ONOS-866: Refactor the storing and handling of BgpSession info.

Moved the local and remote BGP session info to a separate class BgpSessionInfo.
No functional changes.

Also, removed methods TestBgpPeerChannelHandler.prepareBgpKeepalive(),
prepareBgpNotification() and prepareBgpMessage() from the unit tests.
Instead, use the corresponding methods in the BGP implementation itself
to generate the BGP messages.

Change-Id: I7f4b6ad4f6995c242cd8a9848ea527b1fcac9c11
diff --git a/apps/sdnip/src/main/java/org/onosproject/sdnip/bgp/BgpSessionManager.java b/apps/sdnip/src/main/java/org/onosproject/sdnip/bgp/BgpSessionManager.java
index 557e9b6..2ca2972 100644
--- a/apps/sdnip/src/main/java/org/onosproject/sdnip/bgp/BgpSessionManager.java
+++ b/apps/sdnip/src/main/java/org/onosproject/sdnip/bgp/BgpSessionManager.java
@@ -189,18 +189,18 @@
     boolean peerConnected(BgpSession bgpSession) {
 
         // Test whether there is already a session from the same remote
-        if (bgpSessions.get(bgpSession.getRemoteAddress()) != null) {
+        if (bgpSessions.get(bgpSession.remoteInfo().address()) != null) {
             return false;               // Duplicate BGP session
         }
-        bgpSessions.put(bgpSession.getRemoteAddress(), bgpSession);
+        bgpSessions.put(bgpSession.remoteInfo().address(), bgpSession);
 
         //
         // If the first connection, set my BGP ID to the local address
         // of the socket.
         //
-        if (bgpSession.getLocalAddress() instanceof InetSocketAddress) {
+        if (bgpSession.localInfo().address() instanceof InetSocketAddress) {
             InetAddress inetAddr =
-                    ((InetSocketAddress) bgpSession.getLocalAddress()).getAddress();
+                ((InetSocketAddress) bgpSession.localInfo().address()).getAddress();
             Ip4Address ip4Address = Ip4Address.valueOf(inetAddr.getAddress());
             updateMyBgpId(ip4Address);
         }
@@ -213,7 +213,7 @@
      * @param bgpSession the BGP session for the peer
      */
     void peerDisconnected(BgpSession bgpSession) {
-        bgpSessions.remove(bgpSession.getRemoteAddress());
+        bgpSessions.remove(bgpSession.remoteInfo().address());
     }
 
     /**