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();
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();
}
}
- 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()
// 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);
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();