summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortturney <tturney@google.com>2017-05-25 07:27:58 -0700
committertturney <tturney@google.com>2017-05-30 18:17:51 -0700
commit2f24b00e0728cd23ace484a871fcba8d5e2f17ae (patch)
treec4399fa55977f5c648b50810e0cc447198d7c832
parent22f652a5f6126a806e7805bf68e6ddc37cc2df0e (diff)
downloadplatform_tools_test_connectivity-2f24b00e0728cd23ace484a871fcba8d5e2f17ae.tar.gz
platform_tools_test_connectivity-2f24b00e0728cd23ace484a871fcba8d5e2f17ae.tar.bz2
platform_tools_test_connectivity-2f24b00e0728cd23ace484a871fcba8d5e2f17ae.zip
PTS Cmd Line Tool for controlling configs
Bug: 38268825 Test: Ran PTS tests Change-Id: I9e7f953d08b035bc785b99b4d3c2844b7b39b2c3 (cherry picked from commit 1347933b4d2a5b31bdb9b208f38defc9045c616d)
-rw-r--r--acts/tests/google/bt/pts/cmd_input.py29
-rw-r--r--acts/tests/google/bt/pts/config_lib.py61
-rw-r--r--acts/tests/google/bt/pts/configs/bt_stack.conf39
-rw-r--r--acts/tests/google/bt/pts/configs/dis_mitm_bt_stack.conf30
-rw-r--r--acts/tests/google/bt/pts/configs/non_bond_bt_stack.conf30
5 files changed, 189 insertions, 0 deletions
diff --git a/acts/tests/google/bt/pts/cmd_input.py b/acts/tests/google/bt/pts/cmd_input.py
index b49167446e..b3e6cbb462 100644
--- a/acts/tests/google/bt/pts/cmd_input.py
+++ b/acts/tests/google/bt/pts/cmd_input.py
@@ -21,6 +21,7 @@ from acts.test_utils.bt.BtEnum import BluetoothScanModeType
from acts.test_utils.bt.GattEnum import GattServerResponses
from ble_lib import BleLib
from bta_lib import BtaLib
+from config_lib import ConfigLib
from gattc_lib import GattClientLib
from gatts_lib import GattServerLib
from rfcomm_lib import RfcommLib
@@ -45,6 +46,7 @@ class CmdInput(cmd.Cmd):
self.log = log
# Initialize libraries
+ self.config_lib = ConfigLib(log, self.pri_dut)
self.bta_lib = BtaLib(log, mac_addr, self.pri_dut)
self.ble_lib = BleLib(log, mac_addr, self.pri_dut)
self.gattc_lib = GattClientLib(log, mac_addr, self.pri_dut)
@@ -796,3 +798,30 @@ class CmdInput(cmd.Cmd):
self.log.info(FAILURE.format(cmd, err))
"""End Rfcomm wrappers"""
+ """Begin Config wrappers"""
+
+ def do_config_reset(self, line):
+ """Reset Bluetooth Config file"""
+ cmd = "Reset Bluetooth Config file"
+ try:
+ self.config_lib.reset()
+ except Exception as err:
+ self.log.info(FAILURE.format(cmd, err))
+
+ def do_config_set_nonbond(self, line):
+ """Set NonBondable Mode"""
+ cmd = "Set NonBondable Mode"
+ try:
+ self.config_lib.set_nonbond()
+ except Exception as err:
+ self.log.info(FAILURE.format(cmd, err))
+
+ def do_config_set_disable_mitm(self, line):
+ """Set Disable MITM"""
+ cmd = "Set Disable MITM"
+ try:
+ self.config_lib.set_disable_mitm()
+ except Exception as err:
+ self.log.info(FAILURE.format(cmd, err))
+
+ """End Config wrappers"""
diff --git a/acts/tests/google/bt/pts/config_lib.py b/acts/tests/google/bt/pts/config_lib.py
new file mode 100644
index 0000000000..01796926e3
--- /dev/null
+++ b/acts/tests/google/bt/pts/config_lib.py
@@ -0,0 +1,61 @@
+#/usr/bin/env python3.4
+#
+# Copyright (C) 2016 The Android Open Source Project
+#
+# 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.
+"""
+Bluetooth Config Pusher
+"""
+
+from acts.test_utils.bt.bt_gatt_utils import disconnect_gatt_connection
+from acts.test_utils.bt.bt_gatt_utils import setup_gatt_connection
+from acts.test_utils.bt.bt_gatt_utils import setup_gatt_mtu
+from acts.test_utils.bt.GattEnum import GattCbStrings
+from acts.test_utils.bt.GattEnum import GattDescriptor
+from acts.test_utils.bt.GattEnum import GattTransport
+from acts.test_utils.bt.bt_gatt_utils import log_gatt_server_uuids
+
+import time
+import os
+
+
+class ConfigLib():
+ bluetooth_config_path = "/system/etc/bluetooth/bt_stack.conf"
+ conf_path = "{}/configs".format(
+ os.path.dirname(os.path.realpath(__file__)))
+ reset_config_path = "{}/bt_stack.conf".format(conf_path)
+ non_bond_config_path = "{}/non_bond_bt_stack.conf".format(conf_path)
+ disable_mitm_config_path = "{}/dis_mitm_bt_stack.conf".format(conf_path)
+
+ def __init__(self, log, dut):
+ self.dut = dut
+ self.log = log
+
+ def _reset_bluetooth(self):
+ self.dut.droid.bluetoothToggleState(False)
+ self.dut.droid.bluetoothToggleState(True)
+
+ def reset(self):
+ self.dut.adb.push("{} {}".format(self.reset_config_path,
+ self.bluetooth_config_path))
+ self._reset_bluetooth()
+
+ def set_nonbond(self):
+ self.dut.adb.push("{} {}".format(self.non_bond_config_path,
+ self.bluetooth_config_path))
+ self._reset_bluetooth()
+
+ def set_disable_mitm(self):
+ self.dut.adb.push("{} {}".format(self.disable_mitm_config_path,
+ self.bluetooth_config_path))
+ self._reset_bluetooth()
diff --git a/acts/tests/google/bt/pts/configs/bt_stack.conf b/acts/tests/google/bt/pts/configs/bt_stack.conf
new file mode 100644
index 0000000000..dffba01aff
--- /dev/null
+++ b/acts/tests/google/bt/pts/configs/bt_stack.conf
@@ -0,0 +1,39 @@
+# Enable BtSnoop logging function
+# valid value : true, false
+BtSnoopLogOutput=true
+
+# BtSnoop log output file
+BtSnoopFileName=/data/misc/bluetooth/logs/btsnoop_hci.log
+
+# Preserve existing BtSnoop log before overwriting
+BtSnoopSaveLog=true
+
+# Enable trace level reconfiguration function
+# Must be present before any TRC_ trace level settings
+TraceConf=true
+
+# Trace level configuration
+# BT_TRACE_LEVEL_NONE 0 ( No trace messages to be generated )
+# BT_TRACE_LEVEL_ERROR 1 ( Error condition trace messages )
+# BT_TRACE_LEVEL_WARNING 2 ( Warning condition trace messages )
+# BT_TRACE_LEVEL_API 3 ( API traces )
+# BT_TRACE_LEVEL_EVENT 4 ( Debug messages for events )
+# BT_TRACE_LEVEL_DEBUG 5 ( Full debug messages )
+# BT_TRACE_LEVEL_VERBOSE 6 ( Verbose messages ) - Currently supported for TRC_BTAPP only.
+TRC_BTM=5
+TRC_HCI=5
+TRC_L2CAP=5
+TRC_RFCOMM=5
+TRC_OBEX=5
+TRC_AVCT=5
+TRC_AVDT=5
+TRC_AVRC=5
+TRC_AVDT_SCB=5
+TRC_AVDT_CCB=5
+TRC_A2D=2
+TRC_SDP=5
+TRC_GATT=5
+TRC_SMP=5
+TRC_BTAPP=5
+TRC_BTIF=5
+
diff --git a/acts/tests/google/bt/pts/configs/dis_mitm_bt_stack.conf b/acts/tests/google/bt/pts/configs/dis_mitm_bt_stack.conf
new file mode 100644
index 0000000000..120fc1e6ea
--- /dev/null
+++ b/acts/tests/google/bt/pts/configs/dis_mitm_bt_stack.conf
@@ -0,0 +1,30 @@
+# Enable trace level reconfiguration function
+# Must be present before any TRC_ trace level settings
+TraceConf=true
+
+# Trace level configuration
+# BT_TRACE_LEVEL_NONE 0 ( No trace messages to be generated )
+# BT_TRACE_LEVEL_ERROR 1 ( Error condition trace messages )
+# BT_TRACE_LEVEL_WARNING 2 ( Warning condition trace messages )
+# BT_TRACE_LEVEL_API 3 ( API traces )
+# BT_TRACE_LEVEL_EVENT 4 ( Debug messages for events )
+# BT_TRACE_LEVEL_DEBUG 5 ( Full debug messages )
+# BT_TRACE_LEVEL_VERBOSE 6 ( Verbose messages ) - Currently supported for TRC_BTAPP only.
+TRC_BTM=5
+TRC_HCI=5
+TRC_L2CAP=5
+TRC_RFCOMM=5
+TRC_OBEX=5
+TRC_AVCT=5
+TRC_AVDT=5
+TRC_AVRC=5
+TRC_AVDT_SCB=5
+TRC_AVDT_CCB=5
+TRC_A2D=2
+TRC_SDP=5
+TRC_GATT=5
+TRC_SMP=5
+TRC_BTAPP=5
+TRC_BTIF=5
+
+PTS_SmpOptions=0x9,0x4,0xf,0xf,0x10
diff --git a/acts/tests/google/bt/pts/configs/non_bond_bt_stack.conf b/acts/tests/google/bt/pts/configs/non_bond_bt_stack.conf
new file mode 100644
index 0000000000..3dedf7e2b8
--- /dev/null
+++ b/acts/tests/google/bt/pts/configs/non_bond_bt_stack.conf
@@ -0,0 +1,30 @@
+# Enable trace level reconfiguration function
+# Must be present before any TRC_ trace level settings
+TraceConf=true
+
+# Trace level configuration
+# BT_TRACE_LEVEL_NONE 0 ( No trace messages to be generated )
+# BT_TRACE_LEVEL_ERROR 1 ( Error condition trace messages )
+# BT_TRACE_LEVEL_WARNING 2 ( Warning condition trace messages )
+# BT_TRACE_LEVEL_API 3 ( API traces )
+# BT_TRACE_LEVEL_EVENT 4 ( Debug messages for events )
+# BT_TRACE_LEVEL_DEBUG 5 ( Full debug messages )
+# BT_TRACE_LEVEL_VERBOSE 6 ( Verbose messages ) - Currently supported for TRC_BTAPP only.
+TRC_BTM=5
+TRC_HCI=5
+TRC_L2CAP=5
+TRC_RFCOMM=5
+TRC_OBEX=5
+TRC_AVCT=5
+TRC_AVDT=5
+TRC_AVRC=5
+TRC_AVDT_SCB=5
+TRC_AVDT_CCB=5
+TRC_A2D=2
+TRC_SDP=5
+TRC_GATT=5
+TRC_SMP=5
+TRC_BTAPP=5
+TRC_BTIF=5
+
+PTS_SmpOptions=0xC,0x4,0xf,0xf,0x10