Tabnine Logo
ChoiceNode.getChild
Code IndexAdd Tabnine to your IDE (free)

How to use
getChild
method
in
org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode

Best Java code snippets using org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode.getChild (Showing top 14 results out of 315)

origin: org.opendaylight.bgpcep/bgp-linkstate

public static boolean isTeLsp(final ChoiceNode objectType) {
  return objectType.getChild(ADDRESS_FAMILY).isPresent();
}
origin: org.opendaylight.bgpcep/bgp-linkstate

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;
}
origin: org.opendaylight.bgpcep/bgp-rib-spi

private static ContainerNode getDestination(final DataContainerChild<? extends PathArgument, ?> routes, final NodeIdentifier destinationId) {
  if (routes instanceof ContainerNode) {
    final Optional<DataContainerChild<? extends PathArgument, ?>> maybeDestination = ((ContainerNode)routes).getChild(DESTINATION_TYPE);
    if (maybeDestination.isPresent()) {
      final DataContainerChild<? extends PathArgument, ?> destination = maybeDestination.get();
      if (destination instanceof ChoiceNode) {
        final Optional<DataContainerChild<? extends PathArgument, ?>> maybeRet = ((ChoiceNode)destination).getChild(destinationId);
        if (maybeRet.isPresent()) {
          final DataContainerChild<? extends PathArgument, ?> ret = maybeRet.get();
          if (ret instanceof ContainerNode) {
            return (ContainerNode)ret;
          } else {
            LOG.debug("Specified node {} is not a container, ignoring it", ret);
          }
        } else {
          LOG.debug("Specified container {} is not present in destination {}", destinationId, destination);
        }
      } else {
        LOG.warn("Destination {} is not a choice, ignoring it", destination);
      }
    } else {
      LOG.debug("Destination is not present in routes {}", routes);
    }
  } else {
    LOG.warn("Advertized routes {} are not a container, ignoring it", routes);
  }
  return null;
}
origin: org.opendaylight.bgpcep/bgp-linkstate

public static TeLspCase serializeTeLsp(final ChoiceNode objectType) {
  final TeLspCaseBuilder teLsp = new TeLspCaseBuilder();
  teLsp.setLspId(new LspId((Long) objectType.getChild(LSP_ID).get().getValue()));
  teLsp.setTunnelId(new TunnelId((Integer) objectType.getChild(TUNNEL_ID).get().getValue()));
  final ChoiceNode addressFamily = (ChoiceNode) objectType.getChild(ADDRESS_FAMILY).get();
  teLsp.setAddressFamily(serializeAddressFamily(addressFamily, addressFamily.getChild(IPV4_TUNNEL_SENDER_ADDRESS).isPresent()));
  return teLsp.build();
}
origin: org.opendaylight.bgpcep/bgp-linkstate

private static void serializeLocalNodeDescriptor(final CLinkstateDestinationBuilder builder, final ChoiceNode objectType) {
  // link local node descriptors
  final LinkCaseBuilder linkBuilder = new LinkCaseBuilder();
  linkBuilder.setLocalNodeDescriptors(NodeNlriParser.serializeLocalNodeDescriptors((ContainerNode) objectType.getChild(LOCAL_NODE_DESCRIPTORS_NID).get()));
  // link remote node descriptors
  if (objectType.getChild(REMOTE_NODE_DESCRIPTORS_NID).isPresent()) {
    linkBuilder.setRemoteNodeDescriptors(NodeNlriParser.serializeRemoteNodeDescriptors((ContainerNode) objectType.getChild(REMOTE_NODE_DESCRIPTORS_NID).get()));
  }
  // link descriptors
  final Optional<DataContainerChild<? extends PathArgument, ?>> linkDescriptors = objectType.getChild(LINK_DESCRIPTORS_NID);
  if (linkDescriptors.isPresent()) {
    linkBuilder.setLinkDescriptors(LinkNlriParser.serializeLinkDescriptors((ContainerNode) linkDescriptors.get()));
  }
  builder.setObjectType(linkBuilder.build());
}
origin: org.opendaylight.bgpcep/bgp-linkstate

private static void serializeAdvertisedNodeDescriptor(final CLinkstateDestinationBuilder builder, final ChoiceNode objectType) {
  // prefix node descriptors
  final PrefixCaseBuilder prefixBuilder = new PrefixCaseBuilder();
  prefixBuilder.setAdvertisingNodeDescriptors(NodeNlriParser.serializeAdvNodeDescriptors((ContainerNode) objectType.getChild(
    ADVERTISING_NODE_DESCRIPTORS_NID).get()));
  // prefix descriptors
  final Optional<DataContainerChild<? extends PathArgument, ?>> prefixDescriptors = objectType.getChild(PREFIX_DESCRIPTORS_NID);
  if (prefixDescriptors.isPresent()) {
    prefixBuilder.setPrefixDescriptors(AbstractPrefixNlriParser.serializePrefixDescriptors((ContainerNode) prefixDescriptors.get()));
  }
  builder.setObjectType(prefixBuilder.build());
}
origin: org.opendaylight.bgpcep/bgp-linkstate

public static CLinkstateDestination extractLinkstateDestination(final DataContainerNode<? extends PathArgument> linkstate) {
  final CLinkstateDestinationBuilder builder = new CLinkstateDestinationBuilder();
  serializeCommonParts(builder, linkstate);
  final ChoiceNode objectType = (ChoiceNode) linkstate.getChild(OBJECT_TYPE_NID).get();
  if (objectType.getChild(ADVERTISING_NODE_DESCRIPTORS_NID).isPresent()) {
    serializeAdvertisedNodeDescriptor(builder, objectType);
  } else if (objectType.getChild(LOCAL_NODE_DESCRIPTORS_NID).isPresent()) {
    serializeLocalNodeDescriptor(builder, objectType);
  } else if (objectType.getChild(NODE_DESCRIPTORS_NID).isPresent()) {
    serializeNodeDescriptor(builder, objectType);
  } else if (AbstractTeLspNlriCodec.isTeLsp(objectType)) {
    builder.setObjectType(AbstractTeLspNlriCodec.serializeTeLsp(objectType));
  } else {
    LOG.warn("Unknown Object Type: {}.", objectType);
  }
  return builder.build();
}
origin: org.opendaylight.yang-push/yangpush-impl

/**
 * This method parse the pushUpdate notification received
 * for the subscription-id and stores the data to md-sal
 * using path /push-updates/push-update/[subscription-id=sub_id]/
 *
 * @param notification
 * @return DOMSource for the notification
 */
private void pushUpdateHandlder(DOMNotification notification) {
  ContainerNode conNode = notification.getBody();
  ChoiceNode valueNode = null;
  AnyXmlNode anyXmlValue = null;
  DOMSource domSource = null;
  String sub_id = "";
  String timeofeventupdate = "";
  try {
    sub_id = conNode.getChild(subid).get().getValue().toString();
    timeofeventupdate = conNode.getChild(timeofevent).get().getValue().toString();
    valueNode = (ChoiceNode) conNode.getChild(encoding).get();
    anyXmlValue = (AnyXmlNode) valueNode.getChild(contents).get();
    domSource = anyXmlValue.getValue();
  } catch (Exception e) {
    LOG.warn(e.toString());
  }
  //String notificationAsString = domSourceToString(domSource);
  String notificationAsString = valueNode.getChild(contents).get().getValue().toString();
  LOG.trace("Notification recieved for sub_id :{} at : {}:\n {}", sub_id, timeofeventupdate, notificationAsString);
  storeToMdSal(sub_id, timeofeventupdate, domSource, notificationAsString);
}
origin: org.opendaylight.bgpcep/bgp-flowspec

private void processFlowspecType(final ChoiceNode fsType, final FlowspecBuilder fsBuilder) {
  if (fsType.getChild(PORTS_NID).isPresent()) {
    fsBuilder.setFlowspecType(new PortCaseBuilder().setPorts(createPorts((UnkeyedListNode) fsType.getChild(PORTS_NID).get())).build());
  } else if (fsType.getChild(DEST_PORT_NID).isPresent()) {
    fsBuilder.setFlowspecType(new DestinationPortCaseBuilder().setDestinationPorts(createDestinationPorts((UnkeyedListNode) fsType.getChild(DEST_PORT_NID).get())).build());
  } else if (fsType.getChild(SOURCE_PORT_NID).isPresent()) {
    fsBuilder.setFlowspecType(new SourcePortCaseBuilder().setSourcePorts(createSourcePorts((UnkeyedListNode) fsType.getChild(SOURCE_PORT_NID).get())).build());
  } else if (fsType.getChild(ICMP_TYPE_NID).isPresent()) {
    fsBuilder.setFlowspecType(new IcmpTypeCaseBuilder().setTypes(createTypes((UnkeyedListNode) fsType.getChild(ICMP_TYPE_NID).get())).build());
  } else if (fsType.getChild(ICMP_CODE_NID).isPresent()) {
    fsBuilder.setFlowspecType(new IcmpCodeCaseBuilder().setCodes(createCodes((UnkeyedListNode) fsType.getChild(ICMP_CODE_NID).get())).build());
  } else if (fsType.getChild(TCP_FLAGS_NID).isPresent()) {
    fsBuilder.setFlowspecType(new TcpFlagsCaseBuilder().setTcpFlags(createTcpFlags((UnkeyedListNode) fsType.getChild(TCP_FLAGS_NID).get())).build());
  } else if (fsType.getChild(PACKET_LENGTHS_NID).isPresent()) {
    fsBuilder.setFlowspecType(new PacketLengthCaseBuilder().setPacketLengths(createPacketLengths((UnkeyedListNode) fsType.getChild(PACKET_LENGTHS_NID).get())).build());
  } else if (fsType.getChild(DSCP_NID).isPresent()) {
    fsBuilder.setFlowspecType(new DscpCaseBuilder().setDscps(createDscpsLengths((UnkeyedListNode) fsType.getChild(DSCP_NID).get())).build());
  } else if (fsType.getChild(FRAGMENT_NID).isPresent()) {
    fsBuilder.setFlowspecType(new FragmentCaseBuilder().setFragments(createFragments((UnkeyedListNode) fsType.getChild(FRAGMENT_NID).get())).build());
  } else {
    extractSpecificFlowspec(fsType, fsBuilder);
  }
}
origin: org.opendaylight.bgpcep/bgp-flowspec

public static final void extractFlowspec(final ChoiceNode fsType, final FlowspecBuilder fsBuilder) {
  if (fsType.getChild(AbstractFlowspecNlriParser.DEST_PREFIX_NID).isPresent()) {
    fsBuilder.setFlowspecType(
      new DestinationIpv6PrefixCaseBuilder()
        .setDestinationPrefix(new Ipv6Prefix((String) fsType.getChild(AbstractFlowspecNlriParser.DEST_PREFIX_NID).get().getValue()))
        .build()
    );
  } else if (fsType.getChild(AbstractFlowspecNlriParser.SOURCE_PREFIX_NID).isPresent()) {
    fsBuilder.setFlowspecType(
      new SourceIpv6PrefixCaseBuilder()
        .setSourcePrefix(new Ipv6Prefix((String) fsType.getChild(AbstractFlowspecNlriParser.SOURCE_PREFIX_NID).get().getValue()))
        .build()
    );
  } else if (fsType.getChild(NEXT_HEADER_NID).isPresent()) {
    fsBuilder.setFlowspecType(new NextHeaderCaseBuilder().setNextHeaders(createNextHeaders((UnkeyedListNode) fsType.getChild(NEXT_HEADER_NID).get())).build());
  } else if (fsType.getChild(FLOW_LABEL_NID).isPresent()) {
    fsBuilder.setFlowspecType(new FlowLabelCaseBuilder().setFlowLabel(createFlowLabels((UnkeyedListNode) fsType.getChild(FLOW_LABEL_NID).get())).build());
  }
}
origin: org.opendaylight.bgpcep/bgp-flowspec

public static final void extractFlowspec(final ChoiceNode fsType, final FlowspecBuilder fsBuilder) {
  if (fsType.getChild(AbstractFlowspecNlriParser.DEST_PREFIX_NID).isPresent()) {
    fsBuilder.setFlowspecType(
      new DestinationPrefixCaseBuilder()
        .setDestinationPrefix(
          new Ipv4Prefix((String) fsType.getChild(AbstractFlowspecNlriParser.DEST_PREFIX_NID).get().getValue())
        ).build()
    );
  } else if (fsType.getChild(AbstractFlowspecNlriParser.SOURCE_PREFIX_NID).isPresent()) {
    fsBuilder.setFlowspecType(
      new SourcePrefixCaseBuilder()
        .setSourcePrefix(
          new Ipv4Prefix((String) fsType.getChild(AbstractFlowspecNlriParser.SOURCE_PREFIX_NID).get().getValue())
        ).build()
    );
  } else if (fsType.getChild(PROTOCOL_IP_NID).isPresent()) {
    fsBuilder.setFlowspecType(new ProtocolIpCaseBuilder().setProtocolIps(createProtocolsIps((UnkeyedListNode) fsType.getChild(PROTOCOL_IP_NID).get())).build());
  }
}
origin: org.opendaylight.bgpcep/bgp-linkstate

private static AddressFamily serializeAddressFamily(final ChoiceNode addressFamily, final boolean ipv4Case) {
  if (ipv4Case) {
    return new Ipv4CaseBuilder()
      .setIpv4TunnelSenderAddress(new Ipv4Address((String) addressFamily.getChild(IPV4_TUNNEL_SENDER_ADDRESS).get().getValue()))
      .setIpv4TunnelEndpointAddress(new Ipv4Address((String) addressFamily.getChild(IPV4_TUNNEL_ENDPOINT_ADDRESS).get().getValue()))
      .build();
  }
  return new Ipv6CaseBuilder()
    .setIpv6TunnelSenderAddress(new Ipv6Address((String) addressFamily.getChild(IPV6_TUNNEL_SENDER_ADDRESS).get().getValue()))
    .setIpv6TunnelEndpointAddress(new Ipv6Address((String) addressFamily.getChild(IPV6_TUNNEL_ENDPOINT_ADDRESS).get().getValue()))
    .build();
}
origin: org.opendaylight.bgpcep/bgp-linkstate

private static void serializeNodeDescriptor(final CLinkstateDestinationBuilder builder, final ChoiceNode objectType) {
  final NodeCaseBuilder nodeBuilder = new NodeCaseBuilder();
  // node descriptors
  nodeBuilder.setNodeDescriptors(NodeNlriParser.serializeNodeDescriptors((ContainerNode) objectType.getChild(NODE_DESCRIPTORS_NID).get()));
  builder.setObjectType(nodeBuilder.build());
}
origin: org.opendaylight.yang-push/yangpush-impl

DataContainerChild<? extends PathArgument, ?> t2 = t1.getChild(filtertype).get();
ChoiceNode t3 = (ChoiceNode) t2;
DataContainerChild<? extends PathArgument, ?> t4 = t3.getChild(subtreeFilter).get();
if (t4 != null) {
  AnyXmlNode anyXmlFilter = (AnyXmlNode) t4;
org.opendaylight.yangtools.yang.data.api.schemaChoiceNodegetChild

Popular methods of ChoiceNode

  • getValue
  • getIdentifier
  • getNodeType

Popular in Java

  • Reactive rest calls using spring rest template
  • getApplicationContext (Context)
  • scheduleAtFixedRate (Timer)
  • getSharedPreferences (Context)
  • InputStreamReader (java.io)
    A class for turning a byte stream into a character stream. Data read from the source input stream is
  • NumberFormat (java.text)
    The abstract base class for all number formats. This class provides the interface for formatting and
  • Queue (java.util)
    A collection designed for holding elements prior to processing. Besides basic java.util.Collection o
  • JPanel (javax.swing)
  • StringUtils (org.apache.commons.lang)
    Operations on java.lang.String that arenull safe. * IsEmpty/IsBlank - checks if a String contains
  • Project (org.apache.tools.ant)
    Central representation of an Ant project. This class defines an Ant project with all of its targets,
  • Best plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now