--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>opendaylight-startup-archetype</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <packaging>maven-archetype</packaging>
+
+ <name>${project.artifactId}</name>
+
+ <build>
+ <extensions>
+ <extension>
+ <groupId>org.apache.maven.archetype</groupId>
+ <artifactId>archetype-packaging</artifactId>
+ <version>2.2</version>
+ </extension>
+ </extensions>
+
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <artifactId>maven-archetype-plugin</artifactId>
+ <version>2.2</version>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <configuration>
+ <failsOnError>false</failsOnError>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<archetype-descriptor xsi:schemaLocation="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0 http://maven.apache.org/xsd/archetype-descriptor-1.0.0.xsd" name="example-aggregator"
+ xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <requiredProperties>
+ <requiredProperty key="classPrefix" >
+ <defaultValue>
+ ${artifactId.substring(0,1).toUpperCase()}${artifactId.substring(1)}
+ </defaultValue>
+ </requiredProperty>
+ <requiredProperty key="copyright" />
+ </requiredProperties>
+ <fileSets>
+
+ <!-- aggregator -->
+ <fileSet encoding="UTF-8">
+ <directory></directory>
+ <includes>
+ <include>.gitignore</include>
+ </includes>
+ </fileSet>
+ <fileSet filtered="true" encoding="UTF-8">
+ <directory></directory>
+ <includes>
+ <include>pom.xml</include>
+ </includes>
+ </fileSet>
+
+ <!-- karaf distro -->
+ <fileSet filtered="true" encoding="UTF-8">
+ <directory>__artifactId__-karaf</directory>
+ <includes>
+ <include>pom.xml</include>
+ </includes>
+ </fileSet>
+
+ <!-- features -->
+
+ <fileSet filtered="true" encoding="UTF-8">
+ <directory>__artifactId__-features</directory>
+ <includes>
+ <include>pom.xml</include>
+ </includes>
+ </fileSet>
+ <fileSet filtered="true" encoding="UTF-8">
+ <directory>__artifactId__-features/src/main/features</directory>
+ <includes>
+ <include>**/*.xml</include>
+ </includes>
+ </fileSet>
+
+ <!-- impl -->
+
+ <fileSet filtered="true" encoding="UTF-8">
+ <directory>__artifactId__-impl</directory>
+ <includes>
+ <include>pom.xml</include>
+ </includes>
+ </fileSet>
+ <fileSet filtered="true" encoding="UTF-8">
+ <directory>__artifactId__-impl/src/main/java</directory>
+ <includes>
+ <include>**/*.java</include>
+ </includes>
+ </fileSet>
+ <fileSet filtered="true" encoding="UTF-8">
+ <directory>__artifactId__-impl/src/main/config</directory>
+ <includes>
+ <include>**/*.xml</include>
+ </includes>
+ </fileSet>
+ <fileSet filtered="true" encoding="UTF-8">
+ <directory>__artifactId__-impl/src/main/yang</directory>
+ <includes>
+ <include>**/*.yang</include>
+ </includes>
+ </fileSet>
+
+ <!-- api -->
+
+ <fileSet filtered="true" encoding="UTF-8">
+ <directory>__artifactId__-api</directory>
+ <includes>
+ <include>pom.xml</include>
+ </includes>
+ </fileSet>
+ <fileSet filtered="true" encoding="UTF-8">
+ <directory>__artifactId__-api/src/main/yang</directory>
+ <includes>
+ <include>**/*.yang</include>
+ </includes>
+ </fileSet>
+
+ <!-- artifacts -->
+ <fileSet filtered="true" encoding="UTF-8">
+ <directory>__artifactId__-artifacts</directory>
+ <includes>
+ <include>pom.xml</include>
+ </includes>
+ </fileSet>
+ </fileSets>
+</archetype-descriptor>
--- /dev/null
+*.class
+**/target
+bin/
+dist
+**/logs
+*~
+target
+target-ide
+.classpath
+.project
+.settings
+.idea
+xtend-gen
+yang-gen-config
+yang-gen-sal
+classes
+.DS_STORE
+.metadata
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+${copyright} 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
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>binding-parent</artifactId>
+ <version>0.7.0-SNAPSHOT</version>
+ <relativePath/>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>${groupId}</groupId>
+ <artifactId>${artifactId}-api</artifactId>
+ <version>${version}</version>
+ <packaging>bundle</packaging>
+
+</project>
--- /dev/null
+module ${artifactId} {
+ yang-version 1;
+ namespace "urn:opendaylight:params:xml:ns:yang:example";
+ prefix "${artifactId}";
+
+ revision "2015-01-05" {
+ description "Initial revision of ${artifactId} model";
+ }
+}
--- /dev/null
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+${copyright} 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
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>${groupId}</groupId>
+ <artifactId>${artifactId}-artifacts</artifactId>
+ <version>${version}</version>
+ <packaging>pom</packaging>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>${symbol_dollar}{project.groupId}</groupId>
+ <artifactId>${artifactId}-api</artifactId>
+ <version>${symbol_dollar}{project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${symbol_dollar}{project.groupId}</groupId>
+ <artifactId>${artifactId}-impl</artifactId>
+ <version>${symbol_dollar}{project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${symbol_dollar}{project.groupId}</groupId>
+ <artifactId>${artifactId}-features</artifactId>
+ <version>${symbol_dollar}{project.version}</version>
+ <classifier>features</classifier>
+ <type>xml</type>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+</project>
--- /dev/null
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+${copyright} 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 INTERNAL
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <groupId>org.opendaylight.odlparent</groupId>
+ <artifactId>features-parent</artifactId>
+ <version>1.5.0-SNAPSHOT</version>
+ </parent>
+ <groupId>${groupId}</groupId>
+ <artifactId>${artifactId}-features</artifactId>
+ <version>${version}</version>
+ <name>${project.artifactId}</name>
+ <modelVersion>4.0.0</modelVersion>
+ <prerequisites>
+ <maven>3.1.1</maven>
+ </prerequisites>
+ <properties>
+ <mdsal.version>1.2.0-SNAPSHOT</mdsal.version>
+ <yangtools.version>0.7.0-SNAPSHOT</yangtools.version>
+ </properties>
+ <dependencyManagement>
+ <dependencies>
+ <!-- project specific dependencies -->
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>mdsal-artifacts</artifactId>
+ <version>${mdsal.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>${symbol_dollar}{groupId}</groupId>
+ <artifactId>${artifactId}-impl</artifactId>
+ <version>${symbol_dollar}{project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${symbol_dollar}{groupId}</groupId>
+ <artifactId>${artifactId}-api</artifactId>
+ <version>${symbol_dollar}{project.version}</version>
+ </dependency>
+ </dependencies>
+</project>
--- /dev/null
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- vi: set et smarttab sw=4 tabstop=4: -->
+<!--
+Necessary TODO: Put your copyright statement here
+
+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
+-->
+<features name="odl-${artifactId}-${symbol_dollar}{project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.2.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.2.0 http://karaf.apache.org/xmlns/features/v1.2.0">
+ <repository>mvn:org.opendaylight.yangtools/features-yangtools/${symbol_dollar}{yangtools.version}/xml/features</repository>
+ <repository>mvn:org.opendaylight.controller/features-mdsal/${symbol_dollar}{mdsal.version}/xml/features</repository>
+ <repository>mvn:org.opendaylight.controller/features-restconf/${symbol_dollar}{mdsal.version}/xml/features</repository>
+ <feature name='odl-${artifactId}-api' version='${symbol_dollar}{project.version}' description='OpenDaylight :: ${artifactId} :: api '>
+ <feature version='${symbol_dollar}{yangtools.version}'>odl-yangtools-models</feature>
+ <bundle>mvn:${groupId}/${artifactId}-api/${symbol_dollar}{project.version}</bundle>
+ </feature>
+ <feature name='odl-${artifactId}-impl' version='${symbol_dollar}{project.version}' description='OpenDaylight :: ${artifactId} :: impl '>
+ <feature version='${symbol_dollar}{mdsal.version}'>odl-mdsal-broker</feature>
+ <feature version='${symbol_dollar}{project.version}'>odl-${artifactId}-api</feature>
+ <bundle>mvn:${groupId}/${artifactId}-impl/${symbol_dollar}{project.version}</bundle>
+ <configfile finalname="${artifactId}-impl-default-config.xml">mvn:${groupId}/${artifactId}-impl/${symbol_dollar}{project.version}/xml/config</configfile>
+ </feature>
+ <feature name='odl-${artifactId}-impl-rest' version='${symbol_dollar}{project.version}' description='OpenDaylight :: ${artifactId} :: impl :: REST '>
+ <feature version="${symbol_dollar}{project.version}">odl-${artifactId}-impl</feature>
+ <feature version="${symbol_dollar}{mdsal.version}">odl-restconf</feature>
+ </feature>
+ <feature name='odl-${artifactId}-impl-ui' version='${symbol_dollar}{project.version}' description='OpenDaylight :: ${artifactId} :: impl :: UI'>
+ <feature version="${symbol_dollar}{project.version}">odl-${artifactId}-impl-rest</feature>
+ <feature version="${symbol_dollar}{mdsal.version}">odl-mdsal-apidocs</feature>
+ <feature version="${symbol_dollar}{mdsal.version}">odl-mdsal-xsql</feature>
+ </feature>
+
+</features>
--- /dev/null
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- vi: set et smarttab sw=4 tabstop=4: --><!--
+Copyright (c) 2014 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
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <parent>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>config-parent</artifactId>
+ <version>0.3.0-SNAPSHOT</version>
+ <relativePath/>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>${groupId}</groupId>
+ <artifactId>${artifactId}-impl</artifactId>
+ <version>${version}</version>
+ <packaging>bundle</packaging>
+ <dependencies>
+ <dependency>
+ <groupId>${symbol_dollar}{groupId}</groupId>
+ <artifactId>${artifactId}-api</artifactId>
+ <version>${symbol_dollar}{project.version}</version>
+ </dependency>
+ </dependencies>
+
+</project>
--- /dev/null
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- vi: set et smarttab sw=4 tabstop=4: -->
+<!--
+${copyright} 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
+-->
+<snapshot>
+ <required-capabilities>
+ </required-capabilities>
+ <configuration>
+
+ <data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
+ <modules xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
+ <module>
+ <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:${artifactId}:impl">prefix:${artifactId}-impl</type>
+ <name>${artifactId}-default</name>
+ <broker>
+ <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-broker-osgi-registry</type>
+ <name>binding-osgi-broker</name>
+ </broker>
+ </module>
+ </modules>
+ </data>
+ </configuration>
+</snapshot>
--- /dev/null
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+/*
+ * ${copyright} 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 ${package};
+
+import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
+import org.opendaylight.controller.sal.binding.api.BindingAwareProvider;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class ${classPrefix}Provider implements BindingAwareProvider, AutoCloseable {
+
+ private static final Logger LOG = LoggerFactory.getLogger(${classPrefix}Provider.class);
+
+ @Override
+ public void onSessionInitiated(ProviderContext session) {
+ LOG.info("${classPrefix}Provider Session Initiated");
+ }
+
+ @Override
+ public void close() throws Exception {
+ LOG.info("${classPrefix}Provider Closed");
+ }
+
+}
--- /dev/null
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+/*
+ * ${copyright} 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.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.${artifactId}.impl.rev141210;
+
+import ${package}.${classPrefix}Provider;
+
+public class ${classPrefix}ImplModule extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.${artifactId}.impl.rev141210.Abstract${classPrefix}ImplModule {
+ public ${classPrefix}ImplModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+ super(identifier, dependencyResolver);
+ }
+
+ public ${classPrefix}ImplModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.${artifactId}.impl.rev141210.${classPrefix}ImplModule 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() {
+ ${classPrefix}Provider provider = new ${classPrefix}Provider();
+ getBrokerDependency().registerProvider(provider);
+ return provider;
+ }
+
+}
--- /dev/null
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+/*
+ * ${copyright} 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: ${artifactId} yang module local name: ${artifactId}
+* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+* Generated at: Fri Jan 02 13:49:24 CST 2015
+*
+* Do not modify this file unless it is present under src/main directory
+*/
+package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.${artifactId}.impl.rev141210;
+public class ${classPrefix}ImplModuleFactory extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.${artifactId}.impl.rev141210.Abstract${classPrefix}ImplModuleFactory {
+
+}
--- /dev/null
+module ${artifactId}-impl {
+ yang-version 1;
+ namespace "urn:opendaylight:params:xml:ns:yang:${artifactId}:impl";
+ prefix "${artifactId}-impl";
+
+ import config { prefix config; revision-date 2013-04-05; }
+ import opendaylight-md-sal-binding { prefix md-sal-binding; revision-date 2013-10-28;}
+
+ description
+ "Service definition for ${artifactId} project";
+
+ revision "2014-12-10" {
+ description
+ "Initial revision";
+ }
+
+ identity ${artifactId}-impl {
+ base config:module-type;
+ config:java-name-prefix ${classPrefix}Impl;
+ }
+
+ augment "/config:modules/config:module/config:configuration" {
+ case ${artifactId}-impl {
+ when "/config:modules/config:module/config:type = '${artifactId}-impl'";
+ container broker {
+ uses config:service-ref {
+ refine type {
+ mandatory true;
+ config:required-identity md-sal-binding:binding-broker-osgi-registry;
+ }
+ }
+ }
+ }
+ }
+}
--- /dev/null
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- TODO: Put your copyright here:
+<your copyright> 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 INTERNAL
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>karaf-parent</artifactId>
+ <version>1.5.0-SNAPSHOT</version>
+ <relativePath/>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>${groupId}</groupId>
+ <artifactId>${artifactId}</artifactId>
+ <version>${version}</version>
+ <name>${project.artifactId}</name>
+ <prerequisites>
+ <maven>3.1.1</maven>
+ </prerequisites>
+ <properties>
+ <karaf.localFeature>odl-${artifactId}-impl-ui</karaf.localFeature>
+ </properties>
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>${symbol_dollar}{project.groupId}</groupId>
+ <artifactId>${artifactId}-artifacts</artifactId>
+ <version>${symbol_dollar}{project.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+ <dependencies>
+ <dependency>
+ <!-- scope is compile so all features (there is only one) are installed
+ into startup.properties and the feature repo itself is not installed -->
+ <groupId>org.apache.karaf.features</groupId>
+ <artifactId>framework</artifactId>
+ <type>kar</type>
+ </dependency>
+
+ <dependency>
+ <groupId>${symbol_dollar}{project.groupId}</groupId>
+ <artifactId>${artifactId}-features</artifactId>
+ <classifier>features</classifier>
+ <type>xml</type>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- TODO: Put your copyright here:
+<your copyright> 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 INTERNAL
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <groupId>${groupId}</groupId>
+ <artifactId>${artifactId}-aggregator</artifactId>
+ <version>${version}</version>
+ <name>${project.artifactId}</name>
+ <packaging>pom</packaging>
+ <modelVersion>4.0.0</modelVersion>
+ <prerequisites>
+ <maven>3.1.1</maven>
+ </prerequisites>
+ <modules>
+ <module>${artifactId}-api</module>
+ <module>${artifactId}-impl</module>
+ <module>${artifactId}-karaf</module>
+ <module>${artifactId}-features</module>
+ <module>${artifactId}-artifacts</module>
+ </modules>
+</project>
--- /dev/null
+#Mon Jan 12 13:10:37 CST 2015
+package=it.pkg
+version=0.1-SNAPSHOT
+groupId=archetype.it
+artifactId=basic
+classPrefix=Basic
+copyright=Copyright (c) 2013 Cisco Systems, Inc.
<module>opendaylight-configfile-archetype</module>
<module>opendaylight-karaf-distro-archetype</module>
<module>opendaylight-karaf-features</module>
+ <module>opendaylight-startup</module>
</modules>
</project>
<includeTestSourceDirectory>true</includeTestSourceDirectory>
<sourceDirectory>${project.basedir}</sourceDirectory>
<includes>**\/*.java,**\/*.xml,**\/*.ini,**\/*.sh,**\/*.bat</includes>
- <excludes>**\/target\/,**\/bin\/,**\/target-ide\/,**\/${jmxGeneratorPath}\/,**\/${salGeneratorPath}\/,**\/protobuff\/</excludes>
+ <excludes>**\/target\/,**\/bin\/,**\/target-ide\/,**\/${jmxGeneratorPath}\/,**\/${salGeneratorPath}\/,**\/protobuff\/,**\/src\/main\/resources\/archetype-resources\/**\/*.java</excludes>
</configuration>
<dependencies>
<dependency>
<include>**</include>
</includes>
</fileset>
+ <fileset>
+ <directory>${salGeneratorPath}</directory>
+ <includes>
+ <include>**</include>
+ </includes>
+ </fileset>
</filesets>
</configuration>
</plugin>
-return org.opendaylight.controller.config.yang.test.util.NetconfTestImplModuleUtil.registerRuntimeBeans(this);
+ return org.opendaylight.controller.config.yang.test.util.NetconfTestImplModuleUtil.registerRuntimeBeans(this);
*/
package org.opendaylight.controller.sal.compatibility;
-import java.util.Collection;
-import java.util.Collections;
-
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ConsumerContext;
import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
import org.opendaylight.controller.sal.binding.api.BindingAwareProvider;
import org.opendaylight.controller.sal.binding.api.NotificationService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.topology.discovery.rev130819.FlowTopologyDiscoveryService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.PacketProcessingService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.OpendaylightPortStatisticsService;
-import org.opendaylight.yangtools.yang.binding.RpcService;
import com.google.common.base.Preconditions;
this.activator = Preconditions.checkNotNull(cmpAct);
}
- @Override
- public Collection<? extends ProviderFunctionality> getFunctionality() {
- return Collections.emptyList();
- }
-
- @Override
- public Collection<? extends RpcService> getImplementations() {
- return Collections.emptyList();
- }
-
- @Override
- public void onSessionInitialized(final ConsumerContext session) {
- // No-op
- }
-
@Override
public void onSessionInitiated(final ProviderContext session) {
final NotificationService subscribe = session.getSALService(NotificationService.class);
*/
package org.opendaylight.controller.sal.binding.api;
-import java.util.Collection;
-import java.util.Collections;
-
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ConsumerContext;
import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
-import org.opendaylight.yangtools.yang.binding.RpcService;
import org.osgi.framework.BundleContext;
@Deprecated
@Override
protected final void onBrokerAvailable(BindingAwareBroker broker, BundleContext context) {
ProviderContext ctx = broker.registerProvider(this, context);
- registerRpcImplementations(ctx);
- registerFunctionality(ctx);
- }
-
- private void registerFunctionality(ProviderContext ctx) {
- Collection<? extends ProviderFunctionality> functionality = this.getFunctionality();
- if (functionality == null || functionality.isEmpty()) {
- return;
- }
- for (ProviderFunctionality providerFunctionality : functionality) {
- ctx.registerFunctionality(providerFunctionality);
- }
-
- }
-
- private void registerRpcImplementations(ProviderContext ctx) {
- Collection<? extends RpcService> rpcs = this.getImplementations();
- if (rpcs == null || rpcs.isEmpty()) {
- return;
- }
- for (RpcService rpcService : rpcs) {
- // ctx.addRpcImplementation(type, implementation);
- }
-
- }
-
- @Override
- public Collection<? extends ProviderFunctionality> getFunctionality() {
- return Collections.emptySet();
- }
-
- @Override
- public Collection<? extends RpcService> getImplementations() {
- return Collections.emptySet();
- }
-
- /**
- * Initialization of consumer context.
- *
- * {@link ProviderContext} is replacement of {@link ConsumerContext}
- * so this method is not needed in case of Provider.
- *
- */
- @Deprecated
- @Override
- public final void onSessionInitialized(ConsumerContext session) {
- // NOOP
}
}
package org.opendaylight.controller.sal.binding.api;
import org.opendaylight.controller.md.sal.common.api.routing.RoutedRegistration;
-import org.opendaylight.controller.sal.binding.api.BindingAwareProvider.ProviderFunctionality;
import org.opendaylight.yangtools.concepts.ObjectRegistration;
import org.opendaylight.yangtools.yang.binding.BaseIdentity;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
* and {@link ProviderContext}
*/
public interface BindingAwareBroker {
+ /*
+ * @deprecated Use registerConsumer(BindingAwareConsumer cons) instead (BundleContext is no longer used)
+ */
+ @Deprecated
+ ConsumerContext registerConsumer(BindingAwareConsumer consumer, BundleContext ctx);
+
/**
* Registers the {@link BindingAwareConsumer}, which will use the SAL layer.
*
* @throws IllegalStateException
* If the consumer is already registered.
*/
- ConsumerContext registerConsumer(BindingAwareConsumer consumer, BundleContext ctx);
+ ConsumerContext registerConsumer(BindingAwareConsumer consumer);
+
+ /*
+ * @deprecated Use registerProvider(BindingAwareProvider prov) instead (BundleContext is no longer used)
+ */
+ @Deprecated
+ ProviderContext registerProvider(BindingAwareProvider provider, BundleContext ctx);
/**
* Registers the {@link BindingAwareProvider}, which will use the SAL layer.
* @throws IllegalStateException
* If the consumer is already registered.
*/
- ProviderContext registerProvider(BindingAwareProvider provider, BundleContext ctx);
+ ProviderContext registerProvider(BindingAwareProvider provider);
/**
* {@link BindingAwareConsumer} specific access to the SAL functionality.
*/
public interface ProviderContext extends ConsumerContext, RpcProviderRegistry {
- @Deprecated
- void registerFunctionality(ProviderFunctionality functionality);
-
- @Deprecated
- void unregisterFunctionality(ProviderFunctionality functionality);
}
/**
*/
package org.opendaylight.controller.sal.binding.api;
-import java.util.Collection;
-
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ConsumerContext;
import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
-import org.opendaylight.yangtools.yang.binding.RpcService;
/**
*
*/
public interface BindingAwareProvider {
- /**
- * @deprecated
- *
- * This interface was originally intended to solve problems of how to get Implementations
- * of functionality from a provider, but that is no longer necessary because the Provider
- * Registers RPCs in onSessionInitiated.
- *
- * Recommend:
- * {code
- * public Collection<? extends RpcService> getImplementations() {
- * return Collections.emptySet();
- * }
- * }
- */
- @Deprecated
- Collection<? extends RpcService> getImplementations();
-
- /**
- * @deprecated
- *
- * This interface was originally intended to solve problems of how to get Functionality
- * a provider could provide, but that is no longer necessary because the Provider
- * Registers RPCs in onSessionInitiated.
- *
- * Recommend:
- * {code
- * public Collection<? extends ProviderFunctionality> getFunctionality() {
- * return Collections.emptySet();
- * }
- * }
- *
- */
- @Deprecated
- Collection<? extends ProviderFunctionality> getFunctionality();
-
- /**
- * Functionality provided by the {@link BindingAwareProvider}
- *
- * <p>
- * Marker interface used to mark the interfaces describing specific
- * functionality which could be exposed by providers to other components.
- *
- *
- *
- */
- @Deprecated
- public interface ProviderFunctionality {
-
- }
/**
* Callback signaling initialization of the consumer session to the SAL.
*
* @param session Unique session between consumer and SAL.
*/
void onSessionInitiated(ProviderContext session);
-
- /*
- * @deprecated
- *
- * A provider was at one point considered an extension of a consumer, thus this
- * call. It is deprecated and the @see org.opendaylight.controller.sal.binding.api.BindingAwareConsumer#onSessionInitiated
- * used, or you should simply use {@link #onSessionInitiated(ProviderContext)}
- *
- * Recommend:
- * {code
- * public final void onSessionInitialized(ConsumerContext session) {
- * // NOOP - as method is deprecated
- * }
- * }
- */
- @Deprecated
- void onSessionInitialized(ConsumerContext session);
-
}
+++ /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.controller.sal.binding.api.data;
-
-import org.opendaylight.controller.sal.binding.api.BindingAwareProvider;
-
-/**
- * Trigger for refreshing of the data exposed by the {@link Provider}
- *
- *
- * @deprecated Unused, not supported. Replaced by org.opendaylight.controller.sal.core.spi.data.DOMStore.
- */
-@Deprecated
-public interface DataRefresher extends BindingAwareProvider.ProviderFunctionality {
-
- /**
- * Fired when some component explicitly requested the data refresh.
- *
- * The provider which exposed the {@link DataRefresher} should republish its
- * provided data by editing the data in all affected data stores.
- */
- void refreshData();
-}
\ 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.controller.sal.binding.api.data;
-
-import org.opendaylight.controller.md.sal.common.api.data.DataReader;
-import org.opendaylight.controller.sal.binding.api.BindingAwareProvider.ProviderFunctionality;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-/**
- * Utility interface which does type capture for BindingAware DataReader.
- *
- *
- * @deprecated Removed, replaced by org.opendaylight.controller.sal.core.spi.data.DOMStore.
- *
- */
-@Deprecated
-public interface RuntimeDataProvider extends ProviderFunctionality,DataReader<InstanceIdentifier<? extends DataObject>, DataObject> {
-
-
-
-}
}
@Override
- public ConsumerContext registerConsumer(final BindingAwareConsumer consumer, final BundleContext ctx) {
+ public ConsumerContext registerConsumer(BindingAwareConsumer consumer,
+ BundleContext ctx) {
+ return registerConsumer(consumer);
+ }
+
+ @Override
+ public ProviderContext registerProvider(BindingAwareProvider provider,
+ BundleContext ctx) {
+ return registerProvider(provider);
+ }
+
+ @Override
+ public ConsumerContext registerConsumer(final BindingAwareConsumer consumer) {
checkState(supportedConsumerServices != null, "Broker is not initialized.");
return BindingContextUtils.createConsumerContextAndInitialize(consumer, supportedConsumerServices);
}
@Override
- public ProviderContext registerProvider(final BindingAwareProvider provider, final BundleContext ctx) {
+ public ProviderContext registerProvider(final BindingAwareProvider provider) {
checkState(supportedProviderServices != null, "Broker is not initialized.");
return BindingContextUtils.createProviderContextAndInitialize(provider, supportedProviderServices);
}
import java.util.Collection;
import java.util.Collections;
-
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
+
import org.opendaylight.controller.md.sal.binding.impl.AbstractForwardedDataBroker;
+import org.opendaylight.controller.md.sal.common.api.data.DataReader;
import org.opendaylight.controller.md.sal.common.api.routing.RouteChangePublisher;
import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
import org.opendaylight.controller.sal.binding.api.data.DataProviderService;
-import org.opendaylight.controller.sal.binding.api.data.RuntimeDataProvider;
import org.opendaylight.controller.sal.binding.impl.DataBrokerImpl;
import org.opendaylight.controller.sal.binding.impl.MountPointManagerImpl.BindingMountPointImpl;
import org.opendaylight.controller.sal.binding.impl.RpcProviderRegistryImpl;
import org.slf4j.LoggerFactory;
public class BindingIndependentConnector implements //
- RuntimeDataProvider, //
+ DataReader<InstanceIdentifier<? extends DataObject>, DataObject>, //
Provider, //
AutoCloseable {
*/
package org.opendaylight.controller.test.sal.binding.it;
-import java.util.Collection;
-import java.util.Collections;
-
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ConsumerContext;
import org.opendaylight.controller.sal.binding.api.BindingAwareProvider;
-import org.opendaylight.yangtools.yang.binding.RpcService;
public abstract class AbstractTestProvider implements BindingAwareProvider {
- @Override
- public Collection<? extends RpcService> getImplementations() {
- return Collections.emptySet();
- }
-
- @Override
- public Collection<? extends ProviderFunctionality> getFunctionality() {
- return Collections.emptySet();
- }
-
- @Override
- public void onSessionInitialized(ConsumerContext session) {
- // Noop
-
- }
}
import java.math.BigInteger;
import java.util.ArrayList;
-import java.util.Collection;
import java.util.List;
import org.junit.Before;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowCookie;
import org.opendaylight.yangtools.concepts.ListenerRegistration;
import org.opendaylight.yangtools.yang.binding.NotificationListener;
-import org.opendaylight.yangtools.yang.binding.RpcService;
@Ignore
public class NotificationTest extends AbstractTest {
listener2Reg = session.getSALService(NotificationProviderService.class).registerNotificationListener(
listener2);
}
-
- @Override
- public void onSessionInitialized(ConsumerContext session) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public Collection<? extends RpcService> getImplementations() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public Collection<? extends ProviderFunctionality> getFunctionality() {
- // TODO Auto-generated method stub
- return null;
- }
-
};
// registerConsumer method calls onSessionInitialized method above
import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RpcRegistration;
import org.opendaylight.controller.sal.binding.api.BindingAwareConsumer;
import org.opendaylight.controller.sal.binding.api.BindingAwareProvider;
-import org.opendaylight.controller.sal.binding.api.BindingAwareProvider.ProviderFunctionality;
import org.opendaylight.controller.sal.binding.api.BindingAwareService;
import org.opendaylight.controller.sal.binding.api.RpcConsumerRegistry;
import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
throws IllegalStateException {
return getSALService(RpcProviderRegistry.class).addRpcImplementation(type, implementation);
}
-
- @Deprecated
- @Override
- public void registerFunctionality(ProviderFunctionality functionality) {
- // NOOP
- }
-
- @Deprecated
- @Override
- public void unregisterFunctionality(ProviderFunctionality functionality) {
- // NOOP
- }
}
}
getSchemaServiceDependency().registerSchemaContextListener(xsqlAdapter);
xsqlAdapter.setDataBroker(getAsyncDataBrokerDependency());
XSQLProvider p = new XSQLProvider();
- p.buildXSQL(getDataBrokerDependency());
+ //p.buildXSQL(getDataBrokerDependency());
return p;
}
import org.opendaylight.controller.sal.core.api.RpcProvisionRegistry;
import org.opendaylight.controller.sal.core.api.notify.NotificationPublishService;
import org.opendaylight.yangtools.concepts.ObjectRegistration;
-import org.opendaylight.yangtools.yang.binding.RpcService;
import org.opendaylight.yangtools.yang.data.api.CompositeNode;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
import org.slf4j.Logger;
return Collections.emptySet();
}
- @Override
- public Collection<? extends RpcService> getImplementations() {
- return Collections.emptySet();
- }
-
- @Override
- public Collection<? extends BindingAwareProvider.ProviderFunctionality> getFunctionality() {
- return Collections.emptySet();
- }
-
@Override
public void onSessionInitiated(final BindingAwareBroker.ProviderContext session) {
logger.debug("{}: Session with sal established {}", id, session);
datastoreAdapter = new NetconfDeviceDatastoreAdapter(id, dataBroker);
}
- @Override
- public void onSessionInitialized(final BindingAwareBroker.ConsumerContext session) {}
-
public void close() throws Exception {
mountInstance.close();
datastoreAdapter.close();
if (optionalDatastoreData.isPresent() && payload.equals(optionalDatastoreData.get())) {
String errMsg = "Post Configuration via Restconf was not executed because data already exists";
LOG.trace(errMsg + ":{}", path);
+ rWTransaction.cancel();
throw new RestconfDocumentedException("Data already exists for path: " + path, ErrorType.PROTOCOL,
ErrorTag.DATA_EXISTS);
}
try {
currentOp = currentOp.getChild(currentArg);
} catch (DataNormalizationException e) {
+ rwTx.cancel();
throw new IllegalArgumentException(
String.format("Invalid child encountered in path %s", normalizedPath), e);
}
exists = future.checkedGet();
} catch (ReadFailedException e) {
LOG.error("Failed to read pre-existing data from store {} path {}", store, currentPath, e);
+ rwTx.cancel();
throw new IllegalStateException("Failed to read pre-existing data", e);
}
.put(RpcConsumerRegistry.class,servicesFactory.getRpcConsumerRegistry() ).build();
}
- public ProviderContext registerProvider(BindingAwareProvider provider, BundleContext ctx) {
+ public ProviderContext registerProvider(BindingAwareProvider provider) {
throw new UnsupportedOperationException();
}
@Override
//TODO decide if serviceFactory should close clientContext or it has to be closed by consumer
}
@Override
- public ConsumerContext registerConsumer(BindingAwareConsumer consumer, BundleContext ctx) {
+ public ConsumerContext registerConsumer(BindingAwareConsumer consumer) {
checkState(supportedConsumerServices != null, "Broker is not initialized.");
return BindingContextUtils.createConsumerContextAndInitialize(consumer, supportedConsumerServices);
}
+ @Override
+ public ConsumerContext registerConsumer(BindingAwareConsumer consumer,
+ BundleContext ctx) {
+ return registerConsumer(consumer);
+ }
+
+ @Override
+ public ProviderContext registerProvider(BindingAwareProvider provider,
+ BundleContext ctx) {
+ return registerProvider(provider);
+ }
+
}
import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
import com.google.common.collect.Sets;
+import java.util.Collection;
+import java.util.Collections;
import java.util.HashSet;
-import java.util.List;
import java.util.Map;
import java.util.Set;
import org.opendaylight.controller.config.api.LookupRegistry;
private final Set<Capability> capabilities;
private final TransactionProvider transactionProvider;
- public NetconfOperationServiceImpl(YangStoreService yangStoreService, ConfigRegistryJMXClient jmxClient,
- String netconfSessionIdForReporting) throws YangStoreException {
+ public NetconfOperationServiceImpl(final YangStoreService yangStoreService, final ConfigRegistryJMXClient jmxClient,
+ final String netconfSessionIdForReporting) throws YangStoreException {
yangStoreSnapshot = yangStoreService.getYangStoreSnapshot();
checkConsistencyBetweenYangStoreAndConfig(jmxClient, yangStoreSnapshot);
@VisibleForTesting
- static void checkConsistencyBetweenYangStoreAndConfig(LookupRegistry jmxClient, YangStoreSnapshot yangStoreSnapshot) {
+ static void checkConsistencyBetweenYangStoreAndConfig(final LookupRegistry jmxClient, final YangStoreSnapshot yangStoreSnapshot) {
Set<String> missingModulesFromConfig = Sets.newHashSet();
Set<String> modulesSeenByConfig = jmxClient.getAvailableModuleFactoryQNames();
return operationProvider.getOperations();
}
- private static Set<Capability> setupCapabilities(YangStoreSnapshot yangStoreSnapshot) {
+ private static Set<Capability> setupCapabilities(final YangStoreSnapshot yangStoreSnapshot) {
Set<Capability> capabilities = new HashSet<>();
// [RFC6241] 8.3. Candidate Configuration Capability
capabilities.add(new BasicCapability("urn:ietf:params:netconf:capability:candidate:1.0"));
private final String capability;
- private BasicCapability(String capability) {
+ private BasicCapability(final String capability) {
this.capability = capability;
}
}
@Override
- public Optional<List<String>> getLocation() {
- return Optional.absent();
+ public Collection<String> getLocation() {
+ return Collections.emptyList();
}
@Override
private final String moduleName;
private final String moduleNamespace;
- public YangStoreCapability(Module module, String moduleContent) {
+ public YangStoreCapability(final Module module, final String moduleContent) {
super(toCapabilityURI(module));
this.content = moduleContent;
this.moduleName = module.getName();
return Optional.of(content);
}
- private static String toCapabilityURI(Module module) {
+ private static String toCapabilityURI(final Module module) {
return String.valueOf(module.getNamespace()) + "?module="
+ module.getName() + "&revision=" + Util.writeDate(module.getRevision());
}
import com.google.common.base.Function;
import com.google.common.base.Preconditions;
import com.google.common.collect.Collections2;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Sets;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableList.Builder;
import io.netty.util.internal.ConcurrentSet;
-import java.util.Collections;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
import java.util.List;
import java.util.Set;
import javax.annotation.Nonnull;
import org.slf4j.LoggerFactory;
public class NetconfMonitoringServiceImpl implements NetconfMonitoringService, SessionMonitoringService {
-
+ private static final Schema.Location NETCONF_LOCATION = new Schema.Location(Schema.Location.Enumeration.NETCONF);
+ private static final List<Schema.Location> NETCONF_LOCATIONS = ImmutableList.of(NETCONF_LOCATION);
private static final Logger LOG = LoggerFactory.getLogger(NetconfMonitoringServiceImpl.class);
+ private static final Function<NetconfManagementSession, Session> SESSION_FUNCTION = new Function<NetconfManagementSession, Session>() {
+ @Override
+ public Session apply(@Nonnull final NetconfManagementSession input) {
+ return input.toManagementSession();
+ }
+ };
private final Set<NetconfManagementSession> sessions = new ConcurrentSet<>();
private final NetconfOperationProvider netconfOperationProvider;
- public NetconfMonitoringServiceImpl(NetconfOperationProvider netconfOperationProvider) {
+ public NetconfMonitoringServiceImpl(final NetconfOperationProvider netconfOperationProvider) {
this.netconfOperationProvider = netconfOperationProvider;
}
@Override
- public void onSessionUp(NetconfManagementSession session) {
+ public void onSessionUp(final NetconfManagementSession session) {
LOG.debug("Session {} up", session);
Preconditions.checkState(!sessions.contains(session), "Session %s was already added", session);
sessions.add(session);
}
@Override
- public void onSessionDown(NetconfManagementSession session) {
+ public void onSessionDown(final NetconfManagementSession session) {
LOG.debug("Session {} down", session);
Preconditions.checkState(sessions.contains(session), "Session %s not present", session);
sessions.remove(session);
@Override
public Sessions getSessions() {
- return new SessionsBuilder().setSession(transformSessions(sessions)).build();
+ return new SessionsBuilder().setSession(ImmutableList.copyOf(Collections2.transform(sessions, SESSION_FUNCTION))).build();
}
@Override
}
}
- private Schemas transformSchemas(Set<NetconfOperationService> services) {
- Set<Capability> caps = Sets.newHashSet();
-
- List<Schema> schemas = Lists.newArrayList();
-
-
+ private static Schemas transformSchemas(final Set<NetconfOperationService> services) {
+ // FIXME: Capability implementations do not have hashcode/equals!
+ final Set<Capability> caps = new HashSet<>();
for (NetconfOperationService netconfOperationService : services) {
// TODO check for duplicates ? move capability merging to snapshot
// Split capabilities from operations first and delete this duplicate code
caps.addAll(netconfOperationService.getCapabilities());
}
+ final List<Schema> schemas = new ArrayList<>(caps.size());
for (Capability cap : caps) {
- SchemaBuilder builder = new SchemaBuilder();
-
- if (cap.getCapabilitySchema().isPresent() == false) {
- continue;
- }
+ if (cap.getCapabilitySchema().isPresent()) {
+ SchemaBuilder builder = new SchemaBuilder();
+ Preconditions.checkState(cap.getModuleNamespace().isPresent());
+ builder.setNamespace(new Uri(cap.getModuleNamespace().get()));
- Preconditions.checkState(cap.getModuleNamespace().isPresent());
- builder.setNamespace(new Uri(cap.getModuleNamespace().get()));
+ Preconditions.checkState(cap.getRevision().isPresent());
+ String version = cap.getRevision().get();
+ builder.setVersion(version);
- Preconditions.checkState(cap.getRevision().isPresent());
- String version = cap.getRevision().get();
- builder.setVersion(version);
+ Preconditions.checkState(cap.getModuleName().isPresent());
+ String identifier = cap.getModuleName().get();
+ builder.setIdentifier(identifier);
- Preconditions.checkState(cap.getModuleName().isPresent());
- String identifier = cap.getModuleName().get();
- builder.setIdentifier(identifier);
+ builder.setFormat(Yang.class);
- builder.setFormat(Yang.class);
+ builder.setLocation(transformLocations(cap.getLocation()));
- builder.setLocation(transformLocations(cap.getLocation().or(Collections.<String>emptyList())));
+ builder.setKey(new SchemaKey(Yang.class, identifier, version));
- builder.setKey(new SchemaKey(Yang.class, identifier, version));
-
- schemas.add(builder.build());
+ schemas.add(builder.build());
+ }
}
return new SchemasBuilder().setSchema(schemas).build();
}
- private List<Schema.Location> transformLocations(List<String> locations) {
- List<Schema.Location> monitoringLocations = Lists.newArrayList();
- monitoringLocations.add(new Schema.Location(Schema.Location.Enumeration.NETCONF));
+ private static List<Schema.Location> transformLocations(final Collection<String> locations) {
+ if (locations.isEmpty()) {
+ return NETCONF_LOCATIONS;
+ }
+
+ final Builder<Schema.Location> b = ImmutableList.builder();
+ b.add(NETCONF_LOCATION);
for (String location : locations) {
- monitoringLocations.add(new Schema.Location(new Uri(location)));
+ b.add(new Schema.Location(new Uri(location)));
}
- return monitoringLocations;
- }
-
- private List<Session> transformSessions(Set<NetconfManagementSession> sessions) {
- return Lists.newArrayList(Collections2.transform(sessions, new Function<NetconfManagementSession, Session>() {
- @Override
- public Session apply(@Nonnull NetconfManagementSession input) {
- return input.toManagementSession();
- }
- }));
+ return b.build();
}
}
Optional<String> optRev = Optional.of("rev");
doReturn(optRev).when(cap).getRevision();
doReturn(Optional.of("modName")).when(cap).getModuleName();
- doReturn(Optional.of(Lists.newArrayList("loc"))).when(cap).getLocation();
+ doReturn(Lists.newArrayList("loc")).when(cap).getLocation();
doNothing().when(snapshot).close();
assertNotNull(service.getSchemas());
}
@Override
- public Optional<List<String>> getLocation() {
- return Optional.absent();
+ public List<String> getLocation() {
+ return Collections.emptyList();
}
}
}
package org.opendaylight.controller.netconf.mapping.api;
import com.google.common.base.Optional;
-import java.util.List;
+import java.util.Collection;
/**
* Contains capability URI announced by server hello message and optionally its
public Optional<String> getCapabilitySchema();
- public Optional<List<String>> getLocation();
+ public Collection<String> getLocation();
}
import com.google.common.base.Optional;
import com.google.common.collect.Sets;
-import java.util.List;
+import java.util.Collection;
+import java.util.Collections;
import java.util.Set;
import org.opendaylight.controller.netconf.api.monitoring.NetconfMonitoringService;
import org.opendaylight.controller.netconf.mapping.api.Capability;
}
@Override
- public Optional<List<String>> getLocation() {
- return Optional.absent();
+ public Collection<String> getLocation() {
+ return Collections.emptyList();
}
});
private final NetconfMonitoringService monitor;
- public NetconfMonitoringOperationService(NetconfMonitoringService monitor) {
+ public NetconfMonitoringOperationService(final NetconfMonitoringService monitor) {
this.monitor = monitor;
}
import static org.mockito.Mockito.mock;
import com.google.common.base.Optional;
+import java.util.Collections;
import org.junit.Test;
import org.opendaylight.controller.netconf.api.monitoring.NetconfMonitoringService;
import org.opendaylight.controller.netconf.monitoring.MonitoringConstants;
assertEquals(1, service.getNetconfOperations().size());
- assertEquals(Optional.absent(), service.getCapabilities().iterator().next().getCapabilitySchema());
- assertEquals(Optional.absent(), service.getCapabilities().iterator().next().getLocation());
+ assertEquals(Optional.<String>absent(), service.getCapabilities().iterator().next().getCapabilitySchema());
+ assertEquals(Collections.<String>emptyList(), service.getCapabilities().iterator().next().getLocation());
assertEquals(Optional.of(MonitoringConstants.MODULE_REVISION), service.getCapabilities().iterator().next().getRevision());
assertEquals(Optional.of(MonitoringConstants.MODULE_NAME), service.getCapabilities().iterator().next().getModuleName());
assertEquals(Optional.of(MonitoringConstants.NAMESPACE), service.getCapabilities().iterator().next().getModuleNamespace());
package org.opendaylight.controller.netconf.test.tool;
import com.google.common.base.Optional;
+import java.util.Collections;
import java.util.Date;
import java.util.List;
import org.opendaylight.controller.netconf.confignetconfconnector.util.Util;
}
@Override
- public Optional<List<String>> getLocation() {
- return Optional.absent();
+ public List<String> getLocation() {
+ return Collections.emptyList();
}
}