def frames_per_burst(self, frames_per_burst_amount): """Creates messages to define how many frames are needed for every burst. :param frames_per_burst_amount: amount of frames """ input_validator.value_minimum_maximum(1, 1099511627775, frames_per_burst_amount) self.commands.append(':TSTReam:TABLe:ITEM:CONTrol:FPBurst ' + str(frames_per_burst_amount) + '\n') self.stream_queries[':TSTReam:TABLe:ITEM:CONTrol:FPBurst?\n'] = str(frames_per_burst_amount) + '\n'
def inter_burst_gap(self, inter_burst_gap_value): """Creates messages to define the Inter Burst Gap (IBG). :param inter_burst_gap_value: the IBG in ns. """ # First validate the user input input_validator.value_minimum_maximum(1, 1200000000000, inter_burst_gap_value) # Append the associated command message to the self.commands list, to set a variable on the Anritsu self.commands.append(':TSTReam:TABLe:ITEM:CONTrol:GAP:IBG ' + str(inter_burst_gap_value) + '\n') # Write the corresponding query message to the self.stream_queries dictionary as a key and the input as it value. # Which is required to test a variable on the Anritsu with the users input value. self.stream_queries[':TSTReam:TABLe:ITEM:CONTrol:GAP:IBG?\n'] = str(inter_burst_gap_value) + '\n'
def burst_per_stream(self, burst_per_stream_amount): """Creates messages to define how many burst are needed for this stream. :param burst_per_stream_amount: amount of burst """ # First validate the user input input_validator.value_minimum_maximum(1, 1099511627775, burst_per_stream_amount) # Append the associated command message to the self.commands list, to set a variable on the Anritsu self.commands.append(':TSTReam:TABLe:ITEM:CONTrol:BPSTream ' + str(burst_per_stream_amount) + '\n') # Write the corresponding query message to the self.stream_queries dictionary as a key and the input as it value. # Which is required to test a variable on the Anritsu with the users input value. self.stream_queries[':TSTReam:TABLe:ITEM:CONTrol:BPSTream?\n'] = str(burst_per_stream_amount) + '\n'
def distribution(self, stream_distribution_type, jump_to_id=None, count=None): """Creates messages to define the type of distribution of the stream. :param stream_distribution_type: can choose from 'CONT', 'CONT_BURST', 'STOP', 'NEXT', 'JUMP', 'JUMP_COUNT', 'JUMP_STOP'. :param jump_to_id: if the distribution type is 'JUMP', 'JUMP_COUNT', 'JUMP_STOP', this parameter represents to what stream ID to JUMP to. Expects to be a number between 1 and 256 (requirement: the stream id must be already set on the Anritsu) :param count: if the distribution type is 'JUMP_COUNT', 'JUMP_STOP'. This parameter sets the loop count, which is the amount of jumps, before this stream stops. Expects to be a number between 1 and 256. """ # First validate the user input input_validator.string_set(['CONT', 'CONT_BURST', 'STOP', 'NEXT', 'JUMP', 'JUMP_COUNT', 'JUMP_STOP'], stream_distribution_type) # Append the associated command message to the self.commands list, to set a variable on the Anritsu self.commands.append(':TSTReam:TABLe:ITEM:CONTrol:DISTribution ' + str(stream_distribution_type) + '\n') # Write the corresponding query message to the self.stream_queries dictionary as a key and the input as it value. # Which is required to test a variable on the Anritsu with the users input value. self.stream_queries[':TSTReam:TABLe:ITEM:CONTrol:DISTribution?\n'] = str(stream_distribution_type) + '\n' # Expect extra parameters when a certain subset of the first argument is set and append the required command and query messages. if stream_distribution_type == 'JUMP': input_validator.value_minimum_maximum(1, 256, jump_to_id) self.commands.append(':TSTReam:TABLe:ITEM:CONTrol:JTID ' + str(jump_to_id) + '\n') self.stream_queries[':TSTReam:TABLe:ITEM:CONTrol:JTID?\n'] = str(jump_to_id) + '\n' elif stream_distribution_type == 'JUMP_COUNT' or stream_distribution_type == 'JUMP_STOP': input_validator.value_minimum_maximum(1, 256, jump_to_id) input_validator.value_minimum_maximum(1, 16000000, count) self.commands.append(':TSTReam:TABLe:ITEM:CONTrol:JTID ' + str(jump_to_id) + '\n') self.commands.append(':TSTReam:TABLe:ITEM:CONTrol:COUNt ' + str(count) + '\n') self.stream_queries[':TSTReam:TABLe:ITEM:CONTrol:JTID?\n'] = str(jump_to_id) + '\n' self.stream_queries[':TSTReam:TABLe:ITEM:CONTrol:COUNt?\n'] = str(count) + '\n'
def test_frame(self, test_type, length_or_offset=None, flow_id=None): """Adds a test frame in the frame its data field :param test_type: the type of test used, can select out of the following set: 'PRBS', 'flow'. :param length_or_offset: the length in bytes of a PRBS test frame and the offset in bytes of a flow test frame. :param flow_id: when a flow test frame is selected, this is the ID. """ input_validator.string_set(['PRBS', 'FLOW'], test_type) if test_type == 'PRBS': input_validator.value_minimum_maximum(46, 65517, length_or_offset) self.commands.append(':TSTReam:TABLe:ITEM:FRAMe:DFIeld1:ENABle 1\n') self.commands.append(':TSTReam:TABLe:ITEM:FRAMe:DFIeld1:TYPE TEST_FRAME\n') self.commands.append(':TSTReam:TABLe:ITEM:FRAMe:DFIeld1:TFRame:TYPE ' + str(test_type) + '\n') self.frame_queries[':TSTReam:TABLe:ITEM:FRAMe:DFIeld1:ENABle?\n'] = '1\n' self.frame_queries[':TSTReam:TABLe:ITEM:FRAMe:DFIeld1:ITFRame?\n'] = '1\n' self.frame_queries[':TSTReam:TABLe:ITEM:FRAMe:DFIeld1:TYPE?\n'] = 'TEST_FRAME\n' self.frame_queries[':TSTReam:TABLe:ITEM:FRAMe:DFIeld1:TFRame:TYPE?\n'] = str(test_type) + '\n' if length_or_offset != None: self.commands.append(':TSTReam:TABLe:ITEM:FRAMe:DFIeld1:LENGth ' + str(length_or_offset) + '\n') self.frame_queries[':TSTReam:TABLe:ITEM:FRAMe:DFIeld1:LENGth?\n'] = str(length_or_offset) + '\n' elif test_type == 'FLOW': input_validator.value_minimum_maximum(28, 65499, length_or_offset) input_validator.value_minimum_maximum(0, 65535, flow_id) self.commands.append(':TSTReam:TABLe:ITEM:FRAMe:DFIeld1:ENABle 1\n') self.commands.append(':TSTReam:TABLe:ITEM:FRAMe:DFIeld1:TYPE TEST_FRAME\n') self.commands.append(':TSTReam:TABLe:ITEM:FRAMe:DFIeld1:TFRame:TYPE FLOW_ID\n') self.commands.append(':TSTReam:TABLe:ITEM:FRAMe:DFIeld1:TFRame:FID ' + str(flow_id) + '\n') self.frame_queries[':TSTReam:TABLe:ITEM:FRAMe:DFIeld1:ENABle?\n'] = '1\n' self.frame_queries[':TSTReam:TABLe:ITEM:FRAMe:DFIeld1:TYPE?\n'] = 'TEST_FRAME\n' self.frame_queries[':TSTReam:TABLe:ITEM:FRAMe:DFIeld1:TFRame:TYPE?\n'] = 'FLOW_ID\n' self.frame_queries[':TSTReam:TABLe:ITEM:FRAMe:DFIeld1:TFRame:FID?\n'] = str(flow_id) + '\n' if length_or_offset != None: self.commands.append(':TSTReam:TABLe:ITEM:FRAMe:DFIeld1:OFFSet ' + str(length_or_offset) + '\n') self.frame_queries[':TSTReam:TABLe:ITEM:FRAMe:DFIeld1:OFFSet?\n'] = str(length_or_offset) + '\n'
def frame_size(self, frame_size_type, frame_size_value=None, frame_size_maximum=None): """Creates messages to define what frame size type is needed. :param frame_size_type: the type of frame size, which can be 'AUTO', 'FIXED', 'INCREMENT', 'RANDOM' :param frame_size_value param: if the frame size type is 'AUTO', this value is ignored. If 'FIXED' it is the frame size. If 'INCREMENT' or 'RANDOM', it is the minimum frame size. :param frame_size_maximum: ignored with frame size type 'AUTO' and 'FIXED'. If it is 'INCREMENT' or 'RANDOM' it is the maximum frame size. """ input_validator.string_set(['AUTO', 'FIXED', 'INCREMENT', 'RANDOM'], frame_size_type) if frame_size_type == 'AUTO': self.commands.append(':TSTReam:TABLe:ITEM:FSIZe:TYPE ' + str(frame_size_type) + '\n') self.stream_queries[':TSTReam:TABLe:ITEM:FSIZe:TYPE?\n'] = str(frame_size_type) + '\n' elif frame_size_type == 'FIXED': input_validator.value_minimum_maximum(8, 65280, frame_size_value) self.commands.append(':TSTReam:TABLe:ITEM:FSIZe:TYPE ' + str(frame_size_type) + '\n') self.commands.append(':TSTReam:TABLe:ITEM:FSIZe:VALue ' + str(frame_size_value) + '\n') self.stream_queries[':TSTReam:TABLe:ITEM:FSIZe:TYPE?\n'] = str(frame_size_type) + '\n' self.stream_queries[':TSTReam:TABLe:ITEM:FSIZe:VALue?\n'] = str(frame_size_value) + '\n' elif frame_size_type == 'INCREMENT': input_validator.value_minimum_maximum(8, 65280, frame_size_value) self.commands.append(':TSTReam:TABLe:ITEM:FSIZe:TYPE ' + str(frame_size_type) + '\n') self.commands.append(':TSTReam:TABLe:ITEM:FSIZe:MINimum ' + str(frame_size_value) + '\n') self.commands.append(':TSTReam:TABLe:ITEM:FSIZe:MAXimum ' + str(frame_size_maximum) + '\n') self.stream_queries[':TSTReam:TABLe:ITEM:FSIZe:TYPE?\n'] = str(frame_size_type) + '\n' self.stream_queries[':TSTReam:TABLe:ITEM:FSIZe:MINimum?\n'] = str(frame_size_value) + '\n' self.stream_queries[':TSTReam:TABLe:ITEM:FSIZe:MAXimum?\n'] = str(frame_size_maximum) + '\n' elif frame_size_type == 'RANDOM': input_validator.value_minimum_maximum(8, 65280, frame_size_value) self.commands.append(':TSTReam:TABLe:ITEM:FSIZe:TYPE ' + str(frame_size_type) + '\n') self.commands.append(':TSTReam:TABLe:ITEM:FSIZe:MINimum ' + str(frame_size_value) + '\n') self.commands.append(':TSTReam:TABLe:ITEM:FSIZe:MAXimum ' + str(frame_size_maximum) + '\n') self.stream_queries[':TSTReam:TABLe:ITEM:FSIZe:TYPE?\n'] = str(frame_size_type) + '\n' self.stream_queries[':TSTReam:TABLe:ITEM:FSIZe:MINimum?\n'] = str(frame_size_value) + '\n' self.stream_queries[':TSTReam:TABLe:ITEM:FSIZe:MAXimum?\n'] = str(frame_size_maximum) + '\n'
def inter_frame_gap(self, inter_frame_gap_type, inter_frame_gap_value, inter_frame_gap_maximum=None): """Creates messages to define the Inter Frame Gap (IFG). :param inter_frame_gap_type: the type of IFG, which can be 'FIXED' or 'RANDOM'. :param inter_frame_gap_value: if the IFG type is 'FIXED', this will be the fixed IFG in nanosecond (ns). If its 'RANDOM', the keyword represents the minimum time in ns. :param inter_frame_gap_maximum: if the IFG type is 'RANDOM', this keyword is the maximum time in ns. """ # First validate the user input input_validator.string_set(['FIXED', 'RANDOM'], inter_frame_gap_type) if inter_frame_gap_type == 'FIXED': input_validator.value_minimum_maximum(1, 1200000000000, inter_frame_gap_value) # Append the associated command message to the self.commands list, to set a variable on the Anritsu self.commands.append(':TSTReam:TABLe:ITEM:CONTrol:GAP:IFG:TYPE ' + str(inter_frame_gap_type) + '\n') self.commands.append(':TSTReam:TABLe:ITEM:CONTrol:GAP:IFG:VALue ' + str(inter_frame_gap_value) + '\n') # Write the corresponding query message to the self.stream_queries dictionary as a key and the input as it value. # Which is required to test a variable on the Anritsu with the users input value. self.stream_queries[':TSTReam:TABLe:ITEM:CONTrol:GAP:IFG:TYPE?\n'] = str(inter_frame_gap_type) + '\n' self.stream_queries[':TSTReam:TABLe:ITEM:CONTrol:GAP:IFG:VALue?\n'] = str(inter_frame_gap_value) + '\n' if inter_frame_gap_type == 'RANDOM': input_validator.value_minimum_maximum(1, 1200000000000, inter_frame_gap_value) input_validator.value_minimum_maximum(1, 1200000000000, inter_frame_gap_maximum) # Append the associated command message to the self.commands list, to set a variable on the Anritsu self.commands.append(':TSTReam:TABLe:ITEM:CONTrol:GAP:IFG:TYPE ' + str(inter_frame_gap_type) + '\n') self.commands.append(':TSTReam:TABLe:ITEM:CONTrol:GAP:IFG:MINimum ' + str(inter_frame_gap_value) + '\n') self.commands.append(':TSTReam:TABLe:ITEM:CONTrol:GAP:IFG:MAXimum ' + str(inter_frame_gap_maximum) + '\n') # Write the corresponding query message to the self.stream_queries dictionary as a key and the input as it value. # Which is required to test a variable on the Anritsu with the users input value. self.stream_queries[':TSTReam:TABLe:ITEM:CONTrol:GAP:IFG:TYPE?\n'] = str(inter_frame_gap_type) + '\n' self.stream_queries[':TSTReam:TABLe:ITEM:CONTrol:GAP:IFG:VALue?\n'] = str(inter_frame_gap_value) + '\n' self.stream_queries[':TSTReam:TABLe:ITEM:CONTrol:GAP:IFG:MAXimum?\n'] = str(inter_frame_gap_maximum) + '\n'