本文整理了Java中org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.GroupKey
类的一些代码示例,展示了GroupKey
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。GroupKey
类的具体详情如下:
包路径:org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.GroupKey
类名称:GroupKey
暂无
代码示例来源:origin: org.opendaylight.groupbasedpolicy/ofoverlay-renderer
/**
* Creates a group path from a node ID and group ID
*
* @param nodeId the Id of the node
* @param groupId the ID of the group table
* @return the {@link InstanceIdentifier}
*/
public static InstanceIdentifier<Group> createGroupPath(final NodeId nodeId, final GroupId groupId) {
return createNodePath(nodeId).builder()
.augmentation(FlowCapableNode.class)
.child(Group.class, new GroupKey(groupId))
.build();
}
代码示例来源:origin: org.opendaylight.controller.model/model-flow-base
private GroupImpl(GroupBuilder base) {
if (base.getKey() == null) {
this._key = new GroupKey(
base.getGroupId()
);
this._groupId = base.getGroupId();
} else {
this._key = base.getKey();
this._groupId = _key.getGroupId();
}
this._buckets = base.getBuckets();
this._containerName = base.getContainerName();
this._groupName = base.getGroupName();
this._groupType = base.getGroupType();
this._barrier = base.isBarrier();
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.types.rev131018.groups.Group>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.Group>> e = base.augmentation.entrySet().iterator().next();
this.augmentation = Collections.<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.Group>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.Group>>singletonMap(e.getKey(), e.getValue());
break;
default :
this.augmentation = new HashMap<>(base.augmentation);
}
}
代码示例来源:origin: org.opendaylight.controller.model/model-flow-base
return false;
} else if(!_key.equals(other.getKey())) {
return false;
代码示例来源:origin: org.opendaylight.openflowplugin.applications/notification-supplier
@Override
public GroupRemoved deleteNotification(final InstanceIdentifier<Group> path) {
Preconditions.checkArgument(path != null);
final GroupRemovedBuilder builder = new GroupRemovedBuilder();
builder.setGroupId(path.firstKeyOf(Group.class, GroupKey.class).getGroupId());
builder.setGroupRef(new GroupRef(path));
builder.setNode(createNodeRef(path));
return builder.build();
}
}
代码示例来源:origin: org.opendaylight.controller.model/model-flow-base
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((_buckets == null) ? 0 : _buckets.hashCode());
result = prime * result + ((_containerName == null) ? 0 : _containerName.hashCode());
result = prime * result + ((_groupId == null) ? 0 : _groupId.hashCode());
result = prime * result + ((_groupName == null) ? 0 : _groupName.hashCode());
result = prime * result + ((_groupType == null) ? 0 : _groupType.hashCode());
result = prime * result + ((_key == null) ? 0 : _key.hashCode());
result = prime * result + ((_barrier == null) ? 0 : _barrier.hashCode());
result = prime * result + ((augmentation == null) ? 0 : augmentation.hashCode());
return result;
}
代码示例来源:origin: org.opendaylight.tsdr/tsdr-datacollection
} 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();
代码示例来源:origin: org.opendaylight.controller.md/statistics-manager
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);
}
}
}
代码示例来源:origin: org.opendaylight.controller.model/model-flow-base
public GroupBuilder(Group base) {
if (base.getKey() == null) {
this._key = new GroupKey(
base.getGroupId()
);
this._groupId = base.getGroupId();
} else {
this._key = base.getKey();
this._groupId = _key.getGroupId();
}
this._buckets = base.getBuckets();
this._containerName = base.getContainerName();
this._groupName = base.getGroupName();
this._groupType = base.getGroupType();
this._barrier = base.isBarrier();
if (base instanceof GroupImpl) {
GroupImpl _impl = (GroupImpl) base;
this.augmentation = new HashMap<>(_impl.augmentation);
}
}
代码示例来源:origin: org.opendaylight.netvirt/openstack.net-virt-providers
private Group getGroup(GroupBuilder groupBuilder, NodeBuilder nodeBuilder) {
InstanceIdentifier<Group> path1 = InstanceIdentifier.builder(Nodes.class).child(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory
.rev130819.nodes.Node.class, nodeBuilder.getKey()).augmentation(FlowCapableNode.class).child(Group.class,
new GroupKey(groupBuilder.getGroupId())).build();
ReadOnlyTransaction readTx = dataBroker.newReadOnlyTransaction();
try {
Optional<Group> data = readTx.read(LogicalDatastoreType.CONFIGURATION, path1).get();
if (data.isPresent()) {
return data.get();
}
} catch (InterruptedException|ExecutionException e) {
LOG.error("Failed to get group {}", groupBuilder.getGroupName(), e);
}
LOG.debug("Cannot find data for Group {}", groupBuilder.getGroupName());
return null;
}
代码示例来源:origin: org.opendaylight.openflowplugin.applications/statistics-manager
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);
}
}
}
代码示例来源:origin: org.opendaylight.openflowplugin.applications/statistics-manager
private void statGroupDescCommit(final Optional<TransactionCacheContainer<?>> txContainer, final ReadWriteTransaction tx,
final InstanceIdentifier<FlowCapableNode> fNodeIdent, final List<GroupKey> existGroupKeys) {
Preconditions.checkNotNull(existGroupKeys);
Preconditions.checkNotNull(txContainer);
Preconditions.checkNotNull(fNodeIdent);
Preconditions.checkNotNull(tx);
final List<? extends TransactionAware> cacheNotifs = txContainer.get().getNotifications();
for (final TransactionAware notif : cacheNotifs) {
if ( ! (notif instanceof GroupDescStatsUpdated)) {
break;
}
final List<GroupDescStats> groupStats = ((GroupDescStatsUpdated) notif).getGroupDescStats();
if (groupStats == null) {
break;
}
for (final GroupDescStats group : groupStats) {
if (group.getGroupId() != null) {
final GroupBuilder groupBuilder = new GroupBuilder(group);
final GroupKey groupKey = new GroupKey(group.getGroupId());
final InstanceIdentifier<Group> groupRef = fNodeIdent.child(Group.class,groupKey);
final NodeGroupDescStatsBuilder groupDesc= new NodeGroupDescStatsBuilder();
groupDesc.setGroupDesc(new GroupDescBuilder(group).build());
//Update augmented data
groupBuilder.addAugmentation(NodeGroupDescStats.class, groupDesc.build());
existGroupKeys.remove(groupKey);
tx.put(LogicalDatastoreType.OPERATIONAL, groupRef, groupBuilder.build());
}
}
}
}
代码示例来源:origin: org.opendaylight.controller.md/statistics-manager
private void statGroupDescCommit(final Optional<TransactionCacheContainer<?>> txContainer, final ReadWriteTransaction tx,
final InstanceIdentifier<FlowCapableNode> fNodeIdent, final List<GroupKey> existGroupKeys) {
Preconditions.checkNotNull(existGroupKeys);
Preconditions.checkNotNull(txContainer);
Preconditions.checkNotNull(fNodeIdent);
Preconditions.checkNotNull(tx);
final List<? extends TransactionAware> cacheNotifs = txContainer.get().getNotifications();
for (final TransactionAware notif : cacheNotifs) {
if ( ! (notif instanceof GroupDescStatsUpdated)) {
break;
}
final List<GroupDescStats> groupStats = ((GroupDescStatsUpdated) notif).getGroupDescStats();
if (groupStats == null) {
break;
}
for (final GroupDescStats group : groupStats) {
if (group.getGroupId() != null) {
final GroupBuilder groupBuilder = new GroupBuilder(group);
final GroupKey groupKey = new GroupKey(group.getGroupId());
final InstanceIdentifier<Group> groupRef = fNodeIdent.child(Group.class,groupKey);
final NodeGroupDescStatsBuilder groupDesc= new NodeGroupDescStatsBuilder();
groupDesc.setGroupDesc(new GroupDescBuilder(group).build());
//Update augmented data
groupBuilder.addAugmentation(NodeGroupDescStats.class, groupDesc.build());
existGroupKeys.remove(groupKey);
tx.put(LogicalDatastoreType.OPERATIONAL, groupRef, groupBuilder.build());
}
}
}
}
代码示例来源:origin: org.opendaylight.lacp.main/lacp.main.impl
GroupKey groupkey = new GroupKey(groupId);
groupBuilder.setGroupId(groupId);
groupBuilder.setGroupName("LACP"+groupId);
代码示例来源:origin: org.opendaylight.lacp.main/lacp.main.impl
GroupKey groupkey = new GroupKey(groupId);
代码示例来源:origin: org.opendaylight.vpnservice/mdsalutil-impl
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){}
}
}
}
代码示例来源:origin: org.opendaylight.lacp.main/lacp.main.impl
GroupKey groupkey = new GroupKey(groupId);
代码示例来源:origin: org.opendaylight.vpnservice/mdsalutil-impl
public void syncSetUpGroup(GroupEntity groupEntity, long delayTime, boolean isRemove) {
s_logger.trace("syncSetUpGroup for groupEntity {} ", groupEntity);
Group group = groupEntity.getGroupBuilder().build();
BigInteger dpId = groupEntity.getDpnId();
Node nodeDpn = buildDpnNode(dpId);
long groupId = groupEntity.getGroupId();
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){}
}
}
}
代码示例来源:origin: org.opendaylight.netvirt/openstack.net-virt-providers
private void removeGroup(GroupBuilder groupBuilder, NodeBuilder nodeBuilder) {
if (NetvirtProvidersProvider.isMasterProviderInstance()) {
WriteTransaction modification = dataBroker.newWriteOnlyTransaction();
InstanceIdentifier<Group> path1 = InstanceIdentifier.builder(Nodes.class).child(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory
.rev130819.nodes.Node.class, nodeBuilder.getKey()).augmentation(FlowCapableNode.class).child(Group.class,
new GroupKey(groupBuilder.getGroupId())).build();
modification.delete(LogicalDatastoreType.CONFIGURATION, path1);
CheckedFuture<Void, TransactionCommitFailedException> commitFuture = modification.submit();
try {
commitFuture.get(); // TODO: Make it async (See bug 1362)
LOG.debug("Transaction success for deletion of Group {}", groupBuilder.getGroupName());
} catch (InterruptedException|ExecutionException e) {
LOG.error("Failed to remove group {}", groupBuilder.getGroupName(), e);
}
}
}
代码示例来源:origin: org.opendaylight.netvirt/openstack.net-virt-providers
private void writeGroup(GroupBuilder groupBuilder, NodeBuilder nodeBuilder) {
if (NetvirtProvidersProvider.isMasterProviderInstance()) {
ReadWriteTransaction modification = dataBroker.newReadWriteTransaction();
InstanceIdentifier<Group> path1 = InstanceIdentifier.builder(Nodes.class).child(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory
.rev130819.nodes.Node.class, nodeBuilder.getKey()).augmentation(FlowCapableNode.class).child(Group.class,
new GroupKey(groupBuilder.getGroupId())).build();
modification.put(LogicalDatastoreType.CONFIGURATION, path1, groupBuilder.build(), true /*createMissingParents*/);
CheckedFuture<Void, TransactionCommitFailedException> commitFuture = modification.submit();
try {
commitFuture.get(); // TODO: Make it async (See bug 1362)
LOG.debug("Transaction success for write of Group {}", groupBuilder.getGroupName());
} catch (InterruptedException|ExecutionException e) {
LOG.error("Failed to write group {}", groupBuilder.getGroupName(), e);
}
}
}
代码示例来源:origin: org.opendaylight.openflowplugin/test-provider
private void writeGroup(final CommandInterpreter ci, Group group) {
ReadWriteTransaction modification = dataBroker.newReadWriteTransaction();
InstanceIdentifier<Group> path1 = InstanceIdentifier.create(Nodes.class)
.child(Node.class, testNode.getKey()).augmentation(FlowCapableNode.class)
.child(Group.class, new GroupKey(group.getGroupId()));
modification.merge(LogicalDatastoreType.CONFIGURATION, nodeToInstanceId(testNode), testNode, true);
modification.merge(LogicalDatastoreType.CONFIGURATION, path1, group, true);
CheckedFuture<Void, TransactionCommitFailedException> commitFuture = modification.submit();
Futures.addCallback(commitFuture, new FutureCallback<Void>() {
@Override
public void onSuccess(Void aVoid) {
ci.println("Status of Group Data Loaded Transaction: success.");
}
@Override
public void onFailure(Throwable throwable) {
ci.println(String.format("Status of Group Data Loaded Transaction : failure. Reason : %s", throwable));
}
});
}
内容来源于网络,如有侵权,请联系作者删除!