Home | History | Annotate | Download | only in anritsu_lib
      1 #/usr/bin/env python3.4
      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 """
     17 Controller interface for Anritsu Signalling Tester MD8475A.
     18 """
     19 
     20 import time
     21 import socket
     22 from enum import Enum
     23 from enum import IntEnum
     24 
     25 from acts.controllers.anritsu_lib._anritsu_utils import AnritsuError
     26 from acts.controllers.anritsu_lib._anritsu_utils import AnritsuUtils
     27 from acts.controllers.anritsu_lib._anritsu_utils import NO_ERROR
     28 from acts.controllers.anritsu_lib._anritsu_utils import OPERATION_COMPLETE
     29 
     30 TERMINATOR = "\0"
     31 # The following wait times (except COMMUNICATION_STATE_WAIT_TIME) are actually
     32 # the times for socket to time out. Increasing them is to make sure there is
     33 # enough time for MD8475A operation to be completed in some cases.
     34 # It won't increase test execution time.
     35 SMARTSTUDIO_LAUNCH_WAIT_TIME = 300  # was 90
     36 SMARTSTUDIO_SIMULATION_START_WAIT_TIME = 300  # was 120
     37 REGISTRATION_STATE_WAIT_TIME = 240
     38 LOAD_SIMULATION_PARAM_FILE_WAIT_TIME = 30
     39 COMMUNICATION_STATE_WAIT_TIME = 240
     40 ANRITSU_SOCKET_BUFFER_SIZE = 8192
     41 COMMAND_COMPLETE_WAIT_TIME = 180  # was 90
     42 SETTLING_TIME = 1
     43 WAIT_TIME_IDENTITY_RESPONSE = 5
     44 
     45 IMSI_READ_USERDATA_WCDMA = "081501"
     46 IMEI_READ_USERDATA_WCDMA = "081502"
     47 IMEISV_READ_USERDATA_WCDMA = "081503"
     48 IMSI_READ_USERDATA_LTE = "075501"
     49 IMEI_READ_USERDATA_LTE = "075502"
     50 IMEISV_READ_USERDATA_LTE = "075503"
     51 IMSI_READ_USERDATA_GSM = "081501"
     52 IMEI_READ_USERDATA_GSM = "081502"
     53 IMEISV_READ_USERDATA_GSM = "081503"
     54 IDENTITY_REQ_DATA_LEN = 24
     55 SEQ_LOG_MESSAGE_START_INDEX = 60
     56 
     57 
     58 def create(configs, logger):
     59     objs = []
     60     for c in configs:
     61         ip_address = c["ip_address"]
     62         objs.append(MD8475A(ip_address, logger))
     63     return objs
     64 
     65 
     66 def destroy(objs):
     67     return
     68 
     69 
     70 class ProcessingStatus(Enum):
     71     ''' MD8475A processing status for UE,Packet,Voice,Video,SMS,
     72         PPP, PWS '''
     73     PROCESS_STATUS_NONE = "NONE"
     74     PROCESS_STATUS_NOTRUN = "NOTRUN"
     75     PROCESS_STATUS_POWEROFF = "POWEROFF"
     76     PROCESS_STATUS_REGISTRATION = "REGISTRATION"
     77     PROCESS_STATUS_DETACH = "DETACH"
     78     PROCESS_STATUS_IDLE = "IDLE"
     79     PROCESS_STATUS_ORIGINATION = "ORIGINATION"
     80     PROCESS_STATUS_HANDOVER = "HANDOVER"
     81     PROCESS_STATUS_UPDATING = "UPDATING"
     82     PROCESS_STATUS_TERMINATION = "TERMINATION"
     83     PROCESS_STATUS_COMMUNICATION = "COMMUNICATION"
     84     PROCESS_STATUS_UERELEASE = "UERELEASE"
     85     PROCESS_STATUS_NWRELEASE = "NWRELEASE"
     86 
     87 
     88 class BtsNumber(Enum):
     89     '''ID number for MD8475A supported BTS '''
     90     BTS1 = "BTS1"
     91     BTS2 = "BTS2"
     92     BTS3 = "BTS3"
     93     BTS4 = "BTS4"
     94 
     95 
     96 class BtsTechnology(Enum):
     97     ''' BTS system technology'''
     98     LTE = "LTE"
     99     WCDMA = "WCDMA"
    100     TDSCDMA = "TDSCDMA"
    101     GSM = "GSM"
    102     CDMA1X = "CDMA1X"
    103     EVDO = "EVDO"
    104 
    105 
    106 class BtsBandwidth(Enum):
    107     ''' Values for Cell Bandwidth '''
    108     LTE_BANDWIDTH_1dot4MHz = "1.4MHz"
    109     LTE_BANDWIDTH_3MHz = "3MHz"
    110     LTE_BANDWIDTH_5MHz = "5MHz"
    111     LTE_BANDWIDTH_10MHz = "10MHz"
    112     LTE_BANDWIDTH_15MHz = "15MHz"
    113     LTE_BANDWIDTH_20MHz = "20MHz"
    114 
    115 
    116 class BtsPacketRate(Enum):
    117     ''' Values for Cell Packet rate '''
    118     LTE_MANUAL = "MANUAL"
    119     LTE_BESTEFFORT = "BESTEFFORT"
    120     WCDMA_DLHSAUTO_REL7_UL384K = "DLHSAUTO_REL7_UL384K"
    121     WCDMA_DL18_0M_UL384K = "DL18_0M_UL384K"
    122     WCDMA_DL21_6M_UL384K = "DL21_6M_UL384K"
    123     WCDMA_DLHSAUTO_REL7_ULHSAUTO = "DLHSAUTO_REL7_ULHSAUTO"
    124     WCDMA_DL18_0M_UL1_46M = "DL18_0M_UL1_46M"
    125     WCDMA_DL18_0M_UL2_0M = "DL18_0M_UL2_0M"
    126     WCDMA_DL18_0M_UL5_76M = "DL18_0M_UL5_76M"
    127     WCDMA_DL21_6M_UL1_46M = "DL21_6M_UL1_46M"
    128     WCDMA_DL21_6M_UL2_0M = "DL21_6M_UL2_0M"
    129     WCDMA_DL21_6M_UL5_76M = "DL21_6M_UL5_76M"
    130     WCDMA_DLHSAUTO_REL8_UL384K = "DLHSAUTO_REL8_UL384K"
    131     WCDMA_DL23_4M_UL384K = "DL23_4M_UL384K"
    132     WCDMA_DL28_0M_UL384K = "DL28_0M_UL384K"
    133     WCDMA_DL36_0M_UL384K = "DL36_0M_UL384K"
    134     WCDMA_DL43_2M_UL384K = "DL43_2M_UL384K"
    135     WCDMA_DLHSAUTO_REL8_ULHSAUTO = "DLHSAUTO_REL8_ULHSAUTO"
    136     WCDMA_DL23_4M_UL1_46M = "DL23_4M_UL1_46M"
    137     WCDMA_DL23_4M_UL2_0M = "DL23_4M_UL2_0M"
    138     WCDMA_DL23_4M_UL5_76M = "DL23_4M_UL5_76M"
    139     WCDMA_DL28_0M_UL1_46M = "DL28_0M_UL1_46M"
    140     WCDMA_DL28_0M_UL2_0M = "DL28_0M_UL2_0M"
    141     WCDMA_DL28_0M_UL5_76M = "L28_0M_UL5_76M"
    142     WCDMA_DL36_0M_UL1_46M = "DL36_0M_UL1_46M"
    143     WCDMA_DL36_0M_UL2_0M = "DL36_0M_UL2_0M"
    144     WCDMA_DL36_0M_UL5_76M = "DL36_0M_UL5_76M"
    145     WCDMA_DL43_2M_UL1_46M = "DL43_2M_UL1_46M"
    146     WCDMA_DL43_2M_UL2_0M = "DL43_2M_UL2_0M"
    147     WCDMA_DL43_2M_UL5_76M = "L43_2M_UL5_76M"
    148 
    149 
    150 class BtsPacketWindowSize(Enum):
    151     ''' Values for Cell Packet window size '''
    152     WINDOW_SIZE_1 = 1
    153     WINDOW_SIZE_8 = 8
    154     WINDOW_SIZE_16 = 16
    155     WINDOW_SIZE_32 = 32
    156     WINDOW_SIZE_64 = 64
    157     WINDOW_SIZE_128 = 128
    158     WINDOW_SIZE_256 = 256
    159     WINDOW_SIZE_512 = 512
    160     WINDOW_SIZE_768 = 768
    161     WINDOW_SIZE_1024 = 1024
    162     WINDOW_SIZE_1536 = 1536
    163     WINDOW_SIZE_2047 = 2047
    164 
    165 
    166 class BtsServiceState(Enum):
    167     ''' Values for BTS service state '''
    168     SERVICE_STATE_IN = "IN"
    169     SERVICE_STATE_OUT = "OUT"
    170 
    171 
    172 class BtsCellBarred(Enum):
    173     ''' Values for Cell barred parameter '''
    174     NOTBARRED = "NOTBARRED"
    175     BARRED = "BARRED"
    176 
    177 
    178 class BtsAccessClassBarred(Enum):
    179     ''' Values for Access class barred parameter '''
    180     NOTBARRED = "NOTBARRED"
    181     EMERGENCY = "EMERGENCY"
    182     BARRED = "BARRED"
    183     USERSPECIFIC = "USERSPECIFIC"
    184 
    185 
    186 class BtsLteEmergencyAccessClassBarred(Enum):
    187     ''' Values for Lte emergency access class barred parameter '''
    188     NOTBARRED = "NOTBARRED"
    189     BARRED = "BARRED"
    190 
    191 
    192 class BtsNwNameEnable(Enum):
    193     ''' Values for BT network name enable parameter '''
    194     NAME_ENABLE = "ON"
    195     NAME_DISABLE = "OFF"
    196 
    197 
    198 class IPAddressType(Enum):
    199     ''' Values for IP address type '''
    200     IPV4 = "IPV4"
    201     IPV6 = "IPV6"
    202     IPV4V6 = "IPV4V6"
    203 
    204 
    205 class TriggerMessageIDs(Enum):
    206     ''' ID for Trigger messages  '''
    207     RRC_CONNECTION_REQ = 111101
    208     RRC_CONN_REESTABLISH_REQ = 111100
    209     ATTACH_REQ = 141141
    210     DETACH_REQ = 141145
    211     MM_LOC_UPDATE_REQ = 221108
    212     GMM_ATTACH_REQ = 241101
    213     GMM_RA_UPDATE_REQ = 241108
    214     IDENTITY_REQUEST_LTE = 141155
    215     IDENTITY_REQUEST_WCDMA = 241115
    216     IDENTITY_REQUEST_GSM = 641115
    217 
    218 
    219 class TriggerMessageReply(Enum):
    220     ''' Values for Trigger message reply parameter '''
    221     ACCEPT = "ACCEPT"
    222     REJECT = "REJECT"
    223     IGNORE = "IGNORE"
    224     NONE = "NONE"
    225     ILLEGAL = "ILLEGAL"
    226 
    227 
    228 class TestProcedure(Enum):
    229     ''' Values for different Test procedures in MD8475A '''
    230     PROCEDURE_BL = "BL"
    231     PROCEDURE_SELECTION = "SELECTION"
    232     PROCEDURE_RESELECTION = "RESELECTION"
    233     PROCEDURE_REDIRECTION = "REDIRECTION"
    234     PROCEDURE_HO = "HO"
    235     PROCEDURE_HHO = "HHO"
    236     PROCEDURE_SHO = "SHO"
    237     PROCEDURE_MEASUREMENT = "MEASUREMENT"
    238     PROCEDURE_CELLCHANGE = "CELLCHANGE"
    239     PROCEDURE_MULTICELL = "MULTICELL"
    240 
    241 
    242 class TestPowerControl(Enum):
    243     ''' Values for power control in test procedure '''
    244     POWER_CONTROL_ENABLE = "ENABLE"
    245     POWER_CONTROL_DISABLE = "DISABLE"
    246 
    247 
    248 class TestMeasurement(Enum):
    249     ''' Values for mesaurement in test procedure '''
    250     MEASUREMENT_ENABLE = "ENABLE"
    251     MEASUREMENT_DISABLE = "DISABLE"
    252 
    253 
    254 '''MD8475A processing states'''
    255 _PROCESS_STATES = {
    256     "NONE": ProcessingStatus.PROCESS_STATUS_NONE,
    257     "NOTRUN": ProcessingStatus.PROCESS_STATUS_NOTRUN,
    258     "POWEROFF": ProcessingStatus.PROCESS_STATUS_POWEROFF,
    259     "REGISTRATION": ProcessingStatus.PROCESS_STATUS_REGISTRATION,
    260     "DETACH": ProcessingStatus.PROCESS_STATUS_DETACH,
    261     "IDLE": ProcessingStatus.PROCESS_STATUS_IDLE,
    262     "ORIGINATION": ProcessingStatus.PROCESS_STATUS_ORIGINATION,
    263     "HANDOVER": ProcessingStatus.PROCESS_STATUS_HANDOVER,
    264     "UPDATING": ProcessingStatus.PROCESS_STATUS_UPDATING,
    265     "TERMINATION": ProcessingStatus.PROCESS_STATUS_TERMINATION,
    266     "COMMUNICATION": ProcessingStatus.PROCESS_STATUS_COMMUNICATION,
    267     "UERELEASE": ProcessingStatus.PROCESS_STATUS_UERELEASE,
    268     "NWRELEASE": ProcessingStatus.PROCESS_STATUS_NWRELEASE,
    269 }
    270 
    271 
    272 class ImsCscfStatus(Enum):
    273     """ MD8475A ims cscf status for UE
    274     """
    275     OFF = "OFF"
    276     SIPIDLE = "SIPIDLE"
    277     CONNECTED = "CONNECTED"
    278     CALLING = "CALLING"
    279     RINGING = "RINGING"
    280     UNKNOWN = "UNKNOWN"
    281 
    282 
    283 class ImsCscfCall(Enum):
    284     """ MD8475A ims cscf call action
    285     """
    286     MAKE = "MAKE"
    287     END = "END"
    288     MAKEVIDEO = "MAKEVIDEO"
    289     MAKE2ND = "MAKE2ND"
    290     END2ND = "END2ND"
    291     ANSWER = "ANSWER"
    292     HOLD = "HOLD"
    293     RESUME = "RESUME"
    294 
    295 
    296 class VirtualPhoneStatus(IntEnum):
    297     ''' MD8475A virtual phone status for UE voice and UE video
    298         PPP, PWS '''
    299     STATUS_IDLE = 0
    300     STATUS_VOICECALL_ORIGINATION = 1
    301     STATUS_VOICECALL_INCOMING = 2
    302     STATUS_VOICECALL_INPROGRESS = 3
    303     STATUS_VOICECALL_DISCONNECTING = 4
    304     STATUS_VOICECALL_DISCONNECTED = 5
    305     STATUS_VIDEOCALL_ORIGINATION = 6
    306     STATUS_VIDEOCALL_INCOMING = 7
    307     STATUS_VIDEOCALL_INPROGRESS = 8
    308     STATUS_VIDEOCALL_DISCONNECTING = 9
    309     STATUS_VIDEOCALL_DISCONNECTED = 10
    310 
    311 
    312 '''Virtual Phone Status '''
    313 _VP_STATUS = {
    314     "0": VirtualPhoneStatus.STATUS_IDLE,
    315     "1": VirtualPhoneStatus.STATUS_VOICECALL_ORIGINATION,
    316     "2": VirtualPhoneStatus.STATUS_VOICECALL_INCOMING,
    317     "3": VirtualPhoneStatus.STATUS_VOICECALL_INPROGRESS,
    318     "4": VirtualPhoneStatus.STATUS_VOICECALL_DISCONNECTING,
    319     "5": VirtualPhoneStatus.STATUS_VOICECALL_DISCONNECTED,
    320     "6": VirtualPhoneStatus.STATUS_VIDEOCALL_ORIGINATION,
    321     "7": VirtualPhoneStatus.STATUS_VIDEOCALL_INCOMING,
    322     "8": VirtualPhoneStatus.STATUS_VIDEOCALL_INPROGRESS,
    323     "9": VirtualPhoneStatus.STATUS_VIDEOCALL_DISCONNECTING,
    324     "10": VirtualPhoneStatus.STATUS_VIDEOCALL_DISCONNECTED,
    325 }
    326 
    327 
    328 class VirtualPhoneAutoAnswer(Enum):
    329     ''' Virtual phone auto answer enable values'''
    330     ON = "ON"
    331     OFF = "OFF"
    332 
    333 
    334 class CsfbType(Enum):
    335     ''' CSFB Type values'''
    336     CSFB_TYPE_REDIRECTION = "REDIRECTION"
    337     CSFB_TYPE_HANDOVER = "HO"
    338 
    339 
    340 class ReturnToEUTRAN(Enum):
    341     '''Return to EUTRAN setting values '''
    342     RETEUTRAN_ENABLE = "ENABLE"
    343     RETEUTRAN_DISABLE = "DISABLE"
    344 
    345 
    346 class CTCHSetup(Enum):
    347     '''CTCH setting values '''
    348     CTCH_ENABLE = "ENABLE"
    349     CTCH_DISABLE = "DISABLE"
    350 
    351 
    352 class UEIdentityType(Enum):
    353     '''UE Identity type values '''
    354     IMSI = "IMSI"
    355     IMEI = "IMEI"
    356     IMEISV = "IMEISV"
    357 
    358 
    359 class CBCHSetup(Enum):
    360     '''CBCH setting values '''
    361     CBCH_ENABLE = "ENABLE"
    362     CBCH_DISABLE = "DISABLE"
    363 
    364 
    365 class Switch(Enum):
    366     ''' Values for ENABLE or DISABLE '''
    367     ENABLE = "ENABLE"
    368     DISABLE = "DISABLE"
    369 
    370 
    371 class MD8475A(object):
    372     """Class to communicate with Anritsu MD8475A Signalling Tester.
    373        This uses GPIB command to interface with Anritsu MD8475A """
    374 
    375     def __init__(self, ip_address, log_handle, wlan=False):
    376         self._error_reporting = True
    377         self._ipaddr = ip_address
    378         self.log = log_handle
    379         self._wlan = wlan
    380 
    381         # Open socket connection to Signaling Tester
    382         self.log.info("Opening Socket Connection with "
    383                       "Signaling Tester ({}) ".format(self._ipaddr))
    384         try:
    385             self._sock = socket.create_connection(
    386                 (self._ipaddr, 28002), timeout=120)
    387             self.send_query("*IDN?", 60)
    388             self.log.info("Communication with Signaling Tester OK.")
    389             self.log.info("Opened Socket connection to ({})"
    390                           "with handle ({})".format(self._ipaddr, self._sock))
    391             # launching Smart Studio Application needed for the simulation
    392             ret = self.launch_smartstudio()
    393         except socket.timeout:
    394             raise AnritsuError("Timeout happened while conencting to"
    395                                " Anritsu MD8475A")
    396         except socket.error:
    397             raise AnritsuError("Socket creation error")
    398 
    399     def get_BTS(self, btsnumber):
    400         """ Returns the BTS object based on the BTS number provided
    401 
    402         Args:
    403             btsnumber: BTS number (BTS1, BTS2)
    404 
    405         Returns:
    406             BTS object
    407         """
    408         return _BaseTransceiverStation(self, btsnumber)
    409 
    410     def get_AnritsuTestCases(self):
    411         """ Returns the Anritsu Test Case Module Object
    412 
    413         Args:
    414             None
    415 
    416         Returns:
    417             Anritsu Test Case Module Object
    418         """
    419         return _AnritsuTestCases(self)
    420 
    421     def get_VirtualPhone(self):
    422         """ Returns the Anritsu Virtual Phone Module Object
    423 
    424         Args:
    425             None
    426 
    427         Returns:
    428             Anritsu Virtual Phone Module Object
    429         """
    430         return _VirtualPhone(self)
    431 
    432     def get_PDN(self, pdn_number):
    433         """ Returns the PDN Module Object
    434 
    435         Args:
    436             None
    437 
    438         Returns:
    439             Anritsu PDN Module Object
    440         """
    441         return _PacketDataNetwork(self, pdn_number)
    442 
    443     def get_TriggerMessage(self):
    444         """ Returns the Anritsu Trigger Message Module Object
    445 
    446         Args:
    447             None
    448 
    449         Returns:
    450             Anritsu Trigger Message Module Object
    451         """
    452         return _TriggerMessage(self)
    453 
    454     def get_IMS(self, vnid):
    455         """ Returns the IMS Module Object with VNID
    456 
    457         Args:
    458             vnid: Virtual Network ID
    459 
    460         Returns:
    461             Anritsu IMS VNID Module Object
    462         """
    463         return _IMS_Services(self, vnid)
    464 
    465     def get_ims_cscf_status(self, virtual_network_id):
    466         """ Get the IMS CSCF Status of virtual network
    467 
    468         Args:
    469             virtual_network_id: virtual network id
    470 
    471         Returns:
    472             IMS CSCF status
    473         """
    474         cmd = "IMSCSCFSTAT? {}".format(virtual_network_id)
    475         return self.send_query(cmd)
    476 
    477     def ims_cscf_call_action(self, virtual_network_id, action):
    478         """ IMS CSCF Call action
    479 
    480         Args:
    481             virtual_network_id: virtual network id
    482             action: action to make
    483 
    484         Returns:
    485             None
    486         """
    487         cmd = "IMSCSCFCALL {},{}".format(virtual_network_id, action)
    488         self.send_command(cmd)
    489 
    490     def send_query(self, query, sock_timeout=10):
    491         """ Sends a Query message to Anritsu and return response
    492 
    493         Args:
    494             query - Query string
    495 
    496         Returns:
    497             query response
    498         """
    499         self.log.info("--> {}".format(query))
    500         querytoSend = (query + TERMINATOR).encode('utf-8')
    501         self._sock.settimeout(sock_timeout)
    502         try:
    503             self._sock.send(querytoSend)
    504             result = self._sock.recv(ANRITSU_SOCKET_BUFFER_SIZE).rstrip(
    505                 TERMINATOR.encode('utf-8'))
    506             response = result.decode('utf-8')
    507             self.log.info('<-- {}'.format(response))
    508             return response
    509         except socket.timeout:
    510             raise AnritsuError("Timeout: Response from Anritsu")
    511         except socket.error:
    512             raise AnritsuError("Socket Error")
    513 
    514     def send_command(self, command, sock_timeout=20):
    515         """ Sends a Command message to Anritsu
    516 
    517         Args:
    518             command - command string
    519 
    520         Returns:
    521             None
    522         """
    523         self.log.info("--> {}".format(command))
    524         if self._error_reporting:
    525             cmdToSend = (command + ";ERROR?" + TERMINATOR).encode('utf-8')
    526             self._sock.settimeout(sock_timeout)
    527             try:
    528                 self._sock.send(cmdToSend)
    529                 err = self._sock.recv(ANRITSU_SOCKET_BUFFER_SIZE).rstrip(
    530                     TERMINATOR.encode('utf-8'))
    531                 error = int(err.decode('utf-8'))
    532                 if error != NO_ERROR:
    533                     raise AnritsuError(error, command)
    534             except socket.timeout:
    535                 raise AnritsuError("Timeout for Command Response from Anritsu")
    536             except socket.error:
    537                 raise AnritsuError("Socket Error for Anritsu command")
    538             except Exception as e:
    539                 raise AnritsuError(e, command)
    540         else:
    541             cmdToSend = (command + TERMINATOR).encode('utf-8')
    542             try:
    543                 self._sock.send(cmdToSend)
    544             except socket.error:
    545                 raise AnritsuError("Socket Error", command)
    546             return
    547 
    548     def launch_smartstudio(self):
    549         """ launch the Smart studio application
    550             This should be done before stating simulation
    551 
    552         Args:
    553             None
    554 
    555         Returns:
    556             None
    557         """
    558         # check the Smart Studio status . If Smart Studio doesn't exist ,
    559         # start it.if it is running, stop it. Smart Studio should be in
    560         # NOTRUN (Simulation Stopped) state to start new simulation
    561         stat = self.send_query("STAT?", 30)
    562         if stat == "NOTEXIST":
    563             self.log.info("Launching Smart Studio Application,"
    564                           "it takes about a minute.")
    565             time_to_wait = SMARTSTUDIO_LAUNCH_WAIT_TIME
    566             sleep_interval = 15
    567             waiting_time = 0
    568 
    569             err = self.send_command("RUN", SMARTSTUDIO_LAUNCH_WAIT_TIME)
    570             stat = self.send_query("STAT?")
    571             while stat != "NOTRUN":
    572                 time.sleep(sleep_interval)
    573                 waiting_time = waiting_time + sleep_interval
    574                 if waiting_time <= time_to_wait:
    575                     stat = self.send_query("STAT?")
    576                 else:
    577                     raise AnritsuError("Timeout: Smart Studio launch")
    578         elif stat == "RUNNING":
    579             # Stop simulation if necessary
    580             self.send_command("STOP", 60)
    581             stat = self.send_query("STAT?")
    582 
    583         # The state of the Smart Studio should be NOTRUN at this point
    584         # after the one of the steps from above
    585         if stat != "NOTRUN":
    586             self.log.info(
    587                 "Can not launch Smart Studio, "
    588                 "please shut down all the Smart Studio SW components")
    589             raise AnritsuError("Could not run SmartStudio")
    590 
    591     def close_smartstudio(self):
    592         """ Closes the Smart studio application
    593 
    594         Args:
    595             None
    596 
    597         Returns:
    598             None
    599         """
    600         self.stop_simulation()
    601         self.send_command("EXIT", 60)
    602 
    603     def get_smartstudio_status(self):
    604         """ Gets the Smart studio status
    605 
    606         Args:
    607             None
    608 
    609         Returns:
    610             Smart studio status
    611         """
    612         return self.send_query("STAT?")
    613 
    614     def start_simulation(self):
    615         """ Starting the simulation of the network model.
    616             simulation model or simulation parameter file
    617             should be set before starting the simulation
    618 
    619         Args:
    620           None
    621 
    622         Returns:
    623             None
    624         """
    625         time_to_wait = SMARTSTUDIO_SIMULATION_START_WAIT_TIME
    626         sleep_interval = 2
    627         waiting_time = 0
    628 
    629         self.send_command("START", SMARTSTUDIO_SIMULATION_START_WAIT_TIME)
    630 
    631         self.log.info("Waiting for CALLSTAT=POWEROFF")
    632         callstat = self.send_query("CALLSTAT? BTS1").split(",")
    633         while callstat[0] != "POWEROFF":
    634             time.sleep(sleep_interval)
    635             waiting_time += sleep_interval
    636             if waiting_time <= time_to_wait:
    637                 callstat = self.send_query("CALLSTAT? BTS1").split(",")
    638             else:
    639                 raise AnritsuError("Timeout: Starting simulation")
    640 
    641     def stop_simulation(self):
    642         """ Stop simulation operation
    643 
    644         Args:
    645           None
    646 
    647         Returns:
    648             None
    649         """
    650         # Stop virtual network (IMS) #1 if still running
    651         # this is needed before Sync command is supported in 6.40a
    652         if self.send_query("IMSVNSTAT? 1") == "RUNNING":
    653             self.send_command("IMSSTOPVN 1")
    654         stat = self.send_query("STAT?")
    655         # Stop simulation if its is RUNNING
    656         if stat == "RUNNING":
    657             self.send_command("STOP", 60)
    658             stat = self.send_query("STAT?")
    659             if stat != "NOTRUN":
    660                 self.log.info("Failed to stop simulation")
    661                 raise AnritsuError("Failed to stop simulation")
    662 
    663     def reset(self):
    664         """ reset simulation parameters
    665 
    666         Args:
    667           None
    668 
    669         Returns:
    670             None
    671         """
    672         self.send_command("*RST", COMMAND_COMPLETE_WAIT_TIME)
    673 
    674     def load_simulation_paramfile(self, filepath):
    675         """ loads simulation model parameter file
    676         Args:
    677           filepath : simulation model parameter file path
    678 
    679         Returns:
    680             None
    681         """
    682         self.stop_simulation()
    683         cmd = "LOADSIMPARAM \"" + filepath + '\";ERROR?'
    684         self.send_query(cmd, LOAD_SIMULATION_PARAM_FILE_WAIT_TIME)
    685 
    686     def load_cell_paramfile(self, filepath):
    687         """ loads cell model parameter file
    688 
    689         Args:
    690           filepath : cell model parameter file path
    691 
    692         Returns:
    693             None
    694         """
    695         self.stop_simulation()
    696         cmd = "LOADCELLPARAM \"" + filepath + '\";ERROR?'
    697         status = int(self.send_query(cmd))
    698         if status != NO_ERROR:
    699             raise AnritsuError(status, cmd)
    700 
    701     def _set_simulation_model(self, sim_model):
    702         """ Set simulation model and valid the configuration
    703 
    704         Args:
    705             sim_model: simulation model
    706 
    707         Returns:
    708             True/False
    709         """
    710         error = int(
    711             self.send_query("SIMMODEL %s;ERROR?" % sim_model,
    712                             COMMAND_COMPLETE_WAIT_TIME))
    713         if error:
    714             return False
    715         # Reset every time after SIMMODEL is set because SIMMODEL will load
    716         # some of the contents from previous parameter files.
    717         self.reset()
    718         return True
    719 
    720     def set_simulation_model(self, bts1, bts2=None, bts3=None, bts4=None):
    721         """ Sets the simulation model
    722 
    723         Args:
    724             bts1 - BTS1 RAT
    725             bts1 - BTS2 RAT
    726             bts3 - Not used now
    727             bts4 - Not used now
    728 
    729         Returns:
    730             True or False
    731         """
    732         self.stop_simulation()
    733         simmodel = bts1.value
    734         if bts2 is not None:
    735             simmodel = simmodel + "," + bts2.value
    736         if self._wlan:
    737             simmodel = simmodel + "," + "WLAN"
    738         return self._set_simulation_model(simmodel)
    739 
    740     def get_simulation_model(self):
    741         """ Gets the simulation model
    742 
    743         Args:
    744             None
    745 
    746         Returns:
    747             Current simulation model
    748         """
    749         cmd = "SIMMODEL?"
    750         return self.send_query(cmd)
    751 
    752     def set_simulation_state_to_poweroff(self):
    753         """ Sets the simulation state to POWER OFF
    754 
    755         Args:
    756           None
    757 
    758         Returns:
    759             None
    760         """
    761         self.send_command("RESETSIMULATION POWEROFF")
    762         time_to_wait = 30
    763         sleep_interval = 2
    764         waiting_time = 0
    765 
    766         self.log.info("Waiting for CALLSTAT=POWEROFF")
    767         callstat = self.send_query("CALLSTAT?").split(",")
    768         while callstat[0] != "POWEROFF":
    769             time.sleep(sleep_interval)
    770             waiting_time = waiting_time + sleep_interval
    771             if waiting_time <= time_to_wait:
    772                 callstat = self.send_query("CALLSTAT?").split(",")
    773             else:
    774                 break
    775 
    776     def set_simulation_state_to_idle(self, btsnumber):
    777         """ Sets the simulation state to IDLE
    778 
    779         Args:
    780           None
    781 
    782         Returns:
    783             None
    784         """
    785         if not isinstance(btsnumber, BtsNumber):
    786             raise ValueError(' The parameter should be of type "BtsNumber" ')
    787         cmd = "RESETSIMULATION IDLE," + btsnumber.value
    788         self.send_command(cmd)
    789         time_to_wait = 30
    790         sleep_interval = 2
    791         waiting_time = 0
    792 
    793         self.log.info("Waiting for CALLSTAT=IDLE")
    794         callstat = self.send_query("CALLSTAT?").split(",")
    795         while callstat[0] != "IDLE":
    796             time.sleep(sleep_interval)
    797             waiting_time = waiting_time + sleep_interval
    798             if waiting_time <= time_to_wait:
    799                 callstat = self.send_query("CALLSTAT?").split(",")
    800             else:
    801                 break
    802 
    803     def wait_for_registration_state(self, bts=1):
    804         """ Waits for UE registration state on Anritsu
    805 
    806         Args:
    807           bts: index of MD8475A BTS, eg 1, 2
    808 
    809         Returns:
    810             None
    811         """
    812         self.log.info("wait for IDLE/COMMUNICATION state on anritsu.")
    813         time_to_wait = REGISTRATION_STATE_WAIT_TIME
    814         sleep_interval = 1
    815         sim_model = (self.get_simulation_model()).split(",")
    816         #wait 1 more round for GSM because of PS attach
    817         registration_check_iterations = 2 if sim_model[bts - 1] == "GSM" else 1
    818         for _ in range(registration_check_iterations):
    819             waiting_time = 0
    820             while waiting_time <= time_to_wait:
    821                 callstat = self.send_query(
    822                     "CALLSTAT? BTS{}".format(bts)).split(",")
    823                 if callstat[0] == "IDLE" or callstat[1] == "COMMUNICATION":
    824                     break
    825                 time.sleep(sleep_interval)
    826                 waiting_time += sleep_interval
    827             else:
    828                 raise AnritsuError(
    829                     "UE failed to register in {} seconds".format(time_to_wait))
    830             time.sleep(sleep_interval)
    831 
    832     def wait_for_communication_state(self):
    833         """ Waits for UE communication state on Anritsu
    834 
    835         Args:
    836           None
    837 
    838         Returns:
    839             None
    840         """
    841         self.log.info("wait for COMMUNICATION state on anritsu")
    842         time_to_wait = COMMUNICATION_STATE_WAIT_TIME
    843         sleep_interval = 1
    844         waiting_time = 0
    845 
    846         self.log.info("Waiting for CALLSTAT=COMMUNICATION")
    847         callstat = self.send_query("CALLSTAT? BTS1").split(",")
    848         while callstat[1] != "COMMUNICATION":
    849             time.sleep(sleep_interval)
    850             waiting_time += sleep_interval
    851             if waiting_time <= time_to_wait:
    852                 callstat = self.send_query("CALLSTAT? BTS1").split(",")
    853             else:
    854                 raise AnritsuError("UE failed to register on network")
    855 
    856     def get_camping_cell(self):
    857         """ Gets the current camping cell information
    858 
    859         Args:
    860           None
    861 
    862         Returns:
    863             returns a tuple (BTS number, RAT Technology) '
    864         """
    865         bts_number, rat_info = self.send_query("CAMPINGCELL?").split(",")
    866         return bts_number, rat_info
    867 
    868     def start_testcase(self):
    869         """ Starts a test case on Anritsu
    870 
    871         Args:
    872           None
    873 
    874         Returns:
    875             None
    876         """
    877         self.send_command("STARTTEST")
    878 
    879     def get_testcase_status(self):
    880         """ Gets the current test case status on Anritsu
    881 
    882         Args:
    883           None
    884 
    885         Returns:
    886             current test case status
    887         """
    888         return self.send_query("TESTSTAT?")
    889 
    890     @property
    891     def gateway_ipv4addr(self):
    892         """ Gets the IPv4 address of the default gateway
    893 
    894         Args:
    895           None
    896 
    897         Returns:
    898             current UE status
    899         """
    900         return self.send_query("DGIPV4?")
    901 
    902     @gateway_ipv4addr.setter
    903     def gateway_ipv4addr(self, ipv4_addr):
    904         """ sets the IPv4 address of the default gateway
    905         Args:
    906             ipv4_addr: IPv4 address of the default gateway
    907 
    908         Returns:
    909             None
    910         """
    911         cmd = "DGIPV4 " + ipv4_addr
    912         self.send_command(cmd)
    913 
    914     @property
    915     def usim_key(self):
    916         """ Gets the USIM Security Key
    917 
    918         Args:
    919           None
    920 
    921         Returns:
    922             USIM Security Key
    923         """
    924         return self.send_query("USIMK?")
    925 
    926     @usim_key.setter
    927     def usim_key(self, usimk):
    928         """ sets the USIM Security Key
    929         Args:
    930             usimk: USIM Security Key, eg "000102030405060708090A0B0C0D0E0F"
    931 
    932         Returns:
    933             None
    934         """
    935         cmd = "USIMK " + usimk
    936         self.send_command(cmd)
    937 
    938     def get_ue_status(self):
    939         """ Gets the current UE status on Anritsu
    940 
    941         Args:
    942           None
    943 
    944         Returns:
    945             current UE status
    946         """
    947         UE_STATUS_INDEX = 0
    948         ue_status = self.send_query("CALLSTAT?").split(",")[UE_STATUS_INDEX]
    949         return _PROCESS_STATES[ue_status]
    950 
    951     def get_packet_status(self):
    952         """ Gets the current Packet status on Anritsu
    953 
    954         Args:
    955           None
    956 
    957         Returns:
    958             current Packet status
    959         """
    960         PACKET_STATUS_INDEX = 1
    961         packet_status = self.send_query("CALLSTAT?").split(",")[
    962             PACKET_STATUS_INDEX]
    963         return _PROCESS_STATES[packet_status]
    964 
    965     def disconnect(self):
    966         """ Disconnect the Anritsu box from test PC
    967 
    968         Args:
    969           None
    970 
    971         Returns:
    972             None
    973         """
    974         # no need to # exit smart studio application
    975         # self.close_smartstudio()
    976         self._sock.close()
    977 
    978     def machine_reboot(self):
    979         """ Reboots the Anritsu Machine
    980 
    981         Args:
    982           None
    983 
    984         Returns:
    985             None
    986         """
    987         self.send_command("REBOOT")
    988 
    989     def save_sequence_log(self, fileName):
    990         """ Saves the Anritsu Sequence logs to file
    991 
    992         Args:
    993           fileName: log file name
    994 
    995         Returns:
    996             None
    997         """
    998         cmd = 'SAVESEQLOG "{}"'.format(fileName)
    999         self.send_command(cmd)
   1000 
   1001     def clear_sequence_log(self):
   1002         """ Clears the Anritsu Sequence logs
   1003 
   1004         Args:
   1005           None
   1006 
   1007         Returns:
   1008             None
   1009         """
   1010         self.send_command("CLEARSEQLOG")
   1011 
   1012     def save_message_log(self, fileName):
   1013         """ Saves the Anritsu Message logs to file
   1014 
   1015         Args:
   1016           fileName: log file name
   1017 
   1018         Returns:
   1019             None
   1020         """
   1021         cmd = 'SAVEMSGLOG "{}"'.format(fileName)
   1022         self.send_command(cmd)
   1023 
   1024     def clear_message_log(self):
   1025         """ Clears the Anritsu Message logs
   1026 
   1027         Args:
   1028           None
   1029 
   1030         Returns:
   1031             None
   1032         """
   1033         self.send_command("CLEARMSGLOG")
   1034 
   1035     def save_trace_log(self, fileName, fileType, overwrite, start, end):
   1036         """ Saves the Anritsu Trace logs
   1037 
   1038         Args:
   1039           fileName: log file name
   1040           fileType: file type (BINARY, TEXT, H245,PACKET, CPLABE)
   1041           overwrite: whether to over write
   1042           start: starting trace number
   1043           end: ending trace number
   1044 
   1045         Returns:
   1046             None
   1047         """
   1048         cmd = 'SAVETRACELOG "{}",{},{},{},{}'.format(fileName, fileType,
   1049                                                      overwrite, start, end)
   1050         self.send_command(cmd)
   1051 
   1052     def send_cmas_lte_wcdma(self, serialNo, messageID, warningMessage):
   1053         """ Sends a CMAS message
   1054 
   1055         Args:
   1056           serialNo: serial number of CMAS message
   1057           messageID: CMAS message ID
   1058           warningMessage:  CMAS Warning message
   1059 
   1060         Returns:
   1061             None
   1062         """
   1063         cmd = ('PWSSENDWM 3GPP,"BtsNo=1&WarningSystem=CMAS&SerialNo={}'
   1064                '&MessageID={}&wm={}"').format(serialNo, messageID,
   1065                                               warningMessage)
   1066         self.send_command(cmd)
   1067 
   1068     def send_etws_lte_wcdma(self, serialNo, messageID, warningType,
   1069                             warningMessage, userAlertenable, popUpEnable):
   1070         """ Sends a ETWS message
   1071 
   1072         Args:
   1073           serialNo: serial number of CMAS message
   1074           messageID: CMAS message ID
   1075           warningMessage:  CMAS Warning message
   1076 
   1077         Returns:
   1078             None
   1079         """
   1080         cmd = (
   1081             'PWSSENDWM 3GPP,"BtsNo=1&WarningSystem=ETWS&SerialNo={}&'
   1082             'Primary=ON&PrimaryMessageID={}&Secondary=ON&SecondaryMessageID={}'
   1083             '&WarningType={}&wm={}&UserAlert={}&Popup={}&dcs=0x10&LanguageCode=en"'
   1084         ).format(serialNo, messageID, messageID, warningType, warningMessage,
   1085                  userAlertenable, popUpEnable)
   1086         self.send_command(cmd)
   1087 
   1088     def send_cmas_etws_cdma1x(self, message_id, service_category, alert_ext,
   1089                               response_type, severity, urgency, certainty):
   1090         """ Sends a CMAS/ETWS message on CDMA 1X
   1091 
   1092         Args:
   1093           serviceCategory: service category of alert
   1094           messageID: message ID
   1095           alertText: Warning message
   1096 
   1097         Returns:
   1098             None
   1099         """
   1100         cmd = (
   1101             'PWSSENDWM 3GPP2,"BtsNo=1&ServiceCategory={}&MessageID={}&AlertText={}&'
   1102             'CharSet=ASCII&ResponseType={}&Severity={}&Urgency={}&Certainty={}"'
   1103         ).format(service_category, message_id, alert_ext, response_type,
   1104                  severity, urgency, certainty)
   1105         self.send_command(cmd)
   1106 
   1107     @property
   1108     def csfb_type(self):
   1109         """ Gets the current CSFB type
   1110 
   1111         Args:
   1112             None
   1113 
   1114         Returns:
   1115             current CSFB type
   1116         """
   1117         return self.send_query("SIMMODELEX? CSFB")
   1118 
   1119     @csfb_type.setter
   1120     def csfb_type(self, csfb_type):
   1121         """ sets the CSFB type
   1122         Args:
   1123             csfb_type: CSFB type
   1124 
   1125         Returns:
   1126             None
   1127         """
   1128         if not isinstance(csfb_type, CsfbType):
   1129             raise ValueError('The parameter should be of type "CsfbType" ')
   1130         cmd = "SIMMODELEX CSFB," + csfb_type.value
   1131         self.send_command(cmd)
   1132 
   1133     @property
   1134     def csfb_return_to_eutran(self):
   1135         """ Gets the current return to EUTRAN status
   1136 
   1137         Args:
   1138             None
   1139 
   1140         Returns:
   1141             current return to EUTRAN status
   1142         """
   1143         return self.send_query("SIMMODELEX? RETEUTRAN")
   1144 
   1145     @csfb_return_to_eutran.setter
   1146     def csfb_return_to_eutran(self, enable):
   1147         """ sets the return to EUTRAN feature
   1148         Args:
   1149             enable: enable/disable return to EUTRAN feature
   1150 
   1151         Returns:
   1152             None
   1153         """
   1154         if not isinstance(enable, ReturnToEUTRAN):
   1155             raise ValueError(
   1156                 'The parameter should be of type "ReturnToEUTRAN"')
   1157         cmd = "SIMMODELEX RETEUTRAN," + enable.value
   1158         self.send_command(cmd)
   1159 
   1160     def set_packet_preservation(self):
   1161         """ Set packet state to Preservation
   1162 
   1163         Args:
   1164             None
   1165 
   1166         Returns:
   1167             None
   1168         """
   1169         cmd = "OPERATEPACKET PRESERVATION"
   1170         self.send_command(cmd)
   1171 
   1172     def set_packet_dormant(self):
   1173         """ Set packet state to Dormant
   1174 
   1175         Args:
   1176             None
   1177 
   1178         Returns:
   1179             None
   1180         """
   1181         cmd = "OPERATEPACKET DORMANT"
   1182         self.send_command(cmd)
   1183 
   1184     def get_ue_identity(self, identity_type):
   1185         """ Get the UE identity IMSI, IMEI, IMEISV
   1186 
   1187         Args:
   1188             identity_type : IMSI/IMEI/IMEISV
   1189 
   1190         Returns:
   1191             IMSI/IMEI/IMEISV value
   1192         """
   1193         bts, rat = self.get_camping_cell()
   1194         if rat == BtsTechnology.LTE.value:
   1195             identity_request = TriggerMessageIDs.IDENTITY_REQUEST_LTE.value
   1196             if identity_type == UEIdentityType.IMSI:
   1197                 userdata = IMSI_READ_USERDATA_LTE
   1198             elif identity_type == UEIdentityType.IMEI:
   1199                 userdata = IMEI_READ_USERDATA_LTE
   1200             elif identity_type == UEIdentityType.IMEISV:
   1201                 userdata = IMEISV_READ_USERDATA_LTE
   1202             else:
   1203                 return None
   1204         elif rat == BtsTechnology.WCDMA.value:
   1205             identity_request = TriggerMessageIDs.IDENTITY_REQUEST_WCDMA.value
   1206             if identity_type == UEIdentityType.IMSI:
   1207                 userdata = IMSI_READ_USERDATA_WCDMA
   1208             elif identity_type == UEIdentityType.IMEI:
   1209                 userdata = IMEI_READ_USERDATA_WCDMA
   1210             elif identity_type == UEIdentityType.IMEISV:
   1211                 userdata = IMEISV_READ_USERDATA_WCDMA
   1212             else:
   1213                 return None
   1214         elif rat == BtsTechnology.GSM.value:
   1215             identity_request = TriggerMessageIDs.IDENTITY_REQUEST_GSM.value
   1216             if identity_type == UEIdentityType.IMSI:
   1217                 userdata = IMSI_READ_USERDATA_GSM
   1218             elif identity_type == UEIdentityType.IMEI:
   1219                 userdata = IMEI_READ_USERDATA_GSM
   1220             elif identity_type == UEIdentityType.IMEISV:
   1221                 userdata = IMEISV_READ_USERDATA_GSM
   1222             else:
   1223                 return None
   1224         else:
   1225             return None
   1226 
   1227         self.send_command("TMMESSAGEMODE {},USERDATA".format(identity_request))
   1228         time.sleep(SETTLING_TIME)
   1229         self.send_command("TMUSERDATA {}, {}, {}".format(
   1230             identity_request, userdata, IDENTITY_REQ_DATA_LEN))
   1231         time.sleep(SETTLING_TIME)
   1232         self.send_command("TMSENDUSERMSG {}".format(identity_request))
   1233         time.sleep(WAIT_TIME_IDENTITY_RESPONSE)
   1234         # Go through sequence log and find the identity response message
   1235         target = '"{}"'.format(identity_type.value)
   1236         seqlog = self.send_query("SEQLOG?").split(",")
   1237         while (target not in seqlog):
   1238             index = int(seqlog[0]) - 1
   1239             if index < SEQ_LOG_MESSAGE_START_INDEX:
   1240                 self.log.error("Can not find " + target)
   1241                 return None
   1242             seqlog = self.send_query("SEQLOG? %d" % index).split(",")
   1243         return (seqlog[-1])
   1244 
   1245     def select_usim(self, usim):
   1246         """ Select pre-defined Anritsu USIM models
   1247 
   1248         Args:
   1249             usim: any of P0035Bx, P0135Ax, P0250Ax, P0260Ax
   1250 
   1251         Returns:
   1252             None
   1253         """
   1254         cmd = "SELECTUSIM {}".format(usim)
   1255         self.send_command(cmd)
   1256 
   1257 
   1258 class _AnritsuTestCases(object):
   1259     '''Class to interact with the MD8475 supported test procedures '''
   1260 
   1261     def __init__(self, anritsu):
   1262         self._anritsu = anritsu
   1263         self.log = anritsu.log
   1264 
   1265     @property
   1266     def procedure(self):
   1267         """ Gets the current Test Procedure type
   1268 
   1269         Args:
   1270             None
   1271 
   1272         Returns:
   1273             One of TestProcedure type values
   1274         """
   1275         return self._anritsu.send_query("TESTPROCEDURE?")
   1276 
   1277     @procedure.setter
   1278     def procedure(self, procedure):
   1279         """ sets the Test Procedure type
   1280         Args:
   1281             procedure: One of TestProcedure type values
   1282 
   1283         Returns:
   1284             None
   1285         """
   1286         if not isinstance(procedure, TestProcedure):
   1287             raise ValueError(
   1288                 'The parameter should be of type "TestProcedure" ')
   1289         cmd = "TESTPROCEDURE " + procedure.value
   1290         self._anritsu.send_command(cmd)
   1291 
   1292     @property
   1293     def bts_direction(self):
   1294         """ Gets the current Test direction
   1295 
   1296          Args:
   1297             None
   1298 
   1299         Returns:
   1300             Current Test direction eg:BTS2,BTS1
   1301         """
   1302         return self._anritsu.send_query("TESTBTSDIRECTION?")
   1303 
   1304     @bts_direction.setter
   1305     def bts_direction(self, direction):
   1306         """ sets the Test direction  eg: BTS1 to BTS2 '''
   1307 
   1308         Args:
   1309             direction: tuple (from-bts,to_bts) of type BtsNumber
   1310 
   1311         Returns:
   1312             None
   1313         """
   1314         if not isinstance(direction, tuple) or len(direction) is not 2:
   1315             raise ValueError("Pass a tuple with two items")
   1316         from_bts, to_bts = direction
   1317         if (isinstance(from_bts, BtsNumber) and isinstance(to_bts, BtsNumber)):
   1318             cmd = "TESTBTSDIRECTION {},{}".format(from_bts.value, to_bts.value)
   1319             self._anritsu.send_command(cmd)
   1320         else:
   1321             raise ValueError(' The parameters should be of type "BtsNumber" ')
   1322 
   1323     @property
   1324     def registration_timeout(self):
   1325         """ Gets the current Test registration timeout
   1326 
   1327         Args:
   1328             None
   1329 
   1330         Returns:
   1331             Current test registration timeout value
   1332         """
   1333         return self._anritsu.send_query("TESTREGISTRATIONTIMEOUT?")
   1334 
   1335     @registration_timeout.setter
   1336     def registration_timeout(self, timeout_value):
   1337         """ sets the Test registration timeout value
   1338         Args:
   1339             timeout_value: test registration timeout value
   1340 
   1341         Returns:
   1342             None
   1343         """
   1344         cmd = "TESTREGISTRATIONTIMEOUT " + str(timeout_value)
   1345         self._anritsu.send_command(cmd)
   1346 
   1347     @property
   1348     def power_control(self):
   1349         """ Gets the power control enabled/disabled status for test case
   1350 
   1351         Args:
   1352             None
   1353 
   1354         Returns:
   1355             current power control enabled/disabled status
   1356         """
   1357         return self._anritsu.send_query("TESTPOWERCONTROL?")
   1358 
   1359     @power_control.setter
   1360     def power_control(self, enable):
   1361         """ Sets the power control enabled/disabled status for test case
   1362 
   1363         Args:
   1364             enable:  enabled/disabled
   1365 
   1366         Returns:
   1367             None
   1368         """
   1369         if not isinstance(enable, TestPowerControl):
   1370             raise ValueError(' The parameter should be of type'
   1371                              ' "TestPowerControl" ')
   1372         cmd = "TESTPOWERCONTROL " + enable.value
   1373         self._anritsu.send_command(cmd)
   1374 
   1375     @property
   1376     def measurement_LTE(self):
   1377         """ Checks measurement status for LTE test case
   1378 
   1379         Args:
   1380             None
   1381 
   1382         Returns:
   1383             Enabled/Disabled
   1384         """
   1385         return self._anritsu.send_query("TESTMEASUREMENT? LTE")
   1386 
   1387     @measurement_LTE.setter
   1388     def measurement_LTE(self, enable):
   1389         """ Sets the measurement enabled/disabled status for LTE test case
   1390 
   1391         Args:
   1392             enable:  enabled/disabled
   1393 
   1394         Returns:
   1395             None
   1396         """
   1397         if not isinstance(enable, TestMeasurement):
   1398             raise ValueError(' The parameter should be of type'
   1399                              ' "TestMeasurement" ')
   1400         cmd = "TESTMEASUREMENT LTE," + enable.value
   1401         self._anritsu.send_command(cmd)
   1402 
   1403     @property
   1404     def measurement_WCDMA(self):
   1405         """ Checks measurement status for WCDMA test case
   1406 
   1407         Args:
   1408             None
   1409 
   1410         Returns:
   1411             Enabled/Disabled
   1412         """
   1413         return self._anritsu.send_query("TESTMEASUREMENT? WCDMA")
   1414 
   1415     @measurement_WCDMA.setter
   1416     def measurement_WCDMA(self, enable):
   1417         """ Sets the measurement enabled/disabled status for WCDMA test case
   1418 
   1419         Args:
   1420             enable:  enabled/disabled
   1421 
   1422         Returns:
   1423             None
   1424         """
   1425         if not isinstance(enable, TestMeasurement):
   1426             raise ValueError(' The parameter should be of type'
   1427                              ' "TestMeasurement" ')
   1428         cmd = "TESTMEASUREMENT WCDMA," + enable.value
   1429         self._anritsu.send_command(cmd)
   1430 
   1431     @property
   1432     def measurement_TDSCDMA(self):
   1433         """ Checks measurement status for TDSCDMA test case
   1434 
   1435         Args:
   1436             None
   1437 
   1438         Returns:
   1439             Enabled/Disabled
   1440         """
   1441         return self._anritsu.send_query("TESTMEASUREMENT? TDSCDMA")
   1442 
   1443     @measurement_TDSCDMA.setter
   1444     def measurement_WCDMA(self, enable):
   1445         """ Sets the measurement enabled/disabled status for TDSCDMA test case
   1446 
   1447         Args:
   1448             enable:  enabled/disabled
   1449 
   1450         Returns:
   1451             None
   1452         """
   1453         if not isinstance(enable, TestMeasurement):
   1454             raise ValueError(' The parameter should be of type'
   1455                              ' "TestMeasurement" ')
   1456         cmd = "TESTMEASUREMENT TDSCDMA," + enable.value
   1457         self._anritsu.send_command(cmd)
   1458 
   1459     def set_pdn_targeteps(self, pdn_order, pdn_number=1):
   1460         """ Sets PDN to connect as a target when performing the
   1461            test case for packet handover
   1462 
   1463         Args:
   1464             pdn_order:  PRIORITY/USER
   1465             pdn_number: Target PDN number
   1466 
   1467         Returns:
   1468             None
   1469         """
   1470         cmd = "TESTPDNTARGETEPS " + pdn_order
   1471         if pdn_order == "USER":
   1472             cmd = cmd + "," + str(pdn_number)
   1473         self._anritsu.send_command(cmd)
   1474 
   1475 
   1476 class _BaseTransceiverStation(object):
   1477     '''Class to interact different BTS supported by MD8475 '''
   1478 
   1479     def __init__(self, anritsu, btsnumber):
   1480         if not isinstance(btsnumber, BtsNumber):
   1481             raise ValueError(' The parameter should be of type "BtsNumber" ')
   1482         self._bts_number = btsnumber.value
   1483         self._anritsu = anritsu
   1484         self.log = anritsu.log
   1485 
   1486     @property
   1487     def output_level(self):
   1488         """ Gets the Downlink power of the cell
   1489 
   1490         Args:
   1491             None
   1492 
   1493         Returns:
   1494             DL Power level
   1495         """
   1496         cmd = "OLVL? " + self._bts_number
   1497         return self._anritsu.send_query(cmd)
   1498 
   1499     @output_level.setter
   1500     def output_level(self, level):
   1501         """ Sets the Downlink power of the cell
   1502 
   1503         Args:
   1504             level: Power level
   1505 
   1506         Returns:
   1507             None
   1508         """
   1509         cmd = "OLVL {},{}".format(level, self._bts_number)
   1510         self._anritsu.send_command(cmd)
   1511 
   1512     @property
   1513     def input_level(self):
   1514         """ Gets the reference power of the cell
   1515 
   1516         Args:
   1517             None
   1518 
   1519         Returns:
   1520             Reference Power level
   1521         """
   1522         cmd = "RFLVL? " + self._bts_number
   1523         return self._anritsu.send_query(cmd)
   1524 
   1525     @input_level.setter
   1526     def input_level(self, level):
   1527         """ Sets the reference power of the cell
   1528 
   1529         Args:
   1530             level: Power level
   1531 
   1532         Returns:
   1533             None
   1534         """
   1535         cmd = "RFLVL {},{}".format(level, self._bts_number)
   1536         self._anritsu.send_command(cmd)
   1537 
   1538     @property
   1539     def band(self):
   1540         """ Gets the Band of the cell
   1541 
   1542         Args:
   1543             None
   1544 
   1545         Returns:
   1546             Cell band
   1547         """
   1548         cmd = "BAND? " + self._bts_number
   1549         return self._anritsu.send_query(cmd)
   1550 
   1551     @band.setter
   1552     def band(self, band):
   1553         """ Sets the Band of the cell
   1554 
   1555         Args:
   1556             band: Band of the cell
   1557 
   1558         Returns:
   1559             None
   1560         """
   1561         cmd = "BAND {},{}".format(band, self._bts_number)
   1562         self._anritsu.send_command(cmd)
   1563 
   1564     @property
   1565     def transmode(self):
   1566         """ Gets the Transmission Mode of the cell
   1567 
   1568         Args:
   1569             None
   1570 
   1571         Returns:
   1572             Transmission mode
   1573         """
   1574         cmd = "TRANSMODE? " + self._bts_number
   1575         return self._anritsu.send_query(cmd)
   1576 
   1577     @transmode.setter
   1578     def transmode(self, tm_mode):
   1579         """ Sets the TM of the cell
   1580 
   1581         Args:
   1582             TM: TM of the cell
   1583 
   1584         Returns:
   1585             None
   1586         """
   1587         cmd = "TRANSMODE {},{}".format(tm_mode, self._bts_number)
   1588         self._anritsu.send_command(cmd)
   1589 
   1590     @property
   1591     def dl_antenna(self):
   1592         """ Gets the DL ANTENNA count of the cell
   1593 
   1594         Args:
   1595             None
   1596 
   1597         Returns:
   1598             No of DL Antenna
   1599         """
   1600         cmd = "ANTENNAS? " + self._bts_number
   1601         return self._anritsu.send_query(cmd)
   1602 
   1603     @dl_antenna.setter
   1604     def dl_antenna(self, num_antenna):
   1605         """ Sets the DL ANTENNA of the cell
   1606 
   1607         Args:
   1608             c: DL ANTENNA of the cell
   1609 
   1610         Returns:
   1611             None
   1612         """
   1613         cmd = "ANTENNAS {},{}".format(num_antenna, self._bts_number)
   1614         self._anritsu.send_command(cmd)
   1615 
   1616     @property
   1617     def bandwidth(self):
   1618         """ Gets the channel bandwidth of the cell
   1619 
   1620         Args:
   1621             None
   1622 
   1623         Returns:
   1624             channel bandwidth
   1625         """
   1626         cmd = "BANDWIDTH? " + self._bts_number
   1627         return self._anritsu.send_query(cmd)
   1628 
   1629     @bandwidth.setter
   1630     def bandwidth(self, bandwidth):
   1631         """ Sets the channel bandwidth of the cell
   1632 
   1633         Args:
   1634             bandwidth: channel bandwidth  of the cell
   1635 
   1636         Returns:
   1637             None
   1638         """
   1639         if not isinstance(bandwidth, BtsBandwidth):
   1640             raise ValueError(' The parameter should be of type "BtsBandwidth"')
   1641         cmd = "BANDWIDTH {},{}".format(bandwidth.value, self._bts_number)
   1642         self._anritsu.send_command(cmd)
   1643 
   1644     @property
   1645     def dl_bandwidth(self):
   1646         """ Gets the downlink bandwidth of the cell
   1647 
   1648         Args:
   1649             None
   1650 
   1651         Returns:
   1652             downlink bandwidth
   1653         """
   1654         cmd = "DLBANDWIDTH? " + self._bts_number
   1655         return self._anritsu.send_query(cmd)
   1656 
   1657     @dl_bandwidth.setter
   1658     def dl_bandwidth(self, bandwidth):
   1659         """ Sets the downlink bandwidth of the cell
   1660 
   1661         Args:
   1662             bandwidth: downlink bandwidth of the cell
   1663 
   1664         Returns:
   1665             None
   1666         """
   1667         if not isinstance(bandwidth, BtsBandwidth):
   1668             raise ValueError(' The parameter should be of type "BtsBandwidth"')
   1669         cmd = "DLBANDWIDTH {},{}".format(bandwidth.value, self._bts_number)
   1670         self._anritsu.send_command(cmd)
   1671 
   1672     @property
   1673     def ul_bandwidth(self):
   1674         """ Gets the uplink bandwidth of the cell
   1675 
   1676         Args:
   1677             None
   1678 
   1679         Returns:
   1680             uplink bandwidth
   1681         """
   1682         cmd = "ULBANDWIDTH? " + self._bts_number
   1683         return self._anritsu.send_query(cmd)
   1684 
   1685     @ul_bandwidth.setter
   1686     def ul_bandwidth(self, bandwidth):
   1687         """ Sets the uplink bandwidth of the cell
   1688 
   1689         Args:
   1690             bandwidth: uplink bandwidth of the cell
   1691 
   1692         Returns:
   1693             None
   1694         """
   1695         if not isinstance(bandwidth, BtsBandwidth):
   1696             raise ValueError(
   1697                 ' The parameter should be of type "BtsBandwidth" ')
   1698         cmd = "ULBANDWIDTH {},{}".format(bandwidth.value, self._bts_number)
   1699         self._anritsu.send_command(cmd)
   1700 
   1701     @property
   1702     def packet_rate(self):
   1703         """ Gets the packet rate of the cell
   1704 
   1705         Args:
   1706             None
   1707 
   1708         Returns:
   1709             packet rate
   1710         """
   1711         cmd = "PACKETRATE? " + self._bts_number
   1712         return self._anritsu.send_query(cmd)
   1713 
   1714     @packet_rate.setter
   1715     def packet_rate(self, packetrate):
   1716         """ Sets the packet rate of the cell
   1717 
   1718         Args:
   1719             packetrate: packet rate of the cell
   1720 
   1721         Returns:
   1722             None
   1723         """
   1724         if not isinstance(packetrate, BtsPacketRate):
   1725             raise ValueError(' The parameter should be of type'
   1726                              ' "BtsPacketRate" ')
   1727         cmd = "PACKETRATE {},{}".format(packetrate.value, self._bts_number)
   1728         self._anritsu.send_command(cmd)
   1729 
   1730     @property
   1731     def ul_windowsize(self):
   1732         """ Gets the uplink window size of the cell
   1733 
   1734         Args:
   1735             None
   1736 
   1737         Returns:
   1738             uplink window size
   1739         """
   1740         cmd = "ULWINSIZE? " + self._bts_number
   1741         return self._anritsu.send_query(cmd)
   1742 
   1743     @ul_windowsize.setter
   1744     def ul_windowsize(self, windowsize):
   1745         """ Sets the uplink window size of the cell
   1746 
   1747         Args:
   1748             windowsize: uplink window size of the cell
   1749 
   1750         Returns:
   1751             None
   1752         """
   1753         if not isinstance(windowsize, BtsPacketWindowSize):
   1754             raise ValueError(' The parameter should be of type'
   1755                              ' "BtsPacketWindowSize" ')
   1756         cmd = "ULWINSIZE {},{}".format(windowsize.value, self._bts_number)
   1757         self._anritsu.send_command(cmd)
   1758 
   1759     @property
   1760     def dl_windowsize(self):
   1761         """ Gets the downlink window size of the cell
   1762 
   1763         Args:
   1764             None
   1765 
   1766         Returns:
   1767             downlink window size
   1768         """
   1769         cmd = "DLWINSIZE? " + self._bts_number
   1770         return self._anritsu.send_query(cmd)
   1771 
   1772     @dl_windowsize.setter
   1773     def dl_windowsize(self, windowsize):
   1774         """ Sets the downlink window size of the cell
   1775 
   1776         Args:
   1777             windowsize: downlink window size of the cell
   1778 
   1779         Returns:
   1780             None
   1781         """
   1782         if not isinstance(windowsize, BtsPacketWindowSize):
   1783             raise ValueError(' The parameter should be of type'
   1784                              ' "BtsPacketWindowSize" ')
   1785         cmd = "DLWINSIZE {},{}".format(windowsize.value, self._bts_number)
   1786         self._anritsu.send_command(cmd)
   1787 
   1788     @property
   1789     def service_state(self):
   1790         """ Gets the service state of BTS
   1791 
   1792         Args:
   1793             None
   1794 
   1795         Returns:
   1796             service state IN/OUT
   1797         """
   1798         cmd = "OUTOFSERVICE? " + self._bts_number
   1799         return self._anritsu.send_query(cmd)
   1800 
   1801     @service_state.setter
   1802     def service_state(self, service_state):
   1803         """ Sets the service state of BTS
   1804 
   1805         Args:
   1806             service_state: service state of BTS , IN/OUT
   1807 
   1808         Returns:
   1809             None
   1810         """
   1811         if not isinstance(service_state, BtsServiceState):
   1812             raise ValueError(' The parameter should be of type'
   1813                              ' "BtsServiceState" ')
   1814         cmd = "OUTOFSERVICE {},{}".format(service_state.value,
   1815                                           self._bts_number)
   1816         self._anritsu.send_command(cmd)
   1817 
   1818     @property
   1819     def cell_barred(self):
   1820         """ Gets the Cell Barred state of the cell
   1821 
   1822         Args:
   1823             None
   1824 
   1825         Returns:
   1826             one of BtsCellBarred value
   1827         """
   1828         cmd = "CELLBARRED?" + self._bts_number
   1829         return self._anritsu.send_query(cmd)
   1830 
   1831     @cell_barred.setter
   1832     def cell_barred(self, barred_option):
   1833         """ Sets the Cell Barred state of the cell
   1834 
   1835         Args:
   1836             barred_option: Cell Barred state of the cell
   1837 
   1838         Returns:
   1839             None
   1840         """
   1841         if not isinstance(barred_option, BtsCellBarred):
   1842             raise ValueError(' The parameter should be of type'
   1843                              ' "BtsCellBarred" ')
   1844         cmd = "CELLBARRED {},{}".format(barred_option.value, self._bts_number)
   1845         self._anritsu.send_command(cmd)
   1846 
   1847     @property
   1848     def accessclass_barred(self):
   1849         """ Gets the Access Class Barred state of the cell
   1850 
   1851         Args:
   1852             None
   1853 
   1854         Returns:
   1855             one of BtsAccessClassBarred value
   1856         """
   1857         cmd = "ACBARRED? " + self._bts_number
   1858         return self._anritsu.send_query(cmd)
   1859 
   1860     @accessclass_barred.setter
   1861     def accessclass_barred(self, barred_option):
   1862         """ Sets the Access Class Barred state of the cell
   1863 
   1864         Args:
   1865             barred_option: Access Class Barred state of the cell
   1866 
   1867         Returns:
   1868             None
   1869         """
   1870         if not isinstance(barred_option, BtsAccessClassBarred):
   1871             raise ValueError(' The parameter should be of type'
   1872                              ' "BtsAccessClassBarred" ')
   1873         cmd = "ACBARRED {},{}".format(barred_option.value, self._bts_number)
   1874         self._anritsu.send_command(cmd)
   1875 
   1876     @property
   1877     def lteemergency_ac_barred(self):
   1878         """ Gets the LTE emergency Access Class Barred state of the cell
   1879 
   1880         Args:
   1881             None
   1882 
   1883         Returns:
   1884             one of BtsLteEmergencyAccessClassBarred value
   1885         """
   1886         cmd = "LTEEMERGENCYACBARRED? " + self._bts_number
   1887         return self._anritsu.send_query(cmd)
   1888 
   1889     @lteemergency_ac_barred.setter
   1890     def lteemergency_ac_barred(self, barred_option):
   1891         """ Sets the LTE emergency Access Class Barred state of the cell
   1892 
   1893         Args:
   1894             barred_option: Access Class Barred state of the cell
   1895 
   1896         Returns:
   1897             None
   1898         """
   1899         if not isinstance(barred_option, BtsLteEmergencyAccessClassBarred):
   1900             raise ValueError(' The parameter should be of type'
   1901                              ' "BtsLteEmergencyAccessClassBarred" ')
   1902         cmd = "LTEEMERGENCYACBARRED {},{}".format(barred_option.value,
   1903                                                   self._bts_number)
   1904         self._anritsu.send_command(cmd)
   1905 
   1906     @property
   1907     def mcc(self):
   1908         """ Gets the MCC of the cell
   1909 
   1910         Args:
   1911             None
   1912 
   1913         Returns:
   1914             MCC of the cell
   1915         """
   1916         cmd = "MCC? " + self._bts_number
   1917         return self._anritsu.send_query(cmd)
   1918 
   1919     @mcc.setter
   1920     def mcc(self, mcc_code):
   1921         """ Sets the MCC of the cell
   1922 
   1923         Args:
   1924             mcc_code: MCC of the cell
   1925 
   1926         Returns:
   1927             None
   1928         """
   1929         cmd = "MCC {},{}".format(mcc_code, self._bts_number)
   1930         self._anritsu.send_command(cmd)
   1931 
   1932     @property
   1933     def mnc(self):
   1934         """ Gets the MNC of the cell
   1935 
   1936         Args:
   1937             None
   1938 
   1939         Returns:
   1940             MNC of the cell
   1941         """
   1942         cmd = "MNC? " + self._bts_number
   1943         return self._anritsu.send_query(cmd)
   1944 
   1945     @mnc.setter
   1946     def mnc(self, mnc_code):
   1947         """ Sets the MNC of the cell
   1948 
   1949         Args:
   1950             mnc_code: MNC of the cell
   1951 
   1952         Returns:
   1953             None
   1954         """
   1955         cmd = "MNC {},{}".format(mnc_code, self._bts_number)
   1956         self._anritsu.send_command(cmd)
   1957 
   1958     @property
   1959     def nw_fullname_enable(self):
   1960         """ Gets the network full name enable status
   1961 
   1962         Args:
   1963             None
   1964 
   1965         Returns:
   1966             one of BtsNwNameEnable value
   1967         """
   1968         cmd = "NWFNAMEON? " + self._bts_number
   1969         return self._anritsu.send_query(cmd)
   1970 
   1971     @nw_fullname_enable.setter
   1972     def nw_fullname_enable(self, enable):
   1973         """ Sets the network full name enable status
   1974 
   1975         Args:
   1976             enable: network full name enable status
   1977 
   1978         Returns:
   1979             None
   1980         """
   1981         if not isinstance(enable, BtsNwNameEnable):
   1982             raise ValueError(' The parameter should be of type'
   1983                              ' "BtsNwNameEnable" ')
   1984         cmd = "NWFNAMEON {},{}".format(enable.value, self._bts_number)
   1985         self._anritsu.send_command(cmd)
   1986 
   1987     @property
   1988     def nw_fullname(self):
   1989         """ Gets the network full name
   1990 
   1991         Args:
   1992             None
   1993 
   1994         Returns:
   1995             Network fulll name
   1996         """
   1997         cmd = "NWFNAME? " + self._bts_number
   1998         return self._anritsu.send_query(cmd)
   1999 
   2000     @nw_fullname.setter
   2001     def nw_fullname(self, fullname):
   2002         """ Sets the network full name
   2003 
   2004         Args:
   2005             fullname: network full name
   2006 
   2007         Returns:
   2008             None
   2009         """
   2010         cmd = "NWFNAME {},{}".format(fullname, self._bts_number)
   2011         self._anritsu.send_command(cmd)
   2012 
   2013     @property
   2014     def nw_shortname_enable(self):
   2015         """ Gets the network short name enable status
   2016 
   2017         Args:
   2018             None
   2019 
   2020         Returns:
   2021             one of BtsNwNameEnable value
   2022         """
   2023         cmd = "NWSNAMEON? " + self._bts_number
   2024         return self._anritsu.send_query(cmd)
   2025 
   2026     @nw_shortname_enable.setter
   2027     def nw_shortname_enable(self, enable):
   2028         """ Sets the network short name enable status
   2029 
   2030         Args:
   2031             enable: network short name enable status
   2032 
   2033         Returns:
   2034             None
   2035         """
   2036         if not isinstance(enable, BtsNwNameEnable):
   2037             raise ValueError(' The parameter should be of type'
   2038                              ' "BtsNwNameEnable" ')
   2039         cmd = "NWSNAMEON {},{}".format(enable.value, self._bts_number)
   2040         self._anritsu.send_command(cmd)
   2041 
   2042     @property
   2043     def nw_shortname(self):
   2044         """ Gets the network short name
   2045 
   2046         Args:
   2047             None
   2048 
   2049         Returns:
   2050             Network short name
   2051         """
   2052         cmd = "NWSNAME? " + self._bts_number
   2053         return self._anritsu.send_query(cmd)
   2054 
   2055     @nw_shortname.setter
   2056     def nw_shortname(self, shortname):
   2057         """ Sets the network short name
   2058 
   2059         Args:
   2060             shortname: network short name
   2061 
   2062         Returns:
   2063             None
   2064         """
   2065         cmd = "NWSNAME {},{}".format(shortname, self._bts_number)
   2066         self._anritsu.send_command(cmd)
   2067 
   2068     def apply_parameter_changes(self):
   2069         """ apply the parameter changes at run time
   2070 
   2071         Args:
   2072             None
   2073 
   2074         Returns:
   2075             None
   2076         """
   2077         cmd = "APPLYPARAM"
   2078         self._anritsu.send_command(cmd)
   2079 
   2080     @property
   2081     def wcdma_ctch(self):
   2082         """ Gets the WCDMA CTCH enable/disable status
   2083 
   2084         Args:
   2085             None
   2086 
   2087         Returns:
   2088             one of CTCHSetup values
   2089         """
   2090         cmd = "CTCHPARAMSETUP? " + self._bts_number
   2091         return self._anritsu.send_query(cmd)
   2092 
   2093     @wcdma_ctch.setter
   2094     def wcdma_ctch(self, enable):
   2095         """ Sets the WCDMA CTCH enable/disable status
   2096 
   2097         Args:
   2098             enable: WCDMA CTCH enable/disable status
   2099 
   2100         Returns:
   2101             None
   2102         """
   2103         cmd = "CTCHPARAMSETUP {},{}".format(enable.value, self._bts_number)
   2104         self._anritsu.send_command(cmd)
   2105 
   2106     @property
   2107     def lac(self):
   2108         """ Gets the Location Area Code of the cell
   2109 
   2110         Args:
   2111             None
   2112 
   2113         Returns:
   2114             LAC value
   2115         """
   2116         cmd = "LAC? " + self._bts_number
   2117         return self._anritsu.send_query(cmd)
   2118 
   2119     @lac.setter
   2120     def lac(self, lac):
   2121         """ Sets the Location Area Code of the cell
   2122 
   2123         Args:
   2124             lac: Location Area Code of the cell
   2125 
   2126         Returns:
   2127             None
   2128         """
   2129         cmd = "LAC {},{}".format(lac, self._bts_number)
   2130         self._anritsu.send_command(cmd)
   2131 
   2132     @property
   2133     def rac(self):
   2134         """ Gets the Routing Area Code of the cell
   2135 
   2136         Args:
   2137             None
   2138 
   2139         Returns:
   2140             RAC value
   2141         """
   2142         cmd = "RAC? " + self._bts_number
   2143         return self._anritsu.send_query(cmd)
   2144 
   2145     @rac.setter
   2146     def rac(self, rac):
   2147         """ Sets the Routing Area Code of the cell
   2148 
   2149         Args:
   2150             rac: Routing Area Code of the cell
   2151 
   2152         Returns:
   2153             None
   2154         """
   2155         cmd = "RAC {},{}".format(rac, self._bts_number)
   2156         self._anritsu.send_command(cmd)
   2157 
   2158     @property
   2159     def dl_channel(self):
   2160         """ Gets the downlink channel number of the cell
   2161 
   2162         Args:
   2163             None
   2164 
   2165         Returns:
   2166             RAC value
   2167         """
   2168         cmd = "DLCHAN? " + self._bts_number
   2169         return self._anritsu.send_query(cmd)
   2170 
   2171     @dl_channel.setter
   2172     def dl_channel(self, channel):
   2173         """ Sets the downlink channel number of the cell
   2174 
   2175         Args:
   2176             channel: downlink channel number of the cell
   2177 
   2178         Returns:
   2179             None
   2180         """
   2181         cmd = "DLCHAN {},{}".format(channel, self._bts_number)
   2182         self._anritsu.send_command(cmd)
   2183 
   2184     @property
   2185     def sector1_mcc(self):
   2186         """ Gets the sector 1 MCC of the CDMA cell
   2187 
   2188         Args:
   2189             None
   2190 
   2191         Returns:
   2192             sector 1 mcc
   2193         """
   2194         cmd = "S1MCC? " + self._bts_number
   2195         return self._anritsu.send_query(cmd)
   2196 
   2197     @sector1_mcc.setter
   2198     def sector1_mcc(self, mcc):
   2199         """ Sets the sector 1 MCC of the CDMA cell
   2200 
   2201         Args:
   2202             mcc: sector 1 MCC of the CDMA cell
   2203 
   2204         Returns:
   2205             None
   2206         """
   2207         cmd = "S1MCC {},{}".format(mcc, self._bts_number)
   2208         self._anritsu.send_command(cmd)
   2209 
   2210     @property
   2211     def sector1_sid(self):
   2212         """ Gets the sector 1 system ID of the CDMA cell
   2213 
   2214         Args:
   2215             None
   2216 
   2217         Returns:
   2218             sector 1 system Id
   2219         """
   2220         cmd = "S1SID? " + self._bts_number
   2221         return self._anritsu.send_query(cmd)
   2222 
   2223     @sector1_sid.setter
   2224     def sector1_sid(self, sid):
   2225         """ Sets the sector 1 system ID of the CDMA cell
   2226 
   2227         Args:
   2228             sid: sector 1 system ID of the CDMA cell
   2229 
   2230         Returns:
   2231             None
   2232         """
   2233         cmd = "S1SID {},{}".format(sid, self._bts_number)
   2234         self._anritsu.send_command(cmd)
   2235 
   2236     @property
   2237     def sector1_nid(self):
   2238         """ Gets the sector 1 network ID of the CDMA cell
   2239 
   2240         Args:
   2241             None
   2242 
   2243         Returns:
   2244             sector 1 network Id
   2245         """
   2246         cmd = "S1NID? " + self._bts_number
   2247         return self._anritsu.send_query(cmd)
   2248 
   2249     @sector1_nid.setter
   2250     def sector1_nid(self, nid):
   2251         """ Sets the sector 1 network ID of the CDMA cell
   2252 
   2253         Args:
   2254             nid: sector 1 network ID of the CDMA cell
   2255 
   2256         Returns:
   2257             None
   2258         """
   2259         cmd = "S1NID {},{}".format(nid, self._bts_number)
   2260         self._anritsu.send_command(cmd)
   2261 
   2262     @property
   2263     def sector1_baseid(self):
   2264         """ Gets the sector 1 Base ID of the CDMA cell
   2265 
   2266         Args:
   2267             None
   2268 
   2269         Returns:
   2270             sector 1 Base Id
   2271         """
   2272         cmd = "S1BASEID? " + self._bts_number
   2273         return self._anritsu.send_query(cmd)
   2274 
   2275     @sector1_baseid.setter
   2276     def sector1_baseid(self, baseid):
   2277         """ Sets the sector 1 Base ID of the CDMA cell
   2278 
   2279         Args:
   2280             baseid: sector 1 Base ID of the CDMA cell
   2281 
   2282         Returns:
   2283             None
   2284         """
   2285         cmd = "S1BASEID {},{}".format(baseid, self._bts_number)
   2286         self._anritsu.send_command(cmd)
   2287 
   2288     @property
   2289     def sector1_latitude(self):
   2290         """ Gets the sector 1 latitude of the CDMA cell
   2291 
   2292         Args:
   2293             None
   2294 
   2295         Returns:
   2296             sector 1 latitude
   2297         """
   2298         cmd = "S1LATITUDE? " + self._bts_number
   2299         return self._anritsu.send_query(cmd)
   2300 
   2301     @sector1_latitude.setter
   2302     def sector1_latitude(self, latitude):
   2303         """ Sets the sector 1 latitude of the CDMA cell
   2304 
   2305         Args:
   2306             latitude: sector 1 latitude of the CDMA cell
   2307 
   2308         Returns:
   2309             None
   2310         """
   2311         cmd = "S1LATITUDE {},{}".format(latitude, self._bts_number)
   2312         self._anritsu.send_command(cmd)
   2313 
   2314     @property
   2315     def sector1_longitude(self):
   2316         """ Gets the sector 1 longitude of the CDMA cell
   2317 
   2318         Args:
   2319             None
   2320 
   2321         Returns:
   2322             sector 1 longitude
   2323         """
   2324         cmd = "S1LONGITUDE? " + self._bts_number
   2325         return self._anritsu.send_query(cmd)
   2326 
   2327     @sector1_longitude.setter
   2328     def sector1_longitude(self, longitude):
   2329         """ Sets the sector 1 longitude of the CDMA cell
   2330 
   2331         Args:
   2332             longitude: sector 1 longitude of the CDMA cell
   2333 
   2334         Returns:
   2335             None
   2336         """
   2337         cmd = "S1LONGITUDE {},{}".format(longitude, self._bts_number)
   2338         self._anritsu.send_command(cmd)
   2339 
   2340     @property
   2341     def evdo_sid(self):
   2342         """ Gets the Sector ID of the EVDO cell
   2343 
   2344         Args:
   2345             None
   2346 
   2347         Returns:
   2348             Sector Id
   2349         """
   2350         cmd = "S1SECTORID? " + self._bts_number
   2351         return self._anritsu.send_query(cmd)
   2352 
   2353     @evdo_sid.setter
   2354     def evdo_sid(self, sid):
   2355         """ Sets the Sector ID of the EVDO cell
   2356 
   2357         Args:
   2358             sid: Sector ID of the EVDO cell
   2359 
   2360         Returns:
   2361             None
   2362         """
   2363         cmd = "S1SECTORID {},{}".format(sid, self._bts_number)
   2364         self._anritsu.send_command(cmd)
   2365 
   2366     @property
   2367     def cell_id(self):
   2368         """ Gets the cell identity of the cell
   2369 
   2370         Args:
   2371             None
   2372 
   2373         Returns:
   2374             cell identity
   2375         """
   2376         cmd = "CELLID? " + self._bts_number
   2377         return self._anritsu.send_query(cmd)
   2378 
   2379     @cell_id.setter
   2380     def cell_id(self, cell_id):
   2381         """ Sets the cell identity of the cell
   2382 
   2383         Args:
   2384             cell_id: cell identity of the cell
   2385 
   2386         Returns:
   2387             None
   2388         """
   2389         cmd = "CELLID {},{}".format(cell_id, self._bts_number)
   2390         self._anritsu.send_command(cmd)
   2391 
   2392     @property
   2393     def physical_cellid(self):
   2394         """ Gets the physical cell id of the cell
   2395 
   2396         Args:
   2397             None
   2398 
   2399         Returns:
   2400             physical cell id
   2401         """
   2402         cmd = "PHYCELLID? " + self._bts_number
   2403         return self._anritsu.send_query(cmd)
   2404 
   2405     @physical_cellid.setter
   2406     def physical_cellid(self, physical_cellid):
   2407         """ Sets the physical cell id of the cell
   2408 
   2409         Args:
   2410             physical_cellid: physical cell id of the cell
   2411 
   2412         Returns:
   2413             None
   2414         """
   2415         cmd = "PHYCELLID {},{}".format(physical_cellid, self._bts_number)
   2416         self._anritsu.send_command(cmd)
   2417 
   2418     @property
   2419     def gsm_mcs_dl(self):
   2420         """ Gets the Modulation and Coding scheme (DL) of the GSM cell
   2421 
   2422         Args:
   2423             None
   2424 
   2425         Returns:
   2426             DL MCS
   2427         """
   2428         cmd = "DLMCS? " + self._bts_number
   2429         return self._anritsu.send_query(cmd)
   2430 
   2431     @gsm_mcs_dl.setter
   2432     def gsm_mcs_dl(self, mcs_dl):
   2433         """ Sets the Modulation and Coding scheme (DL) of the GSM cell
   2434 
   2435         Args:
   2436             mcs_dl: Modulation and Coding scheme (DL) of the GSM cell
   2437 
   2438         Returns:
   2439             None
   2440         """
   2441         cmd = "DLMCS {},{}".format(mcs_dl, self._bts_number)
   2442         self._anritsu.send_command(cmd)
   2443 
   2444     @property
   2445     def gsm_mcs_ul(self):
   2446         """ Gets the Modulation and Coding scheme (UL) of the GSM cell
   2447 
   2448         Args:
   2449             None
   2450 
   2451         Returns:
   2452             UL MCS
   2453         """
   2454         cmd = "ULMCS? " + self._bts_number
   2455         return self._anritsu.send_query(cmd)
   2456 
   2457     @gsm_mcs_ul.setter
   2458     def gsm_mcs_ul(self, mcs_ul):
   2459         """ Sets the Modulation and Coding scheme (UL) of the GSM cell
   2460 
   2461         Args:
   2462             mcs_ul:Modulation and Coding scheme (UL) of the GSM cell
   2463 
   2464         Returns:
   2465             None
   2466         """
   2467         cmd = "ULMCS {},{}".format(mcs_ul, self._bts_number)
   2468         self._anritsu.send_command(cmd)
   2469 
   2470     @property
   2471     def lte_mcs_dl(self):
   2472         """ Gets the Modulation and Coding scheme (DL) of the LTE cell
   2473 
   2474         Args:
   2475             None
   2476 
   2477         Returns:
   2478             DL MCS
   2479         """
   2480         cmd = "DLIMCS? " + self._bts_number
   2481         return self._anritsu.send_query(cmd)
   2482 
   2483     @lte_mcs_dl.setter
   2484     def lte_mcs_dl(self, mcs_dl):
   2485         """ Sets the Modulation and Coding scheme (DL) of the LTE cell
   2486 
   2487         Args:
   2488             mcs_dl: Modulation and Coding scheme (DL) of the LTE cell
   2489 
   2490         Returns:
   2491             None
   2492         """
   2493         cmd = "DLIMCS {},{}".format(mcs_dl, self._bts_number)
   2494         self._anritsu.send_command(cmd)
   2495 
   2496     @property
   2497     def lte_mcs_ul(self):
   2498         """ Gets the Modulation and Coding scheme (UL) of the LTE cell
   2499 
   2500         Args:
   2501             None
   2502 
   2503         Returns:
   2504             UL MCS
   2505         """
   2506         cmd = "ULIMCS? " + self._bts_number
   2507         return self._anritsu.send_query(cmd)
   2508 
   2509     @lte_mcs_ul.setter
   2510     def lte_mcs_ul(self, mcs_ul):
   2511         """ Sets the Modulation and Coding scheme (UL) of the LTE cell
   2512 
   2513         Args:
   2514             mcs_ul: Modulation and Coding scheme (UL) of the LTE cell
   2515 
   2516         Returns:
   2517             None
   2518         """
   2519         cmd = "ULIMCS {},{}".format(mcs_ul, self._bts_number)
   2520         self._anritsu.send_command(cmd)
   2521 
   2522     @property
   2523     def nrb_dl(self):
   2524         """ Gets the Downlink N Resource Block of the cell
   2525 
   2526         Args:
   2527             None
   2528 
   2529         Returns:
   2530             Downlink NRB
   2531         """
   2532         cmd = "DLNRB? " + self._bts_number
   2533         return self._anritsu.send_query(cmd)
   2534 
   2535     @nrb_dl.setter
   2536     def nrb_dl(self, blocks):
   2537         """ Sets the Downlink N Resource Block of the cell
   2538 
   2539         Args:
   2540             blocks: Downlink N Resource Block of the cell
   2541 
   2542         Returns:
   2543             None
   2544         """
   2545         cmd = "DLNRB {},{}".format(blocks, self._bts_number)
   2546         self._anritsu.send_command(cmd)
   2547 
   2548     @property
   2549     def nrb_ul(self):
   2550         """ Gets the uplink N Resource Block of the cell
   2551 
   2552         Args:
   2553             None
   2554 
   2555         Returns:
   2556             uplink NRB
   2557         """
   2558         cmd = "ULNRB? " + self._bts_number
   2559         return self._anritsu.send_query(cmd)
   2560 
   2561     @nrb_ul.setter
   2562     def nrb_ul(self, blocks):
   2563         """ Sets the uplink N Resource Block of the cell
   2564 
   2565         Args:
   2566             blocks: uplink N Resource Block of the cell
   2567 
   2568         Returns:
   2569             None
   2570         """
   2571         cmd = "ULNRB {},{}".format(blocks, self._bts_number)
   2572         self._anritsu.send_command(cmd)
   2573 
   2574     @property
   2575     def neighbor_cell_mode(self):
   2576         """ Gets the neighbor cell mode
   2577 
   2578         Args:
   2579             None
   2580 
   2581         Returns:
   2582             current neighbor cell mode
   2583         """
   2584         cmd = "NCLIST? " + self._bts_number
   2585         return self._anritsu.send_query(cmd)
   2586 
   2587     @neighbor_cell_mode.setter
   2588     def neighbor_cell_mode(self, mode):
   2589         """ Sets the neighbor cell mode
   2590 
   2591         Args:
   2592             mode: neighbor cell mode , DEFAULT/ USERDATA
   2593 
   2594         Returns:
   2595             None
   2596         """
   2597         cmd = "NCLIST {},{}".format(mode, self._bts_number)
   2598         self._anritsu.send_command(cmd)
   2599 
   2600     def get_neighbor_cell_type(self, system, index):
   2601         """ Gets the neighbor cell type
   2602 
   2603         Args:
   2604             system: simulation model of neighbor cell
   2605                     LTE, WCDMA, TDSCDMA, GSM, CDMA1X,EVDO
   2606             index: Index of neighbor cell
   2607 
   2608         Returns:
   2609             neighbor cell type
   2610         """
   2611         cmd = "NCTYPE? {},{},{}".format(system, index, self._bts_number)
   2612         return self._anritsu.send_query(cmd)
   2613 
   2614     def set_neighbor_cell_type(self, system, index, cell_type):
   2615         """ Sets the neighbor cell type
   2616 
   2617         Args:
   2618             system: simulation model of neighbor cell
   2619                    LTE, WCDMA, TDSCDMA, GSM, CDMA1X,EVDO
   2620             index: Index of neighbor cell
   2621             cell_type: cell type
   2622                 BTS1, BTS2, BTS3, BTS4,CELLNAME, DISABLE
   2623 
   2624         Returns:
   2625             None
   2626         """
   2627         cmd = "NCTYPE {},{},{},{}".format(system, index, cell_type,
   2628                                           self._bts_number)
   2629         self._anritsu.send_command(cmd)
   2630 
   2631     def get_neighbor_cell_name(self, system, index):
   2632         """ Gets the neighbor cell name
   2633 
   2634         Args:
   2635             system: simulation model of neighbor cell
   2636                     LTE, WCDMA, TDSCDMA, GSM, CDMA1X,EVDO
   2637             index: Index of neighbor cell
   2638 
   2639         Returns:
   2640             neighbor cell name
   2641         """
   2642         cmd = "NCCELLNAME? {},{},{}".format(system, index, self._bts_number)
   2643         return self._anritsu.send_query(cmd)
   2644 
   2645     def set_neighbor_cell_name(self, system, index, name):
   2646         """ Sets the neighbor cell name
   2647 
   2648         Args:
   2649             system: simulation model of neighbor cell
   2650                    LTE, WCDMA, TDSCDMA, GSM, CDMA1X,EVDO
   2651             index: Index of neighbor cell
   2652             name: cell name
   2653 
   2654         Returns:
   2655             None
   2656         """
   2657         cmd = "NCCELLNAME {},{},{},{}".format(system, index, name,
   2658                                               self._bts_number)
   2659         self._anritsu.send_command(cmd)
   2660 
   2661     def get_neighbor_cell_mcc(self, system, index):
   2662         """ Gets the neighbor cell mcc
   2663 
   2664         Args:
   2665             system: simulation model of neighbor cell
   2666                     LTE, WCDMA, TDSCDMA, GSM, CDMA1X,EVDO
   2667             index: Index of neighbor cell
   2668 
   2669         Returns:
   2670             neighbor cell mcc
   2671         """
   2672         cmd = "NCMCC? {},{},{}".format(system, index, self._bts_number)
   2673         return self._anritsu.send_query(cmd)
   2674 
   2675     def get_neighbor_cell_mnc(self, system, index):
   2676         """ Gets the neighbor cell mnc
   2677 
   2678         Args:
   2679             system: simulation model of neighbor cell
   2680                     LTE, WCDMA, TDSCDMA, GSM, CDMA1X,EVDO
   2681             index: Index of neighbor cell
   2682 
   2683         Returns:
   2684             neighbor cell mnc
   2685         """
   2686         cmd = "NCMNC? {},{},{}".format(system, index, self._bts_number)
   2687         return self._anritsu.send_query(cmd)
   2688 
   2689     def get_neighbor_cell_id(self, system, index):
   2690         """ Gets the neighbor cell id
   2691 
   2692         Args:
   2693             system: simulation model of neighbor cell
   2694                     LTE, WCDMA, TDSCDMA, GSM, CDMA1X,EVDO
   2695             index: Index of neighbor cell
   2696 
   2697         Returns:
   2698             neighbor cell id
   2699         """
   2700         cmd = "NCCELLID? {},{},{}".format(system, index, self._bts_number)
   2701         return self._anritsu.send_query(cmd)
   2702 
   2703     def get_neighbor_cell_tac(self, system, index):
   2704         """ Gets the neighbor cell tracking area code
   2705 
   2706         Args:
   2707             system: simulation model of neighbor cell
   2708                     LTE, WCDMA, TDSCDMA, GSM, CDMA1X,EVDO
   2709             index: Index of neighbor cell
   2710 
   2711         Returns:
   2712             neighbor cell tracking area code
   2713         """
   2714         cmd = "NCTAC? {},{},{}".format(system, index, self._bts_number)
   2715         return self._anritsu.send_query(cmd)
   2716 
   2717     def get_neighbor_cell_dl_channel(self, system, index):
   2718         """ Gets the neighbor cell downlink channel
   2719 
   2720         Args:
   2721             system: simulation model of neighbor cell
   2722                     LTE, WCDMA, TDSCDMA, GSM, CDMA1X,EVDO
   2723             index: Index of neighbor cell
   2724 
   2725         Returns:
   2726             neighbor cell tracking downlink channel
   2727         """
   2728         cmd = "NCDLCHAN? {},{},{}".format(system, index, self._bts_number)
   2729         return self._anritsu.send_query(cmd)
   2730 
   2731     def get_neighbor_cell_dl_bandwidth(self, system, index):
   2732         """ Gets the neighbor cell downlink bandwidth
   2733 
   2734         Args:
   2735             system: simulation model of neighbor cell
   2736                     LTE, WCDMA, TDSCDMA, GSM, CDMA1X,EVDO
   2737             index: Index of neighbor cell
   2738 
   2739         Returns:
   2740             neighbor cell tracking downlink bandwidth
   2741         """
   2742         cmd = "NCDLBANDWIDTH {},{},{}".format(system, index, self._bts_number)
   2743         return self._anritsu.send_query(cmd)
   2744 
   2745     def get_neighbor_cell_pcid(self, system, index):
   2746         """ Gets the neighbor cell physical cell id
   2747 
   2748         Args:
   2749             system: simulation model of neighbor cell
   2750                     LTE, WCDMA, TDSCDMA, GSM, CDMA1X,EVDO
   2751             index: Index of neighbor cell
   2752 
   2753         Returns:
   2754             neighbor cell physical cell id
   2755         """
   2756         cmd = "NCPHYCELLID {},{},{}".format(system, index, self._bts_number)
   2757         return self._anritsu.send_query(cmd)
   2758 
   2759     def get_neighbor_cell_lac(self, system, index):
   2760         """ Gets the neighbor cell location area code
   2761 
   2762         Args:
   2763             system: simulation model of neighbor cell
   2764                     LTE, WCDMA, TDSCDMA, GSM, CDMA1X,EVDO
   2765             index: Index of neighbor cell
   2766 
   2767         Returns:
   2768             neighbor cell location area code
   2769         """
   2770         cmd = "NCLAC {},{},{}".format(system, index, self._bts_number)
   2771         return self._anritsu.send_query(cmd)
   2772 
   2773     def get_neighbor_cell_rac(self, system, index):
   2774         """ Gets the neighbor cell routing area code
   2775 
   2776         Args:
   2777             system: simulation model of neighbor cell
   2778                     LTE, WCDMA, TDSCDMA, GSM, CDMA1X,EVDO
   2779             index: Index of neighbor cell
   2780 
   2781         Returns:
   2782             neighbor cell routing area code
   2783         """
   2784         cmd = "NCRAC {},{},{}".format(system, index, self._bts_number)
   2785         return self._anritsu.send_query(cmd)
   2786 
   2787     @property
   2788     def primary_scrambling_code(self):
   2789         """ Gets the primary scrambling code for WCDMA cell
   2790 
   2791         Args:
   2792             None
   2793 
   2794         Returns:
   2795             primary scrambling code
   2796         """
   2797         cmd = "PRISCRCODE? " + self._bts_number
   2798         return self._anritsu.send_query(cmd)
   2799 
   2800     @primary_scrambling_code.setter
   2801     def primary_scrambling_code(self, psc):
   2802         """ Sets the primary scrambling code for WCDMA cell
   2803 
   2804         Args:
   2805             psc: primary scrambling code
   2806 
   2807         Returns:
   2808             None
   2809         """
   2810         cmd = "PRISCRCODE {},{}".format(psc, self._bts_number)
   2811         self._anritsu.send_command(cmd)
   2812 
   2813     @property
   2814     def tac(self):
   2815         """ Gets the Tracking Area Code of the LTE cell
   2816 
   2817         Args:
   2818             None
   2819 
   2820         Returns:
   2821             Tracking Area Code of the LTE cell
   2822         """
   2823         cmd = "TAC? " + self._bts_number
   2824         return self._anritsu.send_query(cmd)
   2825 
   2826     @tac.setter
   2827     def tac(self, tac):
   2828         """ Sets the Tracking Area Code of the LTE cell
   2829 
   2830         Args:
   2831             tac: Tracking Area Code of the LTE cell
   2832 
   2833         Returns:
   2834             None
   2835         """
   2836         cmd = "TAC {},{}".format(tac, self._bts_number)
   2837         self._anritsu.send_command(cmd)
   2838 
   2839     @property
   2840     def cell(self):
   2841         """ Gets the current cell for BTS
   2842 
   2843         Args:
   2844             None
   2845 
   2846         Returns:
   2847             current cell for BTS
   2848         """
   2849         cmd = "CELLSEL? {}".format(self._bts_number)
   2850         return self._anritsu.send_query(cmd)
   2851 
   2852     @cell.setter
   2853     def cell(self, cell_name):
   2854         """ sets the  cell for BTS
   2855         Args:
   2856             cell_name: cell name
   2857 
   2858         Returns:
   2859             None
   2860         """
   2861         cmd = "CELLSEL {},{}".format(self._bts_number, cell_name)
   2862         return self._anritsu.send_command(cmd)
   2863 
   2864     @property
   2865     def gsm_cbch(self):
   2866         """ Gets the GSM CBCH enable/disable status
   2867 
   2868         Args:
   2869             None
   2870 
   2871         Returns:
   2872             one of CBCHSetup values
   2873         """
   2874         cmd = "CBCHPARAMSETUP? " + self._bts_number
   2875         return self._anritsu.send_query(cmd)
   2876 
   2877     @gsm_cbch.setter
   2878     def gsm_cbch(self, enable):
   2879         """ Sets the GSM CBCH enable/disable status
   2880 
   2881         Args:
   2882             enable: GSM CBCH enable/disable status
   2883 
   2884         Returns:
   2885             None
   2886         """
   2887         cmd = "CBCHPARAMSETUP {},{}".format(enable.value, self._bts_number)
   2888         self._anritsu.send_command(cmd)
   2889 
   2890 
   2891 class _VirtualPhone(object):
   2892     '''Class to interact with virtual phone supported by MD8475 '''
   2893 
   2894     def __init__(self, anritsu):
   2895         self._anritsu = anritsu
   2896         self.log = anritsu.log
   2897 
   2898     @property
   2899     def id(self):
   2900         """ Gets the virtual phone ID
   2901 
   2902         Args:
   2903             None
   2904 
   2905         Returns:
   2906             virtual phone ID
   2907         """
   2908         cmd = "VPID? "
   2909         return self._anritsu.send_query(cmd)
   2910 
   2911     @id.setter
   2912     def id(self, phonenumber):
   2913         """ Sets the virtual phone ID
   2914 
   2915         Args:
   2916             phonenumber: virtual phone ID
   2917 
   2918         Returns:
   2919             None
   2920         """
   2921         cmd = "VPID {}".format(phonenumber)
   2922         self._anritsu.send_command(cmd)
   2923 
   2924     @property
   2925     def id_c2k(self):
   2926         """ Gets the virtual phone ID for CDMA 1x
   2927 
   2928         Args:
   2929             None
   2930 
   2931         Returns:
   2932             virtual phone ID
   2933         """
   2934         cmd = "VPIDC2K? "
   2935         return self._anritsu.send_query(cmd)
   2936 
   2937     @id_c2k.setter
   2938     def id_c2k(self, phonenumber):
   2939         """ Sets the virtual phone ID for CDMA 1x
   2940 
   2941         Args:
   2942             phonenumber: virtual phone ID
   2943 
   2944         Returns:
   2945             None
   2946         """
   2947         cmd = "VPIDC2K {}".format(phonenumber)
   2948         self._anritsu.send_command(cmd)
   2949 
   2950     @property
   2951     def auto_answer(self):
   2952         """ Gets the auto answer status of virtual phone
   2953 
   2954         Args:
   2955             None
   2956 
   2957         Returns:
   2958             auto answer status, ON/OFF
   2959         """
   2960         cmd = "VPAUTOANSWER? "
   2961         return self._anritsu.send_query(cmd)
   2962 
   2963     @auto_answer.setter
   2964     def auto_answer(self, option):
   2965         """ Sets the auto answer feature
   2966 
   2967         Args:
   2968             option: tuple with two items for turning on Auto Answer
   2969                     (OFF or (ON, timetowait))
   2970 
   2971         Returns:
   2972             None
   2973         """
   2974         enable = "OFF"
   2975         time = 5
   2976 
   2977         try:
   2978             enable, time = option
   2979         except ValueError:
   2980             if enable != "OFF":
   2981                 raise ValueError("Pass a tuple with two items for"
   2982                                  " Turning on Auto Answer")
   2983         cmd = "VPAUTOANSWER {},{}".format(enable.value, time)
   2984         self._anritsu.send_command(cmd)
   2985 
   2986     @property
   2987     def calling_mode(self):
   2988         """ Gets the calling mode of virtual phone
   2989 
   2990         Args:
   2991             None
   2992 
   2993         Returns:
   2994             calling mode of virtual phone
   2995         """
   2996         cmd = "VPCALLINGMODE? "
   2997         return self._anritsu.send_query(cmd)
   2998 
   2999     @calling_mode.setter
   3000     def calling_mode(self, calling_mode):
   3001         """ Sets the calling mode of virtual phone
   3002 
   3003         Args:
   3004             calling_mode: calling mode of virtual phone
   3005 
   3006         Returns:
   3007             None
   3008         """
   3009         cmd = "VPCALLINGMODE {}".format(calling_mode)
   3010         self._anritsu.send_command(cmd)
   3011 
   3012     def set_voice_off_hook(self):
   3013         """ Set the virtual phone operating mode to Voice Off Hook
   3014 
   3015         Args:
   3016             None
   3017 
   3018         Returns:
   3019             None
   3020         """
   3021         cmd = "OPERATEVPHONE 0"
   3022         return self._anritsu.send_command(cmd)
   3023 
   3024     def set_voice_on_hook(self):
   3025         """ Set the virtual phone operating mode to Voice On Hook
   3026 
   3027         Args:
   3028             None
   3029 
   3030         Returns:
   3031             None
   3032         """
   3033         cmd = "OPERATEVPHONE 1"
   3034         return self._anritsu.send_command(cmd)
   3035 
   3036     def set_video_off_hook(self):
   3037         """ Set the virtual phone operating mode to Video Off Hook
   3038 
   3039         Args:
   3040             None
   3041 
   3042         Returns:
   3043             None
   3044         """
   3045         cmd = "OPERATEVPHONE 2"
   3046         return self._anritsu.send_command(cmd)
   3047 
   3048     def set_video_on_hook(self):
   3049         """ Set the virtual phone operating mode to Video On Hook
   3050 
   3051         Args:
   3052             None
   3053 
   3054         Returns:
   3055             None
   3056         """
   3057         cmd = "OPERATEVPHONE 3"
   3058         return self._anritsu.send_command(cmd)
   3059 
   3060     def set_call_waiting(self):
   3061         """ Set the virtual phone operating mode to Call waiting
   3062 
   3063         Args:
   3064             None
   3065 
   3066         Returns:
   3067             None
   3068         """
   3069         cmd = "OPERATEVPHONE 4"
   3070         return self._anritsu.send_command(cmd)
   3071 
   3072     @property
   3073     def status(self):
   3074         """ Gets the virtual phone status
   3075 
   3076         Args:
   3077             None
   3078 
   3079         Returns:
   3080             virtual phone status
   3081         """
   3082         cmd = "VPSTAT?"
   3083         status = self._anritsu.send_query(cmd)
   3084         return _VP_STATUS[status]
   3085 
   3086     def sendSms(self, phoneNumber, message):
   3087         """ Sends the SMS data from Anritsu to UE
   3088 
   3089         Args:
   3090             phoneNumber: sender of SMS
   3091             message: message text
   3092 
   3093         Returns:
   3094             None
   3095         """
   3096         cmd = ("SENDSMS /?PhoneNumber=001122334455&Sender={}&Text={}"
   3097                "&DCS=00").format(phoneNumber, AnritsuUtils.gsm_encode(message))
   3098         return self._anritsu.send_command(cmd)
   3099 
   3100     def sendSms_c2k(self, phoneNumber, message):
   3101         """ Sends the SMS data from Anritsu to UE (in CDMA)
   3102 
   3103         Args:
   3104             phoneNumber: sender of SMS
   3105             message: message text
   3106 
   3107         Returns:
   3108             None
   3109         """
   3110         cmd = ("C2KSENDSMS System=CDMA\&Originating_Address={}\&UserData={}"
   3111                ).format(phoneNumber, AnritsuUtils.cdma_encode(message))
   3112         return self._anritsu.send_command(cmd)
   3113 
   3114     def receiveSms(self):
   3115         """ Receives SMS messages sent by the UE in an external application
   3116 
   3117         Args:
   3118             None
   3119 
   3120         Returns:
   3121             None
   3122         """
   3123         return self._anritsu.send_query("RECEIVESMS?")
   3124 
   3125     def receiveSms_c2k(self):
   3126         """ Receives SMS messages sent by the UE(in CDMA) in an external application
   3127 
   3128         Args:
   3129             None
   3130 
   3131         Returns:
   3132             None
   3133         """
   3134         return self._anritsu.send_query("C2KRECEIVESMS?")
   3135 
   3136     def setSmsStatusReport(self, status):
   3137         """ Set the Status Report value of the SMS
   3138 
   3139         Args:
   3140             status: status code
   3141 
   3142         Returns:
   3143             None
   3144         """
   3145         cmd = "SMSSTATUSREPORT {}".format(status)
   3146         return self._anritsu.send_command(cmd)
   3147 
   3148 
   3149 class _PacketDataNetwork(object):
   3150     '''Class to configure PDN parameters'''
   3151 
   3152     def __init__(self, anritsu, pdnnumber):
   3153         self._pdn_number = pdnnumber
   3154         self._anritsu = anritsu
   3155         self.log = anritsu.log
   3156 
   3157     @property
   3158     def ue_address_iptype(self):
   3159         """ Gets IP type of UE for particular PDN
   3160 
   3161         Args:
   3162             None
   3163 
   3164         Returns:
   3165             IP type of UE for particular PDN
   3166         """
   3167         cmd = "PDNIPTYPE? " + self._pdn_number
   3168         return self._anritsu.send_query(cmd)
   3169 
   3170     @ue_address_iptype.setter
   3171     def ue_address_iptype(self, ip_type):
   3172         """ Set IP type of UE for particular PDN
   3173 
   3174         Args:
   3175             ip_type: IP type of UE
   3176 
   3177         Returns:
   3178             None
   3179         """
   3180         if not isinstance(ip_type, IPAddressType):
   3181             raise ValueError(
   3182                 ' The parameter should be of type "IPAddressType"')
   3183         cmd = "PDNIPTYPE {},{}".format(self._pdn_number, ip_type.value)
   3184         self._anritsu.send_command(cmd)
   3185 
   3186     @property
   3187     def ue_address_ipv4(self):
   3188         """ Gets UE IPv4 address
   3189 
   3190         Args:
   3191             None
   3192 
   3193         Returns:
   3194             UE IPv4 address
   3195         """
   3196         cmd = "PDNIPV4? " + self._pdn_number
   3197         return self._anritsu.send_query(cmd)
   3198 
   3199     @ue_address_ipv4.setter
   3200     def ue_address_ipv4(self, ip_address):
   3201         """ Set UE IPv4 address
   3202 
   3203         Args:
   3204             ip_address: UE IPv4 address
   3205 
   3206         Returns:
   3207             None
   3208         """
   3209         cmd = "PDNIPV4 {},{}".format(self._pdn_number, ip_address)
   3210         self._anritsu.send_command(cmd)
   3211 
   3212     @property
   3213     def ue_address_ipv6(self):
   3214         """ Gets UE IPv6 address
   3215 
   3216         Args:
   3217             None
   3218 
   3219         Returns:
   3220             UE IPv6 address
   3221         """
   3222         cmd = "PDNIPV6? " + self._pdn_number
   3223         return self._anritsu.send_query(cmd)
   3224 
   3225     @ue_address_ipv6.setter
   3226     def ue_address_ipv6(self, ip_address):
   3227         """ Set UE IPv6 address
   3228 
   3229         Args:
   3230             ip_address: UE IPv6 address
   3231 
   3232         Returns:
   3233             None
   3234         """
   3235         cmd = "PDNIPV6 {},{}".format(self._pdn_number, ip_address)
   3236         self._anritsu.send_command(cmd)
   3237 
   3238     @property
   3239     def primary_dns_address_ipv4(self):
   3240         """ Gets Primary DNS server IPv4 address
   3241 
   3242         Args:
   3243             None
   3244 
   3245         Returns:
   3246             Primary DNS server IPv4 address
   3247         """
   3248         cmd = "PDNDNSIPV4PRI? " + self._pdn_number
   3249         return self._anritsu.send_query(cmd)
   3250 
   3251     @primary_dns_address_ipv4.setter
   3252     def primary_dns_address_ipv4(self, ip_address):
   3253         """ Set Primary DNS server IPv4 address
   3254 
   3255         Args:
   3256             ip_address: Primary DNS server IPv4 address
   3257 
   3258         Returns:
   3259             None
   3260         """
   3261         cmd = "PDNDNSIPV4PRI {},{}".format(self._pdn_number, ip_address)
   3262         self._anritsu.send_command(cmd)
   3263 
   3264     @property
   3265     def secondary_dns_address_ipv4(self):
   3266         """ Gets secondary DNS server IPv4 address
   3267 
   3268         Args:
   3269             None
   3270 
   3271         Returns:
   3272             secondary DNS server IPv4 address
   3273         """
   3274         cmd = "PDNDNSIPV4SEC? " + self._pdn_number
   3275         return self._anritsu.send_query(cmd)
   3276 
   3277     @secondary_dns_address_ipv4.setter
   3278     def secondary_dns_address_ipv4(self, ip_address):
   3279         """ Set secondary DNS server IPv4 address
   3280 
   3281         Args:
   3282             ip_address: secondary DNS server IPv4 address
   3283 
   3284         Returns:
   3285             None
   3286         """
   3287         cmd = "PDNDNSIPV4SEC {},{}".format(self._pdn_number, ip_address)
   3288         self._anritsu.send_command(cmd)
   3289 
   3290     @property
   3291     def dns_address_ipv6(self):
   3292         """ Gets DNS server IPv6 address
   3293 
   3294         Args:
   3295             None
   3296 
   3297         Returns:
   3298             DNS server IPv6 address
   3299         """
   3300         cmd = "PDNDNSIPV6? " + self._pdn_number
   3301         return self._anritsu.send_query(cmd)
   3302 
   3303     @dns_address_ipv6.setter
   3304     def dns_address_ipv6(self, ip_address):
   3305         """ Set DNS server IPv6 address
   3306 
   3307         Args:
   3308             ip_address: DNS server IPv6 address
   3309 
   3310         Returns:
   3311             None
   3312         """
   3313         cmd = "PDNDNSIPV6 {},{}".format(self._pdn_number, ip_address)
   3314         self._anritsu.send_command(cmd)
   3315 
   3316     @property
   3317     def cscf_address_ipv4(self):
   3318         """ Gets Secondary P-CSCF IPv4 address
   3319 
   3320         Args:
   3321             None
   3322 
   3323         Returns:
   3324             Secondary P-CSCF IPv4 address
   3325         """
   3326         cmd = "PDNPCSCFIPV4? " + self._pdn_number
   3327         return self._anritsu.send_query(cmd)
   3328 
   3329     @cscf_address_ipv4.setter
   3330     def cscf_address_ipv4(self, ip_address):
   3331         """ Set Secondary P-CSCF IPv4 address
   3332 
   3333         Args:
   3334             ip_address: Secondary P-CSCF IPv4 address
   3335 
   3336         Returns:
   3337             None
   3338         """
   3339         cmd = "PDNPCSCFIPV4 {},{}".format(self._pdn_number, ip_address)
   3340         self._anritsu.send_command(cmd)
   3341 
   3342     @property
   3343     def cscf_address_ipv6(self):
   3344         """ Gets P-CSCF IPv6 address
   3345 
   3346         Args:
   3347             None
   3348 
   3349         Returns:
   3350             P-CSCF IPv6 address
   3351         """
   3352         cmd = "PDNPCSCFIPV6? " + self._pdn_number
   3353         return self._anritsu.send_query(cmd)
   3354 
   3355     @cscf_address_ipv6.setter
   3356     def cscf_address_ipv6(self, ip_address):
   3357         """ Set P-CSCF IPv6 address
   3358 
   3359         Args:
   3360             ip_address: P-CSCF IPv6 address
   3361 
   3362         Returns:
   3363             None
   3364         """
   3365         cmd = "PDNPCSCFIPV6 {},{}".format(self._pdn_number, ip_address)
   3366         self._anritsu.send_command(cmd)
   3367 
   3368     @property
   3369     def pdn_ims(self):
   3370         """ Get PDN IMS VNID binding status
   3371 
   3372         Args:
   3373             None
   3374 
   3375         Returns:
   3376             PDN IMS VNID binding status
   3377         """
   3378         cmd = "PDNIMS? " + self._pdn_number
   3379         return self._anritsu.send_query(cmd)
   3380 
   3381     @pdn_ims.setter
   3382     def pdn_ims(self, switch):
   3383         """ Set PDN IMS VNID binding Enable/Disable
   3384 
   3385         Args:
   3386             switch: "ENABLE/DISABLE"
   3387 
   3388         Returns:
   3389             None
   3390         """
   3391         if not isinstance(switch, Switch):
   3392             raise ValueError(' The parameter should be of type'
   3393                              ' "Switch", ie, ENABLE or DISABLE ')
   3394         cmd = "PDNIMS {},{}".format(self._pdn_number, switch.value)
   3395         self._anritsu.send_command(cmd)
   3396 
   3397     @property
   3398     def pdn_vnid(self):
   3399         """ Get PDN IMS VNID
   3400 
   3401         Args:
   3402             None
   3403 
   3404         Returns:
   3405             PDN IMS VNID
   3406         """
   3407         cmd = "PDNVNID? " + self._pdn_number
   3408         return self._anritsu.send_query(cmd)
   3409 
   3410     @pdn_vnid.setter
   3411     def pdn_vnid(self, vnid):
   3412         """ Set PDN IMS VNID
   3413 
   3414         Args:
   3415             vnid: 1~99
   3416 
   3417         Returns:
   3418             None
   3419         """
   3420         cmd = "PDNVNID {},{}".format(self._pdn_number, vnid)
   3421         self._anritsu.send_command(cmd)
   3422 
   3423 
   3424 class _TriggerMessage(object):
   3425     '''Class to interact with trigger message handling supported by MD8475 '''
   3426 
   3427     def __init__(self, anritsu):
   3428         self._anritsu = anritsu
   3429         self.log = anritsu.log
   3430 
   3431     def set_reply_type(self, message_id, reply_type):
   3432         """ Sets the reply type of the trigger information
   3433 
   3434         Args:
   3435             message_id: trigger information message Id
   3436             reply_type: reply type of the trigger information
   3437 
   3438         Returns:
   3439             None
   3440         """
   3441         if not isinstance(message_id, TriggerMessageIDs):
   3442             raise ValueError(' The parameter should be of type'
   3443                              ' "TriggerMessageIDs"')
   3444         if not isinstance(reply_type, TriggerMessageReply):
   3445             raise ValueError(' The parameter should be of type'
   3446                              ' "TriggerMessageReply"')
   3447 
   3448         cmd = "REJECTTYPE {},{}".format(message_id.value, reply_type.value)
   3449         self._anritsu.send_command(cmd)
   3450 
   3451     def set_reject_cause(self, message_id, cause):
   3452         """ Sets the reject cause of the trigger information
   3453 
   3454         Args:
   3455             message_id: trigger information message Id
   3456             cause: cause for reject
   3457 
   3458         Returns:
   3459             None
   3460         """
   3461         if not isinstance(message_id, TriggerMessageIDs):
   3462             raise ValueError(' The parameter should be of type'
   3463                              ' "TriggerMessageIDs"')
   3464 
   3465         cmd = "REJECTCAUSE {},{}".format(message_id.value, cause)
   3466         self._anritsu.send_command(cmd)
   3467 
   3468 
   3469 class _IMS_Services(object):
   3470     '''Class to configure and operate IMS Services'''
   3471 
   3472     def __init__(self, anritsu, vnid):
   3473         self._vnid = vnid
   3474         self._anritsu = anritsu
   3475         self.log = anritsu.log
   3476 
   3477     @property
   3478     def sync(self):
   3479         """ Gets Sync Enable status
   3480 
   3481         Args:
   3482             None
   3483 
   3484         Returns:
   3485             VNID Sync Enable status
   3486         """
   3487         cmd = "IMSSYNCENABLE? " + self._vnid
   3488         return self._anritsu.send_query(cmd)
   3489 
   3490     @sync.setter
   3491     def sync(self, switch):
   3492         """ Set Sync Enable or Disable
   3493 
   3494         Args:
   3495             sync: ENABLE/DISABLE
   3496 
   3497         Returns:
   3498             None
   3499         """
   3500         if not isinstance(switch, Switch):
   3501             raise ValueError(' The parameter should be of type "Switch"')
   3502         cmd = "IMSSYNCENABLE {},{}".format(self._vnid, switch.value)
   3503         self._anritsu.send_command(cmd)
   3504 
   3505     @property
   3506     def cscf_address_ipv4(self):
   3507         """ Gets CSCF IPv4 address
   3508 
   3509         Args:
   3510             None
   3511 
   3512         Returns:
   3513             CSCF IPv4 address
   3514         """
   3515         cmd = "IMSCSCFIPV4? " + self._vnid
   3516         return self._anritsu.send_query(cmd)
   3517 
   3518     @cscf_address_ipv4.setter
   3519     def cscf_address_ipv4(self, ip_address):
   3520         """ Set CSCF IPv4 address
   3521 
   3522         Args:
   3523             ip_address: CSCF IPv4 address
   3524 
   3525         Returns:
   3526             None
   3527         """
   3528         cmd = "IMSCSCFIPV4 {},{}".format(self._vnid, ip_address)
   3529         self._anritsu.send_command(cmd)
   3530 
   3531     @property
   3532     def cscf_address_ipv6(self):
   3533         """ Gets CSCF IPv6 address
   3534 
   3535         Args:
   3536             None
   3537 
   3538         Returns:
   3539             CSCF IPv6 address
   3540         """
   3541         cmd = "IMSCSCFIPV6? " + self._vnid
   3542         return self._anritsu.send_query(cmd)
   3543 
   3544     @cscf_address_ipv6.setter
   3545     def cscf_address_ipv6(self, ip_address):
   3546         """ Set CSCF IPv6 address
   3547 
   3548         Args:
   3549             ip_address: CSCF IPv6 address
   3550 
   3551         Returns:
   3552             None
   3553         """
   3554         cmd = "IMSCSCFIPV6 {},{}".format(self._vnid, ip_address)
   3555         self._anritsu.send_command(cmd)
   3556 
   3557     @property
   3558     def cscf_monitoring_ua(self):
   3559         """ Get CSCF Monitoring UA URI
   3560 
   3561         Args:
   3562             None
   3563 
   3564         Returns:
   3565             CSCF Monitoring UA URI
   3566         """
   3567         cmd = "IMSCSCFUAURI? " + self._vnid
   3568         return self._anritsu.send_query(cmd)
   3569 
   3570     @cscf_monitoring_ua.setter
   3571     def cscf_monitoring_ua(self, ua_uri):
   3572         """ Set CSCF Monitoring UA URI
   3573 
   3574         Args:
   3575             ua_uri: CSCF Monitoring UA URI
   3576 
   3577         Returns:
   3578             None
   3579         """
   3580         cmd = "IMSCSCFUAURI {},{}".format(self._vnid, ua_uri)
   3581         self._anritsu.send_command(cmd)
   3582 
   3583     @property
   3584     def dns(self):
   3585         """ Gets DNS Enable status
   3586 
   3587         Args:
   3588             None
   3589 
   3590         Returns:
   3591             VNID DNS Enable status
   3592         """
   3593         cmd = "IMSDNS? " + self._vnid
   3594         return self._anritsu.send_query(cmd)
   3595 
   3596     @dns.setter
   3597     def dns(self, switch):
   3598         """ Set DNS Enable or Disable
   3599 
   3600         Args:
   3601             sync: ENABLE/DISABLE
   3602 
   3603         Returns:
   3604             None
   3605         """
   3606         if not isinstance(switch, Switch):
   3607             raise ValueError(' The parameter should be of type "Switch"')
   3608         cmd = "IMSDNS {},{}".format(self._vnid, switch.value)
   3609         self._anritsu.send_command(cmd)
   3610 
   3611     @property
   3612     def ndp_nic(self):
   3613         """ Gets NDP Network Interface name
   3614 
   3615         Args:
   3616             None
   3617 
   3618         Returns:
   3619             NDP NIC name
   3620         """
   3621         cmd = "IMSNDPNIC? " + self._vnid
   3622         return self._anritsu.send_query(cmd)
   3623 
   3624     @ndp_nic.setter
   3625     def ndp_nic(self, nic_name):
   3626         """ Set NDP Network Interface name
   3627 
   3628         Args:
   3629             nic_name: NDP Network Interface name
   3630 
   3631         Returns:
   3632             None
   3633         """
   3634         cmd = "IMSNDPNIC {},{}".format(self._vnid, nic_name)
   3635         self._anritsu.send_command(cmd)
   3636 
   3637     @property
   3638     def psap(self):
   3639         """ Gets PSAP Enable status
   3640 
   3641         Args:
   3642             None
   3643 
   3644         Returns:
   3645             VNID PSAP Enable status
   3646         """
   3647         cmd = "IMSPSAP? " + self._vnid
   3648         return self._anritsu.send_query(cmd)
   3649 
   3650     @psap.setter
   3651     def psap(self, switch):
   3652         """ Set PSAP Enable or Disable
   3653 
   3654         Args:
   3655             switch: ENABLE/DISABLE
   3656 
   3657         Returns:
   3658             None
   3659         """
   3660         if not isinstance(switch, Switch):
   3661             raise ValueError(' The parameter should be of type "Switch"')
   3662         cmd = "IMSPSAP {},{}".format(self._vnid, switch.value)
   3663         self._anritsu.send_command(cmd)
   3664 
   3665     @property
   3666     def psap_auto_answer(self):
   3667         """ Gets PSAP Auto Answer status
   3668 
   3669         Args:
   3670             None
   3671 
   3672         Returns:
   3673             VNID PSAP Auto Answer status
   3674         """
   3675         cmd = "IMSPSAPAUTOANSWER? " + self._vnid
   3676         return self._anritsu.send_query(cmd)
   3677 
   3678     @psap_auto_answer.setter
   3679     def psap_auto_answer(self, switch):
   3680         """ Set PSAP Auto Answer Enable or Disable
   3681 
   3682         Args:
   3683             switch: ENABLE/DISABLE
   3684 
   3685         Returns:
   3686             None
   3687         """
   3688         if not isinstance(switch, Switch):
   3689             raise ValueError(' The parameter should be of type "Switch"')
   3690         cmd = "IMSPSAPAUTOANSWER {},{}".format(self._vnid, switch.value)
   3691         self._anritsu.send_command(cmd)
   3692 
   3693     def start_virtual_network(self):
   3694         """ Start the specified Virtual Network (IMS service)
   3695 
   3696         Args:
   3697             None
   3698 
   3699         Returns:
   3700             None
   3701         """
   3702         cmd = "IMSSTARTVN " + self._vnid
   3703         return self._anritsu.send_command(cmd)
   3704