CM_ENCRYPTED.sh 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. #!/bin/sh
  2. # file: scripts/CM_ENCRYPTED.sh
  3. # This script formats and sends a CM_ENCRYPTED_PAYBOOT message to a
  4. # specific slave device; the message is written as a text file then
  5. # passed to efsu to send;
  6. # ====================================================================
  7. # host symbols;
  8. # --------------------------------------------------------------------
  9. . ./hardware.sh
  10. # ====================================================================
  11. # file symbols;
  12. # --------------------------------------------------------------------
  13. COUNT=1
  14. FRAME=test.hex
  15. # ====================================================================
  16. # display usage information;e
  17. # --------------------------------------------------------------------
  18. usage()
  19. {
  20. cat << EOF
  21. usage: ${options}
  22. This scripts sets the up and down bandwidth on Slave devices in the network
  23. OPTIONS
  24. -h show this message
  25. -s slave device name
  26. -u Upstream Bandwidth required in Mbps
  27. -d Downstream Bandwidth required in Mbps
  28. Note: Bandwidth value support 0-15 input values and 0 selects full line rate
  29. EOF
  30. }
  31. # ====================================================================
  32. # command line parser routine
  33. # --------------------------------------------------------------------
  34. device=
  35. while getopts "hs:u:d:" OPTION
  36. do
  37. case ${OPTION} in
  38. h)
  39. usage
  40. exit 1
  41. ;;
  42. s)
  43. device=${OPTARG}
  44. ;;
  45. esac
  46. done
  47. if [[ -z ${device} ]]; then
  48. usage
  49. exit 1
  50. elif [ ${device} = slave1 ]; then
  51. target=${slave1}
  52. elif [ ${device} = slave2 ]; then
  53. target=${slave2}
  54. elif [ ${device} = slave3 ]; then
  55. target=${slave3}
  56. elif [ ${device} = slave4 ]; then
  57. target=${slave4}
  58. elif [ ${device} = slave5 ]; then
  59. target=${slave5}
  60. else
  61. target=${master}
  62. fi
  63. # ====================================================================
  64. # Format the MME with processed values from command line
  65. # --------------------------------------------------------------------
  66. da="ff ff ff ff ff ff"
  67. sa="ff ff ff ff ff ff"
  68. mtype="88 e1"
  69. mmv="01"
  70. mmtype="06 60"
  71. FMI="00 00"
  72. PEKS="0F"
  73. AVLN="00"
  74. PID="04"
  75. PRN="09 75"
  76. PMN="01"
  77. UUID="55 aa 55 aa 55 aa 55 aa 55 aa 55 aa 55 aa 55 aa"
  78. LEN="00 00"
  79. HLE="AA 55 aa 55 aa 55 aa 55 aa 55 aa 55 aa 55 aa 55"
  80. fill="ff ff ff ff ff ff ff ff ff"
  81. cat > ${FRAME} <<EOF
  82. ${da} ${sa} ${mtype} ${mmv} ${mmtype} ${FMI} ${PEKS} ${AVLN} ${PID} ${PRN} ${PMN} ${UUID} ${LEN} ${HLE} ${fill} ${fill} ${fill} ${fill} ${fill} ${fill} ${fill} ${fill}
  83. EOF
  84. # ====================================================================
  85. # check environment;
  86. # --------------------------------------------------------------------
  87. if [ ! -f ${FRAME} ]; then
  88. echo "File ${FRAME} is missing or misplaced"
  89. exit 1
  90. fi
  91. # ====================================================================
  92. # send traffic in both directions;
  93. # --------------------------------------------------------------------
  94. efsu -i ${ETH2} -h ${FRAME} -l ${COUNT} -v
  95. rm ${FRAME}