- try {
- return new NetconfOperationServiceImpl(yangStoreService, jmxClient, netconfSessionIdForReporting);
- } catch (YangStoreException e) {
- throw new IllegalStateException(e);
+ return new NetconfOperationServiceImpl(yangStoreService, jmxClient, netconfSessionIdForReporting);
+ }
+
+
+ @Override
+ public Set<Capability> getCapabilities() {
+ return setupCapabilities(yangStoreService);
+ }
+
+ @Override
+ public AutoCloseable registerCapabilityListener(final CapabilityListener listener) {
+ return yangStoreService.registerCapabilityListener(listener);
+ }
+
+ public static Set<Capability> setupCapabilities(final YangStoreContext yangStoreSnapshot) {
+ Set<Capability> capabilities = new HashSet<>();
+ // [RFC6241] 8.3. Candidate Configuration Capability
+ capabilities.add(new BasicCapability("urn:ietf:params:netconf:capability:candidate:1.0"));
+
+ // TODO rollback on error not supported EditConfigXmlParser:100
+ // [RFC6241] 8.5. Rollback-on-Error Capability
+ // capabilities.add(new BasicCapability("urn:ietf:params:netconf:capability:rollback-on-error:1.0"));
+
+ Set<Module> modules = yangStoreSnapshot.getModules();
+ for (Module module : modules) {
+ capabilities.add(new YangModuleCapability(module, yangStoreSnapshot.getModuleSource(module)));