<artifactId>guava</artifactId>
<version>${guava.version}</version>
</dependency>
+ <!--
+ FIXME: this is in support of the generated code. This should not
+ be here, but the plugin should bring it in.
+ -->
+ <dependency>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>yang-binding</artifactId>
+ <version>0.5.7-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>yang-common</artifactId>
+ <version>0.5.7-SNAPSHOT</version>
+ </dependency>
+
+ <!--
+ FIXME: these are IETF models which are pre-generated in SAL infra.
+ This should not be here, but rather should somehow be
+ discovered by the plugin.
+ -->
+ <dependency>
+ <groupId>org.opendaylight.yangtools.model</groupId>
+ <artifactId>ietf-inet-types</artifactId>
+ <version>2010.09.24-SNAPSHOT</version>
+ </dependency>
</dependencies>
<build>
<plugins>
<plugin>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>yang-maven-plugin</artifactId>
+ <version>0.5.7-SNAPSHOT</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>generate-sources</goal>
+ </goals>
+ <configuration>
+ <yangFilesRootDir>src/main/yang</yangFilesRootDir>
+ <codeGenerators>
+ <generator>
+ <codeGeneratorClass>
+ org.opendaylight.yangtools.maven.sal.api.gen.plugin.CodeGeneratorImpl
+ </codeGeneratorClass>
+ <outputBaseDir>
+ target/generated-sources/sal
+ </outputBaseDir>
+ </generator>
+ </codeGenerators>
+ <inspectDependencies>true</inspectDependencies>
+ </configuration>
+ </execution>
+ </executions>
+ <dependencies>
+ <dependency>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>maven-sal-api-gen-plugin</artifactId>
+ <version>0.5.7-SNAPSHOT</version>
+ <type>jar</type>
+ </dependency>
+ </dependencies>
+ </plugin>
+ <plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>${maven.bundle.version}</version>
+++ /dev/null
-/*
- * 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;
-
-/**
- *
- * Values of BGP Origin Path Attribute.
- *
- */
-public enum BGPOrigin {
- IGP, EGP, INCOMPLETE
-}
package org.opendaylight.protocol.bgp.concepts;
import org.opendaylight.protocol.concepts.State;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.BgpOrigin;
+
import com.google.common.base.Objects;
import com.google.common.base.Objects.ToStringHelper;
private static final long serialVersionUID = 2371691093534458869L;
- private final BGPOrigin origin;
+ private final BgpOrigin origin;
private final BGPAggregator aggregator;
/**
* @param origin {@link BGPOrigin}
* @param aggregator {@link BGPAggregator}
*/
- public BaseBGPObjectState(final BGPOrigin origin, final BGPAggregator aggregator) {
+ public BaseBGPObjectState(final BgpOrigin origin, final BGPAggregator aggregator) {
super();
this.origin = origin;
this.aggregator = aggregator;
*
* @return the value of the ORIGIN attribute
*/
- public final BGPOrigin getOrigin() {
+ public final BgpOrigin getOrigin() {
return this.origin;
}
--- /dev/null
+module bgp-types {
+ yang-version 1;
+ namespace "urn:opendaylight:params:xml:ns:yang:bgp-types";
+ prefix "bgp-t";
+
+ import ietf-inet-types {
+ prefix inet;
+ revision-date 2010-09-24;
+ }
+
+ organization "Cisco Systems, Inc.";
+ contact "Dana Kutenicsova <dkutenic@cisco.com>";
+
+ description
+ "This module contains the base concepts contained in RFC4271 and RFC4760.
+
+ Copyright (c)2013 Cisco Systems, Inc. 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";
+
+ revision "2013-09-19" {
+ description
+ "Initial revision.";
+ reference "RFC4271, RFC4760";
+ }
+
+ typedef bgp-origin {
+ reference "http://tools.ietf.org/html/rfc4271#section-5";
+ description "Values of BGP Origin Path Attribute.";
+ type enumeration {
+ enum igp {
+ value 0;
+ }
+ enum egp {
+ value 1;
+ }
+ enum incomplete {
+ value 2;
+ }
+ }
+ }
+}
\ No newline at end of file
import static org.junit.Assert.fail;
import org.junit.Test;
-import org.opendaylight.protocol.bgp.concepts.BGPAddressFamily;
-import org.opendaylight.protocol.bgp.concepts.BGPOrigin;
-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.concepts.IPv6;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.BgpOrigin;
public class TableTypeTest {
@Test
public void testOrigin() {
- final BGPOrigin or = BGPOrigin.EGP;
- assertEquals(or.name(), "EGP");
+ final BgpOrigin or = BgpOrigin.Egp;
+ assertEquals(or.name(), "Egp");
}
@Test
public void testBaseBGPObjectState() {
- final BaseBGPObjectState state = new BaseBGPObjectState(BGPOrigin.INCOMPLETE, null);
- final BaseBGPObjectState state1 = new BaseBGPObjectState(BGPOrigin.INCOMPLETE, null);
+ final BaseBGPObjectState state = new BaseBGPObjectState(BgpOrigin.Incomplete, null);
+ final BaseBGPObjectState state1 = new BaseBGPObjectState(BgpOrigin.Incomplete, null);
assertNull(state.getAggregator());
- assertEquals(BGPOrigin.INCOMPLETE, state.getOrigin());
+ assertEquals(BgpOrigin.Incomplete, state.getOrigin());
assertEquals(state.toString(), state1.toString());
final BaseBGPObjectState s = new BaseBGPObjectState(state);
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
-
- <!--
- FIXME: this is in support of the generated code. This should not
- be here, but the plugin should bring it in.
- -->
- <dependency>
- <groupId>org.opendaylight.yangtools</groupId>
- <artifactId>yang-binding</artifactId>
- <version>${yangtools.version}</version>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.yangtools</groupId>
- <artifactId>yang-common</artifactId>
- <version>${yangtools.version}</version>
- </dependency>
-
- <!--
- FIXME: these are IETF models which are pre-generated in SAL infra.
- This should not be here, but rather should somehow be
- discovered by the plugin.
- -->
- <dependency>
- <groupId>org.opendaylight.yangtools.model</groupId>
- <artifactId>ietf-inet-types</artifactId>
- <version>2010.09.24-SNAPSHOT</version>
- </dependency>
- <!--dependency>
- <groupId>org.opendaylight.yangtools.model</groupId>
- <artifactId>ietf-yang-types</artifactId>
- <version>2010.09.24-SNAPSHOT</version>
- </dependency-->
</dependencies>
<build>
revision-date 2010-09-24;
}
+ import bgp-types { prefix bgp-t; }
+
organization "Cisco Systems, Inc.";
contact "Dana Kutenicsova <dkutenic@cisco.com>";
reference "RFC4271, RFC4893";
}
- typedef origin-value {
- reference "http://tools.ietf.org/html/rfc4271#section-5";
- type enumeration {
- enum igp {
- value 0;
- }
- enum egp {
- value 1;
- }
- enum incomplete {
- value 2;
- }
- }
- }
-
typedef protocol-version {
type uint8 {
range 1..7;
container origin {
reference "http://tools.ietf.org/html/rfc4271#section-5.1.1";
leaf value {
- type origin-value;
+ type bgp-t:bgp-origin;
mandatory true;
}
}
import org.junit.Test;
import org.opendaylight.protocol.bgp.concepts.BGPAddressFamily;
-import org.opendaylight.protocol.bgp.concepts.BGPOrigin;
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.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 com.google.common.collect.Maps;
import com.google.common.collect.Sets;
public class APITest {
- BaseBGPObjectState objState = new BaseBGPObjectState(BGPOrigin.EGP, null);
+ BaseBGPObjectState objState = new BaseBGPObjectState(BgpOrigin.Egp, null);
NetworkObjectState netObjState = new NetworkObjectState(null, Collections.<Community> emptySet(), Collections.<ExtendedCommunity> emptySet());
@Test
public void testAPI() {
final BGPRouteState<IPv4Address> route1 = new BGPRouteState<IPv4Address>(this.objState, new NetworkRouteState<IPv4Address>(new IPv4NextHop(IPv4.FAMILY.addressForString("192.168.5.4"))));
- final BGPRouteState<IPv4Address> route2 = new BGPRouteState<IPv4Address>(new BaseBGPObjectState(BGPOrigin.IGP, null), new NetworkRouteState<IPv4Address>(new IPv4NextHop(IPv4.FAMILY.addressForString("172.168.5.42"))));
+ final BGPRouteState<IPv4Address> route2 = new BGPRouteState<IPv4Address>(new BaseBGPObjectState(BgpOrigin.Igp, null), new NetworkRouteState<IPv4Address>(new IPv4NextHop(IPv4.FAMILY.addressForString("172.168.5.42"))));
assertEquals(route1, route1.newInstance());
assertNotSame(route1.hashCode(), new BGPRouteState<IPv4Address>(route2).hashCode());
assertEquals(route1.toString(), route1.toString());
assertNull(route1.getAggregator());
assertNotNull(route1.getObjectState().getNextHop());
- assertEquals(route1.getOrigin(), BGPOrigin.EGP);
+ assertEquals(route1.getOrigin(), BgpOrigin.Egp);
final BGPParsingException e = new BGPParsingException("Some error message.");
assertEquals("Some error message.", e.getError());
final NetworkPrefixState state = new NetworkPrefixState(this.netObjState, Sets.<RouteTag> newTreeSet(), null);
final BGPPrefixState ipv4 = new BGPPrefixState(this.objState, state);
- final BGPPrefixState ipv6 = new BGPPrefixState(new BaseBGPObjectState(BGPOrigin.EGP, null), state);
+ final BGPPrefixState ipv6 = new BGPPrefixState(new BaseBGPObjectState(BgpOrigin.Egp, null), state);
assertEquals(ipv4.toString(), ipv4.newInstance().toString());
assertNotSame(ipv4, new BGPPrefixState(ipv6));
import org.opendaylight.protocol.bgp.concepts.ASPath;
import org.opendaylight.protocol.bgp.concepts.BGPAggregator;
import org.opendaylight.protocol.bgp.concepts.BGPObject;
-import org.opendaylight.protocol.bgp.concepts.BGPOrigin;
import org.opendaylight.protocol.bgp.concepts.BaseBGPObjectState;
import org.opendaylight.protocol.bgp.concepts.Community;
import org.opendaylight.protocol.bgp.concepts.ExtendedCommunity;
import org.opendaylight.protocol.bgp.concepts.IPv4NextHop;
import org.opendaylight.protocol.bgp.concepts.IPv6NextHop;
+import org.opendaylight.protocol.bgp.linkstate.IPv4PrefixIdentifier;
+import org.opendaylight.protocol.bgp.linkstate.IPv6PrefixIdentifier;
+import org.opendaylight.protocol.bgp.linkstate.LinkIdentifier;
+import org.opendaylight.protocol.bgp.linkstate.NetworkLinkImpl;
+import org.opendaylight.protocol.bgp.linkstate.NetworkNodeImpl;
+import org.opendaylight.protocol.bgp.linkstate.NetworkObjectState;
+import org.opendaylight.protocol.bgp.linkstate.NetworkPrefixState;
+import org.opendaylight.protocol.bgp.linkstate.NetworkRouteState;
+import org.opendaylight.protocol.bgp.linkstate.NodeIdentifier;
import org.opendaylight.protocol.bgp.parser.BGPParsingException;
import org.opendaylight.protocol.bgp.parser.BGPUpdateEvent;
import org.opendaylight.protocol.bgp.parser.impl.message.BGPUpdateMessageParser;
import org.opendaylight.protocol.bgp.util.BGPIPv6RouteImpl;
import org.opendaylight.protocol.bgp.util.BGPLinkImpl;
import org.opendaylight.protocol.bgp.util.BGPNodeImpl;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
import org.opendaylight.protocol.concepts.IPv4Address;
import org.opendaylight.protocol.concepts.IPv6Address;
import org.opendaylight.protocol.concepts.Prefix;
-import org.opendaylight.protocol.bgp.linkstate.LinkIdentifier;
-import org.opendaylight.protocol.bgp.linkstate.NodeIdentifier;
-import org.opendaylight.protocol.bgp.linkstate.NetworkObjectState;
-import org.opendaylight.protocol.bgp.linkstate.NetworkPrefixState;
-import org.opendaylight.protocol.bgp.linkstate.NetworkRouteState;
-import org.opendaylight.protocol.bgp.linkstate.IPv4PrefixIdentifier;
-import org.opendaylight.protocol.bgp.linkstate.IPv6PrefixIdentifier;
-import org.opendaylight.protocol.bgp.linkstate.NetworkLinkImpl;
-import org.opendaylight.protocol.bgp.linkstate.NetworkNodeImpl;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.BgpOrigin;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
private Set<BGPObject> fillAddedObjects(final List<PathAttribute> pathAttributes, final Set<Prefix<IPv4Address>> nlri)
throws BGPParsingException {
- BGPOrigin origin = null;
+ BgpOrigin origin = null;
ASPath aspath = null;
IPv4NextHop nextHop = null;
BGPAggregator aggregator = null;
final Set<Community> comm = Sets.newHashSet();
final Map<Integer, ByteList> linkstate = Maps.newHashMap();
for (final PathAttribute pa : pathAttributes) {
- if (pa.getValue() instanceof BGPOrigin) {
- origin = (BGPOrigin) pa.getValue();
+ if (pa.getValue() instanceof BgpOrigin) {
+ origin = (BgpOrigin) pa.getValue();
} else if (pa.getValue() instanceof ASPath) {
aspath = (ASPath) pa.getValue();
} else if (pa.getValue() instanceof IPv4NextHop) {
import java.util.Map;
import java.util.Set;
-
import org.opendaylight.protocol.bgp.concepts.ASPath;
import org.opendaylight.protocol.bgp.concepts.BGPAggregator;
-import org.opendaylight.protocol.bgp.concepts.BGPOrigin;
import org.opendaylight.protocol.bgp.concepts.ClusterIdentifier;
import org.opendaylight.protocol.bgp.concepts.Community;
import org.opendaylight.protocol.bgp.concepts.ExtendedCommunity;
import org.opendaylight.protocol.bgp.parser.impl.PathAttribute;
import org.opendaylight.protocol.bgp.parser.impl.PathAttribute.TypeCode;
import org.opendaylight.protocol.bgp.parser.impl.message.update.AsPathSegmentParser.SegmentType;
-import org.opendaylight.protocol.util.ByteArray;
import org.opendaylight.protocol.concepts.ASNumber;
import org.opendaylight.protocol.concepts.IPv4Address;
import org.opendaylight.protocol.concepts.NetworkAddress;
+import org.opendaylight.protocol.util.ByteArray;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.BgpOrigin;
+
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import com.google.common.primitives.UnsignedBytes;
* @throws BGPParsingException if the Origin value is unknown
* @throws BGPDocumentedException
*/
- private static BGPOrigin parseOrigin(final byte[] bytes) throws BGPDocumentedException {
- final int value = UnsignedBytes.toInt(bytes[0]);
- BGPOrigin origin;
- switch (value) {
- case 0:
- origin = BGPOrigin.IGP;
- break;
- case 1:
- origin = BGPOrigin.EGP;
- break;
- case 2:
- origin = BGPOrigin.INCOMPLETE;
- break;
- default:
+ private static BgpOrigin parseOrigin(final byte[] bytes) throws BGPDocumentedException {
+ final BgpOrigin origin = BgpOrigin.forValue(UnsignedBytes.toInt(bytes[0]));
+ if (origin == null)
throw new BGPDocumentedException("Unknown Origin type.", BGPError.ORIGIN_ATTR_NOT_VALID, new byte[] { (byte) 0x01, (byte) 0x01,
bytes[0] });
- }
return origin;
}
import org.opendaylight.protocol.bgp.concepts.BGPAddressFamily;
import org.opendaylight.protocol.bgp.concepts.BGPAggregator;
import org.opendaylight.protocol.bgp.concepts.BGPObject;
-import org.opendaylight.protocol.bgp.concepts.BGPOrigin;
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.concepts.Metric;
import org.opendaylight.protocol.util.ByteArray;
import org.opendaylight.protocol.util.DefaultingTypesafeContainer;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.BgpOrigin;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
// final Set<IPv4Prefix> nlri = Sets.newHashSet(pref1, pref2, pref3);
// assertEquals(nlri, ret.getBgpUpdateMessageBuilder().getNlri());
- final BaseBGPObjectState state = new BaseBGPObjectState(BGPOrigin.IGP, null);
+ final BaseBGPObjectState state = new BaseBGPObjectState(BgpOrigin.Igp, null);
final NetworkRouteState<IPv4Address> routeState = new NetworkRouteState<>(new NetworkObjectState(asPath, comms, Collections.<ExtendedCommunity> emptySet()), nextHop);
// check API message
// TypeCode.CLUSTER_LIST, true, false, false, false, clusters);
// assertEquals(clusterAttr, attrs.get(4));
- final BaseBGPObjectState state = new BaseBGPObjectState(BGPOrigin.IGP, null);
+ final BaseBGPObjectState state = new BaseBGPObjectState(BgpOrigin.Igp, null);
final NetworkRouteState<IPv6Address> routeState = new NetworkRouteState<>(new NetworkObjectState(asPath, Collections.<Community> emptySet(), Collections.<ExtendedCommunity> emptySet()), nextHop);
// check API message
// final Set<IPv4Prefix> nlri = Sets.newHashSet(pref1);
// assertEquals(nlri, ret.getBgpUpdateMessageBuilder().getNlri());
- final BaseBGPObjectState state = new BaseBGPObjectState(BGPOrigin.INCOMPLETE, aggregator);
+ final BaseBGPObjectState state = new BaseBGPObjectState(BgpOrigin.Incomplete, aggregator);
final NetworkRouteState<IPv4Address> routeState = new NetworkRouteState<>(new NetworkObjectState(asPath, Collections.<Community> emptySet(), Collections.<ExtendedCommunity> emptySet()), nextHop);
// check API message
final IPv4NextHop nextHop = IPv4NextHop.forString("3.3.3.3");
final Set<ExtendedCommunity> comms = Sets.newHashSet((ExtendedCommunity) new Inet4SpecificExtendedCommunity(false, 4, IPv4.FAMILY.addressForString("192.168.1.0"), new byte[] {
- 0x12, 0x34 }));
+ 0x12, 0x34 }));
// check path attributes
// final Set<IPv4Prefix> nlri = Sets.newHashSet(pref1, pref2, pref3);
// assertEquals(nlri, ret.getBgpUpdateMessageBuilder().getNlri());
- final BaseBGPObjectState state = new BaseBGPObjectState(BGPOrigin.EGP, null);
+ final BaseBGPObjectState state = new BaseBGPObjectState(BgpOrigin.Egp, null);
final NetworkRouteState<IPv4Address> routeState = new NetworkRouteState<>(new NetworkObjectState(ASPath.EMPTY, Collections.<Community> emptySet(), comms), nextHop);
// check API message
// network object state
final NetworkObjectState objState = new NetworkObjectState(ASPath.EMPTY, Collections.<Community> emptySet(), Collections.<ExtendedCommunity> emptySet());
- final BaseBGPObjectState state = new BaseBGPObjectState(BGPOrigin.IGP, null);
+ final BaseBGPObjectState state = new BaseBGPObjectState(BgpOrigin.Igp, null);
// network link state
final DefaultingTypesafeContainer<Metric<?>> container = new DefaultingTypesafeContainer<Metric<?>>();
// network object state
final NetworkObjectState objState = new NetworkObjectState(ASPath.EMPTY, Collections.<Community> emptySet(), Collections.<ExtendedCommunity> emptySet());
- final BaseBGPObjectState state = new BaseBGPObjectState(BGPOrigin.IGP, null);
+ final BaseBGPObjectState state = new BaseBGPObjectState(BgpOrigin.Igp, null);
final NetworkNodeState nstate = new NetworkNodeState(objState, Collections.<TopologyIdentifier> emptySet(), Collections.<ISISAreaIdentifier> emptySet(), false, false, false, false, Collections.<RouterIdentifier> emptySet(), null);
// network link state
--- /dev/null
+/*
+ * 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.parser.impl;
+
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+import org.junit.Test;
+import org.opendaylight.protocol.bgp.parser.BGPDocumentedException;
+import org.opendaylight.protocol.bgp.parser.BGPParsingException;
+import org.opendaylight.protocol.bgp.parser.impl.message.update.PathAttributeParser;
+
+/*
+ * To test incorrect values.
+ */
+public class PathAttributeParserTest {
+
+ @Test
+ public void testOriginParser() {
+ try {
+ PathAttributeParser.parseAttribute(new byte[] { 0x40, 0x01, 0x01, 0x04 });
+ fail("This needs to fail.");
+ } catch (final BGPDocumentedException e) {
+ assertEquals("Unknown Origin type.", e.getMessage());
+ assertArrayEquals(new byte[] { 0x01, 0x01, 0x04 }, e.getData());
+ } catch (final BGPParsingException e) {
+ fail("This exception should not occur.");
+ }
+ }
+}
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.BGPOrigin;
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.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 com.google.common.collect.Lists;
import com.google.common.collect.Maps;
public void testGetUpdateMessage() throws DeserializerException, DocumentedException, IOException {
final Map<byte[], List<BGPMessage>> updateMap = Maps.newHashMap();
for (int i = 0; i < this.inputBytes.length; i++) {
- updateMap.put(this.inputBytes[i], Lists.newArrayList((BGPMessage)this.messages.get(i)));
+ updateMap.put(this.inputBytes[i], Lists.newArrayList((BGPMessage) this.messages.get(i)));
}
final BGPMessageParserMock mockParser = new BGPMessageParserMock(updateMap);
public void testGetUpdateMessageException() throws DeserializerException, DocumentedException, IOException {
final Map<byte[], List<BGPMessage>> updateMap = Maps.newHashMap();
for (int i = 0; i < this.inputBytes.length; i++) {
- updateMap.put(this.inputBytes[i], Lists.newArrayList((BGPMessage)this.messages.get(i)));
+ updateMap.put(this.inputBytes[i], Lists.newArrayList((BGPMessage) this.messages.get(i)));
}
final BGPMessageParserMock mockParser = new BGPMessageParserMock(updateMap);
final Set<BGPObject> addedObjects = new HashSet<BGPObject>();
final NetworkRouteState<IPv6Address> nstate = new NetworkRouteState<>(new NetworkObjectState(asPath, Collections.<Community> emptySet(), Collections.<ExtendedCommunity> emptySet()), nextHop);
- final BaseBGPObjectState state = new BaseBGPObjectState(BGPOrigin.IGP, null);
+ final BaseBGPObjectState state = new BaseBGPObjectState(BgpOrigin.Igp, null);
final BGPRoute<IPv6Address> route1 = new BGPIPv6RouteImpl(pref1, state, nstate);
final BGPRoute<IPv6Address> route2 = new BGPIPv6RouteImpl(pref2, state, nstate);
final byte[] input = new byte[] { 5, 8, 13, 21 };
- openMap.put(input, Lists.newArrayList((BGPMessage)new BGPOpenMessage(new ASNumber(30), (short) 30, null, params)));
+ openMap.put(input, Lists.newArrayList((BGPMessage) new BGPOpenMessage(new ASNumber(30), (short) 30, null, params)));
final BGPMessageParserMock mockParser = new BGPMessageParserMock(openMap);
*/
package org.opendaylight.protocol.bgp.util;
-import org.opendaylight.protocol.bgp.concepts.BGPAggregator;
-import org.opendaylight.protocol.bgp.concepts.BGPOrigin;
import org.opendaylight.protocol.bgp.concepts.BaseBGPObjectState;
+import org.opendaylight.protocol.bgp.linkstate.NetworkNodeState;
+import org.opendaylight.protocol.bgp.linkstate.NodeIdentifier;
import org.opendaylight.protocol.bgp.parser.BGPNode;
import org.opendaylight.protocol.bgp.parser.BGPNodeState;
-import org.opendaylight.protocol.bgp.linkstate.NodeIdentifier;
-import org.opendaylight.protocol.bgp.linkstate.NetworkNode;
-import org.opendaylight.protocol.bgp.linkstate.NetworkNodeState;
import com.google.common.base.Objects.ToStringHelper;
/**
/**
* Creates this object with given arguments.
*
- * @param origin {@link BGPOrigin}
- * @param aggregator {@link BGPAggregator}
* @param nodeIdentifier {@link NodeIdentifier}
- * @param nodeAttributes {@link NetworkNode}
+ * @param nodeState {@link NetworkNodeState}
*/
public BGPNodeImpl(final BaseBGPObjectState base, final NodeIdentifier nodeIdentifier, final NetworkNodeState nodeState) {
super(new BGPNodeState(base, nodeState));
import java.util.Collections;
import org.junit.Test;
-
-import org.opendaylight.protocol.concepts.Metric;
+import org.opendaylight.protocol.bgp.concepts.BaseBGPObjectState;
+import org.opendaylight.protocol.bgp.concepts.Community;
+import org.opendaylight.protocol.bgp.concepts.ExtendedCommunity;
import org.opendaylight.protocol.bgp.linkstate.LinkIdentifier;
import org.opendaylight.protocol.bgp.linkstate.LinkProtectionType;
-import org.opendaylight.protocol.bgp.linkstate.TopologyIdentifier;
import org.opendaylight.protocol.bgp.linkstate.NetworkLinkState;
import org.opendaylight.protocol.bgp.linkstate.NetworkObjectState;
-
-import org.opendaylight.protocol.bgp.concepts.BGPOrigin;
-import org.opendaylight.protocol.bgp.concepts.BaseBGPObjectState;
-import org.opendaylight.protocol.bgp.concepts.Community;
-import org.opendaylight.protocol.bgp.concepts.ExtendedCommunity;
-import org.opendaylight.protocol.bgp.util.BGPLinkImpl;
+import org.opendaylight.protocol.bgp.linkstate.TopologyIdentifier;
+import org.opendaylight.protocol.concepts.Metric;
import org.opendaylight.protocol.util.DefaultingTypesafeContainer;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.BgpOrigin;
public class LinkTest {
@Test
public void testLinkImpl() {
- final BaseBGPObjectState state1 = new BaseBGPObjectState(BGPOrigin.EGP, null);
+ final BaseBGPObjectState state1 = new BaseBGPObjectState(BgpOrigin.Egp, null);
final NetworkObjectState empty = new NetworkObjectState(null, Collections.<Community> emptySet(), Collections.<ExtendedCommunity> emptySet());
final NetworkLinkState nstate1 = new NetworkLinkState(empty, new DefaultingTypesafeContainer<Metric<?>>(), null, LinkProtectionType.UNPROTECTED, null, null, null);
import static org.junit.Assert.assertNull;
import org.junit.Test;
-import org.opendaylight.protocol.bgp.concepts.BGPOrigin;
import org.opendaylight.protocol.bgp.concepts.BaseBGPObjectState;
-import org.opendaylight.protocol.bgp.util.BGPNodeImpl;
-
import org.opendaylight.protocol.bgp.linkstate.NetworkNodeState;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.BgpOrigin;
public class NodeTest {
@Test
public void testNodeImpl() {
- final BGPNodeImpl node1 = new BGPNodeImpl(new BaseBGPObjectState(BGPOrigin.INCOMPLETE, null), null, NetworkNodeState.EMPTY);
- final BGPNodeImpl node2 = new BGPNodeImpl(new BaseBGPObjectState(BGPOrigin.EGP, null), null, NetworkNodeState.EMPTY);
+ final BGPNodeImpl node1 = new BGPNodeImpl(new BaseBGPObjectState(BgpOrigin.Incomplete, null), null, NetworkNodeState.EMPTY);
+ final BGPNodeImpl node2 = new BGPNodeImpl(new BaseBGPObjectState(BgpOrigin.Egp, null), null, NetworkNodeState.EMPTY);
assertFalse(node1.equals(node2));
assertNotSame(node1.hashCode(), node2.hashCode());
assertEquals(node1.toString(), node1.toString());
assertNull(node1.currentState().getAggregator());
- assertEquals(node1.currentState().getOrigin(), BGPOrigin.INCOMPLETE);
+ assertEquals(node1.currentState().getOrigin(), BgpOrigin.Incomplete);
assertEquals(node1.getNodeIdentifier(), node2.getNodeIdentifier());
- assertEquals(node2, new BGPNodeImpl(new BaseBGPObjectState(BGPOrigin.EGP, null), null, NetworkNodeState.EMPTY));
+ assertEquals(node2, new BGPNodeImpl(new BaseBGPObjectState(BgpOrigin.Egp, null), null, NetworkNodeState.EMPTY));
}
}
import org.junit.Test;
import org.opendaylight.protocol.bgp.concepts.ASPath;
-import org.opendaylight.protocol.bgp.concepts.BGPOrigin;
import org.opendaylight.protocol.bgp.concepts.BaseBGPObjectState;
import org.opendaylight.protocol.bgp.concepts.Community;
import org.opendaylight.protocol.bgp.concepts.ExtendedCommunity;
-import org.opendaylight.protocol.bgp.util.BGPIPv4PrefixImpl;
-import org.opendaylight.protocol.bgp.util.BGPIPv6PrefixImpl;
-
-import org.opendaylight.protocol.concepts.ASNumber;
-import org.opendaylight.protocol.concepts.IPv4;
-import org.opendaylight.protocol.concepts.IPv6;
+import org.opendaylight.protocol.bgp.linkstate.IPv4PrefixIdentifier;
+import org.opendaylight.protocol.bgp.linkstate.IPv6PrefixIdentifier;
+import org.opendaylight.protocol.bgp.linkstate.NetworkObjectState;
+import org.opendaylight.protocol.bgp.linkstate.NetworkPrefixState;
import org.opendaylight.protocol.bgp.linkstate.NodeIdentifier;
import org.opendaylight.protocol.bgp.linkstate.OSPFRouterIdentifier;
import org.opendaylight.protocol.bgp.linkstate.RouteTag;
-import org.opendaylight.protocol.bgp.linkstate.NetworkObjectState;
-import org.opendaylight.protocol.bgp.linkstate.NetworkPrefixState;
-import org.opendaylight.protocol.bgp.linkstate.IPv4PrefixIdentifier;
-import org.opendaylight.protocol.bgp.linkstate.IPv6PrefixIdentifier;
+import org.opendaylight.protocol.concepts.ASNumber;
+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.BgpOrigin;
+
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
public class PrefixTest {
- final BaseBGPObjectState base = new BaseBGPObjectState(BGPOrigin.EGP, null);
+ final BaseBGPObjectState base = new BaseBGPObjectState(BgpOrigin.Egp, null);
final NetworkObjectState state = new NetworkObjectState(new ASPath(Lists.newArrayList(new ASNumber(10L))), Collections.<Community> emptySet(), Collections.<ExtendedCommunity> emptySet());
final NetworkPrefixState prefixState = new NetworkPrefixState(this.state, Sets.<RouteTag> newTreeSet(), null);
import static org.junit.Assert.assertNotSame;
import org.junit.Test;
-import org.opendaylight.protocol.bgp.concepts.BGPOrigin;
import org.opendaylight.protocol.bgp.concepts.BaseBGPObjectState;
import org.opendaylight.protocol.bgp.concepts.IPv4NextHop;
import org.opendaylight.protocol.bgp.concepts.IPv6NextHop;
-import org.opendaylight.protocol.bgp.util.BGPIPv4RouteImpl;
-import org.opendaylight.protocol.bgp.util.BGPIPv6RouteImpl;
-
+import org.opendaylight.protocol.bgp.linkstate.NetworkRouteState;
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.bgp.linkstate.NetworkRouteState;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.BgpOrigin;
public class RouteTest {
- BaseBGPObjectState base = new BaseBGPObjectState(BGPOrigin.EGP, null);
+ BaseBGPObjectState base = new BaseBGPObjectState(BgpOrigin.Egp, null);
final NetworkRouteState<IPv4Address> prefix4State = new NetworkRouteState<>(IPv4NextHop.forString("128.54.8.9"));
final NetworkRouteState<IPv6Address> prefix6State = new NetworkRouteState<>(IPv6NextHop.forString("2001::4"));
final BGPIPv4RouteImpl r4 = new BGPIPv4RouteImpl(IPv4.FAMILY.prefixForString("172.168.4.6/24"), this.base, this.prefix4State);