+++ /dev/null
-/*
- * Copyright (c) 2015 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.controller.config.yang.netconf.mdsal.yang.library;
-
-import org.opendaylight.netconf.mdsal.yang.library.SchemaServiceToMdsalWriter;
-
-public class NetconfMdsalYanglibModule extends org.opendaylight.controller.config.yang.netconf.mdsal.yang.library.AbstractNetconfMdsalYanglibModule {
- public NetconfMdsalYanglibModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
- super(identifier, dependencyResolver);
- }
-
- public NetconfMdsalYanglibModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.controller.config.yang.netconf.mdsal.yang.library.NetconfMdsalYanglibModule oldModule, java.lang.AutoCloseable oldInstance) {
- super(identifier, dependencyResolver, oldModule, oldInstance);
- }
-
- @Override
- public void customValidation() {
- // add custom validation form module attributes here.
- }
-
- @Override
- public java.lang.AutoCloseable createInstance() {
- // TODO Implement also yang-library-change notfication
- final SchemaServiceToMdsalWriter schemaServiceToMdsalWriter =
- new SchemaServiceToMdsalWriter(getRootSchemaServiceDependency());
-
- getBindingAwareBrokerDependency().registerProvider(schemaServiceToMdsalWriter);
-
- return schemaServiceToMdsalWriter;
- }
-
-}
+++ /dev/null
-/*
- * Copyright (c) 2015 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
- */
-
-/*
-* Generated file
-*
-* Generated from: yang module name: netconf-mdsal-yang-library yang module local name: netconf-mdsal-yanglib
-* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
-* Generated at: Sun Jun 19 15:28:13 CEST 2016
-*
-* Do not modify this file unless it is present under src/main directory
-*/
-package org.opendaylight.controller.config.yang.netconf.mdsal.yang.library;
-public class NetconfMdsalYanglibModuleFactory extends org.opendaylight.controller.config.yang.netconf.mdsal.yang.library.AbstractNetconfMdsalYanglibModuleFactory {
-
-}
* Listens for updates on global schema context, transforms context to ietf-yang-library:modules-state and
* writes this state to operational data store
*/
-public class SchemaServiceToMdsalWriter implements SchemaContextListener, BindingAwareProvider, AutoCloseable {
+public class SchemaServiceToMdsalWriter implements SchemaContextListener, AutoCloseable {
private static final Logger LOG = LoggerFactory.getLogger(SchemaServiceToMdsalWriter.class);
private final SchemaService schemaService;
private final AtomicInteger moduleSetId;
- private DataBroker dataBroker;
+ private final DataBroker dataBroker;
- public SchemaServiceToMdsalWriter(final SchemaService schemaService) {
+ public SchemaServiceToMdsalWriter(final SchemaService schemaService,
+ final DataBroker dataBroker) {
this.schemaService = schemaService;
+ this.dataBroker = dataBroker;
this.moduleSetId = new AtomicInteger(0);
}
// TODO Delete modules-state from operational data store
}
- @Override
- public void onSessionInitiated(final BindingAwareBroker.ProviderContext providerContext) {
- dataBroker = providerContext.getSALService(DataBroker.class);
+ /**
+ * Invoke by blueprint
+ */
+ public void start() {
schemaService.registerSchemaContextListener(this);
}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2016 Inocybe Technologies 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
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
+ odl:use-default-for-reference-types="true">
+
+ <reference id="dataBroker"
+ interface="org.opendaylight.controller.md.sal.binding.api.DataBroker"
+ odl:type="default"/>
+ <reference id="schemaService"
+ interface="org.opendaylight.controller.sal.core.api.model.SchemaService" />
+
+ <bean id="schemaServiceToMdsalWriter"
+ class="org.opendaylight.netconf.mdsal.yang.library.SchemaServiceToMdsalWriter"
+ init-method="start"
+ destroy-method="close">
+ <argument ref="schemaService" />
+ <argument ref="dataBroker" />
+ </bean>
+
+</blueprint>
+++ /dev/null
-module netconf-mdsal-yang-library {
- yang-version 1;
- namespace "urn:opendaylight:params:xml:ns:yang:controller:netconf:mdsal:yang:library";
- prefix "nmyanglib";
-
- import opendaylight-md-sal-dom { prefix md-sal-dom; revision-date 2013-10-28; }
- import opendaylight-md-sal-binding {prefix md-sal-binding; revision-date 2013-10-28;}
- import config { prefix config; revision-date 2013-04-05; }
-
- organization "Cisco Systems, Inc.";
-
- description
- "This module contains the base YANG definitions for
- MDSAL netconf yang module library implementation";
-
- revision "2016-06-17" {
- description
- "Initial revision.";
- }
-
- identity netconf-mdsal-yanglib {
- base config:module-type;
- }
-
- augment "/config:modules/config:module/config:configuration" {
- case netconf-mdsal-yanglib {
- when "/config:modules/config:module/config:type = 'netconf-mdsal-yanglib'";
-
- container root-schema-service {
- uses config:service-ref {
- refine type {
- mandatory false;
- config:required-identity md-sal-dom:schema-service;
- }
- }
- }
-
- container binding-aware-broker {
- uses config:service-ref {
- refine type {
- mandatory true;
- config:required-identity md-sal-binding:binding-broker-osgi-registry;
- }
- }
- }
- }
- }
-}
\ No newline at end of file
return null;
}
});
- schemaServiceToMdsalWriter = new SchemaServiceToMdsalWriter(schemaService);
+ schemaServiceToMdsalWriter = new SchemaServiceToMdsalWriter(schemaService, dataBroker);
}
@Test
public void testOnGlobalContextUpdated() {
- schemaServiceToMdsalWriter.onSessionInitiated(context);
+ schemaServiceToMdsalWriter.start();
schemaServiceToMdsalWriter.onGlobalContextUpdated(getSchema());
verify(writeTransaction).put(eq(LogicalDatastoreType.OPERATIONAL), eq(MODULES_STATE_INSTANCE_IDENTIFIER), eq(createTestModuleState()));
<classifier>config</classifier>
<type>xml</type>
</dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>yanglib-config</artifactId>
- <version>${project.version}</version>
- <classifier>config</classifier>
- <type>xml</type>
- </dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netconf-client</artifactId>
<name>netconf-mdsal-notification-mapper</name>
</module>
- <module>
- <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:netconf:mdsal:yang:library">prefix:netconf-mdsal-yanglib</type>
- <name>netconf-mdsal-yanglib</name>
- <binding-aware-broker xmlns="urn:opendaylight:params:xml:ns:yang:controller:netconf:mdsal:yang:library">
- <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">prefix:binding-broker-osgi-registry</type>
- <name>binding-osgi-broker</name>
- </binding-aware-broker>
- <root-schema-service xmlns="urn:opendaylight:params:xml:ns:yang:controller:netconf:mdsal:yang:library">
- <type xmlns:dom="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom">dom:schema-service</type>
- <name>yang-schema-service</name>
- </root-schema-service>
- </module>
-
-
-
<!--TCP endpoint for MD-SAL netconf server -->
<!--<module>-->
<!--<type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:netconf:northbound:tcp">prefix:netconf-northbound-tcp</type>-->
<!--<name>netconf-mdsal-server-dispatcher</name>-->
<!--</dispatcher>-->
<!--</module>-->
-
</modules>
<services xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
<capability>urn:opendaylight:params:xml:ns:yang:controller:config:netconf:northbound:impl?module=netconf-northbound-impl&revision=2015-01-12</capability>
<capability>urn:opendaylight:params:xml:ns:yang:controller:threadpool:impl:scheduled?module=threadpool-impl-scheduled&revision=2013-12-01</capability>
<capability>urn:opendaylight:params:xml:ns:yang:controller:netconf:mdsal:notification?module=netconf-mdsal-notification&revision=2015-08-03</capability>
- <capability>urn:opendaylight:params:xml:ns:yang:controller:netconf:mdsal:yang:library?module=netconf-mdsal-yang-library&revision=2016-06-17</capability>
</required-capabilities>
</snapshot>