summaryrefslogtreecommitdiffstats
path: root/infra/northbound
diff options
context:
space:
mode:
authorMichal Cmarada <michal.cmarada@pantheon.tech>2018-09-25 11:15:35 +0200
committerMichal Cmarada <michal.cmarada@pantheon.tech>2018-09-25 11:22:18 +0200
commit556a0f59abc9b09005d40945bc20948d69e4f98e (patch)
tree76d795ae59aba49521fc4fdc7d65062c946147be /infra/northbound
parent46bcceb927b1bce07c1c9517f45470703293eb84 (diff)
Bump ODL dependencies to Fluorine (HONEYCOMB-433)
Change-Id: I142ebd2899272feff00abe7d4bae708f093ee3ec Signed-off-by: Michal Cmarada <michal.cmarada@pantheon.tech>
Diffstat (limited to 'infra/northbound')
-rw-r--r--infra/northbound/bgp-extensions/evpn/src/main/java/io/fd/honeycomb/northbound/bgp/extension/EvpnModule.java4
-rw-r--r--infra/northbound/bgp-extensions/evpn/src/main/java/io/fd/honeycomb/northbound/bgp/extension/EvpnWriterFactory.java2
-rw-r--r--infra/northbound/bgp-extensions/extension-common/pom.xml5
-rw-r--r--infra/northbound/bgp-extensions/extension-common/src/main/java/io/fd/honeycomb/northbound/bgp/extension/AbstractBgpExtensionModule.java8
-rw-r--r--infra/northbound/bgp-extensions/extension-common/src/main/java/io/fd/honeycomb/northbound/bgp/extension/RIBExtensionConsumerContextProvider.java6
-rw-r--r--infra/northbound/bgp-extensions/inet/src/main/java/io/fd/honeycomb/northbound/bgp/extension/InetModule.java18
-rw-r--r--infra/northbound/bgp-extensions/inet/src/main/java/io/fd/honeycomb/northbound/bgp/extension/InetWriterFactory.java4
-rw-r--r--infra/northbound/bgp-extensions/l3-vpn-v4/src/main/java/io/fd/honeycomb/northbound/bgp/extension/L3VpnV4Module.java12
-rw-r--r--infra/northbound/bgp-extensions/l3-vpn-v4/src/main/java/io/fd/honeycomb/northbound/bgp/extension/L3VpnV4WriterFactory.java2
-rw-r--r--infra/northbound/bgp-extensions/l3-vpn-v6/src/main/java/io/fd/honeycomb/northbound/bgp/extension/L3VpnV6Module.java12
-rw-r--r--infra/northbound/bgp-extensions/l3-vpn-v6/src/main/java/io/fd/honeycomb/northbound/bgp/extension/L3VpnV6WriterFactory.java2
-rw-r--r--infra/northbound/bgp-extensions/labeled-unicast/src/main/java/io/fd/honeycomb/northbound/bgp/extension/LabeledUnicastModule.java18
-rw-r--r--infra/northbound/bgp-extensions/labeled-unicast/src/main/java/io/fd/honeycomb/northbound/bgp/extension/LabeledUnicastWriterFactory.java4
-rw-r--r--infra/northbound/bgp-extensions/linkstate/src/main/java/io/fd/honeycomb/northbound/bgp/extension/LinkstateModule.java14
-rw-r--r--infra/northbound/bgp-extensions/linkstate/src/main/java/io/fd/honeycomb/northbound/bgp/extension/LinkstateWriterFactory.java2
-rw-r--r--infra/northbound/bgp/pom.xml5
-rw-r--r--infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/ApplicationRibWriterFactory.java4
-rw-r--r--infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BgpConfiguration.java17
-rw-r--r--infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BgpModule.java2
-rw-r--r--infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BgpPolicyConfiguration.java70
-rw-r--r--infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BgpPolicyConfigurationModule.java34
-rw-r--r--infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BgpRIBProvider.java85
-rw-r--r--infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BgpReaderFactoryProvider.java4
-rw-r--r--infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/neighbors/BgpPeerWriterFactory.java10
-rw-r--r--infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/neighbors/NeighborCustomizer.java40
-rw-r--r--infra/northbound/bgp/src/main/resources/honeycomb-minimal-resources/config/bgp-policy.json4
-rw-r--r--infra/northbound/bgp/src/test/java/io/fd/honeycomb/infra/bgp/neighbors/NeighborCustomizerTest.java67
-rw-r--r--infra/northbound/netconf/src/main/java/io/fd/honeycomb/northbound/netconf/HoneycombNotification2NetconfProvider.java8
-rw-r--r--infra/northbound/netconf/src/main/java/io/fd/honeycomb/northbound/netconf/NetconfMdsalMapperProvider.java10
-rw-r--r--infra/northbound/netconf/src/main/resources/honeycomb-minimal-resources/config/netconf-whitelist.xml2
-rw-r--r--infra/northbound/restconf/pom.xml20
-rw-r--r--infra/northbound/restconf/src/main/java/io/fd/honeycomb/northbound/restconf/BrokerFacadeProvider.java47
-rw-r--r--infra/northbound/restconf/src/main/java/io/fd/honeycomb/northbound/restconf/ControllerContextProvider.java38
-rw-r--r--infra/northbound/restconf/src/main/java/io/fd/honeycomb/northbound/restconf/JettyServerProvider.java40
-rw-r--r--infra/northbound/restconf/src/main/java/io/fd/honeycomb/northbound/restconf/RestconfApplicationProvider.java37
-rw-r--r--infra/northbound/restconf/src/main/java/io/fd/honeycomb/northbound/restconf/RestconfModule.java12
-rw-r--r--infra/northbound/restconf/src/main/java/io/fd/honeycomb/northbound/restconf/RestconfProvider.java28
-rw-r--r--infra/northbound/restconf/src/main/java/io/fd/honeycomb/northbound/restconf/RestconfServiceProvider.java37
-rw-r--r--infra/northbound/restconf/src/main/java/io/fd/honeycomb/northbound/restconf/StatisticsRestconfServiceWrapperProvider.java34
39 files changed, 592 insertions, 176 deletions
diff --git a/infra/northbound/bgp-extensions/evpn/src/main/java/io/fd/honeycomb/northbound/bgp/extension/EvpnModule.java b/infra/northbound/bgp-extensions/evpn/src/main/java/io/fd/honeycomb/northbound/bgp/extension/EvpnModule.java
index 7b24b2ff7..4198dc418 100644
--- a/infra/northbound/bgp-extensions/evpn/src/main/java/io/fd/honeycomb/northbound/bgp/extension/EvpnModule.java
+++ b/infra/northbound/bgp-extensions/evpn/src/main/java/io/fd/honeycomb/northbound/bgp/extension/EvpnModule.java
@@ -29,8 +29,8 @@ import org.opendaylight.protocol.bgp.parser.spi.BGPExtensionProviderActivator;
import org.opendaylight.protocol.bgp.rib.spi.RIBExtensionProviderActivator;
import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.AfiSafi;
import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.types.rev151009.L2VPNEVPN;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.EvpnSubsequentAddressFamily;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.L2vpnAddressFamily;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev180329.EvpnSubsequentAddressFamily;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev180329.L2vpnAddressFamily;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/infra/northbound/bgp-extensions/evpn/src/main/java/io/fd/honeycomb/northbound/bgp/extension/EvpnWriterFactory.java b/infra/northbound/bgp-extensions/evpn/src/main/java/io/fd/honeycomb/northbound/bgp/extension/EvpnWriterFactory.java
index 82567dd26..d6c591603 100644
--- a/infra/northbound/bgp-extensions/evpn/src/main/java/io/fd/honeycomb/northbound/bgp/extension/EvpnWriterFactory.java
+++ b/infra/northbound/bgp-extensions/evpn/src/main/java/io/fd/honeycomb/northbound/bgp/extension/EvpnWriterFactory.java
@@ -25,7 +25,7 @@ import io.fd.honeycomb.translate.write.WriterFactory;
import io.fd.honeycomb.translate.write.registry.ModifiableWriterRegistryBuilder;
import javax.annotation.Nonnull;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.evpn.routes.EvpnRoutes;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev180329.evpn.routes.EvpnRoutes;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
public class EvpnWriterFactory implements WriterFactory {
diff --git a/infra/northbound/bgp-extensions/extension-common/pom.xml b/infra/northbound/bgp-extensions/extension-common/pom.xml
index 999b1f80a..d0283e850 100644
--- a/infra/northbound/bgp-extensions/extension-common/pom.xml
+++ b/infra/northbound/bgp-extensions/extension-common/pom.xml
@@ -75,6 +75,11 @@
<artifactId>bgp-parser-impl</artifactId>
<version>${odl.bgpcep.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-binding-broker-impl</artifactId>
+ <version>${odl.mdsal.controller.version}</version>
+ </dependency>
</dependencies>
</project> \ No newline at end of file
diff --git a/infra/northbound/bgp-extensions/extension-common/src/main/java/io/fd/honeycomb/northbound/bgp/extension/AbstractBgpExtensionModule.java b/infra/northbound/bgp-extensions/extension-common/src/main/java/io/fd/honeycomb/northbound/bgp/extension/AbstractBgpExtensionModule.java
index a43885761..dfa31aac0 100644
--- a/infra/northbound/bgp-extensions/extension-common/src/main/java/io/fd/honeycomb/northbound/bgp/extension/AbstractBgpExtensionModule.java
+++ b/infra/northbound/bgp-extensions/extension-common/src/main/java/io/fd/honeycomb/northbound/bgp/extension/AbstractBgpExtensionModule.java
@@ -26,10 +26,10 @@ import org.opendaylight.protocol.bgp.parser.spi.BGPExtensionProviderActivator;
import org.opendaylight.protocol.bgp.rib.spi.RIBExtensionProviderActivator;
import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.AfiSafi;
import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.types.rev151009.AfiSafiType;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.rib.Tables;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.ApplicationRib;
-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.SubsequentAddressFamily;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.Tables;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.ApplicationRib;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.AddressFamily;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.SubsequentAddressFamily;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.slf4j.Logger;
diff --git a/infra/northbound/bgp-extensions/extension-common/src/main/java/io/fd/honeycomb/northbound/bgp/extension/RIBExtensionConsumerContextProvider.java b/infra/northbound/bgp-extensions/extension-common/src/main/java/io/fd/honeycomb/northbound/bgp/extension/RIBExtensionConsumerContextProvider.java
index a8374ea67..8c4144d45 100644
--- a/infra/northbound/bgp-extensions/extension-common/src/main/java/io/fd/honeycomb/northbound/bgp/extension/RIBExtensionConsumerContextProvider.java
+++ b/infra/northbound/bgp-extensions/extension-common/src/main/java/io/fd/honeycomb/northbound/bgp/extension/RIBExtensionConsumerContextProvider.java
@@ -19,6 +19,8 @@ package io.fd.honeycomb.northbound.bgp.extension;
import com.google.inject.Inject;
import io.fd.honeycomb.binding.init.ProviderTrait;
import io.fd.honeycomb.data.init.ShutdownHandler;
+import org.opendaylight.controller.md.sal.binding.impl.BindingToNormalizedNodeCodec;
+
import org.opendaylight.protocol.bgp.rib.spi.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -32,12 +34,14 @@ public class RIBExtensionConsumerContextProvider extends ProviderTrait<RIBExtens
private Set<RIBExtensionProviderActivator> activators;
@Inject
private ShutdownHandler shutdownHandler;
+ @Inject
+ private BindingToNormalizedNodeCodec serializer;
@Override
protected RIBExtensionConsumerContext create() {
final RIBExtensionProviderContext ctx = new SimpleRIBExtensionProviderContext();
final SimpleRIBExtensionProviderContextActivator activator =
- new SimpleRIBExtensionProviderContextActivator(ctx, new ArrayList<>(activators));
+ new SimpleRIBExtensionProviderContextActivator(ctx, new ArrayList<>(activators), serializer);
LOG.debug("Starting RIBExtensionConsumerContext with activators: {}", activators);
activator.start();
shutdownHandler.register("rib-extension-consumer-context-activator", activator);
diff --git a/infra/northbound/bgp-extensions/inet/src/main/java/io/fd/honeycomb/northbound/bgp/extension/InetModule.java b/infra/northbound/bgp-extensions/inet/src/main/java/io/fd/honeycomb/northbound/bgp/extension/InetModule.java
index 9d798c849..cf7b4af1e 100644
--- a/infra/northbound/bgp-extensions/inet/src/main/java/io/fd/honeycomb/northbound/bgp/extension/InetModule.java
+++ b/infra/northbound/bgp-extensions/inet/src/main/java/io/fd/honeycomb/northbound/bgp/extension/InetModule.java
@@ -32,11 +32,11 @@ import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.r
import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.AfiSafiBuilder;
import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.types.rev151009.IPV4UNICAST;
import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.types.rev151009.IPV6UNICAST;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev171207.AfiSafi2;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev171207.AfiSafi2Builder;
-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.Ipv6AddressFamily;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.UnicastSubsequentAddressFamily;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.NeighborAddPathsConfig;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.NeighborAddPathsConfigBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.Ipv4AddressFamily;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.Ipv6AddressFamily;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.UnicastSubsequentAddressFamily;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -86,8 +86,8 @@ public class InetModule extends AbstractBgpExtensionModule {
@Override
public AfiSafi get() {
return new AfiSafiBuilder().setAfiSafiName(IPV4UNICAST.class)
- .addAugmentation(AfiSafi2.class,
- new AfiSafi2Builder().setReceive(cfg.isBgpMultiplePathsEnabled())
+ .addAugmentation(NeighborAddPathsConfig.class,
+ new NeighborAddPathsConfigBuilder().setReceive(cfg.isBgpMultiplePathsEnabled())
.setSendMax(cfg.bgpSendMaxMaths.get().shortValue()).build())
.build();
}
@@ -101,8 +101,8 @@ public class InetModule extends AbstractBgpExtensionModule {
@Override
public AfiSafi get() {
return new AfiSafiBuilder().setAfiSafiName(IPV6UNICAST.class)
- .addAugmentation(AfiSafi2.class,
- new AfiSafi2Builder().setReceive(cfg.isBgpMultiplePathsEnabled())
+ .addAugmentation(NeighborAddPathsConfig.class,
+ new NeighborAddPathsConfigBuilder().setReceive(cfg.isBgpMultiplePathsEnabled())
.setSendMax(cfg.bgpSendMaxMaths.get().shortValue()).build())
.build();
}
diff --git a/infra/northbound/bgp-extensions/inet/src/main/java/io/fd/honeycomb/northbound/bgp/extension/InetWriterFactory.java b/infra/northbound/bgp-extensions/inet/src/main/java/io/fd/honeycomb/northbound/bgp/extension/InetWriterFactory.java
index 69bda6fe8..37e053a59 100644
--- a/infra/northbound/bgp-extensions/inet/src/main/java/io/fd/honeycomb/northbound/bgp/extension/InetWriterFactory.java
+++ b/infra/northbound/bgp-extensions/inet/src/main/java/io/fd/honeycomb/northbound/bgp/extension/InetWriterFactory.java
@@ -22,8 +22,8 @@ import io.fd.honeycomb.translate.util.write.BindingBrokerWriter;
import io.fd.honeycomb.translate.write.WriterFactory;
import io.fd.honeycomb.translate.write.registry.ModifiableWriterRegistryBuilder;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev171207.ipv4.routes.Ipv4Routes;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev171207.ipv6.routes.Ipv6Routes;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev180329.ipv4.routes.Ipv4Routes;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev180329.ipv6.routes.Ipv6Routes;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import javax.annotation.Nonnull;
diff --git a/infra/northbound/bgp-extensions/l3-vpn-v4/src/main/java/io/fd/honeycomb/northbound/bgp/extension/L3VpnV4Module.java b/infra/northbound/bgp-extensions/l3-vpn-v4/src/main/java/io/fd/honeycomb/northbound/bgp/extension/L3VpnV4Module.java
index 0ac311b10..efaa84c99 100644
--- a/infra/northbound/bgp-extensions/l3-vpn-v4/src/main/java/io/fd/honeycomb/northbound/bgp/extension/L3VpnV4Module.java
+++ b/infra/northbound/bgp-extensions/l3-vpn-v4/src/main/java/io/fd/honeycomb/northbound/bgp/extension/L3VpnV4Module.java
@@ -19,14 +19,14 @@ package io.fd.honeycomb.northbound.bgp.extension;
import com.google.common.collect.ImmutableSet;
import com.google.inject.Provider;
import io.fd.honeycomb.translate.write.WriterFactory;
-import org.opendaylight.protocol.bgp.l3vpn.ipv4.BgpIpv4Activator;
-import org.opendaylight.protocol.bgp.l3vpn.ipv4.RibIpv4Activator;
+import org.opendaylight.protocol.bgp.l3vpn.BGPActivator;
+import org.opendaylight.protocol.bgp.l3vpn.RIBActivator;
import org.opendaylight.protocol.bgp.parser.spi.BGPExtensionProviderActivator;
import org.opendaylight.protocol.bgp.rib.spi.RIBExtensionProviderActivator;
import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.AfiSafi;
import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.types.rev151009.L3VPNIPV4UNICAST;
-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.MplsLabeledVpnSubsequentAddressFamily;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.Ipv4AddressFamily;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.MplsLabeledVpnSubsequentAddressFamily;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -41,12 +41,12 @@ public class L3VpnV4Module extends AbstractBgpExtensionModule {
@Override
public Set<Class<? extends RIBExtensionProviderActivator>> getRibActivators() {
- return ImmutableSet.of(RibIpv4Activator.class);
+ return ImmutableSet.of(RIBActivator.class);
}
@Override
public Set<Class<? extends BGPExtensionProviderActivator>> getExtensionActivators() {
- return ImmutableSet.of(BgpIpv4Activator.class);
+ return ImmutableSet.of(BGPActivator.class);
}
@Override
diff --git a/infra/northbound/bgp-extensions/l3-vpn-v4/src/main/java/io/fd/honeycomb/northbound/bgp/extension/L3VpnV4WriterFactory.java b/infra/northbound/bgp-extensions/l3-vpn-v4/src/main/java/io/fd/honeycomb/northbound/bgp/extension/L3VpnV4WriterFactory.java
index 01051e2b2..ad33cbb06 100644
--- a/infra/northbound/bgp-extensions/l3-vpn-v4/src/main/java/io/fd/honeycomb/northbound/bgp/extension/L3VpnV4WriterFactory.java
+++ b/infra/northbound/bgp-extensions/l3-vpn-v4/src/main/java/io/fd/honeycomb/northbound/bgp/extension/L3VpnV4WriterFactory.java
@@ -25,7 +25,7 @@ import io.fd.honeycomb.translate.write.WriterFactory;
import io.fd.honeycomb.translate.write.registry.ModifiableWriterRegistryBuilder;
import javax.annotation.Nonnull;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.vpn.ipv4.rev171207.l3vpn.ipv4.routes.VpnIpv4Routes;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.vpn.ipv4.rev180329.l3vpn.ipv4.routes.VpnIpv4Routes;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
public class L3VpnV4WriterFactory implements WriterFactory {
diff --git a/infra/northbound/bgp-extensions/l3-vpn-v6/src/main/java/io/fd/honeycomb/northbound/bgp/extension/L3VpnV6Module.java b/infra/northbound/bgp-extensions/l3-vpn-v6/src/main/java/io/fd/honeycomb/northbound/bgp/extension/L3VpnV6Module.java
index 2583d4a60..e5844b410 100644
--- a/infra/northbound/bgp-extensions/l3-vpn-v6/src/main/java/io/fd/honeycomb/northbound/bgp/extension/L3VpnV6Module.java
+++ b/infra/northbound/bgp-extensions/l3-vpn-v6/src/main/java/io/fd/honeycomb/northbound/bgp/extension/L3VpnV6Module.java
@@ -19,14 +19,14 @@ package io.fd.honeycomb.northbound.bgp.extension;
import com.google.common.collect.ImmutableSet;
import com.google.inject.Provider;
import io.fd.honeycomb.translate.write.WriterFactory;
-import org.opendaylight.protocol.bgp.l3vpn.ipv6.BgpIpv6Activator;
-import org.opendaylight.protocol.bgp.l3vpn.ipv6.RibIpv6Activator;
+import org.opendaylight.protocol.bgp.l3vpn.BGPActivator;
+import org.opendaylight.protocol.bgp.l3vpn.RIBActivator;
import org.opendaylight.protocol.bgp.parser.spi.BGPExtensionProviderActivator;
import org.opendaylight.protocol.bgp.rib.spi.RIBExtensionProviderActivator;
import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.AfiSafi;
import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.types.rev151009.L3VPNIPV6UNICAST;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.Ipv6AddressFamily;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.MplsLabeledVpnSubsequentAddressFamily;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.Ipv6AddressFamily;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.MplsLabeledVpnSubsequentAddressFamily;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -41,12 +41,12 @@ public class L3VpnV6Module extends AbstractBgpExtensionModule {
@Override
public Set<Class<? extends RIBExtensionProviderActivator>> getRibActivators() {
- return ImmutableSet.of(RibIpv6Activator.class);
+ return ImmutableSet.of(RIBActivator.class);
}
@Override
public Set<Class<? extends BGPExtensionProviderActivator>> getExtensionActivators() {
- return ImmutableSet.of(BgpIpv6Activator.class);
+ return ImmutableSet.of(BGPActivator.class);
}
@Override
diff --git a/infra/northbound/bgp-extensions/l3-vpn-v6/src/main/java/io/fd/honeycomb/northbound/bgp/extension/L3VpnV6WriterFactory.java b/infra/northbound/bgp-extensions/l3-vpn-v6/src/main/java/io/fd/honeycomb/northbound/bgp/extension/L3VpnV6WriterFactory.java
index 65a28173b..b2b2fbd5d 100644
--- a/infra/northbound/bgp-extensions/l3-vpn-v6/src/main/java/io/fd/honeycomb/northbound/bgp/extension/L3VpnV6WriterFactory.java
+++ b/infra/northbound/bgp-extensions/l3-vpn-v6/src/main/java/io/fd/honeycomb/northbound/bgp/extension/L3VpnV6WriterFactory.java
@@ -25,7 +25,7 @@ import io.fd.honeycomb.translate.write.WriterFactory;
import io.fd.honeycomb.translate.write.registry.ModifiableWriterRegistryBuilder;
import javax.annotation.Nonnull;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.vpn.ipv6.rev171207.l3vpn.ipv6.routes.VpnIpv6Routes;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.vpn.ipv6.rev180329.l3vpn.ipv6.routes.VpnIpv6Routes;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
public class L3VpnV6WriterFactory implements WriterFactory {
diff --git a/infra/northbound/bgp-extensions/labeled-unicast/src/main/java/io/fd/honeycomb/northbound/bgp/extension/LabeledUnicastModule.java b/infra/northbound/bgp-extensions/labeled-unicast/src/main/java/io/fd/honeycomb/northbound/bgp/extension/LabeledUnicastModule.java
index 9aab1fc28..fa251e049 100644
--- a/infra/northbound/bgp-extensions/labeled-unicast/src/main/java/io/fd/honeycomb/northbound/bgp/extension/LabeledUnicastModule.java
+++ b/infra/northbound/bgp-extensions/labeled-unicast/src/main/java/io/fd/honeycomb/northbound/bgp/extension/LabeledUnicastModule.java
@@ -32,11 +32,11 @@ import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.r
import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.AfiSafiBuilder;
import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.types.rev151009.IPV4LABELLEDUNICAST;
import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.types.rev151009.IPV6LABELLEDUNICAST;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev171207.LabeledUnicastSubsequentAddressFamily;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev171207.AfiSafi2;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev171207.AfiSafi2Builder;
-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.Ipv6AddressFamily;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev180329.LabeledUnicastSubsequentAddressFamily;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.NeighborAddPathsConfig;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.NeighborAddPathsConfigBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.Ipv4AddressFamily;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.Ipv6AddressFamily;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -87,8 +87,8 @@ public class LabeledUnicastModule extends AbstractBgpExtensionModule {
@Override
public AfiSafi get() {
return new AfiSafiBuilder().setAfiSafiName(IPV4LABELLEDUNICAST.class)
- .addAugmentation(AfiSafi2.class,
- new AfiSafi2Builder().setReceive(cfg.isBgpMultiplePathsEnabled())
+ .addAugmentation(NeighborAddPathsConfig .class,
+ new NeighborAddPathsConfigBuilder().setReceive(cfg.isBgpMultiplePathsEnabled())
.setSendMax(cfg.bgpSendMaxMaths.get().shortValue()).build())
.build();
}
@@ -101,8 +101,8 @@ public class LabeledUnicastModule extends AbstractBgpExtensionModule {
@Override
public AfiSafi get() {
return new AfiSafiBuilder().setAfiSafiName(IPV6LABELLEDUNICAST.class)
- .addAugmentation(AfiSafi2.class,
- new AfiSafi2Builder().setReceive(cfg.isBgpMultiplePathsEnabled())
+ .addAugmentation(NeighborAddPathsConfig .class,
+ new NeighborAddPathsConfigBuilder().setReceive(cfg.isBgpMultiplePathsEnabled())
.setSendMax(cfg.bgpSendMaxMaths.get().shortValue()).build())
.build();
}
diff --git a/infra/northbound/bgp-extensions/labeled-unicast/src/main/java/io/fd/honeycomb/northbound/bgp/extension/LabeledUnicastWriterFactory.java b/infra/northbound/bgp-extensions/labeled-unicast/src/main/java/io/fd/honeycomb/northbound/bgp/extension/LabeledUnicastWriterFactory.java
index 37bb0fa9b..cd683f878 100644
--- a/infra/northbound/bgp-extensions/labeled-unicast/src/main/java/io/fd/honeycomb/northbound/bgp/extension/LabeledUnicastWriterFactory.java
+++ b/infra/northbound/bgp-extensions/labeled-unicast/src/main/java/io/fd/honeycomb/northbound/bgp/extension/LabeledUnicastWriterFactory.java
@@ -25,8 +25,8 @@ import io.fd.honeycomb.translate.write.WriterFactory;
import io.fd.honeycomb.translate.write.registry.ModifiableWriterRegistryBuilder;
import javax.annotation.Nonnull;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev171207.labeled.unicast.ipv6.routes.LabeledUnicastIpv6Routes;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev171207.labeled.unicast.routes.LabeledUnicastRoutes;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev180329.labeled.unicast.ipv6.routes.LabeledUnicastIpv6Routes;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev180329.labeled.unicast.routes.LabeledUnicastRoutes;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
diff --git a/infra/northbound/bgp-extensions/linkstate/src/main/java/io/fd/honeycomb/northbound/bgp/extension/LinkstateModule.java b/infra/northbound/bgp-extensions/linkstate/src/main/java/io/fd/honeycomb/northbound/bgp/extension/LinkstateModule.java
index ca98b6d51..fbd46e54d 100644
--- a/infra/northbound/bgp-extensions/linkstate/src/main/java/io/fd/honeycomb/northbound/bgp/extension/LinkstateModule.java
+++ b/infra/northbound/bgp-extensions/linkstate/src/main/java/io/fd/honeycomb/northbound/bgp/extension/LinkstateModule.java
@@ -30,11 +30,11 @@ import org.opendaylight.protocol.bgp.parser.spi.BGPExtensionProviderActivator;
import org.opendaylight.protocol.bgp.rib.spi.RIBExtensionProviderActivator;
import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.AfiSafi;
import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.AfiSafiBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.LinkstateAddressFamily;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.LinkstateSubsequentAddressFamily;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev171207.AfiSafi2;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev171207.AfiSafi2Builder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev171207.LINKSTATE;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.LinkstateAddressFamily;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.LinkstateSubsequentAddressFamily;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.LINKSTATE;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.NeighborAddPathsConfig;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.NeighborAddPathsConfigBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -81,8 +81,8 @@ public class LinkstateModule extends AbstractBgpExtensionModule {
@Override
public AfiSafi get() {
return new AfiSafiBuilder().setAfiSafiName(LINKSTATE.class)
- .addAugmentation(AfiSafi2.class,
- new AfiSafi2Builder().setReceive(cfg.isBgpMultiplePathsEnabled())
+ .addAugmentation(NeighborAddPathsConfig.class,
+ new NeighborAddPathsConfigBuilder().setReceive(cfg.isBgpMultiplePathsEnabled())
.setSendMax(cfg.bgpSendMaxMaths.get().shortValue()).build())
.build();
}
diff --git a/infra/northbound/bgp-extensions/linkstate/src/main/java/io/fd/honeycomb/northbound/bgp/extension/LinkstateWriterFactory.java b/infra/northbound/bgp-extensions/linkstate/src/main/java/io/fd/honeycomb/northbound/bgp/extension/LinkstateWriterFactory.java
index bcb3f684a..6738fdda3 100644
--- a/infra/northbound/bgp-extensions/linkstate/src/main/java/io/fd/honeycomb/northbound/bgp/extension/LinkstateWriterFactory.java
+++ b/infra/northbound/bgp-extensions/linkstate/src/main/java/io/fd/honeycomb/northbound/bgp/extension/LinkstateWriterFactory.java
@@ -25,7 +25,7 @@ import io.fd.honeycomb.translate.write.WriterFactory;
import io.fd.honeycomb.translate.write.registry.ModifiableWriterRegistryBuilder;
import javax.annotation.Nonnull;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.linkstate.routes.LinkstateRoutes;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.linkstate.routes.LinkstateRoutes;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
public class LinkstateWriterFactory implements WriterFactory {
diff --git a/infra/northbound/bgp/pom.xml b/infra/northbound/bgp/pom.xml
index f41e623fe..f8538f514 100644
--- a/infra/northbound/bgp/pom.xml
+++ b/infra/northbound/bgp/pom.xml
@@ -79,6 +79,11 @@
<groupId>org.opendaylight.bgpcep</groupId>
<artifactId>bgp-rib-impl</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.opendaylight.bgpcep</groupId>
+ <artifactId>bgp-openconfig-rp-impl</artifactId>
+ <version>${odl.bgpcep.version}</version>
+ </dependency>
<!-- test dependencies -->
<dependency>
diff --git a/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/ApplicationRibWriterFactory.java b/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/ApplicationRibWriterFactory.java
index 05a2a9602..9ff55207b 100644
--- a/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/ApplicationRibWriterFactory.java
+++ b/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/ApplicationRibWriterFactory.java
@@ -23,8 +23,8 @@ import io.fd.honeycomb.translate.util.write.BindingBrokerWriter;
import io.fd.honeycomb.translate.write.WriterFactory;
import io.fd.honeycomb.translate.write.registry.ModifiableWriterRegistryBuilder;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.ApplicationRib;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.rib.Tables;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.ApplicationRib;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.Tables;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
/**
diff --git a/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BgpConfiguration.java b/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BgpConfiguration.java
index b651c4c0a..2c6c17c92 100644
--- a/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BgpConfiguration.java
+++ b/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BgpConfiguration.java
@@ -18,9 +18,17 @@ package io.fd.honeycomb.infra.bgp;
import com.google.common.base.MoreObjects;
import java.util.Optional;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
import net.jmob.guice.conf.core.BindConfig;
import net.jmob.guice.conf.core.InjectConfig;
import net.jmob.guice.conf.core.Syntax;
+import org.opendaylight.protocol.bgp.rib.impl.config.PeerGroupConfigLoader;
+import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.ConfigBuilder;
+import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.peer.group.PeerGroup;
+import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.peer.group.PeerGroupBuilder;
+import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.top.Bgp;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
/**
* This is the Java equivalent for bgp.json file. We use guice-config library to load all the config attributes into
@@ -29,7 +37,7 @@ import net.jmob.guice.conf.core.Syntax;
* The BindConfig annotation tells that bgp.json file should be looked up on classpath root.
*/
@BindConfig(value = "bgp", syntax = Syntax.JSON)
-public class BgpConfiguration {
+public class BgpConfiguration implements PeerGroupConfigLoader {
@InjectConfig("bgp-binding-address")
public Optional<String> bgpBindingAddress;
@@ -65,4 +73,11 @@ public class BgpConfiguration {
.add("bgpNettyThreads", bgpNettyThreads)
.toString();
}
+
+ @Nullable
+ @Override
+ public PeerGroup getPeerGroup(@Nonnull final InstanceIdentifier<Bgp> instanceIdentifier,
+ @Nonnull final String neighbor) {
+ return new PeerGroupBuilder().setConfig(new ConfigBuilder().build()).build();
+ }
}
diff --git a/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BgpModule.java b/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BgpModule.java
index 6aab7c6ca..7123caf14 100644
--- a/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BgpModule.java
+++ b/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BgpModule.java
@@ -47,6 +47,8 @@ public final class BgpModule extends PrivateModule {
// Create BGPDispatcher BGPDispatcher for creating BGP clients
bind(EventLoopGroup.class).toProvider(BgpNettyThreadGroupProvider.class).in(Singleton.class);
bind(BGPDispatcher.class).toProvider(BGPDispatcherImplProvider.class).in(Singleton.class);
+ // Bind BgpPolicy configuration before RIB is initialized
+ install(new BgpPolicyConfigurationModule());
configureRIB();
diff --git a/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BgpPolicyConfiguration.java b/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BgpPolicyConfiguration.java
new file mode 100644
index 000000000..911cbfd86
--- /dev/null
+++ b/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BgpPolicyConfiguration.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2018 Cisco and/or its affiliates.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package io.fd.honeycomb.infra.bgp;
+
+import com.google.common.base.MoreObjects;
+import java.util.Collections;
+import java.util.Optional;
+import net.jmob.guice.conf.core.BindConfig;
+import net.jmob.guice.conf.core.InjectConfig;
+import net.jmob.guice.conf.core.Syntax;
+import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.routing.policy.rev151009.DefaultPolicyType;
+import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.routing.policy.rev151009.apply.policy.group.apply.policy.Config;
+import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.routing.policy.rev151009.apply.policy.group.apply.policy.ConfigBuilder;
+
+/**
+ * This is the Java equivalent for bgp-policy.json file. We use guice-config library to load all the config attributes
+ * into this class instance.
+ *
+ * The BindConfig annotation tells that bgp-policy.json file should be looked up on classpath root.
+ *
+ * For now we support only default actions for import and export policies (ACCEPT-ROUTE or REJECT-ROUTE)
+ */
+
+// TODO (HONEYCOMB-446) Add full support of initial configuration for BGP policy.
+@BindConfig(value = "bgp-policy", syntax = Syntax.JSON)
+public class BgpPolicyConfiguration {
+
+ @InjectConfig("default-import-policy")
+ public Optional<String> defaultImportPolicy;
+ @InjectConfig("default-export-policy")
+ public Optional<String> defaultExportPolicy;
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("default-import-policy", defaultImportPolicy)
+ .add("default-export-policy", defaultExportPolicy)
+ .toString();
+ }
+
+ public Optional<Config> getPolicyConfig() {
+ if (defaultImportPolicy.isPresent() && defaultExportPolicy.isPresent()) {
+ Config config = new ConfigBuilder()
+ .setDefaultImportPolicy(
+ DefaultPolicyType.valueOf(defaultImportPolicy.get().replace("-", "")))
+ .setDefaultExportPolicy(
+ DefaultPolicyType.valueOf(defaultExportPolicy.get().replace("-", "")))
+ .setImportPolicy(Collections.emptyList())
+ .setExportPolicy(Collections.emptyList())
+ .build();
+ return Optional.of(config);
+ } else {
+ return Optional.empty();
+ }
+ }
+}
diff --git a/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BgpPolicyConfigurationModule.java b/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BgpPolicyConfigurationModule.java
new file mode 100644
index 000000000..3137150c3
--- /dev/null
+++ b/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BgpPolicyConfigurationModule.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2018 Cisco and/or its affiliates.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package io.fd.honeycomb.infra.bgp;
+
+import com.google.inject.AbstractModule;
+import net.jmob.guice.conf.core.ConfigurationModule;
+
+/**
+ * Load the configuration from json into HoneycombConfiguration and make it available.
+ */
+final class BgpPolicyConfigurationModule extends AbstractModule {
+
+ @Override
+ protected void configure() {
+ install(ConfigurationModule.create());
+ // Inject non-dependency configuration
+ requestInjection(BgpPolicyConfiguration.class);
+ }
+
+}
diff --git a/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BgpRIBProvider.java b/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BgpRIBProvider.java
index 76b34d5eb..8ced20b80 100644
--- a/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BgpRIBProvider.java
+++ b/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BgpRIBProvider.java
@@ -16,36 +16,38 @@
package io.fd.honeycomb.infra.bgp;
-import static org.opendaylight.protocol.bgp.rib.impl.config.OpenConfigMappingUtil.toTableTypes;
-
+import com.google.common.base.Preconditions;
import com.google.inject.Inject;
+import com.google.inject.name.Named;
import io.fd.honeycomb.binding.init.ProviderTrait;
import io.fd.honeycomb.data.init.ShutdownHandler;
import java.util.ArrayList;
-import java.util.Map;
+import java.util.Collections;
+import java.util.List;
+import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.binding.impl.BindingToNormalizedNodeCodec;
import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
import org.opendaylight.controller.md.sal.dom.broker.impl.PingPongDataBroker;
-import org.opendaylight.controller.sal.core.api.model.SchemaService;
-import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonService;
-import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider;
-import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceRegistration;
-import org.opendaylight.protocol.bgp.mode.api.PathSelectionMode;
+import org.opendaylight.mdsal.dom.api.DOMSchemaService;
+import org.opendaylight.protocol.bgp.openconfig.routing.policy.impl.BGPRibRoutingPolicyFactoryImpl;
+import org.opendaylight.protocol.bgp.openconfig.routing.policy.spi.registry.StatementRegistry;
import org.opendaylight.protocol.bgp.openconfig.spi.BGPTableTypeRegistryConsumer;
+import org.opendaylight.protocol.bgp.rib.impl.CodecsRegistryImpl;
import org.opendaylight.protocol.bgp.rib.impl.RIBImpl;
-import org.opendaylight.protocol.bgp.rib.impl.config.OpenConfigMappingUtil;
import org.opendaylight.protocol.bgp.rib.impl.spi.BGPDispatcher;
import org.opendaylight.protocol.bgp.rib.impl.spi.RIB;
import org.opendaylight.protocol.bgp.rib.spi.RIBExtensionConsumerContext;
+import org.opendaylight.protocol.bgp.rib.spi.policy.BGPRibRoutingPolicy;
import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.AfiSafi;
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.rev171207.RibId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.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;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.BgpTableType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.RibId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.BgpId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.ClusterIdentifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -55,6 +57,8 @@ final class BgpRIBProvider extends ProviderTrait<RIB> {
@Inject
private BgpConfiguration cfg;
@Inject
+ private BgpPolicyConfiguration policyCfg;
+ @Inject
private RIBExtensionConsumerContext extensions;
@Inject
private BGPDispatcher dispatcher;
@@ -63,9 +67,12 @@ final class BgpRIBProvider extends ProviderTrait<RIB> {
@Inject
private DOMDataBroker domBroker;
@Inject
+ @Named(BgpModule.HONEYCOMB_BGP)
+ private DataBroker dataBroker;
+ @Inject
private BGPTableTypeRegistryConsumer tableTypeRegistry;
@Inject
- private SchemaService schemaService;
+ private DOMSchemaService schemaService;
@Inject
private ShutdownHandler shutdownHandler;
@Inject
@@ -73,6 +80,8 @@ final class BgpRIBProvider extends ProviderTrait<RIB> {
@Override
protected RIB create() {
+ Preconditions.checkArgument(policyCfg.getPolicyConfig().isPresent(),
+ "Bgp policy configuration failed to load. Check bgp-policy.json configuration file.");
final AsNumber asNumber = new AsNumber(cfg.bgpAsNumber.get().longValue());
final Ipv4Address routerId = new Ipv4Address(cfg.bgpBindingAddress.get());
final ClusterIdentifier clusterId = new ClusterIdentifier(routerId);
@@ -81,17 +90,18 @@ final class BgpRIBProvider extends ProviderTrait<RIB> {
// TODO(HONEYCOMB-363): configure other BGP Multiprotocol extensions:
final ArrayList<AfiSafi> afiSafiList = new ArrayList<>(configuredAfiSafis);
- final Map<TablesKey, PathSelectionMode> pathSelectionModes =
- OpenConfigMappingUtil.toPathSelectionMode(afiSafiList, tableTypeRegistry)
- .entrySet().stream().collect(Collectors.toMap(entry ->
- new TablesKey(entry.getKey().getAfi(), entry.getKey().getSafi()), Map.Entry::getValue));
// based on org.opendaylight.protocol.bgp.rib.impl.config.RibImpl.createRib
final PingPongDataBroker pingPongDataBroker = new PingPongDataBroker(domBroker);
- final RIBImpl rib =
- new RIBImpl(new RibId(cfg.bgpProtocolInstanceName.get()),
- asNumber, new BgpId(routerId), clusterId, extensions, dispatcher, codec,
- pingPongDataBroker, toTableTypes(afiSafiList, tableTypeRegistry), pathSelectionModes,
- extensions.getClassLoadingStrategy());
+ final CodecsRegistryImpl codecsRegistry =
+ CodecsRegistryImpl.create(codec, extensions.getClassLoadingStrategy());
+ final BGPRibRoutingPolicyFactoryImpl bgpRibRoutingPolicyFactory =
+ new BGPRibRoutingPolicyFactoryImpl(dataBroker, new StatementRegistry());
+ final BGPRibRoutingPolicy ribPolicies = bgpRibRoutingPolicyFactory
+ .buildBGPRibPolicy(cfg.bgpAsNumber.get(), new Ipv4Address(cfg.bgpBindingAddress.get()), clusterId,
+ policyCfg.getPolicyConfig().get());
+ final RIBImpl rib = new RIBImpl(tableTypeRegistry, new RibId(cfg.bgpProtocolInstanceName.get()),
+ asNumber, new BgpId(routerId), extensions, dispatcher, codecsRegistry, pingPongDataBroker, dataBroker,
+ ribPolicies, toTableTypes(afiSafiList, tableTypeRegistry), Collections.emptyMap());
rib.instantiateServiceInstance();
// required for proper RIB's CodecRegistry initialization (based on RIBImpl.start)
@@ -101,26 +111,13 @@ final class BgpRIBProvider extends ProviderTrait<RIB> {
return rib;
}
- /**
- * HC does not support clustering, but BGP uses {@link ClusterSingletonServiceProvider} to initialize {@link
- * RIBImpl}. Therefore we provide this dummy implementation.
- */
- private static final class NoopClusterSingletonServiceProvider implements ClusterSingletonServiceProvider {
- private static final Logger LOG = LoggerFactory.getLogger(NoopClusterSingletonServiceProvider.class);
-
- private static final ClusterSingletonServiceRegistration REGISTRATION =
- () -> LOG.debug("Closing ClusterSingletonServiceRegistration");
-
- @Override
- public ClusterSingletonServiceRegistration registerClusterSingletonService(
- final ClusterSingletonService clusterSingletonService) {
- clusterSingletonService.instantiateServiceInstance();
- return REGISTRATION;
- }
-
- @Override
- public void close() throws Exception {
- LOG.debug("Closing NoopClusterSingletonServiceProvider");
- }
+ private List<BgpTableType> toTableTypes(final List<AfiSafi> afiSafis,
+ final BGPTableTypeRegistryConsumer tableTypeRegistry) {
+ return afiSafis.stream()
+ .filter(afiSafi -> afiSafi.getAfiSafiName()!=null)
+ .map(afiSafi -> tableTypeRegistry.getTableType(afiSafi.getAfiSafiName()))
+ .filter(Optional::isPresent)
+ .map(Optional::get)
+ .collect(Collectors.toList());
}
}
diff --git a/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BgpReaderFactoryProvider.java b/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BgpReaderFactoryProvider.java
index 6f5bd5066..7ae724696 100644
--- a/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BgpReaderFactoryProvider.java
+++ b/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/BgpReaderFactoryProvider.java
@@ -24,8 +24,8 @@ import io.fd.honeycomb.translate.read.registry.ModifiableReaderRegistryBuilder;
import io.fd.honeycomb.translate.util.read.BindingBrokerReader;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.BgpRib;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.BgpRibBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.BgpRib;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.BgpRibBuilder;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
final class BgpReaderFactoryProvider extends ProviderTrait<ReaderFactory> {
diff --git a/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/neighbors/BgpPeerWriterFactory.java b/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/neighbors/BgpPeerWriterFactory.java
index 5e924be7e..e844cf3e0 100644
--- a/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/neighbors/BgpPeerWriterFactory.java
+++ b/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/neighbors/BgpPeerWriterFactory.java
@@ -22,6 +22,7 @@ import io.fd.honeycomb.translate.impl.write.GenericListWriter;
import io.fd.honeycomb.translate.write.WriterFactory;
import io.fd.honeycomb.translate.write.registry.ModifiableWriterRegistryBuilder;
import javax.annotation.Nonnull;
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.protocol.bgp.openconfig.spi.BGPTableTypeRegistryConsumer;
import org.opendaylight.protocol.bgp.rib.impl.spi.BGPPeerRegistry;
import org.opendaylight.protocol.bgp.rib.impl.spi.RIB;
@@ -32,8 +33,9 @@ import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.network.instance.re
import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.network.instance.rev151018.network.instance.top.network.instances.NetworkInstance;
import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.network.instance.rev151018.network.instance.top.network.instances.network.instance.Protocols;
import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.network.instance.rev151018.network.instance.top.network.instances.network.instance.protocols.Protocol;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev171207.Protocol1;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.NetworkInstanceProtocol;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.osgi.framework.BundleContext;
/**
* Initializes writer for Bgp Neighbors ({@link Neighbor} node) and all its parents required by HC infra.
@@ -47,7 +49,8 @@ public final class BgpPeerWriterFactory implements WriterFactory {
NETWORK_INSTANCE_ID.child(Protocols.class).child(Protocol.class);
private static final InstanceIdentifier<Neighbor> NEIGHBOR_ID =
- PROTOCOL_ID.augmentation(Protocol1.class).child(Bgp.class).child(Neighbors.class).child(Neighbor.class);
+ PROTOCOL_ID.augmentation(NetworkInstanceProtocol.class).child(Bgp.class).child(Neighbors.class)
+ .child(Neighbor.class);
@Inject
private BgpConfiguration configuration;
@@ -74,7 +77,8 @@ public final class BgpPeerWriterFactory implements WriterFactory {
// Bgp
// Neighbors
// Neighbor=
- registry.wildcardedSubtreeAdd(new GenericListWriter<>(NEIGHBOR_ID, new NeighborCustomizer(globalRib, peerRegistry, tableTypeRegistry)));
+ registry.wildcardedSubtreeAdd(new GenericListWriter<>(NEIGHBOR_ID, new NeighborCustomizer(globalRib, peerRegistry,
+ tableTypeRegistry, configuration)));
}
}
diff --git a/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/neighbors/NeighborCustomizer.java b/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/neighbors/NeighborCustomizer.java
index cdaffb6f6..ebe5795f1 100644
--- a/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/neighbors/NeighborCustomizer.java
+++ b/infra/northbound/bgp/src/main/java/io/fd/honeycomb/infra/bgp/neighbors/NeighborCustomizer.java
@@ -18,9 +18,9 @@ package io.fd.honeycomb.infra.bgp.neighbors;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Preconditions.checkState;
-import static org.opendaylight.protocol.bgp.rib.impl.config.OpenConfigMappingUtil.isApplicationPeer;
import com.google.common.annotations.VisibleForTesting;
+import io.fd.honeycomb.infra.bgp.BgpConfiguration;
import io.fd.honeycomb.translate.spi.write.ListWriterCustomizer;
import io.fd.honeycomb.translate.write.WriteContext;
import io.fd.honeycomb.translate.write.WriteFailedException;
@@ -33,10 +33,19 @@ import org.opendaylight.protocol.bgp.openconfig.spi.BGPTableTypeRegistryConsumer
import org.opendaylight.protocol.bgp.rib.impl.config.AppPeer;
import org.opendaylight.protocol.bgp.rib.impl.config.BgpPeer;
import org.opendaylight.protocol.bgp.rib.impl.config.PeerBean;
+import org.opendaylight.protocol.bgp.rib.impl.config.PeerGroupConfigLoader;
import org.opendaylight.protocol.bgp.rib.impl.spi.BGPPeerRegistry;
import org.opendaylight.protocol.bgp.rib.impl.spi.RIB;
+import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.Config;
import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbors.Neighbor;
import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbors.NeighborKey;
+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.network.instance.rev151018.network.instance.top.NetworkInstances;
+import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.network.instance.rev151018.network.instance.top.network.instances.NetworkInstance;
+import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.network.instance.rev151018.network.instance.top.network.instances.network.instance.Protocols;
+import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.network.instance.rev151018.network.instance.top.network.instances.network.instance.protocols.Protocol;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.NeighborPeerGroupConfig;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.NetworkInstanceProtocol;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -50,17 +59,24 @@ final class NeighborCustomizer implements ListWriterCustomizer<Neighbor, Neighbo
private static final Logger LOG = LoggerFactory.getLogger(NeighborCustomizer.class);
private final RIB globalRib;
private final BGPPeerRegistry peerRegistry;
+ private final PeerGroupConfigLoader peerGroupLoader;
private BGPTableTypeRegistryConsumer tableTypeRegistry;
+ @VisibleForTesting
+ static final InstanceIdentifier<Bgp> bgpIid = InstanceIdentifier.create(NetworkInstances.class)
+ .child(NetworkInstance.class).child(Protocols.class).child(Protocol.class).augmentation(
+ NetworkInstanceProtocol.class).child(Bgp.class);
@GuardedBy("this")
private final Map<InstanceIdentifier<Neighbor>, PeerBean> peers = new HashMap<>();
public NeighborCustomizer(@Nonnull final RIB globalRib, @Nonnull final BGPPeerRegistry peerRegistry,
- @Nonnull final BGPTableTypeRegistryConsumer tableTypeRegistry) {
+ @Nonnull final BGPTableTypeRegistryConsumer tableTypeRegistry,
+ final BgpConfiguration configuration) {
this.globalRib = checkNotNull(globalRib, "globalRib should not be null");
- this.peerRegistry = checkNotNull(peerRegistry, "globalRib should not be null");
+ this.peerRegistry = checkNotNull(peerRegistry, "peerRegistry should not be null");
this.tableTypeRegistry = checkNotNull(tableTypeRegistry, "tableTypeRegistry should not be null");
+ this.peerGroupLoader = checkNotNull(configuration, "configuration should not be null");
}
@VisibleForTesting
@@ -80,7 +96,7 @@ final class NeighborCustomizer implements ListWriterCustomizer<Neighbor, Neighbo
@Nonnull final WriteContext writeContext)
throws WriteFailedException {
final PeerBean peer;
- if (isApplicationPeer(neighbor)) {
+ if (isAppPeer(neighbor)) {
LOG.debug("Creating AppPeer bean for {}: {}", id, neighbor);
peer = new AppPeer();
} else {
@@ -88,11 +104,23 @@ final class NeighborCustomizer implements ListWriterCustomizer<Neighbor, Neighbo
peer = new BgpPeer(null);
}
LOG.debug("Starting bgp peer for {}", id);
- peer.start(globalRib, neighbor, tableTypeRegistry);
+ peer.start(globalRib, neighbor, bgpIid, peerGroupLoader, tableTypeRegistry);
peer.instantiateServiceInstance();
addPeer(id, peer);
}
+ static boolean isAppPeer(final Neighbor neighbor) {
+ Config config = neighbor.getConfig();
+ if (config != null) {
+ NeighborPeerGroupConfig config1 = config.augmentation(NeighborPeerGroupConfig.class);
+ if (config1 != null) {
+ String peerGroup = config1.getPeerGroup();
+ return peerGroup != null && peerGroup.equals("application-peers");
+ }
+ }
+ return false;
+ }
+
@Override
public synchronized void updateCurrentAttributes(@Nonnull final InstanceIdentifier<Neighbor> id,
@Nonnull final Neighbor dataBefore,
@@ -103,7 +131,7 @@ final class NeighborCustomizer implements ListWriterCustomizer<Neighbor, Neighbo
final PeerBean peer = peers.get(id);
checkState(peer != null, "Could not find peer bean while updating neighbor {}", id);
closePeerBean(peer);
- peer.start(globalRib, dataAfter, tableTypeRegistry);
+ peer.start(globalRib, dataAfter, bgpIid, peerGroupLoader, tableTypeRegistry);
peer.instantiateServiceInstance();
LOG.debug("Peer instance updated {}", peer);
}
diff --git a/infra/northbound/bgp/src/main/resources/honeycomb-minimal-resources/config/bgp-policy.json b/infra/northbound/bgp/src/main/resources/honeycomb-minimal-resources/config/bgp-policy.json
new file mode 100644
index 000000000..01abb6905
--- /dev/null
+++ b/infra/northbound/bgp/src/main/resources/honeycomb-minimal-resources/config/bgp-policy.json
@@ -0,0 +1,4 @@
+{
+ "default-import-policy": "ACCEPT-ROUTE",
+ "default-export-policy": "ACCEPT-ROUTE"
+} \ No newline at end of file
diff --git a/infra/northbound/bgp/src/test/java/io/fd/honeycomb/infra/bgp/neighbors/NeighborCustomizerTest.java b/infra/northbound/bgp/src/test/java/io/fd/honeycomb/infra/bgp/neighbors/NeighborCustomizerTest.java
index 64e0b9bd1..fadef81ab 100644
--- a/infra/northbound/bgp/src/test/java/io/fd/honeycomb/infra/bgp/neighbors/NeighborCustomizerTest.java
+++ b/infra/northbound/bgp/src/test/java/io/fd/honeycomb/infra/bgp/neighbors/NeighborCustomizerTest.java
@@ -25,12 +25,18 @@ import static org.mockito.Mockito.when;
import static org.mockito.MockitoAnnotations.initMocks;
import com.google.common.util.concurrent.CheckedFuture;
+import com.google.common.util.concurrent.FluentFuture;
+import com.google.common.util.concurrent.Futures;
+import io.fd.honeycomb.infra.bgp.BgpConfiguration;
import io.fd.honeycomb.translate.write.WriteContext;
import io.fd.honeycomb.translate.write.WriteFailedException;
import java.util.Collections;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
+import org.opendaylight.controller.md.sal.binding.api.BindingTransactionChain;
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
import org.opendaylight.controller.md.sal.dom.api.DOMDataTreeChangeService;
import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
import org.opendaylight.controller.md.sal.dom.api.DOMTransactionChain;
@@ -38,9 +44,10 @@ import org.opendaylight.protocol.bgp.openconfig.spi.BGPTableTypeRegistryConsumer
import org.opendaylight.protocol.bgp.rib.impl.config.PeerBean;
import org.opendaylight.protocol.bgp.rib.impl.spi.BGPDispatcher;
import org.opendaylight.protocol.bgp.rib.impl.spi.BGPPeerRegistry;
-import org.opendaylight.protocol.bgp.rib.impl.spi.ImportPolicyPeerTracker;
import org.opendaylight.protocol.bgp.rib.impl.spi.RIB;
import org.opendaylight.protocol.bgp.rib.impl.spi.RIBSupportContextRegistry;
+import org.opendaylight.protocol.bgp.rib.spi.BGPPeerTracker;
+import org.opendaylight.protocol.bgp.rib.spi.policy.BGPRibRoutingPolicy;
import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.AfiSafiBuilder;
import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.AfiSafisBuilder;
import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.ConfigBuilder;
@@ -50,14 +57,15 @@ 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.top.bgp.Neighbors;
import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.types.rev151009.IPV4UNICAST;
import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.types.rev151009.PeerType;
+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.Ipv4Address;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev171207.Config2;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev171207.Config2Builder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.BgpRib;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.RibId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.bgp.rib.Rib;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.bgp.rib.RibKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.NeighborPeerGroupConfig;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.NeighborPeerGroupConfigBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.BgpRib;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.RibId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.bgp.rib.Rib;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.bgp.rib.RibKey;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
@@ -78,41 +86,60 @@ public class NeighborCustomizerTest {
@Mock
private WriteContext ctx;
@Mock
- private DOMTransactionChain chain;
+ private BindingTransactionChain chain;
@Mock
- private DOMDataWriteTransaction tx;
+ private DOMTransactionChain domChain;
+ @Mock
+ private DOMDataWriteTransaction domTx;
+ @Mock
+ private WriteTransaction tx;
@Mock
private BGPDispatcher dispatcher;
private NeighborCustomizer customizer;
+ @Mock
+ private DataBroker dataBroker;
+ @Mock
+ private BgpConfiguration configuration;
@Before
public void setUp() {
initMocks(this);
when(globalRib.getYangRibId()).thenReturn(YangInstanceIdentifier.EMPTY);
when(globalRib.getInstanceIdentifier()).thenReturn(RIB_IID);
+ when(globalRib.getRibPolicies()).thenReturn(mock(BGPRibRoutingPolicy.class));
+
+ when(globalRib.createPeerDOMChain(any())).thenReturn(domChain);
+ when(domChain.newWriteOnlyTransaction()).thenReturn(domTx);
+ when(domTx.commit()).thenReturn(FluentFuture.from(Futures.immediateFuture(null)));
+
when(globalRib.createPeerChain(any())).thenReturn(chain);
when(chain.newWriteOnlyTransaction()).thenReturn(tx);
when(tx.submit()).thenReturn(mock(CheckedFuture.class));
- when(globalRib.getImportPolicyPeerTracker()).thenReturn(mock(ImportPolicyPeerTracker.class));
when(globalRib.getRibSupportContext()).thenReturn(mock(RIBSupportContextRegistry.class));
when(globalRib.getService()).thenReturn(mock(DOMDataTreeChangeService.class));
when(globalRib.getDispatcher()).thenReturn(dispatcher);
+ when(globalRib.getLocalAs()).thenReturn(new AsNumber(65000L));
+ when(globalRib.getDataBroker()).thenReturn(dataBroker);
+ when(globalRib.getPeerTracker()).thenReturn(mock(BGPPeerTracker.class));
when(dispatcher.getBGPPeerRegistry()).thenReturn(peerRegistry);
- customizer = new NeighborCustomizer(globalRib, peerRegistry, tableTypeRegistry);
+ when(dataBroker.newWriteOnlyTransaction()).thenReturn(tx);
+ when(tx.commit()).thenReturn(FluentFuture.from(Futures.immediateFuture(null)));
+
+ customizer = new NeighborCustomizer(globalRib, peerRegistry, tableTypeRegistry, configuration);
}
@Test
public void testAddAppPeer() throws WriteFailedException {
final Neighbor neighbor = new NeighborBuilder()
- .setNeighborAddress(IP)
- .setConfig(
- new ConfigBuilder()
- .addAugmentation(
- Config2.class,
- new Config2Builder().setPeerGroup("application-peers").build()
- ).build())
- .build();
+ .setNeighborAddress(IP)
+ .setConfig(
+ new ConfigBuilder()
+ .addAugmentation(
+ NeighborPeerGroupConfig.class,
+ new NeighborPeerGroupConfigBuilder().setPeerGroup("application-peers").build())
+ .build())
+ .build();
customizer.writeCurrentAttributes(ID, neighbor, ctx);
assertTrue(customizer.isPeerConfigured(ID));
}
@@ -143,7 +170,7 @@ public class NeighborCustomizerTest {
customizer.updateCurrentAttributes(ID, before, after, ctx);
verify(peer).closeServiceInstance();
verify(peer).close();
- verify(peer).start(globalRib, after, tableTypeRegistry);
+ verify(peer).start(globalRib, after, NeighborCustomizer.bgpIid, configuration, tableTypeRegistry);
}
@Test
diff --git a/infra/northbound/netconf/src/main/java/io/fd/honeycomb/northbound/netconf/HoneycombNotification2NetconfProvider.java b/infra/northbound/netconf/src/main/java/io/fd/honeycomb/northbound/netconf/HoneycombNotification2NetconfProvider.java
index 26ecf3a44..287629288 100644
--- a/infra/northbound/netconf/src/main/java/io/fd/honeycomb/northbound/netconf/HoneycombNotification2NetconfProvider.java
+++ b/infra/northbound/netconf/src/main/java/io/fd/honeycomb/northbound/netconf/HoneycombNotification2NetconfProvider.java
@@ -28,7 +28,7 @@ import javax.annotation.Nonnull;
import org.opendaylight.controller.md.sal.dom.api.DOMNotification;
import org.opendaylight.controller.md.sal.dom.api.DOMNotificationListener;
import org.opendaylight.controller.md.sal.dom.broker.impl.DOMNotificationRouter;
-import org.opendaylight.controller.sal.core.api.model.SchemaService;
+import org.opendaylight.mdsal.dom.api.DOMSchemaService;
import org.opendaylight.netconf.notifications.NetconfNotificationCollector;
import org.opendaylight.netconf.notifications.NotificationPublisherRegistration;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netconf.notification._1._0.rev080714.StreamNameType;
@@ -46,7 +46,7 @@ public final class HoneycombNotification2NetconfProvider
@Inject
private DOMNotificationRouter notificationRouter;
@Inject
- private SchemaService schemaService;
+ private DOMSchemaService schemaService;
@Inject
private NetconfConfiguration cfgAttributes;
@Inject
@@ -112,10 +112,10 @@ public final class HoneycombNotification2NetconfProvider
private final NotificationPublisherRegistration netconfNotifReg;
private final StreamNameType streamType;
- private final SchemaService schemaService;
+ private final DOMSchemaService schemaService;
TranslatingNotificationListener(final NotificationPublisherRegistration netconfNotifReg,
- final StreamNameType streamType, final SchemaService schemaService) {
+ final StreamNameType streamType, final DOMSchemaService schemaService) {
this.netconfNotifReg = netconfNotifReg;
this.streamType = streamType;
this.schemaService = schemaService;
diff --git a/infra/northbound/netconf/src/main/java/io/fd/honeycomb/northbound/netconf/NetconfMdsalMapperProvider.java b/infra/northbound/netconf/src/main/java/io/fd/honeycomb/northbound/netconf/NetconfMdsalMapperProvider.java
index bb9264684..da092b21c 100644
--- a/infra/northbound/netconf/src/main/java/io/fd/honeycomb/northbound/netconf/NetconfMdsalMapperProvider.java
+++ b/infra/northbound/netconf/src/main/java/io/fd/honeycomb/northbound/netconf/NetconfMdsalMapperProvider.java
@@ -23,8 +23,7 @@ import com.google.inject.name.Named;
import io.fd.honeycomb.binding.init.ProviderTrait;
import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
import org.opendaylight.controller.md.sal.dom.api.DOMRpcService;
-import org.opendaylight.controller.sal.core.api.model.SchemaService;
-import org.opendaylight.mdsal.binding.generator.impl.ModuleInfoBackedContext;
+import org.opendaylight.mdsal.dom.api.DOMSchemaService;
import org.opendaylight.netconf.mapping.api.NetconfOperationServiceFactory;
import org.opendaylight.netconf.mapping.api.NetconfOperationServiceFactoryListener;
import org.opendaylight.netconf.mdsal.connector.MdsalNetconfOperationServiceFactory;
@@ -32,12 +31,10 @@ import org.opendaylight.netconf.mdsal.connector.MdsalNetconfOperationServiceFact
public final class NetconfMdsalMapperProvider extends ProviderTrait<NetconfOperationServiceFactory> {
@Inject
- private SchemaService schemaService;
+ private DOMSchemaService schemaService;
@Inject
private NetconfOperationServiceFactoryListener aggregator;
@Inject
- private ModuleInfoBackedContext moduleInfoBackedContext;
- @Inject
@Named(HONEYCOMB_CONFIG)
private DOMDataBroker domBroker;
@Inject
@@ -48,7 +45,8 @@ public final class NetconfMdsalMapperProvider extends ProviderTrait<NetconfOpera
@Override
protected MdsalNetconfOperationServiceFactory create() {
MdsalNetconfOperationServiceFactory mdsalNetconfOperationServiceFactory =
- new MdsalNetconfOperationServiceFactory(schemaService, moduleInfoBackedContext, netconfOperationServiceFactoryListener, domBroker, rpcService);
+ new MdsalNetconfOperationServiceFactory(schemaService, netconfOperationServiceFactoryListener,
+ domBroker, rpcService);
return mdsalNetconfOperationServiceFactory;
}
}
diff --git a/infra/northbound/netconf/src/main/resources/honeycomb-minimal-resources/config/netconf-whitelist.xml b/infra/northbound/netconf/src/main/resources/honeycomb-minimal-resources/config/netconf-whitelist.xml
index 371ee2b18..32e5ed07d 100644
--- a/infra/northbound/netconf/src/main/resources/honeycomb-minimal-resources/config/netconf-whitelist.xml
+++ b/infra/northbound/netconf/src/main/resources/honeycomb-minimal-resources/config/netconf-whitelist.xml
@@ -40,7 +40,7 @@
</description>
</module>
<module>
- <package>org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev130712</package>
+ <package>org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021</package>
<description>
Required for mounting of netconf devices(Operational read does not work without it)
</description>
diff --git a/infra/northbound/restconf/pom.xml b/infra/northbound/restconf/pom.xml
index 7e873bc31..ee07c33ab 100644
--- a/infra/northbound/restconf/pom.xml
+++ b/infra/northbound/restconf/pom.xml
@@ -32,9 +32,10 @@
<name>${project.artifactId}</name>
<properties>
- <jersey.version>1.19.1</jersey.version>
+ <jersey.version>1.19.4</jersey.version>
+ <glassfish-jersey.version>2.25.1</glassfish-jersey.version>
<servlet.version>3.1.0</servlet.version>
- <jetty.version>9.3.11.v20160721</jetty.version>
+ <jetty.version>9.3.21.v20170918</jetty.version>
<yang.modules.whitelist>
${project.basedir}/src/main/resources/honeycomb-minimal-resources/config/restconf-whitelist.xml
</yang.modules.whitelist>
@@ -96,19 +97,14 @@
<version>${jetty.version}</version>
</dependency>
<dependency>
- <groupId>com.sun.jersey</groupId>
+ <groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-server</artifactId>
- <version>${jersey.version}</version>
+ <version>${glassfish-jersey.version}</version>
</dependency>
<dependency>
- <groupId>com.sun.jersey</groupId>
- <artifactId>jersey-core</artifactId>
- <version>${jersey.version}</version>
- </dependency>
- <dependency>
- <groupId>com.sun.jersey</groupId>
- <artifactId>jersey-servlet</artifactId>
- <version>${jersey.version}</version>
+ <groupId>org.glassfish.jersey.containers</groupId>
+ <artifactId>jersey-container-servlet-core</artifactId>
+ <version>${glassfish-jersey.version}</version>
</dependency>
<!-- javax.annotation -->
diff --git a/infra/northbound/restconf/src/main/java/io/fd/honeycomb/northbound/restconf/BrokerFacadeProvider.java b/infra/northbound/restconf/src/main/java/io/fd/honeycomb/northbound/restconf/BrokerFacadeProvider.java
new file mode 100644
index 000000000..f6a7e5e81
--- /dev/null
+++ b/infra/northbound/restconf/src/main/java/io/fd/honeycomb/northbound/restconf/BrokerFacadeProvider.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2018 Cisco and/or its affiliates.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package io.fd.honeycomb.northbound.restconf;
+
+import com.google.inject.Inject;
+import com.google.inject.name.Named;
+import io.fd.honeycomb.binding.init.ProviderTrait;
+import io.fd.honeycomb.infra.distro.data.ConfigAndOperationalPipelineModule;
+import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
+import org.opendaylight.controller.md.sal.dom.api.DOMRpcService;
+import org.opendaylight.controller.md.sal.dom.broker.impl.DOMNotificationRouter;
+import org.opendaylight.netconf.sal.restconf.impl.BrokerFacade;
+import org.opendaylight.netconf.sal.restconf.impl.ControllerContext;
+
+final class BrokerFacadeProvider extends ProviderTrait<BrokerFacade> {
+
+ @Inject
+ @Named(ConfigAndOperationalPipelineModule.HONEYCOMB_CONFIG)
+ private DOMDataBroker domDataBroker;
+ @Inject
+ private DOMRpcService rpcService;
+ @Inject
+ private DOMNotificationRouter notificationService;
+ @Inject
+ private ControllerContext controllerContext;
+
+ @Override
+ protected BrokerFacade create() {
+ BrokerFacade brokerFacade =
+ BrokerFacade.newInstance(rpcService, domDataBroker, notificationService, controllerContext);
+ return brokerFacade;
+ }
+}
diff --git a/infra/northbound/restconf/src/main/java/io/fd/honeycomb/northbound/restconf/ControllerContextProvider.java b/infra/northbound/restconf/src/main/java/io/fd/honeycomb/northbound/restconf/ControllerContextProvider.java
new file mode 100644
index 000000000..909f063d1
--- /dev/null
+++ b/infra/northbound/restconf/src/main/java/io/fd/honeycomb/northbound/restconf/ControllerContextProvider.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018 Cisco and/or its affiliates.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package io.fd.honeycomb.northbound.restconf;
+
+import com.google.inject.Inject;
+import io.fd.honeycomb.binding.init.ProviderTrait;
+import org.opendaylight.controller.md.sal.dom.api.DOMMountPointService;
+import org.opendaylight.mdsal.dom.api.DOMSchemaService;
+import org.opendaylight.netconf.sal.restconf.impl.ControllerContext;
+
+final class ControllerContextProvider extends ProviderTrait<ControllerContext> {
+
+ @Inject
+ private DOMSchemaService schemaService;
+ @Inject
+ private DOMMountPointService mountPointService;
+
+ @Override
+ protected ControllerContext create() {
+ ControllerContext controllerCtx =
+ ControllerContext.newInstance(schemaService, mountPointService, schemaService);
+ return controllerCtx;
+ }
+}
diff --git a/infra/northbound/restconf/src/main/java/io/fd/honeycomb/northbound/restconf/JettyServerProvider.java b/infra/northbound/restconf/src/main/java/io/fd/honeycomb/northbound/restconf/JettyServerProvider.java
index a87459560..8a3ee62f6 100644
--- a/infra/northbound/restconf/src/main/java/io/fd/honeycomb/northbound/restconf/JettyServerProvider.java
+++ b/infra/northbound/restconf/src/main/java/io/fd/honeycomb/northbound/restconf/JettyServerProvider.java
@@ -27,10 +27,21 @@ import org.eclipse.jetty.security.HashLoginService;
import org.eclipse.jetty.security.authentication.BasicAuthenticator;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.handler.gzip.GzipHandler;
+import org.eclipse.jetty.servlet.ServletHolder;
import org.eclipse.jetty.util.security.Constraint;
import org.eclipse.jetty.util.security.Password;
import org.eclipse.jetty.util.thread.QueuedThreadPool;
import org.eclipse.jetty.webapp.WebAppContext;
+import org.glassfish.jersey.server.ResourceConfig;
+import org.glassfish.jersey.servlet.ServletContainer;
+import org.opendaylight.netconf.sal.rest.impl.JsonNormalizedNodeBodyReader;
+import org.opendaylight.netconf.sal.rest.impl.NormalizedNodeJsonBodyWriter;
+import org.opendaylight.netconf.sal.rest.impl.NormalizedNodeXmlBodyWriter;
+import org.opendaylight.netconf.sal.rest.impl.RestconfApplication;
+import org.opendaylight.netconf.sal.rest.impl.RestconfDocumentedExceptionMapper;
+import org.opendaylight.netconf.sal.rest.impl.XmlNormalizedNodeBodyReader;
+import org.opendaylight.netconf.sal.restconf.impl.ControllerContext;
+import org.opendaylight.netconf.sal.restconf.impl.RestconfImpl;
final class JettyServerProvider extends ProviderTrait<Server> {
@@ -41,6 +52,7 @@ final class JettyServerProvider extends ProviderTrait<Server> {
"application/yang.data+xml",
"application/json",
"application/yang.data+json"};
+ public static final String RESTCONF_APP_NAME = "JAXRSRestconf";
@Inject
private RestconfConfiguration cfg;
@@ -48,6 +60,15 @@ final class JettyServerProvider extends ProviderTrait<Server> {
@Inject
private CredentialsConfiguration credentialsCfg;
+ @Inject
+ private RestconfApplication restconfApplication;
+
+ @Inject
+ private RestconfImpl restconf;
+
+ @Inject
+ private ControllerContext controllerContext;
+
@Override
protected Server create() {
Server server = new Server(new QueuedThreadPool(cfg.restPoolMaxSize.get(), cfg.restPoolMinSize.get()));
@@ -62,7 +83,26 @@ final class JettyServerProvider extends ProviderTrait<Server> {
final URL resource = getClass().getResource("/");
WebAppContext webapp = new WebAppContext(resource.getPath(), cfg.restconfRootPath.get());
+ // Create Restconf application implementation for server
+ ResourceConfig resourceConfig = new ResourceConfig();
+ resourceConfig.setApplicationName(RESTCONF_APP_NAME);
+ resourceConfig = resourceConfig.registerInstances(restconf, new NormalizedNodeJsonBodyWriter(),
+ new NormalizedNodeXmlBodyWriter(), new XmlNormalizedNodeBodyReader(controllerContext),
+ new JsonNormalizedNodeBodyReader(controllerContext),
+ new RestconfDocumentedExceptionMapper(controllerContext));
+ // register Restconf Application classes
+ resourceConfig.registerClasses(restconfApplication.getClasses());
+
+ // Create Servlet container which holds configured application
+ ServletContainer servlet = new ServletContainer(resourceConfig);
+ ServletHolder servletHolder = new ServletHolder(RESTCONF_APP_NAME, servlet);
+ // init on startup
+ servletHolder.setInitOrder(1);
+ // set service handler
server.setHandler(getGzip(service, webapp));
+
+ //add servlet with "/*" mapping
+ webapp.addServlet(servletHolder, "/*");
return server;
}
diff --git a/infra/northbound/restconf/src/main/java/io/fd/honeycomb/northbound/restconf/RestconfApplicationProvider.java b/infra/northbound/restconf/src/main/java/io/fd/honeycomb/northbound/restconf/RestconfApplicationProvider.java
new file mode 100644
index 000000000..0f55b4947
--- /dev/null
+++ b/infra/northbound/restconf/src/main/java/io/fd/honeycomb/northbound/restconf/RestconfApplicationProvider.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2018 Cisco and/or its affiliates.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package io.fd.honeycomb.northbound.restconf;
+
+import com.google.inject.Inject;
+import io.fd.honeycomb.binding.init.ProviderTrait;
+import org.opendaylight.netconf.sal.rest.impl.RestconfApplication;
+import org.opendaylight.netconf.sal.restconf.impl.ControllerContext;
+import org.opendaylight.netconf.sal.restconf.impl.StatisticsRestconfServiceWrapper;
+
+public class RestconfApplicationProvider extends ProviderTrait<RestconfApplication> {
+
+ @Inject
+ private ControllerContext controllerContext;
+ @Inject
+ private StatisticsRestconfServiceWrapper statisticsRestconfServiceWrapper;
+
+ @Override
+ protected RestconfApplication create() {
+ return new RestconfApplication(controllerContext, statisticsRestconfServiceWrapper);
+ }
+}
diff --git a/infra/northbound/restconf/src/main/java/io/fd/honeycomb/northbound/restconf/RestconfModule.java b/infra/northbound/restconf/src/main/java/io/fd/honeycomb/northbound/restconf/RestconfModule.java
index 1a59b7298..d2841baef 100644
--- a/infra/northbound/restconf/src/main/java/io/fd/honeycomb/northbound/restconf/RestconfModule.java
+++ b/infra/northbound/restconf/src/main/java/io/fd/honeycomb/northbound/restconf/RestconfModule.java
@@ -23,6 +23,11 @@ import io.fd.honeycomb.northbound.restconf.JettyServerStarter.RestconfJettyServe
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.ServerConnector;
import org.opendaylight.netconf.sal.rest.api.RestConnector;
+import org.opendaylight.netconf.sal.rest.impl.RestconfApplication;
+import org.opendaylight.netconf.sal.restconf.impl.BrokerFacade;
+import org.opendaylight.netconf.sal.restconf.impl.ControllerContext;
+import org.opendaylight.netconf.sal.restconf.impl.RestconfImpl;
+import org.opendaylight.netconf.sal.restconf.impl.StatisticsRestconfServiceWrapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -30,6 +35,7 @@ public class RestconfModule extends NorthboundAbstractModule<RestconfConfigurati
private static final Logger LOG = LoggerFactory.getLogger(RestconfModule.class);
+ public static final String HONEYCOMB_RESTCONF = "honeycomb-restconf";
public static final String RESTCONF_HTTP = "restconf-http";
public static final String RESTCONF_HTTPS = "restconf-https";
@@ -46,6 +52,12 @@ public class RestconfModule extends NorthboundAbstractModule<RestconfConfigurati
LOG.info("Starting RESTCONF Northbound");
install(new RestconfConfigurationModule());
+ bind(ControllerContext.class).toProvider(ControllerContextProvider.class).in(Singleton.class);
+ bind(BrokerFacade.class).toProvider(BrokerFacadeProvider.class).in(Singleton.class);
+ bind(RestconfImpl.class).toProvider(RestconfServiceProvider.class).in(Singleton.class);
+ bind(StatisticsRestconfServiceWrapper.class)
+ .toProvider(StatisticsRestconfServiceWrapperProvider.class).in(Singleton.class);
+ bind(RestconfApplication.class).toProvider(RestconfApplicationProvider.class).in(Singleton.class);
bind(Server.class).toProvider(JettyServerProvider.class).in(Singleton.class);
bind(ServerConnector.class).annotatedWith(Names.named(RESTCONF_HTTP))
.toProvider(HttpConnectorProvider.class)
diff --git a/infra/northbound/restconf/src/main/java/io/fd/honeycomb/northbound/restconf/RestconfProvider.java b/infra/northbound/restconf/src/main/java/io/fd/honeycomb/northbound/restconf/RestconfProvider.java
index a3b3fe902..85caf6621 100644
--- a/infra/northbound/restconf/src/main/java/io/fd/honeycomb/northbound/restconf/RestconfProvider.java
+++ b/infra/northbound/restconf/src/main/java/io/fd/honeycomb/northbound/restconf/RestconfProvider.java
@@ -17,17 +17,11 @@
package io.fd.honeycomb.northbound.restconf;
import com.google.inject.Inject;
-import com.google.inject.name.Named;
import io.fd.honeycomb.binding.init.ProviderTrait;
import io.fd.honeycomb.data.init.ShutdownHandler;
-import io.fd.honeycomb.infra.distro.data.ConfigAndOperationalPipelineModule;
-import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
-import org.opendaylight.controller.md.sal.dom.api.DOMMountPointService;
-import org.opendaylight.controller.md.sal.dom.api.DOMRpcService;
-import org.opendaylight.controller.md.sal.dom.broker.impl.DOMNotificationRouter;
-import org.opendaylight.controller.sal.core.api.model.SchemaService;
import org.opendaylight.netconf.sal.rest.api.RestConnector;
import org.opendaylight.netconf.sal.restconf.impl.RestconfProviderImpl;
+import org.opendaylight.netconf.sal.restconf.impl.StatisticsRestconfServiceWrapper;
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;
@@ -36,27 +30,15 @@ final class RestconfProvider extends ProviderTrait<RestConnector> {
@Inject
private RestconfConfiguration cfg;
@Inject
- @Named(ConfigAndOperationalPipelineModule.HONEYCOMB_CONFIG)
- private DOMDataBroker domDataBroker;
- @Inject
- private SchemaService schemaService;
- @Inject
- private DOMRpcService rpcService;
- @Inject
- private DOMNotificationRouter notificationService;
- @Inject
private ShutdownHandler shutdownHandler;
@Inject
- private DOMMountPointService mountPointService;
+ private StatisticsRestconfServiceWrapper statsServiceWrapper;
@Override
protected RestconfProviderImpl create() {
- final RestconfProviderImpl instance = new RestconfProviderImpl(domDataBroker, schemaService, rpcService,
- notificationService, mountPointService,
- schemaService,
- IpAddressBuilder.getDefaultInstance(cfg.restconfWebsocketAddress.get()),
- new PortNumber(cfg.restconfWebsocketPort.get()));
-
+ final RestconfProviderImpl instance = new RestconfProviderImpl(statsServiceWrapper,
+ IpAddressBuilder.getDefaultInstance(cfg.restconfWebsocketAddress.get()),
+ new PortNumber(cfg.restconfWebsocketPort.get()));
// Required to properly initialize restconf (broker, schema ctx, etc.).
// Without that restconf would fail with 503 (service not available).
instance.start();
diff --git a/infra/northbound/restconf/src/main/java/io/fd/honeycomb/northbound/restconf/RestconfServiceProvider.java b/infra/northbound/restconf/src/main/java/io/fd/honeycomb/northbound/restconf/RestconfServiceProvider.java
new file mode 100644
index 000000000..20dcc28ad
--- /dev/null
+++ b/infra/northbound/restconf/src/main/java/io/fd/honeycomb/northbound/restconf/RestconfServiceProvider.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2018 Cisco and/or its affiliates.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package io.fd.honeycomb.northbound.restconf;
+
+import com.google.inject.Inject;
+import io.fd.honeycomb.binding.init.ProviderTrait;
+import org.opendaylight.netconf.sal.restconf.impl.BrokerFacade;
+import org.opendaylight.netconf.sal.restconf.impl.ControllerContext;
+import org.opendaylight.netconf.sal.restconf.impl.RestconfImpl;
+
+public class RestconfServiceProvider extends ProviderTrait<RestconfImpl> {
+
+ @Inject
+ private ControllerContext controllerContext;
+ @Inject
+ private BrokerFacade brokerFacade;
+
+ @Override
+ protected RestconfImpl create() {
+ return RestconfImpl.newInstance(brokerFacade, controllerContext);
+ }
+}
diff --git a/infra/northbound/restconf/src/main/java/io/fd/honeycomb/northbound/restconf/StatisticsRestconfServiceWrapperProvider.java b/infra/northbound/restconf/src/main/java/io/fd/honeycomb/northbound/restconf/StatisticsRestconfServiceWrapperProvider.java
new file mode 100644
index 000000000..f3a4c3b73
--- /dev/null
+++ b/infra/northbound/restconf/src/main/java/io/fd/honeycomb/northbound/restconf/StatisticsRestconfServiceWrapperProvider.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2018 Cisco and/or its affiliates.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package io.fd.honeycomb.northbound.restconf;
+
+import com.google.inject.Inject;
+import io.fd.honeycomb.binding.init.ProviderTrait;
+import org.opendaylight.netconf.sal.restconf.impl.RestconfImpl;
+import org.opendaylight.netconf.sal.restconf.impl.StatisticsRestconfServiceWrapper;
+
+public class StatisticsRestconfServiceWrapperProvider extends ProviderTrait<StatisticsRestconfServiceWrapper> {
+
+ @Inject
+ RestconfImpl restconfService;
+
+ @Override
+ protected StatisticsRestconfServiceWrapper create() {
+ return StatisticsRestconfServiceWrapper.newInstance(restconfService);
+ }
+}