Skip to content. | Skip to navigation

Personal tools


You are here: Home / Wiki / Kb112


Emulab FAQ: Experiment Templates: Template Parameters

Emulab FAQ: Experiment Templates: Template Parameters

Emulab has added an NS extension specifically for use with Experiment Templates:

$ns define-template-parameter ''name'' ''value''

A template parameter is a user defined variable that can be overridden when the template is later instantiated. Template parameters are bound when the NS file is parsed, and are made part of the environment on your experimental nodes via the program agent. For example:

    $ns define-template-parameter NodeCount 3
    $ns define-template-parameter OS RHL90-STD
    set maxnodes $NodeCount
    for {set i 1} {$i <= $maxnodes} {incr i} {
        set node($i) [$ns node]
        tb-set-node-os $node($i) $OS

The initial parse of your NS file will bind the template parameters to their default value. Later, when you instantiate your template, you will be given an opportunity to (optionally) override the default values with new values. This allows you to more easily set up a series of experiments with varying arguments.