use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev171025.Tlvs3 in project bgpcep by opendaylight.
the class PCCMockCommon method checkResyncSession.
static void checkResyncSession(final Optional<Integer> startAtNumberLsp, final int expectedNumberOfLsp, final int expectedTotalMessages, final BigInteger startingDBVersion, final BigInteger expectedDBVersion, final TestingSessionListener pceSessionListener) throws Exception {
assertNotNull(pceSessionListener.getSession());
assertTrue(pceSessionListener.isUp());
final List<Message> messages;
checkReceivedMessages(pceSessionListener, expectedTotalMessages);
if (startAtNumberLsp.isPresent()) {
messages = pceSessionListener.messages().subList(startAtNumberLsp.get(), startAtNumberLsp.get() + expectedNumberOfLsp);
} else {
messages = pceSessionListener.messages();
}
checkEquals(() -> checkSequequenceDBVersionSync(pceSessionListener, expectedDBVersion));
assertEquals(expectedNumberOfLsp, messages.size());
final PCEPSession session = pceSessionListener.getSession();
checkSession(session, DEAD_TIMER, KEEP_ALIVE);
assertTrue(session.getRemoteTlvs().getAugmentation(Tlvs1.class).getStateful().getAugmentation(Stateful1.class).isInitiation());
final BigInteger pceDBVersion = session.getLocalTlvs().getAugmentation(Tlvs3.class).getLspDbVersion().getLspDbVersionValue();
assertEquals(startingDBVersion, pceDBVersion);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev171025.Tlvs3 in project bgpcep by opendaylight.
the class SrObjectParserTest method testOpenObjectWithSpcTlv.
@Test
public void testOpenObjectWithSpcTlv() throws PCEPDeserializerException {
final PcepOpenObjectWithSpcTlvParser parser = new PcepOpenObjectWithSpcTlvParser(this.tlvRegistry, this.viTlvRegistry);
final OpenBuilder builder = new OpenBuilder();
builder.setProcessingRule(false);
builder.setIgnore(false);
builder.setVersion(new ProtocolVersion((short) 1));
builder.setKeepalive((short) 30);
builder.setDeadTimer((short) 120);
builder.setSessionId((short) 1);
final Tlvs1 tlv = new Tlvs1Builder().setSrPceCapability(new SrPceCapabilityBuilder().setMsd((short) 1).build()).build();
builder.setTlvs(new TlvsBuilder().addAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.Tlvs1.class, new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.Tlvs1Builder().build()).addAugmentation(Tlvs1.class, tlv).addAugmentation(Tlvs3.class, new Tlvs3Builder().build()).build());
final ByteBuf result = Unpooled.wrappedBuffer(openObjectBytes);
assertEquals(builder.build(), parser.parseObject(new ObjectHeaderImpl(false, false), result.slice(4, result.readableBytes() - 4)));
final ByteBuf buffer = Unpooled.buffer();
parser.serializeObject(builder.build(), buffer);
parser.serializeTlvs(null, Unpooled.EMPTY_BUFFER);
parser.serializeTlvs(new TlvsBuilder().build(), Unpooled.EMPTY_BUFFER);
assertArrayEquals(openObjectBytes, ByteArray.getAllBytes(buffer));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev171025.Tlvs3 in project bgpcep by opendaylight.
the class PCCPeerProposal method setPeerSpecificProposal.
@Override
public void setPeerSpecificProposal(@Nonnull final InetSocketAddress address, @Nonnull final TlvsBuilder openBuilder) {
requireNonNull(address);
final LspDbVersion lspDbVersion = new LspDbVersionBuilder().setLspDbVersionValue(this.dbVersion).build();
openBuilder.addAugmentation(Tlvs3.class, new Tlvs3Builder().setLspDbVersion(lspDbVersion).build());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev171025.Tlvs3 in project bgpcep by opendaylight.
the class PCEPStatefulPeerProposalTest method testSetPeerProposalWithEntityIdSuccess.
@Test
public void testSetPeerProposalWithEntityIdSuccess() throws InterruptedException, ExecutionException {
doReturn(Optional.of(LSP_DB_VERSION)).when(this.listenableFutureMock).get();
final PCEPStatefulPeerProposal peerProposal = PCEPStatefulPeerProposal.createStatefulPeerProposal(this.dataBroker, TOPOLOGY_IID);
peerProposal.setPeerProposal(NODE_ID, this.tlvsBuilder, SPEAKER_ID);
final Tlvs3 aug = this.tlvsBuilder.getAugmentation(Tlvs3.class);
assertEquals(LSP_DB_VERSION, aug.getLspDbVersion());
assertArrayEquals(SPEAKER_ID, aug.getSpeakerEntityId().getSpeakerEntityIdValue());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev171025.Tlvs3 in project bgpcep by opendaylight.
the class SessionStateImpl method init.
public synchronized void init(final PCEPSessionState session) {
requireNonNull(session);
this.pcepSessionState = session;
final Open localOpen = session.getLocalOpen();
if (localOpen.getTlvs() != null && localOpen.getTlvs().getAugmentation(Tlvs3.class) != null) {
final SpeakerEntityId entityId = localOpen.getTlvs().getAugmentation(Tlvs3.class).getSpeakerEntityId();
if (entityId != null) {
this.localPref = new LocalPrefBuilder(session.getLocalPref()).addAugmentation(PcepEntityIdStatsAug.class, new PcepEntityIdStatsAugBuilder(entityId).build()).build();
}
} else {
this.localPref = session.getLocalPref();
}
this.peerPref = session.getPeerPref();
this.sessionUpDuration.start();
}
Aggregations