LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   tcl script for VBR traffic (https://www.linuxquestions.org/questions/linux-newbie-8/tcl-script-for-vbr-traffic-4175534576/)

Chinmayi 02-19-2015 10:34 PM

tcl script for VBR traffic
 
how to write tcl script for VBR traffic

knudfl 02-20-2015 05:19 AM

Welcome to LQ.

https://www.google.com/webhp?hl=all&...l=en&q=ns2+vbr

Example : vbr-normal.tcl
http://code.google.com/p/txsys/sourc...vbr-normal.tcl

VBR info ....
. http://www.linuxquestions.org/questions/tags/vbr/
. https://groups.google.com/forum/?fro.../vbr|sort:date
. http://network-simulator-ns-2.7690.n...=vbr&sort=date

Ns2 doc http://www.isi.edu/nsnam/ns/doc/
. http://csis.bits-pilani.ac.in/facult...orials/ns2.htm
. https://www.google.com/webhp?hl=all&...w+to+write+tcl
. http://www.isi.edu/nsnam/ns/tutorial/nsscript1.html

-

Chinmayi 02-20-2015 10:08 AM

Is this the correct code for generating VBR Traffic
 
set vbr [new Application/Traffic/VBR]
$vbr set rate_ 448Kb
$vbr set rate_dev_ 0.25
$vbr set rate_time_ 2.0
$vbr set burst_time_ 1.0
$vbr set n_o_changes_ 10
$vbr set time_dev_ 0.5
$vbr set constant_ false
$vbr set maxrate_ 648Kb
$vbr set packetSize_ 210
$vbr set maxpkts_ 268435456
I have got this code from http://ns2blogger.blogspot.in/2014/0...tation-in.html
I am using NS-2.35 Version

knudfl 02-20-2015 07:23 PM

← ref. #3.

http://ns2blogger.blogspot.in/2014/0...tation-in.html
.. is incomplete. Seems based on
http://code.google.com/p/txsys/sourc...ate%253Dclosed
→ $ svn checkout http://txsys.googlecode.com/svn/trunk/ txsys-read-only
→ txsys-read-only/ubiquitous/ns2/src/{ .., .., vbr_traffic.cc },
txsys-read-only/ubiquitous/ns2/vbr/ \
{ cbr-sim.tcl, vbr-expo.tcl, vbr-normal.tcl, vbr.plot, vbr-uniform.tcl }.


Quote:

Is this the correct code for generating VBR Traffic
I have no idea. Is for you to try out. Then please post again if any issues.


-

Chinmayi 02-21-2015 05:56 AM

Is VBR Traffic and Exponential traffic same?
what are Makefile.in & vbr_traffic.o?
Where can we get them? How to Include vbr_traffic.o in Makefile.in?

knudfl 02-21-2015 06:56 AM

← ref. #3.
Quote:

what are Makefile.in & vbr_traffic.o ?
Makefile.in is used for generating the Makefile.
`vbr_traffic.o´ is an object file.
→ Is the compiled result from vbr_traffic.cc
→ And is linked together with ~400 other objects, into one file : ns.

Please do :
$ svn checkout http://txsys.googlecode.com/svn/trunk/ txsys-read-only
... to get ( also ) ....
txsys-read-only/ubiquitous/ns2/{ Makefile.in, src/vbr_traffic.cc }


Quote:

Is VBR Traffic and Exponential traffic same ?
Please look it up →
https://www.google.com/webhp?hl=all&...l=en&q=ns2+vbr


-

Chinmayi 02-21-2015 07:48 AM

How to include vbr_traffic.cc in Makefile.in

knudfl 02-21-2015 08:31 AM

← ref. #7.

» include vbr_traffic.cc in Makefile.in « : Read the link in your post #3 :
"" 1. Include vbr_traffic.o in Makefile.in "".
I.e. files.cc are not mentioned in a Makefile*. The objects to be created are.

Makefile.in is a text file. Easy to read. Or use 'grep' :
Code:

$ cd txsys-read-only/ubiquitous/ns2/
$ grep -n vbr_traffic.o Makefile.in
179:    tools/expoo.o tools/cbr_traffic.o tools/vbr_traffic.o \

The number, '179' is the line number.
Which you can see in your Editor, when opening Makefile.in for reading.
.... So nothing to add ! vbr_traffic.o is already present.


-

Chinmayi 02-21-2015 09:14 AM

the Makefile in my NS-2.35 has a little difference in code when compared to the Makefile in http://txsys.googlecode.com/svn/trun...s2/Makefile.in. Should I repalce the original with this new one?

knudfl 02-21-2015 10:17 AM

← ref. #9.
Quote:

Makefile.in
.
Should I repalce the original
No. Just add the object to the ns-2.35/Makefile.in :
<TAB>tools/expoo.o tools/cbr_traffic.o tools/vbr_traffic.o \
... and make sure that vbr_traffic.cc is in tools/.

And then run ./install in the top directory ns-allinone-2.35/.


-

Chinmayi 02-21-2015 11:51 AM

what is "Run make depend in ns-allinone-2.35"?How is this done?

knudfl 02-21-2015 05:36 PM

← ref. #11.

All commands are done from the script ns-allinone-2.35/install :
That's the command $ ./install

"install" is a text file, see the ns-2.35 section, lines 531-553,
if you are using the 2011 version ns-allinone-2.35.tar.gz .
If it's the updated version, 2014 : Then the lines 578-587.
Conclusion : The way to run 'make' is $ ./install

Besides that, ./configure && make clean && make doesn't work in ns-2.35.
That was for the earlier ns2 versions.
Also : Saved some time when just running 'make'.
Old slow computer could use ~15 minutes for ./install.
Not an issue with a modern computer.


'make depend' is done automatically in the right way with ./install,
which runs 'make' in ns-2.35/.
A manual 'make depend' has never been attempted.
Somebody wrote 'make depend' many years ago.
And all the young students just repeat it in their texts.
→ → Don't believe everything you read on the Internet.


-

Chinmayi 02-21-2015 09:54 PM

My Makefile is:


#
# Copyright (c) 1991,1993 The Regents of the University of California.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. All advertising materials mentioning features or use of this software
# must display the following acknowledgement:
# This product includes software developed by the Computer Systems
# Engineering Group at Lawrence Berkeley Laboratory.
# 4. Neither the name of the University nor of the Laboratory may be used
# to endorse or promote products derived from this software without
# specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# @(#) $Header: /cvsroot/nsnam/nam-1/Makefile.in,v 1.54 2011/11/02 16:31:26 tom_henderson Exp $
#
Code:

# Top level hierarchy
prefix = @prefix@
exec_prefix = @exec_prefix@
# Pathname of directory to install the binary
BINDEST = @bindir@
# Pathname of directory to install the man page
MANDEST = @mandir@
# Define datarootdir as of autoconf 2.60
datarootdir = @datarootdir@

CC = @CC@
CPP = @CXX@
CCOPT = @V_CCOPT@
MKDEP = ./conf/mkdep
# Have to be the same as that defined in conf/makefile.win
TCL2C = @V_TCL2CPP@
TCLSH = @V_TCLSH@

#
# Remember to add a dependency if you add any tcl sources here.
#
LIB =  \
        @V_LIBS@ \
        @V_LIB_X11@ \
        @V_LIB@ -lm @LIBS@
INCLUDE = \
        -I. @V_INCLUDES@ \
        @V_INCLUDE_X11@

STATIC = @V_STATIC@
DEFINE = -DTCL_TK -DNO_VOID @V_DEFINE@ @V_DEFINES@
CFLAGS = $(CCOPT) $(DEFINE) $(INCLUDE)

INSTALL = @INSTALL@
RANLIB = @V_RANLIB@

BLANK        = # make a blank space.  DO NOT add anything to this line
AR        = ar rc $(BLANK)
LINK        = $(CPP)
LDFLAGS        =
LDOUT        = -o $(BLANK)
PERL        = perl
RM        = rm -f

# Explicitly define compilation rules since SunOS 4's make doesn't like gcc.
# Also, gcc does not remove the .o before forking 'as', which can be a
# problem if you don't own the file but can write to the directory.
.SUFFIXES: .cc $(.SUFFIXES)

.cc.o:
        rm -f $@; $(CPP) -o $@ -c $(CFLAGS) $*.cc

.c.o:
        rm -f $@; $(CC) -o $@ -c $(CFLAGS) $*.c

GEN_DIR = gen/
NAM        = nam

# WIN32: uncomment the following line to include specific make for VC++
# !include <conf/makefile.win>

OBJ_C = tkcompat.o tkUnixInit.o xwd.o

OBJ_CC = \
        netview.o netmodel.o edge.o packet.o node.o main.o \
        trace.o queue.o drop.o animation.o agent.o feature.o \
        route.o transform.o paint.o state.o monitor.o anetmodel.o \
        rng.o view.o graphview.o netgraph.o tracehook.o \
        lan.o psview.o group.o editview.o tag.o address.o animator.o \
        wnetmodel.o nam_stream.o enetmodel.o testview.o parser.o \
        trafficsource.o lossmodel.o queuehandle.o

OBJ_GEN = \
        $(GEN_DIR)version.o $(GEN_DIR)nam_tcl.o
SRC_GEN = \
        $(GEN_DIR)version.c $(GEN_DIR)nam_tcl.cc

OBJ =        $(OBJ_C) $(OBJ_CC) $(OBJ_GEN)
SRC =        $(OBJ_C:.o=.c) $(OBJ_CC:.o=.cc)

CLEANFILES = $(NAM) $(OBJ) $(SRC_GEN) core core.nam

NAM_TCL_LIB = \
        tcl/nam-lib.tcl \
        tcl/nam-default.tcl \
        tcl/balloon.tcl \
        tcl/snapshot.tcl \
        tcl/animator.tcl \
        tcl/anim-ctrl.tcl \
        tcl/netModel.tcl \
        tcl/autoNetModel.tcl \
        tcl/build-ui.tcl \
        tcl/annotation.tcl \
        tcl/node.tcl \
        tcl/monitor.tcl \
        tcl/stats.tcl \
        tcl/www.tcl \
        tcl/menu_file.tcl \
        tcl/menu_view.tcl \
  tcl/NamgraphView.tcl \
  tcl/NamgraphModel.tcl \
  tcl/TimesliderNamgraphView.tcl \
  tcl/TimesliderView.tcl \
  tcl/TimesliderModel.tcl \
  tcl/observer.tcl \
  tcl/observable.tcl \
  tcl/wirelessNetModel.tcl \
  tcl/editorNetModel.tcl \
  tcl/Editor.tcl \
  tcl/Editor-FileParser.tcl

$(NAM):        $(OBJ) $(SCRYOBJ) Makefile
        $(RM) $@
        $(LINK) $(STATIC) $(LDFLAGS) $(LDOUT)$@ \
                $(OBJ) $(SCRYOBJ) $(LIB)

Makefile: Makefile.in
        @echo "Makefile.in is newer than Makefile."
        @echo "You need to re-run configure."
        false

$(GEN_DIR)nam_tcl.cc: $(NAM_TCL_LIB)
        $(RM) $@
        $(TCLSH) bin/tcl-expand.tcl tcl/nam-lib.tcl | $(TCL2C) et_nam > $@

$(GEN_DIR)version.c: VERSION
        $(RM) $@
        $(TCLSH) bin/string2c.tcl version < VERSION > $@

install: force
        $(INSTALL) -m 755 nam $(DESTDIR)$(BINDEST)

clean:
        $(RM) $(CLEANFILES)

distclean:
        $(RM) $(CLEANFILES) Makefile config.cache config.log config.status

tar:        force
        tar=$(TAR_PREFIX)-nam-`cat VERSION`.tar.gz ; \
        rm -f $$tar ; \
        tar cfhF -  $(TAR) | gzip -c > $$tar

depend: $(SRC)
        $(MKDEP) $(CFLAGS) $(SRC)

srctar:
        @cwd=`pwd` ; dir=`basename $$cwd` ; \
            name=nam-`cat VERSION | tr A-Z a-z` ; \
            tar=nam-src-`cat VERSION`.tar.gz ; \
            list="" ; \
            for i in `cat FILES` ; do list="$$list $$name/$$i" ; done; \
            echo \
            "(rm -f $$tar; cd .. ; ln -s $$dir $$name)" ; \
            (rm -f $$tar; cd .. ; ln -s $$dir $$name) ; \
            echo \
            "(cd .. ; tar cfhz $$tar [lots of files])" ; \
            (cd .. ; tar cfhz - $$list) > $$tar ; \
            echo \
            "rm ../$$name; chmod 444 $$tar" ;  \
            rm ../$$name; chmod 444 $$tar

force:

# Create makefile.vc for Win32 development by replacing:
# "# !include ..."        ->        "!include ..."
makefile.vc: Makefile.in
        $(PERL) bin/gen-vcmake.pl < Makefile.in > makefile.vc
#        $(PERL) -pe 's/^# (\!include)/\!include/o' < Makefile.in > makefile.vc





Where should I include tools/vbr_traffic.o\?

Chinmayi 02-22-2015 03:13 AM

1 Attachment(s)
Ihave run the command ./install
But I am getting some error
Ihave attached the screenshot of the error
Please suggest the solution

knudfl 02-22-2015 04:00 AM

← ref. post #13.

Not Makefile, but 204 random lines from the Makefile.in .
The valid Makefile.in, ns-2.35 has 625 lines.
* Code like post #13 must be in CODE tags.
You can see how code tags look like in post #8.
Please edit post #13 to code tags, or delete the most ..
. http://www.linuxquestions.org/questi....php?do=bbcode
. http://www.linuxquestions.org/questi...gs-4175464257/
I.e. it's the ` # ´ button in the 'Advanced Editor'.
Editing : The 'Edit' button → → "Go Advanced".
.. Or you can type [/code] at code end, and [code] at code text start.


← post #14 : You have missing "ns2 prerequisites".
Which OS are you using ? Name and version, please.

Prerequsites, Ubuntu : $ sudo apt-get install \
g++ g++-4.4 automake patch make libtool libxmu-dev xgraph

Fedora, CentOS :
# yum install gcc-c++ autoconf automake patch make libtool libXmu-devel


-


All times are GMT -5. The time now is 11:11 AM.