Project

General

Profile

Narval Shell Commands

Introduction

The NARVAL shell commands have the role to communicate with the NARVAL AWS component to control an acquisition. There are two ways to use the narval shell commands :
  • In command prompt : 'narval_shell' command
  • Within narvalconsole : 'wolf' tab
    Both ways are equivalent
The NARVAL shell commands are used :
  • In case we can't use graphical a user interface
  • In automatic scripts
  • To debug graphical user interfaces

Main commands

  • Help
    • Syntax : 'help command_name'
    • Gives help on a shell command
    • Example : help get
    • return :
      <result cmd="get" status="OK">
      <message type="help">
      <syntax>get argument_name sub_system_name</syntax>
      <syntax>get argument_name sub_system_name actor_name</syntax>
      <syntax>get arguments sub_system_name</syntax>
      <syntax>get arguments sub_system_name actor_name</syntax>
      <syntax>get sub_systems</syntax>
      <syntax>get actors sub_system_name</syntax>
      </message>
      </result>
      
  • Launch
    • Syntax :
      1. Within a xterm window :
        launch sub_system_name host_name
      2. Without a xterm window :
        launch sub_system_name host_name local
    • Initiates the sub-system
    • Return
      <result cmd ="launch" 
      status ="ok" 
      sub_system_name ="toto">
      </result>
      
  • State machine commands
    • Syntax : set action change_state sub_system_name (where change_state is one above)
      1. configure : configures the sub_system
      2. load : loads actors and shared libraries if needed
      3. initialise : initialises the actors
      4. start : starts the acquisition
      5. stop : stops the acquisition
      6. reset_com : resets all components
      7. unload : unloads shared libraries and shared libraries if some are loaded
      8. unconfigure : unconfigures the sub_system
      9. finish : finishes the acquisition and clean the system from the subsystem
    • Sets state of NARVAL acquisition
  • Get
    • Syntax :
      • get argument_name sub_system_name
      • get argument_name sub_system_name actor_name
      • get arguments sub_system_name
      • get arguments sub_system_name actor_name
      • get sub_systems
      • get actors sub_system_name
    • Retrieves parameters values from Narval processes
  • Set
    • Syntax :
      • set argument value sub_system_name
      • set argument value sub_system_name actor_name
    • Set parameters values in NARVAL processes
  • Errors
    Only in case of error, these commands can be used :
    • full_reset → initialised state
    • partial_reset → configured state
    • actor_reset → resets actors to their initial state
  • commands usable only in narval_shell :
    • load : loads a script located at $NARVAL_SCRIPT
    • quit : exits narval_shell

Scripting

NARVAL shell commands can be used in scripts to automate a NARVAL acquisition
  • Scripts are located at : $NARVAL_SCRIPTS
    • Script can have the same name than the topology file name without the extension
      e.g. : $NARVAL_CONF/test.xml → $NARVAL_SCRIPTS/test
    • Script can have a different name than the topology file name
      in that case, a complete acquisition can be launched inside narval_shell. Just type in narval_shell :
      load my_script
  • A script example can be found at :
    /usr/share/doc/narval-doc/examples/run_example

SOAP request

SOAP requests can be used to send NARVAL shell commands to the server
  • Example for requests made in python
    • SOAP Header example (for requests made in python)
      headers = {"content-type": "text/xml", "charset": "utf-8", "SOAPAction": "Send_Command_With_Arguments"}
    • SOAP Body example
      <?xml version='1.0' encoding='UTF-8'?>
      <soap:Envelope soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/1999/XMLSchema" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance">
      <soap:Body>
      <tns:Send_Command_With_Arguments xmlns:n1="http://soapaws/Narval_Aws_Interface_pkg/" xmlns:tns="http://soapaws/narval_aws_def/">
      <Command xsi:type="xsd:string">help get</Command>
      <Arguments soapenc:arrayType="n1:String_Capsule[1]" xsi:type="soapenc:Array">
         <item xsi:type="n1:String_Capsule">
            <String_Value xsi:type="xsd:string"></String_Value>
         </item>
      </Arguments>
      </tns:Send_Command_With_Arguments>
      </soap:Body>
      </soap:Envelope>
      

Resources