LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking > Linux - Wireless Networking
User Name
Password
Linux - Wireless Networking This forum is for the discussion of wireless networking in Linux.

Notices


Reply
  Search this Thread
Old 07-23-2019, 03:00 PM   #1
EddieXS
LQ Newbie
 
Registered: Jul 2019
Posts: 7

Rep: Reputation: Disabled
Executing .sh script to run ZRP simulations on patched NS-2.35


Running ns-2.35 on ubuntu 16.04 doing an analysis of different routing protocols. No problems with AODV & DSDV as i know they are in the base version. Have got an automation script that runs and takes in my simulation results and creates neat folders and .csv files.

After a struggle getting ZRP patched in and successfully testing the demos from a tutorial: https://www.linuxquestions.org/quest...on-4175526171/ Post #7

I tried to change my existing .tcl file to run the ZRP simulation using my .sh automation by using:
Quote:
set val(rp) ZRP ; #Routing protocol

...

Agent/ZRP set radius_ 2; # Setting ZRP radius =2
But the result i get at this point is

Quote:
$ ns235-zrp ./automate.sh
invalid command name "mkdir"
while executing
"mkdir mobility_files"
(file "./automate.sh" line 4)
And if i try run it without using the ns235-zrp command (just to test out different options) i get:

Quote:
invalid command name "Agent/ZRP"
while executing
"Agent/ZRIP set radius_2 "
Not entirely sure what to do at this point as the older forum answers seem to have run dry.

Let me know if you need anything more information about the steps i took upto this point.

Last edited by EddieXS; 07-23-2019 at 03:02 PM. Reason: Tried to tidy up the format to quote code correctly, let me know if i've done it wrong!
 
Old 07-24-2019, 04:52 PM   #2
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,513

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
Welcome to LQ.

Also ref. https://stackoverflow.com/questions/...after-patching

You can of course not use a tcl-otcl interpreter like 'ns' to run a shell script.
It is `$ ./automate.sh´ ... or if it's a bash script also `$ bash automate.sh´

Quote:
invalid command name "Agent/ZRP"
.
"Agent/ZRIP set radius_2 "
See the EDIT below ...

Ubuntu 16.04: No issues with ns-2.35 + ZRP, unless you changed the default compiler:
The ns-2.35 2014 update (ns-allinone-2.35_gcc482.tar.gz or ns-allinone-2.35_gcc5.tar.gz) requires g++ version <= gcc-5.4 ( ver. 4.4 .. 5.4 No PIE.)

Build example
Code:
tar xvf ns-allinone-2.35_gcc5.tar.gz
https://drive.google.com/file/d/0B7S...ew?usp=sharing
cd ns-allinone-2.35/
patch -p0 < zrp-ns235.patch
https://drive.google.com/file/d/0B7S...ew?usp=sharing
./install
        // ( or : export CC=gcc-4.8 CXX=g++-4.8 && ./install )
cd ns-2.35/
cp ns ns235-zrp
sudo cp ns235-zrp /usr/local/bin/

------------ Simulation ----------
ns235-zrp zrp-Demo1-1.tcl
zrp-examples-06.2019.tar.gz
https://drive.google.com/file/d/1VOO...ew?usp=sharing


EDIT : You have some typo´s → "Agent/ZRIP set radius_2 " ... must be:
Code:
Agent/ZRP set radius_ 2

Last edited by knudfl; 07-24-2019 at 05:47 PM.
 
1 members found this post helpful.
Old 07-26-2019, 04:28 AM   #3
EddieXS
LQ Newbie
 
Registered: Jul 2019
Posts: 7

Original Poster
Rep: Reputation: Disabled
@knudfl R.E post #2

Quote:
Build example
[CODE]tar xvf ns-allinone-2.35_gcc5.tar.gz
https://drive.google.com/file/d/0B7S...ew?usp=sharing
cd ns-allinone-2.35/
patch -p0 < zrp-ns235.patch
https://drive.google.com/file/d/0B7S...ew?usp=sharing
./install
// ( or : export CC=gcc-4.8 CXX=g++-4.8 && ./install )
cd ns-2.35/
cp ns ns235-zrp
sudo cp ns235-zrp /usr/local/bin/
Followed these instructions and got the following results:

Using files given:
./install (no export) results:

Running simulation ($ ns235-zrp zrp-Demo1-1.tcl) Works fine, no errors and creates output

Trying to run .sh script (did not use the ns235-zrp command, just $ ./automate.sh) the same error as before
Code:
 invalid command name "Agent/ZRP"
    while executing
"Agent/ZRP set radius_ 2 "
Trying to run own .tcl script modified for ZRP using the command
Code:
$ ns235-zrp aodv.tcl
num_nodes is set 10
INITIALIZE THE LIST xListHead
couldn't read file "": no such file or directory
    while executing
"source.orig {}"
    ("uplevel" body line 1)
    invoked from within
"uplevel source.orig[list $fileName]"
    invoked from within
"if [$instance_ is_http_url $fileName] {
set buffer [$instance_ read_url $fileName]
uplevel eval $buffer
} else {
uplevel source.orig[list $fileName]
..."
    (procedure "source" line 8)
    invoked from within
"source $mobility"
    (file "aodv.tcl" line 50)
./install with export
Results:
Code:
configure: WARNING: unrecognized options: --enable-gcc
checking whether to use symlinks for manpages... no
checking whether to compress the manpages... no
checking whether to add a package name suffix for the manpages... no
checking for gcc... gcc-4.8
checking whether the C compiler works... no
configure: error: in `/home/sher/Downloads/ns-allinone-2.35/tcl8.5.10/unix':
configure: error: C compiler cannot create executables
See `config.log' for more details
tcl8.5.10 configuration failed! Exiting ...
Tcl is not part of the ns project.  Please see www.Scriptics.com
to see if they have a fix for your platform.


Quote:
EDIT : You have some typo´s → "Agent/ZRIP set radius_2 " ... must be:
Code:
Agent/ZRP set radius_ 2
Corrected Typos as well
 
Old 07-26-2019, 06:11 AM   #4
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,513

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
»» invalid command name "Agent/ZRP" «« : Please attach `automate.sh´ as automate.sh.txt,
i.e. text files require suffix .txt to be attached.

»»couldn't read file "": no such file«« : Please attach the file as AODV-new-name.tcl.txt
.... The name aodv.tcl is generic. See AODV-examples-01.18.tar.gz
https://drive.google.com/file/d/1uOv...ew?usp=sharing

All 3500 simulations "names", see all_tcl-examples-5.tar.xz (39MB)
https://drive.google.com/file/d/1tpt...ew?usp=sharing
Tree https://drive.google.com/drive/folde...Ws?usp=sharing

-
 
Old 07-26-2019, 09:59 AM   #5
EddieXS
LQ Newbie
 
Registered: Jul 2019
Posts: 7

Original Poster
Rep: Reputation: Disabled
I should have attached both. I have renamed what was called aodv.tcl to zrp-setup.tcl to make it appropriate for the actual protocol I am using within it, please let me know if you think more detail should be in the file name.
Attached Files
File Type: txt zrp-setup.tcl.txt (2.6 KB, 26 views)
File Type: txt automate.sh.txt (4.9 KB, 22 views)
 
Old 07-26-2019, 10:26 AM   #6
EddieXS
LQ Newbie
 
Registered: Jul 2019
Posts: 7

Original Poster
Rep: Reputation: Disabled
I hope its okay for me to make another reply on here. Just been testing with my actual AODV script that worked, thought i would try open one of my simulations in nam (Which i've used successfully with it plenty before) and now im getting the following error that could be related to whats going on with the above?

Quote:
$nam
Can't find a usable init.tcl in the following directories:
:/opt/ns-allinone-2.35/tcl8.5.10/library/

This probably means that Tcl wasn't installed properly.

Aborted (Core dumped)
Like i say this definitely worked before i started trying to implement the ZRP patch.
 
Old 07-26-2019, 01:41 PM   #7
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,513

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
Re #5.

"automate.sh" : Line 43, the command is not ns but ns235-zrp.
My line 43: ns235-zrp zrp-setup.tcl mobility_files/mob$i
(The command 'ns235-zrp' can usually also be used for simulations with other protocols.)

"zrp-setup.tcl", line 50 : Must be `# source $mobility´, i.e. commented out.
→ You already have the real settings of $mobility in automate.sh


About nam :
Better install a package for your OS, e.g. nam_1.15-10-ubuntu14_amd64.deb
https://www.linuxquestions.org/quest...-4175524760/#2
... Delete the current 'nam', or hide it away.
Note : There is no usable nam package from Ubuntu for versions 14* .. 17.04.
Oct 2014: https://bugs.launchpad.net/ubuntu/+s...m/+bug/1376970
→ fixed after 42 months!

Download the package ... and install
Code:
sudo gdebi Downloads/nam_1.15-10-ubuntu14_amd64.deb
P.S.: Will appreciate a copy of your "analysis.awk".

-

Last edited by knudfl; 07-29-2019 at 03:23 PM.
 
1 members found this post helpful.
Old 07-28-2019, 06:16 AM   #8
EddieXS
LQ Newbie
 
Registered: Jul 2019
Posts: 7

Original Poster
Rep: Reputation: Disabled
Hi, many apologies for the late response.

I have spent the last few days starting again with my VM & Ubuntu, creating backups along each step of the way to make this process much easier.

Now that is sorted I have started at the point of installing everything fresh using the steps and files provided in post #2

Moving the file, using tar and applying the patch seems to work fine (files appear to transfer), but once ./install is used the following error occurs:

Code:
gcc -g -o cweave cweave.o common.o
ln: failed to create symbolic link 'cweave': File exists
ln: failed to create symbolic link 'ctangle': File exists
============================================================
* Build Stanford GraphBase
* Modified By Paul Shaiju (Paul S)
* Email-id : paultsr@gmail.com
* Website : http://paultsr.in
============================================================
Making sgb
gcc-4.8 -g -I/usr/local/sgb/include  test_io.c gb_io.o -o test_io
make: gcc-4.8: Command not found
Makefile:108: recipe for target 'test_io' failed
make: *** [test_io] Error 127
Unable to create sgb library, but it's optional, so continuing...
============================================================
* Build GT-ITM
* Modified By Paul Shaiju (Paul S)
* Email-id : paultsr@gmail.com
* Website : http://paultsr.in
============================================================
sgb lib not found. gt-itm & sgb2ns could not be installed. Continuing..
============================================================
* Build zlib
* Modified By Paul Shaiju (Paul S)
* Email-id : paultsr@gmail.com
* Website : http://paultsr.in
============================================================
Building static library libz.a version 1.2.3 with gcc-4.8.
cp: preserving times for 'zconf.h': Operation not permitted
Checking for unistd.h... No.
Checking whether to use vs[n]printf() or s[n]printf()... using s[n]printf()
Checking for snprintf() in stdio.h... No.
  WARNING: snprintf() not found, falling back to sprintf(). zlib
  can build but will be open to possible buffer-overflow security
  vulnerabilities.
Checking for return value of sprintf()... No.
  WARNING: apparently sprintf() does not return a value. zlib
  can build but will be open to possible string-format security
  vulnerabilities.
Checking for errno.h... No.
Checking for mmap support... No.
gcc-4.8 -O -DNO_snprintf -DHAS_sprintf_void -DNO_ERRNO_H   -c -o example.o example.c
make: gcc-4.8: Command not found
<builtin>: recipe for target 'example.o' failed
make: *** [example.o] Error 127
Zlib make failed, but it's optional Continue ...
============================================================
* Build tcl8.5.10
* Modified By Paul Shaiju (Paul S)
* Email-id : paultsr@gmail.com
* Website : http://paultsr.in
============================================================
configure: WARNING: unrecognized options: --enable-gcc
checking whether to use symlinks for manpages... no
checking whether to compress the manpages... no
checking whether to add a package name suffix for the manpages... no
checking for gcc... gcc-4.8
checking whether the C compiler works... no
configure: error: in `/opt/ns-allinone-2.35/tcl8.5.10/unix':
configure: error: C compiler cannot create executables
See `config.log' for more details
tcl8.5.10 configuration failed! Exiting ...
Tcl is not part of the ns project.  Please see www.Scriptics.com
to see if they have a fix for your platform.
I was unsure how much of the error was relevant so i tried to go up as far as i could.

This means ns has not installed correctly at all? I am not sure if i have missed anything else to do before the patch & ./install

Aside from the steps given here before i began i went through the standard steps i have gone through previous to get my unpatched version of ns-2.35 working:

Code:
sudo apt-get update
sudo apt-get install gcc
sudo apt-get install build-essential autoconf automake
sudo apt-get install tcl8.5-dev tk8.5-dev
sudo apt-get install perl xgraph libxt-dev libx11-dev libxmu-dev
Again im very sorry for the late response, and i hope the steps i have taken to start fresh and get this working are reasonable.
I have also still attached analysis.awk for you to take a look if you wish to do so.
Attached Files
File Type: txt analysis.awk.txt (3.5 KB, 50 views)
 
Old 07-28-2019, 06:39 AM   #9
EddieXS
LQ Newbie
 
Registered: Jul 2019
Posts: 7

Original Poster
Rep: Reputation: Disabled
Ah! forget my last post i believe.

I left it for a few minutes, checked my permissions (sudo chmod -R 777 FILENAME) everywhere i had been using, and retried ./install

Worked!
Tested the demo, no problem

Altered my files as you suggested (No changes to .awk) and the simulation has run sucessfully.

Currently nam is still playing up but i will follow your instructions to sort that (i also have a working version on my other VM copy so i can transfer files over to that one if needs be)

I was wondering if it would be okay for me to do one last final post on here, explaining every step i went through to get towards this stage? As i know i struggled so much i would like to leave a full tutorial with any fiddly bits in it people may not know they need to do
 
Old 07-28-2019, 07:29 AM   #10
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,513

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
Re #8, #9.

Thank you for the awk script.

gcc-4.8 : $ apt-get install g++-4.8
Suggest a search when packages are wanted: $ apt-cache search gcc-4.8
Or on-line https://packages.ubuntu.com/search?s...searchon=names
Or install `synaptic´ package manager. Can search in all the 40,000 available packages.

About gt-itm/ :
ns-allinone-2.35_gcc5.tar.gz has an ns-allinone-2.36 version. Worked for a short time.
The current most usable gt-itm/ is found in ns-allinone-2.33 .


Quote:
chmod -R 777
Not a good idea to use opt/ for package builds.
Default / safe is /home/name/tmp/ ... and for ns2: /home/name/ns2/(protocol)
I.e. you are exposed for attacks whenever using sudo.

Quote:
... if it would be okay for me to do one last final post on here
You are always welcome to write about your results / issues.

-
 
Old 07-31-2019, 06:59 AM   #11
EddieXS
LQ Newbie
 
Registered: Jul 2019
Posts: 7

Original Poster
Rep: Reputation: Disabled
Re #10

Quote:
gcc-4.8 : $ apt-get install g++-4.8
Suggest a search when packages are wanted: $ apt-cache search gcc-4.8
Or on-line https://packages.ubuntu.com/search?s...searchon=names
Or install `synaptic´ package manager. Can search in all the 40,000 available packages.

About gt-itm/ :
ns-allinone-2.35_gcc5.tar.gz has an ns-allinone-2.36 version. Worked for a short time.
The current most usable gt-itm/ is found in ns-allinone-2.33 .
Thankyou, have kept this noted for future reference.

Quote:
Not a good idea to use opt/ for package builds.
Default / safe is /home/name/tmp/ ... and for ns2: /home/name/ns2/(protocol)
I.e. you are exposed for attacks whenever using sudo.
Sorry I just need some clarity on this, when i install NS2 it is safer / better to place into directory /home/name/ns2 ?

Thankyou again for all your help.
 
  


Reply

Tags
ns2, zrp



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] How to make modified ZRP protocol from ZRP protocol vishalpolara Linux - Newbie 12 10-07-2015 05:02 AM
zrp problem. tcl file not executing. Niraj Mishra Linux - Newbie 1 11-24-2014 10:59 AM
TCP simulations lvxing Linux - Networking 2 09-21-2004 05:49 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking > Linux - Wireless Networking

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

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration