From 87c455085afe01b5a79455977ee700b79e2810b9 Mon Sep 17 00:00:00 2001 From: Dana Kutenicsova Date: Thu, 19 Sep 2013 16:57:54 +0200 Subject: [PATCH] BUG-45 : migrated Subsequent Address Family Identifier to generated source code. Change-Id: Ifa24f6d44f2ad0562d23a16d39d3d9eaea3e1fef Signed-off-by: Dana Kutenicsova --- .../concepts/BGPSubsequentAddressFamily.java | 27 -------------- .../protocol/bgp/concepts/BGPTableType.java | 8 +++-- bgp/concepts/src/main/yang/bgp-types.yang | 16 +++++++++ .../protocol/bgp/concepts/TableTypeTest.java | 9 ++--- .../parameter/MultiprotocolCapability.java | 4 +-- .../src/main/yang/bgp-multiprotocol.yang | 22 ++---------- .../protocol/bgp/parser/APITest.java | 6 ++-- .../impl/message/BGPUpdateMessageParser.java | 8 ++--- .../open/CapabilityParameterParser.java | 25 +++++++------ .../impl/message/update/LinkStateParser.java | 8 ++--- .../impl/message/update/MPReachParser.java | 36 ++++++++----------- .../bgp/parser/impl/BGPParserTest.java | 14 ++++---- .../bgp/parser/impl/ComplementaryTest.java | 12 +------ .../parser/mock/BGPMessageParserMockTest.java | 6 ++-- .../protocol/bgp/rib/BGPEventsTest.java | 10 +++--- .../bgp/rib/impl/BGPSessionNegotiator.java | 4 +-- .../bgp/rib/impl/BGPSessionProposalImpl.java | 6 ++-- .../bgp/rib/impl/BGPSynchronization.java | 10 +++--- .../protocol/bgp/rib/impl/ApiTest.java | 4 +-- .../protocol/bgp/rib/impl/FSMTest.java | 6 ++-- .../protocol/bgp/rib/impl/ParserTest.java | 20 +++++------ .../bgp/rib/impl/SynchronizationTest.java | 6 ++-- 22 files changed, 115 insertions(+), 152 deletions(-) delete mode 100644 bgp/concepts/src/main/java/org/opendaylight/protocol/bgp/concepts/BGPSubsequentAddressFamily.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 index ba237e8c4e..0000000000 --- a/bgp/concepts/src/main/java/org/opendaylight/protocol/bgp/concepts/BGPSubsequentAddressFamily.java +++ /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 -} diff --git a/bgp/concepts/src/main/java/org/opendaylight/protocol/bgp/concepts/BGPTableType.java b/bgp/concepts/src/main/java/org/opendaylight/protocol/bgp/concepts/BGPTableType.java index cc4c6dc79d..b739571bee 100644 --- a/bgp/concepts/src/main/java/org/opendaylight/protocol/bgp/concepts/BGPTableType.java +++ b/bgp/concepts/src/main/java/org/opendaylight/protocol/bgp/concepts/BGPTableType.java @@ -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, 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, 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, Identifier * * @return safi SAFI */ - public BGPSubsequentAddressFamily getSubsequentAddressFamily() { + public BgpSubsequentAddressFamily getSubsequentAddressFamily() { return this.safi; } diff --git a/bgp/concepts/src/main/yang/bgp-types.yang b/bgp/concepts/src/main/yang/bgp-types.yang index ecc4c251bb..db9295ac0e 100644 --- a/bgp/concepts/src/main/yang/bgp-types.yang +++ b/bgp/concepts/src/main/yang/bgp-types.yang @@ -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"; diff --git a/bgp/concepts/src/test/java/org/opendaylight/protocol/bgp/concepts/TableTypeTest.java b/bgp/concepts/src/test/java/org/opendaylight/protocol/bgp/concepts/TableTypeTest.java index ec3e4bb9d0..99fc0ebfca 100644 --- a/bgp/concepts/src/test/java/org/opendaylight/protocol/bgp/concepts/TableTypeTest.java +++ b/bgp/concepts/src/test/java/org/opendaylight/protocol/bgp/concepts/TableTypeTest.java @@ -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()); diff --git a/bgp/parser-api/src/main/java/org/opendaylight/protocol/bgp/parser/parameter/MultiprotocolCapability.java b/bgp/parser-api/src/main/java/org/opendaylight/protocol/bgp/parser/parameter/MultiprotocolCapability.java index 1cfdeab9ff..a93e72ff34 100644 --- a/bgp/parser-api/src/main/java/org/opendaylight/protocol/bgp/parser/parameter/MultiprotocolCapability.java +++ b/bgp/parser-api/src/main/java/org/opendaylight/protocol/bgp/parser/parameter/MultiprotocolCapability.java @@ -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(); } diff --git a/bgp/parser-api/src/main/yang/bgp-multiprotocol.yang b/bgp/parser-api/src/main/yang/bgp-multiprotocol.yang index 3f64f2f3bd..09dfd3cb39 100644 --- a/bgp/parser-api/src/main/yang/bgp-multiprotocol.yang +++ b/bgp/parser-api/src/main/yang/bgp-multiprotocol.yang @@ -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 "; @@ -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; } } diff --git a/bgp/parser-api/src/test/java/org/opendaylight/protocol/bgp/parser/APITest.java b/bgp/parser-api/src/test/java/org/opendaylight/protocol/bgp/parser/APITest.java index 4eee1a32d3..e517707248 100644 --- a/bgp/parser-api/src/test/java/org/opendaylight/protocol/bgp/parser/APITest.java +++ b/bgp/parser-api/src/test/java/org/opendaylight/protocol/bgp/parser/APITest.java @@ -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); diff --git a/bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/BGPUpdateMessageParser.java b/bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/BGPUpdateMessageParser.java index 9289f8a934..300ba1b14f 100644 --- a/bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/BGPUpdateMessageParser.java +++ b/bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/BGPUpdateMessageParser.java @@ -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); } }; diff --git a/bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/open/CapabilityParameterParser.java b/bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/open/CapabilityParameterParser.java index d3af4414f1..f60b321d30 100644 --- a/bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/open/CapabilityParameterParser.java +++ b/bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/open/CapabilityParameterParser.java @@ -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; diff --git a/bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/update/LinkStateParser.java b/bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/update/LinkStateParser.java index ec5d68632c..c3f415a8ec 100644 --- a/bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/update/LinkStateParser.java +++ b/bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/update/LinkStateParser.java @@ -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) { diff --git a/bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/update/MPReachParser.java b/bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/update/MPReachParser.java index e49e5cebd5..cf8c084fde 100644 --- a/bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/update/MPReachParser.java +++ b/bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/update/MPReachParser.java @@ -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); diff --git a/bgp/parser-impl/src/test/java/org/opendaylight/protocol/bgp/parser/impl/BGPParserTest.java b/bgp/parser-impl/src/test/java/org/opendaylight/protocol/bgp/parser/impl/BGPParserTest.java index ed607bc005..ce719b2891 100644 --- a/bgp/parser-impl/src/test/java/org/opendaylight/protocol/bgp/parser/impl/BGPParserTest.java +++ b/bgp/parser-impl/src/test/java/org/opendaylight/protocol/bgp/parser/impl/BGPParserTest.java @@ -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 expected = Sets.newHashSet(new BGPTableType(BGPAddressFamily.IPv4, BGPSubsequentAddressFamily.Unicast), - new BGPTableType(BGPAddressFamily.IPv6, BGPSubsequentAddressFamily.Unicast), - new BGPTableType(BGPAddressFamily.LinkState, BGPSubsequentAddressFamily.Linkstate)); + final Set expected = Sets.newHashSet(new BGPTableType(BGPAddressFamily.IPv4, BgpSubsequentAddressFamily.Unicast), + new BGPTableType(BGPAddressFamily.IPv6, BgpSubsequentAddressFamily.Unicast), + new BGPTableType(BGPAddressFamily.LinkState, BgpSubsequentAddressFamily.Linkstate)); assertEquals(expected, types); } diff --git a/bgp/parser-impl/src/test/java/org/opendaylight/protocol/bgp/parser/impl/ComplementaryTest.java b/bgp/parser-impl/src/test/java/org/opendaylight/protocol/bgp/parser/impl/ComplementaryTest.java index 82739c09ce..4095e36a92 100644 --- a/bgp/parser-impl/src/test/java/org/opendaylight/protocol/bgp/parser/impl/ComplementaryTest.java +++ b/bgp/parser-impl/src/test/java/org/opendaylight/protocol/bgp/parser/impl/ComplementaryTest.java @@ -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 diff --git a/bgp/parser-mock/src/test/java/org/opendaylight/protocol/bgp/parser/mock/BGPMessageParserMockTest.java b/bgp/parser-mock/src/test/java/org/opendaylight/protocol/bgp/parser/mock/BGPMessageParserMockTest.java index 5fd4db656b..76fbf94486 100644 --- a/bgp/parser-mock/src/test/java/org/opendaylight/protocol/bgp/parser/mock/BGPMessageParserMockTest.java +++ b/bgp/parser-mock/src/test/java/org/opendaylight/protocol/bgp/parser/mock/BGPMessageParserMockTest.java @@ -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> openMap = Maps.newHashMap(); final Set type = Sets.newHashSet(); - type.add(new BGPTableType(BGPAddressFamily.IPv4, BGPSubsequentAddressFamily.MPLSLabeledVPN)); + type.add(new BGPTableType(BGPAddressFamily.IPv4, BgpSubsequentAddressFamily.MplsLabeledVpn)); final List 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 }; diff --git a/bgp/rib-api/src/test/java/org/opendaylight/protocol/bgp/rib/BGPEventsTest.java b/bgp/rib-api/src/test/java/org/opendaylight/protocol/bgp/rib/BGPEventsTest.java index 1edc50838b..6d14bccd63 100644 --- a/bgp/rib-api/src/test/java/org/opendaylight/protocol/bgp/rib/BGPEventsTest.java +++ b/bgp/rib-api/src/test/java/org/opendaylight/protocol/bgp/rib/BGPEventsTest.java @@ -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., BGPRouteState> emptyMap()); + final RIBChangedEvent event = new RIBChangedEvent(Collections., BGPRouteState> emptyMap()); assertNotNull(event.getLinks()); assertNotNull(event.getNodes()); assertNotNull(event.getPrefixes()); diff --git a/bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/BGPSessionNegotiator.java b/bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/BGPSessionNegotiator.java index 89d0459586..ef90c805e1 100644 --- a/bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/BGPSessionNegotiator.java +++ b/bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/BGPSessionNegotiator.java @@ -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 tlvs = Lists.newArrayList(); tlvs.add(new MultiprotocolCapability(ipv4)); tlvs.add(new MultiprotocolCapability(linkstate)); diff --git a/bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/BGPSynchronization.java b/bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/BGPSynchronization.java index bf3ef5bc77..64465cad5b 100644 --- a/bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/BGPSynchronization.java +++ b/bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/BGPSynchronization.java @@ -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); } diff --git a/bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/ApiTest.java b/bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/ApiTest.java index 053477bf1b..98f76306b9 100644 --- a/bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/ApiTest.java +++ b/bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/ApiTest.java @@ -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()); } diff --git a/bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/FSMTest.java b/bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/FSMTest.java index 3959c653bd..f9b4f45323 100644 --- a/bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/FSMTest.java +++ b/bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/FSMTest.java @@ -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 receivedMsgs = Lists.newArrayList(); diff --git a/bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/ParserTest.java b/bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/ParserTest.java index 4d083faa53..739e8e9a45 100644 --- a/bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/ParserTest.java +++ b/bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/ParserTest.java @@ -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 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 tlvs = Lists.newArrayList(); tlvs.add(new MultiprotocolCapability(t1)); diff --git a/bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/SynchronizationTest.java b/bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/SynchronizationTest.java index 9bc64875f2..c992d43c8a 100644 --- a/bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/SynchronizationTest.java +++ b/bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/SynchronizationTest.java @@ -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. newHashSet(i6), Collections.EMPTY_SET); this.lsm = new BGPUpdateMessageImpl(Sets. newHashSet(mock(BGPLink.class)), Collections.EMPTY_SET); - final Set types = Sets.newHashSet(new BGPTableType(BGPAddressFamily.IPv4, BGPSubsequentAddressFamily.Unicast), - new BGPTableType(BGPAddressFamily.LinkState, BGPSubsequentAddressFamily.Linkstate)); + final Set types = Sets.newHashSet(new BGPTableType(BGPAddressFamily.IPv4, BgpSubsequentAddressFamily.Unicast), + new BGPTableType(BGPAddressFamily.LinkState, BgpSubsequentAddressFamily.Linkstate)); this.bs = new BGPSynchronization(new BGPSession() { -- 2.36.6