Search in sources :

Example 1 with BindingNormalizedNodeCodecRegistry

use of org.opendaylight.mdsal.binding.dom.codec.impl.BindingNormalizedNodeCodecRegistry in project controller by opendaylight.

the class BindingNormalizedCodecTest method setupWithSchema.

@Override
protected void setupWithSchema(final SchemaContext schemaContext) {
    this.context = schemaContext;
    final DataObjectSerializerGenerator streamWriter = StreamWriterGenerator.create(JavassistUtils.forClassPool(ClassPool.getDefault()));
    final BindingNormalizedNodeCodecRegistry registry = new BindingNormalizedNodeCodecRegistry(streamWriter);
    this.codec = new BindingToNormalizedNodeCodec(GeneratedClassLoadingStrategy.getTCCLClassLoadingStrategy(), registry, true);
}
Also used : BindingNormalizedNodeCodecRegistry(org.opendaylight.mdsal.binding.dom.codec.impl.BindingNormalizedNodeCodecRegistry) DataObjectSerializerGenerator(org.opendaylight.mdsal.binding.dom.codec.gen.impl.DataObjectSerializerGenerator)

Example 2 with BindingNormalizedNodeCodecRegistry

use of org.opendaylight.mdsal.binding.dom.codec.impl.BindingNormalizedNodeCodecRegistry in project bgpcep by opendaylight.

the class AbstractAddPathTest method setUp.

@Before
public void setUp() throws Exception {
    super.setUp();
    this.ribActivator = new RIBActivator();
    this.ribExtension = new SimpleRIBExtensionProviderContext();
    this.ribActivator.startRIBExtensionProvider(this.ribExtension);
    this.bgpActivator = new BGPActivator();
    this.inetActivator = new org.opendaylight.protocol.bgp.inet.BGPActivator();
    this.context = new SimpleBGPExtensionProviderContext();
    this.bgpActivator.start(this.context);
    this.inetActivator.start(this.context);
    this.mappingService = new BindingToNormalizedNodeCodec(GeneratedClassLoadingStrategy.getTCCLClassLoadingStrategy(), new BindingNormalizedNodeCodecRegistry(StreamWriterGenerator.create(JavassistUtils.forClassPool(ClassPool.getDefault()))));
    final ModuleInfoBackedContext moduleInfoBackedContext = ModuleInfoBackedContext.create();
    moduleInfoBackedContext.registerModuleInfo(BindingReflections.getModuleInfo(BgpParameters.class));
    moduleInfoBackedContext.registerModuleInfo(BindingReflections.getModuleInfo(MultiprotocolCapability.class));
    moduleInfoBackedContext.registerModuleInfo(BindingReflections.getModuleInfo(DestinationIpv4Case.class));
    moduleInfoBackedContext.registerModuleInfo(BindingReflections.getModuleInfo(AdvertizedRoutes.class));
    moduleInfoBackedContext.registerModuleInfo(BindingReflections.getModuleInfo(BgpRib.class));
    moduleInfoBackedContext.registerModuleInfo(BindingReflections.getModuleInfo(Attributes1.class));
    moduleInfoBackedContext.registerModuleInfo(BindingReflections.getModuleInfo(MpReachNlri.class));
    this.mappingService.onGlobalContextUpdated(moduleInfoBackedContext.tryToCreateSchemaContext().get());
    this.schemaContext = moduleInfoBackedContext.getSchemaContext();
    if (!Epoll.isAvailable()) {
        this.worker = new NioEventLoopGroup();
        this.boss = new NioEventLoopGroup();
    }
    this.serverRegistry = new StrictBGPPeerRegistry();
    this.serverDispatcher = new BGPDispatcherImpl(this.context.getMessageRegistry(), this.boss, this.worker, this.serverRegistry);
    doReturn(Mockito.mock(ClusterSingletonServiceRegistration.class)).when(this.clusterSingletonServiceProvider).registerClusterSingletonService(any(ClusterSingletonService.class));
    this.codecsRegistry = CodecsRegistryImpl.create(this.mappingService.getCodecFactory(), this.ribExtension.getClassLoadingStrategy());
}
Also used : RIBActivator(org.opendaylight.protocol.bgp.inet.RIBActivator) BGPActivator(org.opendaylight.protocol.bgp.parser.impl.BGPActivator) AdvertizedRoutes(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.update.attributes.mp.reach.nlri.AdvertizedRoutes) BindingToNormalizedNodeCodec(org.opendaylight.mdsal.binding.dom.adapter.BindingToNormalizedNodeCodec) BindingNormalizedNodeCodecRegistry(org.opendaylight.mdsal.binding.dom.codec.impl.BindingNormalizedNodeCodecRegistry) Attributes1(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.Attributes1) BgpParameters(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.open.message.BgpParameters) ModuleInfoBackedContext(org.opendaylight.mdsal.binding.generator.impl.ModuleInfoBackedContext) SimpleRIBExtensionProviderContext(org.opendaylight.protocol.bgp.rib.spi.SimpleRIBExtensionProviderContext) SimpleBGPExtensionProviderContext(org.opendaylight.protocol.bgp.parser.spi.pojo.SimpleBGPExtensionProviderContext) MultiprotocolCapability(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.mp.capabilities.MultiprotocolCapability) ClusterSingletonServiceRegistration(org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceRegistration) ClusterSingletonService(org.opendaylight.mdsal.singleton.common.api.ClusterSingletonService) MpReachNlri(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.update.attributes.MpReachNlri) NioEventLoopGroup(io.netty.channel.nio.NioEventLoopGroup) DestinationIpv4Case(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev171207.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationIpv4Case) BgpRib(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.BgpRib) Before(org.junit.Before)

Example 3 with BindingNormalizedNodeCodecRegistry

use of org.opendaylight.mdsal.binding.dom.codec.impl.BindingNormalizedNodeCodecRegistry in project bgpcep by opendaylight.

the class AbstractRIBTestSetup method createCodecFactory.

private static BindingCodecTreeFactory createCodecFactory(final ClassLoadingStrategy str, final SchemaContext ctx) {
    final DataObjectSerializerGenerator generator = StreamWriterGenerator.create(JavassistUtils.forClassPool(ClassPool.getDefault()));
    final BindingNormalizedNodeCodecRegistry codec = new BindingNormalizedNodeCodecRegistry(generator);
    codec.onBindingRuntimeContextUpdated(BindingRuntimeContext.create(str, ctx));
    return codec;
}
Also used : BindingNormalizedNodeCodecRegistry(org.opendaylight.mdsal.binding.dom.codec.impl.BindingNormalizedNodeCodecRegistry) DataObjectSerializerGenerator(org.opendaylight.mdsal.binding.dom.codec.gen.impl.DataObjectSerializerGenerator)

Example 4 with BindingNormalizedNodeCodecRegistry

use of org.opendaylight.mdsal.binding.dom.codec.impl.BindingNormalizedNodeCodecRegistry in project bgpcep by opendaylight.

the class AbstractRIBSupportTest method setUp.

@Before
public void setUp() throws Exception {
    initMocks(this);
    doAnswer(invocation -> {
        final Object[] args = invocation.getArguments();
        AbstractRIBSupportTest.this.insertedRoutes.add(AbstractRIBSupportTest.this.mappingService.fromNormalizedNode((YangInstanceIdentifier) args[1], (NormalizedNode<?, ?>) args[2]));
        return args[1];
    }).when(this.tx).put(any(LogicalDatastoreType.class), any(YangInstanceIdentifier.class), any(NormalizedNode.class));
    doAnswer(invocation -> {
        final Object[] args = invocation.getArguments();
        AbstractRIBSupportTest.this.deletedRoutes.add(AbstractRIBSupportTest.this.mappingService.fromYangInstanceIdentifier((YangInstanceIdentifier) args[1]));
        return args[1];
    }).when(this.tx).delete(any(LogicalDatastoreType.class), any(YangInstanceIdentifier.class));
    this.deletedRoutes = new ArrayList<>();
    this.insertedRoutes = new ArrayList<>();
    this.mappingService = new BindingToNormalizedNodeCodec(GeneratedClassLoadingStrategy.getTCCLClassLoadingStrategy(), new BindingNormalizedNodeCodecRegistry(StreamWriterGenerator.create(JavassistUtils.forClassPool(ClassPool.getDefault()))));
    this.moduleInfoBackedContext = ModuleInfoBackedContext.create();
}
Also used : BindingToNormalizedNodeCodec(org.opendaylight.mdsal.binding.dom.adapter.BindingToNormalizedNodeCodec) BindingNormalizedNodeCodecRegistry(org.opendaylight.mdsal.binding.dom.codec.impl.BindingNormalizedNodeCodecRegistry) DataObject(org.opendaylight.yangtools.yang.binding.DataObject) LogicalDatastoreType(org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType) NormalizedNode(org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode) YangInstanceIdentifier(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier) Before(org.junit.Before)

Example 5 with BindingNormalizedNodeCodecRegistry

use of org.opendaylight.mdsal.binding.dom.codec.impl.BindingNormalizedNodeCodecRegistry in project controller by opendaylight.

the class BindingTestContext method startBindingToDomMappingService.

public void startBindingToDomMappingService() {
    checkState(this.classPool != null, "ClassPool needs to be present");
    final DataObjectSerializerGenerator generator = StreamWriterGenerator.create(JavassistUtils.forClassPool(this.classPool));
    final BindingNormalizedNodeCodecRegistry codecRegistry = new BindingNormalizedNodeCodecRegistry(generator);
    final GeneratedClassLoadingStrategy loading = GeneratedClassLoadingStrategy.getTCCLClassLoadingStrategy();
    this.codec = new BindingToNormalizedNodeCodec(loading, codecRegistry);
    this.mockSchemaService.registerSchemaContextListener(this.codec);
}
Also used : GeneratedClassLoadingStrategy(org.opendaylight.mdsal.binding.generator.impl.GeneratedClassLoadingStrategy) BindingToNormalizedNodeCodec(org.opendaylight.controller.md.sal.binding.impl.BindingToNormalizedNodeCodec) BindingNormalizedNodeCodecRegistry(org.opendaylight.mdsal.binding.dom.codec.impl.BindingNormalizedNodeCodecRegistry) DataObjectSerializerGenerator(org.opendaylight.mdsal.binding.dom.codec.gen.impl.DataObjectSerializerGenerator)

Aggregations

BindingNormalizedNodeCodecRegistry (org.opendaylight.mdsal.binding.dom.codec.impl.BindingNormalizedNodeCodecRegistry)6 Before (org.junit.Before)3 BindingToNormalizedNodeCodec (org.opendaylight.mdsal.binding.dom.adapter.BindingToNormalizedNodeCodec)3 DataObjectSerializerGenerator (org.opendaylight.mdsal.binding.dom.codec.gen.impl.DataObjectSerializerGenerator)3 NioEventLoopGroup (io.netty.channel.nio.NioEventLoopGroup)2 ModuleInfoBackedContext (org.opendaylight.mdsal.binding.generator.impl.ModuleInfoBackedContext)2 ClusterSingletonService (org.opendaylight.mdsal.singleton.common.api.ClusterSingletonService)2 RIBActivator (org.opendaylight.protocol.bgp.inet.RIBActivator)2 BGPActivator (org.opendaylight.protocol.bgp.parser.impl.BGPActivator)2 SimpleBGPExtensionProviderContext (org.opendaylight.protocol.bgp.parser.spi.pojo.SimpleBGPExtensionProviderContext)2 SimpleRIBExtensionProviderContext (org.opendaylight.protocol.bgp.rib.spi.SimpleRIBExtensionProviderContext)2 DestinationIpv4Case (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev171207.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationIpv4Case)2 BgpParameters (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.open.message.BgpParameters)2 MultiprotocolCapability (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.mp.capabilities.MultiprotocolCapability)2 AdvertizedRoutes (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.update.attributes.mp.reach.nlri.AdvertizedRoutes)2 InetSocketAddress (java.net.InetSocketAddress)1 BindingToNormalizedNodeCodec (org.opendaylight.controller.md.sal.binding.impl.BindingToNormalizedNodeCodec)1 LogicalDatastoreType (org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType)1 DOMDataWriteTransaction (org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction)1 GeneratedClassLoadingStrategy (org.opendaylight.mdsal.binding.generator.impl.GeneratedClassLoadingStrategy)1