-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
691 additions
and
135 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,4 @@ __pycache__/ | |
pycache/ | ||
venv/ | ||
.zip | ||
BUILD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
src/tools/interop/idt/capture/ecosystem/play_services/prober.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# | ||
# Copyright (c) 2023 Project CHIP Authors | ||
# All rights reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
import os | ||
|
||
from capture import log_format | ||
from capture.shell_utils import Bash | ||
|
||
|
||
class PlayServicesProber: | ||
|
||
def __init__(self, platform): | ||
self.platform = platform | ||
self.artifact_dir = self.platform.artifact_dir | ||
self.logger = log_format.get_logger(__file__) | ||
|
||
async def _probe_foyer(self) -> None: | ||
self.logger.info("probing remote services") | ||
tgt = "googlehomefoyer-pa.googleapis.com" | ||
probe_artifact = os.path.join(self.artifact_dir, "net_probes.txt") | ||
command_suffix = f" 2>&1 | tee -a {probe_artifact}" | ||
ping_cmd = f"ping -c 4 {tgt} {command_suffix}" | ||
Bash(ping_cmd, sync=True).start_command() | ||
trace_cmd_i = f"sudo traceroute {tgt} {command_suffix}" | ||
Bash(trace_cmd_i, sync=True).start_command() | ||
trace_cmd_t = f"sudo traceroute -T -p 443 {tgt} {command_suffix}" | ||
Bash(trace_cmd_t, sync=True).start_command() | ||
trace_cmd_u = f"sudo traceroute -U -p 443 {tgt} {command_suffix}" | ||
Bash(trace_cmd_u, sync=True).start_command() | ||
dig_cmd = f"dig {tgt} {command_suffix}" | ||
Bash(dig_cmd, sync=True).start_command() | ||
self.logger.info("probing from phone") | ||
ping_from_phone = f"shell {ping_cmd} {command_suffix}" | ||
self.platform.run_adb_command(ping_from_phone) | ||
|
||
async def probe_services(self) -> None: | ||
for probe_func in filter(lambda s: s.startswith('_probe'), dir(self)): | ||
await getattr(self, probe_func)() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.