本文整理汇总了Java中org.opendaylight.yangtools.yang.binding.Augmentation类的典型用法代码示例。如果您正苦于以下问题:Java Augmentation类的具体用法?Java Augmentation怎么用?Java Augmentation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Augmentation类属于org.opendaylight.yangtools.yang.binding包,在下文中一共展示了Augmentation类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isSchemaAvailable
import org.opendaylight.yangtools.yang.binding.Augmentation; //导入依赖的package包/类
private static boolean isSchemaAvailable(final Class<?> clz, final BindingRuntimeContext context) {
final Object schema;
if (Augmentation.class.isAssignableFrom(clz)) {
schema = context.getAugmentationDefinition(clz);
} else {
schema = context.getSchemaDefinition(clz);
}
return schema != null;
}
示例2: getAugmentation
import org.opendaylight.yangtools.yang.binding.Augmentation; //导入依赖的package包/类
protected A getAugmentation(Node node) {
if (node == null) {
return null;
}
ParameterizedType parameterizedType = (ParameterizedType) getClass().getGenericSuperclass();
Class<? extends Augmentation<Node>> augType =
(Class<? extends Augmentation<Node>>) parameterizedType.getActualTypeArguments()[1];
Augmentation<Node> augmentation = node.getAugmentation(augType);
return (A) augmentation;
}
示例3: path
import org.opendaylight.yangtools.yang.binding.Augmentation; //导入依赖的package包/类
public static <T extends DataObject & Augmentation<TopLevelList>> InstanceIdentifier<T> path(final TopLevelListKey key, final Class<T> augmentation) {
return path(key).augmentation(augmentation);
}
示例4: getModifiedAugmentation
import org.opendaylight.yangtools.yang.binding.Augmentation; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public <C extends Augmentation<T> & DataObject> DataObjectModification<C> getModifiedAugmentation(
final Class<C> augmentation) {
return (DataObjectModification<C>) getModifiedChild(new InstanceIdentifier.Item<>(augmentation));
}
示例5: assertHasAugmentation
import org.opendaylight.yangtools.yang.binding.Augmentation; //导入依赖的package包/类
public AugmentationVerifier<T> assertHasAugmentation(Class<? extends Augmentation<T>> augmentation) {
assertHasAugmentation(object, augmentation);
return this;
}
示例6: changesPerConnectionInstance
import org.opendaylight.yangtools.yang.binding.Augmentation; //导入依赖的package包/类
private Map<OvsdbConnectionInstance, Collection<DataTreeModification<Node>>> changesPerConnectionInstance(
@Nonnull Collection<DataTreeModification<Node>> changes) {
Map<OvsdbConnectionInstance, Collection<DataTreeModification<Node>>> result = new HashMap<>();
for (DataTreeModification<Node> change : changes) {
OvsdbConnectionInstance client = null;
Node node = change.getRootNode().getDataAfter() != null
? change.getRootNode().getDataAfter() : change.getRootNode().getDataBefore();
if (node != null) {
InstanceIdentifier<Node> nodeIid;
Augmentation nodeAug = node.getAugmentation(OvsdbNodeAugmentation.class) != null
? node.getAugmentation(OvsdbNodeAugmentation.class)
: node.getAugmentation(OvsdbBridgeAugmentation.class);
if (nodeAug instanceof OvsdbNodeAugmentation) {
OvsdbNodeAugmentation ovsdbNode = (OvsdbNodeAugmentation) nodeAug;
if (ovsdbNode.getConnectionInfo() != null) {
client = cm.getConnectionInstance(ovsdbNode.getConnectionInfo());
} else {
client = cm.getConnectionInstance(SouthboundMapper.createInstanceIdentifier(node.getNodeId()));
}
}
if (nodeAug instanceof OvsdbBridgeAugmentation) {
OvsdbBridgeAugmentation bridgeAugmentation = (OvsdbBridgeAugmentation)nodeAug;
if (bridgeAugmentation.getManagedBy() != null) {
nodeIid = (InstanceIdentifier<Node>) bridgeAugmentation.getManagedBy().getValue();
client = cm.getConnectionInstance(nodeIid);
}
}
if (client == null) {
//Try getting from change root identifier
client = cm.getConnectionInstance(change.getRootPath().getRootIdentifier());
}
} else {
LOG.warn("Following change don't have after/before data {}", change);
}
if (client != null) {
LOG.debug("Found client for {}", node);
/*
* As of now data change sets are processed by single thread, so we can assume that device will
* be connected and ownership will be decided before sending any instructions down to the device.
* Note:Processing order in onDataChange() method should not change. If processing is changed to
* use multiple thread, we might need to take care of corner cases, where ownership is not decided
* but transaction are ready to go to switch. In that scenario, either we need to queue those task
* till ownership is decided for that specific device.
* Given that each DataChangeNotification is notified through separate thread, so we are already
* multi threaded and i don't see any need to further parallelism per DataChange
* notifications processing.
*/
if (cm.getHasDeviceOwnership(client.getMDConnectionInfo())) {
LOG.debug("*This* instance of southbound plugin is an owner of the device {}", node);
result.computeIfAbsent(client, key -> new ArrayList<>()).add(change);
} else {
LOG.debug("*This* instance of southbound plugin is *not* an owner of the device {}", node);
}
} else {
LOG.debug("Did not find client for {}", node);
}
}
return result;
}
示例7: testNodeAdded
import org.opendaylight.yangtools.yang.binding.Augmentation; //导入依赖的package包/类
@Test
public void testNodeAdded() {
GetFeaturesOutputBuilder featuresBuilder = new GetFeaturesOutputBuilder();
GetFeaturesOutput features = featuresBuilder.build();
Mockito.stub(registry.getDatapathID(connectionAdapter)).toReturn(new BigInteger("1"));
Mockito.stub(registry.getFeaturesOutput(connectionAdapter)).toReturn(features);
Mockito.stub(connectionAdapter.getRemoteAddress()).toReturn(new InetSocketAddress(1));
NodeUpdatedBuilder builder = new NodeUpdatedBuilder();
String current = String.valueOf(new BigInteger("1"));
builder.setId(new NodeId("openflow:" + current));
InstanceIdentifier<Node> identifier = connectionHandler.identifierFromDatapathId(new BigInteger("1"));
builder.setNodeRef(new NodeRef(identifier));
FlowCapableNodeUpdatedBuilder builder2 = new FlowCapableNodeUpdatedBuilder();
try {
builder2.setIpAddress(resolveIpAddress(new InetSocketAddress(1).getAddress()));
} catch (Exception e) {
e.printStackTrace();
}
SwitchFeatures swFeatures = new SwitchFeatures() {
@Override
public <E extends Augmentation<SwitchFeatures>> E getAugmentation(Class<E> arg0) {
// TODO Auto-generated method stub
return null;
}
@Override
public Class<? extends DataContainer> getImplementedInterface() {
// TODO Auto-generated method stub
return null;
}
@Override
public Short getMaxTables() {
// TODO Auto-generated method stub
return null;
}
@Override
public Long getMaxBuffers() {
// TODO Auto-generated method stub
return null;
}
@Override
public List<Class<? extends FeatureCapability>> getCapabilities() {
// TODO Auto-generated method stub
return null;
}
};
SwitchFeaturesUtil swFeaturesUtil = SwitchFeaturesUtil.getInstance();
builder2.setSwitchFeatures(swFeaturesUtil.buildSwitchFeatures(features));
builder.addAugmentation(FlowCapableNodeUpdated.class, builder2.build());
Assert.assertEquals(builder.build(), connectionHandler.nodeAdded(connectionAdapter));
}
示例8: augmentationTypeFor
import org.opendaylight.yangtools.yang.binding.Augmentation; //导入依赖的package包/类
public static ParameterizedType augmentationTypeFor(Type valueType) {
final Type augmentation = typeForClass(Augmentation.class);
return parameterizedTypeFor(augmentation, valueType);
}
示例9: getModifiedAugmentation
import org.opendaylight.yangtools.yang.binding.Augmentation; //导入依赖的package包/类
/**
* Returns augmentation child modification if {@code augmentation} was modified by this
* modification.
*
* For accessing all modified list items consider iterating over {@link #getModifiedChildren()}.
*
* @param augmentation Type of augmentation - must be only container
* @return Modification of {@code augmentation} if {@code augmentation} was modified, null otherwise.
* @throws IllegalArgumentException If supplied {@code augmentation} class is not valid augmentation
* according to generated model.
*/
@Nullable <C extends Augmentation<T> & DataObject> DataObjectModification<C> getModifiedAugmentation(@Nonnull Class<C> augmentation);