BUG 2743 - Added support for runtime RPC's to netconf mdsal northbound.
[controller.git] / opendaylight / netconf / mdsal-netconf-connector / src / main / java / org / opendaylight / controller / netconf / mdsal / connector / OperationProvider.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8
9 package org.opendaylight.controller.netconf.mdsal.connector;
10
11 import com.google.common.collect.Sets;
12 import java.util.Set;
13 import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
14 import org.opendaylight.controller.md.sal.dom.api.DOMRpcService;
15 import org.opendaylight.controller.netconf.mapping.api.NetconfOperation;
16 import org.opendaylight.controller.netconf.mdsal.connector.ops.Commit;
17 import org.opendaylight.controller.netconf.mdsal.connector.ops.DiscardChanges;
18 import org.opendaylight.controller.netconf.mdsal.connector.ops.EditConfig;
19 import org.opendaylight.controller.netconf.mdsal.connector.ops.Lock;
20 import org.opendaylight.controller.netconf.mdsal.connector.ops.RuntimeRpc;
21 import org.opendaylight.controller.netconf.mdsal.connector.ops.Unlock;
22 import org.opendaylight.controller.netconf.mdsal.connector.ops.get.Get;
23 import org.opendaylight.controller.netconf.mdsal.connector.ops.get.GetConfig;
24
25 final class OperationProvider {
26
27     private final String netconfSessionIdForReporting;
28     private final CurrentSchemaContext schemaContext;
29     private final DOMDataBroker dataBroker;
30     private final DOMRpcService rpcService;
31     private final TransactionProvider transactionProvider;
32
33     public OperationProvider(final String netconfSessionIdForReporting, final CurrentSchemaContext schemaContext,
34                              final DOMDataBroker dataBroker, final DOMRpcService rpcService) {
35         this.netconfSessionIdForReporting = netconfSessionIdForReporting;
36         this.schemaContext = schemaContext;
37         this.dataBroker = dataBroker;
38         this.rpcService = rpcService;
39         this.transactionProvider = new TransactionProvider(this.dataBroker, netconfSessionIdForReporting);
40     }
41
42     Set<NetconfOperation> getOperations() {
43         return Sets.<NetconfOperation>newHashSet(
44                 new Commit(netconfSessionIdForReporting, transactionProvider),
45                 new DiscardChanges(netconfSessionIdForReporting, transactionProvider),
46                 new EditConfig(netconfSessionIdForReporting, schemaContext, transactionProvider),
47                 new Get(netconfSessionIdForReporting, schemaContext, transactionProvider),
48                 new GetConfig(netconfSessionIdForReporting, schemaContext, transactionProvider),
49                 new Lock(netconfSessionIdForReporting),
50                 new Unlock(netconfSessionIdForReporting),
51                 new RuntimeRpc(netconfSessionIdForReporting, schemaContext, rpcService)
52         );
53     }
54
55 }