BUG-45 : migrated Subsequent Address Family Identifier to generated source code. 95/1295/1
authorDana Kutenicsova <dkutenic@cisco.com>
Thu, 19 Sep 2013 14:57:54 +0000 (16:57 +0200)
committerDana Kutenicsova <dkutenic@cisco.com>
Thu, 19 Sep 2013 14:57:54 +0000 (16:57 +0200)
Change-Id: Ifa24f6d44f2ad0562d23a16d39d3d9eaea3e1fef
Signed-off-by: Dana Kutenicsova <dkutenic@cisco.com>
22 files changed:
bgp/concepts/src/main/java/org/opendaylight/protocol/bgp/concepts/BGPSubsequentAddressFamily.java [deleted file]
bgp/concepts/src/main/java/org/opendaylight/protocol/bgp/concepts/BGPTableType.java
bgp/concepts/src/main/yang/bgp-types.yang
bgp/concepts/src/test/java/org/opendaylight/protocol/bgp/concepts/TableTypeTest.java
bgp/parser-api/src/main/java/org/opendaylight/protocol/bgp/parser/parameter/MultiprotocolCapability.java
bgp/parser-api/src/main/yang/bgp-multiprotocol.yang
bgp/parser-api/src/test/java/org/opendaylight/protocol/bgp/parser/APITest.java
bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/BGPUpdateMessageParser.java
bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/open/CapabilityParameterParser.java
bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/update/LinkStateParser.java
bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/update/MPReachParser.java
bgp/parser-impl/src/test/java/org/opendaylight/protocol/bgp/parser/impl/BGPParserTest.java
bgp/parser-impl/src/test/java/org/opendaylight/protocol/bgp/parser/impl/ComplementaryTest.java
bgp/parser-mock/src/test/java/org/opendaylight/protocol/bgp/parser/mock/BGPMessageParserMockTest.java
bgp/rib-api/src/test/java/org/opendaylight/protocol/bgp/rib/BGPEventsTest.java
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/BGPSessionNegotiator.java
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/BGPSessionProposalImpl.java
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/BGPSynchronization.java
bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/ApiTest.java
bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/FSMTest.java
bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/ParserTest.java
bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/SynchronizationTest.java

diff --git a/bgp/concepts/src/main/java/org/opendaylight/protocol/bgp/concepts/BGPSubsequentAddressFamily.java b/bgp/concepts/src/main/java/org/opendaylight/protocol/bgp/concepts/BGPSubsequentAddressFamily.java
deleted file mode 100644 (file)
index ba237e8..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.protocol.bgp.concepts;
-
-/**
- * Enumeration of all supported subsequent address family identifiers.
- */
-public enum BGPSubsequentAddressFamily {
-       /**
-        * RFC4760: Network Layer Reachability Information used
-        * for unicast forwarding.
-        */
-       Unicast,
-       /**
-        * RFC4364: MPLS-labeled VPN address
-        */
-       MPLSLabeledVPN,
-       /**
-        * draft-ietf-idr-ls-distribution-03 : Linkstate SAFI
-        */
-       Linkstate
-}
index cc4c6dc79d9a8849716d9a088ab89bfa42037813..b739571bee33735c268f69ed698362ce38c19824 100644 (file)
@@ -8,6 +8,8 @@
 package org.opendaylight.protocol.bgp.concepts;
 
 import org.opendaylight.protocol.concepts.Identifier;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.BgpSubsequentAddressFamily;
+
 import com.google.common.base.Preconditions;
 
 /**
@@ -17,7 +19,7 @@ public final class BGPTableType implements Comparable<BGPTableType>, Identifier
 
        private static final long serialVersionUID = -5502662876916458740L;
 
-       private final BGPSubsequentAddressFamily safi;
+       private final BgpSubsequentAddressFamily safi;
 
        private final BGPAddressFamily afi;
 
@@ -27,7 +29,7 @@ public final class BGPTableType implements Comparable<BGPTableType>, Identifier
         * @param afi Address Family Identifier
         * @param safi Subsequent Address Family Identifier
         */
-       public BGPTableType(final BGPAddressFamily afi, final BGPSubsequentAddressFamily safi) {
+       public BGPTableType(final BGPAddressFamily afi, final BgpSubsequentAddressFamily safi) {
                this.afi = Preconditions.checkNotNull(afi, "Address family may not be null");
                this.safi = Preconditions.checkNotNull(safi, "Subsequent address family may not be null");
        }
@@ -46,7 +48,7 @@ public final class BGPTableType implements Comparable<BGPTableType>, Identifier
         * 
         * @return safi SAFI
         */
-       public BGPSubsequentAddressFamily getSubsequentAddressFamily() {
+       public BgpSubsequentAddressFamily getSubsequentAddressFamily() {
                return this.safi;
        }
 
index ecc4c251bb345e3a5a8dafc9a289068ca4bf3f21..db9295ac0ef9de7d0e53781f9e63092cd7f463e8 100644 (file)
@@ -42,6 +42,22 @@ module bgp-types {
                        }
                }
        }
+       
+       typedef bgp-subsequent-address-family {
+               reference "http://tools.ietf.org/html/rfc4760#section-6";
+               type enumeration {
+                       enum unicast {
+                               value 1;
+                       }
+                       enum mpls-labeled-vpn {
+                               value 128;
+                       }
+                       enum linkstate {
+                               reference "http://tools.ietf.org/html/draft-ietf-idr-ls-distribution-03#section-3.2";
+                               value 71;
+                       }
+               }
+       }
 
        grouping bgp-aggregator {
                reference "http://tools.ietf.org/html/rfc4271#section-5.1.7";
index ec3e4bb9d090b1a95d9d31845f7224981fe35b52..99fc0ebfca81831c00f307c1552764344797654b 100644 (file)
@@ -16,20 +16,21 @@ import static org.junit.Assert.fail;
 import org.junit.Test;
 import org.opendaylight.protocol.concepts.IPv6;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.BgpOrigin;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.BgpSubsequentAddressFamily;
 
 public class TableTypeTest {
 
        @Test
        public void testTableTypes() {
-               final BGPTableType tt1 = new BGPTableType(BGPAddressFamily.IPv4, BGPSubsequentAddressFamily.MPLSLabeledVPN);
-               final BGPTableType tt2 = new BGPTableType(BGPAddressFamily.IPv6, BGPSubsequentAddressFamily.valueOf("MPLSLabeledVPN"));
-               final BGPTableType tt3 = new BGPTableType(BGPAddressFamily.IPv6, BGPSubsequentAddressFamily.Unicast);
+               final BGPTableType tt1 = new BGPTableType(BGPAddressFamily.IPv4, BgpSubsequentAddressFamily.MplsLabeledVpn);
+               final BGPTableType tt2 = new BGPTableType(BGPAddressFamily.IPv6, BgpSubsequentAddressFamily.valueOf("MplsLabeledVpn"));
+               final BGPTableType tt3 = new BGPTableType(BGPAddressFamily.IPv6, BgpSubsequentAddressFamily.Unicast);
 
                assertEquals(IPv6.FAMILY, BGPAddressFamily.IPv6.getAddressFamily());
                assertNull(BGPAddressFamily.LinkState.getAddressFamily());
 
                try {
-                       new BGPTableType(null, BGPSubsequentAddressFamily.MPLSLabeledVPN);
+                       new BGPTableType(null, BgpSubsequentAddressFamily.MplsLabeledVpn);
                        fail("Null AFI!");
                } catch (final NullPointerException e) {
                        assertEquals("Address family may not be null", e.getMessage());
index 1cfdeab9ff95107dd97781e45d47af0412532db3..a93e72ff3470dbac5810672dd148f7902973d3ee 100644 (file)
@@ -8,8 +8,8 @@
 package org.opendaylight.protocol.bgp.parser.parameter;
 
 import org.opendaylight.protocol.bgp.concepts.BGPAddressFamily;
-import org.opendaylight.protocol.bgp.concepts.BGPSubsequentAddressFamily;
 import org.opendaylight.protocol.bgp.concepts.BGPTableType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.BgpSubsequentAddressFamily;
 
 /**
  * Multiprotocol capability Parameter as described in:
@@ -50,7 +50,7 @@ public final class MultiprotocolCapability extends CapabilityParameter {
         * 
         * @return SAFI
         */
-       public BGPSubsequentAddressFamily getSafi() {
+       public BgpSubsequentAddressFamily getSafi() {
                return this.tableType.getSubsequentAddressFamily();
        }
 
index 3f64f2f3bdf7ca36d40124a83ba160ad873e4cf1..09dfd3cb399298d1e4f3fa3c64a0a47a9525f3a5 100644 (file)
@@ -7,7 +7,8 @@ module bgp-multiprotocol {
                prefix inet;
                revision-date 2010-09-24;
        }
-       import bgp-message { prefix bgp-msg;}
+       import bgp-message { prefix bgp-msg; }
+       import bgp-types { prefix bgp-t; }
 
        organization "Cisco Systems, Inc.";
        contact "Dana Kutenicsova <dkutenic@cisco.com>";
@@ -45,29 +46,12 @@ module bgp-multiprotocol {
                }
        }
 
-       typedef bgp-subsequent-address-family {
-               reference "http://tools.ietf.org/html/rfc4760#section-6
-               http://tools.ietf.org/html/rfc4364#section-16
-               http://tools.ietf.org/html/draft-ietf-idr-ls-distribution-03#section-3.2";
-               type enumeration {
-                       enum unicast {
-                               value 1;
-                       }
-                       enum mpls-labeled-vpn {
-                               value 128;
-                       }
-                       enum linkstate {
-                               value 71;
-                       }
-               }
-       }
-
        grouping bgp-table-type {
                leaf afi {
                        type bgp-address-family;
                }
                leaf safi {
-                       type bgp-subsequent-address-family;
+                       type bgp-t:bgp-subsequent-address-family;
                }
        }
 
index 4eee1a32d3ebd0c58088b431c8a5ac7d30b494c4..e517707248f01a1297a871cb5d73d16b4b026569 100644 (file)
@@ -20,7 +20,6 @@ import java.util.Map;
 
 import org.junit.Test;
 import org.opendaylight.protocol.bgp.concepts.BGPAddressFamily;
-import org.opendaylight.protocol.bgp.concepts.BGPSubsequentAddressFamily;
 import org.opendaylight.protocol.bgp.concepts.BGPTableType;
 import org.opendaylight.protocol.bgp.concepts.BaseBGPObjectState;
 import org.opendaylight.protocol.bgp.concepts.Community;
@@ -51,6 +50,7 @@ import org.opendaylight.protocol.concepts.TEMetric;
 import org.opendaylight.protocol.framework.DocumentedException;
 import org.opendaylight.protocol.util.DefaultingTypesafeContainer;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.BgpOrigin;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.BgpSubsequentAddressFamily;
 
 import com.google.common.collect.Maps;
 import com.google.common.collect.Sets;
@@ -110,8 +110,8 @@ public class APITest {
        @Test
        public void testBGPParameter() {
 
-               final BGPTableType t = new BGPTableType(BGPAddressFamily.LinkState, BGPSubsequentAddressFamily.Unicast);
-               final BGPTableType t1 = new BGPTableType(BGPAddressFamily.IPv4, BGPSubsequentAddressFamily.Unicast);
+               final BGPTableType t = new BGPTableType(BGPAddressFamily.LinkState, BgpSubsequentAddressFamily.Unicast);
+               final BGPTableType t1 = new BGPTableType(BGPAddressFamily.IPv4, BgpSubsequentAddressFamily.Unicast);
 
                final BGPParameter tlv1 = new MultiprotocolCapability(t);
 
index 9289f8a934e5c1e39423cbde9b4c61796f6a7bfa..300ba1b14f56ff8f778f62179b46de19d3af7e01 100644 (file)
@@ -14,7 +14,6 @@ import java.util.List;
 import java.util.Set;
 
 import org.opendaylight.protocol.bgp.concepts.BGPAddressFamily;
-import org.opendaylight.protocol.bgp.concepts.BGPSubsequentAddressFamily;
 import org.opendaylight.protocol.bgp.concepts.BGPTableType;
 import org.opendaylight.protocol.bgp.parser.BGPDocumentedException;
 import org.opendaylight.protocol.bgp.parser.BGPError;
@@ -31,6 +30,7 @@ import org.opendaylight.protocol.concepts.IPv4;
 import org.opendaylight.protocol.concepts.IPv4Address;
 import org.opendaylight.protocol.concepts.Prefix;
 import org.opendaylight.protocol.util.ByteArray;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.BgpSubsequentAddressFamily;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -100,7 +100,7 @@ public class BGPUpdateMessageParser {
 
                                @Override
                                public BGPTableType getTableType() {
-                                       return new BGPTableType(BGPAddressFamily.IPv4, BGPSubsequentAddressFamily.Unicast);
+                                       return new BGPTableType(BGPAddressFamily.IPv4, BgpSubsequentAddressFamily.Unicast);
                                }
                        };
                        return event;
@@ -118,7 +118,7 @@ public class BGPUpdateMessageParser {
 
                                                @Override
                                                public BGPTableType getTableType() {
-                                                       return new BGPTableType(BGPAddressFamily.IPv6, BGPSubsequentAddressFamily.Unicast);
+                                                       return new BGPTableType(BGPAddressFamily.IPv6, BgpSubsequentAddressFamily.Unicast);
                                                }
 
                                        };
@@ -130,7 +130,7 @@ public class BGPUpdateMessageParser {
 
                                                @Override
                                                public BGPTableType getTableType() {
-                                                       return new BGPTableType(BGPAddressFamily.LinkState, BGPSubsequentAddressFamily.Unicast);
+                                                       return new BGPTableType(BGPAddressFamily.LinkState, BgpSubsequentAddressFamily.Unicast);
                                                }
 
                                        };
index d3af4414f17eebb2726da627fd24c1df63f7b32a..f60b321d30eccd64a551c0e7d8fb4d501c913d56 100644 (file)
@@ -10,12 +10,7 @@ package org.opendaylight.protocol.bgp.parser.impl.message.open;
 import java.util.Arrays;
 import java.util.Map.Entry;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
 import org.opendaylight.protocol.bgp.concepts.BGPAddressFamily;
-import org.opendaylight.protocol.bgp.concepts.BGPSubsequentAddressFamily;
 import org.opendaylight.protocol.bgp.concepts.BGPTableType;
 import org.opendaylight.protocol.bgp.parser.BGPParsingException;
 import org.opendaylight.protocol.bgp.parser.impl.message.update.MPReachParser;
@@ -23,8 +18,12 @@ import org.opendaylight.protocol.bgp.parser.parameter.AS4BytesCapability;
 import org.opendaylight.protocol.bgp.parser.parameter.CapabilityParameter;
 import org.opendaylight.protocol.bgp.parser.parameter.GracefulCapability;
 import org.opendaylight.protocol.bgp.parser.parameter.MultiprotocolCapability;
-import org.opendaylight.protocol.util.ByteArray;
 import org.opendaylight.protocol.concepts.ASNumber;
+import org.opendaylight.protocol.util.ByteArray;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.BgpSubsequentAddressFamily;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 import com.google.common.primitives.UnsignedBytes;
 
 /**
@@ -137,8 +136,11 @@ public final class CapabilityParameterParser {
 
        private static MultiprotocolCapability parseMultiProtocolParameterValue(final byte[] bytes) throws BGPParsingException {
                final BGPAddressFamily afi = MPReachParser.parseAfi(ByteArray.bytesToInt(ByteArray.subByte(bytes, 0, AFI_SIZE)));
-               final BGPSubsequentAddressFamily safi = MPReachParser.parseSafi(ByteArray.bytesToInt(ByteArray.subByte(bytes, AFI_SIZE + 1,
-                               SAFI_SIZE)));
+               final BgpSubsequentAddressFamily safi = BgpSubsequentAddressFamily.forValue(ByteArray.bytesToInt(ByteArray.subByte(bytes,
+                               AFI_SIZE + 1, SAFI_SIZE)));
+               if (safi == null)
+                       throw new BGPParsingException("Subsequent Address Family Identifier: '"
+                                       + ByteArray.bytesToInt(ByteArray.subByte(bytes, AFI_SIZE + 1, SAFI_SIZE)) + "' not supported.");
                return new MultiprotocolCapability(new BGPTableType(afi, safi));
        }
 
@@ -151,16 +153,17 @@ public final class CapabilityParameterParser {
                return ByteArray.subByte(a, Integer.SIZE / Byte.SIZE - AFI_SIZE, AFI_SIZE);
        }
 
-       static byte putSafi(final BGPSubsequentAddressFamily safi) {
+       static byte putSafi(final BgpSubsequentAddressFamily safi) {
                final byte[] a = ByteArray.intToBytes(serializeSafi(safi));
                return ByteArray.subByte(a, Integer.SIZE / Byte.SIZE - SAFI_SIZE, SAFI_SIZE)[0];
        }
 
-       private static int serializeSafi(final BGPSubsequentAddressFamily type) {
+       // FIXME: this shouldn't be here, as we have the values in 2 places
+       private static int serializeSafi(final BgpSubsequentAddressFamily type) {
                switch (type) {
                case Unicast:
                        return 1;
-               case MPLSLabeledVPN:
+               case MplsLabeledVpn:
                        return 128;
                case Linkstate:
                        return MPReachParser.LS_SAFI;
index ec5d68632c05dc42d1008f548a72a44ab8787f42..c3f415a8ecd05cb4909aa10f8ed8bcf0d5440a4b 100644 (file)
@@ -15,7 +15,6 @@ import java.util.Map.Entry;
 import java.util.Set;
 import java.util.SortedSet;
 
-import org.opendaylight.protocol.bgp.concepts.BGPSubsequentAddressFamily;
 import org.opendaylight.protocol.bgp.concepts.NextHop;
 import org.opendaylight.protocol.bgp.linkstate.AdministrativeGroup;
 import org.opendaylight.protocol.bgp.linkstate.AreaIdentifier;
@@ -74,6 +73,7 @@ import org.opendaylight.protocol.concepts.Prefix;
 import org.opendaylight.protocol.concepts.SharedRiskLinkGroup;
 import org.opendaylight.protocol.concepts.TEMetric;
 import org.opendaylight.protocol.util.ByteArray;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.BgpSubsequentAddressFamily;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -124,7 +124,7 @@ public class LinkStateParser {
         * @return BGPLinkMP or BGPNodeMP
         * @throws BGPParsingException
         */
-       protected static MPReach<?> parseLSNlri(final boolean reachable, final BGPSubsequentAddressFamily safi, final NextHop<?> nextHop,
+       protected static MPReach<?> parseLSNlri(final boolean reachable, final BgpSubsequentAddressFamily safi, final NextHop<?> nextHop,
                        final byte[] bytes) throws BGPParsingException {
                if (bytes.length == 0)
                        return null;
@@ -142,7 +142,7 @@ public class LinkStateParser {
                        // length means total length of the tlvs including route distinguisher not including the type field
                        final int length = ByteArray.bytesToInt(ByteArray.subByte(bytes, byteOffset, LENGTH_SIZE));
                        byteOffset += LENGTH_SIZE;
-                       if (safi == BGPSubsequentAddressFamily.MPLSLabeledVPN) {
+                       if (safi == BgpSubsequentAddressFamily.MplsLabeledVpn) {
                                // this parses route distinguisher
                                ByteArray.bytesToLong(ByteArray.subByte(bytes, byteOffset, ROUTE_DISTINGUISHER_LENGTH));
                                byteOffset += ROUTE_DISTINGUISHER_LENGTH;
@@ -166,7 +166,7 @@ public class LinkStateParser {
                                localDescriptor = parseNodeDescriptors(ByteArray.subByte(bytes, byteOffset, locallength));
                        }
                        byteOffset += locallength;
-                       final int restLength = length - ((safi == BGPSubsequentAddressFamily.MPLSLabeledVPN) ? ROUTE_DISTINGUISHER_LENGTH : 0)
+                       final int restLength = length - ((safi == BgpSubsequentAddressFamily.MplsLabeledVpn) ? ROUTE_DISTINGUISHER_LENGTH : 0)
                                        - PROTOCOL_ID_LENGTH - IDENTIFIER_LENGTH - TYPE_LENGTH - LENGTH_SIZE - locallength;
                        logger.debug("Restlength {}", restLength);
                        switch (type) {
index e49e5cebd54f9eb82af51a7d9d1d6707bb247f15..cf8c084fdea4f26dcdeeef1e2fe05596cb2f4e3e 100644 (file)
@@ -9,9 +9,7 @@ package org.opendaylight.protocol.bgp.parser.impl.message.update;
 
 import java.util.Set;
 
-
 import org.opendaylight.protocol.bgp.concepts.BGPAddressFamily;
-import org.opendaylight.protocol.bgp.concepts.BGPSubsequentAddressFamily;
 import org.opendaylight.protocol.bgp.concepts.IPv4NextHop;
 import org.opendaylight.protocol.bgp.concepts.IPv6NextHop;
 import org.opendaylight.protocol.bgp.concepts.NextHop;
@@ -19,12 +17,14 @@ import org.opendaylight.protocol.bgp.parser.BGPParsingException;
 import org.opendaylight.protocol.bgp.parser.impl.IPv4MP;
 import org.opendaylight.protocol.bgp.parser.impl.IPv6MP;
 import org.opendaylight.protocol.bgp.parser.impl.MPReach;
-import org.opendaylight.protocol.util.ByteArray;
 import org.opendaylight.protocol.concepts.IPv4;
 import org.opendaylight.protocol.concepts.IPv4Address;
 import org.opendaylight.protocol.concepts.IPv6;
 import org.opendaylight.protocol.concepts.IPv6Address;
 import org.opendaylight.protocol.concepts.Prefix;
+import org.opendaylight.protocol.util.ByteArray;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.BgpSubsequentAddressFamily;
+
 import com.google.common.primitives.UnsignedBytes;
 
 /**
@@ -52,7 +52,10 @@ public class MPReachParser {
                int byteOffset = 0;
                final BGPAddressFamily afi = parseAfi(ByteArray.bytesToInt(ByteArray.subByte(bytes, byteOffset, ADDRESS_FAMILY_IDENTIFIER_SIZE)));
                byteOffset += ADDRESS_FAMILY_IDENTIFIER_SIZE;
-               final BGPSubsequentAddressFamily safi = parseSafi(UnsignedBytes.toInt(bytes[byteOffset]));
+               final BgpSubsequentAddressFamily safi = BgpSubsequentAddressFamily.forValue(UnsignedBytes.toInt(bytes[byteOffset]));
+               if (safi == null)
+                       throw new BGPParsingException("Subsequent Address Family Identifier: '" + UnsignedBytes.toInt(bytes[byteOffset])
+                                       + "' not supported.");
                byteOffset += SUBSEQUENT_ADDRESS_FAMILY_IDENTIFIER_SIZE;
                return chooseUnreachParser(afi, safi, ByteArray.subByte(bytes, byteOffset, bytes.length - byteOffset));
        }
@@ -61,7 +64,10 @@ public class MPReachParser {
                int byteOffset = 0;
                final BGPAddressFamily afi = parseAfi(ByteArray.bytesToInt(ByteArray.subByte(bytes, byteOffset, ADDRESS_FAMILY_IDENTIFIER_SIZE)));
                byteOffset += ADDRESS_FAMILY_IDENTIFIER_SIZE;
-               final BGPSubsequentAddressFamily safi = parseSafi(UnsignedBytes.toInt(bytes[byteOffset]));
+               final BgpSubsequentAddressFamily safi = BgpSubsequentAddressFamily.forValue(UnsignedBytes.toInt(bytes[byteOffset]));
+               if (safi == null)
+                       throw new BGPParsingException("Subsequent Address Family Identifier: '" + UnsignedBytes.toInt(bytes[byteOffset])
+                                       + "' not supported.");
                byteOffset += SUBSEQUENT_ADDRESS_FAMILY_IDENTIFIER_SIZE;
                final int nextHopLength = UnsignedBytes.toInt(bytes[byteOffset]);
                byteOffset += NEXT_HOP_LENGTH_SIZE;
@@ -70,19 +76,6 @@ public class MPReachParser {
                return chooseReachParser(afi, safi, nextHop, ByteArray.subByte(bytes, byteOffset, bytes.length - (byteOffset)));
        }
 
-       public static BGPSubsequentAddressFamily parseSafi(final int type) throws BGPParsingException {
-               switch (type) {
-               case 1:
-                       return BGPSubsequentAddressFamily.Unicast;
-               case LS_SAFI:
-                       return BGPSubsequentAddressFamily.Linkstate;
-               case 128:
-                       return BGPSubsequentAddressFamily.MPLSLabeledVPN;
-               default:
-                       throw new BGPParsingException("Subsequent Address Family Identifier: '" + type + "' not supported.");
-               }
-       }
-
        public static BGPAddressFamily parseAfi(final int type) throws BGPParsingException {
                switch (type) {
                case 1:
@@ -96,7 +89,7 @@ public class MPReachParser {
                }
        }
 
-       private static MPReach<?> chooseUnreachParser(final BGPAddressFamily afi, final BGPSubsequentAddressFamily safi, final byte[] bytes)
+       private static MPReach<?> chooseUnreachParser(final BGPAddressFamily afi, final BgpSubsequentAddressFamily safi, final byte[] bytes)
                        throws BGPParsingException {
                switch (afi) {
                case IPv4:
@@ -112,7 +105,7 @@ public class MPReachParser {
                }
        }
 
-       private static MPReach<?> chooseReachParser(final BGPAddressFamily afi, final BGPSubsequentAddressFamily safi,
+       private static MPReach<?> chooseReachParser(final BGPAddressFamily afi, final BgpSubsequentAddressFamily safi,
                        final NextHop<?> nextHop, final byte[] bytes) throws BGPParsingException {
                switch (afi) {
                case IPv4:
@@ -138,7 +131,8 @@ public class MPReachParser {
                        addr = new IPv6NextHop(IPv6.FAMILY.addressForBytes(bytes));
                        break;
                case 32:
-                       addr = new IPv6NextHop(IPv6.FAMILY.addressForBytes(ByteArray.subByte(bytes, 0, 16)), IPv6.FAMILY.addressForBytes(ByteArray.subByte(bytes, 16, 16)));
+                       addr = new IPv6NextHop(IPv6.FAMILY.addressForBytes(ByteArray.subByte(bytes, 0, 16)), IPv6.FAMILY.addressForBytes(ByteArray.subByte(
+                                       bytes, 16, 16)));
                        break;
                default:
                        throw new BGPParsingException("Cannot parse NEXT_HOP attribute. Wrong bytes length: " + bytes.length);
index ed607bc00554f3491674e4a8beb9235e262407bd..ce719b2891b813c4055246ebe1f358b923e5909e 100644 (file)
@@ -25,7 +25,6 @@ import org.junit.Test;
 import org.opendaylight.protocol.bgp.concepts.ASPath;
 import org.opendaylight.protocol.bgp.concepts.BGPAddressFamily;
 import org.opendaylight.protocol.bgp.concepts.BGPObject;
-import org.opendaylight.protocol.bgp.concepts.BGPSubsequentAddressFamily;
 import org.opendaylight.protocol.bgp.concepts.BGPTableType;
 import org.opendaylight.protocol.bgp.concepts.BaseBGPObjectState;
 import org.opendaylight.protocol.bgp.concepts.Community;
@@ -81,6 +80,7 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.BgpAggregator;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.BgpOrigin;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.BgpSubsequentAddressFamily;
 
 import com.google.common.collect.Lists;
 import com.google.common.collect.Sets;
@@ -633,7 +633,7 @@ public class BGPParserTest {
 
                        @Override
                        public BGPTableType getTableType() {
-                               return new BGPTableType(BGPAddressFamily.IPv4, BGPSubsequentAddressFamily.Unicast);
+                               return new BGPTableType(BGPAddressFamily.IPv4, BgpSubsequentAddressFamily.Unicast);
                        }
                };
                assertEquals(expectedMessage.getTableType(), message.getTableType());
@@ -671,7 +671,7 @@ public class BGPParserTest {
 
                        @Override
                        public BGPTableType getTableType() {
-                               return new BGPTableType(BGPAddressFamily.IPv6, BGPSubsequentAddressFamily.Unicast);
+                               return new BGPTableType(BGPAddressFamily.IPv6, BgpSubsequentAddressFamily.Unicast);
                        }
                };
                assertEquals(expectedMessage.getTableType(), message.getTableType());
@@ -709,7 +709,7 @@ public class BGPParserTest {
 
                        @Override
                        public BGPTableType getTableType() {
-                               return new BGPTableType(BGPAddressFamily.LinkState, BGPSubsequentAddressFamily.Unicast);
+                               return new BGPTableType(BGPAddressFamily.LinkState, BgpSubsequentAddressFamily.Unicast);
                        }
                };
 
@@ -1087,9 +1087,9 @@ public class BGPParserTest {
                                types.add(((MultiprotocolCapability) param).getTableType());
                        }
                }
-               final Set<BGPTableType> expected = Sets.newHashSet(new BGPTableType(BGPAddressFamily.IPv4, BGPSubsequentAddressFamily.Unicast),
-                               new BGPTableType(BGPAddressFamily.IPv6, BGPSubsequentAddressFamily.Unicast),
-                               new BGPTableType(BGPAddressFamily.LinkState, BGPSubsequentAddressFamily.Linkstate));
+               final Set<BGPTableType> expected = Sets.newHashSet(new BGPTableType(BGPAddressFamily.IPv4, BgpSubsequentAddressFamily.Unicast),
+                               new BGPTableType(BGPAddressFamily.IPv6, BgpSubsequentAddressFamily.Unicast),
+                               new BGPTableType(BGPAddressFamily.LinkState, BgpSubsequentAddressFamily.Linkstate));
                assertEquals(expected, types);
        }
 
index 82739c09cee56ef68abc7373de453d775b9a5d00..4095e36a922eb027b6be6f76a9b1fbcb0ffadb0e 100644 (file)
@@ -171,22 +171,12 @@ public class ComplementaryTest {
 
        @Test
        public void testMPReachParser() {
-               String msg = "";
-               try {
-                       MPReachParser.parseSafi(5);
-                       fail("Exception shoul have occured.");
-               } catch (final BGPParsingException e) {
-                       msg = e.getMessage();
-               }
-               assertEquals("Subsequent Address Family Identifier: '5' not supported.", msg);
-
                try {
                        MPReachParser.parseAfi(6);
                        fail("Exception should have occured.");
                } catch (final BGPParsingException e) {
-                       msg = e.getMessage();
+                       assertEquals("Address Family Identifier: '6' not supported.", e.getMessage());
                }
-               assertEquals("Address Family Identifier: '6' not supported.", msg);
        }
 
        @Test
index 5fd4db656b42628fe484639d38731cc3827c6ec7..76fbf94486f58624996e334243d4c1bc55c391f3 100644 (file)
@@ -28,7 +28,6 @@ import org.junit.Test;
 import org.opendaylight.protocol.bgp.concepts.ASPath;
 import org.opendaylight.protocol.bgp.concepts.BGPAddressFamily;
 import org.opendaylight.protocol.bgp.concepts.BGPObject;
-import org.opendaylight.protocol.bgp.concepts.BGPSubsequentAddressFamily;
 import org.opendaylight.protocol.bgp.concepts.BGPTableType;
 import org.opendaylight.protocol.bgp.concepts.BaseBGPObjectState;
 import org.opendaylight.protocol.bgp.concepts.Community;
@@ -53,6 +52,7 @@ import org.opendaylight.protocol.concepts.Prefix;
 import org.opendaylight.protocol.framework.DeserializerException;
 import org.opendaylight.protocol.framework.DocumentedException;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.BgpOrigin;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.BgpSubsequentAddressFamily;
 
 import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
@@ -167,10 +167,10 @@ public class BGPMessageParserMockTest {
                final Map<byte[], List<BGPMessage>> openMap = Maps.newHashMap();
 
                final Set<BGPTableType> type = Sets.newHashSet();
-               type.add(new BGPTableType(BGPAddressFamily.IPv4, BGPSubsequentAddressFamily.MPLSLabeledVPN));
+               type.add(new BGPTableType(BGPAddressFamily.IPv4, BgpSubsequentAddressFamily.MplsLabeledVpn));
 
                final List<BGPParameter> params = Lists.newArrayList();
-               params.add(new MultiprotocolCapability(new BGPTableType(BGPAddressFamily.IPv4, BGPSubsequentAddressFamily.MPLSLabeledVPN)));
+               params.add(new MultiprotocolCapability(new BGPTableType(BGPAddressFamily.IPv4, BgpSubsequentAddressFamily.MplsLabeledVpn)));
 
                final byte[] input = new byte[] { 5, 8, 13, 21 };
 
index 1edc50838bdcf85809b3a52daf6a7445264c808c..6d14bccd635cd7bdc7dacca95ec9e58bb0ec2c6b 100644 (file)
@@ -14,23 +14,23 @@ import java.util.Collections;
 
 import org.junit.Test;
 import org.opendaylight.protocol.bgp.concepts.BGPAddressFamily;
-import org.opendaylight.protocol.bgp.concepts.BGPSubsequentAddressFamily;
 import org.opendaylight.protocol.bgp.concepts.BGPTableType;
 import org.opendaylight.protocol.bgp.parser.BGPRouteState;
 import org.opendaylight.protocol.concepts.Prefix;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.BgpSubsequentAddressFamily;
 
 public class BGPEventsTest {
 
        @Test
        public void testSynchronizedEvent() {
-               BGPTableType tt = new BGPTableType(BGPAddressFamily.IPv6, BGPSubsequentAddressFamily.MPLSLabeledVPN);
-               RIBSynchronizedEvent event = new RIBSynchronizedEvent(tt);
+               final BGPTableType tt = new BGPTableType(BGPAddressFamily.IPv6, BgpSubsequentAddressFamily.MplsLabeledVpn);
+               final RIBSynchronizedEvent event = new RIBSynchronizedEvent(tt);
                assertEquals(tt, event.getTable());
        }
-       
+
        @Test
        public void testChangedEvent() {
-               RIBChangedEvent event = new RIBChangedEvent(Collections.<Prefix<?>, BGPRouteState<?>> emptyMap());
+               final RIBChangedEvent event = new RIBChangedEvent(Collections.<Prefix<?>, BGPRouteState<?>> emptyMap());
                assertNotNull(event.getLinks());
                assertNotNull(event.getNodes());
                assertNotNull(event.getPrefixes());
index 89d04595864dd7c3ba70290518856ac42e11f55e..ef90c805e189e69a9bc9ccfe2f0eb8aec5b9eec3 100644 (file)
@@ -19,7 +19,6 @@ import java.util.concurrent.TimeUnit;
 import javax.annotation.concurrent.GuardedBy;
 
 import org.opendaylight.protocol.bgp.concepts.BGPAddressFamily;
-import org.opendaylight.protocol.bgp.concepts.BGPSubsequentAddressFamily;
 import org.opendaylight.protocol.bgp.parser.BGPDocumentedException;
 import org.opendaylight.protocol.bgp.parser.BGPError;
 import org.opendaylight.protocol.bgp.parser.BGPMessage;
@@ -32,6 +31,7 @@ import org.opendaylight.protocol.bgp.parser.parameter.CapabilityParameter;
 import org.opendaylight.protocol.bgp.parser.parameter.MultiprotocolCapability;
 import org.opendaylight.protocol.bgp.rib.impl.spi.BGPSessionPreferences;
 import org.opendaylight.protocol.framework.AbstractSessionNegotiator;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.BgpSubsequentAddressFamily;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -134,7 +134,7 @@ public final class BGPSessionNegotiator extends AbstractSessionNegotiator<BGPMes
                                                if (param instanceof CapabilityParameter) {
                                                        if (((CapabilityParameter) param).getCode() == MultiprotocolCapability.CODE) {
                                                                final MultiprotocolCapability cap = (MultiprotocolCapability) param;
-                                                               if (cap.getAfi() == BGPAddressFamily.LinkState && cap.getSafi() == BGPSubsequentAddressFamily.Linkstate) {
+                                                               if (cap.getAfi() == BGPAddressFamily.LinkState && cap.getSafi() == BgpSubsequentAddressFamily.Linkstate) {
                                                                        this.remotePref = openObj;
                                                                        this.channel.writeAndFlush(new BGPKeepAliveMessage());
                                                                        this.session = new BGPSessionImpl(this.timer, this.listener, this.channel, this.remotePref);
index e6b304917a7f1d08949ef1aaee932c18c8a5145f..98ffcf1bb142e3e16c6ba1ba4c0112fa71581373 100644 (file)
@@ -10,7 +10,6 @@ package org.opendaylight.protocol.bgp.rib.impl;
 import java.util.List;
 
 import org.opendaylight.protocol.bgp.concepts.BGPAddressFamily;
-import org.opendaylight.protocol.bgp.concepts.BGPSubsequentAddressFamily;
 import org.opendaylight.protocol.bgp.concepts.BGPTableType;
 import org.opendaylight.protocol.bgp.parser.BGPParameter;
 import org.opendaylight.protocol.bgp.parser.parameter.AS4BytesCapability;
@@ -19,6 +18,7 @@ import org.opendaylight.protocol.bgp.rib.impl.spi.BGPSessionPreferences;
 import org.opendaylight.protocol.bgp.rib.impl.spi.BGPSessionProposal;
 import org.opendaylight.protocol.concepts.ASNumber;
 import org.opendaylight.protocol.concepts.IPv4Address;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.BgpSubsequentAddressFamily;
 
 import com.google.common.collect.Lists;
 
@@ -40,8 +40,8 @@ public final class BGPSessionProposalImpl implements BGPSessionProposal {
                this.as = as;
                this.bgpId = bgpId;
 
-               final BGPTableType ipv4 = new BGPTableType(BGPAddressFamily.IPv4, BGPSubsequentAddressFamily.Unicast);
-               final BGPTableType linkstate = new BGPTableType(BGPAddressFamily.LinkState, BGPSubsequentAddressFamily.Linkstate);
+               final BGPTableType ipv4 = new BGPTableType(BGPAddressFamily.IPv4, BgpSubsequentAddressFamily.Unicast);
+               final BGPTableType linkstate = new BGPTableType(BGPAddressFamily.LinkState, BgpSubsequentAddressFamily.Linkstate);
                final List<BGPParameter> tlvs = Lists.newArrayList();
                tlvs.add(new MultiprotocolCapability(ipv4));
                tlvs.add(new MultiprotocolCapability(linkstate));
index bf3ef5bc77a3bfe8a423075e7e7aa5fe74c3270b..64465cad5b6ea745c139e9ce29b86ce9b190f822 100644 (file)
@@ -13,7 +13,6 @@ import java.util.Set;
 
 import org.opendaylight.protocol.bgp.concepts.BGPAddressFamily;
 import org.opendaylight.protocol.bgp.concepts.BGPObject;
-import org.opendaylight.protocol.bgp.concepts.BGPSubsequentAddressFamily;
 import org.opendaylight.protocol.bgp.concepts.BGPTableType;
 import org.opendaylight.protocol.bgp.parser.BGPLink;
 import org.opendaylight.protocol.bgp.parser.BGPNode;
@@ -25,6 +24,7 @@ import org.opendaylight.protocol.bgp.parser.BGPUpdateMessage;
 import org.opendaylight.protocol.bgp.parser.BGPUpdateSynchronized;
 import org.opendaylight.protocol.bgp.util.BGPIPv4RouteImpl;
 import org.opendaylight.protocol.bgp.util.BGPIPv6RouteImpl;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.BgpSubsequentAddressFamily;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -91,12 +91,12 @@ public class BGPSynchronization {
                        final BGPObject obj = msg.getAddedObjects().iterator().next();
                        if (obj instanceof BGPRoute<?>) {
                                if ((BGPRoute<?>) obj instanceof BGPIPv4RouteImpl) {
-                                       type = new BGPTableType(BGPAddressFamily.IPv4, BGPSubsequentAddressFamily.Unicast);
+                                       type = new BGPTableType(BGPAddressFamily.IPv4, BgpSubsequentAddressFamily.Unicast);
                                } else if ((BGPRoute<?>) obj instanceof BGPIPv6RouteImpl) {
-                                       type = new BGPTableType(BGPAddressFamily.IPv6, BGPSubsequentAddressFamily.Unicast);
+                                       type = new BGPTableType(BGPAddressFamily.IPv6, BgpSubsequentAddressFamily.Unicast);
                                }
                        } else if (obj instanceof BGPLink || obj instanceof BGPNode || obj instanceof BGPPrefix<?>) {
-                               type = new BGPTableType(BGPAddressFamily.LinkState, BGPSubsequentAddressFamily.Linkstate);
+                               type = new BGPTableType(BGPAddressFamily.LinkState, BgpSubsequentAddressFamily.Linkstate);
                        }
                }
                final SyncVariables s = this.syncStorage.get(type);
@@ -120,7 +120,7 @@ public class BGPSynchronization {
                                        s.setEorTrue();
                                        final BGPUpdateSynchronized up = generateEOR(entry.getKey());
                                        logger.debug("Sending synchronization message: {}", up);
-                                       this.listener.onMessage(session, up);
+                                       this.listener.onMessage(this.session, up);
                                }
                                s.setUpd(false);
                        }
index 053477bf1bd074177011bedb2ba98d3fb2917532..98f76306b93628cb8a9dd1667dc1053040454005 100644 (file)
@@ -12,11 +12,11 @@ import static org.junit.Assert.assertNull;
 
 import org.junit.Test;
 import org.opendaylight.protocol.bgp.concepts.BGPAddressFamily;
-import org.opendaylight.protocol.bgp.concepts.BGPSubsequentAddressFamily;
 import org.opendaylight.protocol.bgp.concepts.BGPTableType;
 import org.opendaylight.protocol.bgp.parser.BGPUpdateSynchronized;
 import org.opendaylight.protocol.bgp.rib.impl.spi.BGPSessionPreferences;
 import org.opendaylight.protocol.concepts.ASNumber;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.BgpSubsequentAddressFamily;
 
 public class ApiTest {
 
@@ -30,7 +30,7 @@ public class ApiTest {
 
        @Test
        public void testBGPUpdateSynchronized() {
-               final BGPTableType tt = new BGPTableType(BGPAddressFamily.IPv4, BGPSubsequentAddressFamily.Linkstate);
+               final BGPTableType tt = new BGPTableType(BGPAddressFamily.IPv4, BgpSubsequentAddressFamily.Linkstate);
                final BGPUpdateSynchronized update = new BGPUpdateSynchronizedImpl(tt);
                assertEquals(tt, update.getTableType());
        }
index 3959c653bd6b39448705e57af4531275b785b4a2..f9b4f453236759745acec873f7ba01e61c5f452e 100644 (file)
@@ -33,7 +33,6 @@ import org.mockito.MockitoAnnotations;
 import org.mockito.invocation.InvocationOnMock;
 import org.mockito.stubbing.Answer;
 import org.opendaylight.protocol.bgp.concepts.BGPAddressFamily;
-import org.opendaylight.protocol.bgp.concepts.BGPSubsequentAddressFamily;
 import org.opendaylight.protocol.bgp.concepts.BGPTableType;
 import org.opendaylight.protocol.bgp.parser.BGPError;
 import org.opendaylight.protocol.bgp.parser.BGPMessage;
@@ -44,6 +43,7 @@ import org.opendaylight.protocol.bgp.parser.message.BGPOpenMessage;
 import org.opendaylight.protocol.bgp.parser.parameter.MultiprotocolCapability;
 import org.opendaylight.protocol.bgp.rib.impl.spi.BGPSessionPreferences;
 import org.opendaylight.protocol.concepts.ASNumber;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.BgpSubsequentAddressFamily;
 
 import com.google.common.collect.Lists;
 
@@ -57,9 +57,9 @@ public class FSMTest {
        @Mock
        private ChannelPipeline pipeline;
 
-       private final BGPTableType ipv4tt = new BGPTableType(BGPAddressFamily.IPv4, BGPSubsequentAddressFamily.Unicast);
+       private final BGPTableType ipv4tt = new BGPTableType(BGPAddressFamily.IPv4, BgpSubsequentAddressFamily.Unicast);
 
-       private final BGPTableType linkstatett = new BGPTableType(BGPAddressFamily.LinkState, BGPSubsequentAddressFamily.Linkstate);
+       private final BGPTableType linkstatett = new BGPTableType(BGPAddressFamily.LinkState, BgpSubsequentAddressFamily.Linkstate);
 
        private final List<BGPMessage> receivedMsgs = Lists.newArrayList();
 
index 4d083faa537f3c40f33348ce5fead8bed225f642..739e8e9a45d6c9d006eaa44ffe032ecc121a5734 100644 (file)
@@ -22,7 +22,6 @@ import java.util.Map;
 
 import org.junit.Test;
 import org.opendaylight.protocol.bgp.concepts.BGPAddressFamily;
-import org.opendaylight.protocol.bgp.concepts.BGPSubsequentAddressFamily;
 import org.opendaylight.protocol.bgp.concepts.BGPTableType;
 import org.opendaylight.protocol.bgp.parser.BGPDocumentedException;
 import org.opendaylight.protocol.bgp.parser.BGPError;
@@ -40,6 +39,7 @@ import org.opendaylight.protocol.framework.DeserializerException;
 import org.opendaylight.protocol.framework.DocumentedException;
 import org.opendaylight.protocol.framework.ProtocolMessageFactory;
 import org.opendaylight.protocol.util.ByteArray;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.BgpSubsequentAddressFamily;
 
 import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
@@ -47,17 +47,17 @@ import com.google.common.collect.Maps;
 public class ParserTest {
 
        public static final byte[] openBMsg = 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, (byte) 0x00, (byte) 0x1d, (byte) 0x01, (byte) 0x04, (byte) 0x00, (byte) 0x64, (byte) 0x00, (byte) 0xb4,
-               (byte) 0x14, (byte) 0x14, (byte) 0x14, (byte) 0x14, (byte) 0x00 };
+                       (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
+                       (byte) 0xff, (byte) 0x00, (byte) 0x1d, (byte) 0x01, (byte) 0x04, (byte) 0x00, (byte) 0x64, (byte) 0x00, (byte) 0xb4,
+                       (byte) 0x14, (byte) 0x14, (byte) 0x14, (byte) 0x14, (byte) 0x00 };
 
        public static final byte[] keepAliveBMsg = 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, (byte) 0x00, (byte) 0x13, (byte) 0x04 };
+                       (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
+                       (byte) 0xff, (byte) 0x00, (byte) 0x13, (byte) 0x04 };
 
        public static final byte[] notificationBMsg = 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, (byte) 0x00, (byte) 0x17, (byte) 0x03, (byte) 0x02, (byte) 0x04, (byte) 0x04, (byte) 0x09 };
+                       (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
+                       (byte) 0xff, (byte) 0xff, (byte) 0x00, (byte) 0x17, (byte) 0x03, (byte) 0x02, (byte) 0x04, (byte) 0x04, (byte) 0x09 };
 
        final ProtocolMessageFactory<BGPMessage> factory = new BGPMessageFactoryImpl();
 
@@ -245,8 +245,8 @@ public class ParserTest {
        @Test
        public void testTLVParser() throws UnknownHostException {
 
-               final BGPTableType t1 = new BGPTableType(BGPAddressFamily.IPv4, BGPSubsequentAddressFamily.Unicast);
-               final BGPTableType t2 = new BGPTableType(BGPAddressFamily.LinkState, BGPSubsequentAddressFamily.Unicast);
+               final BGPTableType t1 = new BGPTableType(BGPAddressFamily.IPv4, BgpSubsequentAddressFamily.Unicast);
+               final BGPTableType t2 = new BGPTableType(BGPAddressFamily.LinkState, BgpSubsequentAddressFamily.Unicast);
 
                final List<BGPParameter> tlvs = Lists.newArrayList();
                tlvs.add(new MultiprotocolCapability(t1));
index 9bc64875f2ed7479ad747d27cc4a7acd7a4dad83..c992d43c8a08fbb2add40775bb257ce3077b7b8d 100644 (file)
@@ -17,7 +17,6 @@ import org.junit.Before;
 import org.junit.Test;
 import org.opendaylight.protocol.bgp.concepts.BGPAddressFamily;
 import org.opendaylight.protocol.bgp.concepts.BGPObject;
-import org.opendaylight.protocol.bgp.concepts.BGPSubsequentAddressFamily;
 import org.opendaylight.protocol.bgp.concepts.BGPTableType;
 import org.opendaylight.protocol.bgp.concepts.BaseBGPObjectState;
 import org.opendaylight.protocol.bgp.parser.BGPLink;
@@ -28,6 +27,7 @@ import org.opendaylight.protocol.bgp.util.BGPIPv4RouteImpl;
 import org.opendaylight.protocol.bgp.util.BGPIPv6RouteImpl;
 import org.opendaylight.protocol.concepts.IPv4;
 import org.opendaylight.protocol.concepts.IPv6;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.BgpSubsequentAddressFamily;
 
 import com.google.common.collect.Sets;
 
@@ -52,8 +52,8 @@ public class SynchronizationTest {
                this.ipv6m = new BGPUpdateMessageImpl(Sets.<BGPObject> newHashSet(i6), Collections.EMPTY_SET);
                this.lsm = new BGPUpdateMessageImpl(Sets.<BGPObject> newHashSet(mock(BGPLink.class)), Collections.EMPTY_SET);
 
-               final Set<BGPTableType> types = Sets.newHashSet(new BGPTableType(BGPAddressFamily.IPv4, BGPSubsequentAddressFamily.Unicast),
-                               new BGPTableType(BGPAddressFamily.LinkState, BGPSubsequentAddressFamily.Linkstate));
+               final Set<BGPTableType> types = Sets.newHashSet(new BGPTableType(BGPAddressFamily.IPv4, BgpSubsequentAddressFamily.Unicast),
+                               new BGPTableType(BGPAddressFamily.LinkState, BgpSubsequentAddressFamily.Linkstate));
 
                this.bs = new BGPSynchronization(new BGPSession() {