use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.symbolic.path.name.tlv.SymbolicPathNameBuilder in project bgpcep by opendaylight.
the class PCEPTopologySessionListenerTest method testUnknownLsp.
@Test
public void testUnknownLsp() throws Exception {
final List<Reports> reports = Lists.newArrayList(new ReportsBuilder().setPath(new PathBuilder().setEro(new EroBuilder().build()).build()).setLsp(new LspBuilder().setPlspId(new PlspId(Uint32.valueOf(5))).setSync(FALSE).setRemove(FALSE).setTlvs(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.object.lsp.TlvsBuilder().setLspIdentifiers(new LspIdentifiersBuilder().setLspId(new LspId(Uint32.ONE)).build()).setSymbolicPathName(new SymbolicPathNameBuilder().setPathName(new SymbolicPathName(new byte[] { 22, 34 })).build()).build()).build()).build());
final Pcrpt rptmsg = new PcrptBuilder().setPcrptMessage(new PcrptMessageBuilder().setReports(reports).build()).build();
listener.onSessionUp(session);
listener.onMessage(session, rptmsg);
readDataOperational(getDataBroker(), TOPO_IID, node -> {
assertFalse(node.nonnullNode().isEmpty());
return node;
});
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.symbolic.path.name.tlv.SymbolicPathNameBuilder in project bgpcep by opendaylight.
the class StateSynchronizationAvoidanceProcedureTest method testStateSynchronizationPerformed.
@Test
public void testStateSynchronizationPerformed() throws Exception {
PCEPSession session = getPCEPSession(getOpen(null), getOpen(null));
listener.onSessionUp(session);
// report LSP + LSP-DB version number
final Pcrpt pcRpt = MsgBuilderUtil.createPcRtpMessage(new LspBuilder().setPlspId(new PlspId(Uint32.ONE)).setTlvs(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.object.lsp.TlvsBuilder().setLspIdentifiers(new LspIdentifiersBuilder().setLspId(new LspId(Uint32.ONE)).build()).setSymbolicPathName(new SymbolicPathNameBuilder().setPathName(new SymbolicPathName("test".getBytes())).build()).addAugmentation(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev200720.Tlvs1Builder().setLspDbVersion(new LspDbVersionBuilder().setLspDbVersionValue(Uint64.ONE).build()).build()).build()).setPlspId(new PlspId(Uint32.ONE)).setSync(true).setRemove(false).setOperational(OperationalStatus.Active).build(), Optional.empty(), createPath(Collections.emptyList()));
listener.onMessage(session, pcRpt);
readDataOperational(getDataBroker(), pathComputationClientIId, pcc -> {
assertFalse(pcc.nonnullReportedLsp().isEmpty());
return pcc;
});
listener.onSessionDown(session, new IllegalArgumentException("Simulate Exception"));
listener = getSessionListener();
// session up - expect sync (LSP-DBs do not match)
final LspDbVersion localDbVersion = new LspDbVersionBuilder().setLspDbVersionValue(Uint64.TWO).build();
session = getPCEPSession(getOpen(localDbVersion), getOpen(null));
listener.onSessionUp(session);
readDataOperational(getDataBroker(), pathComputationClientIId, pcc -> {
// check node - not synchronized
assertEquals(PccSyncState.InitialResync, pcc.getStateSync());
// check reported LSP - persisted from previous session
assertFalse(pcc.nonnullReportedLsp().isEmpty());
return pcc;
});
// sync rpt + LSP-DB
final Pcrpt syncMsg = MsgBuilderUtil.createPcRtpMessage(createLsp(Uint32.ZERO, false, Optional.of(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.object.lsp.TlvsBuilder().addAugmentation(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev200720.Tlvs1Builder().setLspDbVersion(new LspDbVersionBuilder().setLspDbVersionValue(Uint64.TWO).build()).build()).build()), true, false), Optional.empty(), createPath(Collections.emptyList()));
listener.onMessage(session, syncMsg);
readDataOperational(getDataBroker(), pathComputationClientIId, pcc -> {
// check node - synchronized
assertEquals(PccSyncState.Synchronized, pcc.getStateSync());
// check reported LSP is empty, LSP state from previous session was purged
assertNull(pcc.getReportedLsp());
return pcc;
});
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.symbolic.path.name.tlv.SymbolicPathNameBuilder in project bgpcep by opendaylight.
the class Stateful07TopologySessionListenerTest method testUnknownLsp.
@Test
public void testUnknownLsp() throws Exception {
final List<Reports> reports = Lists.newArrayList(new ReportsBuilder().setPath(new PathBuilder().setEro(new EroBuilder().build()).build()).setLsp(new LspBuilder().setPlspId(new PlspId(5L)).setSync(false).setRemove(false).setTlvs(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.object.lsp.TlvsBuilder().setLspIdentifiers(new LspIdentifiersBuilder().setLspId(new LspId(1L)).build()).setSymbolicPathName(new SymbolicPathNameBuilder().setPathName(new SymbolicPathName(new byte[] { 22, 34 })).build()).build()).build()).build());
final Pcrpt rptmsg = new PcrptBuilder().setPcrptMessage(new PcrptMessageBuilder().setReports(reports).build()).build();
this.listener.onSessionUp(this.session);
this.listener.onMessage(this.session, rptmsg);
readDataOperational(getDataBroker(), TOPO_IID, node -> {
assertFalse(node.getNode().isEmpty());
return node;
});
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.symbolic.path.name.tlv.SymbolicPathNameBuilder in project bgpcep by opendaylight.
the class PCEPTlvParserTest method testSymbolicNameTlv.
@Test
public void testSymbolicNameTlv() throws PCEPDeserializerException {
final StatefulLspSymbolicNameTlvParser parser = new StatefulLspSymbolicNameTlvParser();
final SymbolicPathName tlv = new SymbolicPathNameBuilder().setPathName(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.SymbolicPathName("Med test of symbolic nameeee".getBytes())).build();
assertEquals(tlv, parser.parseTlv(Unpooled.wrappedBuffer(ByteArray.cutBytes(SYMBOLIC_NAME_BYTES, 4))));
final ByteBuf buff = Unpooled.buffer();
parser.serializeTlv(tlv, buff);
assertArrayEquals(SYMBOLIC_NAME_BYTES, ByteArray.getAllBytes(buff));
}
Aggregations