1#!/usr/bin/env python3 2# 3# Copyright 2016 - The Android Open Source Project 4# 5# Licensed under the Apache License, Version 2.0 (the "License"); 6# you may not use this file except in compliance with the License. 7# You may obtain a copy of the License at 8# 9# http://www.apache.org/licenses/LICENSE-2.0 10# 11# Unless required by applicable law or agreed to in writing, software 12# distributed under the License is distributed on an "AS IS" BASIS, 13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14# See the License for the specific language governing permissions and 15# limitations under the License. 16""" 17Controller interface for Anritsu Signalling Tester MD8475A. 18""" 19 20import logging 21import time 22import socket 23from enum import Enum 24from enum import IntEnum 25 26from acts.controllers.anritsu_lib._anritsu_utils import AnritsuError 27from acts.controllers.anritsu_lib._anritsu_utils import AnritsuUtils 28from acts.controllers.anritsu_lib._anritsu_utils import NO_ERROR 29from acts.controllers.anritsu_lib._anritsu_utils import OPERATION_COMPLETE 30 31from acts import tracelogger 32 33TERMINATOR = "\0" 34 35# The following wait times (except COMMUNICATION_STATE_WAIT_TIME) are actually 36# the times for socket to time out. Increasing them is to make sure there is 37# enough time for MD8475A operation to be completed in some cases. 38# It won't increase test execution time. 39SMARTSTUDIO_LAUNCH_WAIT_TIME = 300 # was 90 40SMARTSTUDIO_SIMULATION_START_WAIT_TIME = 300 # was 120 41REGISTRATION_STATE_WAIT_TIME = 240 42LOAD_SIMULATION_PARAM_FILE_WAIT_TIME = 30 43COMMUNICATION_STATE_WAIT_TIME = 240 44ANRITSU_SOCKET_BUFFER_SIZE = 8192 45COMMAND_COMPLETE_WAIT_TIME = 180 # was 90 46SETTLING_TIME = 1 47WAIT_TIME_IDENTITY_RESPONSE = 5 48IDLE_STATE_WAIT_TIME = 240 49 50IMSI_READ_USERDATA_WCDMA = "081501" 51IMEI_READ_USERDATA_WCDMA = "081502" 52IMEISV_READ_USERDATA_WCDMA = "081503" 53IMSI_READ_USERDATA_LTE = "075501" 54IMEI_READ_USERDATA_LTE = "075502" 55IMEISV_READ_USERDATA_LTE = "075503" 56IMSI_READ_USERDATA_GSM = "081501" 57IMEI_READ_USERDATA_GSM = "081502" 58IMEISV_READ_USERDATA_GSM = "081503" 59IDENTITY_REQ_DATA_LEN = 24 60SEQ_LOG_MESSAGE_START_INDEX = 60 61 62WCDMA_BANDS = { 63 "I": "1", 64 "II": "2", 65 "III": "3", 66 "IV": "4", 67 "V": "5", 68 "VI": "6", 69 "VII": "7", 70 "VIII": "8", 71 "IX": "9", 72 "X": "10", 73 "XI": "11", 74 "XII": "12", 75 "XIII": "13", 76 "XIV": "14" 77} 78 79 80def create(configs): 81 objs = [] 82 for c in configs: 83 ip_address = c["ip_address"] 84 objs.append(MD8475A(ip_address)) 85 return objs 86 87 88def destroy(objs): 89 return 90 91 92class ProcessingStatus(Enum): 93 ''' MD8475A processing status for UE,Packet,Voice,Video,SMS, 94 PPP, PWS ''' 95 PROCESS_STATUS_NONE = "NONE" 96 PROCESS_STATUS_NOTRUN = "NOTRUN" 97 PROCESS_STATUS_POWEROFF = "POWEROFF" 98 PROCESS_STATUS_REGISTRATION = "REGISTRATION" 99 PROCESS_STATUS_DETACH = "DETACH" 100 PROCESS_STATUS_IDLE = "IDLE" 101 PROCESS_STATUS_ORIGINATION = "ORIGINATION" 102 PROCESS_STATUS_HANDOVER = "HANDOVER" 103 PROCESS_STATUS_UPDATING = "UPDATING" 104 PROCESS_STATUS_TERMINATION = "TERMINATION" 105 PROCESS_STATUS_COMMUNICATION = "COMMUNICATION" 106 PROCESS_STATUS_UERELEASE = "UERELEASE" 107 PROCESS_STATUS_NWRELEASE = "NWRELEASE" 108 109 110class BtsNumber(Enum): 111 '''ID number for MD8475A supported BTS ''' 112 BTS1 = "BTS1" 113 BTS2 = "BTS2" 114 BTS3 = "BTS3" 115 BTS4 = "BTS4" 116 BTS5 = "BTS5" 117 118 119class BtsTechnology(Enum): 120 ''' BTS system technology''' 121 LTE = "LTE" 122 WCDMA = "WCDMA" 123 TDSCDMA = "TDSCDMA" 124 GSM = "GSM" 125 CDMA1X = "CDMA1X" 126 EVDO = "EVDO" 127 128 129class BtsBandwidth(Enum): 130 ''' Values for Cell Bandwidth ''' 131 LTE_BANDWIDTH_1dot4MHz = "1.4MHz" 132 LTE_BANDWIDTH_3MHz = "3MHz" 133 LTE_BANDWIDTH_5MHz = "5MHz" 134 LTE_BANDWIDTH_10MHz = "10MHz" 135 LTE_BANDWIDTH_15MHz = "15MHz" 136 LTE_BANDWIDTH_20MHz = "20MHz" 137 138 def get_float_value(bts_bandwidth): 139 """ Returns a float representing the bandwidth in MHz. 140 141 Args: 142 bts_bandwidth: a BtsBandwidth enum or a string matching one of the 143 values in the BtsBandwidth enum. 144 """ 145 146 if isinstance(bts_bandwidth, BtsBandwidth): 147 bandwidth_str = bts_bandwidth.value 148 elif isinstance(bts_bandwidth, str): 149 bandwidth_str = bts_bandwidth 150 else: 151 raise TypeError('bts_bandwidth should be an instance of string or ' 152 'BtsBandwidth. ') 153 154 if bandwidth_str == BtsBandwidth.LTE_BANDWIDTH_20MHz.value: 155 return 20 156 elif bandwidth_str == BtsBandwidth.LTE_BANDWIDTH_15MHz.value: 157 return 15 158 elif bandwidth_str == BtsBandwidth.LTE_BANDWIDTH_10MHz.value: 159 return 10 160 elif bandwidth_str == BtsBandwidth.LTE_BANDWIDTH_5MHz.value: 161 return 5 162 elif bandwidth_str == BtsBandwidth.LTE_BANDWIDTH_3MHz.value: 163 return 3 164 elif bandwidth_str == BtsBandwidth.LTE_BANDWIDTH_1dot4MHz.value: 165 return 1.4 166 else: 167 raise ValueError( 168 'Could not map {} to a bandwidth value.'.format(bandwidth_str)) 169 170 171MAX_NRB_FOR_BANDWIDTH = { 172 BtsBandwidth.LTE_BANDWIDTH_1dot4MHz.value: 6, 173 BtsBandwidth.LTE_BANDWIDTH_3MHz.value: 15, 174 BtsBandwidth.LTE_BANDWIDTH_5MHz.value: 25, 175 BtsBandwidth.LTE_BANDWIDTH_10MHz.value: 50, 176 BtsBandwidth.LTE_BANDWIDTH_15MHz.value: 75, 177 BtsBandwidth.LTE_BANDWIDTH_20MHz.value: 100 178} 179 180 181class LteMimoMode(Enum): 182 """ Values for LTE MIMO modes. """ 183 NONE = "MIMONOT" 184 MIMO_2X2 = "MIMO2X2" 185 MIMO_4X4 = "MIMO4X4" 186 187 188class BtsGprsMode(Enum): 189 ''' Values for Gprs Modes ''' 190 NO_GPRS = "NO_GPRS" 191 GPRS = "GPRS" 192 EGPRS = "EGPRS" 193 194 195class BtsPacketRate(Enum): 196 ''' Values for Cell Packet rate ''' 197 LTE_MANUAL = "MANUAL" 198 LTE_BESTEFFORT = "BESTEFFORT" 199 WCDMA_DL384K_UL64K = "DL384K_UL64K" 200 WCDMA_DLHSAUTO_REL7_UL384K = "DLHSAUTO_REL7_UL384K" 201 WCDMA_DL18_0M_UL384K = "DL18_0M_UL384K" 202 WCDMA_DL21_6M_UL384K = "DL21_6M_UL384K" 203 WCDMA_DLHSAUTO_REL7_ULHSAUTO = "DLHSAUTO_REL7_ULHSAUTO" 204 WCDMA_DL18_0M_UL1_46M = "DL18_0M_UL1_46M" 205 WCDMA_DL18_0M_UL2_0M = "DL18_0M_UL2_0M" 206 WCDMA_DL18_0M_UL5_76M = "DL18_0M_UL5_76M" 207 WCDMA_DL21_6M_UL1_46M = "DL21_6M_UL1_46M" 208 WCDMA_DL21_6M_UL2_0M = "DL21_6M_UL2_0M" 209 WCDMA_DL21_6M_UL5_76M = "DL21_6M_UL5_76M" 210 WCDMA_DLHSAUTO_REL8_UL384K = "DLHSAUTO_REL8_UL384K" 211 WCDMA_DL23_4M_UL384K = "DL23_4M_UL384K" 212 WCDMA_DL28_0M_UL384K = "DL28_0M_UL384K" 213 WCDMA_DL36_0M_UL384K = "DL36_0M_UL384K" 214 WCDMA_DL43_2M_UL384K = "DL43_2M_UL384K" 215 WCDMA_DLHSAUTO_REL8_ULHSAUTO = "DLHSAUTO_REL8_ULHSAUTO" 216 WCDMA_DL23_4M_UL1_46M = "DL23_4M_UL1_46M" 217 WCDMA_DL23_4M_UL2_0M = "DL23_4M_UL2_0M" 218 WCDMA_DL23_4M_UL5_76M = "DL23_4M_UL5_76M" 219 WCDMA_DL28_0M_UL1_46M = "DL28_0M_UL1_46M" 220 WCDMA_DL28_0M_UL2_0M = "DL28_0M_UL2_0M" 221 WCDMA_DL28_0M_UL5_76M = "L28_0M_UL5_76M" 222 WCDMA_DL36_0M_UL1_46M = "DL36_0M_UL1_46M" 223 WCDMA_DL36_0M_UL2_0M = "DL36_0M_UL2_0M" 224 WCDMA_DL36_0M_UL5_76M = "DL36_0M_UL5_76M" 225 WCDMA_DL43_2M_UL1_46M = "DL43_2M_UL1_46M" 226 WCDMA_DL43_2M_UL2_0M = "DL43_2M_UL2_0M" 227 WCDMA_DL43_2M_UL5_76M = "DL43_2M_UL5_76M" 228 229 230class BtsPacketWindowSize(Enum): 231 ''' Values for Cell Packet window size ''' 232 WINDOW_SIZE_1 = 1 233 WINDOW_SIZE_8 = 8 234 WINDOW_SIZE_16 = 16 235 WINDOW_SIZE_32 = 32 236 WINDOW_SIZE_64 = 64 237 WINDOW_SIZE_128 = 128 238 WINDOW_SIZE_256 = 256 239 WINDOW_SIZE_512 = 512 240 WINDOW_SIZE_768 = 768 241 WINDOW_SIZE_1024 = 1024 242 WINDOW_SIZE_1536 = 1536 243 WINDOW_SIZE_2047 = 2047 244 245 246class BtsServiceState(Enum): 247 ''' Values for BTS service state ''' 248 SERVICE_STATE_IN = "IN" 249 SERVICE_STATE_OUT = "OUT" 250 251 252class BtsCellBarred(Enum): 253 ''' Values for Cell barred parameter ''' 254 NOTBARRED = "NOTBARRED" 255 BARRED = "BARRED" 256 257 258class BtsAccessClassBarred(Enum): 259 ''' Values for Access class barred parameter ''' 260 NOTBARRED = "NOTBARRED" 261 EMERGENCY = "EMERGENCY" 262 BARRED = "BARRED" 263 USERSPECIFIC = "USERSPECIFIC" 264 265 266class BtsLteEmergencyAccessClassBarred(Enum): 267 ''' Values for Lte emergency access class barred parameter ''' 268 NOTBARRED = "NOTBARRED" 269 BARRED = "BARRED" 270 271 272class BtsNwNameEnable(Enum): 273 ''' Values for BT network name enable parameter ''' 274 NAME_ENABLE = "ON" 275 NAME_DISABLE = "OFF" 276 277 278class IPAddressType(Enum): 279 ''' Values for IP address type ''' 280 IPV4 = "IPV4" 281 IPV6 = "IPV6" 282 IPV4V6 = "IPV4V6" 283 284 285class TriggerMessageIDs(Enum): 286 ''' ID for Trigger messages ''' 287 RRC_CONNECTION_REQ = 111101 288 RRC_CONN_REESTABLISH_REQ = 111100 289 ATTACH_REQ = 141141 290 DETACH_REQ = 141145 291 MM_LOC_UPDATE_REQ = 221108 292 GMM_ATTACH_REQ = 241101 293 GMM_RA_UPDATE_REQ = 241108 294 IDENTITY_REQUEST_LTE = 141155 295 IDENTITY_REQUEST_WCDMA = 241115 296 IDENTITY_REQUEST_GSM = 641115 297 UE_CAPABILITY_ENQUIRY = 111167 298 299 300class TriggerMessageReply(Enum): 301 ''' Values for Trigger message reply parameter ''' 302 ACCEPT = "ACCEPT" 303 REJECT = "REJECT" 304 IGNORE = "IGNORE" 305 NONE = "NONE" 306 ILLEGAL = "ILLEGAL" 307 308 309class TestProcedure(Enum): 310 ''' Values for different Test procedures in MD8475A ''' 311 PROCEDURE_BL = "BL" 312 PROCEDURE_SELECTION = "SELECTION" 313 PROCEDURE_RESELECTION = "RESELECTION" 314 PROCEDURE_REDIRECTION = "REDIRECTION" 315 PROCEDURE_HO = "HO" 316 PROCEDURE_HHO = "HHO" 317 PROCEDURE_SHO = "SHO" 318 PROCEDURE_MEASUREMENT = "MEASUREMENT" 319 PROCEDURE_CELLCHANGE = "CELLCHANGE" 320 PROCEDURE_MULTICELL = "MULTICELL" 321 322 323class TestPowerControl(Enum): 324 ''' Values for power control in test procedure ''' 325 POWER_CONTROL_ENABLE = "ENABLE" 326 POWER_CONTROL_DISABLE = "DISABLE" 327 328 329class TestMeasurement(Enum): 330 ''' Values for mesaurement in test procedure ''' 331 MEASUREMENT_ENABLE = "ENABLE" 332 MEASUREMENT_DISABLE = "DISABLE" 333 334 335'''MD8475A processing states''' 336_PROCESS_STATES = { 337 "NONE": ProcessingStatus.PROCESS_STATUS_NONE, 338 "NOTRUN": ProcessingStatus.PROCESS_STATUS_NOTRUN, 339 "POWEROFF": ProcessingStatus.PROCESS_STATUS_POWEROFF, 340 "REGISTRATION": ProcessingStatus.PROCESS_STATUS_REGISTRATION, 341 "DETACH": ProcessingStatus.PROCESS_STATUS_DETACH, 342 "IDLE": ProcessingStatus.PROCESS_STATUS_IDLE, 343 "ORIGINATION": ProcessingStatus.PROCESS_STATUS_ORIGINATION, 344 "HANDOVER": ProcessingStatus.PROCESS_STATUS_HANDOVER, 345 "UPDATING": ProcessingStatus.PROCESS_STATUS_UPDATING, 346 "TERMINATION": ProcessingStatus.PROCESS_STATUS_TERMINATION, 347 "COMMUNICATION": ProcessingStatus.PROCESS_STATUS_COMMUNICATION, 348 "UERELEASE": ProcessingStatus.PROCESS_STATUS_UERELEASE, 349 "NWRELEASE": ProcessingStatus.PROCESS_STATUS_NWRELEASE, 350} 351 352 353class ImsCscfStatus(Enum): 354 """ MD8475A ims cscf status for UE 355 """ 356 OFF = "OFF" 357 SIPIDLE = "SIPIDLE" 358 CONNECTED = "CONNECTED" 359 CALLING = "CALLING" 360 RINGING = "RINGING" 361 UNKNOWN = "UNKNOWN" 362 363 364class ImsCscfCall(Enum): 365 """ MD8475A ims cscf call action 366 """ 367 MAKE = "MAKE" 368 END = "END" 369 MAKEVIDEO = "MAKEVIDEO" 370 MAKE2ND = "MAKE2ND" 371 END2ND = "END2ND" 372 ANSWER = "ANSWER" 373 HOLD = "HOLD" 374 RESUME = "RESUME" 375 376 377class VirtualPhoneStatus(IntEnum): 378 ''' MD8475A virtual phone status for UE voice and UE video 379 PPP, PWS ''' 380 STATUS_IDLE = 0 381 STATUS_VOICECALL_ORIGINATION = 1 382 STATUS_VOICECALL_INCOMING = 2 383 STATUS_VOICECALL_INPROGRESS = 3 384 STATUS_VOICECALL_DISCONNECTING = 4 385 STATUS_VOICECALL_DISCONNECTED = 5 386 STATUS_VIDEOCALL_ORIGINATION = 6 387 STATUS_VIDEOCALL_INCOMING = 7 388 STATUS_VIDEOCALL_INPROGRESS = 8 389 STATUS_VIDEOCALL_DISCONNECTING = 9 390 STATUS_VIDEOCALL_DISCONNECTED = 10 391 392 393'''Virtual Phone Status ''' 394_VP_STATUS = { 395 "0": VirtualPhoneStatus.STATUS_IDLE, 396 "1": VirtualPhoneStatus.STATUS_VOICECALL_ORIGINATION, 397 "2": VirtualPhoneStatus.STATUS_VOICECALL_INCOMING, 398 "3": VirtualPhoneStatus.STATUS_VOICECALL_INPROGRESS, 399 "4": VirtualPhoneStatus.STATUS_VOICECALL_DISCONNECTING, 400 "5": VirtualPhoneStatus.STATUS_VOICECALL_DISCONNECTED, 401 "6": VirtualPhoneStatus.STATUS_VIDEOCALL_ORIGINATION, 402 "7": VirtualPhoneStatus.STATUS_VIDEOCALL_INCOMING, 403 "8": VirtualPhoneStatus.STATUS_VIDEOCALL_INPROGRESS, 404 "9": VirtualPhoneStatus.STATUS_VIDEOCALL_DISCONNECTING, 405 "10": VirtualPhoneStatus.STATUS_VIDEOCALL_DISCONNECTED, 406} 407 408 409class VirtualPhoneAutoAnswer(Enum): 410 ''' Virtual phone auto answer enable values''' 411 ON = "ON" 412 OFF = "OFF" 413 414 415class CsfbType(Enum): 416 ''' CSFB Type values''' 417 CSFB_TYPE_REDIRECTION = "REDIRECTION" 418 CSFB_TYPE_HANDOVER = "HO" 419 420 421class ReturnToEUTRAN(Enum): 422 '''Return to EUTRAN setting values ''' 423 RETEUTRAN_ENABLE = "ENABLE" 424 RETEUTRAN_DISABLE = "DISABLE" 425 426 427class CTCHSetup(Enum): 428 '''CTCH setting values ''' 429 CTCH_ENABLE = "ENABLE" 430 CTCH_DISABLE = "DISABLE" 431 432 433class UEIdentityType(Enum): 434 '''UE Identity type values ''' 435 IMSI = "IMSI" 436 IMEI = "IMEI" 437 IMEISV = "IMEISV" 438 439 440class CBCHSetup(Enum): 441 '''CBCH setting values ''' 442 CBCH_ENABLE = "ENABLE" 443 CBCH_DISABLE = "DISABLE" 444 445 446class Switch(Enum): 447 ''' Values for ENABLE or DISABLE ''' 448 ENABLE = "ENABLE" 449 DISABLE = "DISABLE" 450 451 452class MD8475A(object): 453 """Class to communicate with Anritsu MD8475A Signalling Tester. 454 This uses GPIB command to interface with Anritsu MD8475A """ 455 def __init__(self, ip_address, wlan=False, md8475_version="A"): 456 self._error_reporting = True 457 self._ipaddr = ip_address 458 self.log = tracelogger.TraceLogger(logging.getLogger()) 459 self._wlan = wlan 460 port_number = 28002 461 self._md8475_version = md8475_version 462 if md8475_version == "B": 463 global TERMINATOR 464 TERMINATOR = "\n" 465 port_number = 5025 466 467 # Open socket connection to Signaling Tester 468 self.log.info("Opening Socket Connection with " 469 "Signaling Tester ({}) ".format(self._ipaddr)) 470 try: 471 self._sock = socket.create_connection((self._ipaddr, port_number), 472 timeout=120) 473 self.send_query("*IDN?", 60) 474 self.log.info("Communication with Signaling Tester OK.") 475 self.log.info("Opened Socket connection to ({})" 476 "with handle ({})".format(self._ipaddr, self._sock)) 477 # launching Smart Studio Application needed for the simulation 478 ret = self.launch_smartstudio() 479 except socket.timeout: 480 raise AnritsuError("Timeout happened while conencting to" 481 " Anritsu MD8475A") 482 except socket.error: 483 raise AnritsuError("Socket creation error") 484 485 def get_BTS(self, btsnumber): 486 """ Returns the BTS object based on the BTS number provided 487 488 Args: 489 btsnumber: BTS number (BTS1, BTS2) 490 491 Returns: 492 BTS object 493 """ 494 return _BaseTransceiverStation(self, btsnumber) 495 496 def get_AnritsuTestCases(self): 497 """ Returns the Anritsu Test Case Module Object 498 499 Args: 500 None 501 502 Returns: 503 Anritsu Test Case Module Object 504 """ 505 return _AnritsuTestCases(self) 506 507 def get_VirtualPhone(self): 508 """ Returns the Anritsu Virtual Phone Module Object 509 510 Args: 511 None 512 513 Returns: 514 Anritsu Virtual Phone Module Object 515 """ 516 return _VirtualPhone(self) 517 518 def get_PDN(self, pdn_number): 519 """ Returns the PDN Module Object 520 521 Args: 522 None 523 524 Returns: 525 Anritsu PDN Module Object 526 """ 527 return _PacketDataNetwork(self, pdn_number) 528 529 def get_TriggerMessage(self): 530 """ Returns the Anritsu Trigger Message Module Object 531 532 Args: 533 None 534 535 Returns: 536 Anritsu Trigger Message Module Object 537 """ 538 return _TriggerMessage(self) 539 540 def get_IMS(self, vnid): 541 """ Returns the IMS Module Object with VNID 542 543 Args: 544 vnid: Virtual Network ID 545 546 Returns: 547 Anritsu IMS VNID Module Object 548 """ 549 return _IMS_Services(self, vnid) 550 551 def get_ims_cscf_status(self, virtual_network_id): 552 """ Get the IMS CSCF Status of virtual network 553 554 Args: 555 virtual_network_id: virtual network id 556 557 Returns: 558 IMS CSCF status 559 """ 560 cmd = "IMSCSCFSTAT? {}".format(virtual_network_id) 561 return self.send_query(cmd) 562 563 def ims_cscf_call_action(self, virtual_network_id, action): 564 """ IMS CSCF Call action 565 566 Args: 567 virtual_network_id: virtual network id 568 action: action to make 569 570 Returns: 571 None 572 """ 573 cmd = "IMSCSCFCALL {},{}".format(virtual_network_id, action) 574 self.send_command(cmd) 575 576 def send_query(self, query, sock_timeout=120): 577 """ Sends a Query message to Anritsu and return response 578 579 Args: 580 query - Query string 581 582 Returns: 583 query response 584 """ 585 self.log.info("--> {}".format(query)) 586 querytoSend = (query + TERMINATOR).encode('utf-8') 587 self._sock.settimeout(sock_timeout) 588 try: 589 self._sock.send(querytoSend) 590 result = self._sock.recv(ANRITSU_SOCKET_BUFFER_SIZE).rstrip( 591 TERMINATOR.encode('utf-8')) 592 response = result.decode('utf-8') 593 self.log.info('<-- {}'.format(response)) 594 return response 595 except socket.timeout: 596 raise AnritsuError("Timeout: Response from Anritsu") 597 except socket.error: 598 raise AnritsuError("Socket Error") 599 600 def send_command(self, command, sock_timeout=120): 601 """ Sends a Command message to Anritsu 602 603 Args: 604 command - command string 605 606 Returns: 607 None 608 """ 609 self.log.info("--> {}".format(command)) 610 if self._error_reporting: 611 cmdToSend = (command + ";ERROR?" + TERMINATOR).encode('utf-8') 612 self._sock.settimeout(sock_timeout) 613 try: 614 self._sock.send(cmdToSend) 615 err = self._sock.recv(ANRITSU_SOCKET_BUFFER_SIZE).rstrip( 616 TERMINATOR.encode('utf-8')) 617 error = int(err.decode('utf-8')) 618 if error != NO_ERROR: 619 raise AnritsuError(error, command) 620 except socket.timeout: 621 raise AnritsuError("Timeout for Command Response from Anritsu") 622 except socket.error: 623 raise AnritsuError("Socket Error for Anritsu command") 624 except Exception as e: 625 raise AnritsuError(e, command) 626 else: 627 cmdToSend = (command + TERMINATOR).encode('utf-8') 628 try: 629 self._sock.send(cmdToSend) 630 except socket.error: 631 raise AnritsuError("Socket Error", command) 632 return 633 634 def launch_smartstudio(self): 635 """ launch the Smart studio application 636 This should be done before stating simulation 637 638 Args: 639 None 640 641 Returns: 642 None 643 """ 644 # check the Smart Studio status . If Smart Studio doesn't exist , 645 # start it.if it is running, stop it. Smart Studio should be in 646 # NOTRUN (Simulation Stopped) state to start new simulation 647 stat = self.send_query("STAT?", 30) 648 if stat == "NOTEXIST": 649 self.log.info("Launching Smart Studio Application," 650 "it takes about a minute.") 651 time_to_wait = SMARTSTUDIO_LAUNCH_WAIT_TIME 652 sleep_interval = 15 653 waiting_time = 0 654 655 err = self.send_command("RUN", SMARTSTUDIO_LAUNCH_WAIT_TIME) 656 stat = self.send_query("STAT?") 657 while stat != "NOTRUN": 658 time.sleep(sleep_interval) 659 waiting_time = waiting_time + sleep_interval 660 if waiting_time <= time_to_wait: 661 stat = self.send_query("STAT?") 662 else: 663 raise AnritsuError("Timeout: Smart Studio launch") 664 elif stat == "RUNNING": 665 # Stop simulation if necessary 666 self.send_command("STOP", 60) 667 stat = self.send_query("STAT?") 668 669 # The state of the Smart Studio should be NOTRUN at this point 670 # after the one of the steps from above 671 if stat != "NOTRUN": 672 self.log.info( 673 "Can not launch Smart Studio, " 674 "please shut down all the Smart Studio SW components") 675 raise AnritsuError("Could not run SmartStudio") 676 677 def close_smartstudio(self): 678 """ Closes the Smart studio application 679 680 Args: 681 None 682 683 Returns: 684 None 685 """ 686 self.stop_simulation() 687 self.send_command("EXIT", 60) 688 689 def get_smartstudio_status(self): 690 """ Gets the Smart studio status 691 692 Args: 693 None 694 695 Returns: 696 Smart studio status 697 """ 698 return self.send_query("STAT?") 699 700 def start_simulation(self): 701 """ Starting the simulation of the network model. 702 simulation model or simulation parameter file 703 should be set before starting the simulation 704 705 Args: 706 None 707 708 Returns: 709 None 710 """ 711 time_to_wait = SMARTSTUDIO_SIMULATION_START_WAIT_TIME 712 sleep_interval = 2 713 waiting_time = 0 714 715 self.send_command("START", SMARTSTUDIO_SIMULATION_START_WAIT_TIME) 716 717 self.log.info("Waiting for CALLSTAT=POWEROFF") 718 callstat = self.send_query("CALLSTAT? BTS1").split(",") 719 while callstat[0] != "POWEROFF": 720 time.sleep(sleep_interval) 721 waiting_time += sleep_interval 722 if waiting_time <= time_to_wait: 723 callstat = self.send_query("CALLSTAT? BTS1").split(",") 724 else: 725 raise AnritsuError("Timeout: Starting simulation") 726 727 def stop_simulation(self): 728 """ Stop simulation operation 729 730 Args: 731 None 732 733 Returns: 734 None 735 """ 736 # Stop virtual network (IMS) #1 if still running 737 # this is needed before Sync command is supported in 6.40a 738 if self.send_query("IMSVNSTAT? 1") == "RUNNING": 739 self.send_command("IMSSTOPVN 1") 740 if self.send_query("IMSVNSTAT? 2") == "RUNNING": 741 self.send_command("IMSSTOPVN 2") 742 stat = self.send_query("STAT?") 743 # Stop simulation if its is RUNNING 744 if stat == "RUNNING": 745 self.send_command("STOP", 60) 746 stat = self.send_query("STAT?") 747 if stat != "NOTRUN": 748 self.log.info("Failed to stop simulation") 749 raise AnritsuError("Failed to stop simulation") 750 751 def reset(self): 752 """ reset simulation parameters 753 754 Args: 755 None 756 757 Returns: 758 None 759 """ 760 self.send_command("*RST", COMMAND_COMPLETE_WAIT_TIME) 761 762 def load_simulation_paramfile(self, filepath): 763 """ loads simulation model parameter file 764 Args: 765 filepath : simulation model parameter file path 766 767 Returns: 768 None 769 """ 770 self.stop_simulation() 771 cmd = "LOADSIMPARAM \"" + filepath + '\";ERROR?' 772 self.send_query(cmd, LOAD_SIMULATION_PARAM_FILE_WAIT_TIME) 773 774 def load_cell_paramfile(self, filepath): 775 """ loads cell model parameter file 776 777 Args: 778 filepath : cell model parameter file path 779 780 Returns: 781 None 782 """ 783 self.stop_simulation() 784 cmd = "LOADCELLPARAM \"" + filepath + '\";ERROR?' 785 status = int(self.send_query(cmd)) 786 if status != NO_ERROR: 787 raise AnritsuError(status, cmd) 788 789 def _set_simulation_model(self, sim_model, reset=True): 790 """ Set simulation model and valid the configuration 791 792 Args: 793 sim_model: simulation model 794 reset: if True, reset the simulation after setting the new 795 simulation model 796 Returns: 797 True/False 798 """ 799 error = int( 800 self.send_query("SIMMODEL %s;ERROR?" % sim_model, 801 COMMAND_COMPLETE_WAIT_TIME)) 802 if error: # Try again if first set SIMMODEL fails 803 time.sleep(3) 804 if "WLAN" in sim_model: 805 new_sim_model = sim_model[:-5] 806 error = int( 807 self.send_query("SIMMODEL %s;ERROR?" % new_sim_model, 808 COMMAND_COMPLETE_WAIT_TIME)) 809 time.sleep(3) 810 error = int( 811 self.send_query("SIMMODEL %s;ERROR?" % sim_model, 812 COMMAND_COMPLETE_WAIT_TIME)) 813 if error: 814 return False 815 if reset: 816 # Reset might be necessary because SIMMODEL will load 817 # some of the contents from previous parameter files. 818 self.reset() 819 return True 820 821 def set_simulation_model(self, *bts_rats, reset=True): 822 """ Stops the simulation and then sets the simulation model. 823 824 Args: 825 *bts_rats: base station rats for BTS 1 to 5. 826 reset: if True, reset the simulation after setting the new 827 simulation model 828 Returns: 829 True or False 830 """ 831 self.stop_simulation() 832 if len(bts_rats) not in range(1, 6): 833 raise ValueError( 834 "set_simulation_model requires 1 to 5 BTS values.") 835 simmodel = ",".join(bts_rat.value for bts_rat in bts_rats) 836 if self._wlan: 837 simmodel = simmodel + "," + "WLAN" 838 return self._set_simulation_model(simmodel, reset) 839 840 def get_simulation_model(self): 841 """ Gets the simulation model 842 843 Args: 844 None 845 846 Returns: 847 Current simulation model 848 """ 849 cmd = "SIMMODEL?" 850 return self.send_query(cmd) 851 852 def get_lte_rrc_status_change(self): 853 """ Gets the LTE RRC status change function state 854 855 Returns: 856 Boolean: True is Enabled / False is Disabled 857 """ 858 cmd = "L_RRCSTAT?" 859 return self.send_query(cmd) == "ENABLE" 860 861 def set_lte_rrc_status_change(self, status_change): 862 """ Enables or Disables the LTE RRC status change function 863 864 Returns: 865 None 866 """ 867 cmd = "L_RRCSTAT " 868 if status_change: 869 cmd += "ENABLE" 870 else: 871 cmd += "DISABLE" 872 self.send_command(cmd) 873 874 def get_lte_rrc_status_change_timer(self): 875 """ Gets the LTE RRC Status Change Timer 876 877 Returns: 878 returns a status change timer integer value 879 """ 880 cmd = "L_STATTMR?" 881 return self.send_query(cmd) 882 883 def set_lte_rrc_status_change_timer(self, time): 884 """ Sets the LTE RRC Status Change Timer parameter 885 886 Returns: 887 None 888 """ 889 cmd = "L_STATTMR %s" % time 890 self.send_command(cmd) 891 892 def set_umts_rrc_status_change(self, status_change): 893 """ Enables or Disables the UMTS RRC status change function 894 895 Returns: 896 None 897 """ 898 cmd = "W_RRCSTAT " 899 if status_change: 900 cmd += "ENABLE" 901 else: 902 cmd += "DISABLE" 903 self.send_command(cmd) 904 905 def get_umts_rrc_status_change(self): 906 """ Gets the UMTS RRC Status Change 907 908 Returns: 909 Boolean: True is Enabled / False is Disabled 910 """ 911 cmd = "W_RRCSTAT?" 912 return self.send_query(cmd) 913 914 def set_umts_dch_stat_timer(self, timer_seconds): 915 """ Sets the UMTS RRC DCH timer 916 917 Returns: 918 None 919 """ 920 cmd = "W_STATTMRDCH %s" % timer_seconds 921 self.send_command(cmd) 922 923 def set_simulation_state_to_poweroff(self): 924 """ Sets the simulation state to POWER OFF 925 926 Args: 927 None 928 929 Returns: 930 None 931 """ 932 self.send_command("RESETSIMULATION POWEROFF") 933 time_to_wait = 30 934 sleep_interval = 2 935 waiting_time = 0 936 937 self.log.info("Waiting for CALLSTAT=POWEROFF") 938 callstat = self.send_query("CALLSTAT?").split(",") 939 while callstat[0] != "POWEROFF": 940 time.sleep(sleep_interval) 941 waiting_time = waiting_time + sleep_interval 942 if waiting_time <= time_to_wait: 943 callstat = self.send_query("CALLSTAT?").split(",") 944 else: 945 break 946 947 def set_simulation_state_to_idle(self, btsnumber): 948 """ Sets the simulation state to IDLE 949 950 Args: 951 None 952 953 Returns: 954 None 955 """ 956 if not isinstance(btsnumber, BtsNumber): 957 raise ValueError(' The parameter should be of type "BtsNumber" ') 958 cmd = "RESETSIMULATION IDLE," + btsnumber.value 959 self.send_command(cmd) 960 time_to_wait = 30 961 sleep_interval = 2 962 waiting_time = 0 963 964 self.log.info("Waiting for CALLSTAT=IDLE") 965 callstat = self.send_query("CALLSTAT?").split(",") 966 while callstat[0] != "IDLE": 967 time.sleep(sleep_interval) 968 waiting_time = waiting_time + sleep_interval 969 if waiting_time <= time_to_wait: 970 callstat = self.send_query("CALLSTAT?").split(",") 971 else: 972 break 973 974 def set_trigger_message_mode(self, msg_id): 975 """ Sets the Message Mode of the trigger 976 977 Args: 978 msg_id: The hex value of the identity of an RRC/NAS message. 979 980 Returns: 981 None 982 """ 983 984 if isinstance(msg_id, TriggerMessageIDs): 985 msg_id = msg_id.value 986 987 cmd = "TMMESSAGEMODE {},USERDATA".format(msg_id) 988 self.send_command(cmd) 989 990 def set_data_of_trigger_message(self, msg_id, user_data): 991 """ Sets the User Data of the trigger message 992 993 Args: 994 msg_id: The hex value of the identity of an RRC/NAS message. 995 user_data: Hex data 996 997 Returns: 998 None 999 """ 1000 1001 if isinstance(msg_id, TriggerMessageIDs): 1002 msg_id = msg_id.value 1003 1004 data_len = len(user_data) * 4 1005 1006 cmd = "TMUSERDATA {}, {}, {}".format(msg_id, user_data, data_len) 1007 self.send_command(cmd) 1008 1009 def send_trigger_message(self, msg_id): 1010 """ Sends the User Data of the trigger information 1011 1012 Args: 1013 msg_id: The hex value of the identity of an RRC/NAS message. 1014 1015 Returns: 1016 None 1017 """ 1018 1019 if isinstance(msg_id, TriggerMessageIDs): 1020 msg_id = msg_id.value 1021 1022 cmd = "TMSENDUSERMSG {}".format(msg_id) 1023 self.send_command(cmd) 1024 1025 def wait_for_registration_state(self, 1026 bts=1, 1027 time_to_wait=REGISTRATION_STATE_WAIT_TIME): 1028 """ Waits for UE registration state on Anritsu 1029 1030 Args: 1031 bts: index of MD8475A BTS, eg 1, 2 1032 time_to_wait: time to wait for the phone to get to registration state 1033 1034 Returns: 1035 None 1036 """ 1037 self.log.info("wait for IDLE/COMMUNICATION state on anritsu.") 1038 1039 sleep_interval = 1 1040 sim_model = (self.get_simulation_model()).split(",") 1041 # wait 1 more round for GSM because of PS attach 1042 registration_check_iterations = 2 if sim_model[bts - 1] == "GSM" else 1 1043 for _ in range(registration_check_iterations): 1044 waiting_time = 0 1045 while waiting_time <= time_to_wait: 1046 callstat = self.send_query( 1047 "CALLSTAT? BTS{}".format(bts)).split(",") 1048 if callstat[0] == "IDLE" or callstat[1] == "COMMUNICATION": 1049 break 1050 time.sleep(sleep_interval) 1051 waiting_time += sleep_interval 1052 else: 1053 raise AnritsuError( 1054 "UE failed to register in {} seconds".format(time_to_wait)) 1055 time.sleep(sleep_interval) 1056 1057 def wait_for_communication_state( 1058 self, time_to_wait=COMMUNICATION_STATE_WAIT_TIME): 1059 """ Waits for UE communication state on Anritsu 1060 1061 Args: 1062 time_to_wait: time to wait for the phone to get to communication state 1063 1064 Returns: 1065 None 1066 """ 1067 self.log.info("wait for COMMUNICATION state on anritsu") 1068 sleep_interval = 1 1069 waiting_time = 0 1070 1071 self.log.info("Waiting for CALLSTAT=COMMUNICATION") 1072 callstat = self.send_query("CALLSTAT? BTS1").split(",") 1073 while callstat[1] != "COMMUNICATION": 1074 time.sleep(sleep_interval) 1075 waiting_time += sleep_interval 1076 if waiting_time <= time_to_wait: 1077 callstat = self.send_query("CALLSTAT? BTS1").split(",") 1078 else: 1079 raise AnritsuError("UE failed to register on network") 1080 1081 def wait_for_idle_state(self, time_to_wait=IDLE_STATE_WAIT_TIME): 1082 """ Waits for UE idle state on Anritsu 1083 1084 Args: 1085 time_to_wait: time to wait for the phone to get to idle state 1086 1087 Returns: 1088 None 1089 """ 1090 self.log.info("wait for IDLE state on anritsu.") 1091 1092 sleep_interval = 1 1093 waiting_time = 0 1094 1095 callstat = self.send_query("CALLSTAT? BTS1").split(",") 1096 while callstat[0] != "IDLE": 1097 time.sleep(sleep_interval) 1098 waiting_time += sleep_interval 1099 if waiting_time <= time_to_wait: 1100 callstat = self.send_query("CALLSTAT? BTS1").split(",") 1101 else: 1102 raise AnritsuError("UE failed to go on idle state") 1103 1104 def get_camping_cell(self): 1105 """ Gets the current camping cell information 1106 1107 Args: 1108 None 1109 1110 Returns: 1111 returns a tuple (BTS number, RAT Technology) ' 1112 """ 1113 bts_number, rat_info = self.send_query("CAMPINGCELL?").split(",") 1114 return bts_number, rat_info 1115 1116 def get_supported_bands(self, rat): 1117 """ Gets the supported bands from UE capability information 1118 1119 Args: 1120 rat: LTE or WCDMA 1121 1122 Returns: 1123 returns a list of bnads 1124 """ 1125 cmd = "UEINFO? " 1126 if rat == "LTE": 1127 cmd += "L" 1128 elif rat == "WCDMA": 1129 cmd += "W" 1130 else: 1131 raise ValueError('The rat argument needs to be "LTE" or "WCDMA"') 1132 cmd += "_SupportedBand" 1133 result = self.send_query(cmd).split(",") 1134 if result == "NONE": 1135 return None 1136 if rat == "WCDMA": 1137 bands = [] 1138 for band in result: 1139 bands.append(WCDMA_BANDS[band]) 1140 return bands 1141 else: 1142 return result 1143 1144 def start_testcase(self): 1145 """ Starts a test case on Anritsu 1146 1147 Args: 1148 None 1149 1150 Returns: 1151 None 1152 """ 1153 self.send_command("STARTTEST") 1154 1155 def get_testcase_status(self): 1156 """ Gets the current test case status on Anritsu 1157 1158 Args: 1159 None 1160 1161 Returns: 1162 current test case status 1163 """ 1164 return self.send_query("TESTSTAT?") 1165 1166 def start_ip_traffic(self, pdn='1'): 1167 """ Starts IP data traffic with the selected PDN. 1168 1169 Args: 1170 pdn: the pdn to be used for data traffic. Defaults to '1'. 1171 """ 1172 self.send_command('OPERATEIPTRAFFIC START,' + pdn) 1173 1174 def stop_ip_traffic(self, pdn='1'): 1175 """ Stops IP data traffic with the selected PDN. 1176 1177 Args: 1178 pdn: pdn for which data traffic has to be stopped. Defaults to '1'. 1179 """ 1180 self.send_command('OPERATEIPTRAFFIC STOP,' + pdn) 1181 1182 def set_carrier_aggregation_enabled(self, enabled=True): 1183 """ Enables or disables de carrier aggregation option. 1184 1185 Args: 1186 enabled: enables CA if True and disables CA if False. 1187 """ 1188 cmd = 'CA ' + 'ENABLE' if enabled else 'DISABLE' 1189 self.send_command(cmd) 1190 1191 # Common Default Gateway: 1192 @property 1193 def gateway_ipv4addr(self): 1194 """ Gets the IPv4 address of the default gateway 1195 1196 Args: 1197 None 1198 1199 Returns: 1200 current UE status 1201 """ 1202 return self.send_query("DGIPV4?") 1203 1204 @gateway_ipv4addr.setter 1205 def gateway_ipv4addr(self, ipv4_addr): 1206 """ sets the IPv4 address of the default gateway 1207 Args: 1208 ipv4_addr: IPv4 address of the default gateway 1209 1210 Returns: 1211 None 1212 """ 1213 cmd = "DGIPV4 " + ipv4_addr 1214 self.send_command(cmd) 1215 1216 @property 1217 def gateway_ipv6addr(self): 1218 """ Gets the IPv6 address of the default gateway 1219 1220 Args: 1221 None 1222 1223 Returns: 1224 current UE status 1225 """ 1226 return self.send_query("DGIPV6?") 1227 1228 @gateway_ipv6addr.setter 1229 def gateway_ipv6addr(self, ipv6_addr): 1230 """ sets the IPv6 address of the default gateway 1231 Args: 1232 ipv6_addr: IPv6 address of the default gateway 1233 1234 Returns: 1235 None 1236 """ 1237 cmd = "DGIPV6 " + ipv6_addr 1238 self.send_command(cmd) 1239 1240 @property 1241 def usim_key(self): 1242 """ Gets the USIM Security Key 1243 1244 Args: 1245 None 1246 1247 Returns: 1248 USIM Security Key 1249 """ 1250 return self.send_query("USIMK?") 1251 1252 @usim_key.setter 1253 def usim_key(self, usimk): 1254 """ sets the USIM Security Key 1255 Args: 1256 usimk: USIM Security Key, eg "000102030405060708090A0B0C0D0E0F" 1257 1258 Returns: 1259 None 1260 """ 1261 cmd = "USIMK " + usimk 1262 self.send_command(cmd) 1263 1264 def get_ue_status(self): 1265 """ Gets the current UE status on Anritsu 1266 1267 Args: 1268 None 1269 1270 Returns: 1271 current UE status 1272 """ 1273 UE_STATUS_INDEX = 0 1274 ue_status = self.send_query("CALLSTAT?").split(",")[UE_STATUS_INDEX] 1275 return _PROCESS_STATES[ue_status] 1276 1277 def get_packet_status(self): 1278 """ Gets the current Packet status on Anritsu 1279 1280 Args: 1281 None 1282 1283 Returns: 1284 current Packet status 1285 """ 1286 PACKET_STATUS_INDEX = 1 1287 packet_status = self.send_query("CALLSTAT?").split( 1288 ",")[PACKET_STATUS_INDEX] 1289 return _PROCESS_STATES[packet_status] 1290 1291 def disconnect(self): 1292 """ Disconnect the Anritsu box from test PC 1293 1294 Args: 1295 None 1296 1297 Returns: 1298 None 1299 """ 1300 # no need to # exit smart studio application 1301 # self.close_smartstudio() 1302 self._sock.close() 1303 1304 def machine_reboot(self): 1305 """ Reboots the Anritsu Machine 1306 1307 Args: 1308 None 1309 1310 Returns: 1311 None 1312 """ 1313 self.send_command("REBOOT") 1314 1315 def save_sequence_log(self, fileName): 1316 """ Saves the Anritsu Sequence logs to file 1317 1318 Args: 1319 fileName: log file name 1320 1321 Returns: 1322 None 1323 """ 1324 cmd = 'SAVESEQLOG "{}"'.format(fileName) 1325 self.send_command(cmd) 1326 1327 def clear_sequence_log(self): 1328 """ Clears the Anritsu Sequence logs 1329 1330 Args: 1331 None 1332 1333 Returns: 1334 None 1335 """ 1336 self.send_command("CLEARSEQLOG") 1337 1338 def save_message_log(self, fileName): 1339 """ Saves the Anritsu Message logs to file 1340 1341 Args: 1342 fileName: log file name 1343 1344 Returns: 1345 None 1346 """ 1347 cmd = 'SAVEMSGLOG "{}"'.format(fileName) 1348 self.send_command(cmd) 1349 1350 def clear_message_log(self): 1351 """ Clears the Anritsu Message logs 1352 1353 Args: 1354 None 1355 1356 Returns: 1357 None 1358 """ 1359 self.send_command("CLEARMSGLOG") 1360 1361 def save_trace_log(self, fileName, fileType, overwrite, start, end): 1362 """ Saves the Anritsu Trace logs 1363 1364 Args: 1365 fileName: log file name 1366 fileType: file type (BINARY, TEXT, H245,PACKET, CPLABE) 1367 overwrite: whether to over write 1368 start: starting trace number 1369 end: ending trace number 1370 1371 Returns: 1372 None 1373 """ 1374 cmd = 'SAVETRACELOG "{}",{},{},{},{}'.format(fileName, fileType, 1375 overwrite, start, end) 1376 self.send_command(cmd) 1377 1378 def send_cmas_lte_wcdma(self, serialNo, messageID, warningMessage): 1379 """ Sends a CMAS message 1380 1381 Args: 1382 serialNo: serial number of CMAS message 1383 messageID: CMAS message ID 1384 warningMessage: CMAS Warning message 1385 1386 Returns: 1387 None 1388 """ 1389 cmd = ('PWSSENDWM 3GPP,"BtsNo=1&WarningSystem=CMAS&SerialNo={}' 1390 '&MessageID={}&wm={}"').format(serialNo, messageID, 1391 warningMessage) 1392 self.send_command(cmd) 1393 1394 def send_etws_lte_wcdma(self, serialNo, messageID, warningType, 1395 warningMessage, userAlertenable, popUpEnable): 1396 """ Sends a ETWS message 1397 1398 Args: 1399 serialNo: serial number of CMAS message 1400 messageID: CMAS message ID 1401 warningMessage: CMAS Warning message 1402 1403 Returns: 1404 None 1405 """ 1406 cmd = ( 1407 'PWSSENDWM 3GPP,"BtsNo=1&WarningSystem=ETWS&SerialNo={}&' 1408 'Primary=ON&PrimaryMessageID={}&Secondary=ON&SecondaryMessageID={}' 1409 '&WarningType={}&wm={}&UserAlert={}&Popup={}&dcs=0x10&LanguageCode=en"' 1410 ).format(serialNo, messageID, messageID, warningType, warningMessage, 1411 userAlertenable, popUpEnable) 1412 self.send_command(cmd) 1413 1414 def send_cmas_etws_cdma1x(self, message_id, service_category, alert_ext, 1415 response_type, severity, urgency, certainty): 1416 """ Sends a CMAS/ETWS message on CDMA 1X 1417 1418 Args: 1419 serviceCategory: service category of alert 1420 messageID: message ID 1421 alertText: Warning message 1422 1423 Returns: 1424 None 1425 """ 1426 cmd = ( 1427 'PWSSENDWM 3GPP2,"BtsNo=1&ServiceCategory={}&MessageID={}&AlertText={}&' 1428 'CharSet=ASCII&ResponseType={}&Severity={}&Urgency={}&Certainty={}"' 1429 ).format(service_category, message_id, alert_ext, response_type, 1430 severity, urgency, certainty) 1431 self.send_command(cmd) 1432 1433 @property 1434 def csfb_type(self): 1435 """ Gets the current CSFB type 1436 1437 Args: 1438 None 1439 1440 Returns: 1441 current CSFB type 1442 """ 1443 return self.send_query("SIMMODELEX? CSFB") 1444 1445 @csfb_type.setter 1446 def csfb_type(self, csfb_type): 1447 """ sets the CSFB type 1448 Args: 1449 csfb_type: CSFB type 1450 1451 Returns: 1452 None 1453 """ 1454 if not isinstance(csfb_type, CsfbType): 1455 raise ValueError('The parameter should be of type "CsfbType" ') 1456 cmd = "SIMMODELEX CSFB," + csfb_type.value 1457 self.send_command(cmd) 1458 1459 @property 1460 def csfb_return_to_eutran(self): 1461 """ Gets the current return to EUTRAN status 1462 1463 Args: 1464 None 1465 1466 Returns: 1467 current return to EUTRAN status 1468 """ 1469 return self.send_query("SIMMODELEX? RETEUTRAN") 1470 1471 @csfb_return_to_eutran.setter 1472 def csfb_return_to_eutran(self, enable): 1473 """ sets the return to EUTRAN feature 1474 Args: 1475 enable: enable/disable return to EUTRAN feature 1476 1477 Returns: 1478 None 1479 """ 1480 if not isinstance(enable, ReturnToEUTRAN): 1481 raise ValueError( 1482 'The parameter should be of type "ReturnToEUTRAN"') 1483 cmd = "SIMMODELEX RETEUTRAN," + enable.value 1484 self.send_command(cmd) 1485 1486 def set_packet_preservation(self): 1487 """ Set packet state to Preservation 1488 1489 Args: 1490 None 1491 1492 Returns: 1493 None 1494 """ 1495 cmd = "OPERATEPACKET PRESERVATION" 1496 self.send_command(cmd) 1497 1498 def set_packet_dormant(self): 1499 """ Set packet state to Dormant 1500 1501 Args: 1502 None 1503 1504 Returns: 1505 None 1506 """ 1507 cmd = "OPERATEPACKET DORMANT" 1508 self.send_command(cmd) 1509 1510 def get_ue_identity(self, identity_type): 1511 """ Get the UE identity IMSI, IMEI, IMEISV 1512 1513 Args: 1514 identity_type : IMSI/IMEI/IMEISV 1515 1516 Returns: 1517 IMSI/IMEI/IMEISV value 1518 """ 1519 bts, rat = self.get_camping_cell() 1520 if rat == BtsTechnology.LTE.value: 1521 identity_request = TriggerMessageIDs.IDENTITY_REQUEST_LTE.value 1522 if identity_type == UEIdentityType.IMSI: 1523 userdata = IMSI_READ_USERDATA_LTE 1524 elif identity_type == UEIdentityType.IMEI: 1525 userdata = IMEI_READ_USERDATA_LTE 1526 elif identity_type == UEIdentityType.IMEISV: 1527 userdata = IMEISV_READ_USERDATA_LTE 1528 else: 1529 return None 1530 elif rat == BtsTechnology.WCDMA.value: 1531 identity_request = TriggerMessageIDs.IDENTITY_REQUEST_WCDMA.value 1532 if identity_type == UEIdentityType.IMSI: 1533 userdata = IMSI_READ_USERDATA_WCDMA 1534 elif identity_type == UEIdentityType.IMEI: 1535 userdata = IMEI_READ_USERDATA_WCDMA 1536 elif identity_type == UEIdentityType.IMEISV: 1537 userdata = IMEISV_READ_USERDATA_WCDMA 1538 else: 1539 return None 1540 elif rat == BtsTechnology.GSM.value: 1541 identity_request = TriggerMessageIDs.IDENTITY_REQUEST_GSM.value 1542 if identity_type == UEIdentityType.IMSI: 1543 userdata = IMSI_READ_USERDATA_GSM 1544 elif identity_type == UEIdentityType.IMEI: 1545 userdata = IMEI_READ_USERDATA_GSM 1546 elif identity_type == UEIdentityType.IMEISV: 1547 userdata = IMEISV_READ_USERDATA_GSM 1548 else: 1549 return None 1550 else: 1551 return None 1552 1553 self.send_command("TMMESSAGEMODE {},USERDATA".format(identity_request)) 1554 time.sleep(SETTLING_TIME) 1555 self.send_command("TMUSERDATA {}, {}, {}".format( 1556 identity_request, userdata, IDENTITY_REQ_DATA_LEN)) 1557 time.sleep(SETTLING_TIME) 1558 self.send_command("TMSENDUSERMSG {}".format(identity_request)) 1559 time.sleep(WAIT_TIME_IDENTITY_RESPONSE) 1560 # Go through sequence log and find the identity response message 1561 target = '"{}"'.format(identity_type.value) 1562 seqlog = self.send_query("SEQLOG?").split(",") 1563 while (target not in seqlog): 1564 index = int(seqlog[0]) - 1 1565 if index < SEQ_LOG_MESSAGE_START_INDEX: 1566 self.log.error("Can not find " + target) 1567 return None 1568 seqlog = self.send_query("SEQLOG? %d" % index).split(",") 1569 return (seqlog[-1]) 1570 1571 def trigger_ue_capability_enquiry(self, requested_bands): 1572 """ Triggers LTE RRC UE capability enquiry from callbox. 1573 1574 Args: 1575 requested_bands: User data in hex format 1576 """ 1577 self.set_trigger_message_mode(TriggerMessageIDs.UE_CAPABILITY_ENQUIRY) 1578 time.sleep(SETTLING_TIME) 1579 self.set_data_of_trigger_message( 1580 TriggerMessageIDs.UE_CAPABILITY_ENQUIRY, requested_bands) 1581 time.sleep(SETTLING_TIME) 1582 self.send_trigger_message(TriggerMessageIDs.UE_CAPABILITY_ENQUIRY) 1583 time.sleep(SETTLING_TIME) 1584 1585 def select_usim(self, usim): 1586 """ Select pre-defined Anritsu USIM models 1587 1588 Args: 1589 usim: any of P0035Bx, P0135Ax, P0250Ax, P0260Ax 1590 1591 Returns: 1592 None 1593 """ 1594 cmd = "SELECTUSIM {}".format(usim) 1595 self.send_command(cmd) 1596 1597 1598class _AnritsuTestCases(object): 1599 '''Class to interact with the MD8475 supported test procedures ''' 1600 def __init__(self, anritsu): 1601 self._anritsu = anritsu 1602 self.log = anritsu.log 1603 1604 @property 1605 def procedure(self): 1606 """ Gets the current Test Procedure type 1607 1608 Args: 1609 None 1610 1611 Returns: 1612 One of TestProcedure type values 1613 """ 1614 return self._anritsu.send_query("TESTPROCEDURE?") 1615 1616 @procedure.setter 1617 def procedure(self, procedure): 1618 """ sets the Test Procedure type 1619 Args: 1620 procedure: One of TestProcedure type values 1621 1622 Returns: 1623 None 1624 """ 1625 if not isinstance(procedure, TestProcedure): 1626 raise ValueError( 1627 'The parameter should be of type "TestProcedure" ') 1628 cmd = "TESTPROCEDURE " + procedure.value 1629 self._anritsu.send_command(cmd) 1630 1631 @property 1632 def bts_direction(self): 1633 """ Gets the current Test direction 1634 1635 Args: 1636 None 1637 1638 Returns: 1639 Current Test direction eg:BTS2,BTS1 1640 """ 1641 return self._anritsu.send_query("TESTBTSDIRECTION?") 1642 1643 @bts_direction.setter 1644 def bts_direction(self, direction): 1645 """ sets the Test direction eg: BTS1 to BTS2 ''' 1646 1647 Args: 1648 direction: tuple (from-bts,to_bts) of type BtsNumber 1649 1650 Returns: 1651 None 1652 """ 1653 if not isinstance(direction, tuple) or len(direction) is not 2: 1654 raise ValueError("Pass a tuple with two items") 1655 from_bts, to_bts = direction 1656 if (isinstance(from_bts, BtsNumber) and isinstance(to_bts, BtsNumber)): 1657 cmd = "TESTBTSDIRECTION {},{}".format(from_bts.value, to_bts.value) 1658 self._anritsu.send_command(cmd) 1659 else: 1660 raise ValueError(' The parameters should be of type "BtsNumber" ') 1661 1662 @property 1663 def registration_timeout(self): 1664 """ Gets the current Test registration timeout 1665 1666 Args: 1667 None 1668 1669 Returns: 1670 Current test registration timeout value 1671 """ 1672 return self._anritsu.send_query("TESTREGISTRATIONTIMEOUT?") 1673 1674 @registration_timeout.setter 1675 def registration_timeout(self, timeout_value): 1676 """ sets the Test registration timeout value 1677 Args: 1678 timeout_value: test registration timeout value 1679 1680 Returns: 1681 None 1682 """ 1683 cmd = "TESTREGISTRATIONTIMEOUT " + str(timeout_value) 1684 self._anritsu.send_command(cmd) 1685 1686 @property 1687 def power_control(self): 1688 """ Gets the power control enabled/disabled status for test case 1689 1690 Args: 1691 None 1692 1693 Returns: 1694 current power control enabled/disabled status 1695 """ 1696 return self._anritsu.send_query("TESTPOWERCONTROL?") 1697 1698 @power_control.setter 1699 def power_control(self, enable): 1700 """ Sets the power control enabled/disabled status for test case 1701 1702 Args: 1703 enable: enabled/disabled 1704 1705 Returns: 1706 None 1707 """ 1708 if not isinstance(enable, TestPowerControl): 1709 raise ValueError(' The parameter should be of type' 1710 ' "TestPowerControl" ') 1711 cmd = "TESTPOWERCONTROL " + enable.value 1712 self._anritsu.send_command(cmd) 1713 1714 @property 1715 def measurement_LTE(self): 1716 """ Checks measurement status for LTE test case 1717 1718 Args: 1719 None 1720 1721 Returns: 1722 Enabled/Disabled 1723 """ 1724 return self._anritsu.send_query("TESTMEASUREMENT? LTE") 1725 1726 @measurement_LTE.setter 1727 def measurement_LTE(self, enable): 1728 """ Sets the measurement enabled/disabled status for LTE test case 1729 1730 Args: 1731 enable: enabled/disabled 1732 1733 Returns: 1734 None 1735 """ 1736 if not isinstance(enable, TestMeasurement): 1737 raise ValueError(' The parameter should be of type' 1738 ' "TestMeasurement" ') 1739 cmd = "TESTMEASUREMENT LTE," + enable.value 1740 self._anritsu.send_command(cmd) 1741 1742 @property 1743 def measurement_WCDMA(self): 1744 """ Checks measurement status for WCDMA test case 1745 1746 Args: 1747 None 1748 1749 Returns: 1750 Enabled/Disabled 1751 """ 1752 return self._anritsu.send_query("TESTMEASUREMENT? WCDMA") 1753 1754 @measurement_WCDMA.setter 1755 def measurement_WCDMA(self, enable): 1756 """ Sets the measurement enabled/disabled status for WCDMA test case 1757 1758 Args: 1759 enable: enabled/disabled 1760 1761 Returns: 1762 None 1763 """ 1764 if not isinstance(enable, TestMeasurement): 1765 raise ValueError(' The parameter should be of type' 1766 ' "TestMeasurement" ') 1767 cmd = "TESTMEASUREMENT WCDMA," + enable.value 1768 self._anritsu.send_command(cmd) 1769 1770 @property 1771 def measurement_TDSCDMA(self): 1772 """ Checks measurement status for TDSCDMA test case 1773 1774 Args: 1775 None 1776 1777 Returns: 1778 Enabled/Disabled 1779 """ 1780 return self._anritsu.send_query("TESTMEASUREMENT? TDSCDMA") 1781 1782 @measurement_TDSCDMA.setter 1783 def measurement_WCDMA(self, enable): 1784 """ Sets the measurement enabled/disabled status for TDSCDMA test case 1785 1786 Args: 1787 enable: enabled/disabled 1788 1789 Returns: 1790 None 1791 """ 1792 if not isinstance(enable, TestMeasurement): 1793 raise ValueError(' The parameter should be of type' 1794 ' "TestMeasurement" ') 1795 cmd = "TESTMEASUREMENT TDSCDMA," + enable.value 1796 self._anritsu.send_command(cmd) 1797 1798 def set_pdn_targeteps(self, pdn_order, pdn_number=1): 1799 """ Sets PDN to connect as a target when performing the 1800 test case for packet handover 1801 1802 Args: 1803 pdn_order: PRIORITY/USER 1804 pdn_number: Target PDN number 1805 1806 Returns: 1807 None 1808 """ 1809 cmd = "TESTPDNTARGETEPS " + pdn_order 1810 if pdn_order == "USER": 1811 cmd = cmd + "," + str(pdn_number) 1812 self._anritsu.send_command(cmd) 1813 1814 1815class _BaseTransceiverStation(object): 1816 '''Class to interact different BTS supported by MD8475 ''' 1817 def __init__(self, anritsu, btsnumber): 1818 if not isinstance(btsnumber, BtsNumber): 1819 raise ValueError(' The parameter should be of type "BtsNumber" ') 1820 self._bts_number = btsnumber.value 1821 self._anritsu = anritsu 1822 self.log = anritsu.log 1823 1824 @property 1825 def output_level(self): 1826 """ Gets the Downlink power of the cell 1827 1828 Args: 1829 None 1830 1831 Returns: 1832 DL Power level 1833 """ 1834 cmd = "OLVL? " + self._bts_number 1835 return self._anritsu.send_query(cmd) 1836 1837 @output_level.setter 1838 def output_level(self, level): 1839 """ Sets the Downlink power of the cell 1840 1841 Args: 1842 level: Power level 1843 1844 Returns: 1845 None 1846 """ 1847 counter = 1 1848 while float(level) != float(self.output_level): 1849 if counter > 3: 1850 raise AnritsuError("Fail to set output level in 3 tries!") 1851 cmd = "OLVL {},{}".format(level, self._bts_number) 1852 self._anritsu.send_command(cmd) 1853 counter += 1 1854 time.sleep(1) 1855 1856 @property 1857 def input_level(self): 1858 """ Gets the reference power of the cell 1859 1860 Args: 1861 None 1862 1863 Returns: 1864 Reference Power level 1865 """ 1866 cmd = "RFLVL? " + self._bts_number 1867 return self._anritsu.send_query(cmd) 1868 1869 @input_level.setter 1870 def input_level(self, level): 1871 """ Sets the reference power of the cell 1872 1873 Args: 1874 level: Power level 1875 1876 Returns: 1877 None 1878 """ 1879 counter = 1 1880 while float(level) != float(self.input_level): 1881 if counter > 3: 1882 raise AnritsuError("Fail to set intput level in 3 tries!") 1883 cmd = "RFLVL {},{}".format(level, self._bts_number) 1884 self._anritsu.send_command(cmd) 1885 counter += 1 1886 time.sleep(1) 1887 1888 @property 1889 def band(self): 1890 """ Gets the Band of the cell 1891 1892 Args: 1893 None 1894 1895 Returns: 1896 Cell band 1897 """ 1898 cmd = "BAND? " + self._bts_number 1899 return self._anritsu.send_query(cmd) 1900 1901 @band.setter 1902 def band(self, band): 1903 """ Sets the Band of the cell 1904 1905 Args: 1906 band: Band of the cell 1907 1908 Returns: 1909 None 1910 """ 1911 cmd = "BAND {},{}".format(band, self._bts_number) 1912 self._anritsu.send_command(cmd) 1913 1914 @property 1915 def transmode(self): 1916 """ Gets the Transmission Mode of the cell 1917 1918 Args: 1919 None 1920 1921 Returns: 1922 Transmission mode 1923 """ 1924 cmd = "TRANSMODE? " + self._bts_number 1925 return self._anritsu.send_query(cmd) 1926 1927 @transmode.setter 1928 def transmode(self, tm_mode): 1929 """ Sets the TM of the cell 1930 1931 Args: 1932 TM: TM of the cell 1933 1934 Returns: 1935 None 1936 """ 1937 cmd = "TRANSMODE {},{}".format(tm_mode, self._bts_number) 1938 self._anritsu.send_command(cmd) 1939 1940 @property 1941 def duplex_mode(self): 1942 """ Gets the Duplex Mode of the cell 1943 1944 Args: 1945 None 1946 1947 Returns: 1948 Duplex mode 1949 """ 1950 cmd = "DUPLEXMODE? " + self._bts_number 1951 return self._anritsu.send_query(cmd) 1952 1953 @duplex_mode.setter 1954 def duplex_mode(self, mode): 1955 """ Sets the duplex mode for the cell 1956 1957 Args: 1958 mode: string indicating FDD or TDD 1959 1960 Returns: 1961 None 1962 """ 1963 cmd = "DUPLEXMODE {},{}".format(mode, self._bts_number) 1964 self._anritsu.send_command(cmd) 1965 1966 @property 1967 def uldl_configuration(self): 1968 """ Gets the UL/DL pattern configuration for TDD bands 1969 1970 Args: 1971 None 1972 1973 Returns: 1974 Configuration number 1975 """ 1976 cmd = "ULDLCONFIGURATION? " + self._bts_number 1977 return self._anritsu.send_query(cmd) 1978 1979 @uldl_configuration.setter 1980 def uldl_configuration(self, configuration): 1981 """ Sets the UL/DL pattern configuration for TDD bands 1982 1983 Args: 1984 configuration: configuration number, [ 0, 6 ] inclusive 1985 1986 Returns: 1987 None 1988 1989 Raises: 1990 ValueError: Frame structure has to be [ 0, 6 ] inclusive 1991 """ 1992 if configuration not in range(0, 7): 1993 raise ValueError("The frame structure configuration has to be a " 1994 "number between 0 and 6 inclusive") 1995 1996 cmd = "ULDLCONFIGURATION {},{}".format(configuration, self._bts_number) 1997 self._anritsu.send_command(cmd) 1998 1999 @property 2000 def cfi(self): 2001 """ Gets the Control Format Indicator for this base station. 2002 2003 Args: 2004 None 2005 2006 Returns: 2007 The CFI number. 2008 """ 2009 cmd = "CFI? " + self._bts_number 2010 return self._anritsu.send_query(cmd) 2011 2012 @cfi.setter 2013 def cfi(self, cfi): 2014 """ Sets the Control Format Indicator for this base station. 2015 2016 Args: 2017 cfi: one of BESTEFFORT, AUTO, 1, 2 or 3. 2018 2019 Returns: 2020 None 2021 2022 Raises: 2023 ValueError: if cfi's value is invalid 2024 """ 2025 2026 cfi = str(cfi) 2027 2028 valid_values = {'BESTEFFORT', 'AUTO', '1', '2', '3'} 2029 if cfi not in valid_values: 2030 raise ValueError('Valid values for CFI are %r' % valid_values) 2031 2032 cmd = "CFI {},{}".format(cfi, self._bts_number) 2033 self._anritsu.send_command(cmd) 2034 2035 @property 2036 def paging_duration(self): 2037 """ Gets the paging cycle duration for this base station. 2038 2039 Args: 2040 None 2041 2042 Returns: 2043 The paging cycle duration in milliseconds. 2044 """ 2045 cmd = "PCYCLE? " + self._bts_number 2046 return self._anritsu.send_query(cmd) 2047 2048 @paging_duration.setter 2049 def paging_duration(self, duration): 2050 """ Sets the paging cycle duration for this base station. 2051 2052 Args: 2053 duration: the paging cycle duration in milliseconds. 2054 2055 Returns: 2056 None 2057 2058 Raises: 2059 ValueError: if duration's value is invalid 2060 """ 2061 2062 duration = int(duration) 2063 2064 valid_values = {320, 640, 1280, 2560} 2065 if duration not in valid_values: 2066 raise ValueError('Valid values for the paging cycle duration are ' 2067 '%r.' % valid_values) 2068 2069 cmd = "PCYCLE {},{}".format(duration, self._bts_number) 2070 self._anritsu.send_command(cmd) 2071 2072 @property 2073 def phich_resource(self): 2074 """ Gets the PHICH Resource setting for this base station. 2075 2076 Args: 2077 None 2078 2079 Returns: 2080 The PHICH Resource setting. 2081 """ 2082 cmd = "PHICHRESOURCE? " + self._bts_number 2083 return self._anritsu.send_query(cmd) 2084 2085 @phich_resource.setter 2086 def phich_resource(self, phich): 2087 """ Sets the PHICH Resource setting for this base station. 2088 2089 Args: 2090 phich: one of 1/6, 1/2, 1, 2. 2091 2092 Returns: 2093 None 2094 2095 Raises: 2096 ValueError: if phich's value is invalid 2097 """ 2098 2099 phich = str(phich) 2100 2101 valid_values = ['1/6', '1/2', '1', '2'] 2102 if phich not in valid_values: 2103 raise ValueError('Valid values for PHICH Resource are %r' % 2104 valid_values) 2105 2106 cmd = "PHICHRESOURCE {},{}".format(phich, self._bts_number) 2107 self._anritsu.send_command(cmd) 2108 2109 @property 2110 def tdd_special_subframe(self): 2111 """ Gets SPECIALSUBFRAME of cell. 2112 2113 Args: 2114 None 2115 2116 Returns: 2117 tdd_special_subframe: integer between 0,9 inclusive 2118 """ 2119 cmd = "SPECIALSUBFRAME? " + self._bts_number 2120 tdd_special_subframe = int(self._anritsu.send_query(cmd)) 2121 return tdd_special_subframe 2122 2123 @tdd_special_subframe.setter 2124 def tdd_special_subframe(self, tdd_special_subframe): 2125 """ Sets SPECIALSUBFRAME of cell. 2126 2127 Args: 2128 tdd_special_subframe: int between 0,9 inclusive 2129 2130 Returns: 2131 None 2132 2133 Raises: 2134 ValueError: tdd_special_subframe has to be between 0,9 inclusive 2135 """ 2136 if tdd_special_subframe not in range(0, 10): 2137 raise ValueError("The special subframe config is not [0,9]") 2138 cmd = "SPECIALSUBFRAME {},{}".format(tdd_special_subframe, 2139 self._bts_number) 2140 self._anritsu.send_command(cmd) 2141 2142 @property 2143 def dl_antenna(self): 2144 """ Gets the DL ANTENNA count of the cell 2145 2146 Args: 2147 None 2148 2149 Returns: 2150 No of DL Antenna 2151 """ 2152 cmd = "ANTENNAS? " + self._bts_number 2153 return self._anritsu.send_query(cmd) 2154 2155 @dl_antenna.setter 2156 def dl_antenna(self, num_antenna): 2157 """ Sets the DL ANTENNA of the cell 2158 2159 Args: 2160 c: DL ANTENNA of the cell 2161 2162 Returns: 2163 None 2164 """ 2165 cmd = "ANTENNAS {},{}".format(num_antenna, self._bts_number) 2166 self._anritsu.send_command(cmd) 2167 2168 @property 2169 def bandwidth(self): 2170 """ Gets the channel bandwidth of the cell 2171 2172 Args: 2173 None 2174 2175 Returns: 2176 channel bandwidth 2177 """ 2178 cmd = "BANDWIDTH? " + self._bts_number 2179 return self._anritsu.send_query(cmd) 2180 2181 @bandwidth.setter 2182 def bandwidth(self, bandwidth): 2183 """ Sets the channel bandwidth of the cell 2184 2185 Args: 2186 bandwidth: channel bandwidth of the cell 2187 2188 Returns: 2189 None 2190 """ 2191 if not isinstance(bandwidth, BtsBandwidth): 2192 raise ValueError(' The parameter should be of type "BtsBandwidth"') 2193 cmd = "BANDWIDTH {},{}".format(bandwidth.value, self._bts_number) 2194 self._anritsu.send_command(cmd) 2195 2196 @property 2197 def dl_bandwidth(self): 2198 """ Gets the downlink bandwidth of the cell 2199 2200 Args: 2201 None 2202 2203 Returns: 2204 downlink bandwidth 2205 """ 2206 cmd = "DLBANDWIDTH? " + self._bts_number 2207 return self._anritsu.send_query(cmd) 2208 2209 @dl_bandwidth.setter 2210 def dl_bandwidth(self, bandwidth): 2211 """ Sets the downlink bandwidth of the cell 2212 2213 Args: 2214 bandwidth: downlink bandwidth of the cell 2215 2216 Returns: 2217 None 2218 """ 2219 if not isinstance(bandwidth, BtsBandwidth): 2220 raise ValueError(' The parameter should be of type "BtsBandwidth"') 2221 cmd = "DLBANDWIDTH {},{}".format(bandwidth.value, self._bts_number) 2222 self._anritsu.send_command(cmd) 2223 2224 @property 2225 def ul_bandwidth(self): 2226 """ Gets the uplink bandwidth of the cell 2227 2228 Args: 2229 None 2230 2231 Returns: 2232 uplink bandwidth 2233 """ 2234 cmd = "ULBANDWIDTH? " + self._bts_number 2235 return self._anritsu.send_query(cmd) 2236 2237 @ul_bandwidth.setter 2238 def ul_bandwidth(self, bandwidth): 2239 """ Sets the uplink bandwidth of the cell 2240 2241 Args: 2242 bandwidth: uplink bandwidth of the cell 2243 2244 Returns: 2245 None 2246 """ 2247 if not isinstance(bandwidth, BtsBandwidth): 2248 raise ValueError( 2249 ' The parameter should be of type "BtsBandwidth" ') 2250 cmd = "ULBANDWIDTH {},{}".format(bandwidth.value, self._bts_number) 2251 self._anritsu.send_command(cmd) 2252 2253 @property 2254 def packet_rate(self): 2255 """ Gets the packet rate of the cell 2256 2257 Args: 2258 None 2259 2260 Returns: 2261 packet rate 2262 """ 2263 cmd = "PACKETRATE? " + self._bts_number 2264 return self._anritsu.send_query(cmd) 2265 2266 @packet_rate.setter 2267 def packet_rate(self, packetrate): 2268 """ Sets the packet rate of the cell 2269 2270 Args: 2271 packetrate: packet rate of the cell 2272 2273 Returns: 2274 None 2275 """ 2276 if not isinstance(packetrate, BtsPacketRate): 2277 raise ValueError(' The parameter should be of type' 2278 ' "BtsPacketRate" ') 2279 cmd = "PACKETRATE {},{}".format(packetrate.value, self._bts_number) 2280 self._anritsu.send_command(cmd) 2281 2282 @property 2283 def ul_windowsize(self): 2284 """ Gets the uplink window size of the cell 2285 2286 Args: 2287 None 2288 2289 Returns: 2290 uplink window size 2291 """ 2292 cmd = "ULWINSIZE? " + self._bts_number 2293 return self._anritsu.send_query(cmd) 2294 2295 @ul_windowsize.setter 2296 def ul_windowsize(self, windowsize): 2297 """ Sets the uplink window size of the cell 2298 2299 Args: 2300 windowsize: uplink window size of the cell 2301 2302 Returns: 2303 None 2304 """ 2305 if not isinstance(windowsize, BtsPacketWindowSize): 2306 raise ValueError(' The parameter should be of type' 2307 ' "BtsPacketWindowSize" ') 2308 cmd = "ULWINSIZE {},{}".format(windowsize.value, self._bts_number) 2309 self._anritsu.send_command(cmd) 2310 2311 @property 2312 def dl_windowsize(self): 2313 """ Gets the downlink window size of the cell 2314 2315 Args: 2316 None 2317 2318 Returns: 2319 downlink window size 2320 """ 2321 cmd = "DLWINSIZE? " + self._bts_number 2322 return self._anritsu.send_query(cmd) 2323 2324 @dl_windowsize.setter 2325 def dl_windowsize(self, windowsize): 2326 """ Sets the downlink window size of the cell 2327 2328 Args: 2329 windowsize: downlink window size of the cell 2330 2331 Returns: 2332 None 2333 """ 2334 if not isinstance(windowsize, BtsPacketWindowSize): 2335 raise ValueError(' The parameter should be of type' 2336 ' "BtsPacketWindowSize" ') 2337 cmd = "DLWINSIZE {},{}".format(windowsize.value, self._bts_number) 2338 self._anritsu.send_command(cmd) 2339 2340 @property 2341 def service_state(self): 2342 """ Gets the service state of BTS 2343 2344 Args: 2345 None 2346 2347 Returns: 2348 service state IN/OUT 2349 """ 2350 cmd = "OUTOFSERVICE? " + self._bts_number 2351 return self._anritsu.send_query(cmd) 2352 2353 @service_state.setter 2354 def service_state(self, service_state): 2355 """ Sets the service state of BTS 2356 2357 Args: 2358 service_state: service state of BTS , IN/OUT 2359 2360 Returns: 2361 None 2362 """ 2363 if not isinstance(service_state, BtsServiceState): 2364 raise ValueError(' The parameter should be of type' 2365 ' "BtsServiceState" ') 2366 cmd = "OUTOFSERVICE {},{}".format(service_state.value, 2367 self._bts_number) 2368 self._anritsu.send_command(cmd) 2369 2370 @property 2371 def cell_barred(self): 2372 """ Gets the Cell Barred state of the cell 2373 2374 Args: 2375 None 2376 2377 Returns: 2378 one of BtsCellBarred value 2379 """ 2380 cmd = "CELLBARRED?" + self._bts_number 2381 return self._anritsu.send_query(cmd) 2382 2383 @cell_barred.setter 2384 def cell_barred(self, barred_option): 2385 """ Sets the Cell Barred state of the cell 2386 2387 Args: 2388 barred_option: Cell Barred state of the cell 2389 2390 Returns: 2391 None 2392 """ 2393 if not isinstance(barred_option, BtsCellBarred): 2394 raise ValueError(' The parameter should be of type' 2395 ' "BtsCellBarred" ') 2396 cmd = "CELLBARRED {},{}".format(barred_option.value, self._bts_number) 2397 self._anritsu.send_command(cmd) 2398 2399 @property 2400 def accessclass_barred(self): 2401 """ Gets the Access Class Barred state of the cell 2402 2403 Args: 2404 None 2405 2406 Returns: 2407 one of BtsAccessClassBarred value 2408 """ 2409 cmd = "ACBARRED? " + self._bts_number 2410 return self._anritsu.send_query(cmd) 2411 2412 @accessclass_barred.setter 2413 def accessclass_barred(self, barred_option): 2414 """ Sets the Access Class Barred state of the cell 2415 2416 Args: 2417 barred_option: Access Class Barred state of the cell 2418 2419 Returns: 2420 None 2421 """ 2422 if not isinstance(barred_option, BtsAccessClassBarred): 2423 raise ValueError(' The parameter should be of type' 2424 ' "BtsAccessClassBarred" ') 2425 cmd = "ACBARRED {},{}".format(barred_option.value, self._bts_number) 2426 self._anritsu.send_command(cmd) 2427 2428 @property 2429 def lteemergency_ac_barred(self): 2430 """ Gets the LTE emergency Access Class Barred state of the cell 2431 2432 Args: 2433 None 2434 2435 Returns: 2436 one of BtsLteEmergencyAccessClassBarred value 2437 """ 2438 cmd = "LTEEMERGENCYACBARRED? " + self._bts_number 2439 return self._anritsu.send_query(cmd) 2440 2441 @lteemergency_ac_barred.setter 2442 def lteemergency_ac_barred(self, barred_option): 2443 """ Sets the LTE emergency Access Class Barred state of the cell 2444 2445 Args: 2446 barred_option: Access Class Barred state of the cell 2447 2448 Returns: 2449 None 2450 """ 2451 if not isinstance(barred_option, BtsLteEmergencyAccessClassBarred): 2452 raise ValueError(' The parameter should be of type' 2453 ' "BtsLteEmergencyAccessClassBarred" ') 2454 cmd = "LTEEMERGENCYACBARRED {},{}".format(barred_option.value, 2455 self._bts_number) 2456 self._anritsu.send_command(cmd) 2457 2458 @property 2459 def mcc(self): 2460 """ Gets the MCC of the cell 2461 2462 Args: 2463 None 2464 2465 Returns: 2466 MCC of the cell 2467 """ 2468 cmd = "MCC? " + self._bts_number 2469 return self._anritsu.send_query(cmd) 2470 2471 @mcc.setter 2472 def mcc(self, mcc_code): 2473 """ Sets the MCC of the cell 2474 2475 Args: 2476 mcc_code: MCC of the cell 2477 2478 Returns: 2479 None 2480 """ 2481 cmd = "MCC {},{}".format(mcc_code, self._bts_number) 2482 self._anritsu.send_command(cmd) 2483 2484 @property 2485 def mnc(self): 2486 """ Gets the MNC of the cell 2487 2488 Args: 2489 None 2490 2491 Returns: 2492 MNC of the cell 2493 """ 2494 cmd = "MNC? " + self._bts_number 2495 return self._anritsu.send_query(cmd) 2496 2497 @mnc.setter 2498 def mnc(self, mnc_code): 2499 """ Sets the MNC of the cell 2500 2501 Args: 2502 mnc_code: MNC of the cell 2503 2504 Returns: 2505 None 2506 """ 2507 cmd = "MNC {},{}".format(mnc_code, self._bts_number) 2508 self._anritsu.send_command(cmd) 2509 2510 @property 2511 def nw_fullname_enable(self): 2512 """ Gets the network full name enable status 2513 2514 Args: 2515 None 2516 2517 Returns: 2518 one of BtsNwNameEnable value 2519 """ 2520 cmd = "NWFNAMEON? " + self._bts_number 2521 return self._anritsu.send_query(cmd) 2522 2523 @nw_fullname_enable.setter 2524 def nw_fullname_enable(self, enable): 2525 """ Sets the network full name enable status 2526 2527 Args: 2528 enable: network full name enable status 2529 2530 Returns: 2531 None 2532 """ 2533 if not isinstance(enable, BtsNwNameEnable): 2534 raise ValueError(' The parameter should be of type' 2535 ' "BtsNwNameEnable" ') 2536 cmd = "NWFNAMEON {},{}".format(enable.value, self._bts_number) 2537 self._anritsu.send_command(cmd) 2538 2539 @property 2540 def nw_fullname(self): 2541 """ Gets the network full name 2542 2543 Args: 2544 None 2545 2546 Returns: 2547 Network fulll name 2548 """ 2549 cmd = "NWFNAME? " + self._bts_number 2550 return self._anritsu.send_query(cmd) 2551 2552 @nw_fullname.setter 2553 def nw_fullname(self, fullname): 2554 """ Sets the network full name 2555 2556 Args: 2557 fullname: network full name 2558 2559 Returns: 2560 None 2561 """ 2562 cmd = "NWFNAME {},{}".format(fullname, self._bts_number) 2563 self._anritsu.send_command(cmd) 2564 2565 @property 2566 def nw_shortname_enable(self): 2567 """ Gets the network short name enable status 2568 2569 Args: 2570 None 2571 2572 Returns: 2573 one of BtsNwNameEnable value 2574 """ 2575 cmd = "NWSNAMEON? " + self._bts_number 2576 return self._anritsu.send_query(cmd) 2577 2578 @nw_shortname_enable.setter 2579 def nw_shortname_enable(self, enable): 2580 """ Sets the network short name enable status 2581 2582 Args: 2583 enable: network short name enable status 2584 2585 Returns: 2586 None 2587 """ 2588 if not isinstance(enable, BtsNwNameEnable): 2589 raise ValueError(' The parameter should be of type' 2590 ' "BtsNwNameEnable" ') 2591 cmd = "NWSNAMEON {},{}".format(enable.value, self._bts_number) 2592 self._anritsu.send_command(cmd) 2593 2594 @property 2595 def nw_shortname(self): 2596 """ Gets the network short name 2597 2598 Args: 2599 None 2600 2601 Returns: 2602 Network short name 2603 """ 2604 cmd = "NWSNAME? " + self._bts_number 2605 return self._anritsu.send_query(cmd) 2606 2607 @nw_shortname.setter 2608 def nw_shortname(self, shortname): 2609 """ Sets the network short name 2610 2611 Args: 2612 shortname: network short name 2613 2614 Returns: 2615 None 2616 """ 2617 cmd = "NWSNAME {},{}".format(shortname, self._bts_number) 2618 self._anritsu.send_command(cmd) 2619 2620 def apply_parameter_changes(self): 2621 """ apply the parameter changes at run time 2622 2623 Args: 2624 None 2625 2626 Returns: 2627 None 2628 """ 2629 cmd = "APPLYPARAM" 2630 self._anritsu.send_command(cmd) 2631 2632 @property 2633 def wcdma_ctch(self): 2634 """ Gets the WCDMA CTCH enable/disable status 2635 2636 Args: 2637 None 2638 2639 Returns: 2640 one of CTCHSetup values 2641 """ 2642 cmd = "CTCHPARAMSETUP? " + self._bts_number 2643 return self._anritsu.send_query(cmd) 2644 2645 @wcdma_ctch.setter 2646 def wcdma_ctch(self, enable): 2647 """ Sets the WCDMA CTCH enable/disable status 2648 2649 Args: 2650 enable: WCDMA CTCH enable/disable status 2651 2652 Returns: 2653 None 2654 """ 2655 cmd = "CTCHPARAMSETUP {},{}".format(enable.value, self._bts_number) 2656 self._anritsu.send_command(cmd) 2657 2658 @property 2659 def lac(self): 2660 """ Gets the Location Area Code of the cell 2661 2662 Args: 2663 None 2664 2665 Returns: 2666 LAC value 2667 """ 2668 cmd = "LAC? " + self._bts_number 2669 return self._anritsu.send_query(cmd) 2670 2671 @lac.setter 2672 def lac(self, lac): 2673 """ Sets the Location Area Code of the cell 2674 2675 Args: 2676 lac: Location Area Code of the cell 2677 2678 Returns: 2679 None 2680 """ 2681 cmd = "LAC {},{}".format(lac, self._bts_number) 2682 self._anritsu.send_command(cmd) 2683 2684 @property 2685 def rac(self): 2686 """ Gets the Routing Area Code of the cell 2687 2688 Args: 2689 None 2690 2691 Returns: 2692 RAC value 2693 """ 2694 cmd = "RAC? " + self._bts_number 2695 return self._anritsu.send_query(cmd) 2696 2697 @rac.setter 2698 def rac(self, rac): 2699 """ Sets the Routing Area Code of the cell 2700 2701 Args: 2702 rac: Routing Area Code of the cell 2703 2704 Returns: 2705 None 2706 """ 2707 cmd = "RAC {},{}".format(rac, self._bts_number) 2708 self._anritsu.send_command(cmd) 2709 2710 @property 2711 def dl_channel(self): 2712 """ Gets the downlink channel number of the cell 2713 2714 Args: 2715 None 2716 2717 Returns: 2718 RAC value 2719 """ 2720 cmd = "DLCHAN? " + self._bts_number 2721 return self._anritsu.send_query(cmd) 2722 2723 @dl_channel.setter 2724 def dl_channel(self, channel): 2725 """ Sets the downlink channel number of the cell 2726 2727 Args: 2728 channel: downlink channel number of the cell 2729 2730 Returns: 2731 None 2732 """ 2733 cmd = "DLCHAN {},{}".format(channel, self._bts_number) 2734 self._anritsu.send_command(cmd) 2735 2736 @property 2737 def dl_cc_enabled(self): 2738 """ Checks if component carrier is enabled or disabled 2739 2740 Args: 2741 None 2742 2743 Returns: 2744 True if enabled, False if disabled 2745 """ 2746 return (self._anritsu.send_query("TESTDLCC?" + 2747 self._bts_number) == "ENABLE") 2748 2749 @dl_cc_enabled.setter 2750 def dl_cc_enabled(self, enabled): 2751 """ Enables or disables the component carrier 2752 2753 Args: 2754 enabled: True if it should be enabled, False if disabled 2755 2756 Returns: 2757 None 2758 """ 2759 cmd = "TESTDLCC {},{}".format("ENABLE" if enabled else "DISABLE", 2760 self._bts_number) 2761 self._anritsu.send_command(cmd) 2762 2763 @property 2764 def sector1_mcc(self): 2765 """ Gets the sector 1 MCC of the CDMA cell 2766 2767 Args: 2768 None 2769 2770 Returns: 2771 sector 1 mcc 2772 """ 2773 cmd = "S1MCC? " + self._bts_number 2774 return self._anritsu.send_query(cmd) 2775 2776 @sector1_mcc.setter 2777 def sector1_mcc(self, mcc): 2778 """ Sets the sector 1 MCC of the CDMA cell 2779 2780 Args: 2781 mcc: sector 1 MCC of the CDMA cell 2782 2783 Returns: 2784 None 2785 """ 2786 cmd = "S1MCC {},{}".format(mcc, self._bts_number) 2787 self._anritsu.send_command(cmd) 2788 2789 @property 2790 def sector1_sid(self): 2791 """ Gets the sector 1 system ID of the CDMA cell 2792 2793 Args: 2794 None 2795 2796 Returns: 2797 sector 1 system Id 2798 """ 2799 cmd = "S1SID? " + self._bts_number 2800 return self._anritsu.send_query(cmd) 2801 2802 @sector1_sid.setter 2803 def sector1_sid(self, sid): 2804 """ Sets the sector 1 system ID of the CDMA cell 2805 2806 Args: 2807 sid: sector 1 system ID of the CDMA cell 2808 2809 Returns: 2810 None 2811 """ 2812 cmd = "S1SID {},{}".format(sid, self._bts_number) 2813 self._anritsu.send_command(cmd) 2814 2815 @property 2816 def sector1_nid(self): 2817 """ Gets the sector 1 network ID of the CDMA cell 2818 2819 Args: 2820 None 2821 2822 Returns: 2823 sector 1 network Id 2824 """ 2825 cmd = "S1NID? " + self._bts_number 2826 return self._anritsu.send_query(cmd) 2827 2828 @sector1_nid.setter 2829 def sector1_nid(self, nid): 2830 """ Sets the sector 1 network ID of the CDMA cell 2831 2832 Args: 2833 nid: sector 1 network ID of the CDMA cell 2834 2835 Returns: 2836 None 2837 """ 2838 cmd = "S1NID {},{}".format(nid, self._bts_number) 2839 self._anritsu.send_command(cmd) 2840 2841 @property 2842 def sector1_baseid(self): 2843 """ Gets the sector 1 Base ID of the CDMA cell 2844 2845 Args: 2846 None 2847 2848 Returns: 2849 sector 1 Base Id 2850 """ 2851 cmd = "S1BASEID? " + self._bts_number 2852 return self._anritsu.send_query(cmd) 2853 2854 @sector1_baseid.setter 2855 def sector1_baseid(self, baseid): 2856 """ Sets the sector 1 Base ID of the CDMA cell 2857 2858 Args: 2859 baseid: sector 1 Base ID of the CDMA cell 2860 2861 Returns: 2862 None 2863 """ 2864 cmd = "S1BASEID {},{}".format(baseid, self._bts_number) 2865 self._anritsu.send_command(cmd) 2866 2867 @property 2868 def sector1_latitude(self): 2869 """ Gets the sector 1 latitude of the CDMA cell 2870 2871 Args: 2872 None 2873 2874 Returns: 2875 sector 1 latitude 2876 """ 2877 cmd = "S1LATITUDE? " + self._bts_number 2878 return self._anritsu.send_query(cmd) 2879 2880 @sector1_latitude.setter 2881 def sector1_latitude(self, latitude): 2882 """ Sets the sector 1 latitude of the CDMA cell 2883 2884 Args: 2885 latitude: sector 1 latitude of the CDMA cell 2886 2887 Returns: 2888 None 2889 """ 2890 cmd = "S1LATITUDE {},{}".format(latitude, self._bts_number) 2891 self._anritsu.send_command(cmd) 2892 2893 @property 2894 def sector1_longitude(self): 2895 """ Gets the sector 1 longitude of the CDMA cell 2896 2897 Args: 2898 None 2899 2900 Returns: 2901 sector 1 longitude 2902 """ 2903 cmd = "S1LONGITUDE? " + self._bts_number 2904 return self._anritsu.send_query(cmd) 2905 2906 @sector1_longitude.setter 2907 def sector1_longitude(self, longitude): 2908 """ Sets the sector 1 longitude of the CDMA cell 2909 2910 Args: 2911 longitude: sector 1 longitude of the CDMA cell 2912 2913 Returns: 2914 None 2915 """ 2916 cmd = "S1LONGITUDE {},{}".format(longitude, self._bts_number) 2917 self._anritsu.send_command(cmd) 2918 2919 @property 2920 def evdo_sid(self): 2921 """ Gets the Sector ID of the EVDO cell 2922 2923 Args: 2924 None 2925 2926 Returns: 2927 Sector Id 2928 """ 2929 cmd = "S1SECTORID? " + self._bts_number 2930 return self._anritsu.send_query(cmd) 2931 2932 @evdo_sid.setter 2933 def evdo_sid(self, sid): 2934 """ Sets the Sector ID of the EVDO cell 2935 2936 Args: 2937 sid: Sector ID of the EVDO cell 2938 2939 Returns: 2940 None 2941 """ 2942 cmd = "S1SECTORID {},{}".format(sid, self._bts_number) 2943 self._anritsu.send_command(cmd) 2944 2945 @property 2946 def cell_id(self): 2947 """ Gets the cell identity of the cell 2948 2949 Args: 2950 None 2951 2952 Returns: 2953 cell identity 2954 """ 2955 cmd = "CELLID? " + self._bts_number 2956 return self._anritsu.send_query(cmd) 2957 2958 @cell_id.setter 2959 def cell_id(self, cell_id): 2960 """ Sets the cell identity of the cell 2961 2962 Args: 2963 cell_id: cell identity of the cell 2964 2965 Returns: 2966 None 2967 """ 2968 cmd = "CELLID {},{}".format(cell_id, self._bts_number) 2969 self._anritsu.send_command(cmd) 2970 2971 @property 2972 def physical_cellid(self): 2973 """ Gets the physical cell id of the cell 2974 2975 Args: 2976 None 2977 2978 Returns: 2979 physical cell id 2980 """ 2981 cmd = "PHYCELLID? " + self._bts_number 2982 return self._anritsu.send_query(cmd) 2983 2984 @physical_cellid.setter 2985 def physical_cellid(self, physical_cellid): 2986 """ Sets the physical cell id of the cell 2987 2988 Args: 2989 physical_cellid: physical cell id of the cell 2990 2991 Returns: 2992 None 2993 """ 2994 cmd = "PHYCELLID {},{}".format(physical_cellid, self._bts_number) 2995 self._anritsu.send_command(cmd) 2996 2997 @property 2998 def gsm_mcs_dl(self): 2999 """ Gets the Modulation and Coding scheme (DL) of the GSM cell 3000 3001 Args: 3002 None 3003 3004 Returns: 3005 DL MCS 3006 """ 3007 cmd = "DLMCS? " + self._bts_number 3008 return self._anritsu.send_query(cmd) 3009 3010 @gsm_mcs_dl.setter 3011 def gsm_mcs_dl(self, mcs_dl): 3012 """ Sets the Modulation and Coding scheme (DL) of the GSM cell 3013 3014 Args: 3015 mcs_dl: Modulation and Coding scheme (DL) of the GSM cell 3016 3017 Returns: 3018 None 3019 """ 3020 cmd = "DLMCS {},{}".format(mcs_dl, self._bts_number) 3021 self._anritsu.send_command(cmd) 3022 3023 @property 3024 def gsm_mcs_ul(self): 3025 """ Gets the Modulation and Coding scheme (UL) of the GSM cell 3026 3027 Args: 3028 None 3029 3030 Returns: 3031 UL MCS 3032 """ 3033 cmd = "ULMCS? " + self._bts_number 3034 return self._anritsu.send_query(cmd) 3035 3036 @gsm_mcs_ul.setter 3037 def gsm_mcs_ul(self, mcs_ul): 3038 """ Sets the Modulation and Coding scheme (UL) of the GSM cell 3039 3040 Args: 3041 mcs_ul:Modulation and Coding scheme (UL) of the GSM cell 3042 3043 Returns: 3044 None 3045 """ 3046 cmd = "ULMCS {},{}".format(mcs_ul, self._bts_number) 3047 self._anritsu.send_command(cmd) 3048 3049 @property 3050 def lte_scheduling_mode(self): 3051 """ Gets the Scheduling mode of the LTE cell 3052 3053 Args: 3054 None 3055 3056 Returns: 3057 Scheduling mode 3058 """ 3059 cmd = "SCHEDULEMODE? " + self._bts_number 3060 return self._anritsu.send_query(cmd) 3061 3062 @lte_scheduling_mode.setter 3063 def lte_scheduling_mode(self, mode): 3064 """ Sets the Scheduling mode of the LTE cell 3065 3066 Args: 3067 mode: STATIC (default) or DYNAMIC 3068 3069 Returns: 3070 None 3071 """ 3072 counter = 1 3073 while mode != self.lte_scheduling_mode: 3074 if counter > 3: 3075 raise AnritsuError("Fail to set scheduling mode in 3 tries!") 3076 cmd = "SCHEDULEMODE {},{}".format(mode, self._bts_number) 3077 self._anritsu.send_command(cmd) 3078 counter += 1 3079 time.sleep(1) 3080 3081 @property 3082 def tbs_pattern(self): 3083 """ Gets the TBS Pattern setting for the LTE cell 3084 3085 Args: 3086 None 3087 3088 Returns: 3089 TBS Pattern setting 3090 """ 3091 cmd = "TBSPATTERN? " + self._bts_number 3092 return self._anritsu.send_query(cmd) 3093 3094 @tbs_pattern.setter 3095 def tbs_pattern(self, pattern): 3096 """ Sets the TBS Pattern setting for the LTE cell 3097 3098 Args: 3099 mode: "FULLALLOCATION" or "OFF" 3100 3101 Returns: 3102 None 3103 """ 3104 cmd = "TBSPATTERN {}, {}".format(pattern, self._bts_number) 3105 self._anritsu.send_command(cmd) 3106 3107 @property 3108 def lte_mcs_dl(self): 3109 """ Gets the Modulation and Coding scheme (DL) of the LTE cell 3110 3111 Args: 3112 None 3113 3114 Returns: 3115 DL MCS 3116 """ 3117 cmd = "DLIMCS? " + self._bts_number 3118 return self._anritsu.send_query(cmd) 3119 3120 @lte_mcs_dl.setter 3121 def lte_mcs_dl(self, mcs_dl): 3122 """ Sets the Modulation and Coding scheme (DL) of the LTE cell 3123 3124 Args: 3125 mcs_dl: Modulation and Coding scheme (DL) of the LTE cell 3126 3127 Returns: 3128 None 3129 """ 3130 cmd = "DLIMCS {},{}".format(mcs_dl, self._bts_number) 3131 self._anritsu.send_command(cmd) 3132 3133 @property 3134 def lte_mcs_ul(self): 3135 """ Gets the Modulation and Coding scheme (UL) of the LTE cell 3136 3137 Args: 3138 None 3139 3140 Returns: 3141 UL MCS 3142 """ 3143 cmd = "ULIMCS? " + self._bts_number 3144 return self._anritsu.send_query(cmd) 3145 3146 @lte_mcs_ul.setter 3147 def lte_mcs_ul(self, mcs_ul): 3148 """ Sets the Modulation and Coding scheme (UL) of the LTE cell 3149 3150 Args: 3151 mcs_ul: Modulation and Coding scheme (UL) of the LTE cell 3152 3153 Returns: 3154 None 3155 """ 3156 cmd = "ULIMCS {},{}".format(mcs_ul, self._bts_number) 3157 self._anritsu.send_command(cmd) 3158 3159 @property 3160 def lte_dl_modulation_order(self): 3161 """ Gets the DL modulation order of the LTE cell 3162 3163 Args: 3164 None 3165 3166 Returns: 3167 The DL modulation order 3168 """ 3169 cmd = "DLRMC_MOD? " + self._bts_number 3170 return self._anritsu.send_query(cmd) 3171 3172 @lte_dl_modulation_order.setter 3173 def lte_dl_modulation_order(self, order): 3174 """ Sets the DL modulation order of the LTE cell 3175 3176 Args: 3177 order: the DL modulation order of the LTE cell 3178 3179 Returns: 3180 None 3181 """ 3182 cmd = "DLRMC_MOD {},{}".format(order, self._bts_number) 3183 self._anritsu.send_command(cmd) 3184 3185 @property 3186 def lte_ul_modulation_order(self): 3187 """ Gets the UL modulation order of the LTE cell 3188 3189 Args: 3190 None 3191 3192 Returns: 3193 The UL modulation order 3194 """ 3195 cmd = "ULRMC_MOD? " + self._bts_number 3196 return self._anritsu.send_query(cmd) 3197 3198 @lte_ul_modulation_order.setter 3199 def lte_ul_modulation_order(self, order): 3200 """ Sets the UL modulation order of the LTE cell 3201 3202 Args: 3203 order: the UL modulation order of the LTE cell 3204 3205 Returns: 3206 None 3207 """ 3208 cmd = "ULRMC_MOD {},{}".format(order, self._bts_number) 3209 self._anritsu.send_command(cmd) 3210 3211 @property 3212 def nrb_dl(self): 3213 """ Gets the Downlink N Resource Block of the cell 3214 3215 Args: 3216 None 3217 3218 Returns: 3219 Downlink NRB 3220 """ 3221 cmd = "DLNRB? " + self._bts_number 3222 return self._anritsu.send_query(cmd) 3223 3224 @nrb_dl.setter 3225 def nrb_dl(self, blocks): 3226 """ Sets the Downlink N Resource Block of the cell 3227 3228 Args: 3229 blocks: Downlink N Resource Block of the cell 3230 3231 Returns: 3232 None 3233 """ 3234 cmd = "DLNRB {},{}".format(blocks, self._bts_number) 3235 self._anritsu.send_command(cmd) 3236 3237 @property 3238 def nrb_ul(self): 3239 """ Gets the uplink N Resource Block of the cell 3240 3241 Args: 3242 None 3243 3244 Returns: 3245 uplink NRB 3246 """ 3247 cmd = "ULNRB? " + self._bts_number 3248 return self._anritsu.send_query(cmd) 3249 3250 @nrb_ul.setter 3251 def nrb_ul(self, blocks): 3252 """ Sets the uplink N Resource Block of the cell 3253 3254 Args: 3255 blocks: uplink N Resource Block of the cell 3256 3257 Returns: 3258 None 3259 """ 3260 cmd = "ULNRB {},{}".format(blocks, self._bts_number) 3261 self._anritsu.send_command(cmd) 3262 3263 @property 3264 def max_nrb_ul(self): 3265 ul_bandwidth = self.ul_bandwidth 3266 if ul_bandwidth == 'SAMEASDL': 3267 ul_bandwidth = self.dl_bandwidth 3268 max_nrb = MAX_NRB_FOR_BANDWIDTH.get(ul_bandwidth, None) 3269 if not max_nrb: 3270 raise ValueError('Could not get maximum RB allocation' 3271 'for bandwidth: {}'.format(ul_bandwidth)) 3272 return max_nrb 3273 3274 @property 3275 def mimo_support(self): 3276 """ Gets the maximum supported MIMO mode for the LTE bases tation. 3277 3278 Returns: 3279 the MIMO mode as a string 3280 """ 3281 cmd = "LTEMIMO? " + self._bts_number 3282 return self._anritsu.send_query(cmd) 3283 3284 @mimo_support.setter 3285 def mimo_support(self, mode): 3286 """ Sets the maximum supported MIMO mode for the LTE base station. 3287 3288 Args: 3289 mode: a string or an object of the LteMimoMode class. 3290 """ 3291 3292 if isinstance(mode, LteMimoMode): 3293 mode = mode.value 3294 3295 cmd = "LTEMIMO {},{}".format(self._bts_number, mode) 3296 self._anritsu.send_command(cmd) 3297 3298 @property 3299 def neighbor_cell_mode(self): 3300 """ Gets the neighbor cell mode 3301 3302 Args: 3303 None 3304 3305 Returns: 3306 current neighbor cell mode 3307 """ 3308 cmd = "NCLIST? " + self._bts_number 3309 return self._anritsu.send_query(cmd) 3310 3311 @neighbor_cell_mode.setter 3312 def neighbor_cell_mode(self, mode): 3313 """ Sets the neighbor cell mode 3314 3315 Args: 3316 mode: neighbor cell mode , DEFAULT/ USERDATA 3317 3318 Returns: 3319 None 3320 """ 3321 cmd = "NCLIST {},{}".format(mode, self._bts_number) 3322 self._anritsu.send_command(cmd) 3323 3324 def get_neighbor_cell_type(self, system, index): 3325 """ Gets the neighbor cell type 3326 3327 Args: 3328 system: simulation model of neighbor cell 3329 LTE, WCDMA, TDSCDMA, GSM, CDMA1X,EVDO 3330 index: Index of neighbor cell 3331 3332 Returns: 3333 neighbor cell type 3334 """ 3335 cmd = "NCTYPE? {},{},{}".format(system, index, self._bts_number) 3336 return self._anritsu.send_query(cmd) 3337 3338 def set_neighbor_cell_type(self, system, index, cell_type): 3339 """ Sets the neighbor cell type 3340 3341 Args: 3342 system: simulation model of neighbor cell 3343 LTE, WCDMA, TDSCDMA, GSM, CDMA1X,EVDO 3344 index: Index of neighbor cell 3345 cell_type: cell type 3346 BTS1, BTS2, BTS3, BTS4,CELLNAME, DISABLE 3347 3348 Returns: 3349 None 3350 """ 3351 cmd = "NCTYPE {},{},{},{}".format(system, index, cell_type, 3352 self._bts_number) 3353 self._anritsu.send_command(cmd) 3354 3355 def get_neighbor_cell_name(self, system, index): 3356 """ Gets the neighbor cell name 3357 3358 Args: 3359 system: simulation model of neighbor cell 3360 LTE, WCDMA, TDSCDMA, GSM, CDMA1X,EVDO 3361 index: Index of neighbor cell 3362 3363 Returns: 3364 neighbor cell name 3365 """ 3366 cmd = "NCCELLNAME? {},{},{}".format(system, index, self._bts_number) 3367 return self._anritsu.send_query(cmd) 3368 3369 def set_neighbor_cell_name(self, system, index, name): 3370 """ Sets the neighbor cell name 3371 3372 Args: 3373 system: simulation model of neighbor cell 3374 LTE, WCDMA, TDSCDMA, GSM, CDMA1X,EVDO 3375 index: Index of neighbor cell 3376 name: cell name 3377 3378 Returns: 3379 None 3380 """ 3381 cmd = "NCCELLNAME {},{},{},{}".format(system, index, name, 3382 self._bts_number) 3383 self._anritsu.send_command(cmd) 3384 3385 def get_neighbor_cell_mcc(self, system, index): 3386 """ Gets the neighbor cell mcc 3387 3388 Args: 3389 system: simulation model of neighbor cell 3390 LTE, WCDMA, TDSCDMA, GSM, CDMA1X,EVDO 3391 index: Index of neighbor cell 3392 3393 Returns: 3394 neighbor cell mcc 3395 """ 3396 cmd = "NCMCC? {},{},{}".format(system, index, self._bts_number) 3397 return self._anritsu.send_query(cmd) 3398 3399 def get_neighbor_cell_mnc(self, system, index): 3400 """ Gets the neighbor cell mnc 3401 3402 Args: 3403 system: simulation model of neighbor cell 3404 LTE, WCDMA, TDSCDMA, GSM, CDMA1X,EVDO 3405 index: Index of neighbor cell 3406 3407 Returns: 3408 neighbor cell mnc 3409 """ 3410 cmd = "NCMNC? {},{},{}".format(system, index, self._bts_number) 3411 return self._anritsu.send_query(cmd) 3412 3413 def get_neighbor_cell_id(self, system, index): 3414 """ Gets the neighbor cell id 3415 3416 Args: 3417 system: simulation model of neighbor cell 3418 LTE, WCDMA, TDSCDMA, GSM, CDMA1X,EVDO 3419 index: Index of neighbor cell 3420 3421 Returns: 3422 neighbor cell id 3423 """ 3424 cmd = "NCCELLID? {},{},{}".format(system, index, self._bts_number) 3425 return self._anritsu.send_query(cmd) 3426 3427 def get_neighbor_cell_tac(self, system, index): 3428 """ Gets the neighbor cell tracking area code 3429 3430 Args: 3431 system: simulation model of neighbor cell 3432 LTE, WCDMA, TDSCDMA, GSM, CDMA1X,EVDO 3433 index: Index of neighbor cell 3434 3435 Returns: 3436 neighbor cell tracking area code 3437 """ 3438 cmd = "NCTAC? {},{},{}".format(system, index, self._bts_number) 3439 return self._anritsu.send_query(cmd) 3440 3441 def get_neighbor_cell_dl_channel(self, system, index): 3442 """ Gets the neighbor cell downlink channel 3443 3444 Args: 3445 system: simulation model of neighbor cell 3446 LTE, WCDMA, TDSCDMA, GSM, CDMA1X,EVDO 3447 index: Index of neighbor cell 3448 3449 Returns: 3450 neighbor cell tracking downlink channel 3451 """ 3452 cmd = "NCDLCHAN? {},{},{}".format(system, index, self._bts_number) 3453 return self._anritsu.send_query(cmd) 3454 3455 def get_neighbor_cell_dl_bandwidth(self, system, index): 3456 """ Gets the neighbor cell downlink bandwidth 3457 3458 Args: 3459 system: simulation model of neighbor cell 3460 LTE, WCDMA, TDSCDMA, GSM, CDMA1X,EVDO 3461 index: Index of neighbor cell 3462 3463 Returns: 3464 neighbor cell tracking downlink bandwidth 3465 """ 3466 cmd = "NCDLBANDWIDTH {},{},{}".format(system, index, self._bts_number) 3467 return self._anritsu.send_query(cmd) 3468 3469 def get_neighbor_cell_pcid(self, system, index): 3470 """ Gets the neighbor cell physical cell id 3471 3472 Args: 3473 system: simulation model of neighbor cell 3474 LTE, WCDMA, TDSCDMA, GSM, CDMA1X,EVDO 3475 index: Index of neighbor cell 3476 3477 Returns: 3478 neighbor cell physical cell id 3479 """ 3480 cmd = "NCPHYCELLID {},{},{}".format(system, index, self._bts_number) 3481 return self._anritsu.send_query(cmd) 3482 3483 def get_neighbor_cell_lac(self, system, index): 3484 """ Gets the neighbor cell location area code 3485 3486 Args: 3487 system: simulation model of neighbor cell 3488 LTE, WCDMA, TDSCDMA, GSM, CDMA1X,EVDO 3489 index: Index of neighbor cell 3490 3491 Returns: 3492 neighbor cell location area code 3493 """ 3494 cmd = "NCLAC {},{},{}".format(system, index, self._bts_number) 3495 return self._anritsu.send_query(cmd) 3496 3497 def get_neighbor_cell_rac(self, system, index): 3498 """ Gets the neighbor cell routing area code 3499 3500 Args: 3501 system: simulation model of neighbor cell 3502 LTE, WCDMA, TDSCDMA, GSM, CDMA1X,EVDO 3503 index: Index of neighbor cell 3504 3505 Returns: 3506 neighbor cell routing area code 3507 """ 3508 cmd = "NCRAC {},{},{}".format(system, index, self._bts_number) 3509 return self._anritsu.send_query(cmd) 3510 3511 @property 3512 def primary_scrambling_code(self): 3513 """ Gets the primary scrambling code for WCDMA cell 3514 3515 Args: 3516 None 3517 3518 Returns: 3519 primary scrambling code 3520 """ 3521 cmd = "PRISCRCODE? " + self._bts_number 3522 return self._anritsu.send_query(cmd) 3523 3524 @primary_scrambling_code.setter 3525 def primary_scrambling_code(self, psc): 3526 """ Sets the primary scrambling code for WCDMA cell 3527 3528 Args: 3529 psc: primary scrambling code 3530 3531 Returns: 3532 None 3533 """ 3534 cmd = "PRISCRCODE {},{}".format(psc, self._bts_number) 3535 self._anritsu.send_command(cmd) 3536 3537 @property 3538 def tac(self): 3539 """ Gets the Tracking Area Code of the LTE cell 3540 3541 Args: 3542 None 3543 3544 Returns: 3545 Tracking Area Code of the LTE cell 3546 """ 3547 cmd = "TAC? " + self._bts_number 3548 return self._anritsu.send_query(cmd) 3549 3550 @tac.setter 3551 def tac(self, tac): 3552 """ Sets the Tracking Area Code of the LTE cell 3553 3554 Args: 3555 tac: Tracking Area Code of the LTE cell 3556 3557 Returns: 3558 None 3559 """ 3560 cmd = "TAC {},{}".format(tac, self._bts_number) 3561 self._anritsu.send_command(cmd) 3562 3563 @property 3564 def cell(self): 3565 """ Gets the current cell for BTS 3566 3567 Args: 3568 None 3569 3570 Returns: 3571 current cell for BTS 3572 """ 3573 cmd = "CELLSEL? {}".format(self._bts_number) 3574 return self._anritsu.send_query(cmd) 3575 3576 @cell.setter 3577 def cell(self, cell_name): 3578 """ sets the cell for BTS 3579 Args: 3580 cell_name: cell name 3581 3582 Returns: 3583 None 3584 """ 3585 cmd = "CELLSEL {},{}".format(self._bts_number, cell_name) 3586 return self._anritsu.send_command(cmd) 3587 3588 @property 3589 def gsm_cbch(self): 3590 """ Gets the GSM CBCH enable/disable status 3591 3592 Args: 3593 None 3594 3595 Returns: 3596 one of CBCHSetup values 3597 """ 3598 cmd = "CBCHPARAMSETUP? " + self._bts_number 3599 return self._anritsu.send_query(cmd) 3600 3601 @gsm_cbch.setter 3602 def gsm_cbch(self, enable): 3603 """ Sets the GSM CBCH enable/disable status 3604 3605 Args: 3606 enable: GSM CBCH enable/disable status 3607 3608 Returns: 3609 None 3610 """ 3611 cmd = "CBCHPARAMSETUP {},{}".format(enable.value, self._bts_number) 3612 self._anritsu.send_command(cmd) 3613 3614 @property 3615 def gsm_gprs_mode(self): 3616 """ Gets the GSM connection mode 3617 3618 Args: 3619 None 3620 3621 Returns: 3622 A string indicating if connection is EGPRS, GPRS or non-GPRS 3623 """ 3624 cmd = "GPRS? " + self._bts_number 3625 return self._anritsu.send_query(cmd) 3626 3627 @gsm_gprs_mode.setter 3628 def gsm_gprs_mode(self, mode): 3629 """ Sets the GPRS connection mode 3630 3631 Args: 3632 mode: GPRS connection mode 3633 3634 Returns: 3635 None 3636 """ 3637 3638 if not isinstance(mode, BtsGprsMode): 3639 raise ValueError(' The parameter should be of type "BtsGprsMode"') 3640 cmd = "GPRS {},{}".format(mode.value, self._bts_number) 3641 3642 self._anritsu.send_command(cmd) 3643 3644 @property 3645 def gsm_slots(self): 3646 """ Gets the GSM slot assignment 3647 3648 Args: 3649 None 3650 3651 Returns: 3652 A tuple indicating DL and UL slots. 3653 """ 3654 3655 cmd = "MLTSLTCFG? " + self._bts_number 3656 3657 response = self._anritsu.send_query(cmd) 3658 split_response = response.split(',') 3659 3660 if not len(split_response) == 2: 3661 raise ValueError(response) 3662 3663 return response[0], response[1] 3664 3665 @gsm_slots.setter 3666 def gsm_slots(self, slots): 3667 """ Sets the number of downlink / uplink slots for GSM 3668 3669 Args: 3670 slots: a tuple containing two ints indicating (DL,UL) 3671 3672 Returns: 3673 None 3674 """ 3675 3676 try: 3677 dl, ul = slots 3678 dl = int(dl) 3679 ul = int(ul) 3680 except: 3681 raise ValueError( 3682 'The parameter slot has to be a tuple containing two ints ' 3683 'indicating (dl,ul) slots.') 3684 3685 # Validate 3686 if dl < 1 or ul < 1 or dl + ul > 5: 3687 raise ValueError( 3688 'DL and UL slots have to be >= 1 and the sum <= 5.') 3689 3690 cmd = "MLTSLTCFG {},{},{}".format(dl, ul, self._bts_number) 3691 3692 self._anritsu.send_command(cmd) 3693 3694 3695class _VirtualPhone(object): 3696 '''Class to interact with virtual phone supported by MD8475 ''' 3697 def __init__(self, anritsu): 3698 self._anritsu = anritsu 3699 self.log = anritsu.log 3700 3701 @property 3702 def id(self): 3703 """ Gets the virtual phone ID 3704 3705 Args: 3706 None 3707 3708 Returns: 3709 virtual phone ID 3710 """ 3711 cmd = "VPID? " 3712 return self._anritsu.send_query(cmd) 3713 3714 @id.setter 3715 def id(self, phonenumber): 3716 """ Sets the virtual phone ID 3717 3718 Args: 3719 phonenumber: virtual phone ID 3720 3721 Returns: 3722 None 3723 """ 3724 cmd = "VPID {}".format(phonenumber) 3725 self._anritsu.send_command(cmd) 3726 3727 @property 3728 def id_c2k(self): 3729 """ Gets the virtual phone ID for CDMA 1x 3730 3731 Args: 3732 None 3733 3734 Returns: 3735 virtual phone ID 3736 """ 3737 cmd = "VPIDC2K? " 3738 return self._anritsu.send_query(cmd) 3739 3740 @id_c2k.setter 3741 def id_c2k(self, phonenumber): 3742 """ Sets the virtual phone ID for CDMA 1x 3743 3744 Args: 3745 phonenumber: virtual phone ID 3746 3747 Returns: 3748 None 3749 """ 3750 cmd = "VPIDC2K {}".format(phonenumber) 3751 self._anritsu.send_command(cmd) 3752 3753 @property 3754 def auto_answer(self): 3755 """ Gets the auto answer status of virtual phone 3756 3757 Args: 3758 None 3759 3760 Returns: 3761 auto answer status, ON/OFF 3762 """ 3763 cmd = "VPAUTOANSWER? " 3764 return self._anritsu.send_query(cmd) 3765 3766 @auto_answer.setter 3767 def auto_answer(self, option): 3768 """ Sets the auto answer feature 3769 3770 Args: 3771 option: tuple with two items for turning on Auto Answer 3772 (OFF or (ON, timetowait)) 3773 3774 Returns: 3775 None 3776 """ 3777 enable = "OFF" 3778 time = 5 3779 3780 try: 3781 enable, time = option 3782 except ValueError: 3783 if enable != "OFF": 3784 raise ValueError("Pass a tuple with two items for" 3785 " Turning on Auto Answer") 3786 cmd = "VPAUTOANSWER {},{}".format(enable.value, time) 3787 self._anritsu.send_command(cmd) 3788 3789 @property 3790 def calling_mode(self): 3791 """ Gets the calling mode of virtual phone 3792 3793 Args: 3794 None 3795 3796 Returns: 3797 calling mode of virtual phone 3798 """ 3799 cmd = "VPCALLINGMODE? " 3800 return self._anritsu.send_query(cmd) 3801 3802 @calling_mode.setter 3803 def calling_mode(self, calling_mode): 3804 """ Sets the calling mode of virtual phone 3805 3806 Args: 3807 calling_mode: calling mode of virtual phone 3808 3809 Returns: 3810 None 3811 """ 3812 cmd = "VPCALLINGMODE {}".format(calling_mode) 3813 self._anritsu.send_command(cmd) 3814 3815 def set_voice_off_hook(self): 3816 """ Set the virtual phone operating mode to Voice Off Hook 3817 3818 Args: 3819 None 3820 3821 Returns: 3822 None 3823 """ 3824 cmd = "OPERATEVPHONE 0" 3825 return self._anritsu.send_command(cmd) 3826 3827 def set_voice_on_hook(self): 3828 """ Set the virtual phone operating mode to Voice On Hook 3829 3830 Args: 3831 None 3832 3833 Returns: 3834 None 3835 """ 3836 cmd = "OPERATEVPHONE 1" 3837 return self._anritsu.send_command(cmd) 3838 3839 def set_video_off_hook(self): 3840 """ Set the virtual phone operating mode to Video Off Hook 3841 3842 Args: 3843 None 3844 3845 Returns: 3846 None 3847 """ 3848 cmd = "OPERATEVPHONE 2" 3849 return self._anritsu.send_command(cmd) 3850 3851 def set_video_on_hook(self): 3852 """ Set the virtual phone operating mode to Video On Hook 3853 3854 Args: 3855 None 3856 3857 Returns: 3858 None 3859 """ 3860 cmd = "OPERATEVPHONE 3" 3861 return self._anritsu.send_command(cmd) 3862 3863 def set_call_waiting(self): 3864 """ Set the virtual phone operating mode to Call waiting 3865 3866 Args: 3867 None 3868 3869 Returns: 3870 None 3871 """ 3872 cmd = "OPERATEVPHONE 4" 3873 return self._anritsu.send_command(cmd) 3874 3875 @property 3876 def status(self): 3877 """ Gets the virtual phone status 3878 3879 Args: 3880 None 3881 3882 Returns: 3883 virtual phone status 3884 """ 3885 cmd = "VPSTAT?" 3886 status = self._anritsu.send_query(cmd) 3887 return _VP_STATUS[status] 3888 3889 def sendSms(self, phoneNumber, message): 3890 """ Sends the SMS data from Anritsu to UE 3891 3892 Args: 3893 phoneNumber: sender of SMS 3894 message: message text 3895 3896 Returns: 3897 None 3898 """ 3899 cmd = ("SENDSMS /?PhoneNumber=001122334455&Sender={}&Text={}" 3900 "&DCS=00").format(phoneNumber, AnritsuUtils.gsm_encode(message)) 3901 return self._anritsu.send_command(cmd) 3902 3903 def sendSms_c2k(self, phoneNumber, message): 3904 """ Sends the SMS data from Anritsu to UE (in CDMA) 3905 3906 Args: 3907 phoneNumber: sender of SMS 3908 message: message text 3909 3910 Returns: 3911 None 3912 """ 3913 cmd = ("C2KSENDSMS System=CDMA\&Originating_Address={}\&UserData={}" 3914 ).format(phoneNumber, AnritsuUtils.cdma_encode(message)) 3915 return self._anritsu.send_command(cmd) 3916 3917 def receiveSms(self): 3918 """ Receives SMS messages sent by the UE in an external application 3919 3920 Args: 3921 None 3922 3923 Returns: 3924 None 3925 """ 3926 return self._anritsu.send_query("RECEIVESMS?") 3927 3928 def receiveSms_c2k(self): 3929 """ Receives SMS messages sent by the UE(in CDMA) in an external application 3930 3931 Args: 3932 None 3933 3934 Returns: 3935 None 3936 """ 3937 return self._anritsu.send_query("C2KRECEIVESMS?") 3938 3939 def setSmsStatusReport(self, status): 3940 """ Set the Status Report value of the SMS 3941 3942 Args: 3943 status: status code 3944 3945 Returns: 3946 None 3947 """ 3948 cmd = "SMSSTATUSREPORT {}".format(status) 3949 return self._anritsu.send_command(cmd) 3950 3951 3952class _PacketDataNetwork(object): 3953 '''Class to configure PDN parameters''' 3954 def __init__(self, anritsu, pdnnumber): 3955 self._pdn_number = pdnnumber 3956 self._anritsu = anritsu 3957 self.log = anritsu.log 3958 3959 # Default Gateway Selection 3960 @property 3961 def pdn_DG_selection(self): 3962 """ Gets the default gateway for the PDN 3963 3964 Args: 3965 None 3966 3967 Returns: 3968 Current UE status 3969 """ 3970 cmd = "PDNDEFAULTGATEWAY? " + self._pdn_number 3971 return self._anritsu.send_query(cmd) 3972 3973 @pdn_DG_selection.setter 3974 def pdn_DG_selection(self, selection): 3975 """ Sets the default gateway selection for the PDN 3976 3977 Args: 3978 Selection: COMMON or USER 3979 3980 Returns: 3981 None 3982 """ 3983 cmd = "PDNDEFAULTGATEWAY {},{}".format(self._pdn_number, selection) 3984 self._anritsu.send_command(cmd) 3985 3986 # PDN specific Default Gateway: 3987 @property 3988 def pdn_gateway_ipv4addr(self): 3989 """ Gets the IPv4 address of the default gateway 3990 3991 Args: 3992 None 3993 3994 Returns: 3995 current UE status 3996 """ 3997 cmd = "PDNDGIPV4? " + self._pdn_number 3998 return self._anritsu.send_query(cmd) 3999 4000 @pdn_gateway_ipv4addr.setter 4001 def pdn_gateway_ipv4addr(self, ipv4_addr): 4002 """ sets the IPv4 address of the default gateway 4003 4004 Args: 4005 ipv4_addr: IPv4 address of the default gateway 4006 4007 Returns: 4008 None 4009 """ 4010 cmd = "PDNDGIPV4 {},{}".format(self._pdn_number, ipv4_addr) 4011 self._anritsu.send_command(cmd) 4012 4013 @property 4014 def pdn_gateway_ipv6addr(self): 4015 """ Gets the IPv6 address of the default gateway 4016 4017 Args: 4018 None 4019 4020 Returns: 4021 current UE status 4022 """ 4023 cmd = "PDNDGIPV6? " + self._pdn_number 4024 return self._anritsu.send_query(cmd) 4025 4026 @pdn_gateway_ipv6addr.setter 4027 def pdn_gateway_ipv6addr(self, ipv6_addr): 4028 """ sets the IPv6 address of the default gateway 4029 4030 Args: 4031 ipv6_addr: IPv6 address of the default gateway 4032 4033 Returns: 4034 None 4035 """ 4036 cmd = "PDNDGIPV6 {},{}".format(self._pdn_number, ipv6_addr) 4037 self._anritsu.send_command(cmd) 4038 4039 @property 4040 def ue_address_iptype(self): 4041 """ Gets IP type of UE for particular PDN 4042 4043 Args: 4044 None 4045 4046 Returns: 4047 IP type of UE for particular PDN 4048 """ 4049 cmd = "PDNIPTYPE? " + self._pdn_number 4050 return self._anritsu.send_query(cmd) 4051 4052 @ue_address_iptype.setter 4053 def ue_address_iptype(self, ip_type): 4054 """ Set IP type of UE for particular PDN 4055 4056 Args: 4057 ip_type: IP type of UE 4058 4059 Returns: 4060 None 4061 """ 4062 if not isinstance(ip_type, IPAddressType): 4063 raise ValueError( 4064 ' The parameter should be of type "IPAddressType"') 4065 cmd = "PDNIPTYPE {},{}".format(self._pdn_number, ip_type.value) 4066 self._anritsu.send_command(cmd) 4067 4068 @property 4069 def ue_address_ipv4(self): 4070 """ Gets UE IPv4 address 4071 4072 Args: 4073 None 4074 4075 Returns: 4076 UE IPv4 address 4077 """ 4078 cmd = "PDNIPV4? " + self._pdn_number 4079 return self._anritsu.send_query(cmd) 4080 4081 @ue_address_ipv4.setter 4082 def ue_address_ipv4(self, ip_address): 4083 """ Set UE IPv4 address 4084 4085 Args: 4086 ip_address: UE IPv4 address 4087 4088 Returns: 4089 None 4090 """ 4091 cmd = "PDNIPV4 {},{}".format(self._pdn_number, ip_address) 4092 self._anritsu.send_command(cmd) 4093 4094 @property 4095 def ue_address_ipv6(self): 4096 """ Gets UE IPv6 address 4097 4098 Args: 4099 None 4100 4101 Returns: 4102 UE IPv6 address 4103 """ 4104 cmd = "PDNIPV6? " + self._pdn_number 4105 return self._anritsu.send_query(cmd) 4106 4107 @ue_address_ipv6.setter 4108 def ue_address_ipv6(self, ip_address): 4109 """ Set UE IPv6 address 4110 4111 Args: 4112 ip_address: UE IPv6 address 4113 4114 Returns: 4115 None 4116 """ 4117 cmd = "PDNIPV6 {},{}".format(self._pdn_number, ip_address) 4118 self._anritsu.send_command(cmd) 4119 4120 @property 4121 def primary_dns_address_ipv4(self): 4122 """ Gets Primary DNS server IPv4 address 4123 4124 Args: 4125 None 4126 4127 Returns: 4128 Primary DNS server IPv4 address 4129 """ 4130 cmd = "PDNDNSIPV4PRI? " + self._pdn_number 4131 return self._anritsu.send_query(cmd) 4132 4133 @primary_dns_address_ipv4.setter 4134 def primary_dns_address_ipv4(self, ip_address): 4135 """ Set Primary DNS server IPv4 address 4136 4137 Args: 4138 ip_address: Primary DNS server IPv4 address 4139 4140 Returns: 4141 None 4142 """ 4143 cmd = "PDNDNSIPV4PRI {},{}".format(self._pdn_number, ip_address) 4144 self._anritsu.send_command(cmd) 4145 4146 @property 4147 def secondary_dns_address_ipv4(self): 4148 """ Gets secondary DNS server IPv4 address 4149 4150 Args: 4151 None 4152 4153 Returns: 4154 secondary DNS server IPv4 address 4155 """ 4156 cmd = "PDNDNSIPV4SEC? " + self._pdn_number 4157 return self._anritsu.send_query(cmd) 4158 4159 @secondary_dns_address_ipv4.setter 4160 def secondary_dns_address_ipv4(self, ip_address): 4161 """ Set secondary DNS server IPv4 address 4162 4163 Args: 4164 ip_address: secondary DNS server IPv4 address 4165 4166 Returns: 4167 None 4168 """ 4169 cmd = "PDNDNSIPV4SEC {},{}".format(self._pdn_number, ip_address) 4170 self._anritsu.send_command(cmd) 4171 4172 @property 4173 def dns_address_ipv6(self): 4174 """ Gets DNS server IPv6 address 4175 4176 Args: 4177 None 4178 4179 Returns: 4180 DNS server IPv6 address 4181 """ 4182 cmd = "PDNDNSIPV6? " + self._pdn_number 4183 return self._anritsu.send_query(cmd) 4184 4185 @dns_address_ipv6.setter 4186 def dns_address_ipv6(self, ip_address): 4187 """ Set DNS server IPv6 address 4188 4189 Args: 4190 ip_address: DNS server IPv6 address 4191 4192 Returns: 4193 None 4194 """ 4195 cmd = "PDNDNSIPV6 {},{}".format(self._pdn_number, ip_address) 4196 self._anritsu.send_command(cmd) 4197 4198 @property 4199 def cscf_address_ipv4(self): 4200 """ Gets Secondary P-CSCF IPv4 address 4201 4202 Args: 4203 None 4204 4205 Returns: 4206 Secondary P-CSCF IPv4 address 4207 """ 4208 cmd = "PDNPCSCFIPV4? " + self._pdn_number 4209 return self._anritsu.send_query(cmd) 4210 4211 @cscf_address_ipv4.setter 4212 def cscf_address_ipv4(self, ip_address): 4213 """ Set Secondary P-CSCF IPv4 address 4214 4215 Args: 4216 ip_address: Secondary P-CSCF IPv4 address 4217 4218 Returns: 4219 None 4220 """ 4221 cmd = "PDNPCSCFIPV4 {},{}".format(self._pdn_number, ip_address) 4222 self._anritsu.send_command(cmd) 4223 4224 @property 4225 def cscf_address_ipv6(self): 4226 """ Gets P-CSCF IPv6 address 4227 4228 Args: 4229 None 4230 4231 Returns: 4232 P-CSCF IPv6 address 4233 """ 4234 cmd = "PDNPCSCFIPV6? " + self._pdn_number 4235 return self._anritsu.send_query(cmd) 4236 4237 @cscf_address_ipv6.setter 4238 def cscf_address_ipv6(self, ip_address): 4239 """ Set P-CSCF IPv6 address 4240 4241 Args: 4242 ip_address: P-CSCF IPv6 address 4243 4244 Returns: 4245 None 4246 """ 4247 cmd = "PDNPCSCFIPV6 {},{}".format(self._pdn_number, ip_address) 4248 self._anritsu.send_command(cmd) 4249 4250 @property 4251 def pdn_ims(self): 4252 """ Get PDN IMS VNID binding status 4253 4254 Args: 4255 None 4256 4257 Returns: 4258 PDN IMS VNID binding status 4259 """ 4260 cmd = "PDNIMS? " + self._pdn_number 4261 return self._anritsu.send_query(cmd) 4262 4263 @pdn_ims.setter 4264 def pdn_ims(self, switch): 4265 """ Set PDN IMS VNID binding Enable/Disable 4266 4267 Args: 4268 switch: "ENABLE/DISABLE" 4269 4270 Returns: 4271 None 4272 """ 4273 if not isinstance(switch, Switch): 4274 raise ValueError(' The parameter should be of type' 4275 ' "Switch", ie, ENABLE or DISABLE ') 4276 cmd = "PDNIMS {},{}".format(self._pdn_number, switch.value) 4277 self._anritsu.send_command(cmd) 4278 4279 @property 4280 def pdn_vnid(self): 4281 """ Get PDN IMS VNID 4282 4283 Args: 4284 None 4285 4286 Returns: 4287 PDN IMS VNID 4288 """ 4289 cmd = "PDNVNID? " + self._pdn_number 4290 return self._anritsu.send_query(cmd) 4291 4292 @pdn_vnid.setter 4293 def pdn_vnid(self, vnid): 4294 """ Set PDN IMS VNID 4295 4296 Args: 4297 vnid: 1~99 4298 4299 Returns: 4300 None 4301 """ 4302 cmd = "PDNVNID {},{}".format(self._pdn_number, vnid) 4303 self._anritsu.send_command(cmd) 4304 4305 @property 4306 def pdn_apn_name(self): 4307 """ Get PDN APN NAME 4308 4309 Args: 4310 None 4311 4312 Returns: 4313 PDN APN NAME 4314 """ 4315 cmd = "PDNCHECKAPN? " + self._pdn_number 4316 return self._anritsu.send_query(cmd) 4317 4318 @pdn_apn_name.setter 4319 def pdn_apn_name(self, name): 4320 """ Set PDN APN NAME 4321 4322 Args: 4323 name: fast.t-mobile.com, ims 4324 4325 Returns: 4326 None 4327 """ 4328 cmd = "PDNCHECKAPN {},{}".format(self._pdn_number, name) 4329 self._anritsu.send_command(cmd) 4330 4331 @property 4332 def pdn_qci(self): 4333 """ Get PDN QCI Value 4334 4335 Args: 4336 None 4337 4338 Returns: 4339 PDN QCI Value 4340 """ 4341 cmd = "PDNQCIDEFAULT? " + self._pdn_number 4342 return self._anritsu.send_query(cmd) 4343 4344 @pdn_qci.setter 4345 def pdn_qci(self, qci_value): 4346 """ Set PDN QCI Value 4347 4348 Args: 4349 qci_value: 5, 9 4350 4351 Returns: 4352 None 4353 """ 4354 cmd = "PDNQCIDEFAULT {},{}".format(self._pdn_number, qci_value) 4355 self._anritsu.send_command(cmd) 4356 4357 4358class _TriggerMessage(object): 4359 '''Class to interact with trigger message handling supported by MD8475 ''' 4360 def __init__(self, anritsu): 4361 self._anritsu = anritsu 4362 self.log = anritsu.log 4363 4364 def set_reply_type(self, message_id, reply_type): 4365 """ Sets the reply type of the trigger information 4366 4367 Args: 4368 message_id: trigger information message Id 4369 reply_type: reply type of the trigger information 4370 4371 Returns: 4372 None 4373 """ 4374 if not isinstance(message_id, TriggerMessageIDs): 4375 raise ValueError(' The parameter should be of type' 4376 ' "TriggerMessageIDs"') 4377 if not isinstance(reply_type, TriggerMessageReply): 4378 raise ValueError(' The parameter should be of type' 4379 ' "TriggerMessageReply"') 4380 4381 cmd = "REJECTTYPE {},{}".format(message_id.value, reply_type.value) 4382 self._anritsu.send_command(cmd) 4383 4384 def set_reject_cause(self, message_id, cause): 4385 """ Sets the reject cause of the trigger information 4386 4387 Args: 4388 message_id: trigger information message Id 4389 cause: cause for reject 4390 4391 Returns: 4392 None 4393 """ 4394 if not isinstance(message_id, TriggerMessageIDs): 4395 raise ValueError(' The parameter should be of type' 4396 ' "TriggerMessageIDs"') 4397 4398 cmd = "REJECTCAUSE {},{}".format(message_id.value, cause) 4399 self._anritsu.send_command(cmd) 4400 4401 4402class _IMS_Services(object): 4403 '''Class to configure and operate IMS Services''' 4404 def __init__(self, anritsu, vnid): 4405 self._vnid = vnid 4406 self._anritsu = anritsu 4407 self.log = anritsu.log 4408 4409 @property 4410 def sync(self): 4411 """ Gets Sync Enable status 4412 4413 Args: 4414 None 4415 4416 Returns: 4417 VNID Sync Enable status 4418 """ 4419 cmd = "IMSSYNCENABLE? " + self._vnid 4420 return self._anritsu.send_query(cmd) 4421 4422 @sync.setter 4423 def sync(self, switch): 4424 """ Set Sync Enable or Disable 4425 4426 Args: 4427 sync: ENABLE/DISABLE 4428 4429 Returns: 4430 None 4431 """ 4432 if not isinstance(switch, Switch): 4433 raise ValueError(' The parameter should be of type "Switch"') 4434 cmd = "IMSSYNCENABLE {},{}".format(self._vnid, switch.value) 4435 self._anritsu.send_command(cmd) 4436 4437 @property 4438 def cscf_address_ipv4(self): 4439 """ Gets CSCF IPv4 address 4440 4441 Args: 4442 None 4443 4444 Returns: 4445 CSCF IPv4 address 4446 """ 4447 cmd = "IMSCSCFIPV4? " + self._vnid 4448 return self._anritsu.send_query(cmd) 4449 4450 @cscf_address_ipv4.setter 4451 def cscf_address_ipv4(self, ip_address): 4452 """ Set CSCF IPv4 address 4453 4454 Args: 4455 ip_address: CSCF IPv4 address 4456 4457 Returns: 4458 None 4459 """ 4460 cmd = "IMSCSCFIPV4 {},{}".format(self._vnid, ip_address) 4461 self._anritsu.send_command(cmd) 4462 4463 @property 4464 def cscf_address_ipv6(self): 4465 """ Gets CSCF IPv6 address 4466 4467 Args: 4468 None 4469 4470 Returns: 4471 CSCF IPv6 address 4472 """ 4473 cmd = "IMSCSCFIPV6? " + self._vnid 4474 return self._anritsu.send_query(cmd) 4475 4476 @cscf_address_ipv6.setter 4477 def cscf_address_ipv6(self, ip_address): 4478 """ Set CSCF IPv6 address 4479 4480 Args: 4481 ip_address: CSCF IPv6 address 4482 4483 Returns: 4484 None 4485 """ 4486 cmd = "IMSCSCFIPV6 {},{}".format(self._vnid, ip_address) 4487 self._anritsu.send_command(cmd) 4488 4489 @property 4490 def imscscf_iptype(self): 4491 """ Gets CSCF IP Type 4492 4493 Args: 4494 None 4495 4496 Returns: 4497 CSCF IP Type 4498 """ 4499 cmd = "IMSCSCFIPTYPE? " + self._vnid 4500 return self._anritsu.send_query(cmd) 4501 4502 @imscscf_iptype.setter 4503 def imscscf_iptype(self, iptype): 4504 """ Set CSCF IP Type 4505 4506 Args: 4507 iptype: IPV4, IPV6, IPV4V6 4508 4509 Returns: 4510 None 4511 """ 4512 cmd = "IMSCSCFIPTYPE {},{}".format(self._vnid, iptype) 4513 self._anritsu.send_command(cmd) 4514 4515 @property 4516 def cscf_monitoring_ua(self): 4517 """ Get CSCF Monitoring UA URI 4518 4519 Args: 4520 None 4521 4522 Returns: 4523 CSCF Monitoring UA URI 4524 """ 4525 cmd = "IMSCSCFUAURI? " + self._vnid 4526 return self._anritsu.send_query(cmd) 4527 4528 @cscf_monitoring_ua.setter 4529 def cscf_monitoring_ua(self, ua_uri): 4530 """ Set CSCF Monitoring UA URI 4531 4532 Args: 4533 ua_uri: CSCF Monitoring UA URI 4534 4535 Returns: 4536 None 4537 """ 4538 cmd = "IMSCSCFUAURI {},{}".format(self._vnid, ua_uri) 4539 self._anritsu.send_command(cmd) 4540 4541 @property 4542 def cscf_host_name(self): 4543 """ Get CSCF Host Name 4544 4545 Args: 4546 None 4547 4548 Returns: 4549 CSCF Host Name 4550 """ 4551 cmd = "IMSCSCFNAME? " + self._vnid 4552 return self._anritsu.send_query(cmd) 4553 4554 @cscf_host_name.setter 4555 def cscf_host_name(self, host_name): 4556 """ Set CSCF Host Name 4557 4558 Args: 4559 host_name: CSCF Host Name 4560 4561 Returns: 4562 None 4563 """ 4564 cmd = "IMSCSCFNAME {},{}".format(self._vnid, host_name) 4565 self._anritsu.send_command(cmd) 4566 4567 @property 4568 def cscf_ims_authentication(self): 4569 """ Get CSCF IMS Auth Value 4570 4571 Args: 4572 None 4573 4574 Returns: 4575 CSCF IMS Auth 4576 """ 4577 cmd = "IMSCSCFAUTH? " + self._vnid 4578 return self._anritsu.send_query(cmd) 4579 4580 @cscf_ims_authentication.setter 4581 def cscf_ims_authentication(self, on_off): 4582 """ Set CSCF IMS Auth Value 4583 4584 Args: 4585 on_off: CSCF IMS Auth ENABLE/DISABLE 4586 4587 Returns: 4588 None 4589 """ 4590 cmd = "IMSCSCFAUTH {},{}".format(self._vnid, on_off) 4591 self._anritsu.send_command(cmd) 4592 4593 @property 4594 def cscf_precondition(self): 4595 """ Get CSCF IMS Precondition 4596 4597 Args: 4598 None 4599 4600 Returns: 4601 CSCF IMS Precondition 4602 """ 4603 cmd = "IMSCSCFPRECONDITION? " + self._vnid 4604 return self._anritsu.send_query(cmd) 4605 4606 @cscf_precondition.setter 4607 def cscf_precondition(self, on_off): 4608 """ Set CSCF IMS Precondition 4609 4610 Args: 4611 on_off: CSCF IMS Precondition ENABLE/DISABLE 4612 4613 Returns: 4614 None 4615 """ 4616 cmd = "IMSCSCFPRECONDITION {},{}".format(self._vnid, on_off) 4617 self._anritsu.send_command(cmd) 4618 4619 @property 4620 def cscf_virtual_ua(self): 4621 """ Get CSCF Virtual UA URI 4622 4623 Args: 4624 None 4625 4626 Returns: 4627 CSCF Virtual UA URI 4628 """ 4629 cmd = "IMSCSCFVUAURI? " + self._vnid 4630 return self._anritsu.send_query(cmd) 4631 4632 @cscf_virtual_ua.setter 4633 def cscf_virtual_ua(self, ua_uri): 4634 """ Set CSCF Virtual UA URI 4635 4636 Args: 4637 ua_uri: CSCF Virtual UA URI 4638 4639 Returns: 4640 None 4641 """ 4642 cmd = "IMSCSCFVUAURI {},{}".format(self._vnid, ua_uri) 4643 self._anritsu.send_command(cmd) 4644 4645 @property 4646 def tmo_cscf_userslist_add(self): 4647 """ Get CSCF USERLIST 4648 4649 Args: 4650 None 4651 4652 Returns: 4653 CSCF USERLIST 4654 """ 4655 cmd = "IMSCSCFUSERSLIST? " + self._vnid 4656 return self._anritsu.send_query(cmd) 4657 4658 @tmo_cscf_userslist_add.setter 4659 def tmo_cscf_userslist_add(self, username): 4660 """ Set CSCF USER to USERLIST 4661 This is needed if IMS AUTH is enabled 4662 4663 Args: 4664 username: CSCF Username 4665 4666 Returns: 4667 None 4668 """ 4669 cmd = "IMSCSCFUSERSLISTADD {},{},00112233445566778899AABBCCDDEEFF,TS34108,AKAV1_MD5,\ 4670 OPC,00000000000000000000000000000000,8000,TRUE,FALSE,0123456789ABCDEF0123456789ABCDEF,\ 4671 54CDFEAB9889000001326754CDFEAB98,6754CDFEAB9889BAEFDC457623100132,\ 4672 326754CDFEAB9889BAEFDC4576231001,TRUE,TRUE,TRUE".format( 4673 self._vnid, username) 4674 self._anritsu.send_command(cmd) 4675 4676 @property 4677 def fi_cscf_userslist_add(self): 4678 """ Get CSCF USERLIST 4679 4680 Args: 4681 None 4682 4683 Returns: 4684 CSCF USERLIST 4685 """ 4686 cmd = "IMSCSCFUSERSLIST? " + self._vnid 4687 return self._anritsu.send_query(cmd) 4688 4689 @fi_cscf_userslist_add.setter 4690 def fi_cscf_userslist_add(self, username): 4691 """ Set CSCF USER to USERLIST 4692 This is needed if IMS AUTH is enabled 4693 4694 Args: 4695 username: CSCF Username 4696 4697 Returns: 4698 None 4699 """ 4700 cmd = "IMSCSCFUSERSLISTADD {},{},00112233445566778899AABBCCDDEEFF,TS34108,AKAV1_MD5,\ 4701 OPC,00000000000000000000000000000000,8000,TRUE,FALSE,0123456789ABCDEF0123456789ABCDEF,\ 4702 54CDFEAB9889000001326754CDFEAB98,6754CDFEAB9889BAEFDC457623100132,\ 4703 326754CDFEAB9889BAEFDC4576231001,TRUE,TRUE,TRUE".format( 4704 self._vnid, username) 4705 self._anritsu.send_command(cmd) 4706 4707 @property 4708 def vzw_cscf_userslist_add(self): 4709 """ Get CSCF USERLIST 4710 4711 Args: 4712 None 4713 4714 Returns: 4715 CSCF USERLIST 4716 """ 4717 cmd = "IMSCSCFUSERSLIST? " + self._vnid 4718 return self._anritsu.send_query(cmd) 4719 4720 @vzw_cscf_userslist_add.setter 4721 def vzw_cscf_userslist_add(self, username): 4722 """ Set CSCF USER to USERLIST 4723 This is needed if IMS AUTH is enabled 4724 4725 Args: 4726 username: CSCF Username 4727 4728 Returns: 4729 None 4730 """ 4731 cmd = "IMSCSCFUSERSLISTADD {},{},465B5CE8B199B49FAA5F0A2EE238A6BC,MILENAGE,AKAV1_MD5,\ 4732 OP,5F1D289C5D354D0A140C2548F5F3E3BA,8000,TRUE,FALSE,0123456789ABCDEF0123456789ABCDEF,\ 4733 54CDFEAB9889000001326754CDFEAB98,6754CDFEAB9889BAEFDC457623100132,\ 4734 326754CDFEAB9889BAEFDC4576231001,TRUE,TRUE,TRUE".format( 4735 self._vnid, username) 4736 self._anritsu.send_command(cmd) 4737 4738 @property 4739 def dns(self): 4740 """ Gets DNS Enable status 4741 4742 Args: 4743 None 4744 4745 Returns: 4746 VNID DNS Enable status 4747 """ 4748 cmd = "IMSDNS? " + self._vnid 4749 return self._anritsu.send_query(cmd) 4750 4751 @dns.setter 4752 def dns(self, switch): 4753 """ Set DNS Enable or Disable 4754 4755 Args: 4756 sync: ENABLE/DISABLE 4757 4758 Returns: 4759 None 4760 """ 4761 if not isinstance(switch, Switch): 4762 raise ValueError(' The parameter should be of type "Switch"') 4763 cmd = "IMSDNS {},{}".format(self._vnid, switch.value) 4764 self._anritsu.send_command(cmd) 4765 4766 @property 4767 def ndp_nic(self): 4768 """ Gets NDP Network Interface name 4769 4770 Args: 4771 None 4772 4773 Returns: 4774 NDP NIC name 4775 """ 4776 cmd = "IMSNDPNIC? " + self._vnid 4777 return self._anritsu.send_query(cmd) 4778 4779 @ndp_nic.setter 4780 def ndp_nic(self, nic_name): 4781 """ Set NDP Network Interface name 4782 4783 Args: 4784 nic_name: NDP Network Interface name 4785 4786 Returns: 4787 None 4788 """ 4789 cmd = "IMSNDPNIC {},{}".format(self._vnid, nic_name) 4790 self._anritsu.send_command(cmd) 4791 4792 @property 4793 def ndp_prefix(self): 4794 """ Gets NDP IPv6 Prefix 4795 4796 Args: 4797 None 4798 4799 Returns: 4800 NDP IPv6 Prefix 4801 """ 4802 cmd = "IMSNDPPREFIX? " + self._vnid 4803 return self._anritsu.send_query(cmd) 4804 4805 @ndp_prefix.setter 4806 def ndp_prefix(self, prefix_addr): 4807 """ Set NDP IPv6 Prefix 4808 4809 Args: 4810 prefix_addr: NDP IPV6 Prefix Addr 4811 4812 Returns: 4813 None 4814 """ 4815 cmd = "IMSNDPPREFIX {},{},64".format(self._vnid, prefix_addr) 4816 self._anritsu.send_command(cmd) 4817 4818 @property 4819 def psap(self): 4820 """ Gets PSAP Enable status 4821 4822 Args: 4823 None 4824 4825 Returns: 4826 VNID PSAP Enable status 4827 """ 4828 cmd = "IMSPSAP? " + self._vnid 4829 return self._anritsu.send_query(cmd) 4830 4831 @psap.setter 4832 def psap(self, switch): 4833 """ Set PSAP Enable or Disable 4834 4835 Args: 4836 switch: ENABLE/DISABLE 4837 4838 Returns: 4839 None 4840 """ 4841 if not isinstance(switch, Switch): 4842 raise ValueError(' The parameter should be of type "Switch"') 4843 cmd = "IMSPSAP {},{}".format(self._vnid, switch.value) 4844 self._anritsu.send_command(cmd) 4845 4846 @property 4847 def psap_auto_answer(self): 4848 """ Gets PSAP Auto Answer status 4849 4850 Args: 4851 None 4852 4853 Returns: 4854 VNID PSAP Auto Answer status 4855 """ 4856 cmd = "IMSPSAPAUTOANSWER? " + self._vnid 4857 return self._anritsu.send_query(cmd) 4858 4859 @psap_auto_answer.setter 4860 def psap_auto_answer(self, switch): 4861 """ Set PSAP Auto Answer Enable or Disable 4862 4863 Args: 4864 switch: ENABLE/DISABLE 4865 4866 Returns: 4867 None 4868 """ 4869 if not isinstance(switch, Switch): 4870 raise ValueError(' The parameter should be of type "Switch"') 4871 cmd = "IMSPSAPAUTOANSWER {},{}".format(self._vnid, switch.value) 4872 self._anritsu.send_command(cmd) 4873 4874 def start_virtual_network(self): 4875 """ Start the specified Virtual Network (IMS service) 4876 4877 Args: 4878 None 4879 4880 Returns: 4881 None 4882 """ 4883 cmd = "IMSSTARTVN " + self._vnid 4884 return self._anritsu.send_command(cmd) 4885