Bug-2116: Added CEASE error code subcodes as defined in RFC4486. 47/12147/1
authorMilos Fabian <milfabia@cisco.com>
Wed, 22 Oct 2014 11:36:25 +0000 (13:36 +0200)
committerMilos Fabian <milfabia@cisco.com>
Wed, 22 Oct 2014 11:36:25 +0000 (13:36 +0200)
Change-Id: I3eb2c6c88629581cdab16e829f9387b3aebef503
Signed-off-by: Milos Fabian <milfabia@cisco.com>
bgp/parser-api/src/main/java/org/opendaylight/protocol/bgp/parser/BGPError.java
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/AbstractBGPSessionNegotiator.java
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/BGPSessionImpl.java
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/StrictBGPPeerRegistry.java

index f3b7ec382aeecedbe758e6b87ab0b3bec63d1f8a..91ccca550fb3f72da3219d0d282aeb921b0a8d90 100644 (file)
@@ -105,7 +105,39 @@ public enum BGPError {
     /**
      * Cease. 6/0
      */
-    CEASE((short) 6, (short) 0);
+    CEASE((short) 6, (short) 0),
+    /**
+     * Maximum Number of Prefixes Reached. 6/1
+     */
+    MAX_NUMBER_OF_PREFIXES_REACHED((short) 6, (short) 1),
+    /**
+     * Administrative Shutdown. 6/2
+     */
+    ADMINISTRATIVE_SHUTDOWN((short) 6, (short) 2),
+    /**
+     * Peer De-configured. 6/3
+     */
+    PEER_DECONFIGURED((short) 6, (short) 3),
+    /**
+     * Administrative Reset. 6/4
+     */
+    ADMINISTRATIVE_RESTART((short) 6, (short) 4),
+    /**
+     * Connection Rejected. 6/5
+     */
+    CONNECTION_REJECTED((short) 6, (short) 5),
+    /**
+     * Other Configuration Change. 6/6
+     */
+    OTHER_CONFIGURATION_CHANGE((short) 6, (short) 6),
+    /**
+     * Connection Collision Resolution. 6/7
+     */
+    CONNECTION_COLLISION_RESOLUTION((short) 6, (short) 7),
+    /**
+     * Out of Resources. 6/8
+     */
+    OUT_OF_RESOURCES((short) 6, (short) 8);
 
     private static final Map<BGPErrorIdentifier, BGPError> VALUE_MAP;
 
index b6f459e641aa22dc0330797b364fcde50d07a8d7..55dc434f6670002dfa8dd896d1985fc4b9ed4bbe 100644 (file)
@@ -94,7 +94,7 @@ public abstract class AbstractBGPSessionNegotiator extends AbstractSessionNegoti
             final BGPDocumentedException cause = new BGPDocumentedException(
                     "BGP peer with ip: " + getRemoteIp()
                     + " not configured, check configured peers in : "
-                    + this.registry, BGPError.CEASE);
+                    + this.registry, BGPError.CONNECTION_REJECTED);
             negotiationFailed(cause);
             return;
         }
index 87f99200e6127a518a03a1cb6cb900e102b36c50..bda181f66768492702eea95c2b13766f91c688f8 100644 (file)
@@ -161,7 +161,8 @@ public class BGPSessionImpl extends AbstractProtocolSession<Notification> implem
     public synchronized void close() {
         LOG.info("Closing session: {}", this);
         if (this.state != State.Idle) {
-            this.sendMessage(new NotifyBuilder().setErrorCode(BGPError.CEASE.getCode()).setErrorSubcode((short)0).build());
+            this.sendMessage(new NotifyBuilder().setErrorCode(BGPError.CEASE.getCode()).setErrorSubcode(
+                    BGPError.CEASE.getSubcode()).build());
             this.channel.close();
             this.state = State.Idle;
         }
index eded3494a9d97410f694d5120c0dad19e29a33ea..e16ab5c4d5e265c5b615eca41098a1c6ba077fde 100644 (file)
@@ -12,17 +12,14 @@ import com.google.common.base.CharMatcher;
 import com.google.common.base.Objects;
 import com.google.common.base.Preconditions;
 import com.google.common.collect.Maps;
-
 import java.net.Inet4Address;
 import java.net.Inet6Address;
 import java.net.InetAddress;
 import java.net.InetSocketAddress;
 import java.net.SocketAddress;
 import java.util.Map;
-
 import javax.annotation.concurrent.GuardedBy;
 import javax.annotation.concurrent.ThreadSafe;
-
 import org.opendaylight.protocol.bgp.parser.BGPDocumentedException;
 import org.opendaylight.protocol.bgp.parser.BGPError;
 import org.opendaylight.protocol.bgp.rib.impl.spi.BGPPeerRegistry;
@@ -104,7 +101,7 @@ public final class StrictBGPPeerRegistry implements BGPPeerRegistry {
                 throw new BGPDocumentedException(
                     String.format("BGP session with %s %s has to be dropped. Same session already present %s",
                         ip, currentConnection, previousConnection),
-                        BGPError.CEASE);
+                        BGPError.CONNECTION_COLLISION_RESOLUTION);
 
                 // Session reestablished with lower source bgp id, dropping current
             } else if (previousConnection.isHigherDirection(currentConnection)) {
@@ -112,7 +109,7 @@ public final class StrictBGPPeerRegistry implements BGPPeerRegistry {
                 throw new BGPDocumentedException(
                     String.format("BGP session with %s initiated %s has to be dropped. Opposite session already present",
                         ip, currentConnection),
-                        BGPError.CEASE);
+                        BGPError.CONNECTION_COLLISION_RESOLUTION);
 
                 // Session reestablished with higher source bgp id, dropping previous
             } else if (currentConnection.isHigherDirection(previousConnection)) {
@@ -126,7 +123,7 @@ public final class StrictBGPPeerRegistry implements BGPPeerRegistry {
                 throw new BGPDocumentedException(
                     String.format("BGP session with %s initiated %s has to be dropped. Same session already present",
                         ip, currentConnection),
-                        BGPError.CEASE);
+                        BGPError.CONNECTION_COLLISION_RESOLUTION);
             }
         }