summaryrefslogtreecommitdiffstats
path: root/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-impl/src/main
diff options
context:
space:
mode:
authorMarco Platania <platania@research.att.com>2018-03-16 16:31:33 -0400
committerMarco Platania <platania@research.att.com>2018-03-16 16:31:33 -0400
commit2a759ffd2f6a4cd692fcc333ac87fd8921a5c936 (patch)
tree93f1bf1f259e4443ae0dea903710679e59f27353 /vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-impl/src/main
parent4a76de616e000bdfcf25262bf09cfa373c6226af (diff)
Add health check to vLBMS
- Add health check to VNF components for vLB manual scale out - Update POM tree Change-Id: Id348d0cb56adf052694c6e8682b499eb1ac24af1 Issue-ID: INT-433 Signed-off-by: Marco Platania <platania@research.att.com>
Diffstat (limited to 'vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-impl/src/main')
-rw-r--r--vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/CrudService.java64
-rw-r--r--vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/ElementCrudService.java114
-rw-r--r--vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/Module.java66
-rw-r--r--vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/ModuleConfiguration.java46
-rw-r--r--vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/write/DnsInstanceManager.java142
-rw-r--r--vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/write/ElementCustomizer.java73
-rw-r--r--vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/write/ModuleWriterFactory.java54
7 files changed, 0 insertions, 559 deletions
diff --git a/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/CrudService.java b/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/CrudService.java
deleted file mode 100644
index 1e7be67b..00000000
--- a/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/CrudService.java
+++ /dev/null
@@ -1,64 +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 org.onap.vnf.vlb;
-
-import io.fd.honeycomb.translate.read.ReadFailedException;
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import java.util.List;
-import javax.annotation.Nonnull;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-/**
- * Example of an aggregated access interface.
- * <p/>
- * Shared by all the customizers hiding the ugly details of our data management.
- *
- * TODO update javadoc
- */
-public interface CrudService<T extends DataObject> {
-
- /**
- * Perform write of provided data.
- */
- void writeData(@Nonnull final InstanceIdentifier<T> identifier, @Nonnull final T data)
- throws WriteFailedException;
-
-
- /**
- * Perform delete of existing data.
- */
- void deleteData(@Nonnull final InstanceIdentifier<T> identifier, @Nonnull final T data)
- throws WriteFailedException;
-
- /**
- * Perform update of existing data.
- */
- void updateData(@Nonnull final InstanceIdentifier<T> identifier, @Nonnull final T dataOld,
- @Nonnull final T dataNew)
- throws WriteFailedException;
-
- /**
- * Read data identified by provided identifier.
- */
- T readSpecific(@Nonnull final InstanceIdentifier<T> identifier) throws ReadFailedException;
-
- /**
- * Read all nodes of type {@link T}.
- */
- List<T> readAll() throws ReadFailedException;
-}
diff --git a/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/ElementCrudService.java b/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/ElementCrudService.java
deleted file mode 100644
index d17c6c18..00000000
--- a/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/ElementCrudService.java
+++ /dev/null
@@ -1,114 +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 org.onap.vnf.vlb;
-
-import io.fd.honeycomb.translate.read.ReadFailedException;
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import java.util.Collections;
-import java.util.List;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vlb.business.vnf.onap.plugin.rev160918.VlbBusinessVnfOnapPluginState;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vlb.business.vnf.onap.plugin.rev160918.vlb.business.vnf.onap.plugin.params.VdnsInstances;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vlb.business.vnf.onap.plugin.rev160918.vlb.business.vnf.onap.plugin.params.vdns.instances.VdnsInstance;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vlb.business.vnf.onap.plugin.rev160918.vlb.business.vnf.onap.plugin.params.vdns.instances.VdnsInstanceBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vlb.business.vnf.onap.plugin.rev160918.vlb.business.vnf.onap.plugin.params.vdns.instances.VdnsInstanceKey;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Simple example of class handling Crud operations for plugin.
- * <p/>
- * No real handling, serves just as an illustration.
- *
- * TODO update javadoc
- */
-final class ElementCrudService implements CrudService<VdnsInstance> {
-
- private static final Logger LOG = LoggerFactory.getLogger(ElementCrudService.class);
-
- @Override
- public void writeData(@Nonnull final InstanceIdentifier<VdnsInstance> identifier, @Nonnull final VdnsInstance data)
- throws WriteFailedException {
- if (data != null) {
-
- // identifier.firstKeyOf(SomeClassUpperInHierarchy.class) can be used to identify
- // relationships such as to which parent these data are related to
-
- // Performs any logic needed for persisting such data
- LOG.info("Writing path[{}] / data [{}]", identifier, data);
- } else {
- throw new WriteFailedException.CreateFailedException(identifier, data,
- new NullPointerException("Provided data are null"));
- }
- }
-
- @Override
- public void deleteData(@Nonnull final InstanceIdentifier<VdnsInstance> identifier, @Nonnull final VdnsInstance data)
- throws WriteFailedException {
- if (data != null) {
-
- // identifier.firstKeyOf(SomeClassUpperInHierarchy.class) can be used to identify
- // relationships such as to which parent these data are related to
-
- // Performs any logic needed for persisting such data
- LOG.info("Removing path[{}] / data [{}]", identifier, data);
- } else {
- throw new WriteFailedException.DeleteFailedException(identifier,
- new NullPointerException("Provided data are null"));
- }
- }
-
- @Override
- public void updateData(@Nonnull final InstanceIdentifier<VdnsInstance> identifier, @Nonnull final VdnsInstance dataOld,
- @Nonnull final VdnsInstance dataNew) throws WriteFailedException {
- if (dataOld != null && dataNew != null) {
-
- // identifier.firstKeyOf(SomeClassUpperInHierarchy.class) can be used to identify
- // relationships such as to which parent these data are related to
-
- // Performs any logic needed for persisting such data
- LOG.info("Update path[{}] from [{}] to [{}]", identifier, dataOld, dataNew);
- } else {
- throw new WriteFailedException.DeleteFailedException(identifier,
- new NullPointerException("Provided data are null"));
- }
- }
-
- @Override
- public VdnsInstance readSpecific(@Nonnull final InstanceIdentifier<VdnsInstance> identifier) throws ReadFailedException {
-
- // read key specified in path identifier
- final VdnsInstanceKey key = identifier.firstKeyOf(VdnsInstance.class);
-
- // load data by this key
- // *Key class will always contain key of entity, in this case long value
-
- return new VdnsInstanceBuilder()
- .setIpAddr(key.getIpAddr())
- .setKey(key)
- .setIsEnabled(true)
- .build();
- }
-
- @Override
- public List<VdnsInstance> readAll() throws ReadFailedException {
- // read all data under parent node,in this case {@link ModuleState}
- return Collections.singletonList(
- readSpecific(InstanceIdentifier.create(VlbBusinessVnfOnapPluginState.class).child(VdnsInstances.class).child(VdnsInstance.class, new VdnsInstanceKey(""))));
- }
-}
diff --git a/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/Module.java b/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/Module.java
deleted file mode 100644
index 37506d1e..00000000
--- a/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/Module.java
+++ /dev/null
@@ -1,66 +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 org.onap.vnf.vlb;
-
-import static org.onap.vnf.vlb.ModuleConfiguration.ELEMENT_SERVICE_NAME;
-
-import com.google.inject.AbstractModule;
-import com.google.inject.TypeLiteral;
-import com.google.inject.multibindings.Multibinder;
-import com.google.inject.name.Names;
-//import org.onap.vnf.vlb.read.ModuleStateReaderFactory;
-import org.onap.vnf.vlb.write.ModuleWriterFactory;
-import io.fd.honeycomb.data.init.DataTreeInitializer;
-import io.fd.honeycomb.translate.read.ReaderFactory;
-import io.fd.honeycomb.translate.write.WriterFactory;
-import net.jmob.guice.conf.core.ConfigurationModule;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vlb.business.vnf.onap.plugin.rev160918.vlb.business.vnf.onap.plugin.params.vdns.instances.VdnsInstance;
-
-/**
- * Module class instantiating vlb-business-vnf-onap-plugin plugin components.
- */
-public final class Module extends AbstractModule {
-
- // TODO This initiates all the plugin components, but it still needs to be registered/wired into an integration
- // module producing runnable distributions. There is one such distribution in honeycomb project:
- // vpp-integration/minimal-distribution
- // In order to integrate this plugin with the distribution:
- // 1. Add a dependency on this maven module to the the distribution's pom.xml
- // 2. Add an instance of this module into the distribution in its Main class
-
- @Override
- protected void configure() {
- // requests injection of properties
- install(ConfigurationModule.create());
- requestInjection(ModuleConfiguration.class);
-
- // creates binding for interface implementation by name
- bind(new TypeLiteral<CrudService<VdnsInstance>>(){})
- .annotatedWith(Names.named(ELEMENT_SERVICE_NAME))
- .to(ElementCrudService.class);
-
- // creates reader factory binding
- // can hold multiple binding for separate yang modules
- //final Multibinder<ReaderFactory> 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<WriterFactory> writerFactoryBinder = Multibinder.newSetBinder(binder(), WriterFactory.class);
- writerFactoryBinder.addBinding().to(ModuleWriterFactory.class);
- }
-}
diff --git a/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/ModuleConfiguration.java b/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/ModuleConfiguration.java
deleted file mode 100644
index c2a429ab..00000000
--- a/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/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 org.onap.vnf.vlb;
-
-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 vlb-business-vnf-onap-plugin module,<br>
- * either loaded from property file vlb-business-vnf-onap-plugin.json from classpath.
- * <p/>
- * Further documentation for the configuration injection can be found at:
- * https://github.com/yyvess/gconf
- */
-@BindConfig(value = "vlb-business-vnf-onap-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, vlb-business-vnf-onap-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 vlb-business-vnf-onap-plugin plugin specific components during dependency injection.
- */
- public static final String ELEMENT_SERVICE_NAME = "element-service";
-}
diff --git a/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/write/DnsInstanceManager.java b/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/write/DnsInstanceManager.java
deleted file mode 100644
index dc3e9248..00000000
--- a/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/write/DnsInstanceManager.java
+++ /dev/null
@@ -1,142 +0,0 @@
-
-/*************************************************************************//**
- *
- * Copyright (c) 2018 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.
- *
- ****************************************************************************/
-
-package org.onap.vnf.vlb.write;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- *
- * Class that maintains a map of all the active vDNS instances.
- * A vDNS instance is represented by its IP address and a flag
- * that represents its status, i.e. enabled or disabled.
- *
- * Clients can update the vDNS map via NETCONF or RESTconf.
- * Operations are translated by the Honeycomb agent into a JSON
- * object that is persisted on disk (see Honeycomb distribution
- * configuration for more information). The ElementCustomizer
- * class then updates this map. Each operation results in a vLB
- * setup change, e.g. GRE tunnels that connect the vLB to the
- * vDNS instances are created or deleted, depending on the kind
- * of operation that is invoked. Only vDNS instances for which
- * the isEnabled flag is true are currently served by the vLB.
- *
- * The vLB setup and configuration is executed via shell scripts.
- *
- */
-
-public class DnsInstanceManager {
-
- private static final Logger LOG = LoggerFactory.getLogger(DnsInstanceManager.class);
- private Map<String, Boolean> dnsInstances = new HashMap<String, Boolean>();
-
- /*
- * Add a new DNS instance to the map and create a GRE tunnel
- * towards that instance if isEnabled is set to true.
- */
- void addDnsInstance(String ipAddr, Boolean isEnabled) {
- // Call updateDnsInstance in case the DNS instance already exists.
- // This is somewhat redundant because Honeycomb already runs this check.
- if(dnsInstances.containsKey(ipAddr)) {
- updateDnsInstance(ipAddr, isEnabled);
- return;
- }
-
- dnsInstances.put(ipAddr, isEnabled);
- LOG.debug("DNS instance " + ipAddr + " with status isEnabled=" + isEnabled + " has been added.");
-
- // Create a GRE tunnel towards the new DNS instance if isEnabled is true.
- if(isEnabled) {
- addGreTunnel(ipAddr);
- }
- }
-
- /*
- * Update an existing DNS instance and create or remove a GRE
- * tunnel based on the current value of the isEnabled flag.
- */
- void updateDnsInstance(String ipAddr, Boolean isEnabled) {
- // This is somewhat redundant because Honeycomb already runs this check.
- if(dnsInstances.get(ipAddr) == isEnabled) {
- LOG.debug("DNS instance " + ipAddr + " with status isEnabled=" + isEnabled + " already exists. No update is necessary.");
- return;
- }
-
- dnsInstances.put(ipAddr, isEnabled);
- LOG.debug("DNS instance " + ipAddr + " has been updated with status isEnabled=" + isEnabled + ".");
-
- if(isEnabled) {
- addGreTunnel(ipAddr);
- }
- else {
- deleteGreTunnel(ipAddr);
- }
- }
-
- /*
- * Delete an existing DNS instance from the map and remove the
- * GRE tunnel if isEnabled was set to true.
- */
- void deleteDnsInstance(String ipAddr) {
- // This is somewhat redundant because Honeycomb already runs this check.
- if(!dnsInstances.containsKey(ipAddr)) {
- LOG.debug("DNS instance " + ipAddr + " doesn't exist.");
- return;
- }
-
- // Remove a GRE tunnel towards this DNS instance if it exists.
- if(dnsInstances.get(ipAddr)) {
- deleteGreTunnel(ipAddr);
- }
-
- dnsInstances.remove(ipAddr);
- }
-
- /*
- * Auxiliary function that calls a shell script to create a GRE tunnel towards a new vDNS instance.
- */
- private void addGreTunnel(String ipAddr) {
- String script = new String("bash /opt/add_dns.sh " + ipAddr);
- try {
- Runtime.getRuntime().exec(script);
- LOG.debug("New GRE tunnel towards DNS instance " + ipAddr + " created.");
- } catch (IOException e) {
- LOG.error("add_dns.sh returned an error.");
- e.printStackTrace();
- }
- }
-
- /*
- * Auxiliary function that calls a shell script to delete a GRE tunnel towards a vDNS instance.
- */
- private void deleteGreTunnel(String ipAddr) {
- String script = new String("bash /opt/remove_dns.sh " + ipAddr);
- try {
- Runtime.getRuntime().exec(script);
- LOG.debug("GRE tunnel towards DNS instance " + ipAddr + " removed.");
- } catch (IOException e) {
- LOG.error("remove_dns.sh returned an error.");
- e.printStackTrace();
- }
- }
-}
diff --git a/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/write/ElementCustomizer.java b/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/write/ElementCustomizer.java
deleted file mode 100644
index d8da0b5b..00000000
--- a/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/write/ElementCustomizer.java
+++ /dev/null
@@ -1,73 +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 org.onap.vnf.vlb.write;
-
-import org.onap.vnf.vlb.CrudService;
-import io.fd.honeycomb.translate.spi.write.ListWriterCustomizer;
-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.vlb.business.vnf.onap.plugin.rev160918.vlb.business.vnf.onap.plugin.params.vdns.instances.VdnsInstance;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vlb.business.vnf.onap.plugin.rev160918.vlb.business.vnf.onap.plugin.params.vdns.instances.VdnsInstanceKey;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Writer for {@link Element} list node from our YANG model.
- */
-public final class ElementCustomizer implements ListWriterCustomizer<VdnsInstance, VdnsInstanceKey> {
-
- private final CrudService<VdnsInstance> crudService;
- private DnsInstanceManager dnsInstanceManager;
- private static final Logger LOG = LoggerFactory.getLogger(ElementCustomizer.class);
-
- public ElementCustomizer(@Nonnull final CrudService<VdnsInstance> crudService) {
- this.crudService = crudService;
- dnsInstanceManager = new DnsInstanceManager();
- }
-
- @Override
- public void writeCurrentAttributes(@Nonnull final InstanceIdentifier<VdnsInstance> id, @Nonnull final VdnsInstance dataAfter,
- @Nonnull final WriteContext writeContext) throws WriteFailedException {
- //perform write of data,or throw exception
- //invoked by PUT operation,if provided data doesn't exist in Config data
- crudService.writeData(id, dataAfter);
- dnsInstanceManager.addDnsInstance(dataAfter.getIpAddr(), dataAfter.isIsEnabled());
- }
-
- @Override
- public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<VdnsInstance> id,
- @Nonnull final VdnsInstance dataBefore,
- @Nonnull final VdnsInstance dataAfter, @Nonnull final WriteContext writeContext)
- throws WriteFailedException {
- //perform update of data,or throw exception
- //invoked by PUT operation,if provided data does exist in Config data
- crudService.updateData(id, dataBefore, dataAfter);
- dnsInstanceManager.updateDnsInstance(dataAfter.getIpAddr(), dataAfter.isIsEnabled());
- }
-
- @Override
- public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<VdnsInstance> id,
- @Nonnull final VdnsInstance dataBefore,
- @Nonnull final WriteContext writeContext) throws WriteFailedException {
- //perform delete of data,or throw exception
- //invoked by DELETE operation
- crudService.deleteData(id, dataBefore);
- dnsInstanceManager.deleteDnsInstance(dataBefore.getIpAddr());
- }
-}
diff --git a/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/write/ModuleWriterFactory.java b/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/write/ModuleWriterFactory.java
deleted file mode 100644
index 8be4bb10..00000000
--- a/vnfs/vLBMS/apis/vlb-business-vnf-onap-plugin-impl/src/main/java/org/onap/vnf/vlb/write/ModuleWriterFactory.java
+++ /dev/null
@@ -1,54 +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 org.onap.vnf.vlb.write;
-
-import static org.onap.vnf.vlb.ModuleConfiguration.ELEMENT_SERVICE_NAME;
-
-import com.google.inject.Inject;
-import com.google.inject.name.Named;
-import org.onap.vnf.vlb.CrudService;
-import io.fd.honeycomb.translate.impl.write.GenericWriter;
-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.vlb.business.vnf.onap.plugin.rev160918.VlbBusinessVnfOnapPlugin;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vlb.business.vnf.onap.plugin.rev160918.vlb.business.vnf.onap.plugin.params.VdnsInstances;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vlb.business.vnf.onap.plugin.rev160918.vlb.business.vnf.onap.plugin.params.vdns.instances.VdnsInstance;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-/**
- * Factory producing writers for vlb-business-vnf-onap-plugin plugin's data.
- */
-public final class ModuleWriterFactory implements WriterFactory {
-
- private static final InstanceIdentifier<VlbBusinessVnfOnapPlugin> ROOT_CONTAINER_ID = InstanceIdentifier.create(VlbBusinessVnfOnapPlugin.class);
-
- /**
- * Injected crud service to be passed to customizers instantiated in this factory.
- */
- @Inject
- @Named(ELEMENT_SERVICE_NAME)
- private CrudService<VdnsInstance> crudService;
-
- @Override
- public void init(@Nonnull final ModifiableWriterRegistryBuilder registry) {
-
- //adds writer for child node
- //no need to add writers for empty nodes
- registry.add(new GenericWriter<>(ROOT_CONTAINER_ID.child(VdnsInstances.class).child(VdnsInstance.class), new ElementCustomizer(crudService)));
- }
-}