Printer FriendlyEmail Article Link

Sprirent TestCenter-JTAPI:How to create custom property using DRV?

Environment/Versions
  • Spirent TestCenter
  • Automation-JTAPI
  • DRV
Answer

This feature is implemented in t4.49 of JTAPI

$rt->get_results_drv()
    [custom_drv]
        [custom_property]
            [property_name <name>]
            [expression_type [MATH | BOOL]]
            [equation]
            [depended_counters]
            [precision]

[property_name]
    Specify the result property name.
    Note:
        * In order to return the custom property value in return result hash, user need to specify custom property in "properties" option. (The property name must be specified with "Custom.<property_name>")
          (Refer, the example below for reference.)
        * Custom return output: STC prepends 'Custom' before the specified property name. [Example, if property_name is specified as 'dropped' then return output name would be 'Customdropped']

[expression_type]
    Expression type for equation.
    Default: MATH

[depended_counters]
    Specify result properties required to evaluate equation.

[equation]
    Specify the equation that indicates how to evaluate the result property. Properties specified in 'depended_counters' only can be used in the equation.

[precision]
    Specify the precision for result output. (Mainly used in MATH operation)
    Default: 2
   
Below is the sample code:

my @customProperty = ({property_name   => 'dropped1',
                      expression_type => 'MATH',
                      depended_counters => 'StreamBlock.TxFrameCount StreamBlock.RxSigFrameCount',
                      equation        => "StreamBlock.TxFrameCount - StreamBlock.RxSigFrameCount",
                      precision       => 2},
                      {property_name   => 'dropped2',
                      expression_type => 'BOOL',
                      depended_counters => 'StreamBlock.TxFrameCount StreamBlock.RxSigFrameCount',
                      equation        => "StreamBlock.TxFrameCount == StreamBlock.RxSigFrameCount",
                      precision       => 4});

my $custom_drv1 = { properties =>'StreamBlock.StreamId StreamBlock.TxFrameCount StreamBlock.RxFrameCount StreamBlock.FrameConfig.ethernet:EthernetII.vlans.Vlan.1.id Custom.dropped1 Custom.dropped2',
                  name         => 'drv_vlan1',
                  from         => "$mystream1 [0]",
                  where        => 'StreamBlock.FrameConfig.ethernet:EthernetII.vlans.Vlan.1.id = 1',
                  custom_property => \@customProperty};

my $res3 = $rt->get_results_drv(custom_drv=>$custom_drv1, size=>2000);


Product : Spirent TestCenter,Automation,API,Spirent TestCenter