<artifactId>hwvtepsouthbound-impl</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>hwvtepsouthbound-impl</artifactId>
- <version>${project.version}</version>
- <type>xml</type>
- <classifier>config</classifier>
- </dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>hwvtepsouthbound-api</artifactId>
<!--<bundle>mvn:com.fasterxml.jackson.datatype/jackson-datatype-json-org/{{VERSION}}</bundle>-->
<bundle>wrap:mvn:org.json/json/{{VERSION}}</bundle>
<feature version='${project.version}'>odl-ovsdb-library</feature>
- <configfile finalname="${configfile.directory}/hwvtepsouthbound.xml">mvn:org.opendaylight.ovsdb/hwvtepsouthbound-impl/{{VERSION}}/xml/config</configfile>
</feature>
<feature name='odl-ovsdb-hwvtepsouthbound-rest' version='${project.version}' description='OpenDaylight :: hwvtepsouthbound :: REST'>
<feature version="${project.version}">odl-ovsdb-hwvtepsouthbound</feature>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- vi: set et smarttab sw=4 tabstop=4: -->
-<!--
-Copyright (c) 2015 Ericsson India Global Services Pvt Ltd. 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>
- <!-- <capability>urn:opendaylight:params:xml:ns:yang:hwvtepsouthbound:impl?module=hwvtepsouthbound-impl&revision=2015-09-01</capability> -->
- <capability>urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding?module=opendaylight-md-sal-binding&revision=2013-10-28</capability>
- <capability>urn:opendaylight:params:xml:ns:yang:library:impl?module=library&revision=2014-12-10</capability>
- </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:hwvtepsouthbound:impl">prefix:hwvtepsouthbound</type>
- <name>hwvtepsouthbound-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>
- <schema-service>
- <type xmlns:dom="urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom">dom:schema-service</type>
- <name>yang-schema-service</name>
- </schema-service>
- <binding-normalized-node-serializer>
- <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-normalized-node-serializer</type>
- <name>runtime-mapping-singleton</name>
- </binding-normalized-node-serializer>
- <clustering-entity-ownership-service>
- <type xmlns:ns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:core:spi:entity-ownership-service">ns:entity-ownership-service</type>
- <name>entity-ownership-service</name>
- </clustering-entity-ownership-service>
- <connection-service>
- <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:library:impl">prefix:connection-service</type>
- <name>connection-service</name>
- </connection-service>
- </module>
- </modules>
- </data>
- </configuration>
-</snapshot>
import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
import org.opendaylight.controller.sal.binding.api.BindingAwareProvider;
+import org.opendaylight.controller.sal.core.api.model.SchemaService;
import org.opendaylight.ovsdb.hwvtepsouthbound.transactions.md.TransactionInvoker;
import org.opendaylight.ovsdb.hwvtepsouthbound.transactions.md.TransactionInvokerImpl;
import org.opendaylight.ovsdb.lib.OvsdbConnection;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyBuilder;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey;
+import org.opendaylight.yangtools.binding.data.codec.api.BindingNormalizedNodeSerializer;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.common.base.Optional;
import com.google.common.util.concurrent.CheckedFuture;
-public class HwvtepSouthboundProvider implements BindingAwareProvider, AutoCloseable {
+public class HwvtepSouthboundProvider implements AutoCloseable {
private static final Logger LOG = LoggerFactory.getLogger(HwvtepSouthboundProvider.class);
private static final String ENTITY_TYPE = "ovsdb-hwvtepsouthbound-provider";
}
private static DataBroker db;
+ private final EntityOwnershipService entityOwnershipService;
+ private final OvsdbConnection ovsdbConnection;
+
private HwvtepConnectionManager cm;
- private OvsdbConnection ovsdbConnection;
private TransactionInvoker txInvoker;
- private EntityOwnershipService entityOwnershipService;
private EntityOwnershipCandidateRegistration registration;
private HwvtepsbPluginInstanceEntityOwnershipListener providerOwnershipChangeListener;
private HwvtepDataChangeListener hwvtepDTListener;
- public HwvtepSouthboundProvider(
- EntityOwnershipService entityOwnershipServiceDependency,
- OvsdbConnection ovsdbConnection) {
+ public HwvtepSouthboundProvider(final DataBroker dataBroker,
+ final EntityOwnershipService entityOwnershipServiceDependency,
+ final OvsdbConnection ovsdbConnection,
+ final SchemaService schemaService,
+ final BindingNormalizedNodeSerializer bindingNormalizedNodeSerializer) {
+ this.db = dataBroker;
this.entityOwnershipService = entityOwnershipServiceDependency;
registration = null;
this.ovsdbConnection = ovsdbConnection;
+
+ HwvtepSouthboundUtil.setInstanceIdentifierCodec(new InstanceIdentifierCodec(schemaService,
+ bindingNormalizedNodeSerializer));
LOG.info("HwvtepSouthboundProvider ovsdbConnectionService: {}", ovsdbConnection);
}
- @Override
- public void onSessionInitiated(ProviderContext session) {
+ /**
+ * Used by blueprint when starting the container.
+ */
+ public void init() {
LOG.info("HwvtepSouthboundProvider Session Initiated");
- db = session.getSALService(DataBroker.class);
txInvoker = new TransactionInvokerImpl(db);
cm = new HwvtepConnectionManager(db, txInvoker, entityOwnershipService);
hwvtepDTListener = new HwvtepDataChangeListener(db, cm);
+++ /dev/null
-/*
- * Copyright (c) 2015 Ericsson India Global Services Pvt Ltd. 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.hwvtepsouthbound.impl.rev150901;
-
-import org.opendaylight.ovsdb.hwvtepsouthbound.HwvtepSouthboundProvider;
-import org.opendaylight.ovsdb.hwvtepsouthbound.HwvtepSouthboundUtil;
-import org.opendaylight.ovsdb.hwvtepsouthbound.InstanceIdentifierCodec;
-
-public class HwvtepSouthboundModule extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.hwvtepsouthbound.impl.rev150901.AbstractHwvtepSouthboundModule {
- public HwvtepSouthboundModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
- super(identifier, dependencyResolver);
- }
-
- public HwvtepSouthboundModule(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.hwvtepsouthbound.impl.rev150901.HwvtepSouthboundModule 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() {
- HwvtepSouthboundUtil.setInstanceIdentifierCodec(new InstanceIdentifierCodec(getSchemaServiceDependency(),
- getBindingNormalizedNodeSerializerDependency()));
- HwvtepSouthboundProvider provider = new HwvtepSouthboundProvider(getClusteringEntityOwnershipServiceDependency(),
- getConnectionServiceDependency());
- getBrokerDependency().registerProvider(provider);
- return provider;
- }
-
-}
+++ /dev/null
-/*
-* Generated file
-*
-* Generated from: yang module name: hwvtepsouthbound-impl yang module local name: hwvtepsouthbound
-* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
-* Generated at: Tue Sep 01 21:41:01 IST 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.hwvtepsouthbound.impl.rev150901;
-public class HwvtepSouthboundModuleFactory extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.hwvtepsouthbound.impl.rev150901.AbstractHwvtepSouthboundModuleFactory {
-
-}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
+ odl:use-default-for-reference-types="true">
+
+ <reference id="dataBroker"
+ interface="org.opendaylight.controller.md.sal.binding.api.DataBroker"
+ odl:type="default" />
+ <reference id="eos"
+ interface="org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipService" />
+ <reference id="ovsdbConnection" interface="org.opendaylight.ovsdb.lib.OvsdbConnection" />
+ <reference id="schemaService"
+ interface="org.opendaylight.controller.sal.core.api.model.SchemaService" />
+ <reference id="bindingNormalizedNodeSerializer"
+ interface="org.opendaylight.yangtools.binding.data.codec.api.BindingNormalizedNodeSerializer" />
+
+ <bean id="hwvtepProvider"
+ class="org.opendaylight.ovsdb.hwvtepsouthbound.HwvtepSouthboundProvider"
+ init-method="init" destroy-method="close">
+ <argument ref="dataBroker" />
+ <argument ref="eos" />
+ <argument ref="ovsdbConnection" />
+ <argument ref="schemaService" />
+ <argument ref="bindingNormalizedNodeSerializer" />
+ </bean>
+
+</blueprint>
+++ /dev/null
-module hwvtepsouthbound-impl {
- yang-version 1;
- namespace "urn:opendaylight:params:xml:ns:yang:hwvtepsouthbound:impl";
- prefix "hwvtepsouthbound-impl";
-
- import config { prefix config; revision-date 2013-04-05; }
- import opendaylight-md-sal-binding { prefix md-sal-binding; revision-date 2013-10-28;}
- import opendaylight-entity-ownership-service {prefix eos; revision-date 2015-08-10;}
- import opendaylight-md-sal-dom {prefix dom; revision-date 2013-10-28;}
- import library { prefix library; revision-date 2014-12-10; }
-
- description
- "Service definition for hwvtepsouthbound project";
-
- revision "2015-09-01" {
- description
- "Initial revision";
- }
-
- identity hwvtepsouthbound {
- base config:module-type;
- config:java-name-prefix HwvtepSouthbound;
- }
-
- augment "/config:modules/config:module/config:configuration" {
- case hwvtepsouthbound {
- when "/config:modules/config:module/config:type = 'hwvtepsouthbound'";
- container broker {
- uses config:service-ref {
- refine type {
- mandatory true;
- config:required-identity md-sal-binding:binding-broker-osgi-registry;
- }
- }
- }
- container schema-service {
- uses config:service-ref {
- refine type {
- mandatory false;
- config:required-identity dom:schema-service;
- }
- }
- }
- container clustering-entity-ownership-service {
- uses config:service-ref {
- refine type {
- mandatory true;
- config:required-identity eos:entity-ownership-service;
- }
- }
- }
- container binding-normalized-node-serializer {
- uses config:service-ref {
- refine type {
- mandatory true;
- config:required-identity md-sal-binding:binding-normalized-node-serializer;
- }
- }
- }
- container connection-service {
- uses config:service-ref {
- refine type {
- mandatory true;
- config:required-identity library:connection-service;
- }
- }
- }
- }
- }
-}
+++ /dev/null
-/*
- * Copyright (c) 2015 Ericsson India Global Services Pvt Ltd. 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.hwvtepsouthbound.impl.rev150901;
-
-import org.junit.Test;
-
-public class HwvtepSouthboundModuleFactoryTest {
- @Test
- public void testFactoryConstructor() {
- // ensure no exceptions on construction
- new HwvtepSouthboundModuleFactory();
- }
-}
+++ /dev/null
-/*
- * Copyright (c) 2015 Ericsson India Global Services Pvt Ltd. 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.hwvtepsouthbound.impl.rev150901;
-
-import org.junit.Ignore;
-import org.junit.Test;
-import org.opendaylight.controller.config.api.DependencyResolver;
-import org.opendaylight.controller.config.api.JmxAttribute;
-import org.opendaylight.controller.config.api.ModuleIdentifier;
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
-import org.opendaylight.ovsdb.hwvtepsouthbound.HwvtepSouthboundProvider;
-
-import javax.management.ObjectName;
-
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.eq;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-public class HwvtepSouthboundModuleTest {
- @Test
- public void testCustomValidation() {
- HwvtepSouthboundModule module = new HwvtepSouthboundModule(mock(ModuleIdentifier.class), mock(DependencyResolver.class));
-
- // ensure no exceptions on validation
- // currently this method is empty
- module.customValidation();
- }
-
- //TODO: Ignore for now, will be replaced with better UT
- @Ignore
- @Test
- public void testCreateInstance() throws Exception {
- // configure mocks
- DependencyResolver dependencyResolver = mock(DependencyResolver.class);
- BindingAwareBroker broker = mock(BindingAwareBroker.class);
- when(dependencyResolver.resolveInstance(eq(BindingAwareBroker.class), any(ObjectName.class), any(JmxAttribute.class))).thenReturn(broker);
-
- // create instance of module with injected mocks
- HwvtepSouthboundModule module = new HwvtepSouthboundModule(mock(ModuleIdentifier.class), dependencyResolver);
-
- // getInstance calls resolveInstance to get the broker dependency and then calls createInstance
- AutoCloseable closeable = module.getInstance();
-
- // verify that the module registered the returned provider with the broker
- verify(broker).registerProvider((HwvtepSouthboundProvider)closeable);
-
- // ensure no exceptions on close
- closeable.close();
- }
-}