gcpdiag/runbook/dataproc/cluster_creation.py [437:562]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        )
        return
      # Skip DPGKE clusters
      if not cluster.is_gce_cluster:
        op.add_skipped(
            cluster,
            reason='This is a Dataproc on GKE cluster, skipping this step.',
        )
      # Skip single node clusters
      if cluster.is_single_node_cluster:
        op.add_skipped(
            cluster,
            reason='This is a single node cluster, skipping this step.')
      # target (master node or master node 0)
      if cluster.is_ha_cluster:
        target = gce.get_instance(
            project_id=op.get(flags.PROJECT_ID),
            zone=cluster_zone,
            instance_name=f'{cluster.name}-m-0',
        )
      else:
        target = gce.get_instance(
            project_id=op.get(flags.PROJECT_ID),
            zone=cluster_zone,
            instance_name=f'{cluster.name}-m',
        )
      target_ip = target.get_network_ip_for_instance_interface(
          cluster.gce_network_uri)
      # source (worker node 0)
      source = gce.get_instance(
          project_id=op.get(flags.PROJECT_ID),
          zone=cluster_zone,
          instance_name=f'{cluster.name}-w-0',
      )
      source_ip = source.get_network_ip_for_instance_interface(
          cluster.gce_network_uri)

      is_connectivity_fine = True

      # run connectivity tests between master and worker
      op.info('Running connectivity tests.')
      # ICMP
      op.info('ICMP test.')
      connectivity_test_result = networkmanagement.run_connectivity_test(
          project_id=op.get(flags.PROJECT_ID),
          src_ip=str(source_ip)[:-3],
          dest_ip=str(target_ip)[:-3],
          dest_port=None,
          protocol='ICMP')
      op.info('Connectivity test result: ' +
              connectivity_test_result['reachabilityDetails']['result'])
      if connectivity_test_result['reachabilityDetails'][
          'result'] != 'REACHABLE':
        is_connectivity_fine = False
        for trace in connectivity_test_result['reachabilityDetails']['traces']:
          op.info('Endpoint details: ' +
                  json.dumps(trace['endpointInfo'], indent=2))
          last_step = None
          for step in trace['steps']:
            last_step = step
          op.info('Last step: ' + json.dumps(last_step, indent=2))
          op.info('Full list of steps: ' + json.dumps(trace['steps'], indent=2))
        op.info(
            'ICMP traffic must be allowed. Check the result of the connectivity '
            + 'test to verify what is blocking the traffic, ' +
            'in particular Last step and Full list of steps.')
      # TCP
      op.info('TCP test.')
      connectivity_test_result = networkmanagement.run_connectivity_test(
          project_id=op.get(flags.PROJECT_ID),
          src_ip=str(source_ip)[:-3],
          dest_ip=str(target_ip)[:-3],
          dest_port=8088,
          protocol='TCP')
      op.info('Connectivity test result: ' +
              connectivity_test_result['reachabilityDetails']['result'])
      if connectivity_test_result['reachabilityDetails'][
          'result'] != 'REACHABLE':
        is_connectivity_fine = False
        for trace in connectivity_test_result['reachabilityDetails']['traces']:
          op.info('Endpoint details: ' +
                  json.dumps(trace['endpointInfo'], indent=2))
          last_step = None
          for step in trace['steps']:
            last_step = step
          op.info('Last step: ' + json.dumps(last_step, indent=2))
          op.info('Full list of steps: ' + json.dumps(trace['steps'], indent=2))
        op.info(
            'TCP traffic must be allowed. Check the result of the connectivity test'
            + 'to verify what is blocking the traffic, ' +
            'in particular Last step and Full list of steps.')
      # UCP
      op.info('UDP test.')
      connectivity_test_result = networkmanagement.run_connectivity_test(
          project_id=op.get(flags.PROJECT_ID),
          src_ip=str(source_ip)[:-3],
          dest_ip=str(target_ip)[:-3],
          dest_port=8088,
          protocol='UDP')
      op.info('Connectivity test result: ' +
              connectivity_test_result['reachabilityDetails']['result'])
      if connectivity_test_result['reachabilityDetails'][
          'result'] != 'REACHABLE':
        is_connectivity_fine = False
        for trace in connectivity_test_result['reachabilityDetails']['traces']:
          op.info('Endpoint details: ' +
                  json.dumps(trace['endpointInfo'], indent=2))
          last_step = None
          for step in trace['steps']:
            last_step = step
          op.info('Last step: ' + json.dumps(last_step, indent=2))
          op.info('Full list of steps: ' + json.dumps(trace['steps'], indent=2))
        op.info(
            'UDP traffic must be allowed. Check the result of the connectivity test '
            + 'to verify what is blocking the traffic, ' +
            'in particular Last step and Full list of steps.')

      if is_connectivity_fine:
        op.add_ok(cluster,
                  op.prep_msg(op.SUCCESS_REASON, cluster_name=cluster.name))
      else:
        op.add_failed(
            cluster,
            reason=op.prep_msg(op.FAILURE_REASON, cluster_name=cluster.name),
            remediation=op.prep_msg(op.FAILURE_REMEDIATION),
        )
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



