<artifactId>ietf-inet-types</artifactId>
<version>2010.09.24-SNAPSHOT</version>
</dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <version>${osgi.version}</version>
+ <scope>provided</scope>
+ </dependency>
</dependencies>
<build>
<Bundle-Name>${project.groupId}.${project.artifactId}</Bundle-Name>
<Export-Package>
org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev130918.*,
- </Export-Package>
+ </Export-Package>
+ <Private-Package>
+ org.opendaylight.protocol.bgp.linkstate
+ </Private-Package>
+ <Activator>org.opendaylight.protocol.bgp.linkstate.LinkstateOSGiActivator</Activator>
</instructions>
</configuration>
</plugin>
--- /dev/null
+/*
+ * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.protocol.bgp.linkstate;
+
+import org.opendaylight.protocol.bgp.parser.spi.BGPExtensionProviderActivator;
+import org.opendaylight.protocol.bgp.parser.spi.BGPExtensionProviderContext;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev130918.LinkstateAddressFamily;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev130918.LinkstateSubsequentAddressFamily;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.MplsLabeledVpnSubsequentAddressFamily;
+
+/**
+ *
+ */
+public final class Activator implements BGPExtensionProviderActivator {
+ @Override
+ public void start(final BGPExtensionProviderContext context) throws Exception {
+ context.registerAddressFamily(LinkstateAddressFamily.class, 16388);
+ context.registerSubsequentAddressFamily(LinkstateSubsequentAddressFamily.class, 71);
+
+ context.registerNlriParser(LinkstateAddressFamily.class, LinkstateSubsequentAddressFamily.class,
+ new LinkstateNlriParser(false));
+ context.registerNlriParser(LinkstateAddressFamily.class, MplsLabeledVpnSubsequentAddressFamily.class,
+ new LinkstateNlriParser(true));
+
+ context.registerAttributeParser(LinkstateAttributeParser.TYPE, new LinkstateAttributeParser());
+ }
+
+ @Override
+ public void stop() throws Exception {
+ // TODO Auto-generated method stub
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.protocol.bgp.linkstate;
+
+import org.opendaylight.protocol.bgp.parser.spi.BGPExtensionProviderActivator;
+import org.opendaylight.protocol.bgp.parser.spi.BGPExtensionProviderContext;
+import org.opendaylight.protocol.bgp.parser.spi.osgi.AbstractOSGiBGPExtensionProviderActivator;
+
+public final class OSGiActivator extends AbstractOSGiBGPExtensionProviderActivator {
+ private final BGPExtensionProviderActivator activator = new Activator();
+
+ @Override
+ public void start(final BGPExtensionProviderContext context) throws Exception {
+ activator.start(context);
+ }
+
+ @Override
+ public void stop() throws Exception {
+ activator.stop();
+ }
+}
--- /dev/null
+org.opendaylight.protocol.bgp.linkstate.Activator
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>bgp-concepts</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>bgp-linkstate</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.opendaylight.yangtools.model</groupId>
<artifactId>ietf-inet-types</artifactId>
<version>2010.09.24-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <version>${osgi.version}</version>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>bgp-linkstate</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
<configuration>
<instructions>
<Bundle-Name>${project.groupId}.${project.artifactId}</Bundle-Name>
- <Import-Package>
- org.opendaylight.protocol.bgp.concepts,
- org.opendaylight.protocol.bgp.parser,
- org.opendaylight.protocol.bgp.util,
- org.opendaylight.protocol.concepts,
- org.opendaylight.protocol.framework,
- org.opendaylight.protocol.util,
- org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev130918.*,
- com.google.common.*,
- org.slf4j,
- </Import-Package>
<Export-Package>
org.opendaylight.protocol.bgp.parser.impl.*
</Export-Package>
+ <Activator>org.opendaylight.protocol.bgp.parser.impl.OSGiActivator</Activator>
</instructions>
</configuration>
</plugin>
import java.util.ArrayList;
import java.util.List;
-import org.opendaylight.protocol.bgp.linkstate.LinkstateAttributeParser;
-import org.opendaylight.protocol.bgp.linkstate.LinkstateNlriParser;
import org.opendaylight.protocol.bgp.parser.impl.message.BGPKeepAliveMessageParser;
import org.opendaylight.protocol.bgp.parser.impl.message.BGPNotificationMessageParser;
import org.opendaylight.protocol.bgp.parser.impl.message.BGPOpenMessageParser;
import org.opendaylight.protocol.bgp.parser.impl.message.update.OriginatorIdAttributeParser;
import org.opendaylight.protocol.bgp.parser.spi.AddressFamilyRegistry;
import org.opendaylight.protocol.bgp.parser.spi.AttributeRegistry;
+import org.opendaylight.protocol.bgp.parser.spi.BGPExtensionProviderActivator;
+import org.opendaylight.protocol.bgp.parser.spi.BGPExtensionProviderContext;
import org.opendaylight.protocol.bgp.parser.spi.CapabilityRegistry;
-import org.opendaylight.protocol.bgp.parser.spi.MessageRegistry;
import org.opendaylight.protocol.bgp.parser.spi.NlriRegistry;
import org.opendaylight.protocol.bgp.parser.spi.ParameterRegistry;
-import org.opendaylight.protocol.bgp.parser.spi.ProviderActivator;
-import org.opendaylight.protocol.bgp.parser.spi.ProviderContext;
import org.opendaylight.protocol.bgp.parser.spi.SubsequentAddressFamilyRegistry;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev130918.LinkstateAddressFamily;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev130918.LinkstateSubsequentAddressFamily;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130918.Keepalive;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130918.Notify;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130918.Open;
import com.google.common.base.Preconditions;
-public final class ActivatorImpl implements ProviderActivator {
- private static final Logger logger = LoggerFactory.getLogger(ActivatorImpl.class);
+public final class Activator implements BGPExtensionProviderActivator {
+ private static final Logger logger = LoggerFactory.getLogger(Activator.class);
private List<AutoCloseable> registrations;
@Override
- public synchronized void start(final ProviderContext context) {
+ public synchronized void start(final BGPExtensionProviderContext context) {
Preconditions.checkState(registrations == null);
final List<AutoCloseable> regs = new ArrayList<>();
final AddressFamilyRegistry afiReg = context.getAddressFamilyRegistry();
- regs.add(afiReg.registerAddressFamily(Ipv4AddressFamily.class, 1));
- regs.add(afiReg.registerAddressFamily(Ipv6AddressFamily.class, 2));
- regs.add(afiReg.registerAddressFamily(LinkstateAddressFamily.class, 16388));
+ regs.add(context.registerAddressFamily(Ipv4AddressFamily.class, 1));
+ regs.add(context.registerAddressFamily(Ipv6AddressFamily.class, 2));
final SubsequentAddressFamilyRegistry safiReg = context.getSubsequentAddressFamilyRegistry();
- regs.add(safiReg.registerSubsequentAddressFamily(UnicastSubsequentAddressFamily.class, 1));
- regs.add(safiReg.registerSubsequentAddressFamily(LinkstateSubsequentAddressFamily.class, 71));
- regs.add(safiReg.registerSubsequentAddressFamily(MplsLabeledVpnSubsequentAddressFamily.class, 128));
+ regs.add(context.registerSubsequentAddressFamily(UnicastSubsequentAddressFamily.class, 1));
+ regs.add(context.registerSubsequentAddressFamily(MplsLabeledVpnSubsequentAddressFamily.class, 128));
final NlriRegistry nlriReg = context.getNlriRegistry();
- regs.add(nlriReg.registerNlriParser(Ipv4AddressFamily.class, UnicastSubsequentAddressFamily.class,
+ regs.add(context.registerNlriParser(Ipv4AddressFamily.class, UnicastSubsequentAddressFamily.class,
new Ipv4NlriParser()));
- regs.add(nlriReg.registerNlriParser(Ipv6AddressFamily.class, UnicastSubsequentAddressFamily.class,
+ regs.add(context.registerNlriParser(Ipv6AddressFamily.class, UnicastSubsequentAddressFamily.class,
new Ipv6NlriParser()));
- regs.add(nlriReg.registerNlriParser(LinkstateAddressFamily.class, LinkstateSubsequentAddressFamily.class,
- new LinkstateNlriParser(false)));
- regs.add(nlriReg.registerNlriParser(LinkstateAddressFamily.class, MplsLabeledVpnSubsequentAddressFamily.class,
- new LinkstateNlriParser(true)));
final AttributeRegistry attrReg = context.getAttributeRegistry();
- regs.add(attrReg.registerAttributeParser(OriginAttributeParser.TYPE, new OriginAttributeParser()));
- regs.add(attrReg.registerAttributeParser(AsPathAttributeParser.TYPE, new AsPathAttributeParser()));
- regs.add(attrReg.registerAttributeParser(NextHopAttributeParser.TYPE, new NextHopAttributeParser()));
- regs.add(attrReg.registerAttributeParser(MultiExitDiscriminatorAttributeParser.TYPE,
+ regs.add(context.registerAttributeParser(OriginAttributeParser.TYPE, new OriginAttributeParser()));
+ regs.add(context.registerAttributeParser(AsPathAttributeParser.TYPE, new AsPathAttributeParser()));
+ regs.add(context.registerAttributeParser(NextHopAttributeParser.TYPE, new NextHopAttributeParser()));
+ regs.add(context.registerAttributeParser(MultiExitDiscriminatorAttributeParser.TYPE,
new MultiExitDiscriminatorAttributeParser()));
- regs.add(attrReg.registerAttributeParser(LocalPreferenceAttributeParser.TYPE, new LocalPreferenceAttributeParser()));
- regs.add(attrReg.registerAttributeParser(AtomicAggregateAttributeParser.TYPE, new AtomicAggregateAttributeParser()));
- regs.add(attrReg.registerAttributeParser(AggregatorAttributeParser.TYPE, new AggregatorAttributeParser()));
- regs.add(attrReg.registerAttributeParser(CommunitiesAttributeParser.TYPE, new CommunitiesAttributeParser()));
- regs.add(attrReg.registerAttributeParser(OriginatorIdAttributeParser.TYPE, new OriginatorIdAttributeParser()));
- regs.add(attrReg.registerAttributeParser(ClusterIdAttributeParser.TYPE, new ClusterIdAttributeParser()));
- regs.add(attrReg.registerAttributeParser(MPReachAttributeParser.TYPE, new MPReachAttributeParser(nlriReg)));
- regs.add(attrReg.registerAttributeParser(MPUnreachAttributeParser.TYPE, new MPUnreachAttributeParser(nlriReg)));
- regs.add(attrReg.registerAttributeParser(ExtendedCommunitiesAttributeParser.TYPE, new ExtendedCommunitiesAttributeParser()));
- regs.add(attrReg.registerAttributeParser(AS4AggregatorAttributeParser.TYPE, new AS4AggregatorAttributeParser()));
- regs.add(attrReg.registerAttributeParser(AS4PathAttributeParser.TYPE, new AS4PathAttributeParser()));
- regs.add(attrReg.registerAttributeParser(LinkstateAttributeParser.TYPE, new LinkstateAttributeParser()));
+ regs.add(context.registerAttributeParser(LocalPreferenceAttributeParser.TYPE, new LocalPreferenceAttributeParser()));
+ regs.add(context.registerAttributeParser(AtomicAggregateAttributeParser.TYPE, new AtomicAggregateAttributeParser()));
+ regs.add(context.registerAttributeParser(AggregatorAttributeParser.TYPE, new AggregatorAttributeParser()));
+ regs.add(context.registerAttributeParser(CommunitiesAttributeParser.TYPE, new CommunitiesAttributeParser()));
+ regs.add(context.registerAttributeParser(OriginatorIdAttributeParser.TYPE, new OriginatorIdAttributeParser()));
+ regs.add(context.registerAttributeParser(ClusterIdAttributeParser.TYPE, new ClusterIdAttributeParser()));
+ regs.add(context.registerAttributeParser(MPReachAttributeParser.TYPE, new MPReachAttributeParser(nlriReg)));
+ regs.add(context.registerAttributeParser(MPUnreachAttributeParser.TYPE, new MPUnreachAttributeParser(nlriReg)));
+ regs.add(context.registerAttributeParser(ExtendedCommunitiesAttributeParser.TYPE, new ExtendedCommunitiesAttributeParser()));
+ regs.add(context.registerAttributeParser(AS4AggregatorAttributeParser.TYPE, new AS4AggregatorAttributeParser()));
+ regs.add(context.registerAttributeParser(AS4PathAttributeParser.TYPE, new AS4PathAttributeParser()));
final CapabilityRegistry capReg = context.getCapabilityRegistry();
final MultiProtocolCapabilityHandler multi = new MultiProtocolCapabilityHandler(afiReg, safiReg);
- regs.add(capReg.registerCapabilityParser(MultiProtocolCapabilityHandler.CODE, multi));
- regs.add(capReg.registerCapabilitySerializer(CMultiprotocol.class, multi));
+ regs.add(context.registerCapabilityParser(MultiProtocolCapabilityHandler.CODE, multi));
+ regs.add(context.registerCapabilitySerializer(CMultiprotocol.class, multi));
final As4CapabilityHandler as4 = new As4CapabilityHandler();
- regs.add(capReg.registerCapabilityParser(As4CapabilityHandler.CODE, as4));
- regs.add(capReg.registerCapabilitySerializer(CAs4Bytes.class, as4));
+ regs.add(context.registerCapabilityParser(As4CapabilityHandler.CODE, as4));
+ regs.add(context.registerCapabilitySerializer(CAs4Bytes.class, as4));
final ParameterRegistry paramReg = context.getParameterRegistry();
final CapabilityParameterParser cpp = new CapabilityParameterParser(capReg);
- regs.add(paramReg.registerParameterParser(CapabilityParameterParser.TYPE, cpp));
- regs.add(paramReg.registerParameterSerializer(BgpParameters.class, cpp));
+ regs.add(context.registerParameterParser(CapabilityParameterParser.TYPE, cpp));
+ regs.add(context.registerParameterSerializer(BgpParameters.class, cpp));
- final MessageRegistry msgReg = context.getMessageRegistry();
final BGPOpenMessageParser omp = new BGPOpenMessageParser(paramReg);
- regs.add(msgReg.registerMessageParser(BGPOpenMessageParser.TYPE, omp));
- regs.add(msgReg.registerMessageSerializer(Open.class, omp));
+ regs.add(context.registerMessageParser(BGPOpenMessageParser.TYPE, omp));
+ regs.add(context.registerMessageSerializer(Open.class, omp));
final BGPUpdateMessageParser ump = new BGPUpdateMessageParser(attrReg);
- regs.add(msgReg.registerMessageParser(BGPUpdateMessageParser.TYPE, ump));
+ regs.add(context.registerMessageParser(BGPUpdateMessageParser.TYPE, ump));
// Serialization of Update message is not supported
// regs.add(msgReg.registerMessageSerializer(Update.class, ump));
final BGPNotificationMessageParser nmp = new BGPNotificationMessageParser();
- regs.add(msgReg.registerMessageParser(BGPNotificationMessageParser.TYPE, nmp));
- regs.add(msgReg.registerMessageSerializer(Notify.class, nmp));
+ regs.add(context.registerMessageParser(BGPNotificationMessageParser.TYPE, nmp));
+ regs.add(context.registerMessageSerializer(Notify.class, nmp));
final BGPKeepAliveMessageParser kamp = new BGPKeepAliveMessageParser();
- regs.add(msgReg.registerMessageParser(BGPKeepAliveMessageParser.TYPE, kamp));
- regs.add(msgReg.registerMessageSerializer(Keepalive.class, kamp));
+ regs.add(context.registerMessageParser(BGPKeepAliveMessageParser.TYPE, kamp));
+ regs.add(context.registerMessageSerializer(Keepalive.class, kamp));
registrations = regs;
}
--- /dev/null
+/*
+ * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.protocol.bgp.parser.impl;
+
+import org.opendaylight.protocol.bgp.parser.spi.BGPExtensionProviderActivator;
+import org.opendaylight.protocol.bgp.parser.spi.BGPExtensionProviderContext;
+import org.opendaylight.protocol.bgp.parser.spi.osgi.AbstractOSGiBGPExtensionProviderActivator;
+
+public final class OSGiActivator extends AbstractOSGiBGPExtensionProviderActivator {
+ private final BGPExtensionProviderActivator activator = new Activator();
+
+ @Override
+ public void start(final BGPExtensionProviderContext context) throws Exception {
+ activator.start(context);
+ }
+
+ @Override
+ public void stop() throws Exception {
+ activator.stop();
+ }
+}
+++ /dev/null
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.protocol.bgp.parser.impl;
-
-import org.opendaylight.protocol.bgp.parser.spi.AddressFamilyRegistry;
-import org.opendaylight.protocol.bgp.parser.spi.AttributeRegistry;
-import org.opendaylight.protocol.bgp.parser.spi.CapabilityRegistry;
-import org.opendaylight.protocol.bgp.parser.spi.MessageRegistry;
-import org.opendaylight.protocol.bgp.parser.spi.NlriRegistry;
-import org.opendaylight.protocol.bgp.parser.spi.ParameterRegistry;
-import org.opendaylight.protocol.bgp.parser.spi.ProviderContext;
-import org.opendaylight.protocol.bgp.parser.spi.SubsequentAddressFamilyRegistry;
-
-public final class SingletonProviderContext implements ProviderContext {
- private static final class Holder {
- private static final ProviderContext INSTANCE;
-
- static {
- final ProviderContext pc = new SingletonProviderContext();
- new ActivatorImpl().start(pc);
- INSTANCE = pc;
- }
- }
-
- private final AddressFamilyRegistry afiReg = new SimpleAddressFamilyRegistry();
- private final AttributeRegistry attrReg = new SimpleAttributeRegistry();
- private final CapabilityRegistry capReg = new SimpleCapabilityRegistry();
- private final MessageRegistry msgReg = new SimpleMessageRegistry();
- private final NlriRegistry nlriReg;
- private final ParameterRegistry paramReg = new SimpleParameterRegistry();
- private final SubsequentAddressFamilyRegistry safiReg= new SimpleSubsequentAddressFamilyRegistry();
-
- private SingletonProviderContext() {
- nlriReg = new SimpleNlriRegistry(afiReg, safiReg);
- }
-
- public static ProviderContext getInstance() {
- return Holder.INSTANCE;
- }
-
- @Override
- public AddressFamilyRegistry getAddressFamilyRegistry() {
- return afiReg;
- }
-
- @Override
- public AttributeRegistry getAttributeRegistry() {
- return attrReg;
- }
-
- @Override
- public CapabilityRegistry getCapabilityRegistry() {
- return capReg;
- }
-
- @Override
- public MessageRegistry getMessageRegistry() {
- return msgReg;
- }
-
- @Override
- public NlriRegistry getNlriRegistry() {
- return nlriReg;
- }
-
- @Override
- public ParameterRegistry getParameterRegistry() {
- return paramReg;
- }
-
- @Override
- public SubsequentAddressFamilyRegistry getSubsequentAddressFamilyRegistry() {
- return safiReg;
- }
-}
--- /dev/null
+org.opendaylight.protocol.bgp.parser.impl.Activator
import org.opendaylight.protocol.bgp.parser.impl.message.BGPUpdateMessageParser;
import org.opendaylight.protocol.bgp.parser.spi.MessageRegistry;
import org.opendaylight.protocol.bgp.parser.spi.MessageUtil;
+import org.opendaylight.protocol.bgp.parser.spi.pojo.BGPExtensionConsumerContextImpl;
import org.opendaylight.protocol.util.ByteArray;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.AsNumber;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;
@BeforeClass
public static void setUp() throws Exception {
- updateParser = new BGPUpdateMessageParser(SingletonProviderContext.getInstance().getAttributeRegistry());
+ updateParser = new BGPUpdateMessageParser(BGPExtensionConsumerContextImpl.getSingletonInstance().getAttributeRegistry());
for (int i = 1; i <= COUNTER; i++) {
final String name = "/up" + i + ".bin";
final byte[] body = ByteArray.cutBytes(inputBytes.get(0), MessageUtil.COMMON_HEADER_LENGTH);
final int messageLength = ByteArray.bytesToInt(ByteArray.subByte(inputBytes.get(0), MessageUtil.MARKER_LENGTH,
MessageUtil.LENGTH_FIELD_LENGTH));
- final Update message = this.updateParser.parseMessageBody(body, messageLength);
+ final Update message = BGPParserTest.updateParser.parseMessageBody(body, messageLength);
// check fields
final byte[] body = ByteArray.cutBytes(inputBytes.get(1), MessageUtil.COMMON_HEADER_LENGTH);
final int messageLength = ByteArray.bytesToInt(ByteArray.subByte(inputBytes.get(1), MessageUtil.MARKER_LENGTH,
MessageUtil.LENGTH_FIELD_LENGTH));
- final Update message = this.updateParser.parseMessageBody(body, messageLength);
+ final Update message = BGPParserTest.updateParser.parseMessageBody(body, messageLength);
// check fields
assertNull(message.getWithdrawnRoutes());
final byte[] body = ByteArray.cutBytes(inputBytes.get(2), MessageUtil.COMMON_HEADER_LENGTH);
final int messageLength = ByteArray.bytesToInt(ByteArray.subByte(inputBytes.get(2), MessageUtil.MARKER_LENGTH,
MessageUtil.LENGTH_FIELD_LENGTH));
- final Update message = this.updateParser.parseMessageBody(body, messageLength);
+ final Update message = BGPParserTest.updateParser.parseMessageBody(body, messageLength);
// check fields
assertNull(message.getWithdrawnRoutes());
final byte[] body = ByteArray.cutBytes(inputBytes.get(3), MessageUtil.COMMON_HEADER_LENGTH);
final int messageLength = ByteArray.bytesToInt(ByteArray.subByte(inputBytes.get(3), MessageUtil.MARKER_LENGTH,
MessageUtil.LENGTH_FIELD_LENGTH));
- final Update message = this.updateParser.parseMessageBody(body, messageLength);
+ final Update message = BGPParserTest.updateParser.parseMessageBody(body, messageLength);
// check fields
final byte[] body = ByteArray.cutBytes(inputBytes.get(4), MessageUtil.COMMON_HEADER_LENGTH);
final int messageLength = ByteArray.bytesToInt(ByteArray.subByte(inputBytes.get(4), MessageUtil.MARKER_LENGTH,
MessageUtil.LENGTH_FIELD_LENGTH));
- final Update message = this.updateParser.parseMessageBody(body, messageLength);
+ final Update message = BGPParserTest.updateParser.parseMessageBody(body, messageLength);
// attributes
final byte[] body = ByteArray.cutBytes(inputBytes.get(5), MessageUtil.COMMON_HEADER_LENGTH);
final int messageLength = ByteArray.bytesToInt(ByteArray.subByte(inputBytes.get(5), MessageUtil.MARKER_LENGTH,
MessageUtil.LENGTH_FIELD_LENGTH));
- final Update message = this.updateParser.parseMessageBody(body, messageLength);
+ final Update message = BGPParserTest.updateParser.parseMessageBody(body, messageLength);
assertEquals(new UpdateBuilder().build(), message);
}
final byte[] body = ByteArray.cutBytes(inputBytes.get(6), MessageUtil.COMMON_HEADER_LENGTH);
final int messageLength = ByteArray.bytesToInt(ByteArray.subByte(inputBytes.get(6), MessageUtil.MARKER_LENGTH,
MessageUtil.LENGTH_FIELD_LENGTH));
- final Update message = this.updateParser.parseMessageBody(body, messageLength);
+ final Update message = BGPParserTest.updateParser.parseMessageBody(body, messageLength);
// check fields
final byte[] body = ByteArray.cutBytes(inputBytes.get(7), MessageUtil.COMMON_HEADER_LENGTH);
final int messageLength = ByteArray.bytesToInt(ByteArray.subByte(inputBytes.get(7), MessageUtil.MARKER_LENGTH,
MessageUtil.LENGTH_FIELD_LENGTH));
- final Update message = this.updateParser.parseMessageBody(body, messageLength);
+ final Update message = BGPParserTest.updateParser.parseMessageBody(body, messageLength);
final Class<? extends AddressFamily> afi = message.getPathAttributes().getAugmentation(PathAttributes1.class).getMpReachNlri().getAfi();
final SubsequentAddressFamily safi = message.getPathAttributes().getAugmentation(PathAttributes1.class).getMpReachNlri().getSafi().newInstance();
final byte[] body = ByteArray.cutBytes(inputBytes.get(8), MessageUtil.COMMON_HEADER_LENGTH);
final int messageLength = ByteArray.bytesToInt(ByteArray.subByte(inputBytes.get(8), MessageUtil.MARKER_LENGTH,
MessageUtil.LENGTH_FIELD_LENGTH));
- final Update message = this.updateParser.parseMessageBody(body, messageLength);
+ final Update message = BGPParserTest.updateParser.parseMessageBody(body, messageLength);
// check fields
final byte[] body = ByteArray.cutBytes(inputBytes.get(9), MessageUtil.COMMON_HEADER_LENGTH);
final int messageLength = ByteArray.bytesToInt(ByteArray.subByte(inputBytes.get(9), MessageUtil.MARKER_LENGTH,
MessageUtil.LENGTH_FIELD_LENGTH));
- final Update message = this.updateParser.parseMessageBody(body, messageLength);
+ final Update message = BGPParserTest.updateParser.parseMessageBody(body, messageLength);
// check fields
*/
@Test
public void testOpenMessage() throws Exception {
- final MessageRegistry msgReg = SingletonProviderContext.getInstance().getMessageRegistry();
+ final MessageRegistry msgReg = BGPExtensionConsumerContextImpl.getSingletonInstance().getMessageRegistry();
final Open open = (Open) msgReg.parseMessage(inputBytes.get(13));
final Set<BgpTableType> types = Sets.newHashSet();
for (final BgpParameters param : open.getBgpParameters()) {
import org.opendaylight.protocol.bgp.parser.BgpTableTypeImpl;
import org.opendaylight.protocol.bgp.parser.impl.message.update.CommunitiesParser;
import org.opendaylight.protocol.bgp.parser.spi.MessageRegistry;
+import org.opendaylight.protocol.bgp.parser.spi.pojo.BGPExtensionConsumerContextImpl;
import org.opendaylight.protocol.framework.DeserializerException;
import org.opendaylight.protocol.framework.DocumentedException;
import org.opendaylight.protocol.util.ByteList;
@Test
public void testBGPHeaderParser() throws IOException {
- final MessageRegistry msgReg = SingletonProviderContext.getInstance().getMessageRegistry();
+ final MessageRegistry msgReg = BGPExtensionConsumerContextImpl.getSingletonInstance().getMessageRegistry();
try {
msgReg.parseMessage(new byte[] { (byte) 0, (byte) 0 });
fail("Exception should have occured.");
@Test
public void testMessageParser() throws IOException {
- final MessageRegistry msgReg = SingletonProviderContext.getInstance().getMessageRegistry();
+ final MessageRegistry msgReg = BGPExtensionConsumerContextImpl.getSingletonInstance().getMessageRegistry();
String ex = "";
try {
msgReg.serializeMessage(null);
import org.junit.Test;
import org.opendaylight.protocol.bgp.parser.BGPDocumentedException;
import org.opendaylight.protocol.bgp.parser.BGPParsingException;
+import org.opendaylight.protocol.bgp.parser.spi.pojo.BGPExtensionConsumerContextImpl;
/*
* To test incorrect values.
@Test
public void testOriginParser() {
try {
- SingletonProviderContext.getInstance().getAttributeRegistry().parseAttributes(new byte[] { 0x40, 0x01, 0x01, 0x04 });
+ BGPExtensionConsumerContextImpl.getSingletonInstance().getAttributeRegistry().parseAttributes(new byte[] { 0x40, 0x01, 0x01, 0x04 });
fail("This needs to fail.");
} catch (final BGPDocumentedException e) {
assertEquals("Unknown Origin type.", e.getMessage());
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <version>${osgi.version}</version>
+ <scope>provided</scope>
+ </dependency>
</dependencies>
<build>
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.AddressFamily;
public interface AddressFamilyRegistry {
- public AutoCloseable registerAddressFamily(Class<? extends AddressFamily> clazz, int number);
-
public Class<? extends AddressFamily> classForFamily(int number);
public Integer numberForClass(Class<? extends AddressFamily> clazz);
}
import org.opendaylight.yangtools.yang.binding.DataObject;
public interface AttributeRegistry {
- public AutoCloseable registerAttributeParser(int attributeType, AttributeParser parser);
- public AutoCloseable registerAttributeSerializer(Class<? extends DataObject> attributeClass, AttributeSerializer serializer);
-
public PathAttributes parseAttributes(final byte[] bytes) throws BGPDocumentedException, BGPParsingException;
public byte[] serializeAttribute(DataObject attribute);
}
*/
package org.opendaylight.protocol.bgp.parser.spi;
-public interface ProviderActivator {
- public void start(ProviderContext context);
- public void stop();
+public interface BGPExtensionConsumerActivator {
+ public void start(BGPExtensionConsumerContext context) throws Exception;
+ public void stop() throws Exception;
}
\ No newline at end of file
*/
package org.opendaylight.protocol.bgp.parser.spi;
-public interface ProviderContext {
+public interface BGPExtensionConsumerContext {
public AddressFamilyRegistry getAddressFamilyRegistry();
public AttributeRegistry getAttributeRegistry();
public CapabilityRegistry getCapabilityRegistry();
--- /dev/null
+/*
+ * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.protocol.bgp.parser.spi;
+
+public interface BGPExtensionProviderActivator {
+ public void start(BGPExtensionProviderContext context) throws Exception;
+ public void stop() throws Exception;
+}
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.protocol.bgp.parser.spi;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130918.open.BgpParameters;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130918.open.bgp.parameters.CParameters;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.AddressFamily;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.SubsequentAddressFamily;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.opendaylight.yangtools.yang.binding.Notification;
+
+public interface BGPExtensionProviderContext extends BGPExtensionConsumerContext {
+ public AutoCloseable registerAddressFamily(Class<? extends AddressFamily> clazz, int number);
+ public AutoCloseable registerSubsequentAddressFamily(Class<? extends SubsequentAddressFamily> clazz, int number);
+
+ public AutoCloseable registerAttributeParser(int attributeType, AttributeParser parser);
+ public AutoCloseable registerAttributeSerializer(Class<? extends DataObject> attributeClass, AttributeSerializer serializer);
+
+ public AutoCloseable registerCapabilityParser(int capabilityType, CapabilityParser parser);
+ public AutoCloseable registerCapabilitySerializer(Class<? extends CParameters> capabilityClass, CapabilitySerializer serializer);
+
+ public AutoCloseable registerMessageParser(int messageType, MessageParser parser);
+ public AutoCloseable registerMessageSerializer(Class<? extends Notification> messageClass, MessageSerializer serializer);
+
+ public AutoCloseable registerNlriParser(Class<? extends AddressFamily> afi, Class<? extends SubsequentAddressFamily> safi, NlriParser parser);
+ public AutoCloseable registerNlriSerializer(Class<? extends DataObject> nlriClass, NlriSerializer serializer);
+
+ public AutoCloseable registerParameterParser(int parameterType, ParameterParser parser);
+ public AutoCloseable registerParameterSerializer(Class<? extends BgpParameters> paramClass, ParameterSerializer serializer);
+}
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130918.open.bgp.parameters.CParameters;
public interface CapabilityRegistry {
- public AutoCloseable registerCapabilityParser(int capabilityType, CapabilityParser parser);
- public AutoCloseable registerCapabilitySerializer(Class<? extends CParameters> capabilityClass, CapabilitySerializer serializer);
-
public CParameters parseCapability(final int type, final byte[] bytes) throws BGPDocumentedException, BGPParsingException;
public byte[] serializeCapability(CParameters capability);
}
import org.opendaylight.yangtools.yang.binding.Notification;
public interface MessageRegistry {
- public AutoCloseable registerMessageParser(int messageType, MessageParser parser);
- public AutoCloseable registerMessageSerializer(Class<? extends Notification> messageClass, MessageSerializer serializer);
-
public Notification parseMessage(final byte[] bytes) throws BGPDocumentedException, DeserializerException;
public byte[] serializeMessage(Notification message);
}
import org.opendaylight.protocol.bgp.parser.BGPParsingException;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130918.update.path.attributes.MpReachNlri;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130918.update.path.attributes.MpUnreachNlri;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.AddressFamily;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.SubsequentAddressFamily;
public interface NlriRegistry {
- public AutoCloseable registerNlriParser(Class<? extends AddressFamily> afi,
- Class<? extends SubsequentAddressFamily> safi, NlriParser parser);
- // public AutoCloseable registerNlriSerializer(Class<? extends DataObject> nlriClass, NlriSerializer serializer);
-
public MpUnreachNlri parseMpUnreach(final byte[] bytes) throws BGPParsingException;
public MpReachNlri parseMpReach(final byte[] bytes) throws BGPParsingException;
// public byte[] serializeNlri(DataObject attribute);
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130918.open.BgpParameters;
public interface ParameterRegistry {
- public AutoCloseable registerParameterParser(int parameterType, ParameterParser parser);
- public AutoCloseable registerParameterSerializer(Class<? extends BgpParameters> paramClass, ParameterSerializer serializer);
-
public BgpParameters parseParameter(int parameterType, final byte[] bytes) throws BGPParsingException, BGPDocumentedException;
public byte[] serializeParameter(final BgpParameters parameter);
}
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.SubsequentAddressFamily;
public interface SubsequentAddressFamilyRegistry {
- public AutoCloseable registerSubsequentAddressFamily(Class<? extends SubsequentAddressFamily> clazz, int number);
-
public Class<? extends SubsequentAddressFamily> classForFamily(int number);
public Integer numberForClass(Class<? extends SubsequentAddressFamily> clazz);
}
--- /dev/null
+/*
+ * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.protocol.bgp.parser.spi.osgi;
+
+import org.opendaylight.protocol.bgp.parser.spi.BGPExtensionConsumerActivator;
+import org.opendaylight.protocol.bgp.parser.spi.BGPExtensionConsumerContext;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+import com.google.common.base.Preconditions;
+
+public abstract class AbstractOSGiBGPExtensionConsumerActivator implements BundleActivator, BGPExtensionConsumerActivator {
+ private BGPExtensionConsumerContext consumerContext;
+
+ @Override
+ public final void start(final BundleContext context) throws Exception {
+ Preconditions.checkState(consumerContext == null);
+ final BGPExtensionConsumerContext consumerContext = new OSGiBGPExtensionProviderContext(context);
+ start(consumerContext);
+ this.consumerContext = consumerContext;
+ }
+
+ @Override
+ public final void stop(final BundleContext context) throws Exception {
+ Preconditions.checkState(consumerContext != null);
+ try {
+ stop();
+ } finally {
+ consumerContext = null;
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.protocol.bgp.parser.spi.osgi;
+
+import org.opendaylight.protocol.bgp.parser.spi.BGPExtensionProviderActivator;
+import org.opendaylight.protocol.bgp.parser.spi.BGPExtensionProviderContext;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+import com.google.common.base.Preconditions;
+
+public abstract class AbstractOSGiBGPExtensionProviderActivator implements BundleActivator, BGPExtensionProviderActivator {
+ private BGPExtensionProviderContext providerContext;
+
+ @Override
+ public final void start(final BundleContext context) throws Exception {
+ Preconditions.checkState(providerContext == null);
+ final BGPExtensionProviderContext providerContext = new OSGiBGPExtensionProviderContext(context);
+ start(providerContext);
+ this.providerContext = providerContext;
+ }
+
+ @Override
+ public final void stop(final BundleContext context) throws Exception {
+ Preconditions.checkState(providerContext != null);
+ try {
+ stop();
+ } finally {
+ providerContext = null;
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.protocol.bgp.parser.spi.osgi;
+
+import org.opendaylight.protocol.bgp.parser.spi.AddressFamilyRegistry;
+import org.opendaylight.protocol.bgp.parser.spi.AttributeRegistry;
+import org.opendaylight.protocol.bgp.parser.spi.BGPExtensionConsumerContext;
+import org.opendaylight.protocol.bgp.parser.spi.CapabilityRegistry;
+import org.opendaylight.protocol.bgp.parser.spi.MessageRegistry;
+import org.opendaylight.protocol.bgp.parser.spi.NlriRegistry;
+import org.opendaylight.protocol.bgp.parser.spi.ParameterRegistry;
+import org.opendaylight.protocol.bgp.parser.spi.SubsequentAddressFamilyRegistry;
+import org.opendaylight.protocol.concepts.AbstractRegistration;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+
+import com.google.common.base.Preconditions;
+
+class OSGiBGPExtensionConsumerContext implements BGPExtensionConsumerContext {
+ protected final BundleContext bundleContext;
+
+ OSGiBGPExtensionConsumerContext(final BundleContext context) {
+ this.bundleContext = Preconditions.checkNotNull(context);
+ }
+
+ protected <T> AutoCloseable register(final Class<T> clazz, final T object) {
+ final ServiceRegistration<T> reg = bundleContext.registerService(clazz, object, null);
+
+ return new AbstractRegistration() {
+ @Override
+ protected void removeRegistration() {
+ reg.unregister();
+ }
+ };
+ }
+
+ public BundleContext getBundleContext() {
+ return bundleContext;
+ }
+
+ @Override
+ public AddressFamilyRegistry getAddressFamilyRegistry() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public AttributeRegistry getAttributeRegistry() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public CapabilityRegistry getCapabilityRegistry() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public MessageRegistry getMessageRegistry() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public NlriRegistry getNlriRegistry() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public ParameterRegistry getParameterRegistry() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public SubsequentAddressFamilyRegistry getSubsequentAddressFamilyRegistry() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
--- /dev/null
+/*
+ * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.protocol.bgp.parser.spi.osgi;
+
+import org.opendaylight.protocol.bgp.parser.spi.AttributeParser;
+import org.opendaylight.protocol.bgp.parser.spi.AttributeSerializer;
+import org.opendaylight.protocol.bgp.parser.spi.BGPExtensionProviderContext;
+import org.opendaylight.protocol.bgp.parser.spi.CapabilityParser;
+import org.opendaylight.protocol.bgp.parser.spi.CapabilitySerializer;
+import org.opendaylight.protocol.bgp.parser.spi.MessageParser;
+import org.opendaylight.protocol.bgp.parser.spi.MessageSerializer;
+import org.opendaylight.protocol.bgp.parser.spi.NlriParser;
+import org.opendaylight.protocol.bgp.parser.spi.NlriSerializer;
+import org.opendaylight.protocol.bgp.parser.spi.ParameterParser;
+import org.opendaylight.protocol.bgp.parser.spi.ParameterSerializer;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130918.open.BgpParameters;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130918.open.bgp.parameters.CParameters;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.AddressFamily;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.SubsequentAddressFamily;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.opendaylight.yangtools.yang.binding.Notification;
+import org.osgi.framework.BundleContext;
+
+final class OSGiBGPExtensionProviderContext extends OSGiBGPExtensionConsumerContext implements BGPExtensionProviderContext {
+
+ OSGiBGPExtensionProviderContext(final BundleContext context) {
+ super(context);
+ }
+
+ interface ClassRegistration<T> {
+ public int getRegisteredNumber();
+ public Class<? extends T> getRegisteredClass();
+ }
+
+ interface ParserRegistration<PARSER> {
+ public int getRegisteredNumber();
+ public Class<PARSER> getRegisteredParserClass();
+ public PARSER getRegisteredParserObject();
+ }
+
+ interface SerializerRegistration<SERIALIZER> {
+ public Class<?> getRegisteredObjectClass();
+ public Class<SERIALIZER> getRegisteredSerializerClass();
+ public SERIALIZER getRegisteredSerializer();
+ }
+
+ @Override
+ public AutoCloseable registerAddressFamily(final Class<? extends AddressFamily> clazz, final int number) {
+ return register(ClassRegistration.class, new ClassRegistration<AddressFamily>() {
+ @Override
+ public int getRegisteredNumber() {
+ return number;
+ }
+ @Override
+ public Class<? extends AddressFamily> getRegisteredClass() {
+ return clazz;
+ }
+ });
+ }
+
+ @Override
+ public AutoCloseable registerSubsequentAddressFamily(final Class<? extends SubsequentAddressFamily> clazz, final int number) {
+ return register(ClassRegistration.class, new ClassRegistration<SubsequentAddressFamily>() {
+ @Override
+ public int getRegisteredNumber() {
+ return number;
+ }
+ @Override
+ public Class<? extends SubsequentAddressFamily> getRegisteredClass() {
+ return clazz;
+ }
+ });
+ }
+
+ @Override
+ public AutoCloseable registerAttributeParser(final int attributeType, final AttributeParser parser) {
+ return register(ParserRegistration.class, new ParserRegistration<AttributeParser>() {
+ @Override
+ public int getRegisteredNumber() {
+ return attributeType;
+ }
+
+ @Override
+ public Class<AttributeParser> getRegisteredParserClass() {
+ return AttributeParser.class;
+ }
+
+ @Override
+ public AttributeParser getRegisteredParserObject() {
+ return parser;
+ }
+ });
+ }
+
+ @Override
+ public AutoCloseable registerAttributeSerializer(final Class<? extends DataObject> attributeClass, final AttributeSerializer serializer) {
+ return register(SerializerRegistration.class, new SerializerRegistration<AttributeSerializer>() {
+ @Override
+ public Class<?> getRegisteredObjectClass() {
+ return attributeClass;
+ }
+
+ @Override
+ public Class<AttributeSerializer> getRegisteredSerializerClass() {
+ return AttributeSerializer.class;
+ }
+
+ @Override
+ public AttributeSerializer getRegisteredSerializer() {
+ return serializer;
+ }
+ });
+ }
+
+ @Override
+ public AutoCloseable registerCapabilityParser(final int capabilityType, final CapabilityParser parser) {
+ return register(ParserRegistration.class, new ParserRegistration<CapabilityParser>() {
+ @Override
+ public int getRegisteredNumber() {
+ return capabilityType;
+ }
+
+ @Override
+ public Class<CapabilityParser> getRegisteredParserClass() {
+ return CapabilityParser.class;
+ }
+
+ @Override
+ public CapabilityParser getRegisteredParserObject() {
+ return parser;
+ }
+ });
+ }
+
+ @Override
+ public AutoCloseable registerCapabilitySerializer(final Class<? extends CParameters> capabilityClass, final CapabilitySerializer serializer) {
+ return register(SerializerRegistration.class, new SerializerRegistration<CapabilitySerializer>() {
+ @Override
+ public Class<?> getRegisteredObjectClass() {
+ return capabilityClass;
+ }
+
+ @Override
+ public Class<CapabilitySerializer> getRegisteredSerializerClass() {
+ return CapabilitySerializer.class;
+ }
+
+ @Override
+ public CapabilitySerializer getRegisteredSerializer() {
+ return serializer;
+ }
+ });
+ }
+
+ @Override
+ public AutoCloseable registerMessageParser(final int messageType, final MessageParser parser) {
+ return register(ParserRegistration.class, new ParserRegistration<MessageParser>() {
+ @Override
+ public int getRegisteredNumber() {
+ return messageType;
+ }
+
+ @Override
+ public Class<MessageParser> getRegisteredParserClass() {
+ return MessageParser.class;
+ }
+
+ @Override
+ public MessageParser getRegisteredParserObject() {
+ return parser;
+ }
+ });
+ }
+
+ @Override
+ public AutoCloseable registerMessageSerializer(final Class<? extends Notification> messageClass, final MessageSerializer serializer) {
+ return register(SerializerRegistration.class, new SerializerRegistration<MessageSerializer>() {
+ @Override
+ public Class<?> getRegisteredObjectClass() {
+ return messageClass;
+ }
+
+ @Override
+ public Class<MessageSerializer> getRegisteredSerializerClass() {
+ return MessageSerializer.class;
+ }
+
+ @Override
+ public MessageSerializer getRegisteredSerializer() {
+ return serializer;
+ }
+ });
+ }
+
+ @Override
+ public AutoCloseable registerNlriParser(final Class<? extends AddressFamily> afi, final Class<? extends SubsequentAddressFamily> safi,
+ final NlriParser parser) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public AutoCloseable registerNlriSerializer(final Class<? extends DataObject> nlriClass, final NlriSerializer serializer) {
+ return register(SerializerRegistration.class, new SerializerRegistration<NlriSerializer>() {
+ @Override
+ public Class<?> getRegisteredObjectClass() {
+ return nlriClass;
+ }
+
+ @Override
+ public Class<NlriSerializer> getRegisteredSerializerClass() {
+ return NlriSerializer.class;
+ }
+
+ @Override
+ public NlriSerializer getRegisteredSerializer() {
+ return serializer;
+ }
+ });
+ }
+
+ @Override
+ public AutoCloseable registerParameterParser(final int parameterType, final ParameterParser parser) {
+ return register(ParserRegistration.class, new ParserRegistration<ParameterParser>() {
+ @Override
+ public int getRegisteredNumber() {
+ return parameterType;
+ }
+
+ @Override
+ public Class<ParameterParser> getRegisteredParserClass() {
+ return ParameterParser.class;
+ }
+
+ @Override
+ public ParameterParser getRegisteredParserObject() {
+ return parser;
+ }
+ });
+ }
+
+ @Override
+ public AutoCloseable registerParameterSerializer(final Class<? extends BgpParameters> paramClass, final ParameterSerializer serializer) {
+ return register(SerializerRegistration.class, new SerializerRegistration<ParameterSerializer>() {
+ @Override
+ public Class<?> getRegisteredObjectClass() {
+ return paramClass;
+ }
+
+ @Override
+ public Class<ParameterSerializer> getRegisteredSerializerClass() {
+ return ParameterSerializer.class;
+ }
+
+ @Override
+ public ParameterSerializer getRegisteredSerializer() {
+ return serializer;
+ }
+ });
+ }
+}
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.protocol.bgp.parser.impl;
+package org.opendaylight.protocol.bgp.parser.spi.pojo;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.protocol.bgp.parser.impl;
+package org.opendaylight.protocol.bgp.parser.spi.pojo;
import java.util.Arrays;
--- /dev/null
+/*
+ * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.protocol.bgp.parser.spi.pojo;
+
+import java.util.ServiceLoader;
+
+import org.opendaylight.protocol.bgp.parser.spi.AddressFamilyRegistry;
+import org.opendaylight.protocol.bgp.parser.spi.AttributeParser;
+import org.opendaylight.protocol.bgp.parser.spi.AttributeRegistry;
+import org.opendaylight.protocol.bgp.parser.spi.AttributeSerializer;
+import org.opendaylight.protocol.bgp.parser.spi.BGPExtensionConsumerContext;
+import org.opendaylight.protocol.bgp.parser.spi.BGPExtensionProviderActivator;
+import org.opendaylight.protocol.bgp.parser.spi.BGPExtensionProviderContext;
+import org.opendaylight.protocol.bgp.parser.spi.CapabilityParser;
+import org.opendaylight.protocol.bgp.parser.spi.CapabilityRegistry;
+import org.opendaylight.protocol.bgp.parser.spi.CapabilitySerializer;
+import org.opendaylight.protocol.bgp.parser.spi.MessageParser;
+import org.opendaylight.protocol.bgp.parser.spi.MessageRegistry;
+import org.opendaylight.protocol.bgp.parser.spi.MessageSerializer;
+import org.opendaylight.protocol.bgp.parser.spi.NlriParser;
+import org.opendaylight.protocol.bgp.parser.spi.NlriRegistry;
+import org.opendaylight.protocol.bgp.parser.spi.NlriSerializer;
+import org.opendaylight.protocol.bgp.parser.spi.ParameterParser;
+import org.opendaylight.protocol.bgp.parser.spi.ParameterRegistry;
+import org.opendaylight.protocol.bgp.parser.spi.ParameterSerializer;
+import org.opendaylight.protocol.bgp.parser.spi.SubsequentAddressFamilyRegistry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130918.open.BgpParameters;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130918.open.bgp.parameters.CParameters;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.AddressFamily;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.SubsequentAddressFamily;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.opendaylight.yangtools.yang.binding.Notification;
+
+public final class BGPExtensionConsumerContextImpl implements BGPExtensionProviderContext {
+ private static final class Holder {
+ private static final BGPExtensionConsumerContext INSTANCE;
+
+ static {
+ try {
+ INSTANCE = BGPExtensionConsumerContextImpl.create();
+ } catch (Exception e) {
+ throw new ExceptionInInitializerError(e);
+ }
+ }
+ }
+
+ private final SimpleAddressFamilyRegistry afiReg = new SimpleAddressFamilyRegistry();
+ private final SimpleAttributeRegistry attrReg = new SimpleAttributeRegistry();
+ private final SimpleCapabilityRegistry capReg = new SimpleCapabilityRegistry();
+ private final SimpleMessageRegistry msgReg = new SimpleMessageRegistry();
+ private final SimpleSubsequentAddressFamilyRegistry safiReg = new SimpleSubsequentAddressFamilyRegistry();
+ private final SimpleParameterRegistry paramReg = new SimpleParameterRegistry();
+ private final SimpleNlriRegistry nlriReg = new SimpleNlriRegistry(afiReg, safiReg);
+
+ private BGPExtensionConsumerContextImpl() {
+
+ }
+
+ public static BGPExtensionConsumerContext getSingletonInstance() {
+ return Holder.INSTANCE;
+ }
+
+ public static BGPExtensionConsumerContext create() throws Exception {
+ final BGPExtensionConsumerContextImpl ctx = new BGPExtensionConsumerContextImpl();
+
+ final ServiceLoader<BGPExtensionProviderActivator> loader = ServiceLoader.load(BGPExtensionProviderActivator.class);
+ for (BGPExtensionProviderActivator a : loader) {
+ a.start(ctx);
+ }
+
+ return ctx;
+ }
+
+ @Override
+ public AddressFamilyRegistry getAddressFamilyRegistry() {
+ return afiReg;
+ }
+
+ @Override
+ public AutoCloseable registerAddressFamily(final Class<? extends AddressFamily> clazz, final int number) {
+ return afiReg.registerAddressFamily(clazz, number);
+ }
+
+ @Override
+ public AttributeRegistry getAttributeRegistry() {
+ return attrReg;
+ }
+
+ @Override
+ public AutoCloseable registerAttributeParser(final int attributeType, final AttributeParser parser) {
+ return attrReg.registerAttributeParser(attributeType, parser);
+ }
+
+ @Override
+ public AutoCloseable registerAttributeSerializer(final Class<? extends DataObject> attributeClass, final AttributeSerializer serializer) {
+ return attrReg.registerAttributeSerializer(attributeClass, serializer);
+ }
+
+ @Override
+ public CapabilityRegistry getCapabilityRegistry() {
+ return capReg;
+ }
+
+ @Override
+ public AutoCloseable registerCapabilityParser(final int capabilityType, final CapabilityParser parser) {
+ return capReg.registerCapabilityParser(capabilityType, parser);
+ }
+
+ @Override
+ public AutoCloseable registerCapabilitySerializer(final Class<? extends CParameters> capabilityClass, final CapabilitySerializer serializer) {
+ return capReg.registerCapabilitySerializer(capabilityClass, serializer);
+ }
+
+ @Override
+ public MessageRegistry getMessageRegistry() {
+ return msgReg;
+ }
+
+ @Override
+ public AutoCloseable registerMessageParser(final int messageType, final MessageParser parser) {
+ return msgReg.registerMessageParser(messageType, parser);
+ }
+
+ @Override
+ public AutoCloseable registerMessageSerializer(final Class<? extends Notification> messageClass, final MessageSerializer serializer) {
+ return msgReg.registerMessageSerializer(messageClass, serializer);
+ }
+
+ @Override
+ public NlriRegistry getNlriRegistry() {
+ return nlriReg;
+ }
+
+ @Override
+ public AutoCloseable registerNlriParser(final Class<? extends AddressFamily> afi, final Class<? extends SubsequentAddressFamily> safi,
+ final NlriParser parser) {
+ return nlriReg.registerNlriParser(afi, safi, parser);
+ }
+
+ @Override
+ public AutoCloseable registerNlriSerializer(final Class<? extends DataObject> nlriClass, final NlriSerializer serializer) {
+ throw new UnsupportedOperationException("NLRI serialization not implemented");
+ }
+
+ @Override
+ public ParameterRegistry getParameterRegistry() {
+ return paramReg;
+ }
+
+ @Override
+ public AutoCloseable registerParameterParser(final int parameterType, final ParameterParser parser) {
+ return paramReg.registerParameterParser(parameterType, parser);
+ }
+
+ @Override
+ public AutoCloseable registerParameterSerializer(final Class<? extends BgpParameters> paramClass, final ParameterSerializer serializer) {
+ return paramReg.registerParameterSerializer(paramClass, serializer);
+ }
+
+ @Override
+ public SubsequentAddressFamilyRegistry getSubsequentAddressFamilyRegistry() {
+ return safiReg;
+ }
+
+ @Override
+ public AutoCloseable registerSubsequentAddressFamily(final Class<? extends SubsequentAddressFamily> clazz, final int number) {
+ return safiReg.registerSubsequentAddressFamily(clazz, number);
+ }
+}
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.protocol.bgp.parser.impl;
+package org.opendaylight.protocol.bgp.parser.spi.pojo;
import org.opendaylight.protocol.bgp.parser.spi.AddressFamilyRegistry;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.AddressFamily;
import com.google.common.base.Preconditions;
-public final class SimpleAddressFamilyRegistry extends AbstractFamilyRegistry<AddressFamily, Integer> implements AddressFamilyRegistry {
- @Override
- public AutoCloseable registerAddressFamily(final Class<? extends AddressFamily> clazz, final int number) {
+final class SimpleAddressFamilyRegistry extends AbstractFamilyRegistry<AddressFamily, Integer> implements AddressFamilyRegistry {
+ AutoCloseable registerAddressFamily(final Class<? extends AddressFamily> clazz, final int number) {
Preconditions.checkArgument(number >= 0 && number <= 65535);
return super.registerFamily(clazz, number);
}
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.protocol.bgp.parser.impl;
+package org.opendaylight.protocol.bgp.parser.spi.pojo;
import org.opendaylight.protocol.bgp.parser.BGPDocumentedException;
import org.opendaylight.protocol.bgp.parser.BGPError;
import com.google.common.base.Preconditions;
import com.google.common.primitives.UnsignedBytes;
-public final class SimpleAttributeRegistry implements AttributeRegistry {
+final class SimpleAttributeRegistry implements AttributeRegistry {
private final HandlerRegistry<DataContainer, AttributeParser, AttributeSerializer> handlers = new HandlerRegistry<>();
- @Override
- public AutoCloseable registerAttributeParser(final int attributeType, final AttributeParser parser) {
+ AutoCloseable registerAttributeParser(final int attributeType, final AttributeParser parser) {
Preconditions.checkArgument(attributeType >= 0 && attributeType <= 255);
return handlers.registerParser(attributeType, parser);
}
- @Override
- public AutoCloseable registerAttributeSerializer(final Class<? extends DataObject> paramClass, final AttributeSerializer serializer) {
+ AutoCloseable registerAttributeSerializer(final Class<? extends DataObject> paramClass, final AttributeSerializer serializer) {
return handlers.registerSerializer(paramClass, serializer);
}
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.protocol.bgp.parser.impl;
+package org.opendaylight.protocol.bgp.parser.spi.pojo;
import org.opendaylight.protocol.bgp.parser.BGPDocumentedException;
import org.opendaylight.protocol.bgp.parser.BGPParsingException;
import com.google.common.base.Preconditions;
-public final class SimpleCapabilityRegistry implements CapabilityRegistry {
+final class SimpleCapabilityRegistry implements CapabilityRegistry {
private final HandlerRegistry<DataContainer, CapabilityParser, CapabilitySerializer> handlers = new HandlerRegistry<>();
- @Override
- public AutoCloseable registerCapabilityParser(final int messageType, final CapabilityParser parser) {
+ AutoCloseable registerCapabilityParser(final int messageType, final CapabilityParser parser) {
Preconditions.checkArgument(messageType >= 0 && messageType <= 255);
return handlers.registerParser(messageType, parser);
}
- @Override
- public AutoCloseable registerCapabilitySerializer(final Class<? extends CParameters> paramClass, final CapabilitySerializer serializer) {
+ AutoCloseable registerCapabilitySerializer(final Class<? extends CParameters> paramClass, final CapabilitySerializer serializer) {
return handlers.registerSerializer(paramClass, serializer);
}
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.protocol.bgp.parser.impl;
+package org.opendaylight.protocol.bgp.parser.spi.pojo;
import org.opendaylight.protocol.bgp.parser.BGPDocumentedException;
import org.opendaylight.protocol.bgp.parser.spi.MessageParser;
import org.opendaylight.yangtools.yang.binding.DataContainer;
import org.opendaylight.yangtools.yang.binding.Notification;
-public final class SimpleMessageRegistry extends AbstractMessageRegistry {
+final class SimpleMessageRegistry extends AbstractMessageRegistry {
private final HandlerRegistry<DataContainer, MessageParser, MessageSerializer> handlers = new HandlerRegistry<>();
@Override
return serializer.serializeMessage(message);
}
- @Override
- public AutoCloseable registerMessageParser(final int messageType, final MessageParser parser) {
+ AutoCloseable registerMessageParser(final int messageType, final MessageParser parser) {
return handlers.registerParser(messageType, parser);
}
- @Override
- public AutoCloseable registerMessageSerializer(final Class<? extends Notification> messageClass, final MessageSerializer serializer) {
+ AutoCloseable registerMessageSerializer(final Class<? extends Notification> messageClass, final MessageSerializer serializer) {
return handlers.registerSerializer(messageClass, serializer);
}
}
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.protocol.bgp.parser.impl;
+package org.opendaylight.protocol.bgp.parser.spi.pojo;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import com.google.common.base.Preconditions;
import com.google.common.primitives.UnsignedBytes;
-public final class SimpleNlriRegistry implements NlriRegistry {
+final class SimpleNlriRegistry implements NlriRegistry {
private final ConcurrentMap<BgpTableType, NlriParser> handlers = new ConcurrentHashMap<>();
private final SubsequentAddressFamilyRegistry safiReg;
private final AddressFamilyRegistry afiReg;
return new BgpTableTypeImpl(afi, safi);
}
- @Override
- public synchronized AutoCloseable registerNlriParser(final Class<? extends AddressFamily> afi,
+ synchronized AutoCloseable registerNlriParser(final Class<? extends AddressFamily> afi,
final Class<? extends SubsequentAddressFamily> safi, final NlriParser parser) {
final BgpTableType key = createKey(afi, safi);
final NlriParser prev = handlers.get(key);
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.protocol.bgp.parser.impl;
+package org.opendaylight.protocol.bgp.parser.spi.pojo;
import org.opendaylight.protocol.bgp.parser.BGPDocumentedException;
import org.opendaylight.protocol.bgp.parser.BGPParsingException;
import com.google.common.base.Preconditions;
-public final class SimpleParameterRegistry implements ParameterRegistry {
+final class SimpleParameterRegistry implements ParameterRegistry {
private final HandlerRegistry<DataContainer, ParameterParser, ParameterSerializer> handlers = new HandlerRegistry<>();
- @Override
- public AutoCloseable registerParameterParser(final int messageType, final ParameterParser parser) {
+ AutoCloseable registerParameterParser(final int messageType, final ParameterParser parser) {
Preconditions.checkArgument(messageType >= 0 && messageType <= 255);
return handlers.registerParser(messageType, parser);
}
- @Override
- public AutoCloseable registerParameterSerializer(final Class<? extends BgpParameters> paramClass, final ParameterSerializer serializer) {
+ AutoCloseable registerParameterSerializer(final Class<? extends BgpParameters> paramClass, final ParameterSerializer serializer) {
return handlers.registerSerializer(paramClass, serializer);
}
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.protocol.bgp.parser.impl;
+package org.opendaylight.protocol.bgp.parser.spi.pojo;
import org.opendaylight.protocol.bgp.parser.spi.SubsequentAddressFamilyRegistry;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.SubsequentAddressFamily;
import com.google.common.base.Preconditions;
-public final class SimpleSubsequentAddressFamilyRegistry extends
-AbstractFamilyRegistry<SubsequentAddressFamily, Integer> implements SubsequentAddressFamilyRegistry {
- @Override
- public AutoCloseable registerSubsequentAddressFamily(final Class<? extends SubsequentAddressFamily> clazz, final int number) {
+final class SimpleSubsequentAddressFamilyRegistry extends AbstractFamilyRegistry<SubsequentAddressFamily, Integer> implements SubsequentAddressFamilyRegistry {
+ AutoCloseable registerSubsequentAddressFamily(final Class<? extends SubsequentAddressFamily> clazz, final int number) {
Preconditions.checkArgument(number >= 0 && number <= 255);
return super.registerFamily(clazz, number);
}
import org.opendaylight.protocol.bgp.parser.BGPDocumentedException;
import org.opendaylight.protocol.bgp.parser.BGPError;
import org.opendaylight.protocol.bgp.parser.BgpTableTypeImpl;
-import org.opendaylight.protocol.bgp.parser.impl.SingletonProviderContext;
import org.opendaylight.protocol.bgp.parser.spi.MessageRegistry;
+import org.opendaylight.protocol.bgp.parser.spi.pojo.BGPExtensionConsumerContextImpl;
import org.opendaylight.protocol.framework.DeserializerException;
import org.opendaylight.protocol.framework.DocumentedException;
import org.opendaylight.protocol.util.ByteArray;
(byte) 0x01, (byte) 0x00, (byte) 0x01 };
final MessageRegistry factory =
- SingletonProviderContext.getInstance().getMessageRegistry();
+ BGPExtensionConsumerContextImpl.getSingletonInstance().getMessageRegistry();
@Test
public void testHeaderErrors() throws DeserializerException, DocumentedException {
import org.opendaylight.protocol.bgp.parser.BGPSessionListener;
import org.opendaylight.protocol.bgp.parser.impl.BGPMessageFactoryImpl;
-import org.opendaylight.protocol.bgp.parser.impl.SingletonProviderContext;
+import org.opendaylight.protocol.bgp.parser.spi.pojo.BGPExtensionConsumerContextImpl;
import org.opendaylight.protocol.bgp.rib.impl.BGPDispatcherImpl;
import org.opendaylight.protocol.bgp.rib.impl.BGPSessionProposalImpl;
import org.opendaylight.protocol.bgp.rib.impl.spi.BGPSessionPreferences;
BGPDispatcherImpl dispatcher;
public Main() throws IOException {
- this.dispatcher = new BGPDispatcherImpl(new BGPMessageFactoryImpl(SingletonProviderContext.getInstance().getMessageRegistry()));
+ this.dispatcher = new BGPDispatcherImpl(new BGPMessageFactoryImpl(BGPExtensionConsumerContextImpl.getSingletonInstance().getMessageRegistry()));
}
public static void main(final String[] args) throws NumberFormatException, IOException {
import org.opendaylight.protocol.bgp.parser.BGPSessionListener;
import org.opendaylight.protocol.bgp.parser.impl.BGPMessageFactoryImpl;
-import org.opendaylight.protocol.bgp.parser.impl.SingletonProviderContext;
+import org.opendaylight.protocol.bgp.parser.spi.pojo.BGPExtensionConsumerContextImpl;
import org.opendaylight.protocol.bgp.rib.impl.BGPHandlerFactory;
import org.opendaylight.protocol.bgp.rib.impl.BGPSessionImpl;
import org.opendaylight.protocol.bgp.rib.impl.BGPSessionNegotiatorFactory;
final SessionNegotiatorFactory<Notification, BGPSessionImpl, BGPSessionListener> snf = new BGPSessionNegotiatorFactory(new HashedWheelTimer(), prefs);
final BGPSpeakerMock<Notification, BGPSessionImpl, BGPSessionListener> mock = new BGPSpeakerMock<>(snf,
- new BGPHandlerFactory(new BGPMessageFactoryImpl(SingletonProviderContext.getInstance().getMessageRegistry())),
+ new BGPHandlerFactory(new BGPMessageFactoryImpl(BGPExtensionConsumerContextImpl.getSingletonInstance().getMessageRegistry())),
new DefaultPromise<BGPSessionImpl>(GlobalEventExecutor.INSTANCE));
mock.createServer(new InetSocketAddress("127.0.0.2", 12345), f);
<nexusproxy>http://nexus.opendaylight.org/content</nexusproxy>
<slf4j.version>1.7.2</slf4j.version>
<surefire.version>2.15</surefire.version>
+ <osgi.version>5.0.0</osgi.version>
<yangtools.version>0.5.9-SNAPSHOT</yangtools.version>
<yang.binding.version>0.6.0-SNAPSHOT</yang.binding.version>