本文整理汇总了Java中org.opendaylight.yangtools.yang.data.api.schema.ContainerNode.getChild方法的典型用法代码示例。如果您正苦于以下问题:Java ContainerNode.getChild方法的具体用法?Java ContainerNode.getChild怎么用?Java ContainerNode.getChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.opendaylight.yangtools.yang.data.api.schema.ContainerNode
的用法示例。
在下文中一共展示了ContainerNode.getChild方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processDestination
import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode; //导入方法依赖的package包/类
@Override
protected final void processDestination(
final DOMDataWriteTransaction tx,
final YangInstanceIdentifier routesPath,
final ContainerNode destination,
final ContainerNode attributes,
final ApplyRoute function
) {
if (destination != null) {
final YangInstanceIdentifier base = routesPath.node(routesContainerIdentifier()).node(routeQName());
final Optional<DataContainerChild<? extends PathArgument, ?>> maybePathIdLeaf = destination.getChild(routePathIdNid());
final String routeKeyValue = this.nlriParser.stringNlri(destination);
final NodeIdentifierWithPredicates routeKey = PathIdUtil.createNidKey(routeQName(), routeKeyQName(), pathIdQName(), routeKeyValue, maybePathIdLeaf);
function.apply(tx, base, routeKey, destination, attributes);
}
}
示例2: serializeRouterId
import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode; //导入方法依赖的package包/类
private static CRouterIdentifier serializeRouterId(final ContainerNode descriptorsData) {
CRouterIdentifier cRouterId = null;
final Optional<DataContainerChild<? extends PathArgument, ?>> maybeRouterId = descriptorsData.getChild(ROUTER_NID);
if (maybeRouterId.isPresent()) {
final ChoiceNode routerId = (ChoiceNode) maybeRouterId.get();
if (routerId.getChild(ISIS_NODE_NID).isPresent()) {
cRouterId = serializeIsisNode((ContainerNode) routerId.getChild(ISIS_NODE_NID).get());
} else if (routerId.getChild(ISIS_PSEUDONODE_NID).isPresent()) {
cRouterId = serializeIsisPseudoNode((ContainerNode) routerId.getChild(ISIS_PSEUDONODE_NID).get());
} else if (routerId.getChild(OSPF_NODE_NID).isPresent()) {
cRouterId = serializeOspfNode((ContainerNode) routerId.getChild(OSPF_NODE_NID).get());
} else if (routerId.getChild(OSPF_PSEUDONODE_NID).isPresent()) {
cRouterId = serializeOspfPseudoNode((ContainerNode) routerId.getChild(OSPF_PSEUDONODE_NID).get());
}
}
return cRouterId;
}
示例3: processDestination
import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode; //导入方法依赖的package包/类
@Override
protected void processDestination(final DOMDataWriteTransaction tx, final YangInstanceIdentifier routesPath,
final ContainerNode destination, final ContainerNode attributes, final ApplyRoute function) {
if (destination != null) {
final Optional<DataContainerChild<? extends PathArgument, ?>> maybeRoutes = destination.getChild(NLRI_ROUTES_LIST);
if (maybeRoutes.isPresent()) {
final DataContainerChild<? extends PathArgument, ?> routes = maybeRoutes.get();
if (routes instanceof UnkeyedListNode) {
final YangInstanceIdentifier base = routesPath.node(routesContainerIdentifier()).node(routeNid());
for (final UnkeyedListEntryNode e : ((UnkeyedListNode) routes).getValue()) {
final NodeIdentifierWithPredicates routeKey = createRouteKey(e);
function.apply(tx, base, routeKey, e, attributes);
}
} else {
LOG.warn("Routes {} are not a map", routes);
}
}
}
}
示例4: processDestination
import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode; //导入方法依赖的package包/类
@Override
protected void processDestination(final DOMDataWriteTransaction tx, final YangInstanceIdentifier routesPath,
final ContainerNode destination, final ContainerNode attributes, final ApplyRoute function) {
if (destination != null) {
final Optional<DataContainerChild<? extends PathArgument, ?>> maybeRoutes =
destination.getChild(this.nlriRoutesListNid);
if (maybeRoutes.isPresent()) {
final DataContainerChild<? extends PathArgument, ?> routes = maybeRoutes.get();
if (routes instanceof UnkeyedListNode) {
final UnkeyedListNode routeListNode = (UnkeyedListNode) routes;
LOG.debug("{} routes are found", routeListNode.getSize());
final YangInstanceIdentifier base = routesPath.node(routesContainerIdentifier()).node(routeNid());
for (final UnkeyedListEntryNode e : routeListNode.getValue()) {
final NodeIdentifierWithPredicates key = createRouteKey(e);
LOG.debug("Route {} is processed.", key);
function.apply(tx, base, key, e, attributes);
}
} else {
LOG.warn("Routes {} are not a map", routes);
}
}
} else {
LOG.debug("Destination is null.");
}
}
示例5: processDestination
import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode; //导入方法依赖的package包/类
@Override
protected void processDestination(final DOMDataWriteTransaction tx, final YangInstanceIdentifier routesPath,
final ContainerNode destination, final ContainerNode attributes, final ApplyRoute function) {
if (destination != null) {
final Optional<DataContainerChild<? extends PathArgument, ?>> maybeRoutes =
destination.getChild(this.nlriRoutesList);
if (maybeRoutes.isPresent()) {
final DataContainerChild<? extends PathArgument, ?> routes = maybeRoutes.get();
if (routes instanceof UnkeyedListNode) {
// Instance identifier to table/(choice routes)/(map of route)
// FIXME: cache on per-table basis (in TableContext, for example)
final YangInstanceIdentifier base = routesPath.node(routesContainerIdentifier()).node(routeNid());
for (final UnkeyedListEntryNode e : ((UnkeyedListNode) routes).getValue()) {
final NodeIdentifierWithPredicates routeKey = createRouteKey(e);
function.apply(tx, base, routeKey, e, attributes);
}
} else {
LOG.warn("Routes {} are not a map", routes);
}
}
}
}
示例6: testAnyXmlStreaming
import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode; //导入方法依赖的package包/类
@Test
public void testAnyXmlStreaming() throws Exception {
String xml = "<foo xmlns=\"http://www.w3.org/TR/html4/\" x=\"123\"><bar>one</bar><bar>two</bar></foo>";
final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
Node xmlNode = factory.newDocumentBuilder().parse(
new InputSource(new StringReader(xml))).getDocumentElement();
assertEquals("http://www.w3.org/TR/html4/", xmlNode.getNamespaceURI());
NormalizedNode<?, ?> anyXmlContainer = ImmutableContainerNodeBuilder.create().withNodeIdentifier(
new YangInstanceIdentifier.NodeIdentifier(TestModel.TEST_QNAME)).withChild(
Builders.anyXmlBuilder().withNodeIdentifier(new NodeIdentifier(TestModel.ANY_XML_QNAME))
.withValue(new DOMSource(xmlNode)).build()).build();
ByteArrayOutputStream bos = new ByteArrayOutputStream();
NormalizedNodeDataOutput nnout = NormalizedNodeInputOutput.newDataOutput(ByteStreams.newDataOutput(bos));
nnout.writeNormalizedNode(anyXmlContainer);
NormalizedNodeDataInput nnin = NormalizedNodeInputOutput.newDataInput(ByteStreams.newDataInput(
bos.toByteArray()));
ContainerNode deserialized = (ContainerNode)nnin.readNormalizedNode();
Optional<DataContainerChild<? extends PathArgument, ?>> child =
deserialized.getChild(new NodeIdentifier(TestModel.ANY_XML_QNAME));
assertEquals("AnyXml child present", true, child.isPresent());
StreamResult xmlOutput = new StreamResult(new StringWriter());
Transformer transformer = TransformerFactory.newInstance().newTransformer();
transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
transformer.transform(((AnyXmlNode)child.get()).getValue(), xmlOutput);
assertEquals("XML", xml, xmlOutput.getWriter().toString());
assertEquals("http://www.w3.org/TR/html4/", ((AnyXmlNode)child.get()).getValue().getNode().getNamespaceURI());
}
示例7: deleteRoutes
import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode; //导入方法依赖的package包/类
@Override
@SuppressWarnings("checkstyle:OverloadMethodsDeclarationOrder")
public final void deleteRoutes(final DOMDataWriteTransaction tx, final YangInstanceIdentifier tablePath,
final ContainerNode nlri, final NodeIdentifier routesNodeId) {
final Optional<DataContainerChild<? extends PathArgument, ?>> maybeRoutes = nlri.getChild(WITHDRAWN_ROUTES);
if (maybeRoutes.isPresent()) {
final ContainerNode destination = getDestination(maybeRoutes.get(), destinationContainerIdentifier());
if (destination != null) {
deleteDestinationRoutes(tx, tablePath, destination, routesNodeId);
}
} else {
LOG.debug("Withdrawn routes are not present in NLRI {}", nlri);
}
}
示例8: putRoutes
import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode; //导入方法依赖的package包/类
@Override
public final void putRoutes(final DOMDataWriteTransaction tx, final YangInstanceIdentifier tablePath,
final ContainerNode nlri, final ContainerNode attributes, final NodeIdentifier routesNodeId) {
final Optional<DataContainerChild<? extends PathArgument, ?>> maybeRoutes = nlri.getChild(ADVERTISED_ROUTES);
if (maybeRoutes.isPresent()) {
final ContainerNode destination = getDestination(maybeRoutes.get(), destinationContainerIdentifier());
if (destination != null) {
putDestinationRoutes(tx, tablePath, destination, attributes, routesNodeId);
}
} else {
LOG.debug("Advertized routes are not present in NLRI {}", nlri);
}
}
示例9: serializeAsNumber
import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode; //导入方法依赖的package包/类
private static AsNumber serializeAsNumber(final ContainerNode descriptorsData) {
final Optional<DataContainerChild<? extends PathArgument, ?>> asNumber = descriptorsData.getChild(AS_NUMBER_NID);
if (asNumber.isPresent()) {
return new AsNumber((Long) asNumber.get().getValue());
}
return null;
}
示例10: serializeDomainId
import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode; //导入方法依赖的package包/类
private static DomainIdentifier serializeDomainId(final ContainerNode descriptorsData) {
final Optional<DataContainerChild<? extends PathArgument, ?>> domainId = descriptorsData.getChild(DOMAIN_NID);
if (domainId.isPresent()) {
return new DomainIdentifier((Long) domainId.get().getValue());
}
return null;
}
示例11: serializeAreaId
import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode; //导入方法依赖的package包/类
private static AreaIdentifier serializeAreaId(final ContainerNode descriptorsData) {
final Optional<DataContainerChild<? extends PathArgument, ?>> areaId = descriptorsData.getChild(AREA_NID);
if (areaId.isPresent()) {
return new AreaIdentifier((Long) areaId.get().getValue());
}
return null;
}
示例12: serializeBgpRouterId
import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode; //导入方法依赖的package包/类
private static Ipv4Address serializeBgpRouterId(final ContainerNode descriptorsData) {
final Optional<DataContainerChild<? extends PathArgument, ?>> bgpRouterId = descriptorsData.getChild(BGP_ROUTER_NID);
if (bgpRouterId.isPresent()) {
return new Ipv4Address((String) bgpRouterId.get().getValue());
}
return null;
}
示例13: serializeMemberAsn
import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode; //导入方法依赖的package包/类
private static AsNumber serializeMemberAsn(final ContainerNode descriptorsData) {
final Optional<DataContainerChild<? extends PathArgument, ?>> memberAsn = descriptorsData.getChild(MEMBER_ASN_NID);
if (memberAsn.isPresent()) {
return new AsNumber((Long) memberAsn.get().getValue());
}
return null;
}
示例14: serializeModel
import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode; //导入方法依赖的package包/类
public static OspfRouteType serializeModel(final ContainerNode prefixDesc) {
final Optional<DataContainerChild<? extends YangInstanceIdentifier.PathArgument, ?>> ospfRoute = prefixDesc.getChild(OSPF_ROUTE_NID);
if (ospfRoute.isPresent()) {
return OspfRouteType.forValue(domOspfRouteTypeValue((String) ospfRoute.get().getValue()));
}
return null;
}
示例15: processDestination
import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode; //导入方法依赖的package包/类
@Override
protected void processDestination(final DOMDataWriteTransaction tx, final YangInstanceIdentifier routesPath,
final ContainerNode destination, final ContainerNode attributes, final ApplyRoute function) {
if (destination != null) {
final Optional<DataContainerChild<? extends PathArgument, ?>> maybeRoutes = destination.getChild(this.nlriRoutesList);
processRoute(maybeRoutes, routesPath, attributes, function, tx);
}
}