2 * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.lispflowmapping.config.yang.netconf.impl;
11 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
12 import org.opendaylight.lispflowmapping.netconf.impl.LispDeviceNetconfConnector;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lispflowmapping.netconf.rev140706.LfmNetconfConnectorService;
14 import org.slf4j.Logger;
15 import org.slf4j.LoggerFactory;
17 public class LfmNetconfConnectorProviderModule extends org.opendaylight.lispflowmapping.config.yang.netconf.impl.AbstractLfmNetconfConnectorProviderModule {
18 private static final Logger log = LoggerFactory.getLogger(LfmNetconfConnectorProviderModule.class);
20 public LfmNetconfConnectorProviderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
21 super(identifier, dependencyResolver);
24 public LfmNetconfConnectorProviderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.lispflowmapping.config.yang.netconf.impl.LfmNetconfConnectorProviderModule oldModule, java.lang.AutoCloseable oldInstance) {
25 super(identifier, dependencyResolver, oldModule, oldInstance);
29 public void customValidation() {
30 // add custom validation form module attributes here.
34 public java.lang.AutoCloseable createInstance() {
36 final LispDeviceNetconfConnector lnconfConnector = LispDeviceNetconfConnector.createLispDeviceNetconfConnector();
38 final BindingAwareBroker.RpcRegistration<LfmNetconfConnectorService> rpcRegistration = getRpcRegistryDependency()
39 .addRpcImplementation(LfmNetconfConnectorService.class, lnconfConnector);
42 // Wrap as AutoCloseable and close registrations to md-sal at close()
43 final class AutoCloseableNCC implements AutoCloseable {
46 public void close() throws Exception {
47 rpcRegistration.close();
48 lnconfConnector.close();
49 log.info("Lisp netconf connector (instance {}) torn down.", this);
53 AutoCloseable ret = new AutoCloseableNCC();
54 log.info("Lisp netconf connector provider (instance {}) initialized.", ret);