1# Copyright (C) 2024 The Android Open Source Project 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14 15import re 16import sys 17 18from mmi2grpc._helpers import assert_description 19from mmi2grpc._proxy import ProfileProxy 20from pandora.host_grpc import Host 21from pandora_experimental.os_grpc import Os 22from pandora_experimental.pan_grpc import PAN 23 24# IP address of PTS 25TSPX_PTS_IP_ADDRESS = "192.168.168.100" 26 27 28class PANProxy(ProfileProxy): 29 30 def __init__(self, channel): 31 super().__init__(channel) 32 self.host = Host(channel) 33 self.pan = PAN(channel) 34 self.os = Os(channel) 35 36 def TSC_BNEP_mmi_iut_accept_transport(self, pts_addr: bytes, **kwargs): 37 """ 38 Take action to accept the PAN transport from the tester. 39 40 Note: The IUT 41 must accept the Basic L2cap configuration for this test case. 42 """ 43 44 # Only accepting pairing here. 45 self.pan.EnableTethering() 46 self.host.WaitConnection(address=pts_addr) 47 48 return "OK" 49 50 @assert_description 51 def TSC_BNEP_mmi_iut_accept_setup(self, pts_addr: bytes, **kwargs): 52 """ 53 Take action to accept setup connection. 54 """ 55 56 return "OK" 57 58 def TSC_BNEP_mmi_iut_initiate_transport(self, test: str, pts_addr: bytes, **kwargs): 59 """ 60 Take action to initiate an PAN transport . 61 62 Note: The IUT must require 63 Basic L2cap configuration for this test case. 64 """ 65 66 self.host.Connect(address=pts_addr) 67 if test in "BNEP/CTRL/BV-02-C": 68 self.pan.ConnectPan(address=pts_addr) 69 70 return "OK" 71 72 @assert_description 73 def TSC_BNEP_mmi_iut_initiate_setup(self, **kwargs): 74 """ 75 Take action to initiate setup connection 76 """ 77 78 return "OK" 79 80 @assert_description 81 def TSC_BNEP_mmi_iut_accept_unknown(self, **kwargs): 82 """ 83 Take action to response to reserve control message 84 """ 85 return "OK" 86 87 @assert_description 88 def TSC_BNEP_mmi_iut_accept_filter_network(self, **kwargs): 89 """ 90 Take action to accept filter network. 91 """ 92 return "OK" 93 94 @assert_description 95 def TSC_BNEP_mmi_iut_accept_filter_multicast(self, **kwargs): 96 """ 97 Take action to accept filter multicast. 98 """ 99 return "OK" 100 101 @assert_description 102 def TSC_BNEP_mmi_iut_confirm_general_ethernet(self, **kwargs): 103 """ 104 Please confirm IUT received general ethernet request. 105 """ 106 return "OK" 107 108 @assert_description 109 def TSC_PAN_mmi_iut_send_arp_probe_request(self, **kwargs): 110 """ 111 Take action to send ARP probe request for the process of choosing a 112 valid LINKLOCAL IP address. 113 114 Notes: 115 (1) It may be necessary to clear 116 the assigned IP on the IUT first in order to trigger ARP request. 117 (2) 118 PTS anticipates an ARP request which has the destination protocol 119 address field matching the value set in TSPX_iut_ip_address. 120 """ 121 122 return "OK" 123 124 @assert_description 125 def TSC_BNEP_mmi_iut_accept_general_ethernet(self, **kwargs): 126 """ 127 Take action to accept general ethernet. 128 """ 129 130 return "OK" 131 132 @assert_description 133 def TSC_PAN_mmi_iut_dhcp_discovery_request(self, **kwargs): 134 """ 135 Take action to send dhcp discovery request 136 """ 137 138 return "OK" 139 140 @assert_description 141 def TSC_PAN_mmi_iut_icmp_echo_reply(self, **kwargs): 142 """ 143 Take action to respond with ICMP echo reply 144 """ 145 146 return "OK" 147 148 @assert_description 149 def TSC_BNEP_mmi_iut_initiate_general_ethernet(self, **kwargs): 150 """ 151 Take action to initiate general ethernet 152 """ 153 154 return "OK" 155 156 @assert_description 157 def TSC_BNEP_mmi_iut_initiate_compressed_ethernet_dest(self, **kwargs): 158 """ 159 Take action to initiate compressed ethernet destination 160 """ 161 162 return "OK" 163 164 @assert_description 165 def TSC_BNEP_mmi_iut_confirm_compressed_ethernet_dest(self, **kwargs): 166 """ 167 Please confirm IUT received compressed ethernet destination request. 168 """ 169 170 return "OK" 171 172 @assert_description 173 def TSC_PAN_mmi_iut_dhcp_request_request(self, **kwargs): 174 """ 175 Take action to send dhcp request 176 """ 177 178 return "OK" 179 180 @assert_description 181 def TSC_PAN_mmi_confirm_ip_address_configured_from_DHCP(self, **kwargs): 182 """ 183 Click OK if the IUT has configured a new IP address assigned by the DHCP 184 server. 185 186 Note: If IUT is able to handle multiple IP addresses, any 187 active IP connections may be maintained. If IUT is able to handle one 188 single IP address at the time any active applications SHALL be 189 terminated. 190 """ 191 192 return "OK" 193 194 @assert_description 195 def TSC_BNEP_mmi_iut_initiate_compressed_ethernet_source(self, **kwargs): 196 """ 197 Take action to initiate compressed ethernet source 198 """ 199 200 return "OK" 201 202 @assert_description 203 def TSC_BNEP_mmi_iut_confirm_compressed_ethernet_source(self, **kwargs): 204 """ 205 Please confirm IUT received compressed ethernet source request. 206 """ 207 208 return "OK" 209 210 @assert_description 211 def TSC_BNEP_mmi_iut_initiate_compressed_ethernet(self, **kwargs): 212 """ 213 Take action to initiate compressed ethernet 214 """ 215 216 return "OK" 217 218 @assert_description 219 def TSC_BNEP_mmi_iut_confirm_compressed_ethernet(self, **kwargs): 220 """ 221 Please confirm IUT received compressed ethernet request. 222 """ 223 224 return "OK" 225 226 @assert_description 227 def TSC_PAN_mmi_confirm_linklocal_ip_address_selected(self, **kwargs): 228 """ 229 Click OK if the IUT has selected a LINKLOCAL IP address: 230 """ 231 232 return "OK" 233 234 @assert_description 235 def TSC_PAN_mmi_iut_icmp_echo_request(self, **kwargs): 236 """ 237 Take action to send ICMP echo request 238 """ 239 240 self.os.SendPing(ip_address=TSPX_PTS_IP_ADDRESS) 241 242 return "OK" 243 244 @assert_description 245 def TSC_PAN_mmi_iut_receive_icmp_echo_reply(self, **kwargs): 246 """ 247 Has the IUT received the ICMP echo reply from PTS? 248 """ 249 250 return "OK" 251 252 @assert_description 253 def TSC_PAN_mmi_iut_send_dns_request(self, **kwargs): 254 """ 255 Take action to send DNS request 256 """ 257 258 return "OK" 259