Change BGP to use bgp-id type and as-number type 00/41800/3
authorKevin Wang <kevixw@gmail.com>
Thu, 14 Jul 2016 02:37:12 +0000 (19:37 -0700)
committerMilos Fabian <milfabia@cisco.com>
Fri, 15 Jul 2016 08:54:11 +0000 (08:54 +0000)
- Remove util converting inet-10 version to inet-13 yang
- Change BGP yang to use bgp-id and as-number wherever these two types are used

Change-Id: I7550de5c15fdcba26113d1b151d920d0b212b2be
Signed-off-by: Kevin Wang <kevixw@gmail.com>
29 files changed:
bgp/openconfig-impl/src/main/java/org/opendaylight/protocol/bgp/openconfig/impl/moduleconfig/BGPPeerProvider.java
bgp/openconfig-impl/src/main/java/org/opendaylight/protocol/bgp/openconfig/impl/moduleconfig/BGPRibImplProvider.java
bgp/openconfig-impl/src/test/java/org/opendaylight/protocol/bgp/openconfig/impl/openconfig/BGPAppNeighborProviderImplTest.java
bgp/openconfig-impl/src/test/java/org/opendaylight/protocol/bgp/openconfig/impl/openconfig/BGPGlobalProviderImplTest.java
bgp/openconfig-spi/src/main/java/org/opendaylight/protocol/bgp/openconfig/spi/pojo/BGPAppPeerInstanceConfiguration.java
bgp/openconfig-spi/src/main/java/org/opendaylight/protocol/bgp/openconfig/spi/pojo/BGPRibInstanceConfiguration.java
bgp/openconfig-spi/src/test/java/org/opendaylight/protocol/bgp/openconfig/spi/pojo/BGPAppPeerInstanceConfigurationTest.java
bgp/openconfig-spi/src/test/java/org/opendaylight/protocol/bgp/openconfig/spi/pojo/BGPRibInstanceConfigurationTest.java
bgp/rib-impl/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/BGPApplicationPeerModule.java
bgp/rib-impl/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/BGPPeerModule.java
bgp/rib-impl/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/RIBImplModule.java
bgp/rib-impl/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/Rev130715Util.java [deleted file]
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/BGPSessionStats.java
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/RIBImpl.java
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/StrictBGPPeerRegistry.java
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/spi/BGPSessionPreferences.java
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/spi/RIB.java
bgp/rib-impl/src/main/yang/bgp-peer.yang
bgp/rib-impl/src/main/yang/bgp-rib-impl.yang
bgp/rib-impl/src/main/yang/bgp-stats-peer.yang
bgp/rib-impl/src/test/java/org/opendaylight/controller/config/yang/bgp/rib/impl/AbstractRIBImplModuleTest.java
bgp/rib-impl/src/test/java/org/opendaylight/controller/config/yang/bgp/rib/impl/RIBImplModuleTest.java
bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/AbstractRIBTestSetup.java
bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/BGPDispatcherImplTest.java
bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/BGPSessionImplTest.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/ParserToSalTest.java
bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/StrictBGPPeerRegistryTest.java
bgp/testtool/src/main/java/org/opendaylight/protocol/bgp/testtool/BGPPeerBuilder.java

index 8671f86e945b1d1719496bdde6bb9fe82033c84f..607fb46205068fabdf21bdc6102e90a12125377b 100644 (file)
@@ -225,7 +225,7 @@ final class BGPPeerProvider {
                 bgpPeerBuilder.setPassword(new Rfc2385Key(neighbor.getConfig().getAuthPassword()));
             }
             if (neighbor.getConfig().getPeerAs() != null) {
-                bgpPeerBuilder.setRemoteAs(neighbor.getConfig().getPeerAs().getValue());
+                bgpPeerBuilder.setRemoteAs(neighbor.getConfig().getPeerAs());
             }
             if (neighbor.getConfig().getPeerType() != null) {
                 bgpPeerBuilder.setPeerRole(toPeerRole(neighbor));
index 7313224532b062e05c3d7ba8fcc42068f7e64a52..127675a20683d882de702b11e64eb4ca70347dfd 100644 (file)
@@ -21,7 +21,6 @@ import org.opendaylight.protocol.bgp.openconfig.impl.util.GlobalIdentifier;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.top.Bgp;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.top.BgpBuilder;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.top.bgp.Global;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.BgpId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.bgp.rib.impl.rev160330.BgpPathSelectionMode;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.bgp.rib.impl.rev160330.BgpTableType;
@@ -114,8 +113,8 @@ final class BGPRibImplProvider {
         final RibImpl ribImpl = (RibImpl) module.getConfiguration();
         final RibImplBuilder ribImplBuilder = new RibImplBuilder();
         if (globalConfig.getConfig() != null) {
-            ribImplBuilder.setBgpRibId(new BgpId(new Ipv4Address(globalConfig.getConfig().getRouterId().getValue())));
-            ribImplBuilder.setLocalAs(globalConfig.getConfig().getAs().getValue());
+            ribImplBuilder.setBgpRibId(new BgpId(globalConfig.getConfig().getRouterId()));
+            ribImplBuilder.setLocalAs(globalConfig.getConfig().getAs());
         }
         ribImplBuilder.setLocalTable(tableTypes);
         ribImplBuilder.setBgpDispatcher(ribImpl.getBgpDispatcher());
index 2039097a2a9c096ac11e7508319f209884140236..347fecb0c05f46066aef7ea3de1b1b1c2b5ee70f 100644 (file)
@@ -26,6 +26,7 @@ import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.n
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbors.NeighborKey;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.BgpId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.bgp.rib.impl.rev160330.BgpApplicationPeer;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.rev130405.modules.ModuleKey;
 
@@ -55,7 +56,7 @@ public class BGPAppNeighborProviderImplTest {
 
     @Test
     public void testApply() {
-        final Neighbor neighbor = neighborProvider.apply(new BGPAppPeerInstanceConfiguration(new InstanceConfigurationIdentifier("instanceName"), "app-rib", new Ipv4Address("1.2.3.4")));
+        final Neighbor neighbor = neighborProvider.apply(new BGPAppPeerInstanceConfiguration(new InstanceConfigurationIdentifier("instanceName"), "app-rib", new BgpId("1.2.3.4")));
         final Neighbor expectedNeighbor = new NeighborBuilder()
             .setNeighborAddress(new IpAddress(new Ipv4Address("1.2.3.4")))
             .setKey(new NeighborKey(new IpAddress(new Ipv4Address("1.2.3.4"))))
index 4c5ba13e05d319ee4c6252004f10a091d78261c1..c0a63ceadaa35d710f3b2ac7c1355f88f571c347 100644 (file)
@@ -33,11 +33,11 @@ import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.t
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.top.bgp.NeighborsBuilder;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.top.bgp.PeerGroupsBuilder;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev150210.LinkstateAddressFamily;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev150210.LinkstateSubsequentAddressFamily;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.BgpTableType;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev160614.LINKSTATE;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.BgpId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.bgp.rib.impl.rev160330.RibImpl;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.rev130405.modules.ModuleKey;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
@@ -64,7 +64,7 @@ public class BGPGlobalProviderImplTest {
     @Test
     public void testApply() {
         final Bgp bgp = this.globalProvider.apply(new BGPRibInstanceConfiguration(new InstanceConfigurationIdentifier("instanceName"), new AsNumber(1L),
-                new Ipv4Address("1.2.3.4"), null,
+                new BgpId("1.2.3.4"), null,
                 Lists.<BgpTableType>newArrayList(new BgpTableTypeImpl(LinkstateAddressFamily.class, LinkstateSubsequentAddressFamily.class)), Collections.emptyMap()));
         final BgpBuilder bgpBuilder = new BgpBuilder();
         bgpBuilder.setNeighbors(new NeighborsBuilder().build());
@@ -73,7 +73,7 @@ public class BGPGlobalProviderImplTest {
         final Global global = new GlobalBuilder()
             .setAfiSafis(
                     new AfiSafisBuilder().setAfiSafi(Collections.singletonList(new AfiSafiBuilder().setAfiSafiName(LINKSTATE.class).build())).build())
-            .setConfig(new ConfigBuilder().setRouterId(new Ipv4Address("1.2.3.4")).setAs(new AsNumber(1L)).build())
+            .setConfig(new ConfigBuilder().setRouterId(new BgpId("1.2.3.4")).setAs(new AsNumber(1L)).build())
             .build();
         bgpBuilder.setGlobal(global);
         assertEquals(bgpBuilder.build(), bgp);
index a8c375b496c889fb5ee8515dad445dad6ab119a9..f90189bcd92f24cb7cab65147b2fe45cd744e7dd 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.protocol.bgp.openconfig.spi.pojo;
 import com.google.common.base.Preconditions;
 import org.opendaylight.protocol.bgp.openconfig.spi.InstanceConfigurationIdentifier;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.BgpId;
 
 /**
  * POJO for holding BGP Application Peer module instance configuration
@@ -19,9 +20,9 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.
 public final class BGPAppPeerInstanceConfiguration extends AbstractInstanceConfiguration {
 
     private final String appRibId;
-    private final Ipv4Address bgpId;
+    private final BgpId bgpId;
 
-    public BGPAppPeerInstanceConfiguration(final InstanceConfigurationIdentifier instanceName, final String appRibId, final Ipv4Address bgpId) {
+    public BGPAppPeerInstanceConfiguration(final InstanceConfigurationIdentifier instanceName, final String appRibId, final BgpId bgpId) {
         super(instanceName);
         this.appRibId = Preconditions.checkNotNull(appRibId);
         this.bgpId = Preconditions.checkNotNull(bgpId);
index e4e24a6a1775910e4d5f8bd29126da5e71345390..a3b00e454d443fa36b95d26449da5a07b4ad9687 100644 (file)
@@ -15,9 +15,10 @@ import java.util.Map;
 import org.opendaylight.protocol.bgp.mode.api.PathSelectionMode;
 import org.opendaylight.protocol.bgp.openconfig.spi.InstanceConfigurationIdentifier;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.BgpTableType;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.rib.TablesKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.BgpId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.ClusterIdentifier;
 
 /**
  * POJO for holding BGP RIB module instance configuration
@@ -26,13 +27,13 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.
 public final class BGPRibInstanceConfiguration extends AbstractInstanceConfiguration {
 
     private final AsNumber localAs;
-    private final Ipv4Address bgpRibId;
-    private final Ipv4Address clusterId;
+    private final BgpId bgpRibId;
+    private final ClusterIdentifier clusterId;
     private final List<BgpTableType> tableTypes;
     private final Map<TablesKey, PathSelectionMode> pathSelectionModes;
 
-    public BGPRibInstanceConfiguration(final InstanceConfigurationIdentifier identifier, final AsNumber localAs, final Ipv4Address bgpRibId,
-            final Ipv4Address clusterId, final List<BgpTableType> tableTypes, final Map<TablesKey, PathSelectionMode> pathSelectionModes) {
+    public BGPRibInstanceConfiguration(final InstanceConfigurationIdentifier identifier, final AsNumber localAs, final BgpId bgpRibId,
+            final ClusterIdentifier clusterId, final List<BgpTableType> tableTypes, final Map<TablesKey, PathSelectionMode> pathSelectionModes) {
         super(identifier);
         this.pathSelectionModes = pathSelectionModes;
         this.localAs = Preconditions.checkNotNull(localAs);
@@ -45,11 +46,11 @@ public final class BGPRibInstanceConfiguration extends AbstractInstanceConfigura
         return localAs;
     }
 
-    public Ipv4Address getBgpRibId() {
+    public BgpId getBgpRibId() {
         return bgpRibId;
     }
 
-    public Optional<Ipv4Address> getClusterId() {
+    public Optional<ClusterIdentifier> getClusterId() {
         return Optional.fromNullable(clusterId);
     }
 
index a234c1874f4d92f649e1f6c05a65724e33c526d6..364894e7998234601c0e9945763c71316547678d 100644 (file)
@@ -8,17 +8,17 @@
 
 package org.opendaylight.protocol.bgp.openconfig.spi.pojo;
 
-import static org.junit.Assert.assertEquals;
-
 import org.junit.Test;
 import org.opendaylight.protocol.bgp.openconfig.spi.InstanceConfigurationIdentifier;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.BgpId;
+
+import static org.junit.Assert.assertEquals;
 
 public class BGPAppPeerInstanceConfigurationTest {
 
     private static final InstanceConfigurationIdentifier INSTANCE_NAME = new InstanceConfigurationIdentifier("instanceName");
     private static final String RIB_ID = "ribId";
-    private static final Ipv4Address BGP_ID = new Ipv4Address("127.0.0.1");
+    private static final BgpId BGP_ID = new BgpId("127.0.0.1");
 
     private final BGPAppPeerInstanceConfiguration config = new BGPAppPeerInstanceConfiguration(INSTANCE_NAME, RIB_ID, BGP_ID);
 
index 1272cb6680335a129533729d7395bf6c4d337c0a..c40381710bb62810776f82687311cc5358155c5d 100644 (file)
@@ -15,15 +15,14 @@ import java.util.Collections;
 import org.junit.Test;
 import org.opendaylight.protocol.bgp.openconfig.spi.InstanceConfigurationIdentifier;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
-
-;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.BgpId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.ClusterIdentifier;
 
 public class BGPRibInstanceConfigurationTest {
 
     private static final InstanceConfigurationIdentifier INSTANCE_NAME = new InstanceConfigurationIdentifier("instanceName");
-    private static final Ipv4Address BGP_ID = new Ipv4Address("127.0.0.1");
-    private static final Ipv4Address CLUSTER_ID = new Ipv4Address("127.0.0.2");
+    private static final BgpId BGP_ID = new BgpId("127.0.0.1");
+    private static final ClusterIdentifier CLUSTER_ID = new ClusterIdentifier("127.0.0.2");
     private static final AsNumber AS_NUMBER = new AsNumber(72L);
 
     private final BGPRibInstanceConfiguration config = new BGPRibInstanceConfiguration(INSTANCE_NAME, AS_NUMBER, BGP_ID, CLUSTER_ID,
index 6a4237b765b8ec91ddc7e67bdf2efe4b9487909a..cb5948fedd6433a1ad6fd4384701f43359298119 100755 (executable)
@@ -117,7 +117,7 @@ public class BGPApplicationPeerModule extends org.opendaylight.controller.config
             }
             final InstanceConfigurationIdentifier identifier = new InstanceConfigurationIdentifier(getIdentifier().getInstanceName());
             this.bgpAppPeerInstanceConfiguration = new BGPAppPeerInstanceConfiguration(identifier, getApplicationRibId().getValue(),
-                    Rev130715Util.getIpv4Address(getBgpPeerId()));
+                    getBgpPeerId());
         }
 
         @Override
index b29a4c9a2d74774ff4bd0fce2d11be4767240506..06cf2986053bd1fda73f9c3e61daf8f5ac1007d5 100755 (executable)
@@ -43,6 +43,7 @@ import org.opendaylight.protocol.concepts.KeyMapping;
 import org.opendaylight.protocol.util.Ipv6Util;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.open.message.BgpParameters;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.open.message.BgpParametersBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.open.message.bgp.parameters.OptionalCapabilities;
@@ -257,9 +258,9 @@ public final class BGPPeerModule extends org.opendaylight.controller.config.yang
                 this.neighborProvider = null;
             }
             final InstanceConfigurationIdentifier identifier = new InstanceConfigurationIdentifier(getIdentifier().getInstanceName());
-            this.bgpPeerInstanceConfiguration = new BGPPeerInstanceConfiguration(identifier, Rev130715Util.getIpvAddress(getNormalizedHost()),
-                    Rev130715Util.getPort(getPort().getValue()), getHoldtimer(), getPeerRole(), getInitiateConnection(),
-                        getAdvertizedTableDependency(), Rev130715Util.getASNumber(getAsOrDefault(getRibDependency()).getValue()),
+            this.bgpPeerInstanceConfiguration = new BGPPeerInstanceConfiguration(identifier, getNormalizedHost(),
+                        getPort(), getHoldtimer(), getPeerRole(), getInitiateConnection(),
+                        getAdvertizedTableDependency(), getAsOrDefault(getRibDependency()),
                         getOptionalPassword(getPassword()), getAddPathDependency());
         }
 
index c385ed0bb9c26627294fb414a17c674d90a80001..f0c2d067a6141ca1c94e8ff64b839805a41d32b6 100755 (executable)
@@ -31,8 +31,6 @@ import org.opendaylight.protocol.bgp.openconfig.spi.InstanceConfigurationIdentif
 import org.opendaylight.protocol.bgp.openconfig.spi.pojo.BGPRibInstanceConfiguration;
 import org.opendaylight.protocol.bgp.rib.impl.RIBImpl;
 import org.opendaylight.protocol.bgp.rib.impl.spi.BGPBestPathSelection;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.BgpTableType;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.rib.TablesKey;
 import org.opendaylight.yangtools.sal.binding.generator.impl.GeneratedClassLoadingStrategy;
@@ -69,11 +67,9 @@ public final class RIBImplModule extends org.opendaylight.controller.config.yang
 
     @Override
     public java.lang.AutoCloseable createInstance() {
-        final AsNumber asNumber = new AsNumber(getLocalAs());
         final Map<TablesKey, PathSelectionMode> pathSelectionStrategies = mapBestPathSelectionStrategyByFamily(getRibPathSelectionModeDependency());
-        final RIBImpl rib = new RIBImpl(getRibId(), asNumber, getBgpRibId(), getClusterId(), getExtensionsDependency(),
-            getBgpDispatcherDependency(), getCodecTreeFactoryDependency(),
-            getDataProviderDependency(), getDomDataProviderDependency(), getLocalTableDependency(), pathSelectionStrategies, classLoadingStrategy(),
+        final RIBImpl rib = new RIBImpl(getRibId(), getLocalAs(), getBgpRibId(), getClusterId(), getExtensionsDependency(),
+            getBgpDispatcherDependency(), getCodecTreeFactoryDependency(), getDataProviderDependency(), getDomDataProviderDependency(), getLocalTableDependency(), pathSelectionStrategies, classLoadingStrategy(),
             new RIBImplModuleTracker(getGlobalWriter()), getOpenconfigProviderDependency());
         registerSchemaContextListener(rib);
         return rib;
@@ -119,10 +115,7 @@ public final class RIBImplModule extends org.opendaylight.controller.config.yang
             this.globalWriter = globalWriter;
             final InstanceConfigurationIdentifier identifier = new InstanceConfigurationIdentifier(getIdentifier().getInstanceName());
             final List<BgpTableType> tableDependency = getLocalTableDependency();
-            final org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber as = Rev130715Util.getASNumber(getLocalAs());
-            final Ipv4Address bgpRibId = Rev130715Util.getIpv4Address(getBgpRibId());
-            final Ipv4Address clusterId = Rev130715Util.getIpv4Address(getClusterId());
-            this.bgpRibConfig = new BGPRibInstanceConfiguration(identifier, as, bgpRibId, clusterId, tableDependency,
+            this.bgpRibConfig = new BGPRibInstanceConfiguration(identifier, getLocalAs(), getBgpRibId(), getClusterId(), tableDependency,
                     mapBestPathSelectionStrategyByFamily(getRibPathSelectionModeDependency()));
         }
 
diff --git a/bgp/rib-impl/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/Rev130715Util.java b/bgp/rib-impl/src/main/java/org/opendaylight/controller/config/yang/bgp/rib/impl/Rev130715Util.java
deleted file mode 100644 (file)
index 434148d..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2015 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.controller.config.yang.bgp.rib.impl;
-
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber;
-
-public  final class Rev130715Util {
-    private Rev130715Util() {
-        throw new UnsupportedOperationException();
-    }
-
-    public static Ipv4Address getIpv4Address(final org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address ipv4) {
-        if(ipv4 == null) {
-            return null;
-        }
-        return new Ipv4Address(ipv4.getValue());
-    }
-
-    public static org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber getASNumber(final Long localAs) {
-        return new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber(localAs);
-    }
-
-    public static PortNumber getPort(final Integer port) {
-        return new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber(port);
-    }
-
-    public static IpAddress getIpvAddress(final org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress hostWithoutValue) {
-        if(hostWithoutValue.getIpv4Address() != null) {
-            return new IpAddress(new Ipv4Address(hostWithoutValue.getIpv4Address().getValue()));
-        }
-        return new IpAddress(new Ipv6Address(hostWithoutValue.getIpv6Address().getValue()));
-    }
-}
index b43c4391ef1c0d8a9be37873ddb122e91f93d678..8878b56899c652cbb39af2b3f370b4037e7287ba 100644 (file)
@@ -39,6 +39,7 @@ import org.opendaylight.controller.config.yang.bgp.rib.impl.UpdateMsgs;
 import org.opendaylight.protocol.bgp.rib.impl.BGPSessionImpl.State;
 import org.opendaylight.protocol.bgp.rib.impl.spi.BGPSessionPreferences;
 import org.opendaylight.protocol.util.StatisticsUtil;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressBuilder;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Timestamp;
@@ -251,7 +252,7 @@ public final class BGPSessionStats {
         if (localPreferences.isPresent()) {
             final BGPSessionPreferences localPref = localPreferences.get();
             pref.setBgpId(new BgpId(localPref.getBgpId().getValue()));
-            pref.setAs(localPref.getMyAs().getValue());
+            pref.setAs(localPref.getMyAs());
             pref.setHoldtimer(localPref.getHoldTime());
             if (localPref.getParams() != null) {
                 for (final BgpParameters param : localPref.getParams()) {
@@ -299,8 +300,8 @@ public final class BGPSessionStats {
         final InetSocketAddress isa = (InetSocketAddress) channel.remoteAddress();
         pref.setHost(IpAddressBuilder.getDefaultInstance(isa.getAddress().getHostAddress()));
         pref.setPort(new PortNumber(isa.getPort()));
-        pref.setBgpId(new BgpId(remoteOpen.getBgpIdentifier().getValue()));
-        pref.setAs(remoteOpen.getMyAsNumber().longValue());
+        pref.setBgpId(new BgpId(remoteOpen.getBgpIdentifier()));
+        pref.setAs(new AsNumber(remoteOpen.getMyAsNumber().longValue()));
         pref.setHoldtimer(remoteOpen.getHoldTimer());
 
         final List<AdvertizedTableTypes> tt = tableTypes.stream().map(BGPSessionStats::addTableType).collect(Collectors.toList());
index 2de279beee199d5794d3f23c39ce68e06310548b..91018671d737942c2cbcbc9d30054c82d3238b7f 100755 (executable)
@@ -61,6 +61,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.rib.Tables;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.rib.TablesKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.rib.tables.Routes;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.BgpId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.ClusterIdentifier;
 import org.opendaylight.yangtools.binding.data.codec.api.BindingCodecTreeFactory;
 import org.opendaylight.yangtools.sal.binding.generator.impl.GeneratedClassLoadingStrategy;
@@ -92,7 +93,7 @@ public final class RIBImpl extends DefaultRibReference implements AutoCloseable,
     private final BGPDispatcher dispatcher;
     private final DOMTransactionChain domChain;
     private final AsNumber localAs;
-    private final Ipv4Address bgpIdentifier;
+    private final BgpId bgpIdentifier;
     private final Set<BgpTableType> localTables;
     private final Set<TablesKey> localTablesKeys;
     private final DataBroker dataBroker;
@@ -109,7 +110,7 @@ public final class RIBImpl extends DefaultRibReference implements AutoCloseable,
     private final Map<TablesKey, PathSelectionMode> bestPathSelectionStrategies;
     private final ImportPolicyPeerTracker importPolicyPeerTracker;
 
-    public RIBImpl(final RibId ribId, final AsNumber localAs, final Ipv4Address localBgpId, final Ipv4Address clusterId, final RIBExtensionConsumerContext extensions,
+    public RIBImpl(final RibId ribId, final AsNumber localAs, final BgpId localBgpId, final ClusterIdentifier clusterId, final RIBExtensionConsumerContext extensions,
         final BGPDispatcher dispatcher, final BindingCodecTreeFactory codecFactory,
         final DataBroker dps, final DOMDataBroker domDataBroker, final List<BgpTableType> localTables,
         @Nonnull final Map<TablesKey, PathSelectionMode> bestPathSelectionStrategies, final GeneratedClassLoadingStrategy classStrategy,
@@ -178,7 +179,7 @@ public final class RIBImpl extends DefaultRibReference implements AutoCloseable,
         }
     }
 
-    public RIBImpl(final RibId ribId, final AsNumber localAs, final Ipv4Address localBgpId, final Ipv4Address clusterId, final RIBExtensionConsumerContext extensions,
+    public RIBImpl(final RibId ribId, final AsNumber localAs, final BgpId localBgpId, final ClusterIdentifier clusterId, final RIBExtensionConsumerContext extensions,
             final BGPDispatcher dispatcher, final BindingCodecTreeFactory codecFactory,
             final DataBroker dps, final DOMDataBroker domDataBroker, final List<BgpTableType> localTables,
             final Map<TablesKey, PathSelectionMode> bestPathSelectionstrategies, final GeneratedClassLoadingStrategy classStrategy) {
@@ -253,7 +254,7 @@ public final class RIBImpl extends DefaultRibReference implements AutoCloseable,
     }
 
     @Override
-    public Ipv4Address getBgpIdentifier() {
+    public BgpId getBgpIdentifier() {
         return this.bgpIdentifier;
     }
 
index e096b2633c5b81d7d71a674236880c88dcdb90c4..ad2008a9311115aae5cff48eaf9eb8f88846335b 100644 (file)
@@ -176,7 +176,7 @@ public final class StrictBGPPeerRegistry implements BGPPeerRegistry {
         }
 
         // https://tools.ietf.org/html/rfc6286#section-2.2
-        if (openObj.getBgpIdentifier() != null && openObj.getBgpIdentifier().equals(localPref.getBgpId())) {
+        if (openObj.getBgpIdentifier() != null && openObj.getBgpIdentifier().getValue().equals(localPref.getBgpId().getValue())) {
             LOG.warn("Remote and local BGP Identifiers are the same: {}", openObj.getBgpIdentifier());
             throw new BGPDocumentedException("Remote and local BGP Identifiers are the same.", BGPError.BAD_BGP_ID);
         }
index 95feb7fd6b652f0a9055e1a5186757ba4cc877f0..7a9d81643e830a39a6badac615ff177197601ab9 100644 (file)
@@ -11,6 +11,7 @@ import java.util.List;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.open.message.BgpParameters;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.BgpId;
 
 /**
  * DTO for BGP Session preferences, that contains BGP Open message.
@@ -21,7 +22,7 @@ public final class BGPSessionPreferences {
 
     private final int hold;
 
-    private final Ipv4Address bgpId;
+    private final BgpId bgpId;
 
     private final List<BgpParameters> params;
 
@@ -36,7 +37,7 @@ public final class BGPSessionPreferences {
      * @param remoteAs expected remote As Number
      * @param params list of advertised parameters
      */
-    public BGPSessionPreferences(final AsNumber as, final int hold, final Ipv4Address bgpId, final AsNumber remoteAs,
+    public BGPSessionPreferences(final AsNumber as, final int hold, final BgpId bgpId, final AsNumber remoteAs,
         final List<BgpParameters> params) {
         this.as = as;
         this.hold = hold;
@@ -68,7 +69,7 @@ public final class BGPSessionPreferences {
      *
      * @return BGP identifier
      */
-    public Ipv4Address getBgpId() {
+    public BgpId getBgpId() {
         return this.bgpId;
     }
 
index ae5da79063d4994127b84a3d3c8cc625b947632d..864636df6e5504fdf1395705512fb990986491bb 100755 (executable)
@@ -21,6 +21,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.rev130715.Ipv4Address;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.BgpTableType;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.rib.TablesKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.BgpId;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 
 /**
@@ -29,7 +30,7 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 public interface RIB  extends RibReference {
     AsNumber getLocalAs();
 
-    Ipv4Address getBgpIdentifier();
+    BgpId getBgpIdentifier();
 
     /**
      * Return the set of table identifiers which are accepted and advertised
index 6a559080a487566ed3066810e1576d8624113af2..9f4fc2652bd5a51cedd07e6f11289fbbe1f69f3a 100644 (file)
@@ -5,7 +5,6 @@ module bgp-peer {
     import bgp-rib { prefix rib; revision-date 2013-09-25; }
     import bgp-types { prefix bgp-t; revision-date 2013-09-19; }
     import bgp-multiprotocol { prefix bgp-mp; revision-date 2013-09-19; }
-    import config { prefix config; revision-date 2013-04-05; }
     import ietf-inet-types { prefix inet; revision-date 2013-07-15; }
     import opendaylight-md-sal-binding {prefix mdsb; revision-date 2013-10-28; }
     import rfc2385 { prefix rfc2385; revision-date 2016-03-24; }
@@ -80,7 +79,7 @@ module bgp-peer {
             description
                 "Expected remote AS number. If not present, it is assumed
                 to be the same as our local AS number.";
-            type uint32;
+            type inet:as-number;
         }
 
         leaf password {
@@ -99,7 +98,7 @@ module bgp-peer {
 
         leaf as {
             description "Autonomous system number.";
-            type uint32;
+            type inet:as-number;
             default 0;
         }
 
index db5ca3aff38f4f3ee9a87c1da4ad501fc30562c0..0f01cc99bfc5e11dd6fe3e175c60343097e8dcb2 100644 (file)
@@ -4,12 +4,8 @@ module bgp-rib-impl {
 
     import bgp-types { prefix bgp-t; revision-date 2013-09-19; }
     import bgp-rib { prefix rib; revision-date 2013-09-25; }
-    import bgp-multiprotocol { prefix bgp-mp; revision-date 2013-09-19; }
-    import config { prefix config; revision-date 2013-04-05; }
     import ietf-inet-types { prefix inet; revision-date 2013-07-15; }
-    import ietf-yang-types { prefix yang; revision-date 2013-07-15; }
     import opendaylight-md-sal-binding {prefix mdsb; revision-date 2013-10-28; }
-    import rpc-context { prefix rpcx; revision-date 2013-06-17; }
 
     organization "Brocade Communications Systems, Inc.";
     contact "Kevin Wang <kwang@brocade.com>";
@@ -31,7 +27,7 @@ module bgp-rib-impl {
     grouping bgp-rib-impl-identifiers {
         leaf local-as {
             description "Our local AS number. Needed by best selection path attribute.";
-            type uint32;
+            type inet:as-number;
             mandatory true;
         }
 
index 2200878f835a9f549e7931384fac06cdfcef01aa..fc176407563fc2c0498681bee1af45dea07d95a7 100644 (file)
@@ -6,7 +6,6 @@ module bgp-stats-peer {
     import bgp-multiprotocol { prefix bgp-mp; revision-date 2013-09-19; }
     import bgp-message { prefix bgp-msg; revision-date 2013-09-19; }
     import ietf-yang-types { prefix yang; revision-date 2013-07-15; }
-    import rpc-context { prefix rpcx; revision-date 2013-06-17; }
 
     organization "Brocade Communications Systems, Inc.";
     contact "Kevin Wang <kwang@brocade.com>";
index 130f3d5849d56e38d1a79bad516b9ad6efd85e40..1d6b3c3c7e7af381216e8daeceeb68776e836cae 100755 (executable)
@@ -88,6 +88,7 @@ import org.opendaylight.protocol.bgp.rib.impl.spi.BGPDispatcher;
 import org.opendaylight.protocol.bgp.rib.impl.spi.BGPPeerRegistry;
 import org.opendaylight.protocol.bgp.rib.spi.RIBExtensionProviderContext;
 import org.opendaylight.protocol.bgp.rib.spi.SimpleRIBExtensionProviderContext;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.RibId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.BgpId;
@@ -116,9 +117,10 @@ public abstract class AbstractRIBImplModuleTest extends AbstractConfigTest {
     private static final String TRANSACTION_NAME = "testTransaction";
 
     protected static final RibId RIB_ID = new RibId("test");
-    protected static final Ipv4Address BGP_ID = new Ipv4Address("192.168.1.1");
-    protected static final Ipv4Address CLUSTER_ID = new Ipv4Address("192.168.1.2");
+    protected static final BgpId BGP_ID = new BgpId("192.168.1.1");
+    protected static final ClusterIdentifier CLUSTER_ID = new ClusterIdentifier("192.168.1.2");
 
+    private static final AsNumber AS_NUMBER = new AsNumber(5000L);
     private static final String SESSION_RS_INSTANCE_NAME = "session-reconnect-strategy-factory";
     private static final String TCP_RS_INSTANCE_NAME = "tcp-reconnect-strategy-factory";
     private static final String RIB_EXTENSIONS_INSTANCE_NAME = "rib-extensions-impl";
@@ -296,14 +298,14 @@ public abstract class AbstractRIBImplModuleTest extends AbstractConfigTest {
         return transaction.commit();
     }
 
-    protected CommitStatus createRIBImplModuleInstance(final RibId ribId, final Long localAs, final Ipv4Address bgpId, final Ipv4Address clusterId) throws Exception {
+    protected CommitStatus createRIBImplModuleInstance(final RibId ribId, final AsNumber localAs, final BgpId bgpId, final ClusterIdentifier clusterId) throws Exception {
         final ConfigTransactionJMXClient transaction = this.configRegistryClient.createTransaction();
         createRIBImplModuleInstance(transaction, ribId, localAs, bgpId, clusterId, createAsyncDataBrokerInstance(transaction));
         return transaction.commit();
     }
 
-    private ObjectName createRIBImplModuleInstance(final ConfigTransactionJMXClient transaction, final RibId ribId, final Long localAs,
-            final Ipv4Address bgpId, final Ipv4Address clusterId, final ObjectName dataBroker) throws Exception {
+    private ObjectName createRIBImplModuleInstance(final ConfigTransactionJMXClient transaction, final RibId ribId, final AsNumber localAs,
+            final BgpId bgpId, final ClusterIdentifier clusterId, final ObjectName dataBroker) throws Exception {
         final ObjectName nameCreated = transaction.createModule(FACTORY_NAME, INSTANCE_NAME);
         final RIBImplModuleMXBean mxBean = transaction.newMXBeanProxy(nameCreated, RIBImplModuleMXBean.class);
         mxBean.setDataProvider(dataBroker);
@@ -325,13 +327,13 @@ public abstract class AbstractRIBImplModuleTest extends AbstractConfigTest {
     }
 
     protected ObjectName createRIBImplModuleInstance(final ConfigTransactionJMXClient transaction) throws Exception {
-        return createRIBImplModuleInstance(transaction, RIB_ID, 5000L, BGP_ID, CLUSTER_ID,
+        return createRIBImplModuleInstance(transaction, RIB_ID, AS_NUMBER, BGP_ID, CLUSTER_ID,
                 createAsyncDataBrokerInstance(transaction));
     }
 
     public ObjectName createRIBImplModuleInstance(final ConfigTransactionJMXClient transaction, final ObjectName dataBroker)
             throws Exception {
-        return createRIBImplModuleInstance(transaction, RIB_ID, 5000L, BGP_ID, CLUSTER_ID, dataBroker);
+        return createRIBImplModuleInstance(transaction, RIB_ID, AS_NUMBER, BGP_ID, CLUSTER_ID, dataBroker);
     }
 
     public ObjectName createAsyncDataBrokerInstance(final ConfigTransactionJMXClient transaction) throws InstanceAlreadyExistsException, InstanceNotFoundException {
index 9df07e5729ded5a4790502552f999dea13be6197..e1b5f83bbafd17181a5fdbc09c95d65888fc26a0 100755 (executable)
@@ -13,16 +13,18 @@ import org.junit.Test;
 import org.opendaylight.controller.config.api.ValidationException;
 import org.opendaylight.controller.config.api.jmx.CommitStatus;
 import org.opendaylight.controller.config.util.ConfigTransactionJMXClient;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber;
 
 public class RIBImplModuleTest extends AbstractRIBImplModuleTest {
     private static final int EXP_INSTANCES = 7;
+    private static final AsNumber AS_NUMBER = new AsNumber(500L);
     private static final String INSTANCE_NAME = "rib-impl";
     private static final String FACTORY_NAME = RIBImplModuleFactory.NAME;
 
     @Test
     public void testValidationExceptionRibIdNotSet() throws Exception {
         try {
-            createRIBImplModuleInstance(null, 500L, BGP_ID, CLUSTER_ID);
+            createRIBImplModuleInstance(null, AS_NUMBER, BGP_ID, CLUSTER_ID);
             fail();
         } catch (final ValidationException e) {
             assertTrue(e.getMessage().contains("RibId is not set."));
@@ -42,7 +44,7 @@ public class RIBImplModuleTest extends AbstractRIBImplModuleTest {
     @Test
     public void testValidationExceptionBgpIdNotSet() throws Exception {
         try {
-            createRIBImplModuleInstance(RIB_ID, 500L, null, CLUSTER_ID);
+            createRIBImplModuleInstance(RIB_ID, AS_NUMBER, null, CLUSTER_ID);
             fail();
         } catch (final ValidationException e) {
             assertTrue(e.getMessage().contains("BgpRibId is not set."));
@@ -73,7 +75,7 @@ public class RIBImplModuleTest extends AbstractRIBImplModuleTest {
         assertBeanCount(1, FACTORY_NAME);
         final RIBImplModuleMXBean mxBean = transaction.newMXBeanProxy(transaction.lookupConfigBean(FACTORY_NAME, INSTANCE_NAME),
                 RIBImplModuleMXBean.class);
-        mxBean.setLocalAs(100L);
+        mxBean.setLocalAs(new AsNumber(100L));
         final CommitStatus status = transaction.commit();
         assertBeanCount(1, FACTORY_NAME);
         assertStatus(status, 0, 1, EXP_INSTANCES - 1);
index 55cb38d17ee241d4726f479fb04a96b0f9f5fde0..a73a6dc11d58a3ab99c7abf0bb288e6a80b48bdf 100755 (executable)
@@ -53,6 +53,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.bgp.rib.Rib;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.rib.TablesKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.AddressFamily;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.BgpId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.ClusterIdentifier;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.Ipv4AddressFamily;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.SubsequentAddressFamily;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.UnicastSubsequentAddressFamily;
@@ -87,8 +89,8 @@ import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 public class AbstractRIBTestSetup {
 
     private RIBImpl rib;
-    private final Ipv4Address clusterId = new Ipv4Address("128.0.0.1");
-    private final Ipv4Address ribId = new Ipv4Address("127.0.0.1");
+    private final ClusterIdentifier clusterId = new ClusterIdentifier("128.0.0.1");
+    private final BgpId ribId = new BgpId("127.0.0.1");
     static final Class<? extends AddressFamily> AFI = Ipv4AddressFamily.class;
     static final Class<? extends SubsequentAddressFamily> SAFI = UnicastSubsequentAddressFamily.class;
     static final TablesKey KEY = new TablesKey(AFI, SAFI);
index eb51af0bd546011351b540df9bc2a9ec6e0cc2c4..0c6862ed9132dc2fc1256ff8166b11470f9bc243 100755 (executable)
@@ -48,6 +48,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mult
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.CParameters1;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.CParameters1Builder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.mp.capabilities.MultiprotocolCapabilityBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.BgpId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.Ipv4AddressFamily;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.UnicastSubsequentAddressFamily;
 import org.slf4j.LoggerFactory;
@@ -154,7 +155,7 @@ public class BGPDispatcherImplTest {
             .build()).build());
         capas.add(new OptionalCapabilitiesBuilder().setCParameters(BgpExtendedMessageUtil.EXTENDED_MESSAGE_CAPABILITY).build());
         tlvs.add(new BgpParametersBuilder().setOptionalCapabilities(capas).build());
-        return new BGPSessionPreferences(AS_NUMBER, (short) 4, new Ipv4Address(socketAddress.getAddress().getHostAddress()), AS_NUMBER, tlvs);
+        return new BGPSessionPreferences(AS_NUMBER, (short) 4, new BgpId(socketAddress.getAddress().getHostAddress()), AS_NUMBER, tlvs);
     }
 
 }
index ed1f3ef40b6f3401010131097cf21ab7e5900691..52229f9a68e1307387317112f338471606277573 100644 (file)
@@ -165,7 +165,7 @@ public class BGPSessionImplTest {
         assertEquals(1, state.getKeepaliveCurrent().intValue());
         assertEquals(BGPSessionImpl.State.UP.name(), state.getSessionState());
         assertEquals(BGP_ID.getValue(), new String(state.getLocalPeerPreferences().getHost().getValue()));
-        assertEquals(AS_NUMBER.getValue(), state.getLocalPeerPreferences().getAs());
+        assertEquals(AS_NUMBER.getValue(), state.getLocalPeerPreferences().getAs().getValue());
         assertTrue(state.getLocalPeerPreferences().getBgpExtendedMessageCapability());
         assertEquals(BGP_ID.getValue(), state.getLocalPeerPreferences().getBgpId().getValue());
         assertEquals(1, state.getLocalPeerPreferences().getAdvertizedTableTypes().size());
index c4c8efc3259e1791292a5b836f47d4543b99e96b..82c9967815c420eb4c17ecbf3e44c5e3f44dde3a 100644 (file)
@@ -64,6 +64,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mult
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.CParameters1Builder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.mp.capabilities.GracefulRestartCapabilityBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.mp.capabilities.MultiprotocolCapabilityBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.BgpId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.Ipv4AddressFamily;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.UnicastSubsequentAddressFamily;
 import org.opendaylight.yangtools.yang.binding.Notification;
@@ -110,7 +111,7 @@ public class FSMTest {
 
 
         tlvs.add(new BgpParametersBuilder().setOptionalCapabilities(capas).build());
-        final BGPSessionPreferences prefs = new BGPSessionPreferences(new AsNumber(30L), (short) 3, new Ipv4Address("1.1.1.1"), new AsNumber(30L), tlvs);
+        final BGPSessionPreferences prefs = new BGPSessionPreferences(new AsNumber(30L), (short) 3, new BgpId("1.1.1.1"), new AsNumber(30L), tlvs);
 
         final ChannelFuture f = mock(ChannelFuture.class);
         doReturn(null).when(f).addListener(any(GenericFutureListener.class));
index be5b469f66f49b8bb5555458c23ae5982db7a461..2b28847ac2e0bd66109acd0bb72ac7fe8a537565 100755 (executable)
@@ -60,6 +60,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.bgp.rib.rib.LocRib;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.rib.Tables;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.rib.TablesKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.BgpId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.Ipv4AddressFamily;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.UnicastSubsequentAddressFamily;
 import org.opendaylight.yangtools.binding.data.codec.api.BindingCodecTreeFactory;
@@ -131,7 +132,7 @@ public class ParserToSalTest extends AbstractDataBrokerTest {
     public void testWithLinkstate() throws InterruptedException, ExecutionException {
         final List<BgpTableType> tables = ImmutableList.of(
                 (BgpTableType) new BgpTableTypeImpl(LinkstateAddressFamily.class, LinkstateSubsequentAddressFamily.class));
-        final RIBImpl rib = new RIBImpl(new RibId(TEST_RIB_ID), new AsNumber(72L), new Ipv4Address("127.0.0.1"), null, this.ext2, this.dispatcher,
+        final RIBImpl rib = new RIBImpl(new RibId(TEST_RIB_ID), new AsNumber(72L), new BgpId("127.0.0.1"), null, this.ext2, this.dispatcher,
             this.codecFactory, getDataBroker(), getDomBroker(), tables,
             Collections.singletonMap(new TablesKey(LinkstateAddressFamily.class, LinkstateSubsequentAddressFamily.class),
                 BasePathSelectionModeFactory.createBestPathSelectionStrategy()), GeneratedClassLoadingStrategy.getTCCLClassLoadingStrategy());
@@ -146,7 +147,7 @@ public class ParserToSalTest extends AbstractDataBrokerTest {
     @Test
     public void testWithoutLinkstate() throws InterruptedException, ExecutionException {
         final List<BgpTableType> tables = ImmutableList.of((BgpTableType) new BgpTableTypeImpl(Ipv4AddressFamily.class, UnicastSubsequentAddressFamily.class));
-        final RIBImpl rib = new RIBImpl(new RibId(TEST_RIB_ID), new AsNumber(72L), new Ipv4Address("127.0.0.1"), null, this.ext1, this.dispatcher,
+        final RIBImpl rib = new RIBImpl(new RibId(TEST_RIB_ID), new AsNumber(72L), new BgpId("127.0.0.1"), null, this.ext1, this.dispatcher,
             this.codecFactory, getDataBroker(), getDomBroker(), tables,
             Collections.singletonMap(new TablesKey(LinkstateAddressFamily.class, LinkstateSubsequentAddressFamily.class),
                 BasePathSelectionModeFactory.createBestPathSelectionStrategy()), GeneratedClassLoadingStrategy.getTCCLClassLoadingStrategy());
index 1d82e2d5d07b2c7eba9dc6ee63e6b855444b82aa..bdc75e3f0cad7f7c789eae05b5622e2c450746e9 100644 (file)
@@ -33,6 +33,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mess
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.open.message.bgp.parameters.OptionalCapabilitiesBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.open.message.bgp.parameters.optional.capabilities.CParametersBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.open.message.bgp.parameters.optional.capabilities.c.parameters.As4BytesCapabilityBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.BgpId;
 
 public class StrictBGPPeerRegistryTest {
 
@@ -58,7 +59,7 @@ public class StrictBGPPeerRegistryTest {
     @Before
     public void setUp() throws Exception {
         this.peerRegistry = new StrictBGPPeerRegistry();
-        this.mockPreferences =  new BGPSessionPreferences(LOCAL_AS, 1, new Ipv4Address("0.0.0.1"), LOCAL_AS, Collections.<BgpParameters> emptyList());
+        this.mockPreferences =  new BGPSessionPreferences(LOCAL_AS, 1, new BgpId("0.0.0.1"), LOCAL_AS, Collections.<BgpParameters> emptyList());
     }
 
     private static BGPSessionListener getMockSession() {
index 76739147379be009d99bb017cad10f1df2109aeb..1bb3fd4534f7aaa345e2afdbaa29c079953ec481 100644 (file)
@@ -22,6 +22,7 @@ import org.opendaylight.protocol.bgp.rib.spi.BGPSessionListener;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.open.message.BgpParameters;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.BgpId;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -36,7 +37,7 @@ final class BGPPeerBuilder {
     static void createPeer(final BGPDispatcher dispatcher, final Arguments arguments, final InetSocketAddress localAddress,
         final BGPSessionListener sessionListener, final BgpParameters bgpParameters) {
         final AsNumber as = arguments.getAs();
-        final BGPSessionPreferences proposal = new BGPSessionPreferences(as, arguments.getHoldTimer(), new Ipv4Address(localAddress.getAddress().getHostAddress()),
+        final BGPSessionPreferences proposal = new BGPSessionPreferences(as, arguments.getHoldTimer(), new BgpId(localAddress.getAddress().getHostAddress()),
             as, Collections.singletonList(bgpParameters));
         final StrictBGPPeerRegistry strictBGPPeerRegistry = new StrictBGPPeerRegistry();
         if (arguments.getInitiateConnection()) {