private Map<Long, Group> indexByGroupId(List<Group> groups) { Map<Long, Group> groupMaps = new HashMap<Long, Group>(); if (groups == null) { return groupMaps; } for (Group group: groups) { groupMaps.put(group.getGroupId().getValue(), group); } return groupMaps; }
public GroupBuilder 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 GroupStatsBuilder 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 GetGroupStatisticsInputBuilder 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 GroupStatsBuilder 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 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 GroupDescStatsBuilder 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 GroupDescBuilder 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() {
private void executeNotifyTaskIfRequired(BigInteger dpId, Group group) { GroupInfoKey groupKey = new GroupInfoKey(dpId, group.getGroupId().getValue()); Runnable notifyTask = groupMap.remove(groupKey); if (notifyTask == null) { return; } executorService.execute(notifyTask); }
@Override public JsonObject objectToJsonMapper(DataObject ofStat) { JsonObject nodeGroupStatisticsJsonObject = null; GroupStatistics groupStat = (GroupStatistics) ofStat; if (groupStat.getByteCount() != null && groupStat.getDuration() != null && groupStat.getPacketCount() != null && groupStat.getBuckets() != null && groupStat.getGroupId() != null && groupStat.getRefCount() != null) { nodeGroupStatisticsJsonObject = factory.createObjectBuilder() .add(properties.getProperty("STAT_TYPE"), properties.getProperty("GRP_STAT")) .add(properties.getProperty("TIMESTAMP"), System.currentTimeMillis()) .add(properties.getProperty("OFSTATS"), factory.createObjectBuilder() .add(properties.getProperty("BYTE_COUNT"), groupStat.getByteCount().getValue()) .add(properties.getProperty("DURATION_SEC"), groupStat.getDuration().getSecond().getValue()) .add(properties.getProperty("DURATION_NANOSEC"), groupStat.getDuration().getNanosecond().getValue()) .add(properties.getProperty("PACK_COUNT"), groupStat.getPacketCount().getValue()) .add(properties.getProperty("REF_COUNT"), groupStat.getRefCount().getValue()) .add(properties.getProperty("GRP_ID"), groupStat.getGroupId().getValue()) .add(properties.getProperty("BUCK"), createBandStatsJsonArrayObject(groupStat.getBuckets().getBucketCounter()))) .build(); } return nodeGroupStatisticsJsonObject; }
@Override public void sync(Endpoint endpoint, OfWriter ofWriter) throws Exception { NodeId endpointNodeId = ctx.getEndpointManager().getEndpointNodeId(endpoint); if (endpointNodeId == null) { LOG.warn("Endpoint {} has no location specified, skipped", endpoint); return; } // there appears to be no way of getting only the existing group // tables unfortunately, so we have to get the whole node. // Since this is happening concurrently with other things that are // working in subtrees of nodes, we have to do two transactions FlowCapableNode fcn = getFCNodeFromDatastore(endpointNodeId); if (fcn == null) return; EndpointFwdCtxOrdinals ordinals = OrdinalFactory.getEndpointFwdCtxOrdinals(ctx, endpoint); if (ordinals == null) { LOG.info("getEndpointFwdCtxOrdinals is null for EP {}", endpoint); return; } GroupId groupId = new GroupId(Long.valueOf(ordinals.getFdId())); if (!ofWriter.groupExists(endpointNodeId, groupId.getValue())) { LOG.info("createGroup {} {}", endpointNodeId, groupId); ofWriter.writeGroup(endpointNodeId, groupId); } syncGroups(endpointNodeId, ordinals, endpoint, groupId, ofWriter); }
Group g = getGroupForNode(nodeId, gid.getValue()); if (g != null) { createdGroups.add(g);
KeyedInstanceIdentifier<Group, GroupKey> groupIdent = nodeIdentity.child(Group.class, group.getKey()); final Long groupId = group.getGroupId().getValue(); ListenableFuture<?> future = JdkFutureAdapters.listenInPoolThread( provider.getGroupCommiter().add(
public void syncSetUpGroup(BigInteger dpId, Group group, long delayTime, boolean isRemove) { s_logger.trace("syncSetUpGroup for group {} ", group); Node nodeDpn = buildDpnNode(dpId); long groupId = group.getGroupId().getValue(); GroupKey groupKey = new GroupKey(new GroupId(groupId)); InstanceIdentifier<Group> groupInstanceId = InstanceIdentifier.builder(Nodes.class) .child(Node.class, nodeDpn.getKey()).augmentation(FlowCapableNode.class) .child(Group.class, groupKey).build(); Runnable notifyTask = new NotifyTask(); GroupInfoKey groupInfoKey = new GroupInfoKey(dpId, groupId); synchronized (groupInfoKey.toString().intern()) { s_logger.trace("syncsetupGroupKey groupKey {}", groupInfoKey); groupMap.put(groupInfoKey, notifyTask); if (isRemove) { MDSALUtil.syncDelete(m_dataBroker, LogicalDatastoreType.CONFIGURATION, groupInstanceId); } else { MDSALUtil.syncWrite(m_dataBroker, LogicalDatastoreType.CONFIGURATION, groupInstanceId, group); } synchronized (notifyTask) { try { notifyTask.wait(delayTime); } catch (InterruptedException e){} } } }
} else if (ia.getKey() instanceof GroupKey) { GroupKey gk = (GroupKey) ia.getKey(); rec.setKeyValue("" + gk.getGroupId().getValue()); } else if (ia.getKey() instanceof NodeConnectorKey) { NodeConnectorKey nck = (NodeConnectorKey) ia.getKey();
groupModInputBuilder.setGroupId(new GroupId(source.getGroupId().getValue()));