use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.identifiers.tlv.lsp.identifiers.address.family.ipv6._case.Ipv6 in project bgpcep by opendaylight.
the class NodeChangedListener method create.
private void create(final ReadWriteTransaction trans, final InstanceIdentifier<ReportedLsp> identifier, final ReportedLsp value) throws ExecutionException, InterruptedException {
final InstanceIdentifier<Node> ni = identifier.firstIdentifierOf(Node.class);
final Path1 rl = value.nonnullPath().values().iterator().next().augmentation(Path1.class);
final AddressFamily af = rl.getLsp().getTlvs().getLspIdentifiers().getAddressFamily();
/*
* We are trying to ensure we have source and destination nodes.
*/
final IpAddress srcIp;
final IpAddress dstIp;
if (af instanceof Ipv4Case) {
final Ipv4 ipv4 = ((Ipv4Case) af).getIpv4();
srcIp = new IpAddress(ipv4.getIpv4TunnelSenderAddress());
dstIp = new IpAddress(ipv4.getIpv4TunnelEndpointAddress());
} else if (af instanceof Ipv6Case) {
final Ipv6 ipv6 = ((Ipv6Case) af).getIpv6();
srcIp = new IpAddress(ipv6.getIpv6TunnelSenderAddress());
dstIp = new IpAddress(ipv6.getIpv6TunnelSenderAddress());
} else {
throw new IllegalArgumentException("Unsupported address family: " + af.implementedInterface());
}
final Path path0 = value.nonnullPath().values().iterator().next();
final Link1Builder lab = new Link1Builder();
if (path0.getBandwidth() != null) {
lab.setBandwidth(path0.getBandwidth().getBandwidth());
}
if (path0.getClassType() != null) {
lab.setClassType(path0.getClassType().getClassType());
}
lab.setSymbolicPathName(value.getName());
final InstanceIdentifier<TerminationPoint> dst = getIpTerminationPoint(trans, dstIp, null, Boolean.FALSE);
final InstanceIdentifier<TerminationPoint> src = getIpTerminationPoint(trans, srcIp, ni, rl.getLsp().getDelegate());
final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.Link1Builder slab = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.Link1Builder();
slab.setOperationalStatus(rl.getLsp().getOperational());
slab.setAdministrativeStatus(rl.getLsp().getAdministrative() ? AdministrativeStatus.Active : AdministrativeStatus.Inactive);
final LinkId id = linkIdForLsp(identifier, value);
final LinkBuilder lb = new LinkBuilder();
lb.setLinkId(id);
lb.setSource(new SourceBuilder().setSourceNode(src.firstKeyOf(Node.class).getNodeId()).setSourceTp(src.firstKeyOf(TerminationPoint.class).getTpId()).build());
lb.setDestination(new DestinationBuilder().setDestNode(dst.firstKeyOf(Node.class).getNodeId()).setDestTp(dst.firstKeyOf(TerminationPoint.class).getTpId()).build());
lb.addAugmentation(lab.build());
lb.addAugmentation(slab.build());
trans.put(LogicalDatastoreType.OPERATIONAL, linkForLsp(id), lb.build());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.identifiers.tlv.lsp.identifiers.address.family.ipv6._case.Ipv6 in project bgpcep by opendaylight.
the class PMSITunnelAttributeHandlerTestUtil method buildMldpP2mpLspIpv6Attribute.
static Attributes buildMldpP2mpLspIpv6Attribute() {
final PmsiTunnelBuilder pmsiTunnelBuilder = new PmsiTunnelBuilder();
pmsiTunnelBuilder.setLeafInformationRequired(true);
pmsiTunnelBuilder.setMplsLabel(MPLS_LABEL);
pmsiTunnelBuilder.setTunnelIdentifier(buildMldpP2mpLsp(IPV6, Ipv6AddressFamily.class, createOpaqueList()));
return buildAttribute(pmsiTunnelBuilder);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.identifiers.tlv.lsp.identifiers.address.family.ipv6._case.Ipv6 in project bgpcep by opendaylight.
the class TableTypeActivatorTest method testActivator.
@Test
public void testActivator() {
final TableTypeActivator tableTypeActivator = new TableTypeActivator();
final SimpleBGPTableTypeRegistryProvider registry = new SimpleBGPTableTypeRegistryProvider();
tableTypeActivator.startBGPTableTypeRegistryProvider(registry);
final Optional<Class<? extends AfiSafiType>> afiSafiType = registry.getAfiSafiType(IPV4);
assertEquals(IPV4UNICAST.class, afiSafiType.get());
final Optional<Class<? extends AfiSafiType>> afiSafiType2 = registry.getAfiSafiType(IPV6);
assertEquals(IPV6UNICAST.class, afiSafiType2.get());
final Optional<BgpTableType> tableType = registry.getTableType(IPV4UNICAST.class);
assertEquals(IPV4, tableType.get());
final Optional<BgpTableType> tableType2 = registry.getTableType(IPV6UNICAST.class);
assertEquals(IPV6, tableType2.get());
tableTypeActivator.stopBGPTableTypeRegistryProvider();
tableTypeActivator.close();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.identifiers.tlv.lsp.identifiers.address.family.ipv6._case.Ipv6 in project bgpcep by opendaylight.
the class AbstractVpnNlriParser method serializeNlri.
private static void serializeNlri(final List<VpnDestination> dests, final boolean isWithdrawnRoute, final ByteBuf buffer) {
final ByteBuf nlriByteBuf = Unpooled.buffer();
for (final VpnDestination dest : dests) {
final List<LabelStack> labelStack = dest.getLabelStack();
final IpPrefix prefix = dest.getPrefix();
LOG.debug("Serializing Nlri: VpnDestination={}, IpPrefix={}", dest, prefix);
AbstractVpnNlriParser.serializeLengtField(prefix, labelStack, nlriByteBuf);
LUNlriParser.serializeLabelStackEntries(labelStack, isWithdrawnRoute, nlriByteBuf);
RouteDistinguisherUtil.serializeRouteDistinquisher(dest.getRouteDistinguisher(), nlriByteBuf);
Preconditions.checkArgument(prefix.getIpv6Prefix() != null || prefix.getIpv4Prefix() != null, "Ipv6 or Ipv4 prefix is missing.");
LUNlriParser.serializePrefixField(prefix, nlriByteBuf);
}
buffer.writeBytes(nlriByteBuf);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.identifiers.tlv.lsp.identifiers.address.family.ipv6._case.Ipv6 in project bgpcep by opendaylight.
the class TableTypeActivatorTest method testActivator.
@Test
public void testActivator() {
final TableTypeActivator tableTypeActivator = new TableTypeActivator();
final SimpleBGPTableTypeRegistryProvider registry = new SimpleBGPTableTypeRegistryProvider();
tableTypeActivator.startBGPTableTypeRegistryProvider(registry);
final Optional<Class<? extends AfiSafiType>> afiSafiType = registry.getAfiSafiType(IPV4);
Assert.assertEquals(L3VPNIPV4UNICAST.class, afiSafiType.get());
final Optional<Class<? extends AfiSafiType>> afiSafiType2 = registry.getAfiSafiType(IPV6);
Assert.assertEquals(L3VPNIPV6UNICAST.class, afiSafiType2.get());
final Optional<BgpTableType> tableType = registry.getTableType(L3VPNIPV4UNICAST.class);
Assert.assertEquals(IPV4, tableType.get());
final Optional<BgpTableType> tableType2 = registry.getTableType(L3VPNIPV6UNICAST.class);
Assert.assertEquals(IPV6, tableType2.get());
tableTypeActivator.stopBGPTableTypeRegistryProvider();
tableTypeActivator.close();
}
Aggregations