JN Test Suite Platform: XML Script Examples for Different Protocols

The test logic for a particular test is presented as a state machine containing states and transitions between the states.

A typical scenario where JN Test Suite is used for service prototyping includes:

  • entering a state and sending a service request towards the tested service
  • waiting for inbound events associated with service response
  • checking the received service response and moving to another state, or to the end of the test
  • repeating the steps listed above

A typical scenario where JN Test Suite is used for service prototyping includes:

  • entering a state and waiting for inbound events associated with an indication sent by the tested service
  • checking the received service indication and moving to another state, or to the end of the test
  • entering another state and sending a service response towards the tested service
  • repeating the steps listed above

State Chart XML notation

State Chart XML (SCXML) syntax is applied for describing the state machine associated with a test. It is an open standard introduced by World Wide Web Consortium (W3C), http://www.w3.org/TR/scxml/

SCXML syntax contains standard XML tags representing the state machine concepts (states, transitions, etc.). JN Test Suite adds custom XML tags for representing communications protocol messages, operations and parameters, for example:

<isup:iam> <sccp:destination_address> <map2:update_location> <cap2:initial_dp>
<sip:invoke> <diameter:ccr> ... etc.

JN Test Suite interprets the XML scripts and produces the associated protocol specific messaging behind the custom tags.

JN Test Suite API provides functionality for automatic conversion of binary protocol messages to corresponding XML notation. For example, copy the binary message from Wireshark and paste it in JN Test Suite Console: the XML notation for this message will be returned.


MAP Test Script Example

<scxml>
  <!-- Some definitions here -->
  <state id="begin">
    <onentry>
      <begin targetlocation="tcapDialog" xmlns="urn:jnts:tcap">
        <tcap:dialog>
          <tcap:ac_name>network_loc_up_context.2</tcap:ac_name>
          <destination_address xmlns="urn:jnts:sccp">
            <ssn expr="_x.params.destination_address_ssn"/>
            <global_title>
              <address expr="_x.params.destination_address_global_title_address"/>
            </global_title>
          </destination_address>
          <origination_address xmlns="urn:jnts:sccp">
            <ssn expr="_x.params.origination_address_ssn"/>
            <global_title>
              <address expr="_x.params.origination_address_global_title_address"/>
            </global_title>
          </origination_address>
        </tcap:dialog>
        <!-- create and schedule invoke -->
        <components>
          <component>
            <invoke>
              <invoke_operation xmlns="urn:jnts:map2">
                <map2:update_location>
                  <map2:imsi>
                    <map2:mcc expr="_x.params.imsi_mcc"/>
                    <map2:mnc expr="_x.params.imsi_mnc"/>
                    <map2:msin expr="_x.params.imsi_msin"/>
                  </map2:imsi>
                  <map2:location_info>
                    <map2:msc_number>
                      <map2:nature_of_address_indicator>1</map2:nature_of_address_indicator>
                      <map2:numbering_plan_indicator>4</map2:numbering_plan_indicator>
                      <map2:address expr="_x.params.msc_address"/>
                    </map2:msc_number>
                  </map2:location_info>
                  <map2:vlr_number>
                    <map2:nature_of_address_indicator>1</map2:nature_of_address_indicator>
                    <map2:numbering_plan_indicator>4</map2:numbering_plan_indicator>
                    <map2:address expr="_x.params.vlr_address"/>
                  </map2:vlr_number>
                  <map2:lmsi>0000C268</map2:lmsi>
                </map2:update_location>
              </invoke_operation>
            </invoke>
          </component>
        </components>
      </begin>
    </onentry>

    <transition event="tcap.continue" target="wait_isd1">
      <!-- Eventually check the recieved message content  -->
    </transition>
  </state>

  <!-- Add more states/transitions here -->

  <final id="FailState">
    <onentry>
      <jnts:fail/>
    </onentry>
  </final>

  <final id="EndState">
    <onentry>
      <jnts:success>
        <matched id="isd0"/>
        <matched id="isd1"/>
        <matched id="isd2"/>
        <matched id="ul_result"/>
      </jnts:success>
    </onentry>
  </final>

</scxml>

CAMEL 4 Test Script Example

<scxml>
  <!-- Some definitions go here -->
  <state id="test_001" initial="send_idp">
    <state id="send_idp">
      <onentry>
        <!-- create dialog -->
        <begin targetlocation="tcapDialog1Id" xmlns="urn:jnts:tcap">
          <dialog xmlns="urn:jnts:tcap">
            <ac_name>cap4_gsmssf_scfgeneric</ac_name>
            <destination_address xmlns="urn:jnts:sccp">
              <ssn expr="_x.params.destination_address_ssn"/>
              <global_title>
                <address expr="_x.params.destination_address_global_title_address"/>
              </global_title>
            </destination_address>
            <origination_address xmlns="urn:jnts:sccp">
              <ssn expr="_x.params.origination_address_ssn"/>
              <global_title>
                <address expr="_x.params.origination_address_global_title_address"/>
              </global_title>
            </origination_address>
          </dialog>
          <!-- create and schedule invoke -->
          <components>
            <component>
              <invoke>
                <invoke_operation xmlns="urn:jnts:cap4">
                  <initial_dp xmlns="urn:jnts:cap4"  template="resource:initial_dp">
                    <service_key expr="_x.params.sk_for_mr_service" />

                    <called_party_number>
                      <address expr="_x.params.called_party_number_address"/>
                    </called_party_number>

                    <calling_party_number>
                      <address expr="_x.params.calling_party_number_address"/>
                    </calling_party_number>

                    <calling_party_category>0xA</calling_party_category>

                    <location_number>
                      <address expr="_x.params.location_number_address"/>
                    </location_number>

                    <bearer_capability expr="_x.params.bearer_cap"/>

                    <event_type_bcsm>term_attempt_authorized</event_type_bcsm>

                    <imsi>
                      <mcc expr="_x.params.imsi_mcc"/>
                      <mnc expr="_x.params.imsi_mnc"/>
                      <msin expr="_x.params.imsi_msin"/>
                    </imsi>

                    <call_reference_number expr="_x.params.call_reference_number"/>

                    <msc_address>
                      <address expr="_x.params.msc_address_address"/>
                    </msc_address>

                    <time_and_timezone expr="jnts.localtime()"/>
                  </initial_dp>
                </invoke_operation>
              </invoke>
            </component>
          </components>
        </begin>
      </onentry>

      <transition event="tcap.continue" target="send_erb_answer">
        <tcap:continue expr="_event.data" id="rrb_cue">
          <!-- Eventually check the recieved message content  -->
        </tcap:continue>
      </transition>
    </state>

    <!-- Add more states/transitions here -->

    <final id="End">
      <onentry>
        <jnts:success>
          <matched id="rrb_cue"/>
          <matched id="tcEnd"/>
        </jnts:success>
      </onentry>
    </final>

</scxml>

SIP Test Script Example

<scxml xmlns="http://www.w3.org/2005/07/scxml"
       version="1.0"
       initial="Begin"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:jnts="urn:jnts:jnts"
       xmlns:sip="urn:jnts:sip"
       xmlns:ct="urn:jnts:common"
       xsi:schemaLocation='urn:jnts:sip ../../../../xsd/sip.xsd'
       >

  <datamodel>
    <data id="script_name" expr="'sip2sip_uac'+_tid" />
    <data id="sip_dialog"/>
    <data id="uas_notify"/>
  </datamodel>

  <state id="Begin">
    <onentry>
      <sip:profile id="p1">
        <sip:interface-address expr="_x.params.uac_ip" />
        <sip:transport expr="_x.params.uac_transport" />
      </sip:profile>
      <invite targetlocation="sip_dialog" profile="p1" xmlns="urn:jnts:sip">
        <request-uri expr="_x.params.b_party"/>
        <from expr="_x.params.a_party"/>
        <to expr="_x.params.b_party"/>
        <contact expr="_x.params.a_party"/>
        <p-asserted-identity expr="_x.params.uac_pai"/>
        <p-preferred-identity expr="_x.params.uac_ppi"/>
        <route expr="_x.params.route_sipas"/>
        <route expr="_x.params.local_route.replace('${_tid}', _tid)"/>
        <content>
          <type>application/sdp</type>
          <value expr="_x.config.uac_sdp"/>
        </content>
      </invite>

    </onentry>
    <transition event="jnts.notifyscript">
      <assign name="uas_notify" expr="_event.data['uas_request_uri_userpart']"/>
    </transition>

    <transition event="sip.provisional-response"/>

    <transition event="sip.success-response">
      <sip:success-response expr="_event.data" id="InviteOkMatched">
        <sip:status>200</sip:status>
      </sip:success-response>

      <sip:ack targetexpr="_event.origin"/>
      <jnts:timer expire_after="2" id="bye_timer"/>
    </transition>

    <transition event="jnts.timer.bye_timer" target="bye"/>
    <transition event="error.platform" target="state_error"/>
  </state>

  <state id="bye">
    <onentry>
      <sip:bye targetexpr="sip_dialog">
        <sip:contact expr="_x.params.a_party"/>
      </sip:bye>
    </onentry>
    <transition event="sip.success-response" target="end">
      <sip:success-response expr="_event.data" id="ByeOkMatched">
        <sip:status>200</sip:status>
      </sip:success-response>
    </transition>
    <transition event="error.platform" target="state_error"/>
  </state>

  <final id="end">
    <onentry>
      <if cond="(uas_notify==_x.params.b_party_userpart)">
        <jnts:success>
          <matched id="ByeOkMatched"/>
          <matched id="InviteOkMatched"/>
        </jnts:success>
      </if>
    </onentry>
  </final>

  <final id="state_error"/>
</scxml>

DIAMETER Test Script Example

<scxml xmlns="http://www.w3.org/2005/07/scxml"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       version="1.0"
       xmlns:jnts="urn:jnts:jnts"
       xmlns:diameter="urn:jnts:diameter"
       initial="diameter_test_001">

  <datamodel>
    <data id="acID"/>
  </datamodel>

  <state id="diameter_test_001" initial="send_ccr">
    <state id="send_ccr">
      <onentry>
        <jnts:timer id="t1" expire_after="1"/>
        <ccr xmlns="urn:jnts:diameter" targetlocation="acID">
          <diameter:code>272</diameter:code>
          <diameter:app-id>4</diameter:app-id>
          <diameter:session-id>prepaid.ggsn1;16;16160502;2840110605393995</diameter:session-id>
          <diameter:origin-host>prepaid.ggsn1</diameter:origin-host>
          <diameter:origin-realm>vodafone</diameter:origin-realm>
          <diameter:destination-realm>mobicents.org</diameter:destination-realm>
          <diameter:avp>
            <diameter:code>1</diameter:code>
            <diameter:vendor-id>10415</diameter:vendor-id>
            <diameter:value>284011060539399</diameter:value>
          </diameter:avp>
          <diameter:avp>
            <diameter:code>10</diameter:code>
            <diameter:vendor-id>10415</diameter:vendor-id>
            <diameter:value>5</diameter:value>
          </diameter:avp>
          <diameter:avp>
            <diameter:code>12</diameter:code>
            <diameter:vendor-id>10415</diameter:vendor-id>
            <diameter:value>0</diameter:value>
          </diameter:avp>
          <diameter:avp>
            <diameter:code>13</diameter:code>
            <diameter:vendor-id>10415</diameter:vendor-id>
            <diameter:value>0005</diameter:value>
          </diameter:avp>
          <diameter:avp>
            <diameter:code>18</diameter:code>
            <diameter:vendor-id>10415</diameter:vendor-id>
            <diameter:value>28401</diameter:value>
          </diameter:avp>
          <diameter:avp>
            <diameter:code>262</diameter:code>
            <diameter:vendor-id>12645</diameter:vendor-id>
            <diameter:value>vodafone-nontra</diameter:value>
          </diameter:avp>
          <diameter:auth-application-id>4</diameter:auth-application-id>
          <diameter:cc-request-type>INITIAL_REQUEST</diameter:cc-request-type>
          <diameter:cc-request-number>0</diameter:cc-request-number>
          <diameter:origin-state-id>0</diameter:origin-state-id>
          <diameter:multiple-services-credit-control/>
          <diameter:service-context-id>version1.clci.ipc@vodafone.com</diameter:service-context-id>
          <diameter:event-timestamp>1159801741000</diameter:event-timestamp>
          <diameter:requested-service-unit/>
          <diameter:multiple-services-indicator>MULTIPLE_SERVICES_SUPPORTED</diameter:multiple-services-indicator>
        </ccr>
      </onentry>

      <transition event="jnts.timer.t1" target="wait_cca">
      </transition>
    </state>

    <state id="wait_cca">
      <transition event="diameter.cca" target="End">
        <cca xmlns="urn:jnts:diameter" expr="_event.data" id="ccaMatched">
        </cca>
      </transition>
    </state>
  </state>

  <final id="End">
    <onentry>
      <jnts:success>
        <matched id="ccaMatched"/>
      </jnts:success>
    </onentry>
  </final>
</scxml>