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