<groupId>org.opendaylight.controller</groupId>
<artifactId>sal-dom-xsql</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-dom-xsql-config</artifactId>
+ </dependency>
<dependency>
<groupId>org.opendaylight.controller</groupId>
<artifactId>sal-binding-api</artifactId>
will pick the pom.xml from the parent directory as the parent pom, which may or may
not be correct.
-->
+ <!--
+ Necessary TODO: Replace the contents of src/main/resources/80-${repoName}.xml with
+ the proper config subsystem contents for your module
+ -->
<artifactId>${artifactId}</artifactId>
<groupId>${groupId}</groupId>
<description>Configuration files for md-sal</description>
<packaging>jar</packaging>
<properties>
<!-- Optional TODO: Rename your configfile to taste -->
- <configfile>80-configfile.xml</configfile>
+ <configfile>80-${repoName}.xml</configfile>
</properties>
<build>
<plugins>
<type>xml</type>
<classifier>config</classifier>
</artifact>
+ <!--
+ Optional TODO: Add additional config files
+ You may need to add more than one config file
+ if so, you just need to add additional <artifact> entries
+ here WITH DIFFERENT CLASSIFIERS
+ Example:
+ <artifact>
+ <file>${project.build.directory}/classes/<another-configfile></file>
+ <type>xml</type>
+ <classifier>config-<meaningful suffix to describe your other configfile></classifier>
+ </artifact>
+ -->
</artifacts>
</configuration>
</execution>
<artifactId>sal-dom-xsql</artifactId>
<version>${mdsal.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-dom-xsql-config</artifactId>
+ <version>${mdsal.version}</version>
+ </dependency>
<dependency>
<groupId>org.opendaylight.controller</groupId>
<artifactId>sal-core-api</artifactId>
import java.util.Date;
import java.util.HashSet;
import java.util.List;
+import java.util.regex.Pattern;
import org.opendaylight.controller.sal.common.util.Arguments;
import org.opendaylight.controller.sal.core.AdvertisedBandwidth;
import org.opendaylight.controller.sal.core.Bandwidth;
private final static Class<NodeConnector> NODECONNECTOR_CLASS = NodeConnector.class;
+ private final static Pattern COLON_NUMBERS_EOL = Pattern.compile(":[0-9]+$");
+
+ private final static Pattern NUMBERS_ONLY = Pattern.compile("[0-9]+");
+
+ private final static Pattern ALL_CHARS_TO_COLON = Pattern.compile("^.*:");
+
private NodeMapping() {
throw new UnsupportedOperationException("Utility class. Instantiation is not allowed.");
}
return org.opendaylight.controller.sal.core.NodeConnector.SPECIALNODECONNECTORID;
}
- String nodeConnectorIdStripped = nodeConnectorId.getValue().replaceFirst("^.*:", "");
- if (nodeConnectorIdStripped.matches("[0-9]+")) {
+ String nodeConnectorIdStripped = ALL_CHARS_TO_COLON.matcher(nodeConnectorId.getValue()).replaceFirst("");
+
+ if (NUMBERS_ONLY.matcher(nodeConnectorIdStripped).matches()) {
Short nodeConnectorIdVal = null;
try {
nodeConnectorIdVal = Short.valueOf(nodeConnectorIdStripped);
+ return nodeConnectorIdVal;
} catch (NumberFormatException e) {
- LOG.warn("nodeConnectorId not supported (short): {}", nodeConnectorIdStripped, e);
+ LOG.warn("nodeConnectorId not supported (long): {}", nodeConnectorIdStripped, e);
}
- return nodeConnectorIdVal;
}
return nodeConnectorIdStripped;
}
public static NodeId toAdNodeId(final NodeConnectorId nodeConnectorId) {
NodeId nodeId = null;
if (nodeConnectorId != null) {
- nodeId = new NodeId(nodeConnectorId.getValue().replaceFirst(":[0-9]+$", ""));
+ nodeId = new NodeId(COLON_NUMBERS_EOL.matcher(nodeConnectorId.getValue()).replaceFirst(""));
}
return nodeId;
}
<!-- XSQL -->
<module>sal-dom-xsql</module>
+ <module>sal-dom-xsql-config</module>
<!-- Yang Test Models for MD-SAL -->
<module>sal-test-model</module>
<!-- Clustering -->
<module>sal-remoterpc-connector</module>
- <module>sal-dom-xsql-config</module>
</modules>
<build>
}
protected abstract void cleanupSingleStat(DataModificationTransaction trans, K item);
protected abstract K updateSingleStat(DataModificationTransaction trans, I item);
+ protected abstract K createInvariantKey(K item);
public abstract void request();
public final synchronized void updateStats(List<I> list) {
final DataModificationTransaction trans = startTransaction();
-
for (final I item : list) {
- trackedItems.put(updateSingleStat(trans, item), requestCounter);
+ K key = updateSingleStat(trans, item);
+ trackedItems.put(createInvariantKey(key), requestCounter);
}
trans.commit();
return false;
return true;
}
+
+ @Override
+ public String toString() {
+ return "FlowStatsEntry [tableId=" + tableId + ", flow=" + flow + "]";
+ }
}
}
return flowCookieMap;
}
+
+ @Override
+ protected FlowStatsEntry createInvariantKey(final FlowStatsEntry item) {
+ FlowBuilder newFlow = new FlowBuilder();
+ newFlow.setId(item.getFlow().getId());
+ newFlow.setKey(item.getFlow().getKey());
+ newFlow.fieldsFrom(item.getFlow());
+ return new FlowStatsEntry(item.getTableId(),newFlow.build());
+ }
}
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.GetFlowTablesStatisticsInputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.OpendaylightFlowTableStatisticsService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.flow.table.and.statistics.map.FlowTableAndStatisticsMap;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.flow.table.and.statistics.map.FlowTableAndStatisticsMapBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.flow.table.statistics.FlowTableStatistics;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.flow.table.statistics.FlowTableStatisticsBuilder;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
requestHelper(flowTableStatsService.getFlowTablesStatistics(input.build()));
}
}
+
+ @Override
+ protected FlowTableAndStatisticsMap createInvariantKey(FlowTableAndStatisticsMap item) {
+ FlowTableAndStatisticsMapBuilder flowTableAndStatisticsMapBuilder = new FlowTableAndStatisticsMapBuilder();
+ flowTableAndStatisticsMapBuilder.setTableId(item.getTableId());
+ flowTableAndStatisticsMapBuilder.setKey(item.getKey());
+ return flowTableAndStatisticsMapBuilder.build();
+ }
}
super.start(dbs);
}
+
+ @Override
+ protected GroupDescStats createInvariantKey(GroupDescStats item) {
+ // No invariant data exist in the group description stats.
+ return item;
+ }
}
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.OpendaylightGroupStatisticsService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.group.statistics.GroupStatisticsBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.statistics.reply.GroupStats;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.statistics.reply.GroupStatsBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.Group;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.GroupBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.GroupKey;
super.start(dbs);
}
+
+ @Override
+ protected GroupStats createInvariantKey(GroupStats item) {
+ GroupStatsBuilder groupStatsBuilder = new GroupStatsBuilder();
+ groupStatsBuilder.setKey(item.getKey());
+ groupStatsBuilder.setGroupId(item.getGroupId());
+ return groupStatsBuilder.build();
+ }
}
super.start(dbs);
}
+
+ @Override
+ protected MeterConfigStats createInvariantKey(MeterConfigStats item) {
+ // No invariant data exist in the meter config stats.
+ return item;
+ }
}
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.OpendaylightMeterStatisticsService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.nodes.node.meter.MeterStatisticsBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.statistics.reply.MeterStats;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.statistics.reply.MeterStatsBuilder;
import org.opendaylight.yangtools.yang.binding.DataObject;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.slf4j.Logger;
super.start(dbs);
}
+
+ @Override
+ protected MeterStats createInvariantKey(MeterStats item) {
+ MeterStatsBuilder meterStatsBuilder = new MeterStatsBuilder();
+ meterStatsBuilder.setKey(item.getKey());
+ meterStatsBuilder.setMeterId(item.getMeterId());
+ return meterStatsBuilder.build();
+ }
}
import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.OpendaylightPortStatisticsService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.flow.capable.node.connector.statistics.FlowCapableNodeConnectorStatisticsBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.node.connector.statistics.and.port.number.map.NodeConnectorStatisticsAndPortNumberMap;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.node.connector.statistics.and.port.number.map.NodeConnectorStatisticsAndPortNumberMapBuilder;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
requestHelper(portStatsService.getAllNodeConnectorsStatistics(input.build()));
}
}
+
+ @Override
+ protected NodeConnectorStatisticsAndPortNumberMap createInvariantKey(NodeConnectorStatisticsAndPortNumberMap item) {
+ NodeConnectorStatisticsAndPortNumberMapBuilder ncStatsBuilder = new NodeConnectorStatisticsAndPortNumberMapBuilder();
+ ncStatsBuilder.setNodeConnectorId(item.getNodeConnectorId());
+ ncStatsBuilder.setKey(item.getKey());
+ return ncStatsBuilder.build();
+ }
}
super.start(dbs);
}
+
+ @Override
+ protected QueueStatsEntry createInvariantKey(QueueStatsEntry item) {
+ // No invariant data exist in the group description stats.
+ return item;
+ }
}
public void applyOperation(final ReadWriteTransaction transaction) {
final Link link = toTopologyLink(notification);
final InstanceIdentifier<Link> path = linkPath(link);
- transaction.put(LogicalDatastoreType.OPERATIONAL, path, link);
+ transaction.merge(LogicalDatastoreType.OPERATIONAL, path, link, true);
}
});
}