Change all connected IP sets mode to Alcatel Dynamic

Post Reply
User avatar
Maulwurf
Member
Posts: 161
Joined: 03 Feb 2010 15:48
Location: Germany

Change all connected IP sets mode to Alcatel Dynamic

Post by Maulwurf »

Hi all,

found at BPWS script to change static IP sets to dynamic. The attached script will change all the connected IPT mode to Alcatel Dynamic.
In my lab (OXE VMware 11.2-l2.300-25-c-de-c0) i get the following error:

(1)xa000000>
(1)xa000000> cd /tmpd
(1)xa000000> chmod 777 iptouch_dhcp.sh
(1)xa000000> chmod 777 all_iptouch_dhcp.sh
(1)xa000000> ./all_iptouch_dhcp.sh

-- Auto Script
-- Copyright 2014. Alcatel-Lucent Technical Support
Reading the list of IPtouch phones...



/tmpd/iptouch_dhcp.sh: line 1: IPv4: command not found
...: Unknown server error
/tmpd/iptouch_dhcp.sh: line 1: IPv4: command not found
/tmpd/iptouch_dhcp.sh: line 42: return: ...: numeric argument required
/tmpd/iptouch_dhcp.sh: line 42: return: ...: numeric argument required
.........: Unknown server error

Task Finished.
Wed Mar 9 09:09:22 CET 2016
(1)xa000000>


Can you help me to solve this?
You do not have the required permissions to view the files attached to this post.
sadim
Alcatel Unleashed Certified Guru
Alcatel Unleashed Certified Guru
Posts: 691
Joined: 02 Jun 2006 07:11
Location: Portugal

Re: Change all connected IP sets mode to Alcatel Dynamic

Post by sadim »

Hello,

Please attach both shell files (iptouch_dhcp.sh and all_iptouch_dhcp.sh)

Regards
User avatar
Maulwurf
Member
Posts: 161
Joined: 03 Feb 2010 15:48
Location: Germany

Re: Change all connected IP sets mode to Alcatel Dynamic

Post by Maulwurf »

Here are the files
You do not have the required permissions to view the files attached to this post.
sadim
Alcatel Unleashed Certified Guru
Alcatel Unleashed Certified Guru
Posts: 691
Joined: 02 Jun 2006 07:11
Location: Portugal

Re: Change all connected IP sets mode to Alcatel Dynamic

Post by sadim »

Hello,

Check the contentes of the file /tmpd/listipt

Regards
User avatar
Maulwurf
Member
Posts: 161
Joined: 03 Feb 2010 15:48
Location: Germany

Re: Change all connected IP sets mode to Alcatel Dynamic

Post by Maulwurf »

Hi sadim,

that my listipt:
|100 |RH1 |00:80:9f:88:1e:7c |S|02100| IPv4 | 192.168.100.176| Unused| Ipt| GE| - |
|102 |RH3 |00:80:9f:a4:07:c8 |S|02128| IPv4 | 192.168.100.175| Unused| Ipt| GE| - |

Both IP Phones have static IP.
sadim
Alcatel Unleashed Certified Guru
Alcatel Unleashed Certified Guru
Posts: 691
Joined: 02 Jun 2006 07:11
Location: Portugal

Re: Change all connected IP sets mode to Alcatel Dynamic

Post by sadim »

Hello,

The Shell script is OXE version dependent. You need to replace the contents of the file iptouch_dhcp.sh with:

#!/bin/bash
# THIS SCRIPT IS DESIGNED FOR setting dhcp to alcatel dynamic
# Copyright 2014. Alcatel-Lucent Technical Support

# INPUT PARAMETERS VERIFICATION

echo
echo \-\- Auto Script for setting iptouch dhcp to alcatel dynamic
echo \-\- Copyright 2014. Alcatel-Lucent Technical Support
echo
echo `/bin/date`
echo
while read LINE
do

# GET EXTENSION NUMBER & IP INFORMATION

LINE="${LINE//[[:space:]]/}"

eval `echo $LINE|awk -F "|" '{print "EXT="$2}'`
eval `echo $LINE|awk -F "|" '{print "IP="$8}'`

# SPLIT IP TO 4 PARTS

IP1=${IP:0:3}
IP2=${IP:4:3}
IP3=${IP:8:3}
IP4=${IP:(-3)}

# REMOVE ADDITIONAL ZEROS FROM IP ADDRESS

function remzero {
local INPUT=$1
if [ ${#INPUT} -ge 1 ]
then
if [ ${INPUT:0:1} = "0" ]
then
INPUT=${INPUT:1:2}
remzero $INPUT
INPUT=$rtn
fi
fi
rtn=$INPUT
return $rtn;
}

remzero $IP1
IP1=$rtn
remzero $IP2
IP2=$rtn
remzero $IP3
IP3=$rtn
remzero $IP4
IP4=$rtn
IP=$IP1.$IP2.$IP3.$IP4

#PROCESS THE CONFIGURATION CHANGE

echo Enabling Telnet Service for IP address $IP Extension $EXT ...
echo `/usr2/oneshot/mtcl/tool ippstat telnet d $EXT t 1440`
echo
sleep 5
echo Setting config boot information from $IP Extension $EXT ...
echo `(sleep 2;echo "config dhcp a";sleep 2; echo "reset";sleep 2) | /usr/bin/te
lnet $IP`
echo
echo
echo done.
sleep 2
echo
done < $1

#TASK FINISHED INDICATION

echo
echo Task Finished.
echo `/bin/date`
sadim
Alcatel Unleashed Certified Guru
Alcatel Unleashed Certified Guru
Posts: 691
Joined: 02 Jun 2006 07:11
Location: Portugal

Re: Change all connected IP sets mode to Alcatel Dynamic

Post by sadim »

You can replace your iptouch_dhcp.sh file by the one in attach
iptouch_dhcp.zip
You do not have the required permissions to view the files attached to this post.
User avatar
Maulwurf
Member
Posts: 161
Joined: 03 Feb 2010 15:48
Location: Germany

Re: Change all connected IP sets mode to Alcatel Dynamic

Post by Maulwurf »

Hi sadim,

thank you very much for helping me. That is great.
With your new "iptouch_dhcp.sh" it works in my lab. I see you added... LINE="${LINE//[[:space:]]/}"
Can you explain why i need this? I will understand it. Original file from BPWS knowledge center should work with OXE R 10 and R11.
Find file and description at BPWS knowledge center. Search "000013045"
sadim
Alcatel Unleashed Certified Guru
Alcatel Unleashed Certified Guru
Posts: 691
Joined: 02 Jun 2006 07:11
Location: Portugal

Re: Change all connected IP sets mode to Alcatel Dynamic

Post by sadim »

Hello,

I added that in order to remove the spaces of on each entry of the file listipt and with this small change i did not need to change the rest of the script (except the line: eval `echo $LINE|awk -F "|" '{print "IP="$7}'` that i also had to change to eval `echo $LINE|awk -F "|" '{print "IP="$8}'`)

Regards
User avatar
tgn
Member
Posts: 802
Joined: 30 Dec 2009 17:59
Location: Germany

Re: Change all connected IP sets mode to Alcatel Dynamic

Post by tgn »

good inspirarion for some other scripts. didn't found this script before on bwps.

thanks for share

regards...
--- back to basics... focus your eyes to the essential things... ---
Post Reply

Return to “DHCP Configuration”