Search in sources :

Example 11 with Registration

use of org.opendaylight.yangtools.concepts.Registration in project bgpcep by opendaylight.

the class BGPActivator method start.

@Override
public List<Registration> start(final BGPExtensionProviderContext context) {
    final List<Registration> regs = new ArrayList<>();
    final SimpleTunnelIdentifierRegistry tunnelIdentifierReg = SimpleTunnelIdentifierRegistry.getInstance();
    final RsvpTeP2MpLspParser rsvpTeP2MpLspParser = new RsvpTeP2MpLspParser();
    regs.add(tunnelIdentifierReg.registerParser(rsvpTeP2MpLspParser));
    regs.add(tunnelIdentifierReg.registerSerializer(rsvpTeP2MpLspParser));
    final MldpP2mpLspParser mldpP2mpLspParser = new MldpP2mpLspParser(context.getAddressFamilyRegistry());
    regs.add(tunnelIdentifierReg.registerParser(mldpP2mpLspParser));
    regs.add(tunnelIdentifierReg.registerSerializer(mldpP2mpLspParser));
    final PimSsmTreeParser pimSsmTreeParser = new PimSsmTreeParser();
    regs.add(tunnelIdentifierReg.registerParser(pimSsmTreeParser));
    regs.add(tunnelIdentifierReg.registerSerializer(pimSsmTreeParser));
    final PimSmTreeParser pimSmTreeParser = new PimSmTreeParser();
    regs.add(tunnelIdentifierReg.registerParser(pimSmTreeParser));
    regs.add(tunnelIdentifierReg.registerSerializer(pimSmTreeParser));
    final BidirPimTreeParser bidirPimTreeParser = new BidirPimTreeParser();
    regs.add(tunnelIdentifierReg.registerParser(bidirPimTreeParser));
    regs.add(tunnelIdentifierReg.registerSerializer(bidirPimTreeParser));
    final IngressReplicationParser ingressReplicationParser = new IngressReplicationParser();
    regs.add(tunnelIdentifierReg.registerParser(ingressReplicationParser));
    regs.add(tunnelIdentifierReg.registerSerializer(ingressReplicationParser));
    final MldpMp2mpLspParser mldpMp2mpLspParser = new MldpMp2mpLspParser();
    regs.add(tunnelIdentifierReg.registerParser(mldpMp2mpLspParser));
    regs.add(tunnelIdentifierReg.registerSerializer(mldpMp2mpLspParser));
    regs.add(context.registerSubsequentAddressFamily(McastVpnSubsequentAddressFamily.class, MVPN_SAFI));
    final MvpnIpv4NlriHandler mvpnIpv4NlriHandler = new MvpnIpv4NlriHandler();
    final Ipv4NextHopParserSerializer ipv4NextHopParser = new Ipv4NextHopParserSerializer();
    regs.add(context.registerNlriParser(Ipv4AddressFamily.class, McastVpnSubsequentAddressFamily.class, mvpnIpv4NlriHandler, ipv4NextHopParser, Ipv4NextHopCase.class));
    regs.add(context.registerNlriSerializer(MvpnRoutesIpv4.class, mvpnIpv4NlriHandler));
    final MvpnIpv6NlriHandler mvpnIpv6NlriHandler = new MvpnIpv6NlriHandler();
    final Ipv6NextHopParserSerializer ipv6NextHopParser = new Ipv6NextHopParserSerializer();
    regs.add(context.registerNlriParser(Ipv6AddressFamily.class, McastVpnSubsequentAddressFamily.class, mvpnIpv6NlriHandler, ipv6NextHopParser, Ipv6NextHopCase.class));
    regs.add(context.registerNlriSerializer(MvpnRoutesIpv6.class, mvpnIpv6NlriHandler));
    final PEDistinguisherLabelsAttributeHandler peDistHandler = new PEDistinguisherLabelsAttributeHandler();
    regs.add(context.registerAttributeParser(peDistHandler.getType(), peDistHandler));
    regs.add(context.registerAttributeSerializer(peDistHandler.getClazz(), peDistHandler));
    final PMSITunnelAttributeHandler pmsiParser = new PMSITunnelAttributeHandler();
    regs.add(context.registerAttributeParser(pmsiParser.getType(), pmsiParser));
    regs.add(context.registerAttributeSerializer(pmsiParser.getClazz(), pmsiParser));
    return regs;
}
Also used : Ipv6AddressFamily(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.Ipv6AddressFamily) MvpnRoutesIpv4(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.ipv4.rev180417.mvpn.routes.ipv4.MvpnRoutesIpv4) Ipv6NextHopParserSerializer(org.opendaylight.protocol.bgp.inet.codec.nexthop.Ipv6NextHopParserSerializer) MldpMp2mpLspParser(org.opendaylight.protocol.bgp.mvpn.impl.attributes.tunnel.identifier.MldpMp2mpLspParser) Ipv4AddressFamily(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.Ipv4AddressFamily) ArrayList(java.util.ArrayList) BidirPimTreeParser(org.opendaylight.protocol.bgp.mvpn.impl.attributes.tunnel.identifier.BidirPimTreeParser) PimSsmTreeParser(org.opendaylight.protocol.bgp.mvpn.impl.attributes.tunnel.identifier.PimSsmTreeParser) Ipv4NextHopCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.next.hop.c.next.hop.Ipv4NextHopCase) Ipv6NextHopCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.next.hop.c.next.hop.Ipv6NextHopCase) MvpnRoutesIpv6(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.ipv6.rev180417.mvpn.routes.ipv6.MvpnRoutesIpv6) SimpleTunnelIdentifierRegistry(org.opendaylight.protocol.bgp.mvpn.spi.pojo.attributes.tunnel.identifier.SimpleTunnelIdentifierRegistry) PimSmTreeParser(org.opendaylight.protocol.bgp.mvpn.impl.attributes.tunnel.identifier.PimSmTreeParser) MvpnIpv6NlriHandler(org.opendaylight.protocol.bgp.mvpn.impl.nlri.MvpnIpv6NlriHandler) PMSITunnelAttributeHandler(org.opendaylight.protocol.bgp.mvpn.impl.attributes.PMSITunnelAttributeHandler) Registration(org.opendaylight.yangtools.concepts.Registration) McastVpnSubsequentAddressFamily(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.rev200120.McastVpnSubsequentAddressFamily) PEDistinguisherLabelsAttributeHandler(org.opendaylight.protocol.bgp.mvpn.impl.attributes.PEDistinguisherLabelsAttributeHandler) IngressReplicationParser(org.opendaylight.protocol.bgp.mvpn.impl.attributes.tunnel.identifier.IngressReplicationParser) MvpnIpv4NlriHandler(org.opendaylight.protocol.bgp.mvpn.impl.nlri.MvpnIpv4NlriHandler) RsvpTeP2MpLspParser(org.opendaylight.protocol.bgp.mvpn.impl.attributes.tunnel.identifier.RsvpTeP2MpLspParser) Ipv4NextHopParserSerializer(org.opendaylight.protocol.bgp.inet.codec.nexthop.Ipv4NextHopParserSerializer) MldpP2mpLspParser(org.opendaylight.protocol.bgp.mvpn.impl.attributes.tunnel.identifier.MldpP2mpLspParser)

Example 12 with Registration

use of org.opendaylight.yangtools.concepts.Registration in project bgpcep by opendaylight.

the class BGPActivator method start.

@Override
public List<Registration> start(final BGPExtensionProviderContext context) {
    final List<Registration> regs = new ArrayList<>();
    regs.add(context.registerAddressFamily(LinkstateAddressFamily.class, LINKSTATE_AFI));
    regs.add(context.registerSubsequentAddressFamily(LinkstateSubsequentAddressFamily.class, LINKSTATE_SAFI));
    final NextHopParserSerializer linkstateNextHopParser = new NextHopParserSerializer() {
    };
    final LinkstateNlriParser parser = new LinkstateNlriParser();
    regs.add(context.registerNlriParser(LinkstateAddressFamily.class, LinkstateSubsequentAddressFamily.class, parser, linkstateNextHopParser, Ipv4NextHopCase.class, Ipv6NextHopCase.class));
    regs.add(context.registerNlriSerializer(LinkstateRoutes.class, parser));
    regs.add(context.registerAttributeSerializer(Attributes1.class, new LinkstateAttributeParser(this.ianaLinkstateAttributeType, this.rsvpTeObjectRegistry)));
    final LinkstateAttributeParser linkstateAttributeParser = new LinkstateAttributeParser(this.ianaLinkstateAttributeType, this.rsvpTeObjectRegistry);
    regs.add(context.registerAttributeParser(linkstateAttributeParser.getType(), linkstateAttributeParser));
    return regs;
}
Also used : LinkstateAttributeParser(org.opendaylight.protocol.bgp.linkstate.impl.attribute.LinkstateAttributeParser) LinkstateSubsequentAddressFamily(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.LinkstateSubsequentAddressFamily) Registration(org.opendaylight.yangtools.concepts.Registration) LinkstateRoutes(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.routes.LinkstateRoutes) ArrayList(java.util.ArrayList) LinkstateAddressFamily(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.LinkstateAddressFamily) LinkstateNlriParser(org.opendaylight.protocol.bgp.linkstate.impl.nlri.LinkstateNlriParser) Attributes1(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.Attributes1) Ipv4NextHopCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.next.hop.c.next.hop.Ipv4NextHopCase) NextHopParserSerializer(org.opendaylight.protocol.bgp.parser.spi.NextHopParserSerializer) Ipv6NextHopCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.next.hop.c.next.hop.Ipv6NextHopCase)

Example 13 with Registration

use of org.opendaylight.yangtools.concepts.Registration in project bgpcep by opendaylight.

the class SyncOptimizationsActivator method start.

@Override
public List<Registration> start(final PCEPExtensionProviderContext context) {
    final List<Registration> regs = new ArrayList<>();
    final TlvRegistry tlvReg = context.getTlvHandlerRegistry();
    final VendorInformationTlvRegistry viTlvReg = context.getVendorInformationTlvRegistry();
    regs.add(context.registerObjectParser(new SyncOptimizationsLspObjectParser(tlvReg, viTlvReg)));
    regs.add(context.registerObjectSerializer(Lsp.class, new SyncOptimizationsLspObjectParser(tlvReg, viTlvReg)));
    regs.add(context.registerObjectParser(new SyncOptimizationsOpenObjectParser(tlvReg, viTlvReg)));
    regs.add(context.registerObjectSerializer(Open.class, new SyncOptimizationsOpenObjectParser(tlvReg, viTlvReg)));
    regs.add(context.registerTlvParser(LspDbVersionTlvParser.TYPE, new LspDbVersionTlvParser()));
    regs.add(context.registerTlvSerializer(LspDbVersion.class, new LspDbVersionTlvParser()));
    regs.add(context.registerTlvParser(SpeakerEntityIdTlvParser.TYPE, new SpeakerEntityIdTlvParser()));
    regs.add(context.registerTlvSerializer(SpeakerEntityId.class, new SpeakerEntityIdTlvParser()));
    regs.add(context.registerTlvParser(SyncOptimizationsCapabilityTlvParser.TYPE, new SyncOptimizationsCapabilityTlvParser()));
    regs.add(context.registerTlvSerializer(Stateful.class, new SyncOptimizationsCapabilityTlvParser()));
    return regs;
}
Also used : Stateful(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.stateful.capability.tlv.Stateful) ArrayList(java.util.ArrayList) Lsp(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.object.Lsp) Open(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.open.object.Open) VendorInformationTlvRegistry(org.opendaylight.protocol.pcep.spi.VendorInformationTlvRegistry) TlvRegistry(org.opendaylight.protocol.pcep.spi.TlvRegistry) Registration(org.opendaylight.yangtools.concepts.Registration) LspDbVersion(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev200720.lsp.db.version.tlv.LspDbVersion) SpeakerEntityId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev200720.speaker.entity.id.tlv.SpeakerEntityId) VendorInformationTlvRegistry(org.opendaylight.protocol.pcep.spi.VendorInformationTlvRegistry)

Example 14 with Registration

use of org.opendaylight.yangtools.concepts.Registration in project bgpcep by opendaylight.

the class HandlerRegistryTest method testHandlerRegistry.

@Test
public void testHandlerRegistry() {
    final HandlerRegistry<Object, String, String> registry = new HandlerRegistry<>();
    final Registration parserReg = registry.registerParser(TYPE, PARSER);
    final Registration serializerReg = registry.registerSerializer(Object.class, SERIALIZER);
    assertNotNull(parserReg);
    assertNotNull(serializerReg);
    assertEquals(SERIALIZER, registry.getSerializer(Object.class));
    assertEquals(SERIALIZER, registry.getAllSerializers().iterator().next());
    assertEquals(PARSER, registry.getParser(TYPE));
    assertNull(registry.getParser(0));
    assertNull(registry.getSerializer(String.class));
    parserReg.close();
    serializerReg.close();
    serializerReg.close();
    assertNull(registry.getParser(TYPE));
    assertNull(registry.getSerializer(Object.class));
}
Also used : Registration(org.opendaylight.yangtools.concepts.Registration) Test(org.junit.Test)

Example 15 with Registration

use of org.opendaylight.yangtools.concepts.Registration in project bgpcep by opendaylight.

the class MultiRegistryTest method testMultiRegistry.

@Test
public void testMultiRegistry() {
    final MultiRegistry<Object, Integer> registry = new MultiRegistry<>();
    final String first = "first";
    final String second = "second";
    final String third = "third";
    final Registration a = registry.register(first, 1);
    registry.register(second, 2);
    registry.register(third, 3);
    assertEquals(Integer.valueOf(1), registry.get("first"));
    assertEquals(Integer.valueOf(2), registry.get("second"));
    assertEquals(Integer.valueOf(3), registry.get("third"));
    registry.register(second, 22);
    assertEquals(Integer.valueOf(22), registry.get("second"));
    registry.register('c', 5);
    assertEquals(Integer.valueOf(5), registry.get('c'));
    a.close();
    assertNull(registry.get("first"));
}
Also used : Registration(org.opendaylight.yangtools.concepts.Registration) Test(org.junit.Test)

Aggregations

Registration (org.opendaylight.yangtools.concepts.Registration)17 ArrayList (java.util.ArrayList)9 Test (org.junit.Test)6 Ipv4NextHopCase (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.next.hop.c.next.hop.Ipv4NextHopCase)4 Ipv6NextHopCase (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.next.hop.c.next.hop.Ipv6NextHopCase)4 TlvRegistry (org.opendaylight.protocol.pcep.spi.TlvRegistry)3 VendorInformationTlvRegistry (org.opendaylight.protocol.pcep.spi.VendorInformationTlvRegistry)3 Open (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.open.object.Open)3 Ipv4NextHopParserSerializer (org.opendaylight.protocol.bgp.inet.codec.nexthop.Ipv4NextHopParserSerializer)2 Ipv6NextHopParserSerializer (org.opendaylight.protocol.bgp.inet.codec.nexthop.Ipv6NextHopParserSerializer)2 NextHopParserSerializer (org.opendaylight.protocol.bgp.parser.spi.NextHopParserSerializer)2 ObjectRegistry (org.opendaylight.protocol.pcep.spi.ObjectRegistry)2 Ipv4AddressFamily (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.Ipv4AddressFamily)2 Ipv6AddressFamily (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.Ipv6AddressFamily)2 Lsp (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.object.Lsp)2 Stateful (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.stateful.capability.tlv.Stateful)2 ActorRef (akka.actor.ActorRef)1 AddressFromURIString (akka.actor.AddressFromURIString)1 Status (akka.actor.Status)1 Success (akka.actor.Status.Success)1