}
LOG.trace("Datastore {} committed successfully: {}", Datastore.candidate, status);
- return XmlUtil.createElement(document, XmlNetconfConstants.OK, Optional.<String>absent());
+ return XmlUtil.createElement(document, XmlNetconfConstants.OK, Optional.absent());
}
}
LOG.trace("Changes discarded successfully from datastore {}", Datastore.candidate);
- return XmlUtil.createElement(document, XmlNetconfConstants.OK, Optional.<String>absent());
+ return XmlUtil.createElement(document, XmlNetconfConstants.OK, Optional.absent());
}
}
// Since candidate datastore instances are allocated per session and not accessible anywhere else, no need to lock
LOG.debug("Locking {} datastore on session: {}", targetDatastore, getNetconfSessionIdForReporting());
// TODO should this fail if we are already locked ?
- return XmlUtil.createElement(document, XmlNetconfConstants.OK, Optional.<String>absent());
+ return XmlUtil.createElement(document, XmlNetconfConstants.OK, Optional.absent());
}
// Not supported running lock
// Since candidate datastore instances are allocated per session and not accessible anywhere else, no need to lock
LOG.debug("Unlocking {} datastore on session: {}", targetDatastore, getNetconfSessionIdForReporting());
// TODO this should fail if we are not locked
- return XmlUtil.createElement(document, XmlNetconfConstants.OK, Optional.<String>absent());
+ return XmlUtil.createElement(document, XmlNetconfConstants.OK, Optional.absent());
}
// Not supported running lock
LOG.trace("Datastore {} validated successfully", Datastore.candidate);
- return XmlUtil.createElement(document, XmlNetconfConstants.OK, Optional.<String>absent());
+ return XmlUtil.createElement(document, XmlNetconfConstants.OK, Optional.absent());
}
}
private static final Logger LOG = LoggerFactory.getLogger(EditConfig.class);
- private EditConfigXmlParser editConfigXmlParser;
+ private final EditConfigXmlParser editConfigXmlParser;
public EditConfig(final ConfigSubsystemFacade configSubsystemFacade, final String netconfSessionIdForReporting) {
super(configSubsystemFacade, netconfSessionIdForReporting);
@Override
protected Element handleWithNoSubsequentOperations(Document document, XmlElement xml) throws DocumentedException {
- ConfigExecution configExecution;
// FIXME config mapping getter works on dynamic yang store service and so does later executeConfigExecution method
// They might have different view of current yangs in ODL and might cause race conditions
Config cfg = getConfigSubsystemFacade().getConfigMapping();
- configExecution = editConfigXmlParser.fromXml(xml, cfg);
+ ConfigExecution configExecution = editConfigXmlParser.fromXml(xml, cfg);
return getResponseInternal(document, configExecution);
}
XmlElement sourceNode = sourceElement.getOnlyChildElement();
String sourceParsed = sourceNode.getName();
LOG.debug("Setting source datastore to '{}'", sourceParsed);
- Datastore sourceDatastore = Datastore.valueOf(sourceParsed);
// Filter option: ignore for now, TODO only load modules specified by the filter
- return sourceDatastore;
+ return Datastore.valueOf(sourceParsed);
}
@Override
public HandlingPriority canHandle(Document message) throws DocumentedException {
- XmlElement requestElement = null;
- requestElement = getRequestElementWithCheck(message);
+ XmlElement requestElement = getRequestElementWithCheck(message);
XmlElement operationElement = requestElement.getOnlyChildElement();
final String netconfOperationName = operationElement.getName();
execution.getOn(), execution.getAttributes(), result);
if (execution.isVoid()) {
- return XmlUtil.createElement(document, XmlNetconfConstants.OK, Optional.<String>absent());
+ return XmlUtil.createElement(document, XmlNetconfConstants.OK, Optional.absent());
} else {
return getConfigSubsystemFacade().getRpcFacade().toXml(document, result, execution);
}
String netconfSessionIdForReporting) {
Set<NetconfOperation> ops = Sets.newHashSet();
- GetConfig getConfigOp = new GetConfig(configSubsystemFacade, Optional.<String> absent(), netconfSessionIdForReporting);
+ GetConfig getConfigOp = new GetConfig(configSubsystemFacade, Optional.absent(), netconfSessionIdForReporting);
ops.add(getConfigOp);
ops.add(new EditConfig(configSubsystemFacade, netconfSessionIdForReporting));
import java.util.Set;
import org.opendaylight.controller.config.facade.xml.ConfigSubsystemFacadeFactory;
import org.opendaylight.controller.config.util.capability.Capability;
-import org.opendaylight.controller.config.util.capability.ModuleListener;
import org.opendaylight.netconf.api.monitoring.CapabilityListener;
import org.opendaylight.netconf.mapping.api.NetconfOperationServiceFactory;
@Override
public AutoCloseable registerCapabilityListener(final CapabilityListener listener) {
- return configFacadeFactory.getYangStoreService().registerModuleListener(new ModuleListener() {
- @Override
- public void onCapabilitiesChanged(Set<Capability> added, Set<Capability> removed) {
- listener.onCapabilitiesChanged(added, removed);
- }
- });
+ return configFacadeFactory.getYangStoreService().registerModuleListener(listener::onCapabilitiesChanged);
}
}
public class NetconfOperationServiceImpl implements NetconfOperationService {
private final NetconfOperationProvider operationProvider;
- private ConfigSubsystemFacade configSubsystemFacade;
+ private final ConfigSubsystemFacade configSubsystemFacade;
public NetconfOperationServiceImpl(final ConfigSubsystemFacade configSubsystemFacade,
final String netconfSessionIdForReporting) {
this.configSubsystemFacade = configSubsystemFacade;
- operationProvider = new NetconfOperationProvider(configSubsystemFacade, netconfSessionIdForReporting);
+ this.operationProvider = new NetconfOperationProvider(configSubsystemFacade, netconfSessionIdForReporting);
}
@Override
<dependency>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>yang-data-impl</artifactId>
-
- <!-- FIXME: this should not be necessary and it hurts shareability -->
- <exclusions>
- <exclusion>
- <groupId>org.opendaylight.yangtools</groupId>
- <artifactId>object-cache-api</artifactId>
- </exclusion>
- </exclusions>
</dependency>
<dependency>
<groupId>org.opendaylight.yangtools</groupId>
import org.opendaylight.yangtools.yang.model.repo.spi.SchemaSourceProvider;
public class CurrentSchemaContext implements SchemaContextListener, AutoCloseable {
- final AtomicReference<SchemaContext> currentContext = new AtomicReference<SchemaContext>();
+ private final AtomicReference<SchemaContext> currentContext = new AtomicReference();
private final ListenerRegistration<SchemaContextListener> schemaContextListenerListenerRegistration;
- private final Set<CapabilityListener> listeners1 = Collections.synchronizedSet(Sets.<CapabilityListener>newHashSet());
- private SchemaSourceProvider<YangTextSchemaSource> rootSchemaSourceProvider;
+ private final Set<CapabilityListener> listeners1 = Collections.synchronizedSet(Sets.newHashSet());
+ private final SchemaSourceProvider<YangTextSchemaSource> rootSchemaSourceProvider;
public SchemaContext getCurrentContext() {
Preconditions.checkState(currentContext.get() != null, "Current context not received");
// FIXME is notifying all the listeners from this callback wise ?
final Set<Capability> addedCaps = MdsalNetconfOperationServiceFactory.transformCapabilities(currentContext.get(), rootSchemaSourceProvider);
for (final CapabilityListener listener : listeners1) {
- listener.onCapabilitiesChanged(addedCaps, Collections.<Capability>emptySet());
+ listener.onCapabilitiesChanged(addedCaps, Collections.emptySet());
}
}
public AutoCloseable registerCapabilityListener(final CapabilityListener listener) {
listener.onCapabilitiesChanged(MdsalNetconfOperationServiceFactory.transformCapabilities(currentContext.get(), rootSchemaSourceProvider), Collections.<Capability>emptySet());
listeners1.add(listener);
- return new AutoCloseable() {
- @Override
- public void close() throws Exception {
- listeners1.remove(listener);
- }
- };
+ return () -> listeners1.remove(listener);
}
}
\ No newline at end of file
final Module module, final SchemaSourceProvider<YangTextSchemaSource> rootSchemaSourceProviderDependency) {
final SourceIdentifier moduleSourceIdentifier = SourceIdentifier.create(module.getName(),
- (SimpleDateFormatUtil.DEFAULT_DATE_REV == module.getRevision() ? Optional.<String>absent() :
+ (SimpleDateFormatUtil.DEFAULT_DATE_REV == module.getRevision() ? Optional.absent() :
Optional.of(SimpleDateFormatUtil.getRevisionFormat().format(module.getRevision()))));
InputStream sourceStream = null;
}
Set<NetconfOperation> getOperations() {
- return Sets.<NetconfOperation>newHashSet(
+ return Sets.newHashSet(
new Commit(netconfSessionIdForReporting, transactionProvider),
new DiscardChanges(netconfSessionIdForReporting, transactionProvider),
new EditConfig(netconfSessionIdForReporting, schemaContext, transactionProvider),
return runningTransaction;
}
- public synchronized boolean commitRunningTransaction(DOMDataReadWriteTransaction tx) throws DocumentedException {
- allOpenReadWriteTransactions.remove(tx);
-
- CheckedFuture<Void, TransactionCommitFailedException> future = tx.submit();
- try {
- future.checkedGet();
- } catch (TransactionCommitFailedException e) {
- LOG.debug("Transaction {} failed on", tx, e);
- throw new DocumentedException("Transaction commit failed on " + e.getMessage() + " " + netconfSessionIdForReporting,
- ErrorType.application, ErrorTag.operation_failed, ErrorSeverity.error);
- }
-
- return true;
- }
-
public synchronized void abortRunningTransaction(DOMDataReadWriteTransaction tx) {
LOG.debug("Aborting current running Transaction");
Preconditions.checkState(runningTransaction != null, NO_TRANSACTION_FOUND_FOR_SESSION + netconfSessionIdForReporting);
import org.w3c.dom.Document;
import org.w3c.dom.Element;
+// FIXME duplicated code
+// netconf/netconf/config-netconf-connector/src/main/java/org/opendaylight/netconf/confignetconfconnector/Commit.java
public class Commit extends AbstractSingletonNetconfOperation {
private static final Logger LOG = LoggerFactory.getLogger(Commit.class);
boolean commitStatus = transactionProvider.commitTransaction();
LOG.trace("Commit completed successfully {}", commitStatus);
- return XmlUtil.createElement(document, XmlNetconfConstants.OK, Optional.<String>absent());
+ return XmlUtil.createElement(document, XmlNetconfConstants.OK, Optional.absent());
}
@Override
throw new DocumentedException(e.getMessage(), e, ErrorType.application, ErrorTag.operation_failed,
ErrorSeverity.error, errorInfo);
}
- return XmlUtil.createElement(document, XmlNetconfConstants.OK, Optional.<String>absent());
+ return XmlUtil.createElement(document, XmlNetconfConstants.OK, Optional.absent());
}
@Override
executeOperations(changeTracker);
}
- return XmlUtil.createElement(document, XmlNetconfConstants.OK, Optional.<String>absent());
+ return XmlUtil.createElement(document, XmlNetconfConstants.OK, Optional.absent());
}
private void executeOperations(final DataTreeChangeTracker changeTracker) throws DocumentedException {
import org.w3c.dom.Document;
import org.w3c.dom.Element;
+// FIXME Duplicated code
+// netconf/netconf/config-netconf-connector/src/main/java/org/opendaylight/netconf/confignetconfconnector/operations/Lock.java
public class Lock extends AbstractSingletonNetconfOperation {
private static final Logger LOG = LoggerFactory.getLogger(Lock.class);
import org.w3c.dom.Document;
import org.w3c.dom.Element;
+// FIXME Duplicated code
+// netconf/netconf/config-netconf-connector/src/main/java/org/opendaylight/netconf/confignetconfconnector/operations/UnLock.java
public class Unlock extends AbstractSingletonNetconfOperation {
private static final Logger LOG = LoggerFactory.getLogger(Unlock.class);
<name>${project.artifactId}</name>
<packaging>bundle</packaging>
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>org.opendaylight.netconf</groupId>
- <artifactId>netconf-subsystem</artifactId>
- <version>${project.version}</version>
- <type>pom</type>
- <scope>import</scope>
- </dependency>
- </dependencies>
- </dependencyManagement>
-
<dependencies>
- <dependency>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- </dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>ietf-netconf-monitoring</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
+ <version>${project.version}</version>
</dependency>
</dependencies>
</project>
<packaging>bundle</packaging>
<dependencies>
- <dependency>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- </dependency>
<dependency>
<groupId>org.opendaylight.mdsal.model</groupId>
<artifactId>ietf-inet-types-2013-07-15</artifactId>
<groupId>org.opendaylight.mdsal.model</groupId>
<artifactId>ietf-yang-types-20130715</artifactId>
</dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
</dependencies>
</project>
~ terms of the Eclipse Public License v1.0 which accompanies this distribution,
~ and is available at http://www.eclipse.org/legal/epl-v10.html
-->
-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<version>0.10.0-SNAPSHOT</version>
<relativePath/>
</parent>
-
+
<groupId>org.opendaylight.netconf</groupId>
<artifactId>ietf-netconf-notifications</artifactId>
<version>1.2.0-SNAPSHOT</version>
<name>${project.artifactId}</name>
<packaging>bundle</packaging>
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>org.opendaylight.netconf</groupId>
- <artifactId>netconf-subsystem</artifactId>
- <version>${project.version}</version>
- <type>pom</type>
- <scope>import</scope>
- </dependency>
- </dependencies>
- </dependencyManagement>
-
<dependencies>
- <dependency>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- </dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>ietf-netconf</artifactId>
+ <version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.opendaylight.mdsal.model</groupId>
<artifactId>ietf-yang-types-20130715</artifactId>
</dependency>
<dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
+ <groupId>org.opendaylight.mdsal.model</groupId>
+ <artifactId>ietf-inet-types-2013-07-15</artifactId>
</dependency>
</dependencies>
</project>
namespace "urn:ietf:params:xml:ns:netmod:notification";
prefix "manageEvent";
- import ietf-yang-types{ prefix yang; revision-date "2013-07-15";}
+ import ietf-yang-types { prefix yang; revision-date "2013-07-15";}
import notifications { prefix ncEvent; revision-date "2008-07-14";}
organization
~ terms of the Eclipse Public License v1.0 which accompanies this distribution,
~ and is available at http://www.eclipse.org/legal/epl-v10.html
-->
-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.opendaylight.mdsal</groupId>
<artifactId>binding-parent</artifactId>
- <version>0.10.0-SNAPSHOT</version>
- <relativePath/>
+ <version>0.10.0-SNAPSHOT</version>
+ <relativePath/>
</parent>
<groupId>org.opendaylight.netconf</groupId>
<name>${project.artifactId}</name>
<dependencies>
- <dependency>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- </dependency>
<dependency>
<groupId>org.opendaylight.mdsal.model</groupId>
<artifactId>ietf-inet-types-2013-07-15</artifactId>
</dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
</dependencies>
</project>