Testing Sip Testcomm 2003 Slides

download Testing Sip Testcomm 2003 Slides

of 31

Transcript of Testing Sip Testcomm 2003 Slides

  • 8/8/2019 Testing Sip Testcomm 2003 Slides

    1/31

    Testing SIPUsing XML Protocol Templates

    M. RanganathanOlivier Deruelle

    Doug Montgomery Advanced Networking Technologies Division,

    National Institute of Standards and Technology,Gaithersburg, MD 20899, USA.

    http://www-x.antd.nist.gov/index.html

  • 8/8/2019 Testing Sip Testcomm 2003 Slides

    2/31

    Introducing SIP

    Peer-to-peer Signaling Protocol used for IPTelephony, Conferencing and InstantMessagingIntroduced in 1999

    9 revisions and 2 RFCs since then!

    Widely deployed - Microsoft RTC Server,IM Client, Cisco gateways etc.

  • 8/8/2019 Testing Sip Testcomm 2003 Slides

    3/31

    Introducing SIP

    Text basedunlike H.323

    Stateless Protocol state encoded in message

    ExtensibleMany extensions exist.

    Can run over unreliable or reliable transportsOut of order / dropped signaling messages.

  • 8/8/2019 Testing Sip Testcomm 2003 Slides

    4/31

    Simple SIP Call Flow

    INVITE

    100 Trying

    180 Ringing200 OKACK

    OK

    UASUAC

    UAS User AgentServer

    UAC User AgentClient

    There can be intermediateSignaling nodes (Proxy Servers

    that keep call state).

    RTP Media Stream

    BYE

  • 8/8/2019 Testing Sip Testcomm 2003 Slides

    5/31

    Protocol Complications

    Protocol is robust and extensible:SIP keeps enough state in the Messages to deal withall these complications.

    Correct implementation is tricky.Signaling may have to go through multiple hops.Proxy servers may go down without warning.

    Peers may go down without warning.Sessions can move without prior planning.Network can fail without warning.

  • 8/8/2019 Testing Sip Testcomm 2003 Slides

    6/31

    SIP Testing

    Load TestingGenerate 100s of simultaneous sessions.

    Call Flow TestingUnit testing the SIP Protocol Implementationby generation of scenarios.Primary mode of testing during SIPinteroperability test events.

  • 8/8/2019 Testing Sip Testcomm 2003 Slides

    7/31

    Generating SIP Test Cases

    Exhaustive testing generates too many testcases.

    End-to-end testing is feasibleprotocol state and causality is encoded in theMessages/Call Flows.

    Understanding implementationcomplexities results in good test cases.

  • 8/8/2019 Testing Sip Testcomm 2003 Slides

    8/31

    SIP Application Structure

    Application

    Network (Raw Bytes)

    Parser Encoder

    ReqReq Res

    SIP Stack

    T r a n s a c t i o n

    T r a n

    s a c t i o n

    T r a n s a c t i o n

    Req Res

    Dialog DialogMessages

    Events

    Messages

    Events

    Messages

    Events

  • 8/8/2019 Testing Sip Testcomm 2003 Slides

    9/31

    Constructing Test Cases For SIP

    Layer the Test Cases like Applications/Stacks are layeredMessage Layer, Transaction Layer and DialogLayer testsThis prunes the number of tests and makes

    the tests more meaningful.

  • 8/8/2019 Testing Sip Testcomm 2003 Slides

    10/31

    SIP Messages

    Protocol encodes all the state it needs in themessage.HTTP/Mail like headers and a Request Line or aStatus Line.

    SIP Components use Messages to Identify protocolabstractions.Protocol State is encoded in

    Request URI, From, To, Via, CSeq, CallId, Max-ForwardsStateless components built directly on MessageLayer.

  • 8/8/2019 Testing Sip Testcomm 2003 Slides

    11/31

    Message Layer

    Handle Incoming Requests/ResponsesRead Raw messages from Network.

    Output Parsed Messages to Transaction layer.

    Dispatch outgoing messagesInput Parsed Messages from TransactionLayer.Encode Parsed Messages and send out on

    Network.

  • 8/8/2019 Testing Sip Testcomm 2003 Slides

    12/31

    Message Layer

    Grammar is context sensitive and defined using ABNFGrammar has changed between RFCs

    Grammar is compositional (mail, URL, HTTP)Parser generators have trouble with RFCgrammar

    usually hand coded parsers are usedSome tools are available antlr

    Headers are Text (Body can be Binary)

  • 8/8/2019 Testing Sip Testcomm 2003 Slides

    13/31

    Transaction Layer

    SIP Applications are transaction orientedand usually interact directly with atransaction layer.Primary duties of the Transaction Layer

    Request Response matchingRetransmission handling for unreliable media.Timeout handling

  • 8/8/2019 Testing Sip Testcomm 2003 Slides

    14/31

    Transaction Layer: Common Bugs

    Implementations do not implement theTransaction State Machine correctly

    Implementations have difficulty keepingbackward compatibilityIn RFC 3261 the branch ID of the topmost

    Via header identifies the TransactionRFC 2543 used a hash over From, To, RequestURI and Via headers

  • 8/8/2019 Testing Sip Testcomm 2003 Slides

    15/31

    Transaction Layer TestingTesting the State Machine

    Simulate lost messagesDrop Requests/Responses

    Simulate timing variationsDelay Responses

    Generate out of order responses Simulate stray messagesCANCEL messages for Server Transactions that do notexist.

    Late CANCELS

    Late ACKsDuplicate ACKsOut of Sequence messages.

  • 8/8/2019 Testing Sip Testcomm 2003 Slides

    16/31

    Transaction Layer TestingTransaction matching / identification

    Via Header branch parameter variationsRFC 3261 relies on this for matching

    Variations in From / To, Request URI andCSeq Sequence Number and CSeq MethodRFC 2543 relies on this for matching.

  • 8/8/2019 Testing Sip Testcomm 2003 Slides

    17/31

    Dialog Layer

    Dialog is a peer-to-peer association betweencommunicating SIP endpointsDialogs established by Dialog creating Transactions.

    Not all transactions create Dialogs. A Transaction may belong to exactly one Dialog.

    SIP messages carry enough state to identify theDialog directly from the message

  • 8/8/2019 Testing Sip Testcomm 2003 Slides

    18/31

    Dialog Layer

    Manages Dialog Creation/TeardownDialogs created by transaction completion

    Manages Route SetsTest agent must test for expected Route / Record-Route headers in requests

    Manages Sequence NumbersTest agent must test for sequence number assignmentManages the Request URI

  • 8/8/2019 Testing Sip Testcomm 2003 Slides

    19/31

    Dialog Layer: Common Bugs

    Dialogs are identified by portions of amessage:CallID, From, To tags in RFC 3261CallID, From, To addresses RFC2543Stacks try to keep backward compatibility

    Bugs are frequently caused by tagmanagement problems.

  • 8/8/2019 Testing Sip Testcomm 2003 Slides

    20/31

    Testing the Dialog Layer

    Requests/Responses within and outsideDialogRequests/Response for Spurious Dialogs

    Variation in From/To Headers and TagsGenerate Requests for Dialogs that do notexist.

    CSeq Header Sequence number variationsOut of sequence message arrivals

  • 8/8/2019 Testing Sip Testcomm 2003 Slides

    21/31

    Call Flow Testing Approach

    Test the causal sequence of messagesrequired to establish and release SIP CallsSIP Protocol Template an XML patternfor a SIP Call Flow.XML Pattern input to a customizable useragent which can run the Call Flow(Responder)

  • 8/8/2019 Testing Sip Testcomm 2003 Slides

    22/31

    Motivation

    XML is hierarchical good way to represent SIP protocolabstractions

    Interoperability testing with controlTypically components are tested in call flowscenariosTypically operating in an un-controlledenvironment

    Reproducing complex scenarios is difficult

  • 8/8/2019 Testing Sip Testcomm 2003 Slides

    23/31

    XML representation of SIP

    Define a set of XML tags to represent therequired headers in a SIP messageDefine XML tags to express call flow statemachineInput to Event Engine that can run the call

    flowGenerate variations of the call flow bymodifying the XML script

  • 8/8/2019 Testing Sip Testcomm 2003 Slides

    24/31

    Test Scripting Architecture

    Call Flow Testing Protocol Template

    Event Engine

    NIST-SIP Stack

    Service Function

    Service Script a callout toa service function at transitionpoints in the call flow.

    Service ContainerXML Engine + Java/Jythoninterpreter

    Network

    XML Tags Mirror Protocol

  • 8/8/2019 Testing Sip Testcomm 2003 Slides

    25/31

    XML Tags Mirror ProtocolStructure

  • 8/8/2019 Testing Sip Testcomm 2003 Slides

    26/31

    Test Script

    Pattern matching, timer events and transitions used fortriggering transitions in test script.Test script is represented by a set of Transactions thatmay be nested within a dialog.

    The entire transaction state machine is exposed anddefined using XML.

    Timing can be varied and controlled errors can be created.

    Service code can be called when messages arrive,transactions are started, transactions complete, dialogsare created or dialogs complete.

  • 8/8/2019 Testing Sip Testcomm 2003 Slides

    27/31

    Why Do It?

    Simple, clear expression of test scenariosProtocol maps to XML script one to oneCan generate multiple scenarios based onsmall variations for the same call flow.Can simulate common end-point (User

    Agent) behavior.Can generate controlled errorconditions/timing variations.

  • 8/8/2019 Testing Sip Testcomm 2003 Slides

    28/31

    Test Log File Collection

    Log file is a diagnostic tool to help debugprotocol problems.Stack generates log files using XML format.

    Distributed traces are collated at test proxyTrace viewer pairs arcs by Transactions

    Proxy Trace viewer (Java Applet)

    Responder UALocal Trace

    Local Trace RMI

  • 8/8/2019 Testing Sip Testcomm 2003 Slides

    29/31

    Visualizing the Trace

    Java Appletcollects andvisualizesdistributed callflow trace files.

    Augmented withXML script stateinformation.Enables

    debugging callflows & testscripts.

  • 8/8/2019 Testing Sip Testcomm 2003 Slides

    30/31

    Related work

    TTCN testing of SIPProcedural test casesNot explicitly tailored to SIP

    Using our approachSimplifies logical designXML tools can be used for test case design.

    http://www-x.antd.nist.gov/proj/iptel

  • 8/8/2019 Testing Sip Testcomm 2003 Slides

    31/31

    Extensions and Future Work

    Standardize XML representation of the SIPprotocolOff line protocol verification

    Generation of Call flows based on message logs Verification of traces based on message logs

    Customizable test scriptsExtensions to service creation.

    Integration with other distributed scriptingtechnologiesJXTA, SOAP