Make base pcep-topology-api independent of stateful 34/4634/9
authorRobert Varga <rovarga@cisco.com>
Thu, 23 Jan 2014 12:18:43 +0000 (13:18 +0100)
committerRobert Varga <rovarga@cisco.com>
Fri, 24 Jan 2014 15:24:53 +0000 (16:24 +0100)
Change-Id: I0da583e0c51932baf5559828aa5e9fbcb2fe2296
Signed-off-by: Robert Varga <rovarga@cisco.com>
16 files changed:
integration-tests/src/test/java/org/opendaylight/protocol/integration/AbstractBundleTest.java
integration-tests/src/test/java/org/opendaylight/protocol/integration/PcepImplBundleTest.java
integration-tests/src/test/java/org/opendaylight/protocol/integration/TestHelper.java
pcep/ietf-stateful02/pom.xml
pcep/ietf-stateful07/pom.xml
pcep/ietf-stateful07/src/main/yang/odl-pcep-ietf-stateful07.yang
pcep/topology-api/pom.xml
pcep/topology-api/src/main/yang/network-topology-pcep.yang
pcep/topology-provider/pom.xml
pcep/topology-provider/src/main/java/org/opendaylight/bgpcep/pcep/topology/provider/AbstractTopologySessionListener.java
pcep/topology-provider/src/main/java/org/opendaylight/bgpcep/pcep/topology/provider/ServerSessionManager.java
pcep/topology-provider/src/main/java/org/opendaylight/bgpcep/pcep/topology/provider/Stateful07TopologySessionListener.java
pcep/topology-provider/src/main/java/org/opendaylight/bgpcep/pcep/topology/provider/TopologyNodeState.java
pcep/topology-provider/src/main/java/org/opendaylight/bgpcep/pcep/topology/provider/TopologyProgramming.java
pcep/tunnel-provider/src/main/java/org/opendaylight/bgpcep/pcep/tunnel/provider/NodeChangedListener.java
pcep/tunnel-provider/src/main/java/org/opendaylight/bgpcep/pcep/tunnel/provider/TunnelProgramming.java

index 4d255a9411b7b773870b6f387f163ecd5fac0424..007b758bd29d735f1678e1c87ad50165aca1f58a 100644 (file)
@@ -54,6 +54,7 @@ public abstract class AbstractBundleTest {
                ret.add(mavenBundle("org.opendaylight.yangtools", "yang-binding").versionAsInProject());
                ret.add(mavenBundle("org.opendaylight.yangtools", "yang-common").versionAsInProject());
                ret.add(mavenBundle("org.opendaylight.yangtools.model", "ietf-inet-types").versionAsInProject());
+               ret.add(mavenBundle("org.opendaylight.yangtools.model", "ietf-topology").versionAsInProject());
 
                ret.add(mavenBundle("org.javassist", "javassist").versionAsInProject());
                ret.add(mavenBundle("org.opendaylight.controller", "config-api").versionAsInProject());
index 9aeba463e74f0eff4ec0f28acaa2ae37297de6b6..40ff0acf0d0a55b75e13a228bbfa17132200a013 100644 (file)
@@ -14,7 +14,8 @@ import com.google.common.collect.Lists;
 public final class PcepImplBundleTest extends AbstractBundleTest {
        @Override
        protected Collection<String> prerequisiteBundles() {
-               return Lists.newArrayList("concepts", "pcep-api", "pcep-spi", "pcep-ietf-stateful02", "pcep-ietf-stateful07", "rsvp-api", "util");
+               return Lists.newArrayList("concepts", "pcep-api", "pcep-spi", "pcep-ietf-stateful02", "pcep-ietf-stateful07", "pcep-topology-api",
+                               "rsvp-api", "programming-api", "programming-topology-api", "topology-api", "util");
        }
 
        @Override
index 4411190a510a0f97ffa37d0c0e5eaf67d44fe895..f2d9d405504ece6c4f1b9cb7945b530575567034 100644 (file)
@@ -159,6 +159,7 @@ public class TestHelper {
                 mavenBundle(YANGTOOLS_MODELS, "ietf-inet-types").versionAsInProject(), // //
                 mavenBundle(YANGTOOLS_MODELS, "ietf-yang-types").versionAsInProject(), // //
                 mavenBundle(YANGTOOLS_MODELS, "opendaylight-l2-types").versionAsInProject(), // //
+                mavenBundle(YANGTOOLS_MODELS, "ietf-topology").versionAsInProject(), // //
                 mavenBundle(CONTROLLER_MODELS, "model-inventory").versionAsInProject());
     }
 
index 2fbb067e01010e02a3875f7c64bf98dcce1e45bd..e0b90af416c43efbd7b4c8d249027b1f49b231e7 100644 (file)
     </prerequisites>
 
     <dependencies>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>concepts</artifactId>
+        </dependency>
         <dependency>
             <groupId>${project.groupId}</groupId>
             <artifactId>pcep-api</artifactId>
@@ -44,7 +48,7 @@
         </dependency>
         <dependency>
             <groupId>${project.groupId}</groupId>
-            <artifactId>concepts</artifactId>
+            <artifactId>pcep-topology-api</artifactId>
         </dependency>
 
         <!--
index 81b695e4680c346c91443799b2d67a30fb5889cd..84b1b1e7a4fff9fd948c2bf454f68c1c2b700690 100644 (file)
     </prerequisites>
 
     <dependencies>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>concepts</artifactId>
+        </dependency>
         <dependency>
             <groupId>${project.groupId}</groupId>
             <artifactId>pcep-api</artifactId>
@@ -44,7 +48,7 @@
         </dependency>
         <dependency>
             <groupId>${project.groupId}</groupId>
-            <artifactId>concepts</artifactId>
+            <artifactId>pcep-topology-api</artifactId>
         </dependency>
 
         <!--
                     </instructions>
                 </configuration>
             </plugin>
+
+                <!-- BUG-294: remove this plugin once fixed -->
+                <plugin>
+                    <groupId>org.opendaylight.yangtools</groupId>
+                    <artifactId>yang-maven-plugin</artifactId>
+                    <version>${yangtools.version}</version>
+                    <executions>
+                        <execution>
+                            <goals>
+                                <goal>generate-sources</goal>
+                            </goals>
+                            <configuration>
+                                <yangFilesRootDir>src/main/yang</yangFilesRootDir>
+                                <codeGenerators>
+                                    <generator>
+                                        <codeGeneratorClass>
+                                            org.opendaylight.yangtools.maven.sal.api.gen.plugin.CodeGeneratorImpl
+                                        </codeGeneratorClass>
+                                        <outputBaseDir>
+                                            target/generated-sources/sal
+                                        </outputBaseDir>
+                                    </generator>
+                                    <generator>
+                                        <codeGeneratorClass>org.opendaylight.yangtools.yang.wadl.generator.maven.WadlGenerator</codeGeneratorClass>
+                                        <outputBaseDir>target/site</outputBaseDir>
+                                    </generator>
+                                    <generator>
+                                        <codeGeneratorClass>
+                                            org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+                                        </codeGeneratorClass>
+                                        <outputBaseDir>${project.build.directory}/generated-sources/config</outputBaseDir>
+                                        <additionalConfiguration>
+                                            <namespaceToPackage1>
+                                                urn:opendaylight:params:xml:ns:yang:controller==org.opendaylight.controller.config.yang
+                                            </namespaceToPackage1>
+                                        </additionalConfiguration>
+                                    </generator>
+                                </codeGenerators>
+                                <inspectDependencies>true</inspectDependencies>
+                            </configuration>
+                        </execution>
+                    </executions>
+                    <dependencies>
+                        <dependency>
+                            <groupId>org.opendaylight.yangtools</groupId>
+                            <artifactId>maven-sal-api-gen-plugin</artifactId>
+                            <version>${yang.binding.version}</version>
+                            <type>jar</type>
+                        </dependency>
+                    <dependency>
+                        <groupId>org.opendaylight.controller</groupId>
+                        <artifactId>yang-jmx-generator-plugin</artifactId>
+                        <version>${controller.config.version}</version>
+                    </dependency>
+                    </dependencies>
+                </plugin>
         </plugins>
     </build>
 </project>
index 8a4bf5677703b1f52d5f77e773ca1354a4f16e47..5b2f4a93bb347828337ae9630b92bda010e35d60 100644 (file)
@@ -4,6 +4,8 @@ module odl-pcep-ietf-stateful07 {
        prefix "stateful";
 
        import ietf-inet-types { prefix inet; revision-date 2010-09-24; }
+       import network-topology { prefix nt; revision-date 2013-10-21; }
+       import network-topology-pcep { prefix topo; revision-date 2013-10-24; }
        import pcep-types { prefix pcep; revision-date 2013-10-05; }
        import pcep-message { prefix msg; revision-date 2013-10-07; }
        import rsvp { prefix rsvp; revision-date 2013-08-20; }
@@ -73,12 +75,10 @@ module odl-pcep-ietf-stateful07 {
                        uses pcep:tlv;
                        leaf lsp-id {
                                type rsvp:lsp-id;
-                               mandatory true;
                        }
 
                        leaf tunnel-id {
                                type rsvp:tunnel-id;
-                               mandatory true;
                        }
 
                        choice address-family {
@@ -125,7 +125,6 @@ module odl-pcep-ietf-stateful07 {
                        uses pcep:tlv;
                        leaf error-code {
                                type uint32;
-                               mandatory true;
                        }
                }
        }
@@ -171,7 +170,6 @@ module odl-pcep-ietf-stateful07 {
                        uses pcep:tlv;
                        leaf path-name {
                                type symbolic-path-name;
-                               mandatory true;
                        }
                }
        }
@@ -194,7 +192,6 @@ module odl-pcep-ietf-stateful07 {
 
                        leaf plsp-id {
                                type plsp-id;
-                               mandatory true;
                        }
 
                        leaf delegate {
@@ -219,7 +216,6 @@ module odl-pcep-ietf-stateful07 {
 
                        leaf operational {
                                type operational-status;
-                               mandatory true;
                        }
                }
        }
@@ -310,4 +306,18 @@ module odl-pcep-ietf-stateful07 {
                        }
                }
        }
+
+       augment "/nt:network-topology/nt:topology/nt:node/topo:path-computation-client/topo:reported-lsp" {
+               uses lsp-object;
+       }
+
+       augment "/nt:network-topology/nt:topology/nt:node/topo:path-computation-client/topo:stateful-tlv" {
+               uses stateful-capability-tlv;
+       }
+
+       augment "/topo:ensure-lsp-operational/topo:input/topo:arguments" {
+               leaf operational {
+                       type stateful:operational-status;
+               }
+       }
 }
index f2fa1debf7c8c94df0c6ecd98ba4f06444b16a7c..ec92c3b6a7a426f9208322b988c4543b66769248 100644 (file)
             <groupId>${project.groupId}</groupId>
             <artifactId>pcep-api</artifactId>
         </dependency>
-        <dependency>
-            <groupId>${project.groupId}</groupId>
-            <artifactId>pcep-ietf-stateful02</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>${project.groupId}</groupId>
-            <artifactId>pcep-ietf-stateful07</artifactId>
-        </dependency>
         <dependency>
             <groupId>${project.groupId}</groupId>
             <artifactId>topology-api</artifactId>
index 5179bcb77cca256712c9d77736dc9201d4d436bb..e2e63c95b4e69cb67d0998f7200f7da4721dc154 100644 (file)
@@ -8,7 +8,6 @@ module network-topology-pcep {
     import network-topology { prefix nt; revision-date 2013-10-21; }
     import odl-network-topology { prefix ont; revision-date 2014-01-13; }
     import pcep-types { prefix pcep; revision-date 2013-10-05; }
-    import odl-pcep-ietf-stateful07 { prefix stateful; revision-date 2013-12-22; }
 
     organization "Cisco Systems, Inc.";
     contact "Robert Varga <rovarga@cisco.com>";
@@ -81,26 +80,23 @@ module network-topology-pcep {
                     data plane addresses.";
 
                 type inet:ip-address;
-                mandatory true;
             }
 
             container stateful-tlv {
-                uses stateful:stateful-capability-tlv;
+
             }
 
             leaf state-sync {
-                when "../stateful-tlv";
                 type pcc-sync-state;
+                when "../stateful-tlv";
             }
 
             list reported-lsp {
                 leaf name {
-                    type stateful:symbolic-path-name;
+                    type string;
                 }
                 key name;
 
-                uses stateful:lsp-object;
-
                 container path {
                     uses pcep:path-definition;
                 }
@@ -131,7 +127,7 @@ module network-topology-pcep {
         }
 
         leaf name {
-            type stateful:symbolic-path-name;
+            type string;
             mandatory true;
         }
     }
@@ -222,10 +218,7 @@ module network-topology-pcep {
         uses lsp-id;
 
         container arguments {
-            leaf operational {
-                type stateful:operational-status;
-                mandatory true;
-            }
+
         }
     }
 
index 490be067f7c03442322c6e6ee2ae19a4b91574f5..80756c3b0673b8daccfa8a74aa1547f67d0584b7 100644 (file)
             <groupId>${project.groupId}</groupId>
             <artifactId>pcep-api</artifactId>
         </dependency>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>pcep-ietf-stateful02</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>pcep-ietf-stateful07</artifactId>
+        </dependency>
         <dependency>
             <groupId>${project.groupId}</groupId>
             <artifactId>pcep-topology-api</artifactId>
index 4a24aa7db70ed593d1dc0e4e220f2642db38060d..1539555d358ff9c4170ee842d216250c106e61d8 100644 (file)
@@ -36,6 +36,9 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev131024.lsp.metadata.Metadata;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev131024.pcep.client.attributes.PathComputationClient;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev131024.pcep.client.attributes.PathComputationClientBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev131024.pcep.client.attributes.path.computation.client.ReportedLsp;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev131024.pcep.client.attributes.path.computation.client.ReportedLspBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev131024.pcep.client.attributes.path.computation.client.ReportedLspKey;
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology;
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
@@ -54,7 +57,7 @@ import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.JdkFutureAdapters;
 import com.google.common.util.concurrent.ListenableFuture;
 
-public abstract class AbstractTopologySessionListener<SRPID, PLSPID, PATHNAME> implements PCEPSessionListener, TopologySessionListener {
+public abstract class AbstractTopologySessionListener<SRPID, PLSPID> implements PCEPSessionListener, TopologySessionListener {
        protected static final MessageHeader MESSAGE_HEADER = new MessageHeader() {
                private final ProtocolVersion version = new ProtocolVersion((short) 1);
 
@@ -68,22 +71,22 @@ public abstract class AbstractTopologySessionListener<SRPID, PLSPID, PATHNAME> i
                        return this.version;
                }
        };
-       protected static final Pcerr UNHANDLED_MESSAGE_ERROR = new PcerrBuilder().setPcerrMessage(
+       private static final Logger LOG = LoggerFactory.getLogger(Stateful07TopologySessionListener.class);
+       private static final Pcerr UNHANDLED_MESSAGE_ERROR = new PcerrBuilder().setPcerrMessage(
                        new PcerrMessageBuilder().setErrorType(null).build()).build();
 
-       private static final Logger LOG = LoggerFactory.getLogger(Stateful07TopologySessionListener.class);
 
        // FIXME: make this private
        protected final ServerSessionManager serverSessionManager;
 
        private final Map<SRPID, PCEPRequest> waitingRequests = new HashMap<>();
        private final Map<SRPID, PCEPRequest> sendingRequests = new HashMap<>();
-       private final Map<PLSPID, PATHNAME> lsps = new HashMap<>();
+       private final Map<PLSPID, String> lsps = new HashMap<>();
        private InstanceIdentifier<Node> topologyNode;
        private InstanceIdentifier<Node1> topologyAugment;
        private PathComputationClientBuilder pccBuilder;
        private Node1Builder topologyAugmentBuilder;
-       private TopologyNodeState<PATHNAME> nodeState;
+       private TopologyNodeState nodeState;
        private boolean ownsTopology = false;
        private boolean synced = false;
        private PCEPSession session;
@@ -228,6 +231,30 @@ public abstract class AbstractTopologySessionListener<SRPID, PLSPID, PATHNAME> i
                tearDown(session);
        }
 
+       @Override
+       public final synchronized void onMessage(final PCEPSession session, final Message message) {
+               final DataModificationTransaction trans = this.serverSessionManager.beginTransaction();
+
+               if (onMessage(trans, message)) {
+                       LOG.info("Unhandled message {} on session {}", message, session);
+                       session.sendMessage(UNHANDLED_MESSAGE_ERROR);
+                       return;
+               }
+
+               Futures.addCallback(JdkFutureAdapters.listenInPoolThread(trans.commit()), new FutureCallback<RpcResult<TransactionStatus>>() {
+                       @Override
+                       public void onSuccess(final RpcResult<TransactionStatus> result) {
+                               LOG.trace("Internal state for session {} updated successfully", session);
+                       }
+
+                       @Override
+                       public void onFailure(final Throwable t) {
+                               LOG.error("Failed to update internal state for session {}, closing it", session, t);
+                               session.close(TerminationReason.Unknown);
+                       }
+               });
+       }
+
        @Override
        public void close() {
                if (session != null) {
@@ -271,6 +298,31 @@ public abstract class AbstractTopologySessionListener<SRPID, PLSPID, PATHNAME> i
                return req.getFuture();
        }
 
+
+       protected final synchronized void updateLsp(final DataModificationTransaction trans, final PLSPID id, String name, final ReportedLspBuilder rlb, final boolean solicited) {
+               if (name == null) {
+                       name = lsps.get(id);
+                       if (name == null) {
+                               LOG.error("PLSPID {} seen for the first time, not reporting the LSP", id);
+                               return;
+                       }
+               }
+               lsps.put(id, name);
+
+
+               Preconditions.checkState(name != null);
+               rlb.setKey(new ReportedLspKey(name));
+
+               // If this is an unsolicited update. We need to make sure we retain the metadata already present
+               if (solicited) {
+                       this.nodeState.setLspMetadata(name, rlb.getMetadata());
+               } else {
+                       rlb.setMetadata(this.nodeState.getLspMetadata(name));
+               }
+
+               trans.putOperationalData(lspIdentifier(name).build(), rlb.build());
+       }
+
        protected final synchronized void stateSynchronizationAchieved(final DataModificationTransaction trans) {
                if (this.synced) {
                        LOG.debug("State synchronization achieved while synchronized, not updating state");
@@ -289,26 +341,19 @@ public abstract class AbstractTopologySessionListener<SRPID, PLSPID, PATHNAME> i
                LOG.debug("Session {} achieved synchronized state", session);
        }
 
-       protected final synchronized void addLsp(final PLSPID id, final PATHNAME name) {
-               Preconditions.checkState(lsps.containsKey(id) == false);
-               lsps.put(id, name);
-       }
-
-       protected final synchronized PATHNAME getLsp(final PLSPID id) {
-               return lsps.get(id);
-       }
-
-       protected final synchronized PATHNAME removeLsp(final PLSPID id) {
-               return lsps.remove(id);
+       protected final InstanceIdentifierBuilder<ReportedLsp> lspIdentifier(final String name) {
+               return pccIdentifier().child(ReportedLsp.class, new ReportedLspKey(name));
        }
 
-       protected final synchronized Metadata getLspMetadata(final PATHNAME name) {
-               return this.nodeState.getLspMetadata(name);
-       }
+       protected final synchronized void removeLsp(final DataModificationTransaction trans, final PLSPID id) {
+               final String name = lsps.remove(id);
+               if (name != null) {
+                       trans.removeOperationalData(lspIdentifier(name).build());
+               }
 
-       protected final synchronized void updateLspMetadata(final PATHNAME name, final Metadata metadata) {
-               this.nodeState.setLspMetadata(name, metadata);
+               LOG.debug("LSP {} removed", name);
        }
 
        abstract protected void onSessionUp(PCEPSession session, PathComputationClientBuilder pccBuilder);
+       abstract protected boolean onMessage(DataModificationTransaction trans, Message message);
 }
index 2f33bf9a9427fdbea1522027d28a99067dfc3758..7413f436807e4b93840465dbca5b60464b0751fd 100644 (file)
@@ -52,7 +52,7 @@ final class ServerSessionManager implements SessionListenerFactory<PCEPSessionLi
        private static final long DEFAULT_HOLD_STATE_NANOS = TimeUnit.MINUTES.toNanos(5);
 
        private final Map<NodeId, TopologySessionListener> nodes = new HashMap<>();
-       private final Map<NodeId, TopologyNodeState<?>> state = new HashMap<>();
+       private final Map<NodeId, TopologyNodeState> state = new HashMap<>();
        private final InstanceIdentifier<Topology> topology;
        private final DataProviderService dataProvider;
 
@@ -87,19 +87,18 @@ final class ServerSessionManager implements SessionListenerFactory<PCEPSessionLi
                });
        }
 
-       public void releaseNodeState(final TopologyNodeState<?> nodeState) {
+       public void releaseNodeState(final TopologyNodeState nodeState) {
                LOG.debug("Node {} unbound", nodeState.getNodeId());
                this.nodes.remove(nodeState.getNodeId());
                nodeState.released();
        }
 
-       synchronized <T> TopologyNodeState<T> takeNodeState(final NodeId id, final TopologySessionListener sessionListener) {
+       synchronized TopologyNodeState takeNodeState(final NodeId id, final TopologySessionListener sessionListener) {
                LOG.debug("Node {} bound to listener {}", id, sessionListener);
 
-               @SuppressWarnings("unchecked")
-               TopologyNodeState<T> ret = (TopologyNodeState<T>) this.state.get(id);
+               TopologyNodeState ret = this.state.get(id);
                if (ret == null) {
-                       ret = new TopologyNodeState<T>(id, DEFAULT_HOLD_STATE_NANOS);
+                       ret = new TopologyNodeState(id, DEFAULT_HOLD_STATE_NANOS);
                        this.state.put(id, ret);
                }
 
index 685b2380d0cd4dd6bb7985a4ae716b9434b080f8..fa729fcd801a30bb5d9c06bae782ec82182c0f8f 100644 (file)
@@ -8,22 +8,27 @@
 package org.opendaylight.bgpcep.pcep.topology.provider;
 
 import java.net.InetAddress;
+import java.nio.ByteBuffer;
 import java.util.Collections;
 
 import javax.annotation.concurrent.GuardedBy;
 
-import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
 import org.opendaylight.controller.sal.binding.api.data.DataModificationTransaction;
 import org.opendaylight.protocol.pcep.PCEPSession;
 import org.opendaylight.protocol.pcep.PCEPSessionListener;
-import org.opendaylight.protocol.pcep.TerminationReason;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated.rev131126.PcinitiateBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated.rev131126.pcinitiate.message.PcinitiateMessageBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated.rev131126.pcinitiate.message.pcinitiate.message.RequestsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.Arguments1;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.OperationalStatus;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.PcrptMessage;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.PcupdBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.PlspId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.ReportedLsp1;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.ReportedLsp1Builder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.SrpIdNumber;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.StatefulTlv1;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.StatefulTlv1Builder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.SymbolicPathName;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.Tlvs2;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.lsp.object.Lsp;
@@ -48,22 +53,17 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev131024.pcep.client.attributes.PathComputationClientBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev131024.pcep.client.attributes.path.computation.client.ReportedLsp;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev131024.pcep.client.attributes.path.computation.client.ReportedLspBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev131024.pcep.client.attributes.path.computation.client.ReportedLspKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev131024.pcep.client.attributes.path.computation.client.StatefulTlvBuilder;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.InstanceIdentifierBuilder;
-import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import com.google.common.base.Charsets;
 import com.google.common.base.Preconditions;
 import com.google.common.collect.ImmutableList;
-import com.google.common.util.concurrent.FutureCallback;
-import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.JdkFutureAdapters;
 import com.google.common.util.concurrent.ListenableFuture;
 
-final class Stateful07TopologySessionListener extends AbstractTopologySessionListener<SrpIdNumber, PlspId, SymbolicPathName> implements PCEPSessionListener {
+final class Stateful07TopologySessionListener extends AbstractTopologySessionListener<SrpIdNumber, PlspId> implements PCEPSessionListener {
        private static final Logger LOG = LoggerFactory.getLogger(Stateful07TopologySessionListener.class);
 
        /**
@@ -81,12 +81,14 @@ final class Stateful07TopologySessionListener extends AbstractTopologySessionLis
                final InetAddress peerAddress = session.getRemoteAddress();
 
                final Tlvs tlvs = session.getRemoteTlvs();
-               if (tlvs.getAugmentation(Tlvs2.class) != null) {
-                       final Stateful stateful = tlvs.getAugmentation(Tlvs2.class).getStateful();
+               final Tlvs2 tlv = tlvs.getAugmentation(Tlvs2.class);
+               if (tlv != null) {
+                       final Stateful stateful = tlv.getStateful();
                        if (stateful != null) {
                                pccBuilder.setReportedLsp(Collections.<ReportedLsp> emptyList());
-                               pccBuilder.setStatefulTlv(new StatefulTlvBuilder().setStateful(stateful).build());
                                pccBuilder.setStateSync(PccSyncState.InitialResync);
+                               pccBuilder.setStatefulTlv(
+                                               new StatefulTlvBuilder().addAugmentation(StatefulTlv1.class, new StatefulTlv1Builder(tlv).build()).build());
                        } else {
                                LOG.debug("Peer {} does not advertise stateful TLV", peerAddress);
                        }
@@ -95,21 +97,13 @@ final class Stateful07TopologySessionListener extends AbstractTopologySessionLis
                }
        }
 
-       private InstanceIdentifierBuilder<ReportedLsp> lspIdentifier(final ReportedLspKey key) {
-               return pccIdentifier().child(ReportedLsp.class, key);
-       }
-
        @Override
-       public synchronized void onMessage(final PCEPSession session, final Message message) {
+       protected synchronized boolean onMessage(final DataModificationTransaction trans, final Message message) {
                if (!(message instanceof PcrptMessage)) {
-                       LOG.info("Unhandled message {} on session {}", message, session);
-                       session.sendMessage(UNHANDLED_MESSAGE_ERROR);
+                       return true;
                }
 
                final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.pcrpt.message.PcrptMessage rpt = ((PcrptMessage) message).getPcrptMessage();
-
-               final DataModificationTransaction trans = this.serverSessionManager.beginTransaction();
-
                for (final Reports r : rpt.getReports()) {
                        final Lsp lsp = r.getLsp();
 
@@ -118,7 +112,8 @@ final class Stateful07TopologySessionListener extends AbstractTopologySessionLis
                                continue;
                        }
 
-                       final ReportedLspBuilder rlb = new ReportedLspBuilder(r);
+                       final ReportedLspBuilder rlb = new ReportedLspBuilder();
+                       rlb.addAugmentation(ReportedLsp1.class, new ReportedLsp1Builder(r).build());
                        boolean solicited = false;
 
                        final Srp srp = r.getSrp();
@@ -150,56 +145,24 @@ final class Stateful07TopologySessionListener extends AbstractTopologySessionLis
                        }
 
                        final PlspId id = lsp.getPlspId();
-                       if (lsp.isRemove()) {
-                               final SymbolicPathName name = removeLsp(id);
-                               if (name != null) {
-                                       trans.removeOperationalData(lspIdentifier(new ReportedLspKey(name)).build());
-                               }
-
-                               LOG.debug("LSP {} removed", lsp);
-                       } else {
-                               SymbolicPathName name = getLsp(id);
-                               if (name == null) {
-                                       LOG.debug("PLSPID {} not known yet, looking for a symbolic name", id);
-
-                                       final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.lsp.object.lsp.Tlvs tlvs = r.getLsp().getTlvs();
-                                       if (tlvs != null && tlvs.getSymbolicPathName() != null) {
-                                               name = tlvs.getSymbolicPathName().getPathName();
-                                               addLsp(id, name);
-                                       } else {
-                                               LOG.error("PLSPID {} seen for the first time, not reporting the LSP", id);
-                                               continue;
-                                       }
-                               }
-
-                               Preconditions.checkState(name != null);
-                               rlb.setKey(new ReportedLspKey(name));
-
-                               // If this is an unsolicited update. We need to make sure we retain the metadata already present
-                               if (solicited) {
-                                       updateLspMetadata(name, rlb.getMetadata());
+                       if (!lsp.isRemove()) {
+                               final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.lsp.object.lsp.Tlvs tlvs = r.getLsp().getTlvs();
+                               final String name;
+                               if (tlvs != null && tlvs.getSymbolicPathName() != null) {
+                                       name = Charsets.UTF_8.decode(ByteBuffer.wrap(tlvs.getSymbolicPathName().getPathName().getValue())).toString();
                                } else {
-                                       rlb.setMetadata(getLspMetadata(name));
+                                       name = null;
                                }
 
-                               trans.putOperationalData(lspIdentifier(rlb.getKey()).build(), rlb.build());
-
+                               updateLsp(trans, id, name, rlb, solicited);
                                LOG.debug("LSP {} updated", lsp);
+                       } else {
+                               removeLsp(trans, id);
+                               LOG.debug("LSP {} removed", lsp);
                        }
                }
 
-               Futures.addCallback(JdkFutureAdapters.listenInPoolThread(trans.commit()), new FutureCallback<RpcResult<TransactionStatus>>() {
-                       @Override
-                       public void onSuccess(final RpcResult<TransactionStatus> result) {
-                               LOG.trace("Internal state for session {} updated successfully", session);
-                       }
-
-                       @Override
-                       public void onFailure(final Throwable t) {
-                               LOG.error("Failed to update internal state for session {}, closing it", session, t);
-                               session.close(TerminationReason.Unknown);
-                       }
-               });
+               return false;
        }
 
        @GuardedBy("this")
@@ -210,7 +173,7 @@ final class Stateful07TopologySessionListener extends AbstractTopologySessionLis
        @Override
        public synchronized ListenableFuture<OperationResult> addLsp(final AddLspArgs input) {
                // Make sure there is no such LSP
-               final InstanceIdentifier<ReportedLsp> lsp = lspIdentifier(new ReportedLspKey(input.getName())).build();
+               final InstanceIdentifier<ReportedLsp> lsp = lspIdentifier(input.getName()).build();
                if (serverSessionManager.readOperationalData(lsp) != null) {
                        LOG.debug("Node {} already contains lsp {} at {}", input.getNode(), input.getName(), lsp);
                        return OperationResults.UNSENT.future();
@@ -221,7 +184,7 @@ final class Stateful07TopologySessionListener extends AbstractTopologySessionLis
                rb.fieldsFrom(input.getArguments());
                rb.setSrp(new SrpBuilder().setOperationId(nextRequest()).setProcessingRule(Boolean.TRUE).build());
                rb.setLsp(new LspBuilder().setAdministrative(input.getArguments().isAdministrative()).setDelegate(Boolean.TRUE).setTlvs(
-                               new TlvsBuilder().setSymbolicPathName(new SymbolicPathNameBuilder().setPathName(input.getName()).build()).build()).build());
+                               new TlvsBuilder().setSymbolicPathName(new SymbolicPathNameBuilder().setPathName(new SymbolicPathName(input.getName().getBytes(Charsets.UTF_8))).build()).build()).build());
 
                final PcinitiateMessageBuilder ib = new PcinitiateMessageBuilder(MESSAGE_HEADER);
                ib.setRequests(ImmutableList.of(rb.build()));
@@ -234,17 +197,20 @@ final class Stateful07TopologySessionListener extends AbstractTopologySessionLis
        @Override
        public synchronized ListenableFuture<OperationResult> removeLsp(final RemoveLspArgs input) {
                // Make sure the LSP exists, we need it for PLSP-ID
-               final InstanceIdentifier<ReportedLsp> lsp = lspIdentifier(new ReportedLspKey(input.getName())).build();
+               final InstanceIdentifier<ReportedLsp> lsp = lspIdentifier(input.getName()).build();
                final ReportedLsp rep = serverSessionManager.readOperationalData(lsp);
                if (rep == null) {
                        LOG.debug("Node {} does not contain LSP {}", input.getNode(), input.getName());
                        return OperationResults.UNSENT.future();
                }
 
+               final ReportedLsp1 ra = rep.getAugmentation(ReportedLsp1.class);
+               Preconditions.checkState(ra != null);
+
                // Build the request and send it
                final RequestsBuilder rb = new RequestsBuilder();
                rb.setSrp(new SrpBuilder().setOperationId(nextRequest()).setProcessingRule(Boolean.TRUE).build());
-               rb.setLsp(new LspBuilder().setRemove(Boolean.TRUE).setPlspId(rep.getLsp().getPlspId()).setDelegate(Boolean.TRUE).build());
+               rb.setLsp(new LspBuilder().setRemove(Boolean.TRUE).setPlspId(ra.getLsp().getPlspId()).setDelegate(Boolean.TRUE).build());
 
                final PcinitiateMessageBuilder ib = new PcinitiateMessageBuilder(MESSAGE_HEADER);
                ib.setRequests(ImmutableList.of(rb.build()));
@@ -254,17 +220,20 @@ final class Stateful07TopologySessionListener extends AbstractTopologySessionLis
        @Override
        public synchronized ListenableFuture<OperationResult> updateLsp(final UpdateLspArgs input) {
                // Make sure the LSP exists
-               final InstanceIdentifier<ReportedLsp> lsp = lspIdentifier(new ReportedLspKey(input.getName())).build();
+               final InstanceIdentifier<ReportedLsp> lsp = lspIdentifier(input.getName()).build();
                final ReportedLsp rep = serverSessionManager.readOperationalData(lsp);
                if (rep == null) {
                        LOG.debug("Node {} does not contain LSP {}", input.getNode(), input.getName());
                        return OperationResults.UNSENT.future();
                }
 
+               final ReportedLsp1 ra = rep.getAugmentation(ReportedLsp1.class);
+               Preconditions.checkState(ra != null);
+
                // Build the PCUpd request and send it
                final UpdatesBuilder rb = new UpdatesBuilder();
                rb.setSrp(new SrpBuilder().setOperationId(nextRequest()).setProcessingRule(Boolean.TRUE).build());
-               rb.setLsp(new LspBuilder().setPlspId(rep.getLsp().getPlspId()).setDelegate(Boolean.TRUE).build());
+               rb.setLsp(new LspBuilder().setPlspId(ra.getLsp().getPlspId()).setDelegate(Boolean.TRUE).build());
                final PathBuilder pb = new PathBuilder();
                rb.setPath(pb.setEro(input.getArguments().getEro()).build());
 
@@ -276,16 +245,28 @@ final class Stateful07TopologySessionListener extends AbstractTopologySessionLis
 
        @Override
        public synchronized ListenableFuture<OperationResult> ensureLspOperational(final EnsureLspOperationalInput input) {
+               OperationalStatus op = null;
+               final Arguments1 aa = input.getArguments().getAugmentation(Arguments1.class);
+               if (aa != null) {
+                       op = aa.getOperational();
+               }
+
                // Make sure the LSP exists
-               final InstanceIdentifier<ReportedLsp> lsp = lspIdentifier(new ReportedLspKey(input.getName())).build();
-               LOG.debug("Checking if LSP {} has operational state {}", lsp, input.getArguments().getOperational());
+               final InstanceIdentifier<ReportedLsp> lsp = lspIdentifier(input.getName()).build();
+               LOG.debug("Checking if LSP {} has operational state {}", lsp, op);
                final ReportedLsp rep = serverSessionManager.readOperationalData(lsp);
                if (rep == null) {
                        LOG.debug("Node {} does not contain LSP {}", input.getNode(), input.getName());
                        return OperationResults.UNSENT.future();
                }
 
-               if (rep.getLsp().getOperational().equals(input.getArguments().getOperational())) {
+               final ReportedLsp1 ra = rep.getAugmentation(ReportedLsp1.class);
+               if (ra == null) {
+                       LOG.warn("Node {} LSP {} does not contain data", input.getNode(), input.getName());
+                       return OperationResults.UNSENT.future();
+               }
+
+               if (ra.getLsp().getOperational().equals(op)) {
                        return OperationResults.SUCCESS.future();
                } else {
                        return OperationResults.UNSENT.future();
index 24d40b634310e68080f111c7e278d585def2935b..c2120090ec1f8e4f4cfd5da104bc39a9b8d060c9 100644 (file)
@@ -20,8 +20,8 @@ import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.
 import com.google.common.base.Preconditions;
 
 @ThreadSafe
-final class TopologyNodeState<PATHNAME> {
-       private final Map<PATHNAME, Metadata> metadata = new HashMap<>();
+final class TopologyNodeState {
+       private final Map<String, Metadata> metadata = new HashMap<>();
        private final long holdStateNanos;
        private final NodeId nodeId;
        private long lastReleased = 0;
@@ -36,11 +36,11 @@ final class TopologyNodeState<PATHNAME> {
                return nodeId;
        }
 
-       public synchronized Metadata getLspMetadata(final PATHNAME name) {
+       public synchronized Metadata getLspMetadata(final String name) {
                return metadata.get(name);
        }
 
-       public synchronized void setLspMetadata(final PATHNAME name, final Metadata value) {
+       public synchronized void setLspMetadata(final String name, final Metadata value) {
                if (value == null) {
                        metadata.remove(name);
                } else {
@@ -48,12 +48,12 @@ final class TopologyNodeState<PATHNAME> {
                }
        }
 
-       public synchronized void removeLspMetadata(final PATHNAME name) {
+       public synchronized void removeLspMetadata(final String name) {
                metadata.remove(name);
        }
 
-       public synchronized void cleanupExcept(final Collection<PATHNAME> values) {
-               final Iterator<PATHNAME> it = metadata.keySet().iterator();
+       public synchronized void cleanupExcept(final Collection<String> values) {
+               final Iterator<String> it = metadata.keySet().iterator();
                while (it.hasNext()) {
                        if (!values.contains(it.next())) {
                                it.remove();
index 1c334d4c635df49c8f06fd7065e5702eb90c7f5d..65da8cd8b08d520a848d3fcbf89fb9b76453c0c6 100644 (file)
@@ -100,7 +100,9 @@ final class TopologyProgramming implements NetworkTopologyPcepProgrammingService
                Preconditions.checkArgument(input.getNode() != null);
                Preconditions.checkArgument(input.getName() != null);
                Preconditions.checkArgument(input.getArguments() != null);
-               Preconditions.checkArgument(input.getArguments().getOperational() != null);
+
+               // FIXME: can we validate this early?
+               //Preconditions.checkArgument(input.getArguments().getOperational() != null);
 
                final SubmitEnsureLspOperationalOutputBuilder b = new SubmitEnsureLspOperationalOutputBuilder();
                b.setResult(AbstractInstructionExecutor.schedule(scheduler, new AbstractInstructionExecutor(input) {
index 950d5178d01a624fac02df9c93031f45b0860a51..1fcdb8954aeaa4c5ae23d793a9e00b85eba53e18 100644 (file)
@@ -17,6 +17,7 @@ import org.opendaylight.controller.sal.binding.api.data.DataChangeListener;
 import org.opendaylight.controller.sal.binding.api.data.DataModificationTransaction;
 import org.opendaylight.controller.sal.binding.api.data.DataProviderService;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpAddress;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.ReportedLsp1;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.SymbolicPathName;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.lsp.identifiers.tlv.lsp.identifiers.AddressFamily;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.endpoints.address.family.Ipv4Case;
@@ -62,6 +63,7 @@ import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import com.google.common.base.Charsets;
 import com.google.common.base.Preconditions;
 import com.google.common.collect.Lists;
 import com.google.common.util.concurrent.FutureCallback;
@@ -202,9 +204,10 @@ public final class NodeChangedListener implements DataChangeListener {
        }
 
        private void create(final DataModificationTransaction trans, final InstanceIdentifier<ReportedLsp> i, final ReportedLsp value) {
-
                final InstanceIdentifier<Node> ni = i.firstIdentifierOf(Node.class);
-               final AddressFamily af = value.getLsp().getTlvs().getLspIdentifiers().getAddressFamily();
+               final ReportedLsp1 rl = value.getAugmentation(ReportedLsp1.class);
+
+               final AddressFamily af = rl.getLsp().getTlvs().getLspIdentifiers().getAddressFamily();
 
                /*
                 * We are trying to ensure we have source and destination nodes.
@@ -222,15 +225,15 @@ public final class NodeChangedListener implements DataChangeListener {
                        throw new IllegalArgumentException("Unsupported address family: " + af.getImplementedInterface());
                }
 
-               final InstanceIdentifier<TerminationPoint> src = getIpTerminationPoint(trans, srcIp, ni, value.getLsp().isDelegate());
-               final InstanceIdentifier<TerminationPoint> dst = getIpTerminationPoint(trans, dstIp, null, Boolean.FALSE);
-
                final Link1Builder lab = new Link1Builder(value.getPath().getLspa());
-               lab.setAdministrativeStatus(value.getLsp().isAdministrative() ? AdministrativeStatus.Active : AdministrativeStatus.Inactive);
                lab.setBandwidth(value.getPath().getBandwidth().getBandwidth());
                lab.setClassType(value.getPath().getClassType().getClassType());
-               lab.setSymbolicPathName(value.getName());
-               lab.setOperationalStatus(value.getLsp().getOperational());
+               lab.setSymbolicPathName(new SymbolicPathName(value.getName().getBytes(Charsets.UTF_8)));
+
+               final InstanceIdentifier<TerminationPoint> dst = getIpTerminationPoint(trans, dstIp, null, Boolean.FALSE);
+               final InstanceIdentifier<TerminationPoint> src = getIpTerminationPoint(trans, srcIp, ni, rl.getLsp().isDelegate());;
+               lab.setOperationalStatus(rl.getLsp().getOperational());
+               lab.setAdministrativeStatus(rl.getLsp().isAdministrative() ? AdministrativeStatus.Active : AdministrativeStatus.Inactive);
 
                final LinkId id = linkIdForLsp(i, value);
                final LinkBuilder lb = new LinkBuilder();
@@ -405,7 +408,7 @@ public final class NodeChangedListener implements DataChangeListener {
        }
 
        public static InstanceIdentifier<Link> linkIdentifier(final InstanceIdentifier<Topology> topology, final NodeId node,
-                       final SymbolicPathName name) {
+                       final String name) {
                return InstanceIdentifier.builder(topology).child(Link.class, new LinkKey(new LinkId(node.getValue() + "/lsp/" + name))).toInstance();
        }
 }
index 77780dd46efbf16873d6bd49c44efab483523aa5..a14874e1408fc8b67ba1b5af4ae168f482130967 100644 (file)
@@ -7,6 +7,7 @@
  */
 package org.opendaylight.bgpcep.pcep.tunnel.provider;
 
+import java.nio.ByteBuffer;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -72,6 +73,7 @@ import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import com.google.common.base.Charsets;
 import com.google.common.base.Function;
 import com.google.common.base.Preconditions;
 import com.google.common.util.concurrent.Futures;
@@ -225,7 +227,7 @@ public final class TunnelProgramming implements TopologyTunnelPcepProgrammingSer
 
                                final AddLspInputBuilder ab = new AddLspInputBuilder();
                                ab.setNode(Preconditions.checkNotNull(supportingNode(sn)));
-                               ab.setName(Preconditions.checkNotNull(input.getSymbolicPathName()));
+                               ab.setName(Charsets.UTF_8.decode(ByteBuffer.wrap(Preconditions.checkNotNull(input.getSymbolicPathName()).getValue())).toString());
 
                                // The link has to be non-existent
                                final InstanceIdentifier<Link> lii = NodeChangedListener.linkIdentifier(tii, ab.getNode(), ab.getName());
@@ -282,7 +284,7 @@ public final class TunnelProgramming implements TopologyTunnelPcepProgrammingSer
                                Preconditions.checkState(node != null);
 
                                final RemoveLspInputBuilder ab = new RemoveLspInputBuilder();
-                               ab.setName(link.getAugmentation(Link1.class).getSymbolicPathName());
+                               ab.setName(Charsets.UTF_8.decode(ByteBuffer.wrap(link.getAugmentation(Link1.class).getSymbolicPathName().getValue())).toString());
                                ab.setNode(node.getSupportingNode().get(0).getKey().getNodeRef());
 
                                return Futures.transform(
@@ -321,7 +323,7 @@ public final class TunnelProgramming implements TopologyTunnelPcepProgrammingSer
                                Preconditions.checkState(node != null);
 
                                final UpdateLspInputBuilder ab = new UpdateLspInputBuilder();
-                               ab.setName(link.getAugmentation(Link1.class).getSymbolicPathName());
+                               ab.setName(Charsets.UTF_8.decode(ByteBuffer.wrap(link.getAugmentation(Link1.class).getSymbolicPathName().getValue())).toString());
                                ab.setNode(Preconditions.checkNotNull(supportingNode(node)));
 
                                final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev131024.update.lsp.args.ArgumentsBuilder args = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev131024.update.lsp.args.ArgumentsBuilder();