use of org.opendaylight.protocol.bgp.parser.impl.message.BGPUpdateMessageParser in project bgpcep by opendaylight.
the class BGPActivator method registerMessageParsers.
private static void registerMessageParsers(final List<AutoCloseable> regs, final BGPExtensionProviderContext context) {
final BGPOpenMessageParser omp = new BGPOpenMessageParser(context.getParameterRegistry());
regs.add(context.registerMessageParser(BGPOpenMessageParser.TYPE, omp));
regs.add(context.registerMessageSerializer(Open.class, omp));
final BGPUpdateMessageParser ump = new BGPUpdateMessageParser(context.getAttributeRegistry());
regs.add(context.registerMessageParser(BGPUpdateMessageParser.TYPE, ump));
regs.add(context.registerMessageSerializer(Update.class, ump));
final BGPNotificationMessageParser nmp = new BGPNotificationMessageParser();
regs.add(context.registerMessageParser(BGPNotificationMessageParser.TYPE, nmp));
regs.add(context.registerMessageSerializer(Notify.class, nmp));
final BGPKeepAliveMessageParser kamp = new BGPKeepAliveMessageParser();
regs.add(context.registerMessageParser(BGPKeepAliveMessageParser.TYPE, kamp));
regs.add(context.registerMessageSerializer(Keepalive.class, kamp));
final AddressFamilyRegistry afiReg = context.getAddressFamilyRegistry();
final SubsequentAddressFamilyRegistry safiReg = context.getSubsequentAddressFamilyRegistry();
final BGPRouteRefreshMessageParser rrmp = new BGPRouteRefreshMessageParser(afiReg, safiReg);
regs.add(context.registerMessageParser(BGPRouteRefreshMessageParser.TYPE, rrmp));
regs.add(context.registerMessageSerializer(RouteRefresh.class, rrmp));
}
use of org.opendaylight.protocol.bgp.parser.impl.message.BGPUpdateMessageParser in project bgpcep by opendaylight.
the class BGPParserTest method setUp.
@BeforeClass
public static void setUp() throws Exception {
updateParser = new BGPUpdateMessageParser(ServiceLoaderBGPExtensionProviderContext.getSingletonInstance().getAttributeRegistry());
for (int i = 1; i <= COUNTER; i++) {
final String name = "/up" + i + ".bin";
try (final InputStream is = BGPParserTest.class.getResourceAsStream(name)) {
if (is == null) {
throw new IOException("Failed to get resource " + name);
}
final ByteArrayOutputStream bis = new ByteArrayOutputStream();
final byte[] data = new byte[MAX_SIZE];
int nRead = 0;
while ((nRead = is.read(data, 0, data.length)) != -1) {
bis.write(data, 0, nRead);
}
bis.flush();
inputBytes.add(bis.toByteArray());
is.close();
}
}
updatesWithMultiplePath = HexDumpBGPFileParser.parseMessages(BGPParserTest.class.getResourceAsStream(multiPathHexFile));
constraint = mock(PeerSpecificParserConstraint.class);
mpSupport = mock(MultiPathSupport.class);
Mockito.doReturn(Optional.of(mpSupport)).when(constraint).getPeerConstraint(Mockito.any());
Mockito.doReturn(true).when(mpSupport).isTableTypeSupported(Mockito.any());
}
use of org.opendaylight.protocol.bgp.parser.impl.message.BGPUpdateMessageParser in project bgpcep by opendaylight.
the class ParserTest method setUp.
@Before
public void setUp() throws Exception {
updateParser = new BGPUpdateMessageParser(ServiceLoaderBGPExtensionProviderContext.getSingletonInstance().getAttributeRegistry());
for (int i = 1; i <= COUNTER; i++) {
final String name = "/up" + i + ".bin";
try (final InputStream is = ParserTest.class.getResourceAsStream(name)) {
if (is == null) {
throw new IOException("Failed to get resource " + name);
}
final ByteArrayOutputStream bis = new ByteArrayOutputStream();
final byte[] data = new byte[MAX_SIZE];
int nRead;
while ((nRead = is.read(data, 0, data.length)) != -1) {
bis.write(data, 0, nRead);
}
bis.flush();
inputBytes.add(bis.toByteArray());
is.close();
}
}
}
Aggregations