3 This project is used to simulate NetConf devices in order to test NetConf
4 south-bound plugin and applications using this plugin. *netconf-testtool*
5 project is designed as versatile java library to be used for custom NetConf device
8 ## How to use as standalone application
10 * start org.opendaylight.netconf.test.tool.Main
12 ## How to use it in your code
13 * Use maven dependency in your project
16 <groupId>org.opendaylight.netconf</groupId>
17 <artifactId>netconf-testtool-core</artifactId>
18 <version>0.1.0-SNAPSHOT</version>
21 * Prepare configuration - models are loaded by classloader
24 Set<String> models = ImmutableSet.of(
25 "models/iana-afn-safi@2013-07-04.yang",
26 "models/ietf-inet-types@2013-07-15.yang",
27 "models/ietf-netconf@2011-06-01.yang",
28 "models/ietf-netconf-monitoring@2010-10-04.yang",
29 "models/ietf-netconf-monitoring-extension@2013-12-10.yang",
30 "models/ietf-yang-library@2016-06-21.yang",
31 "models/ietf-yang-types@2013-07-15.yang",
32 "models/nc-notifications@2008-07-14.yang",
33 "models/notifications@2008-07-14.yang",
37 * Prepare list of capabilities
39 Set<String> capabilities = ImmutableSet.of(
40 "urn:ietf:params:netconf:base:1.0",
41 "urn:ietf:params:netconf:base:1.1",
45 * Override RPC mapping provider org.opendaylight.netconf.test.tool.rpchandler.RpcHandler
47 public class RpcHandlerImpl implements RpcHandler {
49 public Optional<Document> getResponse(XmlElement rpcElement) {
56 * Override operations creator org.opendaylight.netconf.test.tool.operations.OperationsCreator
57 in order to inject custom simulated behavior.
59 public class OperationsCreatorImpl implements OperationsCreator {
61 public NetconfOperationService getNetconfOperationService(Set<Capability> capabilities,
62 SessionIdProvider idProvider,
63 String netconfSessionIdForReporting) {
65 return netconfOperationService;
69 * Start NetConf device simulator in your code
73 public static void main(String[] args) {
74 Configuration configuration = new ConfigurationBuilder()
76 .setCapabilities(capabilities)
77 .setRpcHandler(new RpcHandlerImpl())
78 .setOperationsCreator(new OperationsCreatorImpl());
80 NetConfDeviceSimulator netConfDeviceSimulator =
81 new NetConfDeviceSimulator(configuration);
82 netConfDeviceSimulator.start();