public GroupStatisticsBuilder setByteCount(Counter64 value) { if (value != null) { BigInteger _constraint = value.getValue(); boolean isValidRange = false; for (Range<BigInteger> r : _byteCount_range()) { if (r.contains(_constraint)) { isValidRange = true; } } if (!isValidRange) { throw new IllegalArgumentException(String.format("Invalid range: %s, expected: %s.", value, _byteCount_range)); } } this._byteCount = value; return this; } public static List<Range<BigInteger>> _byteCount_range() {
public GroupStatisticsBuilder setGroupId(GroupId value) { if (value != null) { BigInteger _constraint = BigInteger.valueOf(value.getValue()); boolean isValidRange = false; for (Range<BigInteger> r : _groupId_range()) { if (r.contains(_constraint)) { isValidRange = true; } } if (!isValidRange) { throw new IllegalArgumentException(String.format("Invalid range: %s, expected: %s.", value, _groupId_range)); } } this._groupId = value; return this; } public static List<Range<BigInteger>> _groupId_range() {
public GroupStatisticsBuilder setPacketCount(Counter64 value) { if (value != null) { BigInteger _constraint = value.getValue(); boolean isValidRange = false; for (Range<BigInteger> r : _packetCount_range()) { if (r.contains(_constraint)) { isValidRange = true; } } if (!isValidRange) { throw new IllegalArgumentException(String.format("Invalid range: %s, expected: %s.", value, _packetCount_range)); } } this._packetCount = value; return this; } public static List<Range<BigInteger>> _packetCount_range() {
private GroupStatisticsImpl(GroupStatisticsBuilder base) { this._buckets = base.getBuckets(); this._byteCount = base.getByteCount(); this._duration = base.getDuration(); this._groupId = base.getGroupId(); this._packetCount = base.getPacketCount(); this._refCount = base.getRefCount(); switch (base.augmentation.size()) { case 0: this.augmentation = Collections.emptyMap(); break; case 1: final Map.Entry<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.group.statistics.GroupStatistics>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.group.statistics.GroupStatistics>> e = base.augmentation.entrySet().iterator().next(); this.augmentation = Collections.<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.group.statistics.GroupStatistics>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.group.statistics.GroupStatistics>>singletonMap(e.getKey(), e.getValue()); break; default : this.augmentation = new HashMap<>(base.augmentation); } }
private void statGroupCommit(final List<GroupStats> groupStats, final InstanceIdentifier<Node> nodeIdent, final ReadWriteTransaction tx) { Preconditions.checkNotNull(groupStats); Preconditions.checkNotNull(nodeIdent); Preconditions.checkNotNull(tx); final InstanceIdentifier<FlowCapableNode> fNodeIdent = nodeIdent.augmentation(FlowCapableNode.class); for (final GroupStats gStat : groupStats) { final GroupStatistics stats = new GroupStatisticsBuilder(gStat).build(); final InstanceIdentifier<Group> groupIdent = fNodeIdent.child(Group.class, new GroupKey(gStat.getGroupId())); final InstanceIdentifier<NodeGroupStatistics> nGroupStatIdent =groupIdent .augmentation(NodeGroupStatistics.class); final InstanceIdentifier<GroupStatistics> gsIdent = nGroupStatIdent.child(GroupStatistics.class); /* Statistics Writing */ Optional<Group> group = Optional.absent(); try { group = tx.read(LogicalDatastoreType.OPERATIONAL, groupIdent).checkedGet(); } catch (final ReadFailedException e) { LOG.debug("Read Operational/DS for Group node fail! {}", groupIdent, e); } if (group.isPresent()) { tx.merge(LogicalDatastoreType.OPERATIONAL, nGroupStatIdent, new NodeGroupStatisticsBuilder().build(), true); tx.put(LogicalDatastoreType.OPERATIONAL, gsIdent, stats); } } }
public GroupStatisticsBuilder setRefCount(Counter32 value) { if (value != null) { BigInteger _constraint = BigInteger.valueOf(value.getValue()); boolean isValidRange = false; for (Range<BigInteger> r : _refCount_range()) { if (r.contains(_constraint)) { isValidRange = true; } } if (!isValidRange) { throw new IllegalArgumentException(String.format("Invalid range: %s, expected: %s.", value, _refCount_range)); } } this._refCount = value; return this; } public static List<Range<BigInteger>> _refCount_range() {
private void statGroupCommit(final List<GroupStats> groupStats, final InstanceIdentifier<Node> nodeIdent, final ReadWriteTransaction tx) { Preconditions.checkNotNull(groupStats); Preconditions.checkNotNull(nodeIdent); Preconditions.checkNotNull(tx); final InstanceIdentifier<FlowCapableNode> fNodeIdent = nodeIdent.augmentation(FlowCapableNode.class); for (final GroupStats gStat : groupStats) { final GroupStatistics stats = new GroupStatisticsBuilder(gStat).build(); final InstanceIdentifier<Group> groupIdent = fNodeIdent.child(Group.class, new GroupKey(gStat.getGroupId())); final InstanceIdentifier<NodeGroupStatistics> nGroupStatIdent =groupIdent .augmentation(NodeGroupStatistics.class); final InstanceIdentifier<GroupStatistics> gsIdent = nGroupStatIdent.child(GroupStatistics.class); /* Statistics Writing */ Optional<Group> group = Optional.absent(); try { group = tx.read(LogicalDatastoreType.OPERATIONAL, groupIdent).checkedGet(); } catch (final ReadFailedException e) { LOG.debug("Read Operational/DS for Group node fail! {}", groupIdent, e); } if (group.isPresent()) { tx.merge(LogicalDatastoreType.OPERATIONAL, nGroupStatIdent, new NodeGroupStatisticsBuilder().build(), true); tx.put(LogicalDatastoreType.OPERATIONAL, gsIdent, stats); } } }