Fix Tunnel Topology configuration 73/67773/1
authorClaudio D. Gasparini <claudio.gasparini@pantheon.tech>
Tue, 30 Jan 2018 19:16:06 +0000 (20:16 +0100)
committerClaudio D. Gasparini <claudio.gasparini@pantheon.tech>
Wed, 31 Jan 2018 09:27:32 +0000 (10:27 +0100)
by catch correctly the id of the pcep
topology from topology-ref.
- Improve logs
- Add tunnel topology to example config

Change-Id: If55ea04c6361241b4199bfca02a4c534e67805b6
Signed-off-by: Claudio D. Gasparini <claudio.gasparini@pantheon.tech>
pcep/config-example/src/main/resources/initial/network-topology-pcep-config.xml
pcep/tunnel/tunnel-provider/src/main/java/org/opendaylight/bgpcep/pcep/tunnel/provider/TunnelProviderDeployer.java

index bb9d02350202fe12835d9650506f2809c89adfcd..665b050cd6c0205c802f1d00b5a1cc1bd3d63f1d 100644 (file)
             </session-config>
         </node>
     </topology>
+    <topology xmlns="urn:TBD:params:xml:ns:yang:network-topology">
+        <topology-id>pcep-tunnel-topology</topology-id>
+        <topology-types>
+            <topology-tunnel-pcep xmlns="urn:opendaylight:params:xml:ns:yang:topology:tunnel:pcep"></topology-tunnel-pcep>
+        </topology-types>
+        <pcep-topology-reference xmlns="urn:opendaylight:params:xml:ns:yang:topology:tunnel:pcep:config">
+            /topo:network-topology/topo:topology[topo:topology-id="pcep-topology"]
+        </pcep-topology-reference>
+    </topology>
 </network-topology>
\ No newline at end of file
index 26cde114438640125e985b9dc818cad4fc9670a4..bfea7c9ebdb97883b72b0876162d55cc5a7fcb7a 100644 (file)
@@ -17,6 +17,7 @@ import java.util.concurrent.TimeUnit;
 import java.util.stream.Collectors;
 import javax.annotation.Nonnull;
 import javax.annotation.concurrent.GuardedBy;
+import org.apache.commons.lang3.StringUtils;
 import org.opendaylight.bgpcep.pcep.topology.provider.config.PCEPTopologyDeployerImpl;
 import org.opendaylight.controller.md.sal.binding.api.ClusteredDataTreeChangeListener;
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
@@ -56,6 +57,7 @@ public final class TunnelProviderDeployer implements ClusteredDataTreeChangeList
             final BundleContext bundleContext,
             final ClusterSingletonServiceProvider cssp
     ) {
+        LOG.info("Creating Tunnel Provider Deployer");
         this.dependencies = new TunnelProviderDependencies(dataBroker, cssp, rpcProviderRegistry, bundleContext);
         this.networTopology = InstanceIdentifier.builder(NetworkTopology.class).child(Topology.class).build();
     }
@@ -73,6 +75,7 @@ public final class TunnelProviderDeployer implements ClusteredDataTreeChangeList
     }
 
     public synchronized void init() {
+        LOG.info("Instantiate tunnel topology deployer");
         this.listenerRegistration = this.dependencies.getDataBroker().registerDataTreeChangeListener(
                 new DataTreeIdentifier<>(CONFIGURATION, this.networTopology), this);
     }
@@ -118,10 +121,11 @@ public final class TunnelProviderDeployer implements ClusteredDataTreeChangeList
             LOG.warn("Tunnel Topology {} already exist. New instance won't be created", topologyId);
             return;
         }
+        LOG.debug("Create Tunnel Topology {}", topologyId);
 
         final PcepTunnelTopologyConfig config = topology.getAugmentation(PcepTunnelTopologyConfig.class);
-        final String pcepTopoID = config.getPcepTopologyReference().getValue();
-
+        final String pcepTopoID = StringUtils
+                .substringBetween(config.getPcepTopologyReference().getValue(), "=\"", "\"");
         final InstanceIdentifier<Topology> pcepTopoRef = InstanceIdentifier.builder(NetworkTopology.class)
                 .child(Topology.class, new TopologyKey(new TopologyId(pcepTopoID))).build();
 
@@ -152,6 +156,7 @@ public final class TunnelProviderDeployer implements ClusteredDataTreeChangeList
 
     @Override
     public synchronized void close() {
+        LOG.info("Closing tunnel topology deployer");
         if (this.listenerRegistration != null) {
             this.listenerRegistration.close();
             this.listenerRegistration = null;