0c26f09fda332d52b8a1711d2f74a2b45e628ed8
[bgpcep.git] / bgp / parser-impl / src / main / java / org / opendaylight / protocol / bgp / parser / impl / BGPActivator.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.protocol.bgp.parser.impl;
9
10 import java.util.ArrayList;
11 import java.util.List;
12 import org.opendaylight.protocol.bgp.parser.impl.message.BGPKeepAliveMessageParser;
13 import org.opendaylight.protocol.bgp.parser.impl.message.BGPNotificationMessageParser;
14 import org.opendaylight.protocol.bgp.parser.impl.message.BGPOpenMessageParser;
15 import org.opendaylight.protocol.bgp.parser.impl.message.BGPUpdateMessageParser;
16 import org.opendaylight.protocol.bgp.parser.impl.message.open.AddPathCapabilityHandler;
17 import org.opendaylight.protocol.bgp.parser.impl.message.open.As4CapabilityHandler;
18 import org.opendaylight.protocol.bgp.parser.impl.message.open.CapabilityParameterParser;
19 import org.opendaylight.protocol.bgp.parser.impl.message.open.GracefulCapabilityHandler;
20 import org.opendaylight.protocol.bgp.parser.impl.message.open.MultiProtocolCapabilityHandler;
21 import org.opendaylight.protocol.bgp.parser.impl.message.update.AS4AggregatorAttributeParser;
22 import org.opendaylight.protocol.bgp.parser.impl.message.update.AS4PathAttributeParser;
23 import org.opendaylight.protocol.bgp.parser.impl.message.update.AdvertizedRoutesSerializer;
24 import org.opendaylight.protocol.bgp.parser.impl.message.update.AggregatorAttributeParser;
25 import org.opendaylight.protocol.bgp.parser.impl.message.update.AigpAttributeParser;
26 import org.opendaylight.protocol.bgp.parser.impl.message.update.AsPathAttributeParser;
27 import org.opendaylight.protocol.bgp.parser.impl.message.update.AtomicAggregateAttributeParser;
28 import org.opendaylight.protocol.bgp.parser.impl.message.update.ClusterIdAttributeParser;
29 import org.opendaylight.protocol.bgp.parser.impl.message.update.CommunitiesAttributeParser;
30 import org.opendaylight.protocol.bgp.parser.impl.message.update.ExtendedCommunitiesAttributeParser;
31 import org.opendaylight.protocol.bgp.parser.impl.message.update.Ipv4NlriParser;
32 import org.opendaylight.protocol.bgp.parser.impl.message.update.Ipv6NlriParser;
33 import org.opendaylight.protocol.bgp.parser.impl.message.update.LocalPreferenceAttributeParser;
34 import org.opendaylight.protocol.bgp.parser.impl.message.update.MPReachAttributeParser;
35 import org.opendaylight.protocol.bgp.parser.impl.message.update.MPUnreachAttributeParser;
36 import org.opendaylight.protocol.bgp.parser.impl.message.update.MultiExitDiscriminatorAttributeParser;
37 import org.opendaylight.protocol.bgp.parser.impl.message.update.NextHopAttributeParser;
38 import org.opendaylight.protocol.bgp.parser.impl.message.update.OriginAttributeParser;
39 import org.opendaylight.protocol.bgp.parser.impl.message.update.OriginatorIdAttributeParser;
40 import org.opendaylight.protocol.bgp.parser.impl.message.update.WithdrawnRoutesSerializer;
41 import org.opendaylight.protocol.bgp.parser.impl.message.update.extended.communities.AsTwoOctetSpecificEcHandler;
42 import org.opendaylight.protocol.bgp.parser.impl.message.update.extended.communities.Ipv4SpecificEcHandler;
43 import org.opendaylight.protocol.bgp.parser.impl.message.update.extended.communities.OpaqueEcHandler;
44 import org.opendaylight.protocol.bgp.parser.impl.message.update.extended.communities.RouteOriginAsTwoOctetEcHandler;
45 import org.opendaylight.protocol.bgp.parser.impl.message.update.extended.communities.RouteOriginIpv4EcHandler;
46 import org.opendaylight.protocol.bgp.parser.impl.message.update.extended.communities.RouteTargetAsTwoOctetEcHandler;
47 import org.opendaylight.protocol.bgp.parser.impl.message.update.extended.communities.RouteTargetIpv4EcHandler;
48 import org.opendaylight.protocol.bgp.parser.impl.message.update.next.hop.Ipv4NextHopParserSerializer;
49 import org.opendaylight.protocol.bgp.parser.impl.message.update.next.hop.Ipv6NextHopParserSerializer;
50 import org.opendaylight.protocol.bgp.parser.spi.AbstractBGPExtensionProviderActivator;
51 import org.opendaylight.protocol.bgp.parser.spi.AddressFamilyRegistry;
52 import org.opendaylight.protocol.bgp.parser.spi.BGPExtensionProviderContext;
53 import org.opendaylight.protocol.bgp.parser.spi.NlriRegistry;
54 import org.opendaylight.protocol.bgp.parser.spi.SubsequentAddressFamilyRegistry;
55 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.Keepalive;
56 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.Notify;
57 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.Open;
58 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.Update;
59 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.open.message.BgpParameters;
60 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.open.message.bgp.parameters.optional.capabilities.c.parameters.As4BytesCapability;
61 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.path.attributes.attributes.Aggregator;
62 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.path.attributes.attributes.Aigp;
63 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.path.attributes.attributes.AsPath;
64 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.path.attributes.attributes.AtomicAggregate;
65 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.path.attributes.attributes.ClusterId;
66 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.path.attributes.attributes.Communities;
67 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.path.attributes.attributes.ExtendedCommunities;
68 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.path.attributes.attributes.LocalPref;
69 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.path.attributes.attributes.MultiExitDisc;
70 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.path.attributes.attributes.Origin;
71 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.path.attributes.attributes.OriginatorId;
72 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.update.message.WithdrawnRoutes;
73 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.open.bgp.parameters.optional.capabilities.c.parameters.AddPathCapability;
74 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.open.bgp.parameters.optional.capabilities.c.parameters.GracefulRestartCapability;
75 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.open.bgp.parameters.optional.capabilities.c.parameters.MultiprotocolCapability;
76 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.update.attributes.MpReachNlri;
77 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.update.attributes.MpUnreachNlri;
78 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.update.attributes.mp.reach.nlri.AdvertizedRoutes;
79 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.Ipv4AddressFamily;
80 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.Ipv6AddressFamily;
81 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.MplsLabeledVpnSubsequentAddressFamily;
82 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.NextHop;
83 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.UnicastSubsequentAddressFamily;
84 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.extended.community.extended.community.AsSpecificExtendedCommunityCase;
85 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.extended.community.extended.community.Inet4SpecificExtendedCommunityCase;
86 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.extended.community.extended.community.OpaqueExtendedCommunityCase;
87 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.extended.community.extended.community.RouteOriginExtendedCommunityCase;
88 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.extended.community.extended.community.RouteOriginIpv4Case;
89 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.extended.community.extended.community.RouteTargetExtendedCommunityCase;
90 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.extended.community.extended.community.RouteTargetIpv4Case;
91 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.next.hop.c.next.hop.Ipv4NextHopCase;
92 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.next.hop.c.next.hop.Ipv6NextHopCase;
93
94 public final class BGPActivator extends AbstractBGPExtensionProviderActivator {
95
96     private static final int IPV4_AFI = 1;
97     private static final int IPV6_AFI = 2;
98
99     private static final int UNICAST_SAFI = 1;
100     private static final int VPN_SAFI = 128;
101
102     @Override
103     protected List<AutoCloseable> startImpl(final BGPExtensionProviderContext context) {
104         final List<AutoCloseable> regs = new ArrayList<>();
105
106         regs.add(context.registerNlriSerializer(AdvertizedRoutes.class, new AdvertizedRoutesSerializer()));
107         regs.add(context.registerNlriSerializer(WithdrawnRoutes.class, new WithdrawnRoutesSerializer()));
108
109         regs.add(context.registerAddressFamily(Ipv4AddressFamily.class, IPV4_AFI));
110         regs.add(context.registerAddressFamily(Ipv6AddressFamily.class, IPV6_AFI));
111
112         regs.add(context.registerSubsequentAddressFamily(UnicastSubsequentAddressFamily.class, UNICAST_SAFI));
113         regs.add(context.registerSubsequentAddressFamily(MplsLabeledVpnSubsequentAddressFamily.class, VPN_SAFI));
114
115         final Ipv4NextHopParserSerializer ipv4NextHopParser = new Ipv4NextHopParserSerializer();
116         regs.add(context.registerNlriParser(Ipv4AddressFamily.class, UnicastSubsequentAddressFamily.class,
117             new Ipv4NlriParser(), ipv4NextHopParser, Ipv4NextHopCase.class));
118
119         final Ipv6NextHopParserSerializer ipv6NextHopParser = new Ipv6NextHopParserSerializer();
120         regs.add(context.registerNlriParser(Ipv6AddressFamily.class, UnicastSubsequentAddressFamily.class, new
121             Ipv6NlriParser(), ipv6NextHopParser, Ipv6NextHopCase.class));
122
123         this.registerExtendedCommunities(regs, context);
124         this.registerCapabilityParsers(regs, context);
125         this.registerAttributeParsers(regs, context);
126         this.registerMessageParsers(regs, context);
127         return regs;
128     }
129
130     private void registerCapabilityParsers(final List<AutoCloseable> regs, final BGPExtensionProviderContext context) {
131         final AddressFamilyRegistry afiReg = context.getAddressFamilyRegistry();
132         final SubsequentAddressFamilyRegistry safiReg = context.getSubsequentAddressFamilyRegistry();
133
134         final MultiProtocolCapabilityHandler multi = new MultiProtocolCapabilityHandler(afiReg, safiReg);
135         regs.add(context.registerCapabilityParser(MultiProtocolCapabilityHandler.CODE, multi));
136         regs.add(context.registerCapabilitySerializer(MultiprotocolCapability.class, multi));
137
138         final AddPathCapabilityHandler addPath = new AddPathCapabilityHandler(afiReg, safiReg);
139         regs.add(context.registerCapabilityParser(AddPathCapabilityHandler.CODE, addPath));
140         regs.add(context.registerCapabilitySerializer(AddPathCapability.class, addPath));
141
142         final As4CapabilityHandler as4 = new As4CapabilityHandler();
143         regs.add(context.registerCapabilityParser(As4CapabilityHandler.CODE, as4));
144         regs.add(context.registerCapabilitySerializer(As4BytesCapability.class, as4));
145
146         final GracefulCapabilityHandler grace = new GracefulCapabilityHandler(afiReg, safiReg);
147         regs.add(context.registerCapabilitySerializer(GracefulRestartCapability.class, grace));
148         regs.add(context.registerCapabilityParser(GracefulCapabilityHandler.CODE, grace));
149
150         final CapabilityParameterParser cpp = new CapabilityParameterParser(context.getCapabilityRegistry());
151         regs.add(context.registerParameterParser(CapabilityParameterParser.TYPE, cpp));
152         regs.add(context.registerParameterSerializer(BgpParameters.class, cpp));
153     }
154
155     private void registerAttributeParsers(final List<AutoCloseable> regs, final BGPExtensionProviderContext context) {
156         final OriginAttributeParser originAttributeParser = new OriginAttributeParser();
157         regs.add(context.registerAttributeSerializer(Origin.class, originAttributeParser));
158         regs.add(context.registerAttributeParser(OriginAttributeParser.TYPE, originAttributeParser));
159
160         final AigpAttributeParser aigpAttributeParser = new AigpAttributeParser();
161         regs.add(context.registerAttributeSerializer(Aigp.class, aigpAttributeParser));
162         regs.add(context.registerAttributeParser(AigpAttributeParser.TYPE, aigpAttributeParser));
163
164         final AsPathAttributeParser asPathAttributeParser = new AsPathAttributeParser(context.getReferenceCache());
165         regs.add(context.registerAttributeSerializer(AsPath.class, asPathAttributeParser));
166         regs.add(context.registerAttributeParser(AsPathAttributeParser.TYPE, asPathAttributeParser));
167
168         final NextHopAttributeParser nextHopAttributeParser = new NextHopAttributeParser();
169         regs.add(context.registerAttributeSerializer(NextHop.class, nextHopAttributeParser));
170         regs.add(context.registerAttributeParser(NextHopAttributeParser.TYPE, nextHopAttributeParser));
171
172         final MultiExitDiscriminatorAttributeParser multiExitDiscriminatorAttributeParser = new MultiExitDiscriminatorAttributeParser();
173         regs.add(context.registerAttributeSerializer(MultiExitDisc.class, multiExitDiscriminatorAttributeParser));
174         regs.add(context.registerAttributeParser(MultiExitDiscriminatorAttributeParser.TYPE, multiExitDiscriminatorAttributeParser));
175
176         final LocalPreferenceAttributeParser localPreferenceAttributeParser = new LocalPreferenceAttributeParser();
177         regs.add(context.registerAttributeSerializer(LocalPref.class, localPreferenceAttributeParser));
178         regs.add(context.registerAttributeParser(LocalPreferenceAttributeParser.TYPE, localPreferenceAttributeParser));
179
180         final AtomicAggregateAttributeParser atomicAggregateAttributeParser = new AtomicAggregateAttributeParser();
181         regs.add(context.registerAttributeSerializer(AtomicAggregate.class, atomicAggregateAttributeParser));
182         regs.add(context.registerAttributeParser(AtomicAggregateAttributeParser.TYPE, atomicAggregateAttributeParser));
183
184         final AggregatorAttributeParser as4AggregatorAttributeParser = new AggregatorAttributeParser(context.getReferenceCache());
185         regs.add(context.registerAttributeSerializer(Aggregator.class, as4AggregatorAttributeParser));
186         regs.add(context.registerAttributeParser(AggregatorAttributeParser.TYPE, as4AggregatorAttributeParser));
187
188         final CommunitiesAttributeParser communitiesAttributeParser = new CommunitiesAttributeParser(context.getReferenceCache());
189         regs.add(context.registerAttributeSerializer(Communities.class, communitiesAttributeParser));
190         regs.add(context.registerAttributeParser(CommunitiesAttributeParser.TYPE, communitiesAttributeParser));
191
192         final OriginatorIdAttributeParser originatorIdAttributeParser = new OriginatorIdAttributeParser();
193         regs.add(context.registerAttributeSerializer(OriginatorId.class, originatorIdAttributeParser));
194         regs.add(context.registerAttributeParser(OriginatorIdAttributeParser.TYPE, originatorIdAttributeParser));
195
196         final ClusterIdAttributeParser clusterIdAttributeParser = new ClusterIdAttributeParser();
197         regs.add(context.registerAttributeSerializer(ClusterId.class, clusterIdAttributeParser));
198         regs.add(context.registerAttributeParser(ClusterIdAttributeParser.TYPE, clusterIdAttributeParser));
199
200         final NlriRegistry nlriReg = context.getNlriRegistry();
201
202         final MPReachAttributeParser mpReachAttributeParser = new MPReachAttributeParser(nlriReg);
203         regs.add(context.registerAttributeSerializer(MpReachNlri.class, mpReachAttributeParser));
204         regs.add(context.registerAttributeParser(MPReachAttributeParser.TYPE, mpReachAttributeParser));
205
206         final MPUnreachAttributeParser mpUnreachAttributeParser = new MPUnreachAttributeParser(nlriReg);
207         regs.add(context.registerAttributeSerializer(MpUnreachNlri.class, mpUnreachAttributeParser));
208         regs.add(context.registerAttributeParser(MPUnreachAttributeParser.TYPE, mpUnreachAttributeParser));
209
210         final ExtendedCommunitiesAttributeParser extendedCommunitiesAttributeParser = new ExtendedCommunitiesAttributeParser(context.getExtendedCommunityReistry());
211         regs.add(context.registerAttributeSerializer(ExtendedCommunities.class, extendedCommunitiesAttributeParser));
212         regs.add(context.registerAttributeParser(ExtendedCommunitiesAttributeParser.TYPE, extendedCommunitiesAttributeParser));
213
214         regs.add(context.registerAttributeParser(AS4AggregatorAttributeParser.TYPE, new AS4AggregatorAttributeParser()));
215         regs.add(context.registerAttributeParser(AS4PathAttributeParser.TYPE, new AS4PathAttributeParser()));
216     }
217
218     private void registerMessageParsers(final List<AutoCloseable> regs, final BGPExtensionProviderContext context) {
219         final BGPOpenMessageParser omp = new BGPOpenMessageParser(context.getParameterRegistry());
220         regs.add(context.registerMessageParser(BGPOpenMessageParser.TYPE, omp));
221         regs.add(context.registerMessageSerializer(Open.class, omp));
222
223         final BGPUpdateMessageParser ump = new BGPUpdateMessageParser(context.getAttributeRegistry());
224         regs.add(context.registerMessageParser(BGPUpdateMessageParser.TYPE, ump));
225         regs.add(context.registerMessageSerializer(Update.class, ump));
226
227         final BGPNotificationMessageParser nmp = new BGPNotificationMessageParser();
228         regs.add(context.registerMessageParser(BGPNotificationMessageParser.TYPE, nmp));
229         regs.add(context.registerMessageSerializer(Notify.class, nmp));
230
231         final BGPKeepAliveMessageParser kamp = new BGPKeepAliveMessageParser();
232         regs.add(context.registerMessageParser(BGPKeepAliveMessageParser.TYPE, kamp));
233         regs.add(context.registerMessageSerializer(Keepalive.class, kamp));
234     }
235
236     private void registerExtendedCommunities(final List<AutoCloseable> regs, final BGPExtensionProviderContext context) {
237         final AsTwoOctetSpecificEcHandler twoOctetSpecificEcHandler = new AsTwoOctetSpecificEcHandler();
238         regs.add(context.registerExtendedCommunityParser(twoOctetSpecificEcHandler.getType(true), twoOctetSpecificEcHandler.getSubType(),
239                 twoOctetSpecificEcHandler));
240         regs.add(context.registerExtendedCommunityParser(twoOctetSpecificEcHandler.getType(false), twoOctetSpecificEcHandler.getSubType(),
241                 twoOctetSpecificEcHandler));
242         regs.add(context.registerExtendedCommunitySerializer(AsSpecificExtendedCommunityCase.class, twoOctetSpecificEcHandler));
243
244         final Ipv4SpecificEcHandler ipv4SpecificEcHandler = new Ipv4SpecificEcHandler();
245         regs.add(context.registerExtendedCommunityParser(ipv4SpecificEcHandler.getType(true), ipv4SpecificEcHandler.getSubType(),
246                 ipv4SpecificEcHandler));
247         regs.add(context.registerExtendedCommunityParser(ipv4SpecificEcHandler.getType(false), ipv4SpecificEcHandler.getSubType(),
248                 ipv4SpecificEcHandler));
249         regs.add(context.registerExtendedCommunitySerializer(Inet4SpecificExtendedCommunityCase.class, ipv4SpecificEcHandler));
250
251         final OpaqueEcHandler opaqueEcHandler = new OpaqueEcHandler();
252         regs.add(context.registerExtendedCommunityParser(opaqueEcHandler.getType(true), opaqueEcHandler.getSubType(),
253                 opaqueEcHandler));
254         regs.add(context.registerExtendedCommunityParser(opaqueEcHandler.getType(false), opaqueEcHandler.getSubType(),
255                 opaqueEcHandler));
256         regs.add(context.registerExtendedCommunitySerializer(OpaqueExtendedCommunityCase.class, opaqueEcHandler));
257
258         final RouteOriginAsTwoOctetEcHandler routeOriginAS2bEcHandler = new RouteOriginAsTwoOctetEcHandler();
259         regs.add(context.registerExtendedCommunityParser(routeOriginAS2bEcHandler.getType(true), routeOriginAS2bEcHandler.getSubType(),
260                 routeOriginAS2bEcHandler));
261         regs.add(context.registerExtendedCommunityParser(routeOriginAS2bEcHandler.getType(false), routeOriginAS2bEcHandler.getSubType(),
262                 routeOriginAS2bEcHandler));
263         regs.add(context.registerExtendedCommunitySerializer(RouteOriginExtendedCommunityCase.class, routeOriginAS2bEcHandler));
264
265         final RouteTargetAsTwoOctetEcHandler routeTargetAS2bEcHandler = new RouteTargetAsTwoOctetEcHandler();
266         regs.add(context.registerExtendedCommunityParser(routeTargetAS2bEcHandler.getType(true), routeTargetAS2bEcHandler.getSubType(),
267                 routeTargetAS2bEcHandler));
268         regs.add(context.registerExtendedCommunityParser(routeTargetAS2bEcHandler.getType(false), routeTargetAS2bEcHandler.getSubType(),
269                 routeTargetAS2bEcHandler));
270         regs.add(context.registerExtendedCommunitySerializer(RouteTargetExtendedCommunityCase.class, routeTargetAS2bEcHandler));
271
272         final RouteOriginIpv4EcHandler routeOriginIpv4EcHandler = new RouteOriginIpv4EcHandler();
273         regs.add(context.registerExtendedCommunityParser(routeOriginIpv4EcHandler.getType(true), routeOriginIpv4EcHandler.getSubType(),
274                 routeOriginIpv4EcHandler));
275         regs.add(context.registerExtendedCommunityParser(routeOriginIpv4EcHandler.getType(false), routeOriginIpv4EcHandler.getSubType(),
276                 routeOriginIpv4EcHandler));
277         regs.add(context.registerExtendedCommunitySerializer(RouteOriginIpv4Case.class, routeOriginIpv4EcHandler));
278
279         final RouteTargetIpv4EcHandler routeTargetIpv4EcHandler = new RouteTargetIpv4EcHandler();
280         regs.add(context.registerExtendedCommunityParser(routeTargetIpv4EcHandler.getType(true), routeTargetIpv4EcHandler.getSubType(),
281                 routeTargetIpv4EcHandler));
282         regs.add(context.registerExtendedCommunityParser(routeTargetIpv4EcHandler.getType(false), routeTargetIpv4EcHandler.getSubType(),
283                 routeTargetIpv4EcHandler));
284         regs.add(context.registerExtendedCommunitySerializer(RouteTargetIpv4Case.class, routeTargetIpv4EcHandler));
285     }
286 }