diff --git a/alto-basic/auto-maps/api/pom.xml b/alto-basic/auto-maps/api/pom.xml
index 661975d7..28caf49d 100644
--- a/alto-basic/auto-maps/api/pom.xml
+++ b/alto-basic/auto-maps/api/pom.xml
@@ -21,6 +21,9 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
0.6.4
ODL :: alto :: ${project.artifactId}
bundle
+
+ 0.9.4
+
org.opendaylight.alto.core
@@ -35,5 +38,10 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
org.opendaylight.mdsal.model
ietf-topology
+
+ org.opendaylight.bgpcep
+ bgp-rib-api
+ ${bgpcep.version}
+
diff --git a/alto-basic/auto-maps/api/src/main/yang/alto-auto-maps.yang b/alto-basic/auto-maps/api/src/main/yang/alto-auto-maps.yang
index 1179d1d9..a6954be6 100644
--- a/alto-basic/auto-maps/api/src/main/yang/alto-auto-maps.yang
+++ b/alto-basic/auto-maps/api/src/main/yang/alto-auto-maps.yang
@@ -11,6 +11,10 @@ module alto-auto-maps {
prefix "topology";
}
+ import "bgp-rib" {
+ prefix "rib";
+ }
+
import "alto-basic-types" {
prefix "alto-types";
}
@@ -71,13 +75,34 @@ module alto-auto-maps {
}
case bgp-simple-as-cluster {
container bgp-simple-as-params {
- // FIXME: identityref is better
leaf bgp-rib {
- type string;
+ type rib:rib-id;
}
}
}
}
}
+
+ list resource-cost-map {
+ key "resource-id";
+
+ leaf "resource-id" {
+ mandatory true;
+ type alto-types:resource-id;
+ }
+
+ leaf "dependent-network-map" {
+ mandatory true;
+ type alto-types:resource-id;
+ }
+
+ choice cost-algorithm {
+ case bgp-routes {
+ leaf-list alternative-bgp-ribs {
+ type rib:rib-id;
+ }
+ }
+ }
+ }
}
}
diff --git a/alto-basic/auto-maps/impl/pom.xml b/alto-basic/auto-maps/impl/pom.xml
index 33cc2449..fa4496d7 100644
--- a/alto-basic/auto-maps/impl/pom.xml
+++ b/alto-basic/auto-maps/impl/pom.xml
@@ -72,13 +72,13 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
org.opendaylight.bgpcep
- bgp-rib-api
+ bgp-inet
${bgpcep.version}
org.opendaylight.bgpcep
- bgp-inet
+ bgp-linkstate
${bgpcep.version}
diff --git a/alto-basic/auto-maps/impl/src/main/java/org/opendaylight/alto/basic/impl/AltoAutoMapsBgpIpv4Updater.java b/alto-basic/auto-maps/impl/src/main/java/org/opendaylight/alto/basic/impl/AltoAutoMapsBgpIpv4Updater.java
index 3d7d279e..0524326f 100644
--- a/alto-basic/auto-maps/impl/src/main/java/org/opendaylight/alto/basic/impl/AltoAutoMapsBgpIpv4Updater.java
+++ b/alto-basic/auto-maps/impl/src/main/java/org/opendaylight/alto/basic/impl/AltoAutoMapsBgpIpv4Updater.java
@@ -10,6 +10,9 @@
import com.google.common.base.Optional;
import org.opendaylight.alto.basic.manual.maps.ManualMapsUtils;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.binding.api.DataTreeChangeListener;
+import org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier;
+import org.opendaylight.controller.md.sal.binding.api.DataTreeModification;
import org.opendaylight.controller.md.sal.binding.api.ReadTransaction;
import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
@@ -35,117 +38,141 @@
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.Ipv4AddressFamily;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.UnicastSubsequentAddressFamily;
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import javax.annotation.Nonnull;
import java.util.Arrays;
+import java.util.Collection;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.concurrent.ExecutionException;
-public class AltoAutoMapsBgpIpv4Updater implements AutoCloseable {
+public class AltoAutoMapsBgpIpv4Updater implements DataTreeChangeListener, AutoCloseable {
private static final Logger LOG = LoggerFactory.getLogger(AltoAutoMapsBgpIpv4Updater.class);
private final DataBroker dataBroker;
- // private ListenerRegistration> registration;
+ private ListenerRegistration> registration;
private String contextId;
private ResourceNetworkMap networkMapConfig;
+ private InstanceIdentifier tableIID;
public AltoAutoMapsBgpIpv4Updater(String contextId, ResourceNetworkMap networkMapConfig, final DataBroker dataBroker) {
this.dataBroker = dataBroker;
this.contextId = contextId;
this.networkMapConfig = networkMapConfig;
+ this.tableIID = getConfiguredIpv4Table(networkMapConfig);
registerBGPListener();
}
private void registerBGPListener() {
- final ReadWriteTransaction wrx = dataBroker.newReadWriteTransaction();
- try {
- List