Bug-3204: If no LSP Identifiers TLV is present in PCRpt message updateLsp in DS throw... 70/22570/1
authorMilos Fabian <milfabia@cisco.com>
Mon, 15 Jun 2015 09:04:03 +0000 (11:04 +0200)
committerMilos Fabian <milfabia@cisco.com>
Mon, 15 Jun 2015 09:04:03 +0000 (11:04 +0200)
-handle report message including non-RSVP-TE payload and no LSP Identifier TLV
-in this case use PLSP-ID value as a path identifier in PCEP topology

Change-Id: If1f5716ce0dfaa635028bb4e956ea8595d7b3e34
Signed-off-by: Milos Fabian <milfabia@cisco.com>
pcep/segment-routing/src/test/java/org/opendaylight/protocol/pcep/segment/routing/TopologyProviderTest.java
pcep/topology-provider/src/main/java/org/opendaylight/bgpcep/pcep/topology/provider/Stateful07TopologySessionListener.java

index 1606001389c86c0bdd754fc17bd4a3f9d29523f9..031f07082dd7436a067ff39adc005df4490bbb88 100644 (file)
@@ -65,7 +65,7 @@ public class TopologyProviderTest extends AbstractPCEPSessionTest<Stateful07Topo
     public void testOnReportMessage() throws InterruptedException, ExecutionException {
         this.listener.onSessionUp(this.session);
 
-        Pcrpt pcRptMsg = createSrPcRpt("1.1.1.1", "sr-path1", 1L);
+        Pcrpt pcRptMsg = createSrPcRpt("1.1.1.1", "sr-path1", 1L, true);
         this.listener.onMessage(this.session, pcRptMsg);
         //check sr-path
         Topology topology = getTopology().get();
@@ -78,14 +78,14 @@ public class TopologyProviderTest extends AbstractPCEPSessionTest<Stateful07Topo
         Assert.assertEquals(1, subobjects.size());
         Assert.assertEquals("1.1.1.1", ((IpNodeId)((SrEroType)subobjects.get(0).getSubobjectType()).getNai()).getIpAddress().getIpv4Address().getValue());
 
-        pcRptMsg = createSrPcRpt("1.1.1.3", "sr-path2", 2L);
+        pcRptMsg = createSrPcRpt("1.1.1.3", "sr-path2", 2L, false);
         this.listener.onMessage(this.session, pcRptMsg);
         //check second lsp sr-path
         topology = getTopology().get();
         reportedLsps = topology.getNode().get(0).getAugmentation(Node1.class).getPathComputationClient().getReportedLsp();
         Assert.assertEquals(2, reportedLsps.size());
 
-        pcRptMsg = createSrPcRpt("1.1.1.2", "sr-path1", 1L);
+        pcRptMsg = createSrPcRpt("1.1.1.2", "sr-path1", 1L, true);
         this.listener.onMessage(this.session, pcRptMsg);
         //check updated sr-path
         topology = getTopology().get();
@@ -100,11 +100,14 @@ public class TopologyProviderTest extends AbstractPCEPSessionTest<Stateful07Topo
         }
     }
 
-    private static Pcrpt createSrPcRpt(final String nai, final String pathName, final long plspId) {
+    private static Pcrpt createSrPcRpt(final String nai, final String pathName, final long plspId, final boolean hasLspIdTlv) {
+        final TlvsBuilder lspTlvBuilder = new TlvsBuilder();
+        if (hasLspIdTlv) {
+            lspTlvBuilder.setLspIdentifiers(new LspIdentifiersBuilder().setLspId(new LspId(plspId)).build());
+        }
         return new PcrptBuilder().setPcrptMessage(new PcrptMessageBuilder().setReports(Lists.newArrayList(new ReportsBuilder()
             .setLsp(new LspBuilder().setPlspId(new PlspId(plspId)).setRemove(false).setSync(true).setAdministrative(true).setDelegate(true)
-                    .setTlvs(new TlvsBuilder()
-                        .setLspIdentifiers(new LspIdentifiersBuilder().setLspId(new LspId(plspId)).build())
+                    .setTlvs(lspTlvBuilder
                         .setSymbolicPathName(new SymbolicPathNameBuilder().setPathName(new SymbolicPathName(pathName.getBytes(Charsets.UTF_8))).build()).build()).build())
             .setSrp(new SrpBuilder().setOperationId(new SrpIdNumber(0L)).setTlvs(
                     new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.srp.object.srp.TlvsBuilder()
index 8d4de8268ca27e185dd6edb572deb64eee4b6382..2637bf7c89f5106604b86659c6eae5dfea3340d3 100644 (file)
@@ -197,8 +197,12 @@ final class Stateful07TopologySessionListener extends AbstractTopologySessionLis
             // this is to ensure a path will be created at any rate
             final Path1Builder p1Builder = new Path1Builder();
             p1Builder.setLsp(report.getLsp());
+            final PathSetupType pst;
             if (srp != null && srp.getTlvs() != null && srp.getTlvs().getPathSetupType() != null) {
-                p1Builder.setPathSetupType(srp.getTlvs().getPathSetupType());
+                pst = srp.getTlvs().getPathSetupType();
+                p1Builder.setPathSetupType(pst);
+            } else {
+                pst = null;
             }
             pb.addAugmentation(Path1.class, p1Builder.build());
             String name = lookupLspName(plspid);
@@ -206,6 +210,8 @@ final class Stateful07TopologySessionListener extends AbstractTopologySessionLis
             if (tlvs != null) {
                 if (tlvs.getLspIdentifiers() != null) {
                     pb.setLspId(tlvs.getLspIdentifiers().getLspId());
+                } else if (!isDefaultPST(pst)) {
+                    pb.setLspId(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev130820.LspId(lsp.getPlspId().getValue()));
                 }
                 if (tlvs.getSymbolicPathName() != null) {
                     name = Charsets.UTF_8.decode(ByteBuffer.wrap(tlvs.getSymbolicPathName().getPathName().getValue())).toString();