Implementation of Adj-In and Local RIB UT

Change-Id: I4cac90005f2d728006483b3c03ff0ff3c422f8ba
diff --git a/protocols/bgp/ctl/src/test/java/org/onosproject/bgp/BgpControllerImplTest.java b/protocols/bgp/ctl/src/test/java/org/onosproject/bgp/BgpControllerImplTest.java
old mode 100755
new mode 100644
index 36b1d6f..a64e094
--- a/protocols/bgp/ctl/src/test/java/org/onosproject/bgp/BgpControllerImplTest.java
+++ b/protocols/bgp/ctl/src/test/java/org/onosproject/bgp/BgpControllerImplTest.java
@@ -16,7 +16,10 @@
 package org.onosproject.bgp;
 
 import com.google.common.net.InetAddresses;
+
 import org.jboss.netty.bootstrap.ClientBootstrap;
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.jboss.netty.buffer.ChannelBuffers;
 import org.jboss.netty.channel.Channel;
 import org.jboss.netty.channel.ChannelFactory;
 import org.jboss.netty.channel.ChannelPipeline;
@@ -31,22 +34,43 @@
 import static org.junit.Assert.assertThat;
 
 import org.onlab.junit.TestUtils;
+import org.onlab.junit.TestUtils.TestUtilsException;
+import org.onlab.packet.Ip4Address;
+import org.onlab.packet.IpAddress;
 
 import java.net.InetAddress;
 import java.net.InetSocketAddress;
 import java.net.SocketAddress;
 import java.util.LinkedList;
+import java.util.Map;
 import java.util.concurrent.Executors;
 import java.util.concurrent.TimeUnit;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-
 import org.onosproject.bgp.controller.BgpCfg;
+import org.onosproject.bgp.controller.BgpId;
+import org.onosproject.bgp.controller.impl.AdjRibIn;
 import org.onosproject.bgp.controller.impl.BgpControllerImpl;
+import org.onosproject.bgp.controller.impl.BgpLocalRibImpl;
+import org.onosproject.bgp.controller.impl.BgpPeerImpl;
+import org.onosproject.bgp.controller.impl.VpnAdjRibIn;
+import org.onosproject.bgpio.protocol.linkstate.BgpLinkLSIdentifier;
+import org.onosproject.bgpio.protocol.linkstate.BgpNodeLSIdentifier;
+import org.onosproject.bgpio.protocol.linkstate.BgpPrefixLSIdentifier;
+import org.onosproject.bgpio.protocol.linkstate.NodeDescriptors;
+import org.onosproject.bgpio.protocol.linkstate.PathAttrNlriDetails;
+import org.onosproject.bgpio.protocol.linkstate.PathAttrNlriDetailsLocalRib;
+import org.onosproject.bgpio.types.AutonomousSystemTlv;
+import org.onosproject.bgpio.types.BgpLSIdentifierTlv;
 import org.onosproject.bgpio.types.BgpValueType;
 import org.onosproject.bgpio.types.FourOctetAsNumCapabilityTlv;
+import org.onosproject.bgpio.types.IPReachabilityInformationTlv;
+import org.onosproject.bgpio.types.IPv4AddressTlv;
+import org.onosproject.bgpio.types.IsIsNonPseudonode;
 import org.onosproject.bgpio.types.MultiProtocolExtnCapabilityTlv;
+import org.onosproject.bgpio.types.IsIsPseudonode;
+import org.onosproject.bgpio.types.RouteDistinguisher;
 
 /**
  * Test case for BGPControllerImpl.
@@ -71,6 +95,9 @@
         peer1 = new BgpPeerTest(version, asNumber,
                 holdTime, bgpId, isLargeAsCapabilitySet,
                 capabilityTlv);
+        peer2 = new BgpPeerTest(version, asNumber,
+                holdTime, bgpId, isLargeAsCapabilitySet,
+                capabilityTlv);
 
         bgpControllerImpl = new BgpControllerImpl();
 
@@ -93,6 +120,23 @@
         bgpControllerImpl.getConfig().setState(BgpCfg.State.IP_AS_CONFIGURED);
 
         bgpControllerImpl.getConfig().addPeer("127.0.0.1", 200);
+        bgpControllerImpl.getConfig().addPeer("127.0.0.9", 200);
+        bgpControllerImpl.getConfig().addPeer("127.0.0.33", 200);
+        bgpControllerImpl.getConfig().addPeer("127.0.0.10", 200);
+        bgpControllerImpl.getConfig().addPeer("127.0.0.20", 200);
+        bgpControllerImpl.getConfig().addPeer("127.0.0.30", 200);
+        bgpControllerImpl.getConfig().addPeer("127.0.0.40", 200);
+        bgpControllerImpl.getConfig().addPeer("127.0.0.50", 200);
+        bgpControllerImpl.getConfig().addPeer("127.0.0.60", 200);
+        bgpControllerImpl.getConfig().addPeer("127.0.0.70", 200);
+        bgpControllerImpl.getConfig().addPeer("127.0.0.80", 200);
+        bgpControllerImpl.getConfig().addPeer("127.0.0.90", 200);
+        bgpControllerImpl.getConfig().addPeer("127.0.0.91", 200);
+        bgpControllerImpl.getConfig().addPeer("127.0.0.92", 200);
+        bgpControllerImpl.getConfig().addPeer("127.0.0.99", 200);
+        bgpControllerImpl.getConfig().addPeer("127.0.0.94", 200);
+        bgpControllerImpl.getConfig().addPeer("127.0.0.95", 200);
+        bgpControllerImpl.getConfig().addPeer("127.0.0.35", 200);
     }
 
     @After
@@ -104,7 +148,7 @@
     private BgpControllerImpl bgpControllerImpl;
 
     BgpPeerTest peer1;
-
+    BgpPeerTest peer2;
     // The socket that the remote peers should connect to
     private InetSocketAddress connectToSocket;
 
@@ -254,6 +298,625 @@
     }
 
     /**
+     * Peer1 has Node NLRI (MpReach).
+     */
+    @Test
+    public void testBgpUpdateMessage1() throws InterruptedException {
+        // Initiate the connections
+        peer1.peerChannelHandler.asNumber = 200;
+        peer1.peerChannelHandler.version = 4;
+        peer1.peerChannelHandler.holdTime = 120;
+
+        short afi = 16388;
+        byte res = 0;
+        byte safi = 71;
+
+        bgpControllerImpl.getConfig().setLsCapability(true);
+        BgpValueType tempTlv1 = new MultiProtocolExtnCapabilityTlv(afi, res, safi);
+        peer1.peerChannelHandler.capabilityTlv.add(tempTlv1);
+        peer1.connectFrom(connectToSocket, new InetSocketAddress("127.0.0.9", 0));
+        TimeUnit.MILLISECONDS.sleep(1000);
+
+        //Get peer1
+        BgpId bgpId = new BgpId(IpAddress.valueOf("127.0.0.9"));
+        BgpPeerImpl peer = (BgpPeerImpl) bgpControllerImpl.getPeer(bgpId);
+
+        LinkedList<BgpValueType> subTlvs = new LinkedList<>();
+        BgpValueType tlv = AutonomousSystemTlv.of(2478);
+        subTlvs.add(tlv);
+        tlv = BgpLSIdentifierTlv.of(33686018);
+        subTlvs.add(tlv);
+        NodeDescriptors nodeDes = new NodeDescriptors(subTlvs, (short) 0x10, (short) 256);
+        BgpNodeLSIdentifier key = new BgpNodeLSIdentifier(nodeDes);
+        AdjRibIn adj = peer.adjRib();
+
+        //In Adj-RIB, nodeTree should contains specified key
+        assertThat(adj.nodeTree().containsKey(key), is(true));
+
+        BgpLocalRibImpl obj = (BgpLocalRibImpl) bgpControllerImpl.bgpLocalRib();
+        //In Local-RIB, nodeTree should contains specified key
+        assertThat(obj.nodeTree().containsKey(key), is(true));
+    }
+
+    /**
+     * Peer1 has Node NLRI (MpReach) and Peer2 has Node NLRI with same MpReach and MpUnReach.
+     */
+    @Test
+    public void testBgpUpdateMessage2() throws InterruptedException, TestUtilsException {
+        // Initiate the connections
+        peer1.peerChannelHandler.asNumber = 200;
+        peer1.peerChannelHandler.version = 4;
+        peer1.peerChannelHandler.holdTime = 120;
+        short afi = 16388;
+        byte res = 0;
+        byte safi = 71;
+
+        bgpControllerImpl.getConfig().setLsCapability(true);
+        BgpValueType tempTlv1 = new MultiProtocolExtnCapabilityTlv(afi, res, safi);
+        peer2.peerChannelHandler.capabilityTlv.add(tempTlv1);
+        Channel channel = peer1.connectFrom(connectToSocket, new InetSocketAddress("127.0.0.95", 0));
+        TimeUnit.MILLISECONDS.sleep(1000);
+
+        //Get peer1
+        BgpId bgpId = new BgpId(IpAddress.valueOf("127.0.0.95"));
+        BgpPeerImpl peer = (BgpPeerImpl) bgpControllerImpl.getPeer(bgpId);
+
+        LinkedList<BgpValueType> subTlvs = new LinkedList<>();
+        BgpValueType tlv = AutonomousSystemTlv.of(2478);
+        subTlvs.add(tlv);
+        tlv = BgpLSIdentifierTlv.of(33686018);
+        subTlvs.add(tlv);
+        NodeDescriptors nodeDes = new NodeDescriptors(subTlvs, (short) 0x10, (short) 256);
+        BgpNodeLSIdentifier key = new BgpNodeLSIdentifier(nodeDes);
+        TimeUnit.MILLISECONDS.sleep(500);
+        AdjRibIn adj = peer.adjRib();
+
+        //In Adj-RIB, nodeTree should contains specified key
+        assertThat(adj.nodeTree().containsKey(key), is(true));
+
+        BgpLocalRibImpl obj = (BgpLocalRibImpl) bgpControllerImpl.bgpLocalRib();
+        //In Local-RIB, nodeTree should contains specified key
+        assertThat(obj.nodeTree().containsKey(key), is(true));
+
+        peer2.peerChannelHandler.asNumber = 200;
+        peer2.peerChannelHandler.version = 4;
+        peer2.peerChannelHandler.holdTime = 120;
+
+        bgpControllerImpl.getConfig().setLsCapability(true);
+        tempTlv1 = new MultiProtocolExtnCapabilityTlv(afi, res, safi);
+        peer2.peerChannelHandler.capabilityTlv.add(tempTlv1);
+        peer2.connectFrom(connectToSocket, new InetSocketAddress("127.0.0.70", 0));
+        TimeUnit.MILLISECONDS.sleep(1000);
+
+        //Get peer2
+        bgpId = new BgpId(IpAddress.valueOf("127.0.0.70"));
+        peer = (BgpPeerImpl) bgpControllerImpl.getPeer(bgpId);
+        TimeUnit.MILLISECONDS.sleep(200);
+        adj = peer.adjRib();
+
+        //In Adj-RIB, nodetree should be empty
+        assertThat(adj.nodeTree().isEmpty(), is(true));
+
+        //Disconnect peer1
+        channel.disconnect();
+        channel.close();
+
+        obj = (BgpLocalRibImpl) bgpControllerImpl.bgpLocalRib();
+        TimeUnit.MILLISECONDS.sleep(200);
+        //In Local-RIB, nodetree should be empty
+        assertThat(obj.nodeTree().isEmpty(), is(true));
+    }
+
+    /**
+     * Peer1 has Link NLRI (MpReach).
+     */
+    @Test
+    public void testBgpUpdateMessage3() throws InterruptedException, TestUtilsException {
+        // Initiate the connections
+        peer1.peerChannelHandler.asNumber = 200;
+        peer1.peerChannelHandler.version = 4;
+        peer1.peerChannelHandler.holdTime = 120;
+
+        short afi = 16388;
+        byte res = 0;
+        byte safi = 71;
+
+        bgpControllerImpl.getConfig().setLsCapability(true);
+        BgpValueType tempTlv1 = new MultiProtocolExtnCapabilityTlv(afi, res, safi);
+        peer1.peerChannelHandler.capabilityTlv.add(tempTlv1);
+        peer1.connectFrom(connectToSocket, new InetSocketAddress("127.0.0.10", 0));
+        TimeUnit.MILLISECONDS.sleep(1000);
+
+        //Get peer1
+        BgpId bgpId = new BgpId(IpAddress.valueOf("127.0.0.10"));
+        BgpPeerImpl peer = (BgpPeerImpl) bgpControllerImpl.getPeer(bgpId);
+
+        LinkedList<BgpValueType> localNodeSubTlvs = new LinkedList<>();
+        LinkedList<BgpValueType> remoteNodeSubTlvs = new LinkedList<>();
+        BgpValueType tlv = AutonomousSystemTlv.of(2222);
+        localNodeSubTlvs.add(tlv);
+        remoteNodeSubTlvs.add(tlv);
+        tlv = BgpLSIdentifierTlv.of(33686018);
+        localNodeSubTlvs.add(tlv);
+        remoteNodeSubTlvs.add(tlv);
+        byte[] isoNodeID = new byte[] {0x19, 0x00, (byte) 0x95, 0x02, 0x50, 0x21 };
+        tlv = IsIsPseudonode.of(isoNodeID, (byte) 0x03);
+        localNodeSubTlvs.add(tlv);
+        isoNodeID = new byte[] {0x19, 0x00, (byte) 0x95, 0x02, 0x50, 0x21 };
+        tlv = IsIsNonPseudonode.of(isoNodeID);
+        remoteNodeSubTlvs.add(tlv);
+        NodeDescriptors localNodeDes = new NodeDescriptors(localNodeSubTlvs, (short) 0x1b, (short) 256);
+        NodeDescriptors remoteNodeDes = new NodeDescriptors(remoteNodeSubTlvs, (short) 0x1a, (short) 0x101);
+        LinkedList<BgpValueType> linkDescriptor = new LinkedList<>();
+        tlv = IPv4AddressTlv.of(Ip4Address.valueOf("2.2.2.2"), (short) 0x103);
+        linkDescriptor.add(tlv);
+
+        BgpLinkLSIdentifier key = new BgpLinkLSIdentifier(localNodeDes, remoteNodeDes, linkDescriptor);
+        TimeUnit.MILLISECONDS.sleep(200);
+        AdjRibIn adj = peer.adjRib();
+
+        //In Adj-RIB, linkTree should contain specified key
+        assertThat(adj.linkTree().containsKey(key), is(true));
+
+        BgpLocalRibImpl obj = (BgpLocalRibImpl) bgpControllerImpl.bgpLocalRib();
+        TimeUnit.MILLISECONDS.sleep(200);
+
+        //In Local-RIB, linkTree should contain specified key
+        assertThat(obj.linkTree().containsKey(key), is(true));
+    }
+
+    /**
+     * Peer1 has Node NLRI and Peer2 has Node NLRI with different MpReach and MpUnReach with VPN.
+     */
+    @Test
+    public void testBgpUpdateMessage4() throws InterruptedException {
+        // Initiate the connections
+        peer1.peerChannelHandler.asNumber = 200;
+        peer1.peerChannelHandler.version = 4;
+        peer1.peerChannelHandler.holdTime = 120;
+
+        short afi = 16388;
+        byte res = 0;
+        byte safi = (byte) 0x80;
+
+        bgpControllerImpl.getConfig().setLsCapability(true);
+        BgpValueType tempTlv1 = new MultiProtocolExtnCapabilityTlv(afi, res, safi);
+        peer1.peerChannelHandler.capabilityTlv.add(tempTlv1);
+        Channel channel =  peer1.connectFrom(connectToSocket, new InetSocketAddress("127.0.0.35", 0));
+        TimeUnit.MILLISECONDS.sleep(1000);
+
+        //Get peer1
+        IpAddress ipAddress = IpAddress.valueOf("127.0.0.35");
+        BgpId bgpId = new BgpId(ipAddress);
+        BgpPeerImpl peer = (BgpPeerImpl) bgpControllerImpl.getPeer(bgpId);
+        LinkedList<BgpValueType> subTlvs1 = new LinkedList<>();
+
+        LinkedList<BgpValueType> subTlvs = new LinkedList<>();
+        BgpValueType tlv = AutonomousSystemTlv.of(2478);
+        subTlvs.add(tlv);
+        tlv = BgpLSIdentifierTlv.of(33686018);
+        subTlvs.add(tlv);
+
+        NodeDescriptors nodeDes = new NodeDescriptors(subTlvs, (short) 0x10, (short) 256);
+        BgpNodeLSIdentifier key = new BgpNodeLSIdentifier(nodeDes);
+        RouteDistinguisher rd = new RouteDistinguisher((long) 0x0A);
+        VpnAdjRibIn vpnAdj = peer.vpnAdjRib();
+
+        //In Adj-RIB, vpnNodeTree should contain rd
+        assertThat(vpnAdj.vpnNodeTree().containsKey(rd), is(true));
+
+        Map<BgpNodeLSIdentifier, PathAttrNlriDetails> treeValue = vpnAdj.vpnNodeTree().get(rd);
+        //In Adj-RIB, vpnNodeTree should contain rd key which contains specified value
+        assertThat(treeValue.containsKey(key), is(true));
+
+        BgpLocalRibImpl obj = (BgpLocalRibImpl) bgpControllerImpl.bgpLocalRibVpn();
+        //In Local-RIB, vpnNodeTree should contain rd
+        assertThat(obj.vpnNodeTree().containsKey(rd), is(true));
+
+        Map<BgpNodeLSIdentifier, PathAttrNlriDetailsLocalRib> value = obj.vpnNodeTree().get(rd);
+        //In Local-RIB, vpnNodeTree should contain rd key which contains specified value
+        assertThat(value.containsKey(key), is(true));
+
+        peer2.peerChannelHandler.asNumber = 200;
+        peer2.peerChannelHandler.version = 4;
+        peer2.peerChannelHandler.holdTime = 120;
+
+        bgpControllerImpl.getConfig().setLsCapability(true);
+        tempTlv1 = new MultiProtocolExtnCapabilityTlv(afi, res, safi);
+        peer1.peerChannelHandler.capabilityTlv.add(tempTlv1);
+        peer2.connectFrom(connectToSocket, new InetSocketAddress("127.0.0.40", 0));
+        TimeUnit.MILLISECONDS.sleep(1000);
+
+        //Get peer2
+        bgpId = new BgpId(IpAddress.valueOf("127.0.0.40"));
+        peer = (BgpPeerImpl) bgpControllerImpl.getPeer(bgpId);
+
+        tlv = AutonomousSystemTlv.of(686);
+        subTlvs1.add(tlv);
+        tlv = BgpLSIdentifierTlv.of(33686018);
+        subTlvs1.add(tlv);
+        nodeDes = new NodeDescriptors(subTlvs1, (short) 0x10, (short) 256);
+        key = new BgpNodeLSIdentifier(nodeDes);
+        vpnAdj = peer.vpnAdjRib();
+
+        //In Adj-RIB, vpnNodeTree should contain rd
+        assertThat(vpnAdj.vpnNodeTree().containsKey(rd), is(true));
+
+        treeValue = vpnAdj.vpnNodeTree().get(rd);
+        //In Adj-RIB, vpnNodeTree should contain rd key which contains specified value
+        assertThat(treeValue.containsKey(key), is(true));
+
+        //Disconnect peer1
+        channel.disconnect();
+        channel.close();
+
+        obj = (BgpLocalRibImpl) bgpControllerImpl.bgpLocalRibVpn();
+
+        //In Local-RIB, vpnNodeTree should contain rd
+        assertThat(obj.vpnNodeTree().containsKey(rd), is(true));
+
+        value = obj.vpnNodeTree().get(rd);
+        //In Local-RIB, vpnNodeTree should contain rd key which contains specified value
+        assertThat(value.containsKey(key), is(true));
+    }
+
+    /**
+     * Peer1 has Node NLRI and Peer2 has Node NLRI with different MpReach and MpUnReach.
+     */
+    @Test
+    public void testBgpUpdateMessage5() throws InterruptedException, TestUtilsException {
+        // Initiate the connections
+        peer1.peerChannelHandler.asNumber = 200;
+        peer1.peerChannelHandler.version = 4;
+        peer1.peerChannelHandler.holdTime = 120;
+
+        short afi = 16388;
+        byte res = 0;
+        byte safi = 71;
+
+        bgpControllerImpl.getConfig().setLsCapability(true);
+        BgpValueType tempTlv1 = new MultiProtocolExtnCapabilityTlv(afi, res, safi);
+        peer1.peerChannelHandler.capabilityTlv.add(tempTlv1);
+        Channel channel = peer1.connectFrom(connectToSocket, new InetSocketAddress("127.0.0.99", 0));
+        TimeUnit.MILLISECONDS.sleep(1000);
+
+        //Get peer1
+        BgpId bgpId = new BgpId(IpAddress.valueOf("127.0.0.99"));
+        BgpPeerImpl peer = (BgpPeerImpl) bgpControllerImpl.getPeer(bgpId);
+
+        LinkedList<BgpValueType> subTlvs = new LinkedList<>();
+        BgpValueType tlv = null;
+        tlv = AutonomousSystemTlv.of(2478);
+        subTlvs.add(tlv);
+        tlv = BgpLSIdentifierTlv.of(33686018);
+        subTlvs.add(tlv);
+        NodeDescriptors nodeDes = new NodeDescriptors(subTlvs, (short) 0x10, (short) 256);
+        BgpNodeLSIdentifier key = new BgpNodeLSIdentifier(nodeDes);
+        TimeUnit.MILLISECONDS.sleep(500);
+        AdjRibIn adj = peer.adjRib();
+
+        //In Adj-RIB, nodeTree should contain specified key
+        assertThat(adj.nodeTree().containsKey(key), is(true));
+
+        BgpLocalRibImpl obj = (BgpLocalRibImpl) bgpControllerImpl.bgpLocalRib();
+        //In Local-RIB, nodeTree should contain specified key
+        assertThat(obj.nodeTree().containsKey(key), is(true));
+
+        peer2.peerChannelHandler.asNumber = 200;
+        peer2.peerChannelHandler.version = 4;
+        peer2.peerChannelHandler.holdTime = 120;
+
+        bgpControllerImpl.getConfig().setLsCapability(true);
+        tempTlv1 = new MultiProtocolExtnCapabilityTlv(afi, res, safi);
+        peer2.peerChannelHandler.capabilityTlv.add(tempTlv1);
+        peer2.connectFrom(connectToSocket, new InetSocketAddress("127.0.0.92", 0));
+        TimeUnit.MILLISECONDS.sleep(1000);
+
+        //Get peer2
+        bgpId = new BgpId(IpAddress.valueOf("127.0.0.92"));
+        peer = (BgpPeerImpl) bgpControllerImpl.getPeer(bgpId);
+        adj = peer.adjRib();
+
+        //In Adj-RIB, nodetree should be empty
+        assertThat(adj.nodeTree().isEmpty(), is(true));
+
+        //peer1 disconnects
+        channel.disconnect();
+        channel.close();
+
+        obj = (BgpLocalRibImpl) bgpControllerImpl.bgpLocalRib();
+        TimeUnit.MILLISECONDS.sleep(200);
+
+        //In Local-RIB, nodeTree should be empty
+        assertThat(obj.nodeTree().isEmpty(), is(true));
+    }
+
+    /**
+     * Peer2 has Prefix NLRI (MpReach).
+     */
+    @Test
+    public void testBgpUpdateMessage6() throws InterruptedException {
+        // Initiate the connections
+        peer1.peerChannelHandler.asNumber = 200;
+        peer1.peerChannelHandler.version = 4;
+        peer1.peerChannelHandler.holdTime = 120;
+
+        short afi = 16388;
+        byte res = 0;
+        byte safi = 71;
+
+        bgpControllerImpl.getConfig().setLsCapability(true);
+        BgpValueType tempTlv1 = new MultiProtocolExtnCapabilityTlv(afi, res, safi);
+        peer1.peerChannelHandler.capabilityTlv.add(tempTlv1);
+        Channel channel = peer1.connectFrom(connectToSocket, new InetSocketAddress("127.0.0.94", 0));
+        TimeUnit.MILLISECONDS.sleep(1000);
+
+        //Get peer1
+        BgpId bgpId = new BgpId(IpAddress.valueOf("127.0.0.94"));
+        BgpPeerImpl peer = (BgpPeerImpl) bgpControllerImpl.getPeer(bgpId);
+
+        LinkedList<BgpValueType> subTlvs = new LinkedList<>();
+        BgpValueType tlv = AutonomousSystemTlv.of(2478);
+        subTlvs.add(tlv);
+        tlv = BgpLSIdentifierTlv.of(33686018);
+        subTlvs.add(tlv);
+        NodeDescriptors nodeDes = new NodeDescriptors(subTlvs, (short) 0x10, (short) 256);
+        BgpNodeLSIdentifier key = new BgpNodeLSIdentifier(nodeDes);
+        TimeUnit.MILLISECONDS.sleep(500);
+        AdjRibIn adj = peer.adjRib();
+
+        //In Adj-RIB, nodeTree should contain specified key
+        assertThat(adj.nodeTree().containsKey(key), is(true));
+
+        BgpLocalRibImpl obj = (BgpLocalRibImpl) bgpControllerImpl.bgpLocalRib();
+        //In Local-RIB, nodeTree should contain specified key
+        assertThat(obj.nodeTree().containsKey(key), is(true));
+
+        peer2.peerChannelHandler.asNumber = 200;
+        peer2.peerChannelHandler.version = 4;
+        peer2.peerChannelHandler.holdTime = 120;
+
+        bgpControllerImpl.getConfig().setLsCapability(true);
+        tempTlv1 = new MultiProtocolExtnCapabilityTlv(afi, res, safi);
+        peer2.peerChannelHandler.capabilityTlv.add(tempTlv1);
+        peer2.connectFrom(connectToSocket, new InetSocketAddress("127.0.0.80", 0));
+        TimeUnit.MILLISECONDS.sleep(1000);
+
+        //Get peer2
+        bgpId = new BgpId(IpAddress.valueOf("127.0.0.80"));
+        peer = (BgpPeerImpl) bgpControllerImpl.getPeer(bgpId);
+        TimeUnit.MILLISECONDS.sleep(500);
+        adj = peer.adjRib();
+
+        //In Adj-RIB, nodeTree should contain specified key
+        assertThat(adj.nodeTree().containsKey(key), is(true));
+
+        //peer1 disconnects
+        channel.disconnect();
+        channel.close();
+
+        obj = (BgpLocalRibImpl) bgpControllerImpl.bgpLocalRib();
+        TimeUnit.MILLISECONDS.sleep(200);
+
+        //In Local-RIB, nodeTree should contain specified key
+        assertThat(obj.nodeTree().containsKey(key), is(true));
+    }
+
+    /**
+     * Peer1 has Node NLRI (MpReach) and peer2 has Node NLRI with same MpReach and MpUnReach with IsIsNonPseudonode.
+     */
+    @Test
+    public void testBgpUpdateMessage7() throws InterruptedException, TestUtilsException {
+        // Initiate the connections
+        peer1.peerChannelHandler.asNumber = 200;
+        peer1.peerChannelHandler.version = 4;
+        peer1.peerChannelHandler.holdTime = 120;
+
+        short afi = 16388;
+        byte res = 0;
+        byte safi = 71;
+
+        bgpControllerImpl.getConfig().setLsCapability(true);
+        BgpValueType tempTlv1 = new MultiProtocolExtnCapabilityTlv(afi, res, safi);
+        peer1.peerChannelHandler.capabilityTlv.add(tempTlv1);
+        Channel channel = peer1.connectFrom(connectToSocket, new InetSocketAddress("127.0.0.91", 0));
+        TimeUnit.MILLISECONDS.sleep(1000);
+
+        //Get peer1
+        BgpId bgpId = new BgpId(IpAddress.valueOf("127.0.0.91"));
+        BgpPeerImpl peer = (BgpPeerImpl) bgpControllerImpl.getPeer(bgpId);
+
+        LinkedList<BgpValueType> subTlvs = new LinkedList<>();
+        LinkedList<BgpValueType> subTlvs1 = new LinkedList<>();
+        BgpValueType tlv = null;
+        tlv = AutonomousSystemTlv.of(2478);
+        subTlvs.add(tlv);
+        tlv = BgpLSIdentifierTlv.of(33686018);
+        subTlvs.add(tlv);
+        subTlvs1.add(tlv);
+        NodeDescriptors nodeDes = new NodeDescriptors(subTlvs, (short) 0x10, (short) 256);
+        BgpNodeLSIdentifier key = new BgpNodeLSIdentifier(nodeDes);
+        AdjRibIn adj = peer.adjRib();
+
+        //In Adj-RIB, nodeTree should contains specified key
+        assertThat(adj.nodeTree().containsKey(key), is(true));
+
+        BgpLocalRibImpl obj = (BgpLocalRibImpl) bgpControllerImpl.bgpLocalRib();
+        //In Local-RIB, nodeTree should contains specified key
+        assertThat(obj.nodeTree().containsKey(key), is(true));
+
+        peer2.peerChannelHandler.asNumber = 200;
+        peer2.peerChannelHandler.version = 4;
+        peer2.peerChannelHandler.holdTime = 120;
+
+        bgpControllerImpl.getConfig().setLsCapability(true);
+        tempTlv1 = new MultiProtocolExtnCapabilityTlv(afi, res, safi);
+        peer2.peerChannelHandler.capabilityTlv.add(tempTlv1);
+        peer2.connectFrom(connectToSocket, new InetSocketAddress("127.0.0.90", 0));
+        TimeUnit.MILLISECONDS.sleep(1000);
+
+        //Get peer2
+        bgpId = new BgpId(IpAddress.valueOf("127.0.0.90"));
+        peer = (BgpPeerImpl) bgpControllerImpl.getPeer(bgpId);
+
+        tlv = AutonomousSystemTlv.of(2222);
+        subTlvs1.add(tlv);
+        byte[] isoNodeID = new byte[] {0x19, 0x00, (byte) 0x95, 0x01, (byte) 0x90, 0x58};
+        tlv = IsIsNonPseudonode.of(isoNodeID);
+        subTlvs1.add(tlv);
+        nodeDes = new NodeDescriptors(subTlvs1, (short) 0x1a, (short) 256);
+        key = new BgpNodeLSIdentifier(nodeDes);
+        adj = peer.adjRib();
+
+        //In Adj-RIB, nodeTree should contains specified key
+        log.info("key " + key.toString());
+        log.info("adj.nodeTree() " + adj.nodeTree().toString());
+        assertThat(adj.nodeTree().containsKey(key), is(true));
+
+        //peer1 disconnects
+        channel.disconnect();
+        channel.close();
+
+        obj = (BgpLocalRibImpl) bgpControllerImpl.bgpLocalRib();
+        TimeUnit.MILLISECONDS.sleep(200);
+
+        //In Local-RIB, nodeTree should contains specified key
+        assertThat(obj.nodeTree().containsKey(key), is(true));
+    }
+
+    /**
+     * Peer1 has Prefix NLRI (MpReach).
+     */
+    @Test
+    public void testBgpUpdateMessage8() throws InterruptedException {
+        // Initiate the connections
+        peer1.peerChannelHandler.asNumber = 200;
+        peer1.peerChannelHandler.version = 4;
+        peer1.peerChannelHandler.holdTime = 150;
+
+        short afi = 16388;
+        byte res = 0;
+        byte safi = 71;
+
+        bgpControllerImpl.getConfig().setLsCapability(true);
+        BgpValueType tempTlv1 = new MultiProtocolExtnCapabilityTlv(afi, res, safi);
+        peer1.peerChannelHandler.capabilityTlv.add(tempTlv1);
+        peer1.connectFrom(connectToSocket, new InetSocketAddress("127.0.0.20", 0));
+        TimeUnit.MILLISECONDS.sleep(1000);
+
+        //Get peer1
+        BgpId bgpId = new BgpId(IpAddress.valueOf("127.0.0.20"));
+        BgpPeerImpl peer = (BgpPeerImpl) bgpControllerImpl.getPeer(bgpId);
+
+        LinkedList<BgpValueType> subTlvs = new LinkedList<>();
+        BgpValueType tlv = AutonomousSystemTlv.of(2222);
+        subTlvs.add(tlv);
+        tlv = BgpLSIdentifierTlv.of(33686018);
+        subTlvs.add(tlv);
+        byte[] isoNodeID = new byte[] {0x19, 0x21, 0x68, 0x07, 0x70, 0x01};
+        tlv = IsIsNonPseudonode.of(isoNodeID);
+        subTlvs.add(tlv);
+        NodeDescriptors nodeDes = new NodeDescriptors(subTlvs, (short) 0x1a, (short) 256);
+        LinkedList<BgpValueType> prefixDescriptor = new LinkedList<>();
+        byte[] prefix = new byte[] {0x20, (byte) 0xc0, (byte) 0xa8, 0x4d, 0x01};
+        ChannelBuffer tempCb = ChannelBuffers.dynamicBuffer();
+        tempCb.writeBytes(prefix);
+        tlv = IPReachabilityInformationTlv.read(tempCb, (short) 5);
+        prefixDescriptor.add(tlv);
+        BgpPrefixLSIdentifier key = new BgpPrefixLSIdentifier(nodeDes, prefixDescriptor);
+
+        AdjRibIn adj = peer.adjRib();
+
+        //In Adj-RIB, prefixTree should contain specified key
+        assertThat(adj.prefixTree().containsKey(key), is(true));
+
+        BgpLocalRibImpl obj = (BgpLocalRibImpl) bgpControllerImpl.bgpLocalRib();
+        //In Local-RIB, prefixTree should contain specified key
+        assertThat(obj.prefixTree().containsKey(key), is(true));
+    }
+
+    /**
+     * Peer1 has Node NLRI (MpReach) and Peer2 has node NLRI with different MpReach
+     * and MpUnReach with IsIsNonPseudonode.
+     */
+    @Test
+    public void testBgpUpdateMessage9() throws InterruptedException {
+        // Initiate the connections
+        peer1.peerChannelHandler.asNumber = 200;
+        peer1.peerChannelHandler.version = 4;
+        peer1.peerChannelHandler.holdTime = 120;
+
+        short afi = 16388;
+        byte res = 0;
+        byte safi = (byte) 0x80;
+
+        bgpControllerImpl.getConfig().setLsCapability(true);
+        BgpValueType tempTlv1 = new MultiProtocolExtnCapabilityTlv(afi, res, safi);
+        peer1.peerChannelHandler.capabilityTlv.add(tempTlv1);
+        Channel channel = peer1.connectFrom(connectToSocket, new InetSocketAddress("127.0.0.30", 0));
+        TimeUnit.MILLISECONDS.sleep(1000);
+
+        //Get peer1
+        BgpId bgpId = new BgpId(IpAddress.valueOf("127.0.0.30"));
+        BgpPeerImpl peer = (BgpPeerImpl) bgpControllerImpl.getPeer(bgpId);
+
+        LinkedList<BgpValueType> subTlvs = new LinkedList<>();
+        BgpValueType tlv = AutonomousSystemTlv.of(2478);
+        subTlvs.add(tlv);
+        tlv = BgpLSIdentifierTlv.of(33686018);
+        subTlvs.add(tlv);
+
+        NodeDescriptors nodeDes = new NodeDescriptors(subTlvs, (short) 0x10, (short) 256);
+        BgpNodeLSIdentifier key = new BgpNodeLSIdentifier(nodeDes);
+        RouteDistinguisher rd = new RouteDistinguisher((long) 0x0A);
+        VpnAdjRibIn vpnAdj = peer.vpnAdjRib();
+
+        //In Adj-RIB, vpnNodeTree should contain specified rd
+        assertThat(vpnAdj.vpnNodeTree().containsKey(rd), is(true));
+
+        Map<BgpNodeLSIdentifier, PathAttrNlriDetails> treeValue = vpnAdj.vpnNodeTree().get(rd);
+        //In Adj-RIB, vpnNodeTree should contain specified rd with specified value
+        assertThat(treeValue.containsKey(key), is(true));
+
+        BgpLocalRibImpl obj = (BgpLocalRibImpl) bgpControllerImpl.bgpLocalRibVpn();
+        //In Local-RIB, vpnNodeTree should contain specified rd
+        assertThat(obj.vpnNodeTree().containsKey(rd), is(true));
+
+        Map<BgpNodeLSIdentifier, PathAttrNlriDetailsLocalRib> value = obj.vpnNodeTree().get(rd);
+        //In Local-RIB, vpnNodeTree should contain specified rd with specified value
+        assertThat(value.containsKey(key), is(true));
+
+        peer2.peerChannelHandler.asNumber = 200;
+        peer2.peerChannelHandler.version = 4;
+        peer2.peerChannelHandler.holdTime = 120;
+
+        bgpControllerImpl.getConfig().setLsCapability(true);
+        tempTlv1 = new MultiProtocolExtnCapabilityTlv(afi, res, safi);
+        peer2.peerChannelHandler.capabilityTlv.add(tempTlv1);
+        peer2.connectFrom(connectToSocket, new InetSocketAddress("127.0.0.50", 0));
+        TimeUnit.MILLISECONDS.sleep(1000);
+
+        //Get peer2
+        bgpId = new BgpId(IpAddress.valueOf("127.0.0.50"));
+        peer = (BgpPeerImpl) bgpControllerImpl.getPeer(bgpId);
+        key = new BgpNodeLSIdentifier(nodeDes);
+        vpnAdj = peer.vpnAdjRib();
+
+        //In Adj-RIB, vpnNodeTree should be empty
+        assertThat(vpnAdj.vpnNodeTree().isEmpty(), is(true));
+
+        //peer1 disconnects
+        channel.disconnect();
+        channel.close();
+
+        obj = (BgpLocalRibImpl) bgpControllerImpl.bgpLocalRibVpn();
+        TimeUnit.MILLISECONDS.sleep(200);
+
+        //In Local-RIB, vpnNodeTree should be empty
+        assertThat(obj.vpnNodeTree().isEmpty(), is(true));
+    }
+
+    /**
      * A class to capture the state for a BGP peer.
      */
     private final class BgpPeerTest {
@@ -296,5 +959,29 @@
             peerBootstrap.setPipelineFactory(pipelineFactory);
             peerBootstrap.connect(connectToSocket);
        }
+
+        private Channel connectFrom(InetSocketAddress connectToSocket, SocketAddress localAddress)
+                throws InterruptedException {
+
+                ChannelFactory channelFactory =
+                    new NioClientSocketChannelFactory(
+                            Executors.newCachedThreadPool(),
+                            Executors.newCachedThreadPool());
+                ChannelPipelineFactory pipelineFactory = () -> {
+                    ChannelPipeline pipeline = Channels.pipeline();
+                    pipeline.addLast("BgpPeerFrameDecoderTest",
+                            peerFrameDecoder);
+                    pipeline.addLast("BgpPeerChannelHandlerTest",
+                            peerChannelHandler);
+                    return pipeline;
+                };
+
+                peerBootstrap = new ClientBootstrap(channelFactory);
+                peerBootstrap.setOption("child.keepAlive", true);
+                peerBootstrap.setOption("child.tcpNoDelay", true);
+                peerBootstrap.setPipelineFactory(pipelineFactory);
+                Channel channel = peerBootstrap.connect(connectToSocket, localAddress).getChannel();
+                return channel;
+           }
     }
 }
\ No newline at end of file
diff --git a/protocols/bgp/ctl/src/test/java/org/onosproject/bgp/BgpPeerChannelHandlerTest.java b/protocols/bgp/ctl/src/test/java/org/onosproject/bgp/BgpPeerChannelHandlerTest.java
old mode 100755
new mode 100644
index 26ed36d..ac8206f
--- a/protocols/bgp/ctl/src/test/java/org/onosproject/bgp/BgpPeerChannelHandlerTest.java
+++ b/protocols/bgp/ctl/src/test/java/org/onosproject/bgp/BgpPeerChannelHandlerTest.java
@@ -15,6 +15,7 @@
  */
 package org.onosproject.bgp;
 
+import java.net.InetSocketAddress;
 import java.util.LinkedList;
 import java.util.concurrent.TimeUnit;
 
@@ -27,8 +28,11 @@
 import org.onosproject.bgpio.protocol.ver4.BgpOpenMsgVer4;
 import org.onosproject.bgpio.types.BgpHeader;
 import org.onosproject.bgpio.types.BgpValueType;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class BgpPeerChannelHandlerTest extends SimpleChannelHandler {
+    protected static final Logger log = LoggerFactory.getLogger(BgpPeerChannelHandlerTest.class);
     public static final int OPEN_MSG_MINIMUM_LENGTH = 29;
     public static final byte[] MARKER = new byte[] {(byte) 0xff, (byte) 0xff,
         (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
@@ -76,6 +80,306 @@
         savedCtx.getChannel().close();
     }
 
+    /**
+     * Select update message buffer with VPN.
+     *
+     * @param select number to select update message buffer
+     * @return packet dump in byte array
+     */
+    byte[] selectUpdateMessageVpn(int select) {
+        switch (select) {
+        case 5:
+            /**
+             * Node NLRI with VPN - MpReach.
+             */
+            byte[] updateMsg = new byte[] {(byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
+                    (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
+                    (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, 0x00, 0x5E, 0x02, 0x00, 0x00, //withdrawn len
+                    0x00, 0x47, //path attribute len
+                    0x04, 0x01, 0x01, 0x02, //origin
+                    0x40, 0x02, 0x04, 0x02, 0x01, (byte) 0xfd, (byte) 0xe9, //as_path
+                    (byte) 0x80, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, //med
+                    (byte) 0x80, 0x0e, 0x32, 0x40, 0x04, (byte) 0x80, //mpreach with safi = 80 vpn
+                    0x04, 0x04, 0x00, 0x00, 0x01, //nexthop
+                    0x00, //reserved
+                    0x00, 0x01, 0x00, 0x25, //type ND LEN
+                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A,
+                    0x02,
+                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                    0x01, 0x00, 0x00, 0x10,
+                    0x02, 0x00, 0x00, 0x04, 0x00, 0x00, 0x09, (byte) 0xae,
+                    0x02, 0x01, 0x00, 0x04, 0x02, 0x02, 0x02, 0x02}; //node nlri
+        return updateMsg;
+        case 6:
+            /**
+             * Node NLRI MpReach and MpUnReach different with same VPN.
+             */
+            updateMsg = new byte[] {(byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
+                    (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
+                    (byte) 0xff, (byte) 0xff, (byte) 0xff, 0x00, (byte) 0x8D, 0x02, 0x00, 0x00, //withdrawn len
+                    0x00, 0x76, //path attribute len
+                    0x04, 0x01, 0x01, 0x02, //origin
+                    0x40, 0x02, 0x04, 0x02, 0x01, (byte) 0xfd, (byte) 0xe9, //as_path
+                    (byte) 0x80, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, //med
+                    (byte) 0x80, 0x0e, 0x32, 0x40, 0x04, (byte) 0x80, //mpreach with safi = 80 vpn
+                    0x04, 0x04, 0x00, 0x00, 0x01, //nexthop
+                    0x00, //reserved
+                    0x00, 0x01, 0x00, 0x25, //type ND LEN
+                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A,
+                    0x02,
+                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                    0x01, 0x00, 0x00, 0x10,
+                    0x02, 0x00, 0x00, 0x04, 0x00, 0x00, 0x02, (byte) 0xae,
+                    0x02, 0x01, 0x00, 0x04, 0x02, 0x02, 0x02, 0x02, //node nlri
+                    (byte) 0x80, 0x0f, 0x2C,  0x40, 0x04, (byte) 0x80, //mpUnreach with safi = 80 VPN
+                    0x00, 0x01, 0x00, 0x25, //type n len
+                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A,
+                    0x02,
+                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                    0x01, 0x00, 0x00, 0x10,
+                    0x02, 0x00, 0x00, 0x04, 0x00, 0x00, 0x04, (byte) 0xae, //AutonomousSystemTlv
+                    0x02, 0x01, 0x00, 0x04, 0x02, 0x02, 0x02, 0x02}; //BGPLSIdentifierTlv
+            return updateMsg;
+        case 7:
+            /**
+             * Node NLRI with same MpReach and MpUnReach with VPN.
+             */
+            updateMsg = new byte[] {(byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
+                    (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
+                    (byte) 0xff, (byte) 0xff, (byte) 0xff, 0x00, (byte) 0x8D, 0x02, 0x00, 0x00, //withdrawn len
+                    0x00, 0x76, //path attribute len
+                    0x04, 0x01, 0x01, 0x02, //origin
+                    0x40, 0x02, 0x04, 0x02, 0x01, (byte) 0xfd, (byte) 0xe9, //as_path
+                    (byte) 0x80, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, //med
+                    (byte) 0x80, 0x0e, 0x32, 0x40, 0x04, (byte) 0x80, //mpreach with safi = 80 vpn
+                    0x04, 0x04, 0x00, 0x00, 0x01, //nexthop
+                    0x00, //reserved
+                    0x00, 0x01, 0x00, 0x25, //type ND LEN
+                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A,
+                    0x02,
+                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                    0x01, 0x00, 0x00, 0x10,
+                    0x02, 0x00, 0x00, 0x04, 0x00, 0x00, 0x09, (byte) 0xae,
+                    0x02, 0x01, 0x00, 0x04, 0x02, 0x02, 0x02, 0x02, //node nlri
+                    (byte) 0x80, 0x0f, 0x2C,  0x40, 0x04, (byte) 0x80, //mpUnreach with safi = 80 VPN
+                    0x00, 0x01, 0x00, 0x25, //type n len
+                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A,
+                    0x02,
+                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                    0x01, 0x00, 0x00, 0x10,
+                    0x02, 0x00, 0x00, 0x04, 0x00, 0x00, 0x09, (byte) 0xae, //AutonomousSystemTlv
+                    0x02, 0x01, 0x00, 0x04, 0x02, 0x02, 0x02, 0x02}; //BGPLSIdentifierTlv
+            return updateMsg;
+        case 17:
+            /**
+             * Node NLRI with VPN - MpReach.
+             */
+            updateMsg = new byte[] {(byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
+                    (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
+                    (byte) 0xff, (byte) 0xff, (byte) 0xff, 0x00, 0x5E, 0x02, 0x00, 0x00, //withdrawn len
+                    0x00, 0x47, //path attribute len
+                    0x04, 0x01, 0x01, 0x02, //origin
+                    0x40, 0x02, 0x04, 0x02, 0x01, (byte) 0xfd, (byte) 0xe9, //as_path
+                    (byte) 0x80, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, //med
+                    (byte) 0x80, 0x0e, 0x32, 0x40, 0x04, (byte) 0x80, //mpreach with safi = 80 vpn
+                    0x04, 0x04, 0x00, 0x00, 0x01, //nexthop
+                    0x00, //reserved
+                    0x00, 0x01, 0x00, 0x25, //type ND LEN
+                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A,
+                    0x02,
+                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                    0x01, 0x00, 0x00, 0x10,
+                    0x02, 0x00, 0x00, 0x04, 0x00, 0x00, 0x09, (byte) 0xae,
+                    0x02, 0x01, 0x00, 0x04, 0x02, 0x02, 0x02, 0x02}; //node nlri
+        return updateMsg;
+        default: return null;
+        }
+    }
+
+    /**
+     * Select update message buffer without VPN.
+     *
+     * @param select number to select update message buffer
+     * @return packet dump in byte array
+     */
+    byte[] selectUpdateMsg(int select) {
+        switch (select) {
+        case 1:
+            /**
+             * Node NLRI - MpReach.
+             */
+            byte[] updateMsg = new byte[] {(byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
+                    (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
+                    (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, 0x00, 0x56, 0x02, 0x00, 0x00, //withdrawn len
+                    0x00, 0x3F, 0x04, 0x01, 0x01, 0x02, //origin
+                    0x40, 0x02, 0x04, 0x02, 0x01, (byte) 0xfd, (byte) 0xe9, //as_path
+                    (byte) 0x80, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, //med
+                    (byte) 0x80, 0x0e, 0x2A, 0x40, 0x04, 0x47, //mpreach with safi = 71
+                    0x04, 0x04, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x1D, 0x02,
+                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x10,
+                    0x02, 0x00, 0x00, 0x04, 0x00, 0x00, 0x09, (byte) 0xae,
+                    0x02, 0x01, 0x00, 0x04, 0x02, 0x02, 0x02, 0x02}; //node nlri
+            return updateMsg;
+        case 2:
+            /**
+             * Node NLRI with same MpReach and MpUnReach.
+             */
+            updateMsg = new byte[] {(byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
+                    (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
+                    (byte) 0xff, (byte) 0xff, (byte) 0xff, 0x00, (byte) 0x7D, 0x02, 0x00, 0x00, //withdrawn len
+                    0x00, 0x66, 0x04, 0x01, 0x01, 0x02, 0x40, 0x02, 0x04, 0x02, 0x01, (byte) 0xfd, (byte) 0xe9,
+                    (byte) 0x80, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, //med
+                    (byte) 0x80, 0x0e, 0x2A, 0x40, 0x04, 0x47, //mpreach with safi = 71
+                    0x04, 0x04, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x1D, //type n len
+                    0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                    0x01, 0x00, 0x00, 0x10, 0x02, 0x00, 0x00, 0x04, 0x00, 0x00, 0x09, (byte) 0xae,
+                    0x02, 0x01, 0x00, 0x04, 0x02, 0x02, 0x02, 0x02, //BGPLSIdentifierTlv
+                    (byte) 0x80, 0x0f, 0x24,  0x40, 0x04, 0x47, //mpUnreach with safi = 71
+                    0x00, 0x01, 0x00, 0x1D, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                    0x01, 0x00, 0x00, 0x10, 0x02, 0x00, 0x00, 0x04, 0x00, 0x00, 0x09, (byte) 0xae,
+                    0x02, 0x01, 0x00, 0x04, 0x02, 0x02, 0x02, 0x02, //BGPLSIdentifierTlv
+                    };
+            return updateMsg;
+        case 3:
+            /**
+             * Link NLRI - MpReach.
+             */
+            updateMsg = new byte[] {(byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
+                    (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
+                    (byte) 0xff, (byte) 0xff, (byte) 0xff, 0x00, (byte) 0x8B, 0x02, 0x00, 0x04,
+                    0x18, 0x0a, 0x01, 0x01, 0x00, 0x70, //path attribute len
+                    0x04, 0x01, 0x01, 0x00, 0x40, 0x02, 0x04, 0x02, 0x01, (byte) 0xfd, (byte) 0xe9, //as_path
+                    (byte) 0x80, 0x04, 0x04, 0x00, 0x00, 0x00, 0x10, //med
+                    (byte) 0x80, 0x0e, 0x5B, 0x40, 0x04, 0x47, //mpreach safi 71
+                    0x04, 0x04, 0x00, 0x00, 0x01, 0x00, 0x00, 0x02, 0x00, 0x4E, 0x02,
+                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x1b, //local node
+                    0x02, 0x00, 0x00, 0x04, 0x00, 0x00, 0x08, (byte) 0xae,
+                    0x02, 0x01, 0x00, 0x04, 0x02, 0x02, 0x02, 0x02,
+                    0x02, 0x03, 0x00, 0x07, 0x19, 0x00, (byte) 0x95, 0x02, 0x50, 0x21, 0x03,
+                    0x01, 0x01, 0x00, 0x1a, 0x02, 0x00, 0x00, 0x04, 0x00, 0x00, 0x08, (byte) 0xae,
+                    0x02, 0x01, 0x00, 0x04, 0x02, 0x02, 0x02, 0x02,
+                    0x02, 0x03, 0x00, 0x06, 0x19, 0x00, (byte) 0x95, 0x02, 0x50, 0x21, //link nlri
+                    0x01, 0x03, 0x00, 0x04, 0x02, 0x02, 0x02, 0x02
+            };
+            return updateMsg;
+        case 4:
+            /**
+             * Prefix NLRI - MpReach.
+             */
+            updateMsg = new byte[] {(byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
+                    (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
+                    (byte) 0xff, (byte) 0xff, (byte) 0xff, 0x00, (byte) 0xd6, 0x02, 0x00, 0x04,
+                    0x18, 0x0a, 0x01, 0x01, 0x00, (byte) 0xbb, //path attribute len
+                    0x04, 0x01, 0x01, 0x00, 0x40, 0x02, 0x04, 0x02, 0x01, (byte) 0xfd, (byte) 0xe9, //as_path
+                    (byte) 0x80, 0x04, 0x04, 0x00, 0x00, 0x00, 0x12, //med
+                    (byte) 0x90, 0x0e, 0x00, (byte) 0xa5, 0x40, 0x04, 0x47, //mpreach
+                    0x04, 0x04, 0x00, 0x00, 0x01, 0x00, 0x00, 0x03, 0x00, 0x30,
+                    0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x1a, //local node
+                    0x02, 0x00, 0x00, 0x04, 0x00, 0x00, 0x08, (byte) 0xae,
+                    0x02, 0x01, 0x00, 0x04, 0x02, 0x02, 0x02, 0x02, 0x02, 0x03, 0x00, 0x06, 0x19, 0x21, 0x68, 0x07,
+                    0x70, 0x01, 0x01, 0x09, 0x00, 0x05, 0x20, (byte) 0xc0, (byte) 0xa8, 0x4d, 0x01, //prefix des
+                    0x00, 0x03, 0x00, 0x30, 0x02,
+                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x1a,
+                    0x02, 0x00, 0x00, 0x04, 0x00, 0x00, 0x08, (byte) 0xae,
+                    0x02, 0x01, 0x00, 0x04, 0x02, 0x02, 0x02, 0x02,
+                    0x02, 0x03, 0x00, 0x06, 0x19, 0x00, (byte) 0x95, 0x02, 0x50, 0x21,
+                    0x01, 0x09, 0x00, 0x05, 0x20, 0x15, 0x15, 0x15, 0x15, 0x00, 0x03, 0x00, 0x30,
+                    0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                    0x01, 0x00, 0x00, 0x1a, 0x02, 0x00, 0x00, 0x04, 0x00, 0x00, 0x08, (byte) 0xae,
+                    0x02, 0x01, 0x00, 0x04, 0x02, 0x02, 0x02, 0x02,
+                    0x02, 0x03, 0x00, 0x06, 0x02, 0x20, 0x22, 0x02, 0x20, 0x22,
+                    0x01, 0x09, 0x00, 0x05, 0x20, 0x16, 0x16, 0x16, 0x16}; // prefix nlri
+        return updateMsg;
+        case 8:
+            /**
+             * Node NLRI with different MpReach and MpUnReach with IsIsPseudonode.
+             */
+                        updateMsg = new byte[] {(byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
+                                (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
+                                (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, 0x00,
+                                (byte) 0x91, 0x02, 0x00, 0x00, 0x00, 0x7A, //path attribute len
+                                0x04, 0x01, 0x01, 0x02, 0x40, 0x02, 0x04, 0x02, 0x01, (byte) 0xfd, (byte) 0xe9,
+                                (byte) 0x80, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, //med
+                                (byte) 0x80, 0x0e, 0x34, 0x40, 0x04, 0x47, //mpreach with safi = 71
+                                0x04, 0x04, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00,
+                                0x27, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                                0x01, 0x00, 0x00, 0x1a, 0x02, 0x00, 0x00, 0x04, 0x00, 0x00, 0x08, (byte) 0xae,
+                                0x02, 0x01, 0x00, 0x04, 0x02, 0x02, 0x02, 0x02, 0x02, 0x03,
+                                0x00, 0x06, 0x19, 0x00, (byte) 0x95, 0x01, (byte) 0x90, 0x58,
+                                (byte) 0x80, 0x0f, 0x2E,  0x40, 0x04, 0x47, 0x00, 0x01, 0x00, 0x27, //mpUnreach
+                                0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                                0x01, 0x00, 0x00, 0x1a, 0x02, 0x00, 0x00, 0x04, 0x00, 0x00, 0x09, (byte) 0xae,
+                                0x02, 0x01, 0x00, 0x04, 0x02, 0x02, 0x02, 0x02, //BGPLSIdentifierTlv
+                                0x02, 0x03, 0x00, 0x06, 0x19, 0x00, (byte) 0x99, 0x01, (byte) 0x99, 0x58};
+                        return updateMsg;
+        case 9:
+            /**
+             * Node NLRI with same MpReach and MpUnReach.
+             */
+            updateMsg = new byte[] {(byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
+                    (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
+                    (byte) 0xff, (byte) 0xff, (byte) 0xff, 0x00, (byte) 0x7D, 0x02, 0x00, 0x00, //withdrawn len
+                    0x00, 0x66, 0x04, 0x01, 0x01, 0x02, //origin
+                    0x40, 0x02, 0x04, 0x02, 0x01, (byte) 0xfd, (byte) 0xe9, //as_path
+                    (byte) 0x80, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, //med
+                    (byte) 0x80, 0x0e, 0x2A, 0x40, 0x04, 0x47, //mpreach with safi = 71
+                    0x04, 0x04, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x1D, //type n len
+                    0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                    0x01, 0x00, 0x00, 0x10, 0x02, 0x00, 0x00, 0x04, 0x00, 0x00, 0x09, (byte) 0xae,
+                    0x02, 0x01, 0x00, 0x04, 0x02, 0x02, 0x02, 0x02, //BGPLSIdentifierTlv
+                    (byte) 0x80, 0x0f, 0x24,  0x40, 0x04, 0x47, //mpUnreach with safi = 71
+                    0x00, 0x01, 0x00, 0x1D, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                    0x01, 0x00, 0x00, 0x10, 0x02, 0x00, 0x00, 0x04, 0x00, 0x00, 0x09, (byte) 0xae,
+                    0x02, 0x01, 0x00, 0x04, 0x02, 0x02, 0x02, 0x02, //BGPLSIdentifierTlv
+                    };
+            return updateMsg;
+        case 10:
+            /**
+             * Node NLRI with different MpReach and MpUnReach.
+             */
+            updateMsg = new byte[] {(byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
+                    (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
+                    (byte) 0xff, (byte) 0xff, (byte) 0xff, 0x00, (byte) 0x7D, 0x02, 0x00, 0x00, //withdrawn len
+                    0x00, 0x66, 0x04, 0x01, 0x01, 0x02, //origin
+                    0x40, 0x02, 0x04, 0x02, 0x01, (byte) 0xfd, (byte) 0xe9, //as_path
+                    (byte) 0x80, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, //med
+                    (byte) 0x80, 0x0e, 0x2A, 0x40, 0x04, 0x47, //mpreach with safi = 71
+                    0x04, 0x04, 0x00, 0x00, 0x01, 0x00, //reserved
+                    0x00, 0x01, 0x00, 0x1D, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                    0x01, 0x00, 0x00, 0x10, 0x02, 0x00, 0x00, 0x04, 0x00, 0x00, 0x09, (byte) 0xae,
+                    0x02, 0x01, 0x00, 0x04, 0x02, 0x02, 0x02, 0x02, //BGPLSIdentifierTlv
+                    (byte) 0x80, 0x0f, 0x24,  0x40, 0x04, 0x47, //mpUnreach with safi = 71
+                    0x00, 0x01, 0x00, 0x1D, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                    0x01, 0x00, 0x00, 0x10,  0x02, 0x00, 0x00, 0x04, 0x00, 0x00, 0x08, (byte) 0xae,
+                    0x02, 0x01, 0x00, 0x04, 0x02, 0x02, 0x02, 0x02, //BGPLSIdentifierTlv
+                    };
+            return updateMsg;
+        case 12:
+            /**
+             * Node NLRI with same MpReach and MpUnReach with IsIsPseudonode.
+             */
+          updateMsg = new byte[] {(byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
+                    (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
+                    (byte) 0xff, (byte) 0xff, (byte) 0xff, 0x00, (byte) 0x91, 0x02, 0x00, 0x00, //withdrawn len
+                    0x00, 0x7A, 0x04, 0x01, 0x01, 0x02, //origin
+                    0x40, 0x02, 0x04, 0x02, 0x01, (byte) 0xfd, (byte) 0xe9, //as_path
+                    (byte) 0x80, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, //med
+                    (byte) 0x80, 0x0e, 0x34, 0x40, 0x04, 0x47, //mpreach with safi = 71
+                    0x04, 0x04, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x27, //type n len
+                    0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                    0x01, 0x00, 0x00, 0x1a, 0x02, 0x00, 0x00, 0x04, 0x00, 0x00, 0x09, (byte) 0xae,
+                    0x02, 0x01, 0x00, 0x04, 0x02, 0x02, 0x02, 0x02, //BGPLSIdentifierTlv
+                    0x02, 0x03, 0x00, 0x06, 0x19, 0x00, (byte) 0x99, 0x01, (byte) 0x99, 0x58,
+                    (byte) 0x80, 0x0f, 0x2E,  0x40, 0x04, 0x47, //mpUnreach with safi = 71
+                    0x00, 0x01, 0x00, 0x27, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                    0x01, 0x00, 0x00, 0x1a, 0x02, 0x00, 0x00, 0x04, 0x00, 0x00, 0x09, (byte) 0xae, //AutonomousSystemTlv
+                    0x02, 0x01, 0x00, 0x04, 0x02, 0x02, 0x02, 0x02, //BGPLSIdentifierTlv
+                    0x02, 0x03, 0x00, 0x06, 0x19, 0x00, (byte) 0x99, 0x01, (byte) 0x99, 0x58};
+          return updateMsg;
+      default:        return null;
+        }
+    }
+
     @Override
     public void channelConnected(ChannelHandlerContext ctx,
                                  ChannelStateEvent channelEvent) throws InterruptedException {
@@ -97,6 +401,116 @@
         ChannelBuffer buffer1 = ChannelBuffers.dynamicBuffer();
         keepaliveMsg.writeTo(buffer1);
         ctx.getChannel().write(buffer1);
+
+        if (((InetSocketAddress) ctx.getChannel().getLocalAddress()).getAddress().equals(
+                new InetSocketAddress("127.0.0.1", 0).getAddress())) {
+            return;
+        } else if (((InetSocketAddress) ctx.getChannel().getLocalAddress()).getAddress().equals(
+                new InetSocketAddress("127.0.0.9", 0).getAddress())) {
+            ChannelBuffer bufferUp = ChannelBuffers.dynamicBuffer();
+            bufferUp.writeBytes(selectUpdateMsg(1));
+            ctx.getChannel().write(bufferUp);
+        } else if (((InetSocketAddress) ctx.getChannel().getLocalAddress()).getAddress().equals(
+                new InetSocketAddress("127.0.0.33", 0).getAddress())) {
+            ChannelBuffer bufferUp = ChannelBuffers.dynamicBuffer();
+            bufferUp.writeBytes(selectUpdateMsg(2));
+            ctx.getChannel().write(bufferUp);
+        } else if (((InetSocketAddress) ctx.getChannel().getLocalAddress()).getAddress().equals(
+                new InetSocketAddress("127.0.0.10", 0).getAddress())) {
+            ChannelBuffer bufferUp = ChannelBuffers.dynamicBuffer();
+            bufferUp.writeBytes(selectUpdateMsg(3));
+            ctx.getChannel().write(bufferUp);
+        } else if (((InetSocketAddress) ctx.getChannel().getLocalAddress()).getAddress().equals(
+                new InetSocketAddress("127.0.0.20", 0).getAddress())) {
+
+            ChannelBuffer bufferUp = ChannelBuffers.dynamicBuffer();
+            bufferUp.writeBytes(selectUpdateMsg(4));
+            ctx.getChannel().write(bufferUp);
+        } else if (((InetSocketAddress) ctx.getChannel().getLocalAddress()).getAddress().equals(
+                new InetSocketAddress("127.0.0.30", 0).getAddress())) {
+
+            ChannelBuffer bufferUp = ChannelBuffers.dynamicBuffer();
+            bufferUp.writeBytes(selectUpdateMessageVpn(5));
+            ctx.getChannel().write(bufferUp);
+        } else if (((InetSocketAddress) ctx.getChannel().getLocalAddress()).getAddress().equals(
+                new InetSocketAddress("127.0.0.40", 0).getAddress())) {
+
+            ChannelBuffer bufferUp = ChannelBuffers.dynamicBuffer();
+            bufferUp.writeBytes(selectUpdateMessageVpn(6));
+            ctx.getChannel().write(bufferUp);
+        } else if (((InetSocketAddress) ctx.getChannel().getLocalAddress()).getAddress().equals(
+                new InetSocketAddress("127.0.0.50", 0).getAddress())) {
+
+            ChannelBuffer bufferUp = ChannelBuffers.dynamicBuffer();
+            bufferUp.writeBytes(selectUpdateMessageVpn(7));
+            ctx.getChannel().write(bufferUp);
+        } else if (((InetSocketAddress) ctx.getChannel().getLocalAddress()).getAddress().equals(
+                new InetSocketAddress("127.0.0.60", 0).getAddress())) {
+
+            ChannelBuffer bufferUp = ChannelBuffers.dynamicBuffer();
+            bufferUp.writeBytes(selectUpdateMsg(8));
+            ctx.getChannel().write(bufferUp);
+        } else if (((InetSocketAddress) ctx.getChannel().getLocalAddress()).getAddress().equals(
+                new InetSocketAddress("127.0.0.70", 0).getAddress())) {
+
+            ChannelBuffer bufferUp = ChannelBuffers.dynamicBuffer();
+            bufferUp.writeBytes(selectUpdateMsg(9));
+            ctx.getChannel().write(bufferUp);
+        } else if (((InetSocketAddress) ctx.getChannel().getLocalAddress()).getAddress().equals(
+                new InetSocketAddress("127.0.0.80", 0).getAddress())) {
+
+            ChannelBuffer bufferUp = ChannelBuffers.dynamicBuffer();
+            bufferUp.writeBytes(selectUpdateMsg(10));
+            ctx.getChannel().write(bufferUp);
+        } else if (((InetSocketAddress) ctx.getChannel().getLocalAddress()).getAddress().equals(
+                new InetSocketAddress("127.0.0.90", 0).getAddress())) {
+
+            ChannelBuffer bufferUp = ChannelBuffers.dynamicBuffer();
+            bufferUp.writeBytes(selectUpdateMsg(8));
+            ctx.getChannel().write(bufferUp);
+        } else if (((InetSocketAddress) ctx.getChannel().getLocalAddress()).getAddress().equals(
+                new InetSocketAddress("127.0.0.92", 0).getAddress())) {
+
+            ChannelBuffer bufferUp = ChannelBuffers.dynamicBuffer();
+            bufferUp.writeBytes(selectUpdateMsg(12));
+            ctx.getChannel().write(bufferUp);
+        } else if (((InetSocketAddress) ctx.getChannel().getLocalAddress()).getAddress().equals(
+                new InetSocketAddress("127.0.0.91", 0).getAddress())) {
+
+            ChannelBuffer bufferUp = ChannelBuffers.dynamicBuffer();
+            bufferUp.writeBytes(selectUpdateMsg(1));
+            ctx.getChannel().write(bufferUp);
+        } else if (((InetSocketAddress) ctx.getChannel().getLocalAddress()).getAddress().equals(
+                new InetSocketAddress("127.0.0.9", 0).getAddress())) {
+
+            ChannelBuffer bufferUp = ChannelBuffers.dynamicBuffer();
+            bufferUp.writeBytes(selectUpdateMsg(1));
+            ctx.getChannel().write(bufferUp);
+        } else if (((InetSocketAddress) ctx.getChannel().getLocalAddress()).getAddress().equals(
+                new InetSocketAddress("127.0.0.99", 0).getAddress())) {
+
+            ChannelBuffer bufferUp = ChannelBuffers.dynamicBuffer();
+            bufferUp.writeBytes(selectUpdateMsg(1));
+            ctx.getChannel().write(bufferUp);
+        } else if (((InetSocketAddress) ctx.getChannel().getLocalAddress()).getAddress().equals(
+                new InetSocketAddress("127.0.0.94", 0).getAddress())) {
+
+            ChannelBuffer bufferUp = ChannelBuffers.dynamicBuffer();
+            bufferUp.writeBytes(selectUpdateMsg(1));
+            ctx.getChannel().write(bufferUp);
+        } else if (((InetSocketAddress) ctx.getChannel().getLocalAddress()).getAddress().equals(
+                new InetSocketAddress("127.0.0.35", 0).getAddress())) {
+
+            ChannelBuffer bufferUp = ChannelBuffers.dynamicBuffer();
+            bufferUp.writeBytes(selectUpdateMessageVpn(17));
+            ctx.getChannel().write(bufferUp);
+        } else if (((InetSocketAddress) ctx.getChannel().getLocalAddress()).getAddress().equals(
+                new InetSocketAddress("127.0.0.95", 0).getAddress())) {
+
+            ChannelBuffer bufferUp = ChannelBuffers.dynamicBuffer();
+            bufferUp.writeBytes(selectUpdateMsg(1));
+            ctx.getChannel().write(bufferUp);
+        }
     }
 
     @Override