<?xml version="1.0" encoding="utf-8" ?>
<!ELEMENT tsung (information?, clients, servers, monitoring?, load, options?, sessions)>

<!ELEMENT information (name|description|username|organisation)*>


<!ELEMENT name (#PCDATA)>
<!ELEMENT description (#PCDATA)>
<!ELEMENT username (#PCDATA)>
<!ELEMENT organisation (#PCDATA)>

<!ATTLIST tsung
     dumptraffic (true | false | light | protocol) "false"
     backend     (text | json| rrdtool | fullstats) "text"
     loglevel    (emergency|critical|error|warning|notice|info|debug) "notice"
     version     NMTOKEN #IMPLIED>

<!ELEMENT servers (server+)>
<!ELEMENT server EMPTY>
<!ATTLIST server
     host NMTOKEN #REQUIRED
     port NMTOKEN #REQUIRED
     type (ssl | tcp | udp | erlang | ssl6 | tcp6 | udp6) #REQUIRED>

<!ELEMENT clients (client+)>
<!ELEMENT client (ip*) >
<!ATTLIST client
     cpu      NMTOKEN "1"
     type     (machine | batch)  "machine"
     host     NMTOKEN #IMPLIED
     batch    (torque | pbs | lsf | oar) #IMPLIED
     scan_intf NMTOKEN #IMPLIED
     maxusers NMTOKEN "800"
     use_controller_vm (true | false) "false"
     weight   NMTOKEN "1">

<!ELEMENT ip EMPTY>
<!ATTLIST ip
          value NMTOKEN #REQUIRED
          scan (true| false)  "false"
>

<!ELEMENT monitoring ( monitor+ )>
<!ELEMENT monitor ( snmp? | munin?)>
<!ATTLIST monitor
     host NMTOKEN #REQUIRED
     batch (true | false) "false"
     type (snmp | erlang | munin) "erlang">

<!ELEMENT snmp (oid)*>
<!ATTLIST snmp
     version   (v1 | v2) "v1"
     community NMTOKEN "public"
     port      NMTOKEN "161">

<!ELEMENT oid EMPTY>
<!ATTLIST oid
     value   NMTOKEN #REQUIRED
     name    NMTOKEN #REQUIRED
     type    NMTOKEN "sample"
     eval    CDATA   #IMPLIED>

<!ELEMENT munin EMPTY>
<!ATTLIST munin
     port      NMTOKEN "4949">

<!ELEMENT load (arrivalphase | user)+>
<!ATTLIST load
     duration NMTOKEN #IMPLIED
     unit     (hour | minute | second) "second"
     loop     NMTOKEN "0"
     >

<!ELEMENT arrivalphase (users)>
<!ATTLIST arrivalphase
     duration NMTOKEN #REQUIRED
     phase    NMTOKEN #REQUIRED
     unit     (hour | minute | second | millisecond) #REQUIRED>

<!ELEMENT users EMPTY>
<!ATTLIST users
     interarrival NMTOKEN #IMPLIED
     arrivalrate  NMTOKEN #IMPLIED
     unit (hour | minute | second) #REQUIRED
     maxnumber NMTOKEN #IMPLIED>

<!ELEMENT user EMPTY>
<!ATTLIST user
     start_time NMTOKEN #IMPLIED
     unit (hour | minute | second  | millisecond) "second"
     session      NMTOKEN #REQUIRED>

<!ELEMENT options (option*)>
<!ELEMENT option (user_agent*)>
<!ATTLIST option
    name     NMTOKEN #REQUIRED
    override (true | false) #IMPLIED
    random   (true | false) #IMPLIED
    id       NMTOKEN #IMPLIED
    min      NMTOKEN #IMPLIED
    max      NMTOKEN #IMPLIED
    type     (ts_http | ts_jabber | ts_pgsql) #IMPLIED
    value    CDATA #IMPLIED>

<!ELEMENT set_option (user_agent*)>
<!ATTLIST set_option
    name     NMTOKEN #REQUIRED
    id       NMTOKEN #IMPLIED
    min      NMTOKEN #IMPLIED
    max      NMTOKEN #IMPLIED
    type     (ts_http | ts_jabber | ts_pgsql) #IMPLIED
    value    CDATA #IMPLIED>

<!ELEMENT sessions (session+)>
<!ELEMENT session ( request | thinktime | transaction | setdynvars | for |
repeat | if | change_type | foreach | set_option)*>
<!ATTLIST session
    name         CDATA #REQUIRED
    bidi         CDATA #IMPLIED
    persistent   (true | false) #IMPLIED
    probability   NMTOKEN #REQUIRED
    type         (ts_jabber | ts_http | ts_raw | ts_pgsql | ts_ldap | ts_webdav |ts_mysql| ts_fs |ts_shell|ts_job) #REQUIRED>

<!ELEMENT change_type EMPTY>
<!ATTLIST change_type
     new_type         (ts_jabber | ts_http | ts_raw | ts_pgsql | ts_ldap | ts_webdav |ts_mysql| ts_fs | ts_shell|ts_job) #REQUIRED
     host NMTOKEN #REQUIRED
     port NMTOKEN #REQUIRED
     server_type NMTOKEN #REQUIRED
     store  ( true | false ) "false"
     restore ( true | false ) "false"
    >

<!ELEMENT request ( match*, dyn_variable*, ( http | jabber | raw |
          pgsql | ldap | mysql |fs | shell | job ) )>
<!ATTLIST request
    subst (true|false) "false"
    >

<!ELEMENT match (#PCDATA)>
<!ATTLIST match
    do (continue|loop|abort|restart|log|dump) "continue"
    when (match|nomatch) "match"
    subst (true|false) "false"
    loop_back   NMTOKEN "0"
    max_loop    NMTOKEN "20"
    max_restart NMTOKEN "3"
    sleep_loop  NMTOKEN "5"
    apply_to_content  NMTOKEN "undefined"
    skip_headers      NMTOKEN "no"
    >

<!ELEMENT thinktime EMPTY>
<!ATTLIST thinktime
    random (true|false) "false"
    value  CDATA #IMPLIED
    min    NMTOKEN #IMPLIED
    max    NMTOKEN #IMPLIED
    >

<!ELEMENT user_agent (#PCDATA)*>
<!ATTLIST user_agent
    probability NMTOKEN #REQUIRED
    >

<!ELEMENT transaction (request | setdynvars | thinktime | for | repeat
          | if | foreach)+>
<!ATTLIST transaction name NMTOKEN #REQUIRED>

<!ELEMENT http ( www_authenticate?, soap?, http_header*, add_cookie*)>
<!ATTLIST http
    contents           CDATA #IMPLIED
    contents_from_file CDATA #IMPLIED
    content_type       CDATA #IMPLIED
    if_modified_since  CDATA #IMPLIED
    method             (GET | POST | PUT | DELETE | HEAD | PROPFIND | PROPPATCH | COPY | MOVE | LOCK | UNLOCK | MKCOL | MKACTIVITY | OPTIONS | REPORT | VERSION-CONTROL | MERGE | CHECKOUT) "GET"
    url                CDATA #REQUIRED
    version            (1.0 | 1.1) "1.1" >

<!ELEMENT soap EMPTY >
<!ATTLIST soap action CDATA #REQUIRED >

<!ELEMENT dyn_variable EMPTY >
<!ATTLIST dyn_variable
    name     CDATA #REQUIRED
    xpath    CDATA #IMPLIED
    re    CDATA #IMPLIED
    jsonpath CDATA #IMPLIED
    pgsql_expr CDATA #IMPLIED
    regexp   CDATA #IMPLIED >

<!ELEMENT http_header EMPTY >
<!ATTLIST http_header
    name     CDATA #REQUIRED
    encoding CDATA #IMPLIED
    value    CDATA #IMPLIED >

<!ELEMENT add_cookie EMPTY >
<!ATTLIST add_cookie
    key     CDATA #REQUIRED
    domain  CDATA #IMPLIED
    path    CDATA #IMPLIED
    value   CDATA #REQUIRED >

<!ELEMENT www_authenticate EMPTY >
<!ATTLIST www_authenticate
    passwd CDATA #REQUIRED
    userid CDATA #REQUIRED >

<!ELEMENT jabber (xmpp_authenticate?) >
<!ATTLIST jabber
    ack         (global | local | no_ack | parse) #REQUIRED
    destination (online | offline | random | unique | previous) "random"
    id          NMTOKEN #IMPLIED
    size        NMTOKEN "0"
    data        CDATA   #IMPLIED
    type        NMTOKEN #REQUIRED
    show        (away|chat|dnd|xa) "chat"
    status      CDATA   "Available"
    nick        CDATA #IMPLIED
    room        CDATA #IMPLIED
    group       CDATA #IMPLIED
    node        CDATA #IMPLIED
    regexp        CDATA #IMPLIED
    node_type   CDATA #IMPLIED >

<!ELEMENT xmpp_authenticate EMPTY >
<!ATTLIST xmpp_authenticate
    passwd   CDATA #REQUIRED
    username CDATA #REQUIRED >


<!ELEMENT fs EMPTY >
<!ATTLIST fs
    cmd      (read|write|open|delete|stats|copy|read_chunk|write_chunk|close|make_dir|del_dir)  "write"
    path     CDATA   #IMPLIED
    size     CDATA   "1024"
    position CDATA   #IMPLIED
    mode     (read | write | append ) #IMPLIED
    dest     CDATA   #IMPLIED
>

<!ELEMENT shell EMPTY >
<!ATTLIST shell
    cmd      CDATA   #REQUIRED
    args     CDATA   ""
>

<!ELEMENT job EMPTY >
<!ATTLIST job
    type     (oar|torque) "oar"
    req      (submit|delete|stat|suspend|resume|wait_jobs) #REQUIRED
    script   CDATA     #IMPLIED
    walltime CDATA     #IMPLIED
    duration CDATA     #IMPLIED
    jobid    CDATA     #IMPLIED
    resources CDATA    #IMPLIED
    nodes    CDATA   #IMPLIED
    queue    CDATA   #IMPLIED
    options  CDATA     #IMPLIED
    user     CDATA   #IMPLIED
    name     CDATA   "tsung"
    notify_port  CDATA   #IMPLIED
    notify_script  CDATA   #IMPLIED
>

<!ELEMENT pgsql (#PCDATA) >
<!ATTLIST pgsql
    password     CDATA   #IMPLIED
    database     CDATA   #IMPLIED
    username     CDATA   #IMPLIED
    name_portal   CDATA   #IMPLIED
    name_prepared CDATA   #IMPLIED
    query         CDATA   #IMPLIED
    parameters    CDATA   #IMPLIED
    max_rows      CDATA   "0"
    formats       CDATA   #IMPLIED
    formats_results CDATA   #IMPLIED
    contents_from_file CDATA #IMPLIED
    type        (connect | authenticate | sql | close | bind | parse | cancel|call| sync | execute | describe | flush | copy | copydone| copyfail) #REQUIRED >

<!ELEMENT mysql (#PCDATA) >
<!ATTLIST mysql
    password     CDATA   #IMPLIED
    database     CDATA   #IMPLIED
    username     CDATA   #IMPLIED
    type        (connect | authenticate | sql | close) #REQUIRED >

<!ELEMENT raw EMPTY >
<!ATTLIST raw
    ack         (global | local | no_ack) #REQUIRED
    datasize CDATA #IMPLIED
    data     CDATA #IMPLIED>

<!ELEMENT ldap (attr* | modification*) >
<!ATTLIST ldap
    password    CDATA   #IMPLIED
    user        CDATA   #IMPLIED
    type        (bind | unbind | search | start_tls | add | modify ) #REQUIRED
    result_var  CDATA   #IMPLIED
    filter      CDATA   #IMPLIED
    base        CDATA   #IMPLIED
    scope       (singleLevel | baseObject | wholeSubtree) #IMPLIED
    cacertfile  CDATA   #IMPLIED
    keyfile     CDATA   #IMPLIED
    certfile    CDATA   #IMPLIED
    dn          CDATA   #IMPLIED
    >

<!ELEMENT modification (attr*) >
<!ATTLIST modification
    type CDATA #REQUIRED>


<!ELEMENT attr (value+) >
<!ATTLIST attr
    type CDATA #REQUIRED>

<!ELEMENT value (#PCDATA) >


<!ELEMENT setdynvars (var*) >
<!ATTLIST setdynvars
    sourcetype   (random_string | urandom_string | random_number |
          file | erlang | eval| jsonpath)  #REQUIRED
    callback     CDATA   #IMPLIED
    code         CDATA   #IMPLIED
    fileid       CDATA   #IMPLIED
    order        (iter | random ) #IMPLIED
    delimiter    CDATA   #IMPLIED
    length       CDATA   #IMPLIED
    start        CDATA   #IMPLIED
    end          CDATA   #IMPLIED
    from         CDATA   #IMPLIED
    jsonpath     CDATA   #IMPLIED
    >
<!ELEMENT var (#PCDATA) >
<!ATTLIST var
    name CDATA #REQUIRED>

<!ELEMENT for (request | thinktime | transaction | setdynvars | for |
          if | repeat | change_type | foreach )+>
<!ATTLIST for
    var      CDATA      #REQUIRED
    from     CDATA      #REQUIRED
    to       CDATA      #REQUIRED
    incr     NMTOKEN   "1">

<!ELEMENT foreach (request | thinktime | transaction | setdynvars | foreach |
          if | repeat | change_type | for )+>
<!ATTLIST foreach
    name     NMTOKEN    #REQUIRED
    in       NMTOKEN    #REQUIRED
    include    CDATA    #IMPLIED
    exclude    CDATA    #IMPLIED
>

<!ELEMENT repeat (request | thinktime | transaction | setdynvars | for | repeat
| while | if | until | change_type | foreach )+>
<!ATTLIST repeat
    name      NMTOKEN    #REQUIRED
    max_repeat  NMTOKEN   "20">

<!ELEMENT if (request | thinktime | transaction | setdynvars | for | repeat
| while | if | until | change_type | foreach)+>
<!ATTLIST if
    var       CDATA #REQUIRED
    eq        CDATA #IMPLIED
    neq       CDATA #IMPLIED >

<!ELEMENT while EMPTY>
<!ATTLIST while
    var  CDATA #REQUIRED
    eq   CDATA #IMPLIED
    neq  CDATA #IMPLIED >

<!ELEMENT until EMPTY>
<!ATTLIST until
    var  CDATA #REQUIRED
    eq   CDATA #IMPLIED
    neq  CDATA #IMPLIED >

