Search in sources :

Example 1 with CurrentAdapterSerializer

use of org.opendaylight.mdsal.binding.dom.adapter.CurrentAdapterSerializer in project bgpcep by opendaylight.

the class ParserToSalTest method setUp.

@Override
@Before
public void setUp() throws Exception {
    super.setUp();
    final String hexMessages = "/bgp_hex.txt";
    final List<byte[]> bgpMessages = HexDumpBGPFileParser.parseMessages(ParserToSalTest.class.getResourceAsStream(hexMessages));
    this.mock = new BGPMock(new EventBus("test"), ServiceLoader.load(BGPExtensionConsumerContext.class).findFirst().orElseThrow().getMessageRegistry(), Lists.newArrayList(fixMessages(bgpMessages)));
    doReturn(GlobalEventExecutor.INSTANCE.newSucceededFuture(null)).when(this.dispatcher).createReconnectingClient(any(InetSocketAddress.class), any(InetSocketAddress.class), anyInt(), any(KeyMapping.class));
    final CurrentAdapterSerializer serializer = mappingService.currentSerializer();
    this.baseact.startRIBExtensionProvider(this.ext1, serializer);
    this.lsact.startRIBExtensionProvider(this.ext2, serializer);
    this.codecsRegistry = new ConstantCodecsRegistry(serializer);
}
Also used : CurrentAdapterSerializer(org.opendaylight.mdsal.binding.dom.adapter.CurrentAdapterSerializer) BGPExtensionConsumerContext(org.opendaylight.protocol.bgp.parser.spi.BGPExtensionConsumerContext) InetSocketAddress(java.net.InetSocketAddress) KeyMapping(org.opendaylight.protocol.concepts.KeyMapping) BGPMock(org.opendaylight.protocol.bgp.rib.mock.BGPMock) EventBus(com.google.common.eventbus.EventBus) Before(org.junit.Before)

Example 2 with CurrentAdapterSerializer

use of org.opendaylight.mdsal.binding.dom.adapter.CurrentAdapterSerializer in project bgpcep by opendaylight.

the class AbstractRIBTestSetup method mockRib.

public void mockRib() throws Exception {
    final RIBExtensionProviderContext context = new SimpleRIBExtensionProviderContext();
    final List<BgpTableType> localTables = new ArrayList<>();
    localTables.add(new BgpTableTypeImpl(IPV4_AFI, SAFI));
    localTables.add(new BgpTableTypeImpl(IPV6_AFI, SAFI));
    final CurrentAdapterSerializer serializer = mappingService.currentSerializer();
    this.a1.startRIBExtensionProvider(context, serializer);
    mockedMethods();
    doReturn(mock(ClusterSingletonServiceRegistration.class)).when(this.clusterSingletonServiceProvider).registerClusterSingletonService(any(ClusterSingletonService.class));
    this.rib = new RIBImpl(this.tableRegistry, new RibId("test"), new AsNumber(Uint32.valueOf(5)), RIB_ID, context, this.dispatcher, new ConstantCodecsRegistry(serializer), this.dom, this.policies, localTables, Collections.singletonMap(KEY, BasePathSelectionModeFactory.createBestPathSelectionStrategy()));
}
Also used : BgpTableType(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.BgpTableType) CurrentAdapterSerializer(org.opendaylight.mdsal.binding.dom.adapter.CurrentAdapterSerializer) ArrayList(java.util.ArrayList) AsNumber(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber) SimpleRIBExtensionProviderContext(org.opendaylight.protocol.bgp.rib.spi.SimpleRIBExtensionProviderContext) RibId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.RibId) SimpleRIBExtensionProviderContext(org.opendaylight.protocol.bgp.rib.spi.SimpleRIBExtensionProviderContext) RIBExtensionProviderContext(org.opendaylight.protocol.bgp.rib.spi.RIBExtensionProviderContext) ClusterSingletonServiceRegistration(org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceRegistration) ClusterSingletonService(org.opendaylight.mdsal.singleton.common.api.ClusterSingletonService) BgpTableTypeImpl(org.opendaylight.protocol.bgp.parser.BgpTableTypeImpl)

Aggregations

CurrentAdapterSerializer (org.opendaylight.mdsal.binding.dom.adapter.CurrentAdapterSerializer)2 EventBus (com.google.common.eventbus.EventBus)1 InetSocketAddress (java.net.InetSocketAddress)1 ArrayList (java.util.ArrayList)1 Before (org.junit.Before)1 ClusterSingletonService (org.opendaylight.mdsal.singleton.common.api.ClusterSingletonService)1 ClusterSingletonServiceRegistration (org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceRegistration)1 BgpTableTypeImpl (org.opendaylight.protocol.bgp.parser.BgpTableTypeImpl)1 BGPExtensionConsumerContext (org.opendaylight.protocol.bgp.parser.spi.BGPExtensionConsumerContext)1 BGPMock (org.opendaylight.protocol.bgp.rib.mock.BGPMock)1 RIBExtensionProviderContext (org.opendaylight.protocol.bgp.rib.spi.RIBExtensionProviderContext)1 SimpleRIBExtensionProviderContext (org.opendaylight.protocol.bgp.rib.spi.SimpleRIBExtensionProviderContext)1 KeyMapping (org.opendaylight.protocol.concepts.KeyMapping)1 AsNumber (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber)1 BgpTableType (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.BgpTableType)1 RibId (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.RibId)1