From 91735f200ed89b790251d9a83df24995b28aa079 Mon Sep 17 00:00:00 2001 From: Marco Platania Date: Wed, 8 May 2019 15:08:41 -0400 Subject: Removed unused stuff from demo (master) Change-Id: Ia869971690e31e8a81ea0bb5c1707785f7ab819e Issue-ID: INT-1073 Signed-off-by: Marco Platania --- vnfs/honeycomb_plugin/parent-pom/pom.xml | 9 -- vnfs/honeycomb_plugin/sample-distribution/pom.xml | 102 -------------- .../main/java/io/fd/honeycomb/tutorial/Main.java | 46 ------ vnfs/honeycomb_plugin/sample_plugin/LICENSE.TXT | 22 --- vnfs/honeycomb_plugin/sample_plugin/README.md | 16 --- .../sample_plugin/sample-plugin-api/pom.xml | 81 ----------- .../src/main/yang/sample-plugin.yang | 77 ---------- .../sample_plugin/sample-plugin-impl/Readme.adoc | 3 - .../sample_plugin/sample-plugin-impl/pom.xml | 112 --------------- .../main/java/io/fd/honeycomb/tutorial/Module.java | 71 ---------- .../fd/honeycomb/tutorial/ModuleConfiguration.java | 46 ------ .../tutorial/init/ConfigDataInitializer.java | 50 ------- .../tutorial/notif/SampleNotificationProducer.java | 86 ------------ .../tutorial/write/ModuleWriterFactory.java | 63 --------- .../tutorial/write/PgWriteCustomizer.java | 155 --------------------- 15 files changed, 939 deletions(-) delete mode 100755 vnfs/honeycomb_plugin/sample-distribution/pom.xml delete mode 100755 vnfs/honeycomb_plugin/sample-distribution/src/main/java/io/fd/honeycomb/tutorial/Main.java delete mode 100644 vnfs/honeycomb_plugin/sample_plugin/LICENSE.TXT delete mode 100755 vnfs/honeycomb_plugin/sample_plugin/README.md delete mode 100755 vnfs/honeycomb_plugin/sample_plugin/sample-plugin-api/pom.xml delete mode 100755 vnfs/honeycomb_plugin/sample_plugin/sample-plugin-api/src/main/yang/sample-plugin.yang delete mode 100755 vnfs/honeycomb_plugin/sample_plugin/sample-plugin-impl/Readme.adoc delete mode 100755 vnfs/honeycomb_plugin/sample_plugin/sample-plugin-impl/pom.xml delete mode 100755 vnfs/honeycomb_plugin/sample_plugin/sample-plugin-impl/src/main/java/io/fd/honeycomb/tutorial/Module.java delete mode 100755 vnfs/honeycomb_plugin/sample_plugin/sample-plugin-impl/src/main/java/io/fd/honeycomb/tutorial/ModuleConfiguration.java delete mode 100755 vnfs/honeycomb_plugin/sample_plugin/sample-plugin-impl/src/main/java/io/fd/honeycomb/tutorial/init/ConfigDataInitializer.java delete mode 100755 vnfs/honeycomb_plugin/sample_plugin/sample-plugin-impl/src/main/java/io/fd/honeycomb/tutorial/notif/SampleNotificationProducer.java delete mode 100755 vnfs/honeycomb_plugin/sample_plugin/sample-plugin-impl/src/main/java/io/fd/honeycomb/tutorial/write/ModuleWriterFactory.java delete mode 100755 vnfs/honeycomb_plugin/sample_plugin/sample-plugin-impl/src/main/java/io/fd/honeycomb/tutorial/write/PgWriteCustomizer.java (limited to 'vnfs') diff --git a/vnfs/honeycomb_plugin/parent-pom/pom.xml b/vnfs/honeycomb_plugin/parent-pom/pom.xml index d8322b89..f368d543 100644 --- a/vnfs/honeycomb_plugin/parent-pom/pom.xml +++ b/vnfs/honeycomb_plugin/parent-pom/pom.xml @@ -52,15 +52,9 @@ done -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005 4.1.0 1.2.0 - - 1.19.1 9.3.11.v20160721 3.1.0 - - - - 4.0.0 @@ -69,12 +63,9 @@ done - - ../stream-count/stream-count-api ../stream-count/stream-count-impl ../stream-count/stream-count-distribution - diff --git a/vnfs/honeycomb_plugin/sample-distribution/pom.xml b/vnfs/honeycomb_plugin/sample-distribution/pom.xml deleted file mode 100755 index c2e363ad..00000000 --- a/vnfs/honeycomb_plugin/sample-distribution/pom.xml +++ /dev/null @@ -1,102 +0,0 @@ - - - - - - - - org.onap.demo.vnf - hc-onap - 1.5.0-SNAPSHOT - ../parent-pom/pom.xml - - - 4.0.0 - sample-distribution - - - io.fd.honeycomb.vpp.integration.distro.Main - 1.16.9 - 1.16.9 - 1.16.9 - 1.16.9 - 1.16.9 - - - - - - maven-compiler-plugin - - - org.codehaus.gmaven - groovy-maven-plugin - - - org.apache.maven.plugins - maven-jar-plugin - - - org.apache.maven.plugins - maven-dependency-plugin - - - maven-assembly-plugin - - - - org.apache.maven.plugins - maven-deploy-plugin - - false - - - - - org.apache.maven.plugins - maven-install-plugin - - false - - - - - - - - - io.fd.honeycomb.vpp - minimal-distribution - ${vpp.common.min.distro.version} - - - io.fd.honeycomb.v3po - v3po2vpp - ${v3po.version} - - - io.fd.honeycomb.lisp - lisp2vpp - ${lisp.version} - - - io.fd.honeycomb.vppnsh - vppnsh-impl - ${vppnsh.version} - - - io.fd.honeycomb.common - sample-plugin-impl - ${honeycomb.infra.version} - - - io.fd.honeycomb.lcmapi - stream-count-impl - ${honeycomb.infra.version} - - - - diff --git a/vnfs/honeycomb_plugin/sample-distribution/src/main/java/io/fd/honeycomb/tutorial/Main.java b/vnfs/honeycomb_plugin/sample-distribution/src/main/java/io/fd/honeycomb/tutorial/Main.java deleted file mode 100755 index fbcaab89..00000000 --- a/vnfs/honeycomb_plugin/sample-distribution/src/main/java/io/fd/honeycomb/tutorial/Main.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2016 Cisco and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at: - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * Modifications copyright (c) 2019 AT&T Intellectual Property - */ - -package io.fd.honeycomb.vpp.integration.distro; - -import com.google.common.collect.Lists; -import com.google.inject.Module; -import io.fd.honeycomb.lisp.LispModule; -import io.fd.honeycomb.translate.v3po.V3poModule; -import io.fd.honeycomb.vpp.distro.VppCommonModule; -import io.fd.honeycomb.vppnsh.impl.VppNshModule; -import java.util.List; - -public class Main { - - public static void main(String[] args) { - final List sampleModules = Lists.newArrayList(io.fd.honeycomb.infra.distro.Main.BASE_MODULES); - - // All the plugins should be listed here - sampleModules.add(new VppCommonModule()); - sampleModules.add(new V3poModule()); - sampleModules.add(new LispModule()); - sampleModules.add(new VppNshModule()); - sampleModules.add(new io.fd.honeycomb.tutorial.Module()); - sampleModules.add(new io.fd.honeycomb.lcmapi.Module()); - - io.fd.honeycomb.infra.distro.Main.init(sampleModules); - } -} diff --git a/vnfs/honeycomb_plugin/sample_plugin/LICENSE.TXT b/vnfs/honeycomb_plugin/sample_plugin/LICENSE.TXT deleted file mode 100644 index 16285cd2..00000000 --- a/vnfs/honeycomb_plugin/sample_plugin/LICENSE.TXT +++ /dev/null @@ -1,22 +0,0 @@ -/* - * ============LICENSE_START========================================== - * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. - * =================================================================== - * Unless otherwise specified, all software contained herein is - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END============================================ - * - * ECOMP is trademark and service mark of AT&T Intellectual Property. - * - */ diff --git a/vnfs/honeycomb_plugin/sample_plugin/README.md b/vnfs/honeycomb_plugin/sample_plugin/README.md deleted file mode 100755 index 2719e64f..00000000 --- a/vnfs/honeycomb_plugin/sample_plugin/README.md +++ /dev/null @@ -1,16 +0,0 @@ -# Honeycomb plugin for VPP's packet generator plugin - -This plugin provides REST API to enable/disable streams on the VPP's packet generator. - - -Buid instructions: - -From the sample_pluging folder execute: mvn -s settings.xml clean install. - - -Run instruction: - -From the sample_pluging folder execute: ./sample-distribution/target/sample-distribution-1.0.0-hc/sample-distribution-1.0.0/honeycomb - - -In order to allow access to REST API from an external machine, modify the "restconf-binding-address" parameter in sample-distribution/target/sample-distribution-1.0.0-hc/sample-distribution-1.0.0/config/honeycomb.json diff --git a/vnfs/honeycomb_plugin/sample_plugin/sample-plugin-api/pom.xml b/vnfs/honeycomb_plugin/sample_plugin/sample-plugin-api/pom.xml deleted file mode 100755 index 6f357321..00000000 --- a/vnfs/honeycomb_plugin/sample_plugin/sample-plugin-api/pom.xml +++ /dev/null @@ -1,81 +0,0 @@ - - - - - - - - - io.fd.honeycomb.common - api-parent - 1.16.9 - - - 4.0.0 - sample-plugin-api - bundle - - - - - org.opendaylight.mdsal.model - mdsal-model-artifacts - 0.8.2-Beryllium-SR2 - pom - import - - - - - - - org.opendaylight.mdsal.model - iana-if-type-2014-05-08 - - - org.opendaylight.mdsal.model - ietf-yang-types-20130715 - - - org.opendaylight.mdsal.model - ietf-interfaces - - - org.opendaylight.mdsal.model - ietf-inet-types-2013-07-15 - - - org.opendaylight.mdsal.model - yang-ext - - - - - - - org.apache.maven.plugins - maven-deploy-plugin - - true - - - - - - diff --git a/vnfs/honeycomb_plugin/sample_plugin/sample-plugin-api/src/main/yang/sample-plugin.yang b/vnfs/honeycomb_plugin/sample_plugin/sample-plugin-api/src/main/yang/sample-plugin.yang deleted file mode 100755 index df929782..00000000 --- a/vnfs/honeycomb_plugin/sample_plugin/sample-plugin-api/src/main/yang/sample-plugin.yang +++ /dev/null @@ -1,77 +0,0 @@ -//*************************************************************// -// -// Copyright © 2017 AT&T Intellectual Property. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//****************************************************************** - - -module sample-plugin { - - yang-version 1; - namespace "urn:opendaylight:params:xml:ns:yang:sample-plugin"; - prefix "sample-plugin"; - - import ietf-inet-types { prefix "inet"; } - - description - "This YANG module defines the generic configuration and - operational data for sample-plugin in VPP"; - - revision "2016-09-18" { - description "Initial revision of sample-plugin model"; - } - - container sample-plugin { - uses sample-plugin-params; - description "Configuration data of sample-plugin in Honeycomb"; - - // READ - // curl -u admin:admin http://localhost:8181/restconf/config/sample-plugin:sample-plugin - - // WRITE - // curl http://localhost:8181/restconf/operational/sample-plugin:sample-plugin - - } - - container sample-plugin-state { - config false; - uses sample-plugin-params; - description "Operational data of sample-plugin persisted in VPP"; - - // READ - // curl -u admin:admin http://localhost:8181/restconf/operational/sample-plugin:sample-plugin-state - } - - grouping sample-plugin-params { - container pg-streams { - list pg-stream { - - key id; - leaf id { - type string; - } - - leaf is-enabled { - type boolean; - } - } - } - } - - notification sample-notification { - leaf content { - type string; - } - } -} diff --git a/vnfs/honeycomb_plugin/sample_plugin/sample-plugin-impl/Readme.adoc b/vnfs/honeycomb_plugin/sample_plugin/sample-plugin-impl/Readme.adoc deleted file mode 100755 index c3ca7940..00000000 --- a/vnfs/honeycomb_plugin/sample_plugin/sample-plugin-impl/Readme.adoc +++ /dev/null @@ -1,3 +0,0 @@ ---Documentation for sample-plugin -- - -TODO Replace with general description whats the purpose of sample-plugin and how it works diff --git a/vnfs/honeycomb_plugin/sample_plugin/sample-plugin-impl/pom.xml b/vnfs/honeycomb_plugin/sample_plugin/sample-plugin-impl/pom.xml deleted file mode 100755 index 84f48b42..00000000 --- a/vnfs/honeycomb_plugin/sample_plugin/sample-plugin-impl/pom.xml +++ /dev/null @@ -1,112 +0,0 @@ - - - - - - - - - io.fd.honeycomb.common - impl-parent - 1.16.9 - - - 4.0.0 - sample-plugin-impl - bundle - - - 1.16.9 - - - - - io.fd.honeycomb.common - sample-plugin-api - ${honeycomb.infra.version} - - - - - io.fd.honeycomb - translate-api - ${honeycomb.infra.version} - - - io.fd.honeycomb.vpp - vpp-translate-utils - 1.16.9 - - - - io.fd.honeycomb - notification-api - ${honeycomb.infra.version} - - - - io.fd.honeycomb - translate-spi - ${honeycomb.infra.version} - - - - io.fd.honeycomb - cfg-init - ${honeycomb.infra.version} - - - - - com.google.inject - guice - ${guice.version} - - - net.jmob - guice.conf - ${guice.config.version} - - - com.google.inject.extensions - guice-multibindings - ${guice.version} - - - - - io.fd.vpp - jvpp-core - 16.09 - - - - - - - org.apache.maven.plugins - maven-deploy-plugin - - true - - - - - - diff --git a/vnfs/honeycomb_plugin/sample_plugin/sample-plugin-impl/src/main/java/io/fd/honeycomb/tutorial/Module.java b/vnfs/honeycomb_plugin/sample_plugin/sample-plugin-impl/src/main/java/io/fd/honeycomb/tutorial/Module.java deleted file mode 100755 index 8cd46006..00000000 --- a/vnfs/honeycomb_plugin/sample_plugin/sample-plugin-impl/src/main/java/io/fd/honeycomb/tutorial/Module.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2016 Cisco and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at: - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * Modifications copyright (c) 2017 AT&T Intellectual Property - */ - -package io.fd.honeycomb.tutorial; - -import com.google.inject.AbstractModule; -import com.google.inject.multibindings.Multibinder; -import io.fd.honeycomb.data.init.DataTreeInitializer; -import io.fd.honeycomb.translate.read.ReaderFactory; -import io.fd.honeycomb.translate.v3po.util.NamingContext; -import io.fd.honeycomb.translate.write.WriterFactory; -import io.fd.honeycomb.tutorial.init.ConfigDataInitializer; -//import io.fd.honeycomb.tutorial.read.ModuleStateReaderFactory; -import io.fd.honeycomb.tutorial.write.ModuleWriterFactory; -import net.jmob.guice.conf.core.ConfigurationModule; - -/** - * Module class instantiating sample-plugin plugin components. - */ -public final class Module extends AbstractModule { - - @Override - protected void configure() { - // requests injection of properties - install(ConfigurationModule.create()); - requestInjection(ModuleConfiguration.class); - - // bind naming context instance for reader and writer factories - // the first parameter is artificial name prefix in cases a name needs to be reconstructed for a vxlan tunnel - // that is present in VPP but not in Honeycomb (could be extracted into configuration) - // the second parameter is just the naming context ID (could be extracted into configuration) - binder().bind(NamingContext.class).toInstance(new NamingContext("pgstream", "pgstream-context")); - - // creates reader factory binding - // can hold multiple binding for separate yang modules - // final Multibinder readerFactoryBinder = Multibinder.newSetBinder(binder(), ReaderFactory.class); - // readerFactoryBinder.addBinding().to(ModuleStateReaderFactory.class); - - // create writer factory binding - // can hold multiple binding for separate yang modules - final Multibinder writerFactoryBinder = Multibinder.newSetBinder(binder(), WriterFactory.class); - writerFactoryBinder.addBinding().to(ModuleWriterFactory.class); - - // create initializer binding - // can hold multiple binding for separate yang modules - final Multibinder initializerBinder = - Multibinder.newSetBinder(binder(), DataTreeInitializer.class); - initializerBinder.addBinding().to(ConfigDataInitializer.class); - - // Disable notification producer for now -// Multibinder.newSetBinder(binder(), ManagedNotificationProducer.class).addBinding() -// .to(SampleNotificationProducer.class); - } -} diff --git a/vnfs/honeycomb_plugin/sample_plugin/sample-plugin-impl/src/main/java/io/fd/honeycomb/tutorial/ModuleConfiguration.java b/vnfs/honeycomb_plugin/sample_plugin/sample-plugin-impl/src/main/java/io/fd/honeycomb/tutorial/ModuleConfiguration.java deleted file mode 100755 index ef6be6e2..00000000 --- a/vnfs/honeycomb_plugin/sample_plugin/sample-plugin-impl/src/main/java/io/fd/honeycomb/tutorial/ModuleConfiguration.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2016 Cisco and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at: - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.fd.honeycomb.tutorial; - -import net.jmob.guice.conf.core.BindConfig; -import net.jmob.guice.conf.core.InjectConfig; -import net.jmob.guice.conf.core.Syntax; - -/** - * Class containing static configuration for sample-plugin module,
- * either loaded from property file sample-plugin.json from classpath. - *

- * Further documentation for the configuration injection can be found at: - * https://github.com/yyvess/gconf - */ -@BindConfig(value = "sample-plugin", syntax = Syntax.JSON) -public final class ModuleConfiguration { - - // TODO change the sample property to real plugin configuration - // If there is no such configuration, remove this, sample-plugin.json resource and its wiring from Module class - - /** - * Sample property that's injected from external json configuration file. - */ - @InjectConfig("sample-prop") - public String sampleProp; - - /** - * Constant name used to identify sample-plugin plugin specific components during dependency injection. - */ - public static final String ELEMENT_SERVICE_NAME = "element-service"; -} diff --git a/vnfs/honeycomb_plugin/sample_plugin/sample-plugin-impl/src/main/java/io/fd/honeycomb/tutorial/init/ConfigDataInitializer.java b/vnfs/honeycomb_plugin/sample_plugin/sample-plugin-impl/src/main/java/io/fd/honeycomb/tutorial/init/ConfigDataInitializer.java deleted file mode 100755 index 8a7f4d10..00000000 --- a/vnfs/honeycomb_plugin/sample_plugin/sample-plugin-impl/src/main/java/io/fd/honeycomb/tutorial/init/ConfigDataInitializer.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2016 Cisco and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at: - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.fd.honeycomb.tutorial.init; - -import io.fd.honeycomb.data.init.AbstractDataTreeConverter; -import com.google.inject.Inject; -import com.google.inject.name.Named; -import javax.annotation.Nonnull; -import org.opendaylight.controller.md.sal.binding.api.DataBroker; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.sample.plugin.rev160918.SamplePlugin; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.sample.plugin.rev160918.SamplePluginBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.sample.plugin.rev160918.SamplePluginState; -import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; - -/** - * Initialize configuration data based on operational data. - *

- * Very useful when a plugin is initiated but the underlying layer already contains some operation state. - * Deriving the configuration from existing operational state enables reconciliation in case when Honeycomb's persistence - * is not available to do the work for us. - */ -public final class ConfigDataInitializer extends AbstractDataTreeConverter { - - @Inject - public ConfigDataInitializer(@Named("honeycomb-initializer") @Nonnull final DataBroker bindingDataBroker) { - super(bindingDataBroker, InstanceIdentifier.create(SamplePluginState.class), InstanceIdentifier.create(SamplePlugin.class)); - } - - @Override - public SamplePlugin convert(final SamplePluginState operationalData) { - // Transfer all the operational data into configuration - return new SamplePluginBuilder() - .setPgStreams(operationalData.getPgStreams()) - .build(); - } -} diff --git a/vnfs/honeycomb_plugin/sample_plugin/sample-plugin-impl/src/main/java/io/fd/honeycomb/tutorial/notif/SampleNotificationProducer.java b/vnfs/honeycomb_plugin/sample_plugin/sample-plugin-impl/src/main/java/io/fd/honeycomb/tutorial/notif/SampleNotificationProducer.java deleted file mode 100755 index 6ae1394a..00000000 --- a/vnfs/honeycomb_plugin/sample_plugin/sample-plugin-impl/src/main/java/io/fd/honeycomb/tutorial/notif/SampleNotificationProducer.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (c) 2016 Cisco and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at: - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -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> getNotificationTypes() { - // Producing only this single type of notification - return Collections.singleton(SampleNotification.class); - } - - @Override - public void close() throws Exception { - stop(); - } -} diff --git a/vnfs/honeycomb_plugin/sample_plugin/sample-plugin-impl/src/main/java/io/fd/honeycomb/tutorial/write/ModuleWriterFactory.java b/vnfs/honeycomb_plugin/sample_plugin/sample-plugin-impl/src/main/java/io/fd/honeycomb/tutorial/write/ModuleWriterFactory.java deleted file mode 100755 index ad7669b5..00000000 --- a/vnfs/honeycomb_plugin/sample_plugin/sample-plugin-impl/src/main/java/io/fd/honeycomb/tutorial/write/ModuleWriterFactory.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2016 Cisco and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at: - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * Modifications copyright (c) 2017 AT&T Intellectual Property - */ -package io.fd.honeycomb.tutorial.write; - -import com.google.inject.Inject; -import io.fd.honeycomb.translate.impl.write.GenericWriter; -import io.fd.honeycomb.translate.v3po.util.NamingContext; -import io.fd.honeycomb.translate.write.WriterFactory; -import io.fd.honeycomb.translate.write.registry.ModifiableWriterRegistryBuilder; -import javax.annotation.Nonnull; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.sample.plugin.rev160918.SamplePlugin; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.sample.plugin.rev160918.sample.plugin.params.PgStreams; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.sample.plugin.rev160918.sample.plugin.params.pg.streams.PgStream; -import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import org.openvpp.jvpp.core.future.FutureJVppCore; - -/** - * Factory producing writers for sample-plugin plugin's data. - */ -public final class ModuleWriterFactory implements WriterFactory { - - private static final InstanceIdentifier ROOT_CONTAINER_ID = InstanceIdentifier.create(SamplePlugin.class); - - /** - * Injected vxlan naming context shared with writer, provided by this plugin - */ - @Inject - private NamingContext pgNamingContext; - /** - * Injected jvpp core APIs, provided by Honeycomb's infrastructure - */ - @Inject - private FutureJVppCore jvppCore; - - @Override - public void init(@Nonnull final ModifiableWriterRegistryBuilder registry) { - // Unlike ReaderFactory, there's no need to add structural writers, just the writers that actually do something - - // register writer for vxlan tunnel - registry.add(new GenericWriter<>( - // What part of subtree this writer handles is identified by an InstanceIdentifier - ROOT_CONTAINER_ID.child(PgStreams.class).child(PgStream.class), - // Customizer (the actual translation code to do the heavy lifting) - new PgWriteCustomizer(jvppCore, pgNamingContext))); - } -} diff --git a/vnfs/honeycomb_plugin/sample_plugin/sample-plugin-impl/src/main/java/io/fd/honeycomb/tutorial/write/PgWriteCustomizer.java b/vnfs/honeycomb_plugin/sample_plugin/sample-plugin-impl/src/main/java/io/fd/honeycomb/tutorial/write/PgWriteCustomizer.java deleted file mode 100755 index 7a146f6c..00000000 --- a/vnfs/honeycomb_plugin/sample_plugin/sample-plugin-impl/src/main/java/io/fd/honeycomb/tutorial/write/PgWriteCustomizer.java +++ /dev/null @@ -1,155 +0,0 @@ -/* - * Copyright (c) 2016 Cisco and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at: - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - /* - * Modifications copyright (c) 2017 AT&T Intellectual Property - */ - -package io.fd.honeycomb.tutorial.write; - -import io.fd.honeycomb.translate.spi.write.ListWriterCustomizer; -import io.fd.honeycomb.translate.v3po.util.NamingContext; -import io.fd.honeycomb.translate.v3po.util.TranslateUtils; -import io.fd.honeycomb.translate.write.WriteContext; -import io.fd.honeycomb.translate.write.WriteFailedException; -import javax.annotation.Nonnull; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.sample.plugin.rev160918.sample.plugin.params.pg.streams.PgStream; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.sample.plugin.rev160918.sample.plugin.params.pg.streams.PgStreamKey; -import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import org.openvpp.jvpp.VppBaseCallException; -import org.openvpp.jvpp.core.dto.PgEnableDisable; -import org.openvpp.jvpp.core.dto.PgEnableDisableReply; -import org.openvpp.jvpp.core.future.FutureJVppCore; - -import java.util.Arrays; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - - -/** - * Writer for {@link VxlanTunnel} list node from our YANG model. - */ -public final class PgWriteCustomizer implements ListWriterCustomizer { - - - private static final Logger LOG = LoggerFactory.getLogger(PgWriteCustomizer.class); - - /** - * JVpp APIs - */ - private final FutureJVppCore jvppCore; - /** - * Shared vxlan tunnel naming context - */ - private final NamingContext pgStreamNamingContext; - - public PgWriteCustomizer(final FutureJVppCore jvppCore, final NamingContext pgStreamNamingContext) { - this.jvppCore = jvppCore; - this.pgStreamNamingContext = pgStreamNamingContext; - } - - @Override - public void writeCurrentAttributes(@Nonnull final InstanceIdentifier id, - @Nonnull final PgStream dataAfter, - @Nonnull final WriteContext writeContext) throws WriteFailedException { - // Create and set vxlan tunnel add request - final PgEnableDisable pgEnableDisable = new PgEnableDisable(); - // 1 for add, 0 for delete - //look into this file: ~/vpp/build-root/build-vpp-native/vpp-api/java/jvpp-core/org/openvpp/jvpp/core/dto/PgEnableDisable.java - pgEnableDisable.isEnabled = 1;//public byte - String sName = dataAfter.getId(); - //pgEnableDisable.streamName = sName.getBytes();//public byte[] - byte[] tempArray = sName.getBytes(); - LOG.info("Going to copy array!!!"); - String tempMsg = ""; - pgEnableDisable.streamName = new byte[tempArray.length+1]; - for(int i = 0; i < tempArray.length; i++){ - tempMsg = "copying: i= "+i+" value: "+tempArray[i]; - LOG.info(tempMsg); - pgEnableDisable.streamName[i] = tempArray[i]; - } - - //System.arraycopy( sName.getBytes(), 0, pgEnableDisable.streamName, 0, sName.length()); - pgEnableDisable.streamNameLength = sName.length() + 1;//public int - String logMsg = "######***** Enabling: "+sName+" len: "+sName.length()+" getBytes:" + Arrays.toString(pgEnableDisable.streamName); - LOG.info(logMsg); - // dataAfter is the new vxlanTunnel configuration - //final boolean isIpv6 = dataAfter.getSrc().getIpv6Address() != null; - //vxlanAddDelTunnel.isIpv6 = TranslateUtils.booleanToByte(isIpv6); - //vxlanAddDelTunnel.srcAddress = TranslateUtils.ipAddressToArray(isIpv6, dataAfter.getSrc()); - //vxlanAddDelTunnel.dstAddress = TranslateUtils.ipAddressToArray(isIpv6, dataAfter.getDst()); - // There are other input parameters that are not exposed by our YANG model, default values will be used - - try { - final PgEnableDisableReply replyForWrite = TranslateUtils - .getReplyForWrite(jvppCore.pgEnableDisable(pgEnableDisable).toCompletableFuture(), id); - - // VPP returns the index of new vxlan tunnel - //final int newVxlanTunnelIndex = replyForWrite.swIfIndex; - // It's important to store it in context so that reader knows to which name a vxlan tunnel is mapped - pgStreamNamingContext.addName(1, dataAfter.getId(), writeContext.getMappingContext()); - } catch (VppBaseCallException e) { - throw new WriteFailedException.CreateFailedException(id, dataAfter, e); - } - } - - @Override - public void updateCurrentAttributes(@Nonnull final InstanceIdentifier id, - @Nonnull final PgStream dataBefore, - @Nonnull final PgStream dataAfter, @Nonnull final WriteContext writeContext) - throws WriteFailedException { - // Not supported at VPP API level, throw exception - throw new WriteFailedException.UpdateFailedException(id, dataBefore, dataAfter, - new UnsupportedOperationException("Vxlan tunnel update is not supported by VPP")); - } - - @Override - public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier id, - @Nonnull final PgStream dataBefore, - @Nonnull final WriteContext writeContext) throws WriteFailedException { - // Create and set vxlan tunnel add request - //final VxlanAddDelTunnel vxlanAddDelTunnel = new VxlanAddDelTunnel(); - final PgEnableDisable pgEnableDisable = new PgEnableDisable(); - // 1 for add, 0 for delete - //vxlanAddDelTunnel.isAdd = 0; - pgEnableDisable.isEnabled = 0;//public byte - - String sName = dataBefore.getId(); - pgEnableDisable.streamName = sName.getBytes();//public byte[] - pgEnableDisable.streamNameLength = sName.length()+1;//public int - - String logMsg1 = "***** Disabling: "+sName+" len: "+sName.length()+" getBytes:" + Arrays.toString(pgEnableDisable.streamName); - LOG.info(logMsg1); - // Vxlan tunnel is identified by its attributes when deleting, not index, so set all attributes - // dataBefore is the vxlan tunnel that's being deleted - //final boolean isIpv6 = dataBefore.getSrc().getIpv6Address() != null; - //vxlanAddDelTunnel.isIpv6 = TranslateUtils.booleanToByte(isIpv6); - //vxlanAddDelTunnel.srcAddress = TranslateUtils.ipAddressToArray(isIpv6, dataBefore.getSrc()); - //vxlanAddDelTunnel.dstAddress = TranslateUtils.ipAddressToArray(isIpv6, dataBefore.getDst()); - // There are other input parameters that are not exposed by our YANG model, default values will be used - - try { - // final VxlanAddDelTunnelReply replyForWrite = TranslateUtils - // .getReplyForWrite(jvppCore.vxlanAddDelTunnel(vxlanAddDelTunnel).toCompletableFuture(), id); - final PgEnableDisableReply replyForWrite = TranslateUtils - .getReplyForWrite(jvppCore.pgEnableDisable(pgEnableDisable).toCompletableFuture(), id); - // It's important to remove the mapping from context - pgStreamNamingContext.removeName(dataBefore.getId(), writeContext.getMappingContext()); - } catch (VppBaseCallException e) { - throw new WriteFailedException.DeleteFailedException(id, e); - } - } -} -- cgit 1.2.3-korg