Java Code Examples for org.jboss.netty.channel.Channel#disconnect()
The following examples show how to use
org.jboss.netty.channel.Channel#disconnect() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MemcachedCommandHandler.java From fqueue with Apache License 2.0 | 4 votes |
protected void handleQuit(Channel channel) { channel.disconnect(); }
Example 2
Source File: MemcachedCommandHandler.java From fqueue with Apache License 2.0 | 4 votes |
protected void handleQuit(Channel channel) { channel.disconnect(); }
Example 3
Source File: BootstrapChannelHandler.java From floodlight_with_topoguard with Apache License 2.0 | 4 votes |
@Override protected void handleError(ErrorMessage error, Channel channel) { super.handleError(error, channel); channel.disconnect(); }
Example 4
Source File: BgpControllerImplTest.java From onos with Apache License 2.0 | 4 votes |
/** * 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)); }
Example 5
Source File: BgpControllerImplTest.java From onos with Apache License 2.0 | 4 votes |
/** * 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)); }
Example 6
Source File: BgpControllerImplTest.java From onos with Apache License 2.0 | 4 votes |
/** * 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)); }
Example 7
Source File: BgpControllerImplTest.java From onos with Apache License 2.0 | 4 votes |
/** * 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)); }
Example 8
Source File: BgpControllerImplTest.java From onos with Apache License 2.0 | 4 votes |
/** * 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)); }
Example 9
Source File: BgpControllerImplTest.java From onos with Apache License 2.0 | 4 votes |
/** * 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)); }