Fixed small bugs in PCEP. Adjusted configuration. 14/5114/4
authorDana Kutenicsova <dkutenic@cisco.com>
Tue, 4 Feb 2014 09:50:24 +0000 (10:50 +0100)
committerDana Kutenicsova <dkutenic@cisco.com>
Tue, 4 Feb 2014 12:36:20 +0000 (13:36 +0100)
Change-Id: I0879c7ffada0c8444e4cfe2694970fbebfdc6fc7
Signed-off-by: Dana Kutenicsova <dkutenic@cisco.com>
pcep/impl-config/src/main/yang/odl-pcep-impl-cfg.yang
pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/AbstractMessageParser.java
pcep/topology-provider/src/main/java/org/opendaylight/bgpcep/pcep/topology/provider/AbstractTopologySessionListener.java

index b0d74b766ca2a1fd64bafc303dd990a02f72314f..f5ddbc08ee99a082d63d8aa8095412aae83443ed 100644 (file)
@@ -178,7 +178,7 @@ module odl-pcep-impl-cfg {
 
             leaf initiated {
                 type boolean;
-                default false;
+                default true;
             }
 
             leaf stateful {
index bd29b3f9b97374c5ed74f57e94307ec463feb308..e999bf3c99d822699bb0097cf6ef29a24a529951 100644 (file)
@@ -57,7 +57,7 @@ public abstract class AbstractMessageParser implements MessageParser, MessageSer
 
        protected byte[] serializeObject(final Object object) {
                if (object == null) {
-                       throw new IllegalArgumentException("Null object passed.");
+                       return new byte[] {};
                }
                final ObjectSerializer serializer = this.registry.getObjectSerializer(object);
                return serializer.serializeObject(object);
index 1539555d358ff9c4170ee842d216250c106e61d8..158f24644fd1f06157b4021ac30e514ac450cdbc 100644 (file)
@@ -71,11 +71,10 @@ public abstract class AbstractTopologySessionListener<SRPID, PLSPID> implements
                        return this.version;
                }
        };
-       private static final Logger LOG = LoggerFactory.getLogger(Stateful07TopologySessionListener.class);
+       private static final Logger LOG = LoggerFactory.getLogger(AbstractTopologySessionListener.class);
        private static final Pcerr UNHANDLED_MESSAGE_ERROR = new PcerrBuilder().setPcerrMessage(
                        new PcerrMessageBuilder().setErrorType(null).build()).build();
 
-
        // FIXME: make this private
        protected final ServerSessionManager serverSessionManager;
 
@@ -106,8 +105,7 @@ public abstract class AbstractTopologySessionListener<SRPID, PLSPID> implements
                for (final Node n : topo.getNode()) {
                        LOG.debug("Matching topology node {} to id {}", n, pccId);
                        if (n.getNodeId().getValue().equals(pccId)) {
-                               this.topologyNode =
-                                               InstanceIdentifier.builder(this.serverSessionManager.getTopology()).child(Node.class, n.getKey()).toInstance();
+                               this.topologyNode = InstanceIdentifier.builder(this.serverSessionManager.getTopology()).child(Node.class, n.getKey()).toInstance();
                                LOG.debug("Reusing topology node {} for id {} at {}", n, pccId, this.topologyNode);
                                return n;
                        }
@@ -153,7 +151,7 @@ public abstract class AbstractTopologySessionListener<SRPID, PLSPID> implements
 
                this.topologyAugmentBuilder = new Node1Builder().setPathComputationClient(this.pccBuilder.build());
                this.topologyAugment = InstanceIdentifier.builder(this.topologyNode).augmentation(Node1.class).toInstance();
-               final Node1 ta = topologyAugmentBuilder.build();
+               final Node1 ta = this.topologyAugmentBuilder.build();
 
                trans.putOperationalData(this.topologyAugment, ta);
                LOG.debug("Peer data {} set to {}", this.topologyAugment, ta);
@@ -257,8 +255,8 @@ public abstract class AbstractTopologySessionListener<SRPID, PLSPID> implements
 
        @Override
        public void close() {
-               if (session != null) {
-                       session.close(TerminationReason.Unknown);
+               if (this.session != null) {
+                       this.session.close(TerminationReason.Unknown);
                }
        }
 
@@ -298,17 +296,16 @@ public abstract class AbstractTopologySessionListener<SRPID, PLSPID> implements
                return req.getFuture();
        }
 
-
-       protected final synchronized void updateLsp(final DataModificationTransaction trans, final PLSPID id, String name, final ReportedLspBuilder rlb, final boolean solicited) {
+       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);
+                       name = this.lsps.get(id);
                        if (name == null) {
                                LOG.error("PLSPID {} seen for the first time, not reporting the LSP", id);
                                return;
                        }
                }
-               lsps.put(id, name);
-
+               this.lsps.put(id, name);
 
                Preconditions.checkState(name != null);
                rlb.setKey(new ReportedLspKey(name));
@@ -338,7 +335,7 @@ public abstract class AbstractTopologySessionListener<SRPID, PLSPID> implements
 
                // The node has completed synchronization, cleanup metadata no longer reported back
                this.nodeState.cleanupExcept(this.lsps.values());
-               LOG.debug("Session {} achieved synchronized state", session);
+               LOG.debug("Session {} achieved synchronized state", this.session);
        }
 
        protected final InstanceIdentifierBuilder<ReportedLsp> lspIdentifier(final String name) {
@@ -346,7 +343,7 @@ public abstract class AbstractTopologySessionListener<SRPID, PLSPID> implements
        }
 
        protected final synchronized void removeLsp(final DataModificationTransaction trans, final PLSPID id) {
-               final String name = lsps.remove(id);
+               final String name = this.lsps.remove(id);
                if (name != null) {
                        trans.removeOperationalData(lspIdentifier(name).build());
                }
@@ -355,5 +352,6 @@ public abstract class AbstractTopologySessionListener<SRPID, PLSPID> implements
        }
 
        abstract protected void onSessionUp(PCEPSession session, PathComputationClientBuilder pccBuilder);
+
        abstract protected boolean onMessage(DataModificationTransaction trans, Message message);
 }