diff options
author | Maros Marsalek <mmarsale@cisco.com> | 2016-11-10 13:31:25 +0100 |
---|---|---|
committer | Marek Gradzki <mgradzki@cisco.com> | 2016-11-19 21:29:39 +0100 |
commit | 175197da8ea43335df3daeba4c6296fcd83a057c (patch) | |
tree | 110298a990c6191933c2ad65d1a06333bab76cee /release-notes | |
parent | 1813bf59fa53e8eb913d34b212d45b227dead799 (diff) |
Post split cleanup
- change groupIds
- change packages
- update poms
Change-Id: I343c5a292a67de1dd50687870ca4ab5b7276e93e
Signed-off-by: Maros Marsalek <mmarsale@cisco.com>
Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
Diffstat (limited to 'release-notes')
5 files changed, 5 insertions, 404 deletions
diff --git a/release-notes/pom.xml b/release-notes/pom.xml index 2f08472c9..a29ee5d1a 100644 --- a/release-notes/pom.xml +++ b/release-notes/pom.xml @@ -20,10 +20,9 @@ <groupId>io.fd.honeycomb.common</groupId> <artifactId>honeycomb-parent</artifactId> <version>1.16.12-SNAPSHOT</version> - <relativePath>../common/honeycomb-parent</relativePath> </parent> - <groupId>io.fd.honeycomb.nat</groupId> + <groupId>io.fd.hc2vpp</groupId> <artifactId>release-notes-aggregator</artifactId> <version>1.16.12-SNAPSHOT</version> <name>${project.artifactId}</name> @@ -87,7 +86,7 @@ <!-- TODO set snapshot version to project-snat-version after VPP is released--> <!--<project-snat-snapshot-version>1.0</project-snat-snapshot-version>--> <project-snat-snapshot-version>1.0-SNAPSHOT</project-snat-snapshot-version> - <project-git-web>https://git.fd.io/cgit/honeycomb/tree</project-git-web> + <project-git-web>https://git.fd.io/cgit/hc2vpp/tree</project-git-web> </attributes> </configuration> </execution> diff --git a/release-notes/src/main/asciidoc/devel_guide/devel_guide.adoc b/release-notes/src/main/asciidoc/devel_guide/devel_guide.adoc index 78664e655..5d664ec16 100644 --- a/release-notes/src/main/asciidoc/devel_guide/devel_guide.adoc +++ b/release-notes/src/main/asciidoc/devel_guide/devel_guide.adoc @@ -3,8 +3,8 @@ Honeycomb plugin development guide. === Tutorials -* link:devel_plugin_overview.html[Honeycomb plugin overview] -* link:devel_plugin_tutorial.html[How to write Honeycomb plugins] +!!!!! fixme link here tutorials from honeycomb !!!!! + * link:devel_plugin_vpp_tutorial.html[How to write Honeycomb plugins for VPP] === Samples diff --git a/release-notes/src/main/asciidoc/devel_guide/devel_plugin_overview.adoc b/release-notes/src/main/asciidoc/devel_guide/devel_plugin_overview.adoc deleted file mode 100644 index d844a2f5c..000000000 --- a/release-notes/src/main/asciidoc/devel_guide/devel_plugin_overview.adoc +++ /dev/null @@ -1,26 +0,0 @@ -= Plugin overview - -link:release_notes.html[< Home] - -Honeycomb provides a framework for plugins to participate in the data handling. The plugins use YANG modeling language to describe what: - -* *data* they can handle (Create, Read, Update, Delete operations) -* *notifications* do they emit - -NOTE: RPCs are not supported in this release. - -A plugin usually consists of: - -* *YANG models* - These models contain data and notification definitions that are implemented by the plugin. ODL's Yangtools project is used to generate Java APIs from those models (called Binding Aware APIs in ODL) and are later used in the translation code. -* *Set of readers* - Readers provide operational/state data from plugin or its underlying layer. This means that operational/state data is current state of the plugin or its underlying layer. Readers return these operational data by e.g. reading from underlying layer and transforming it into YANG modeled data. -* *Set of writers* - Writers handle configuration data for the plugin or its underlying layer This means that configuration data is the intent being sent to Honeycomb, that should be passed to plugins or their underlying layers. Writers handle these configuration data by transforming YANG modeled data into e.g. underlying layer calls. -* *Set of initializers* - Initializers are invoked right after Honeycomb starts. The gould here is to read current operational/state data of the plugin or its underlying layer and then transform the operational data into configuration data. This enables reconciliation in cases when Honeycomb looses it's persisted data, or is started fresh while the underlying layer already contains some configuration that is manifested as operational/state data -* *Plugin configuration* - Usually configuration in json format + it's Java equivalent. -* *Set of notification producers* - If there are any notifications, the producers transform the data into YANG model notifications and emit them. -* *Module* - Small class instantiating & exposing plugin's components - -What's good to add: - -* *Unit tests* -* *Documentation* (as Readme.adoc + update global release notes if the plugin is included into honeycomb integration distribution) -* *Sample REST or NETCONF requests* (as POSTMAN request collection)
\ No newline at end of file diff --git a/release-notes/src/main/asciidoc/devel_guide/devel_plugin_tutorial.adoc b/release-notes/src/main/asciidoc/devel_guide/devel_plugin_tutorial.adoc deleted file mode 100644 index 1efa49f04..000000000 --- a/release-notes/src/main/asciidoc/devel_guide/devel_plugin_tutorial.adoc +++ /dev/null @@ -1,368 +0,0 @@ -= Developing generic plugins - -link:release_notes.html[< Home] - -Since Honeycomb is a generic agent. Any plugin (translation code) can be injected into the framework, creating a custom agent providing RESTCONF/NETCONF northbound interfaces out-of-box. - -== Developing plugin code - -Honeycomb provides a maven archetype to generate a plugin skeleton. To use that archetype, run maven: - -[subs="+attributes"] - mvn -X archetype:generate -DarchetypeGroupId=io.fd.honeycomb.tools -DarchetypeArtifactId=honeycomb-plugin-archetype -DarchetypeVersion={project-version} - -Fill in the parameters e.g. - -[subs="+attributes"] - groupId: io.fd.honeycomb.tutorial - artifactId: sample-plugin - version: {project-version} - package: io.fd.honeycomb.tutorial - -And following structure should be created: - -[source] ----- -sample-plugin/ -├── pom.xml -├── sample-plugin-api -│ ├── pom.xml -│ └── src -│ └── main -│ ├── java -│ └── yang -│ └── sample-plugin.yang -└── sample-plugin-impl - ├── pom.xml - ├── Readme.adoc - └── src - ├── main - │ └── java - │ └── io - │ └── fd - │ └── honeycomb - │ └── tutorial - │ ├── CrudService.java - │ ├── ElementCrudService.java - │ ├── init - │ │ └── ConfigDataInitializer.java - │ ├── ModuleConfiguration.java - │ ├── Module.java - │ ├── read - │ │ ├── ElementStateCustomizer.java - │ │ └── ModuleStateReaderFactory.java - │ └── write - │ ├── ElementCustomizer.java - │ └── ModuleWriterFactory.java - └── test - └── java ----- - -There are 2 modules: - -* sample-plugin-api - Contains YANG models and generates Java APIs from the models. -* sample-plugin-impl - Contains: Readers, Writers, Initializers, Notification producers (not yet), Configuration and Wiring. - -There is plenty of comments within the code, so its is advised to import the code into an IDE and take a look around. - -*The archetype generates a plugin that is fully working right from the start*. Since it contains all the components necessary, works on a sample yang model and provides some sample values. - -== Building the code - -To build the code, just execute maven: - - mvn clean install - -And that's it. This is a working Honeycomb plugin. - -== Adding notifications - -No notification producer is generated by the archetype, but it is pretty straightforward to add one. - -First, the notification has to be defined in YANG (sample-plugin-api/src/main/yang/sample-plugin.yang) e.g. - -[source,yang] ----- -notification sample-notification { - leaf content { - type string; - } -} ----- - -Now rebuild the plugin to generate new APIs for our notification. - -Next part is implementing the Notification producer. First thing to do is to add a dependency on notification-api, since it's not included by default. Update sample-plugin-impl's pom file with: - -[source,xml] ----- -<dependency> - <groupId>io.fd.honeycomb</groupId> - <artifactId>notification-api</artifactId> - <version>${honeycomb.infra.version}</version> -</dependency> ----- - -Now, the producer code can be added: - -[source,java] ----- -package io.fd.honeycomb.tutorial.notif; - -import io.fd.honeycomb.notification.ManagedNotificationProducer; -import io.fd.honeycomb.notification.NotificationCollector; -import java.util.Collection; -import java.util.Collections; -import javax.annotation.Nonnull; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.sample.plugin.rev160918.SampleNotification; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.sample.plugin.rev160918.SampleNotificationBuilder; -import org.opendaylight.yangtools.yang.binding.Notification; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Notification producer for sample plugin - */ -public class SampleNotificationProducer implements ManagedNotificationProducer { - - private static final Logger LOG = LoggerFactory.getLogger(SampleNotificationProducer.class); - - private Thread thread; - - @Override - public void start(@Nonnull final NotificationCollector collector) { - LOG.info("Starting notification stream for interfaces"); - - // Simulating notification producer - thread = new Thread(() -> { - while(true) { - if (Thread.currentThread().isInterrupted()) { - return; - } - - try { - Thread.sleep(2000); - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - break; - } - - final SampleNotification notification = new SampleNotificationBuilder() - .setContent("Hello world " + System.currentTimeMillis()) - .build(); - LOG.info("Emitting notification: {}", notification); - collector.onNotification(notification); - } - }, "NotificationProducer"); - thread.setDaemon(true); - thread.start(); - } - - @Override - public void stop() { - if(thread != null) { - thread.interrupt(); - } - } - - @Nonnull - @Override - public Collection<Class<? extends Notification>> getNotificationTypes() { - // Producing only this single type of notification - return Collections.singleton(SampleNotification.class); - } - - @Override - public void close() throws Exception { - stop(); - } -} ----- - -This is placed sample-plugin/sample-plugin-impl/src/main/java/io/fd/honeycomb/tutorial/notif/SampleNotificationProducer.java. - -NOTE: This is a sample producer, that creates a thread to periodically emit a sample notification - -Now it needs to be exposed from the plugin. The configure method in Module class needs to be updated with: - -[source,java] ----- - Multibinder.newSetBinder(binder(), ManagedNotificationProducer.class).addBinding().to(SampleNotificationProducer.class); ----- - -Plugin needs to be rebuilt, but that's it for notification producers. - -== Creating custom distribution - -The plugin is now ready to have a Honeycomb distribution for it. This section will provides information on how to create a custom Honeycomb distribution. - -A new maven module needs to be created. So in sample-plugin folder: - - mkdir sample-distribution - cd sample-distribution - mkdir -p src/main/java/io/fd/honeycomb/tutorial - -Then create the pom: - -[source,xml,subs="+attributes"] ----- -<?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"> - - <parent> - <groupId>io.fd.honeycomb.common</groupId> - <artifactId>minimal-distribution-parent</artifactId> - <version>{project-version}</version> - </parent> - - <modelVersion>4.0.0</modelVersion> - <groupId>io.fd.honeycomb.tutorial</groupId> - <artifactId>sample-distribution</artifactId> - <version>{project-version}</version> - - <properties> - <exec.parameters>-Xms128m -Xmx128m</exec.parameters> - <main.class>io.fd.honeycomb.tutorial.Main</main.class> - <interfaces.mapping.version>{project-version}</interfaces.mapping.version> - <honeycomb.min.distro.version>{project-version}</honeycomb.min.distro.version> - </properties> - - <build> - <plugins> - <plugin> - <artifactId>maven-compiler-plugin</artifactId> - </plugin> - <plugin> - <groupId>org.codehaus.gmaven</groupId> - <artifactId>groovy-maven-plugin</artifactId> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-jar-plugin</artifactId> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-dependency-plugin</artifactId> - </plugin> - <plugin> - <artifactId>maven-assembly-plugin</artifactId> - </plugin> - </plugins> - </build> - - <dependencies> - <!-- Dependency on sample plugin --> - <dependency> - <groupId>io.fd.honeycomb.tutorial</groupId> - <artifactId>sample-plugin-impl</artifactId> - <version>${interfaces.mapping.version}</version> - </dependency> - <!-- Dependency on distribution base --> - <dependency> - <groupId>io.fd.honeycomb</groupId> - <artifactId>minimal-distribution</artifactId> - <version>${honeycomb.min.distro.version}</version> - </dependency> - - </dependencies> -</project> ----- - -Now, Main class has to be added in folder src/main/java/io/fd/honeycomb/tutorial: - -[source,java] ----- -package io.fd.honeycomb.tutorial; - -import com.google.common.collect.Lists; -import com.google.inject.Module; -import java.util.List; - -public class Main { - - public static void main(String[] args) { - final List<Module> sampleModules = Lists.newArrayList(io.fd.honeycomb.infra.distro.Main.BASE_MODULES); - - sampleModules.add(new io.fd.honeycomb.tutorial.Module()); - - io.fd.honeycomb.infra.distro.Main.init(sampleModules); - } -} ----- - -Last thing to do is to update sample-plugin/pom.xml with: -[source,xml] ----- - <module>sample-distribution</module> ----- - -Another rebuild and the distribution should be created in sample-distribution/target. - -=== Adding existing plugins to the mix - -In previous section, a custom Honeycomb distribution was created. This section will show how to add existing plugins to the new distribution. - -So in order to add another existing sample (sample interface plugin from Honeycomb) into the distribution, update the sample-plugin/sample-distribution/pom.xml with: - -[source,xml] ----- -<dependency> - <groupId>io.fd.honeycomb.samples.interfaces</groupId> - <artifactId>interfaces-mapping</artifactId> - <version>${interfaces.mapping.version}</version> -</dependency> ----- - -Now in main, add this line: - -[source,java] ----- - sampleModules.add(new SampleInterfaceModule()); ----- - -That's it, just rebuild. - -== Verifying distribution -The distribution with this sample plugin and sample interface plugin is now available and can be tested. - -Distribution can now be found in sample-plugin/sample-distribution/target as: - -zip archive -tar.gz archive -folder -The distribution can be started by: - -[subs="attributes"] - sudo ./sample-distribution/target/sample-distribution-{project-version}-hc/sample-distribution-{project-version}/honeycomb - -NOTE: honeycomb-start script is the background alternative - -Honeycomb will display following message in the log: - - 2016-09-02 13:20:30.424 CEST [main] INFO io.fd.honeycomb.infra.distro.Main - Honeycomb started successfully! - -and that means Honeycomb was started successfully. - -=== Testing over RESTCONF -Reading sample-plugin operational data: - - curl -u admin:admin http://localhost:8181/restconf/operational/sample-plugin:sample-plugin-state - -Writing sample-plugin operational data: - - Not possible from YANG spec. Operational data is only for read. - -Writing sample-plugin config data: - - curl -H 'Content-Type: application/json' -H 'Accept: application/json' -u admin:admin -X PUT -d '{"sample-plugin":{"element":[{"id":10,"description":"This is a example of loaded data"}]}}' http://localhost:8181/restconf/config/sample-plugin:sample-plugin - -Reading sample-plugin config data: - - curl -u admin:admin http://localhost:8181/restconf/config/sample-plugin:sample-plugin - -=== Testing over NETCONF -Netconf testing guide including Notifications, can be found in link:user_running_honeycomb.html[User guide] - -== Full working example -Full working example on github: https://github.com/marosmars/honeycomb-samples - diff --git a/release-notes/src/main/asciidoc/release_notes.adoc b/release-notes/src/main/asciidoc/release_notes.adoc index 940c8e067..2762501fd 100644 --- a/release-notes/src/main/asciidoc/release_notes.adoc +++ b/release-notes/src/main/asciidoc/release_notes.adoc @@ -1,6 +1,6 @@ = Honeycomb {project-version} Release notes -Release notes for honeycomb {project-version}. Based on VPP {project-vpp-snapshot-version} +Release notes for honeycomb for VPP {project-version}. Based on VPP {project-vpp-snapshot-version} == Release plan https://wiki.fd.io/view/Honeycomb/Release_Plans/Release_Plan_{project-public-version}[Release plan] @@ -16,10 +16,6 @@ Adding to the list of existing features: https://wiki.fd.io/view/Honeycomb/Relea === Modified features * ACL management improvements -* https://jira.fd.io/browse/HONEYCOMB-73[Initializers tie-in with readers] -** Instead of root level initializer, initialization can be split among multiple initializing readers -* https://jira.fd.io/browse/HONEYCOMB-270[Readers/ReadCustomizers able to influence presence of resulting data] -** Suitable for presence container readers === Deprecated features |