use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.identifiers.tlv.lsp.identifiers.address.family.ipv4._case.Ipv4 in project bgpcep by opendaylight.
the class BGPParserTest method testEORIpv4.
/*
* End of Rib for Ipv4.
*
* ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff <- marker
* 00 17 <- length (23) - including header
* 02 <- message type
* 00 00 <- withdrawn routes length
* 00 00 <- total path attribute length
*/
@Test
public void testEORIpv4() throws Exception {
final byte[] body = ByteArray.cutBytes(INPUT_BYTES.get(5), MessageUtil.COMMON_HEADER_LENGTH);
final int messageLength = ByteArray.bytesToInt(ByteArray.subByte(INPUT_BYTES.get(5), MessageUtil.MARKER_LENGTH, LENGTH_FIELD_LENGTH));
final Update message = BGPParserTest.updateParser.parseMessageBody(Unpooled.copiedBuffer(body), messageLength, null);
assertEquals(new UpdateBuilder().build(), message);
final ByteBuf buffer = Unpooled.buffer();
BGPParserTest.updateParser.serializeMessage(message, buffer);
assertArrayEquals(INPUT_BYTES.get(5), ByteArray.readAllBytes(buffer));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.identifiers.tlv.lsp.identifiers.address.family.ipv4._case.Ipv4 in project bgpcep by opendaylight.
the class LlGracefulCapabilityHandlerTest method testLongLivedGracefulCapabilityHandler.
@Test
public void testLongLivedGracefulCapabilityHandler() throws BGPParsingException, BGPDocumentedException {
final byte[] capaBytes = { // header
(byte) 0x47, (byte) 0x0e, // Ipv4 Unicast, afiFlags = false, timer = 10
(byte) 0x00, (byte) 0x01, (byte) 0x01, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x0a, // Ipv6 Unicast, afiFlags = true, timer = 160
(byte) 0x00, (byte) 0x02, (byte) 0x01, (byte) 0x80, (byte) 0x00, (byte) 0x00, (byte) 0xa0 };
final LlGracefulRestartCapability capability = new LlGracefulRestartCapabilityBuilder().setTables(BindingMap.ordered(new TablesBuilder().setAfi(Ipv4AddressFamily.class).setSafi(UnicastSubsequentAddressFamily.class).setAfiFlags(new Tables.AfiFlags(Boolean.FALSE)).setLongLivedStaleTime(TEN).build(), new TablesBuilder().setAfi(Ipv6AddressFamily.class).setSafi(UnicastSubsequentAddressFamily.class).setAfiFlags(new Tables.AfiFlags(Boolean.TRUE)).setLongLivedStaleTime(new Uint24(Uint32.valueOf(160))).build())).build();
final CParameters cParameters = new CParametersBuilder().addAugmentation(new CParameters1Builder().setLlGracefulRestartCapability(capability).build()).build();
final ByteBuf buffer = Unpooled.buffer(capaBytes.length);
this.handler.serializeCapability(cParameters, buffer);
assertArrayEquals(capaBytes, buffer.array());
assertEquals(cParameters, this.handler.parseCapability(Unpooled.wrappedBuffer(capaBytes).slice(2, capaBytes.length - 2)));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.identifiers.tlv.lsp.identifiers.address.family.ipv4._case.Ipv4 in project bgpcep by opendaylight.
the class GracefulRestartTest method nonIpv4PeerGracefulRestart.
/**
* Test graceful restart of a non-IPv4 peer.
* {@link BGPPeer#releaseConnection(boolean)} should not throw NPE and binding chain should be closed
* successfully.
*
* @throws InterruptedException on create peer session.
*/
@Test
public void nonIpv4PeerGracefulRestart() throws InterruptedException {
BgpParameters parametersv6 = PeerUtil.createBgpParameters(Collections.singletonList(IPV6_TABLES_KEY), Collections.emptyList(), Collections.singletonMap(IPV6_TABLES_KEY, true), GRACEFUL_RESTART_TIME);
gracefulAfiSafiAdvertised.add(IPV6_TABLES_KEY);
this.nonIpv4 = configurePeer(this.tableRegistry, PEER2, this.ribImpl, parametersv6, PeerRole.Ibgp, this.serverRegistry, afiSafiAdvertised, gracefulAfiSafiAdvertised);
this.sessionv6 = createPeerSession(PEER2, parametersv6, this.listener);
final Open open = createClassicOpen(true);
this.sessionv6.writeAndFlush(open);
checkIdleState(this.nonIpv4);
synchronized (this.nonIpv4) {
assertNull(this.nonIpv4.ribOutChain);
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.identifiers.tlv.lsp.identifiers.address.family.ipv4._case.Ipv4 in project bgpcep by opendaylight.
the class AdjRibsInWriterTest method testTransform.
@Test
public void testTransform() {
this.writer = AdjRibInWriter.create(YangInstanceIdentifier.of(Rib.QNAME), PeerRole.Ebgp, this.ptc);
assertNotNull(this.writer);
final YangInstanceIdentifier peerPath = YangInstanceIdentifier.builder().node(RIB_NID).node(Peer.QNAME).nodeWithKey(Peer.QNAME, RIBQNames.PEER_ID_QNAME, this.peerIp).build();
this.writer.transform(new PeerId(this.peerIp), peerPath, this.registry, this.tableTypes, ADD_PATH_TABLE_MAPS);
verifyPeerSkeletonInsertedCorrectly(peerPath);
// verify supported tables were inserted for ipv4
verify(this.tx).put(eq(LogicalDatastoreType.OPERATIONAL), eq(peerPath.node(SupportedTables.QNAME).node(RibSupportUtils.toYangKey(SupportedTables.QNAME, K4))), any(NormalizedNode.class));
verifyUptodateSetToFalse(peerPath);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.identifiers.tlv.lsp.identifiers.address.family.ipv4._case.Ipv4 in project bgpcep by opendaylight.
the class LinkstateGraphBuilder method getEdgeId.
/**
* Determine the Source Edge Key from the link descriptor.
* There is several case: IPv4, IPv6 address or Unnumbered Interface.
*
* @param linkCase The Link part of the Linkstate route
*
* @return Unique key
*/
private static Uint64 getEdgeId(final LinkCase linkCase) {
Uint64 key = Uint64.ZERO;
final LinkDescriptors linkDescriptors = linkCase.getLinkDescriptors();
if (linkDescriptors.getIpv4InterfaceAddress() != null) {
key = ipv4ToKey(linkDescriptors.getIpv4InterfaceAddress());
}
if (linkDescriptors.getIpv6InterfaceAddress() != null) {
key = ipv6ToKey(linkDescriptors.getIpv6InterfaceAddress());
}
if (linkDescriptors.getLinkLocalIdentifier() != null) {
key = linkDescriptors.getLinkLocalIdentifier().toUint64();
}
return key;
}
Aggregations