X-Git-Url: https://secure.softndesign.org/git/?a=blobdiff_plain;f=simple-cdd%2Fadditional_scripts%2Fconfigure_fe306.sh;fp=simple-cdd%2Fadditional_scripts%2Fconfigure_fe306.sh;h=0000000000000000000000000000000000000000;hb=7cf8d4b77c1be839986f26cbd946ba28ae6a464e;hp=885af249bbbdd64c0a1cff112eda95d95c3387f4;hpb=1a388d7d89aa3e2b3333b71829e02c68003c886b;p=debian6500.git diff --git a/simple-cdd/additional_scripts/configure_fe306.sh b/simple-cdd/additional_scripts/configure_fe306.sh deleted file mode 100755 index 885af24..0000000 --- a/simple-cdd/additional_scripts/configure_fe306.sh +++ /dev/null @@ -1,182 +0,0 @@ -#!/bin/bash - -# parameters -# -# ============================================================================ -# -# Copyright (C) THALES. All rights reserved -# Author: Laurent Mazet -# -# 2013-11-10 V1.0 : Creation -# -# 2013-11-20 V1.1 : L.Mazet ajout possibilite de configuration du switch -# -# ============================================================================ - -DRY= -ID= -IP=192.168.0.1 -#TRC6500_SCRIPT_DIR=/opt/trc6500/script -TRC6500_SCRIPT_DIR=$(dirname $0) - -# help function - -function usage () { - echo "usage: $PROGNAME [-a] [-d] [-h] [-i ]" - echo " -a: configure all boards" - echo " -d: dry mode" - echo " -h: help message" - echo " -i: board id (from 1 to 5)" - exit $@ - } - -# formating functions - -function title () { echo -e "\033[0;1m$*\033[0;0m"; } -function pass () { echo -e "\033[1;32m$*\033[0;0m"; } -function warn () { echo -e "\033[1;33m$*\033[0;0m"; } -function fail () { echo -e "\033[1;31m$*\033[0;0m"; } - -# configuration values - -# argument processing - -while [ $# -gt 0 ]; do - case "$1" in - -a) ID=all;; - -d) DRY=yes;; - -h) usage 0;; - -i) shift; ID=$1;; - *) usage 1;; - esac - shift -done - -# switch port configure function () - -function sw_configure () { - case "$1" in - off) CMD="-c 'configure terminal' -c 'interface range g1/39-44' -c 'shutdown' -c end -c 'clear mac address-table dynamic' -c 'clear ip arp inspection log' -c exit";; - on) CMD="-c 'configure terminal' -c 'interface range g1/39-44' -c 'no shutdown' -c end -c exit";; - 1) CMD="-c 'configure terminal' -c 'interface g1/39' -c 'no shutdown' -c end -c exit";; - 2) CMD="-c 'configure terminal' -c 'interface g1/40' -c 'no shutdown' -c end -c exit";; - 3) CMD="-c 'configure terminal' -c 'interface g1/41' -c 'no shutdown' -c end -c exit";; - 4) CMD="-c 'configure terminal' -c 'interface g1/42' -c 'no shutdown' -c end -c exit";; - 5) CMD="-c 'configure terminal' -c 'interface g1/43' -c 'no shutdown' -c end -c exit";; - 6) CMD="-c 'configure terminal' -c 'interface g1/44' -c 'no shutdown' -c end -c exit";; - esac - - if [ "$DRY" = "yes" ]; then - echo connect_switch.tcl -h swm $CMD - else - LOG=/tmp/$PROGNAME-$$.log - echo -n "sw_configure $1: " - eval $TRC6500_SCRIPT_DIR/connect_switch.tcl $CMD swm >&$LOG && pass OK || { fail KO; cat $LOG; exit 1; } - rm -f $LOG - fi -} - -case "$ID" in -1) CH1=0; CH2=1; CLOCKREF=external;; -2) CH1=2; CH2=3; CLOCKREF=internal;; -3) CH1=4; CH2=5; CLOCKREF=internal;; -4) CH1=6; CH2=7; CLOCKREF=internal;; -5) CH1=8; CH2=9; CLOCKREF=internal;; -6) CH1=10; CH2=11; CLOCKREF=internal;; -all) - for id in $(seq 1 5); do - title "switch off all fe306 ports" - sw_configure off - title "switch on port for fe306 $id" - sw_configure $id - title "configure fe306 $id" - if [ "$DRY" = "yes" ]; then - echo $(basename $0) -i $id - else - { $0 -i $id | mawk -W interactive '{print " " $0}'; } && pass OK || { fail KO; exit 1; } - fi - done - title "switch on all fe306 ports" - sw_configure on - exit 0 - ;; -*) echo "unknown fe306 id ($ID)"; exit 1;; -esac - -# configure function - -function configure () { - echo -n "$1 [$2 <= $3]: " - if [ "$DRY" = "yes" ]; then - echo wget -q -O - http://$IP/$1?$2=$3 - else - wget -q -O - http://$IP/$1?$2=$3 >/dev/null && pass OK || { fail KO; exit 1; } - fi -} - -# setup local address - -title "setup local address" -cmd="ifconfig eth1:1 192.168.0.2 netmask 255.255.255.0" -[ "$DRY" = "yes" ] && echo $cmd || { echo -n $cmd" "; eval $cmd && pass OK || { fail KO; exit 1; }; } - -# check if fe306 is connected - -#title "check presence of $IP" -#cmd="ping -c 1 -w 10 -W 10 $IP" -#[ "$DRY" = "yes" ] && echo $cmd || { echo -n $cmd" "; eval $cmd >&/dev/null && pass OK || { warn KO; ifconfig eth1:1 down; exit 0; }; } - -# get serial number - -[ "$DRY" = "yes" ] && SN=00 || \ - SN=$(wget -q -O - http://$IP/versions_en.html | mawk '/MODULE/ { module = 1 } /Serial Number/ { if (module) { printf "%02X", $4; exit 0 } }') - -[[ "$SN" =~ ^[0-9A-F][0-9A-F]$ ]] || { echo "unknown serial number ($SN)"; exit 1; } - -# configure ip - -title "configure ip" - -configure ModeServ.cmd serv_mode MANUAL -configure MacServ.cmd serv_mac 00.80.EE.00.$SN.01 -configure IpServ.cmd serv_ip $(getent hosts | awk '/fe306-'$ID'/ {print $1}') -configure MaskServ.cmd serv_mask 255.255.255.0 - -for i in $(seq 1 8); do - configure MacProd$i.cmd prod_mac$i 00.80.EE.00.$SN.0$((i+1)) - configure IpProd$i.cmd prod_ip$i 10.133.26.1$ID$i -done - -configure IpMulticast.cmd multicast_ip 238.0.0.0 -configure RxMulticast.cmd multicast_rx 62002 -configure TxMulticast.cmd multicast_tx 62004 -configure TTL.cmd ttl 10 - -# configure gps - -title "configure gps" - -configure GpsRate.cmd gps_rate 19200 -configure GpsChar.cmd gps_char 8 -configure GpsStop.cmd gps_stop 1 -configure GpsParity.cmd gps_parity no - -# configure miscellaneous - -title "configure miscellaneous" -configure BoardNum.cmd board_num $ID -configure RackNum.cmd rack_num 1 -configure Chan1Num.cmd channel1_num $CH1 -configure Chan2Num.cmd channel2_num $CH2 - -configure FpgaLoc.cmd fpga_loc FLASH -configure Clk10Mhz.cmd clk_10 $CLOCKREF -configure PllConfig.cmd pll_cfg pll_cfg_02 - -# unset local address - -title "unset local address" -cmd="ifconfig eth1:1 down" -[ "$DRY" = "yes" ] && echo $cmd || { echo -n $cmd" "; eval $cmd && pass OK || { fail KO; exit 1; }; } - -# vim:set tabstop=4 shiftwidth=4 softtabstop=4: