use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev200120.stat.Tlvs in project bgpcep by opendaylight.
the class PcepOpenObjectWithSpcTlvParser method addTlv.
@Override
public void addTlv(final TlvsBuilder tbuilder, final Tlv tlv) {
super.addTlv(tbuilder, tlv);
final Tlvs1Builder tlvBuilder = new Tlvs1Builder();
if (tbuilder.augmentation(Tlvs1.class) != null) {
final Tlvs1 tlvs = tbuilder.augmentation(Tlvs1.class);
if (tlvs.getSrPceCapability() != null) {
tlvBuilder.setSrPceCapability(tlvs.getSrPceCapability());
}
}
if (tlv instanceof SrPceCapability) {
tlvBuilder.setSrPceCapability((SrPceCapability) tlv);
}
tbuilder.addAugmentation(tlvBuilder.build());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev200120.stat.Tlvs in project bgpcep by opendaylight.
the class PCEPTopologySessionListener method buildPath.
private static Path buildPath(final Reports report, final Srp srp, final Lsp lsp) {
final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev200120.pcep.client.attributes.path.computation.client.reported.lsp.PathBuilder pb = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev200120.pcep.client.attributes.path.computation.client.reported.lsp.PathBuilder();
if (report.getPath() != null) {
pb.fieldsFrom(report.getPath());
}
// LSP is mandatory (if there is none, parser will throw an exception)
// 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) {
pst = srp.getTlvs().getPathSetupType();
p1Builder.setPathSetupType(pst);
} else {
pst = null;
}
pb.addAugmentation(p1Builder.build());
final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.object.lsp.Tlvs tlvs = report.getLsp().getTlvs();
if (tlvs != null) {
if (tlvs.getLspIdentifiers() != null) {
pb.setLspId(tlvs.getLspIdentifiers().getLspId());
} else if (!PSTUtil.isDefaultPST(pst)) {
pb.setLspId(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.LspId(lsp.getPlspId().getValue()));
}
}
return pb.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev200120.stat.Tlvs in project bgpcep by opendaylight.
the class PCEPTopologySessionListenerTest method testDelegatedLspsCountWithDelegation.
@Test
public void testDelegatedLspsCountWithDelegation() throws Exception {
listener.onSessionUp(session);
topologyRpcs.addLsp(createAddLspInput());
assertEquals(1, receivedMsgs.size());
assertTrue(receivedMsgs.get(0) instanceof Pcinitiate);
final Pcinitiate pcinitiate = (Pcinitiate) receivedMsgs.get(0);
final Requests req = pcinitiate.getPcinitiateMessage().getRequests().get(0);
final Uint32 srpId = req.getSrp().getOperationId().getValue();
final Tlvs tlvs = createLspTlvs(req.getLsp().getPlspId().getValue(), true, testAddress, testAddress, testAddress, Optional.empty());
// delegate set to true
final Pcrpt pcRpt = MsgBuilderUtil.createPcRtpMessage(new LspBuilder(req.getLsp()).setTlvs(tlvs).setPlspId(new PlspId(Uint32.ONE)).setSync(FALSE).setRemove(FALSE).setOperational(OperationalStatus.Active).setDelegate(TRUE).build(), Optional.of(MsgBuilderUtil.createSrp(srpId)), MsgBuilderUtil.createPath(req.getEro().getSubobject()));
listener.onMessage(session, pcRpt);
checkEquals(() -> assertEquals(1, listener.listenerState.getDelegatedLspsCount().intValue()));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev200120.stat.Tlvs in project bgpcep by opendaylight.
the class SyncOptimizationTest method testDoesLspDbMatchPositive.
@Test
public void testDoesLspDbMatchPositive() {
final Tlvs tlvs = createTlvs(1L, false, false);
Mockito.doReturn(tlvs).when(this.pcepSession).getLocalTlvs();
Mockito.doReturn(tlvs).when(this.pcepSession).getRemoteTlvs();
final SyncOptimization syncOpt = new SyncOptimization(this.pcepSession);
assertTrue(syncOpt.doesLspDbMatch());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev200120.stat.Tlvs in project bgpcep by opendaylight.
the class SyncOptimizationTest method testIsDbVersionPresentNegative.
@Test
public void testIsDbVersionPresentNegative() {
final Tlvs tlvs = createTlvs(null, true, false);
Mockito.doReturn(tlvs).when(this.pcepSession).getLocalTlvs();
Mockito.doReturn(tlvs).when(this.pcepSession).getRemoteTlvs();
final SyncOptimization syncOpt = new SyncOptimization(this.pcepSession);
assertFalse(syncOpt.isDbVersionPresent());
}
Aggregations