org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.GroupKey.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(19.6k)|赞(0)|评价(0)|浏览(94)

本文整理了Java中org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.GroupKey.<init>()方法的一些代码示例,展示了GroupKey.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。GroupKey.<init>()方法的具体详情如下:
包路径:org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.GroupKey
类名称:GroupKey
方法名:<init>

GroupKey.<init>介绍

[英]Creates a copy from Source Object.
[中]从源对象创建副本。

代码示例

代码示例来源: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.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.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.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.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.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.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 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));
    }
  });
}

代码示例来源: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
 * @param bucketId the ID of the bucket in the group table
 * @return the {@link InstanceIdentifier}
 */
public static InstanceIdentifier<Bucket> createBucketPath(final NodeId nodeId, final GroupId groupId,
                             final BucketId bucketId) {
  return createNodePath(nodeId).builder()
    .augmentation(FlowCapableNode.class)
    .child(Group.class, new GroupKey(groupId))
    .child(Buckets.class)
    .child(Bucket.class, new BucketKey(bucketId))
    .build();
}

代码示例来源:origin: org.opendaylight.openflowplugin/test-provider

private void deleteGroup(final CommandInterpreter ci, Group group, Group group1) {
  ReadWriteTransaction modification = dataBroker.newReadWriteTransaction();
  InstanceIdentifier<Group> path1 = InstanceIdentifier.create(Nodes.class)
      .child(Node.class, testNode12.getKey()).augmentation(FlowCapableNode.class)
      .child(Group.class, new GroupKey(group.getGroupId()));
  modification.delete(LogicalDatastoreType.OPERATIONAL, path1);
  modification.delete(LogicalDatastoreType.CONFIGURATION, path1);
  InstanceIdentifier<Group> path2 = InstanceIdentifier.create(Nodes.class)
      .child(Node.class, testNode12.getKey()).augmentation(FlowCapableNode.class)
      .child(Group.class, new GroupKey(group1.getGroupId()));
  modification.delete(LogicalDatastoreType.OPERATIONAL, path2);
  modification.delete(LogicalDatastoreType.CONFIGURATION, path2);
  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));
    }
  });
}

代码示例来源:origin: org.opendaylight.openflowplugin/test-provider

private GroupBuilder createTestRemoveGroup() {
  long id = 123;
  GroupKey key = new GroupKey(new GroupId(id));
  GroupBuilder group = new GroupBuilder();
 /*   BucketBuilder bucket = new BucketBuilder();
  bucket.setBucketId(new BucketId((long) 12));
  bucket.setKey(new BucketKey(new BucketId((long) 12))); */
  group.setKey(key);
  //    group.setInstall(false);
  group.setGroupId(new GroupId(id));
 /*  PopVlanActionBuilder vlanAction = new PopVlanActionBuilder();
  ActionBuilder action = new ActionBuilder();
  action.setAction(new PopVlanActionCaseBuilder().setPopVlanAction(vlanAction.build()).build());
  List<Action> actions = new ArrayList<Action>();
  actions.add(action.build()); */
 /*   bucket.setAction(actions);
  bucket.setWatchGroup((long) 14);
  bucket.setWatchPort((long) 1234);
  bucket.setWeight(15); */
  //   group.setGroupType(GroupTypes.GroupSelect);
  //   group.setGroupName(originalGroupName);
  //   group.setBarrier(false);
  //    BucketsBuilder value = new BucketsBuilder();
  //    List<Bucket> value1 = new ArrayList<Bucket>();
  //    value1.add(bucket.build());
  //   value.setBucket(value1);
  //  group.setBuckets(value.build());
  testGroup2 = group.build();
  return group;
}

代码示例来源:origin: org.opendaylight.openflowplugin/test-provider

private void writeGroup(final CommandInterpreter ci, Group group, Group group1) {
  ReadWriteTransaction modification = dataBroker.newReadWriteTransaction();
  InstanceIdentifier<Group> path1 = InstanceIdentifier.create(Nodes.class)
      .child(Node.class, testNode12.getKey()).augmentation(FlowCapableNode.class)
      .child(Group.class, new GroupKey(group.getGroupId()));
  modification.merge(LogicalDatastoreType.CONFIGURATION, nodeToInstanceId(testNode12), testNode12, true);
  modification.merge(LogicalDatastoreType.CONFIGURATION, path1, group, true);
  InstanceIdentifier<Group> path2 = InstanceIdentifier.create(Nodes.class)
      .child(Node.class, testNode12.getKey()).augmentation(FlowCapableNode.class)
      .child(Group.class, new GroupKey(group1.getGroupId()));
  modification.merge(LogicalDatastoreType.CONFIGURATION, nodeToInstanceId(testNode12), testNode12, true);
  modification.merge(LogicalDatastoreType.CONFIGURATION, path2, group1, 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));
    }
  });
}

代码示例来源:origin: org.opendaylight.openflowplugin/test-provider

public void _removeGroup(final CommandInterpreter ci) {
  String nref = ci.nextArgument();
  if (nref == null) {
    ci.println("test node added");
    createTestNode();
  } else {
    ci.println("User node added" + nref);
    createUserNode(nref);
  }
  GroupBuilder gbuilder = createTestGroup(ci.nextArgument(), ci.nextArgument(), "add");
  ReadWriteTransaction modification = dataBroker.newReadWriteTransaction();
  InstanceIdentifier<Group> path1 = InstanceIdentifier.create(Nodes.class).child(Node.class, testNode.getKey())
      .augmentation(FlowCapableNode.class).child(Group.class, new GroupKey(gbuilder.getGroupId()));
  modification.delete(LogicalDatastoreType.CONFIGURATION, path1);
  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));
    }
  });
}

相关文章

微信公众号

最新文章

更多