今天学会了.soc脚本,之前都是一行一行写的命令,比较费时费力。现在,一个for循环就可以搞定。
before:
# "The 1st port connects to the device TG/Ixia.."
# "The remaining ports need to be plugged by the loopback module to become LINKUP."
echo "Snake traffic setting"
vlan clear
vlan remove 1 pbm=all
vlan create 100 pbm=ce0,ce1 ubm=ce0,ce1
vlan create 101 pbm=ce1,ce2 ubm=ce1,ce2
vlan create 102 pbm=ce2,ce3 ubm=ce2,ce3
vlan create 103 pbm=ce3,ce4 ubm=ce3,ce4
vlan create 104 pbm=ce4,ce5 ubm=ce4,ce5
vlan create 105 pbm=ce5,ce6 ubm=ce5,ce6
vlan create 106 pbm=ce6,ce7 ubm=ce6,ce7
vlan create 107 pbm=ce7,ce8 ubm=ce7,ce8
vlan create 108 pbm=ce8,ce9 ubm=ce8,ce9
vlan create 109 pbm=ce9,ce10 ubm=ce9,ce10
vlan create 110 pbm=ce10,ce11 ubm=ce10,ce11
vlan create 111 pbm=ce11,ce12 ubm=ce11,ce12
vlan create 112 pbm=ce12,ce13 ubm=ce12,ce13
vlan create 113 pbm=ce13,ce14 ubm=ce13,ce14
vlan create 114 pbm=ce14,ce15 ubm=ce14,ce15
vlan create 115 pbm=ce15,ce16 ubm=ce15,ce16
vlan create 116 pbm=ce16,ce17 ubm=ce16,ce17
vlan create 117 pbm=ce17,ce18 ubm=ce17,ce18
vlan create 118 pbm=ce18,ce19 ubm=ce18,ce19
vlan create 119 pbm=ce19,ce20 ubm=ce19,ce20
vlan create 120 pbm=ce20,ce21 ubm=ce20,ce21
vlan create 121 pbm=ce21,ce22 ubm=ce21,ce22
vlan create 122 pbm=ce22,ce23 ubm=ce22,ce23
vlan create 123 pbm=ce23,ce24 ubm=ce23,ce24
vlan create 124 pbm=ce24,ce25 ubm=ce24,ce25
vlan create 125 pbm=ce25,ce26 ubm=ce25,ce26
vlan create 126 pbm=ce26,ce27 ubm=ce26,ce27
vlan create 127 pbm=ce27,ce28 ubm=ce27,ce28
vlan create 128 pbm=ce28,ce29 ubm=ce28,ce29
vlan create 129 pbm=ce29,ce30 ubm=ce29,ce30
vlan create 130 pbm=ce30,ce31 ubm=ce30,ce31
vlan create 131 pbm=ce31,ce32 ubm=ce31,ce32
vlan create 132 pbm=ce32,ce33 ubm=ce32,ce33
vlan create 133 pbm=ce33,ce34 ubm=ce33,ce34
vlan create 134 pbm=ce34,ce35 ubm=ce34,ce35
vlan create 135 pbm=ce35,ce36 ubm=ce35,ce36
vlan create 136 pbm=ce36,ce37 ubm=ce36,ce37
vlan create 137 pbm=ce37,ce38 ubm=ce37,ce38
vlan create 138 pbm=ce38,ce39 ubm=ce38,ce39
vlan create 139 pbm=ce39,ce40 ubm=ce39,ce40
vlan create 140 pbm=ce40,ce41 ubm=ce40,ce41
vlan create 141 pbm=ce41,ce42 ubm=ce41,ce42
vlan create 142 pbm=ce42,ce43 ubm=ce42,ce43
vlan create 143 pbm=ce43,ce44 ubm=ce43,ce44
vlan create 144 pbm=ce44,ce45 ubm=ce44,ce45
vlan create 145 pbm=ce45,ce46 ubm=ce45,ce46
vlan create 146 pbm=ce46,ce47 ubm=ce46,ce47
vlan create 147 pbm=ce47,ce48 ubm=ce47,ce48
vlan create 148 pbm=ce48,ce49 ubm=ce48,ce49
vlan create 149 pbm=ce49,ce50 ubm=ce49,ce50
vlan create 150 pbm=ce50,ce51 ubm=ce50,ce51
vlan create 151 pbm=ce51,ce52 ubm=ce51,ce52
vlan create 152 pbm=ce52,ce53 ubm=ce52,ce53
vlan create 153 pbm=ce53,ce54 ubm=ce53,ce54
vlan create 154 pbm=ce54,ce55 ubm=ce54,ce55
vlan create 155 pbm=ce55,ce56 ubm=ce55,ce56
vlan create 156 pbm=ce56,ce57 ubm=ce56,ce57
vlan create 157 pbm=ce57,ce58 ubm=ce57,ce58
vlan create 158 pbm=ce58,ce59 ubm=ce58,ce59
vlan create 159 pbm=ce59,ce60 ubm=ce59,ce60
vlan create 160 pbm=ce60,ce61 ubm=ce60,ce61
vlan create 161 pbm=ce61,ce62 ubm=ce61,ce62
vlan create 162 pbm=ce62,ce63 ubm=ce62,ce63
vlan create 163 pbm=ce63,ce64 ubm=ce63,ce64
vlan create 164 pbm=ce64,ce65 ubm=ce64,ce65
vlan create 165 pbm=ce65,ce66 ubm=ce65,ce66
vlan create 166 pbm=ce66,ce67 ubm=ce66,ce67
vlan create 167 pbm=ce67,ce68 ubm=ce67,ce68
vlan create 168 pbm=ce68,ce69 ubm=ce68,ce69
vlan create 169 pbm=ce69,ce70 ubm=ce69,ce70
vlan create 170 pbm=ce70,ce71 ubm=ce70,ce71
vlan create 171 pbm=ce71,ce72 ubm=ce71,ce72
vlan create 172 pbm=ce72,ce73 ubm=ce72,ce73
vlan create 173 pbm=ce73,ce74 ubm=ce73,ce74
vlan create 174 pbm=ce74,ce75 ubm=ce74,ce75
vlan create 175 pbm=ce75,ce76 ubm=ce75,ce76
vlan create 176 pbm=ce76,ce77 ubm=ce76,ce77
vlan create 177 pbm=ce77,ce78 ubm=ce77,ce78
vlan create 178 pbm=ce78,ce79 ubm=ce78,ce79
vlan create 179 pbm=ce79,ce80 ubm=ce79,ce80
vlan create 180 pbm=ce80,ce81 ubm=ce80,ce81
vlan create 181 pbm=ce81,ce82 ubm=ce81,ce82
vlan create 182 pbm=ce82,ce83 ubm=ce82,ce83
vlan create 183 pbm=ce83,ce84 ubm=ce83,ce84
vlan create 184 pbm=ce84,ce85 ubm=ce84,ce85
vlan create 185 pbm=ce85,ce86 ubm=ce85,ce86
vlan create 186 pbm=ce86,ce87 ubm=ce86,ce87
vlan create 187 pbm=ce87,ce88 ubm=ce87,ce88
vlan create 188 pbm=ce88,ce89 ubm=ce88,ce89
vlan create 189 pbm=ce89,ce90 ubm=ce89,ce90
vlan create 190 pbm=ce90,ce91 ubm=ce90,ce91
vlan create 191 pbm=ce91,ce92 ubm=ce91,ce92
vlan create 192 pbm=ce92,ce93 ubm=ce92,ce93
vlan create 193 pbm=ce93,ce94 ubm=ce93,ce94
vlan create 194 pbm=ce94,ce95 ubm=ce94,ce95
vlan create 195 pbm=ce95,ce96 ubm=ce95,ce96
vlan create 196 pbm=ce96,ce97 ubm=ce96,ce97
vlan create 197 pbm=ce97,ce98 ubm=ce97,ce98
vlan create 198 pbm=ce98,ce99 ubm=ce98,ce99
vlan create 199 pbm=ce99,ce100 ubm=ce99,ce100
vlan create 200 pbm=ce100,ce101 ubm=ce100,ce101
vlan create 201 pbm=ce101,ce102 ubm=ce101,ce102
vlan create 202 pbm=ce102,ce103 ubm=ce102,ce103
vlan create 203 pbm=ce103,ce104 ubm=ce103,ce104
vlan create 204 pbm=ce104,ce105 ubm=ce104,ce105
vlan create 205 pbm=ce105,ce106 ubm=ce105,ce106
vlan create 206 pbm=ce106,ce107 ubm=ce106,ce107
vlan create 207 pbm=ce107,ce108 ubm=ce107,ce108
vlan create 208 pbm=ce108,ce109 ubm=ce108,ce109
vlan create 209 pbm=ce109,ce110 ubm=ce109,ce110
vlan create 210 pbm=ce110,ce111 ubm=ce110,ce111
vlan create 211 pbm=ce111,ce112 ubm=ce111,ce112
vlan create 212 pbm=ce112,ce113 ubm=ce112,ce113
vlan create 213 pbm=ce113,ce114 ubm=ce113,ce114
vlan create 214 pbm=ce114,ce115 ubm=ce114,ce115
vlan create 215 pbm=ce115,ce116 ubm=ce115,ce116
vlan create 216 pbm=ce116,ce117 ubm=ce116,ce117
vlan create 217 pbm=ce117,ce118 ubm=ce117,ce118
vlan create 218 pbm=ce118,ce119 ubm=ce118,ce119
vlan create 219 pbm=ce119,ce120 ubm=ce119,ce120
vlan create 220 pbm=ce120,ce121 ubm=ce120,ce121
vlan create 221 pbm=ce121,ce122 ubm=ce121,ce122
vlan create 222 pbm=ce122,ce123 ubm=ce122,ce123
vlan create 223 pbm=ce123,ce124 ubm=ce123,ce124
vlan create 224 pbm=ce124,ce125 ubm=ce124,ce125
vlan create 225 pbm=ce125,ce126 ubm=ce125,ce126
vlan create 226 pbm=ce126,ce127 ubm=ce126,ce127
vlan create 227 pbm=ce127,ce0 ubm=ce127,ce0
pvlan set ce0 100
pvlan set ce1 101
pvlan set ce2 102
pvlan set ce3 103
pvlan set ce4 104
pvlan set ce5 105
pvlan set ce6 106
pvlan set ce7 107
pvlan set ce8 108
pvlan set ce9 109
pvlan set ce10 110
pvlan set ce11 111
pvlan set ce12 112
pvlan set ce13 113
pvlan set ce14 114
pvlan set ce15 115
pvlan set ce16 116
pvlan set ce17 117
pvlan set ce18 118
pvlan set ce19 119
pvlan set ce20 120
pvlan set ce21 121
pvlan set ce22 122
pvlan set ce23 123
pvlan set ce24 124
pvlan set ce25 125
pvlan set ce26 126
pvlan set ce27 127
pvlan set ce28 128
pvlan set ce29 129
pvlan set ce30 130
pvlan set ce31 131
pvlan set ce32 132
pvlan set ce33 133
pvlan set ce34 134
pvlan set ce35 135
pvlan set ce36 136
pvlan set ce37 137
pvlan set ce38 138
pvlan set ce39 139
pvlan set ce40 140
pvlan set ce41 141
pvlan set ce42 142
pvlan set ce43 143
pvlan set ce44 144
pvlan set ce45 145
pvlan set ce46 146
pvlan set ce47 147
pvlan set ce48 148
pvlan set ce49 149
pvlan set ce50 150
pvlan set ce51 151
pvlan set ce52 152
pvlan set ce53 153
pvlan set ce54 154
pvlan set ce55 155
pvlan set ce56 156
pvlan set ce57 157
pvlan set ce58 158
pvlan set ce59 159
pvlan set ce60 160
pvlan set ce61 161
pvlan set ce62 162
pvlan set ce63 163
pvlan set ce64 164
pvlan set ce65 165
pvlan set ce66 166
pvlan set ce67 167
pvlan set ce68 168
pvlan set ce69 169
pvlan set ce70 170
pvlan set ce71 171
pvlan set ce72 172
pvlan set ce73 173
pvlan set ce74 174
pvlan set ce75 175
pvlan set ce76 176
pvlan set ce77 177
pvlan set ce78 178
pvlan set ce79 179
pvlan set ce80 180
pvlan set ce81 181
pvlan set ce82 182
pvlan set ce83 183
pvlan set ce84 184
pvlan set ce85 185
pvlan set ce86 186
pvlan set ce87 187
pvlan set ce88 188
pvlan set ce89 189
pvlan set ce90 190
pvlan set ce91 191
pvlan set ce92 192
pvlan set ce93 193
pvlan set ce94 194
pvlan set ce95 195
pvlan set ce96 196
pvlan set ce97 197
pvlan set ce98 198
pvlan set ce99 199
pvlan set ce100 200
pvlan set ce101 201
pvlan set ce102 202
pvlan set ce103 203
pvlan set ce104 204
pvlan set ce105 205
pvlan set ce106 206
pvlan set ce107 207
pvlan set ce108 208
pvlan set ce109 209
pvlan set ce110 210
pvlan set ce111 211
pvlan set ce112 212
pvlan set ce113 213
pvlan set ce114 214
pvlan set ce115 215
pvlan set ce116 216
pvlan set ce117 217
pvlan set ce118 218
pvlan set ce119 219
pvlan set ce120 220
pvlan set ce121 221
pvlan set ce122 222a
pvlan set ce123 223
pvlan set ce124 224
pvlan set ce125 225
pvlan set ce126 226
pvlan set ce127 227
echo "Completed the snake traffic setting."
[After]
echo "starting 128x100 vlan setting"
vlan clear
vlan remove 1 pbm=all
local portPrefix ce
local portMaxId 127
expr ${portMaxId}-1;local pnum $?;
for i=0,$pnum,1 '
expr ${i}+1; local nextport $?;
expr ${i}+100; local nvid $?;
vlan create ${nvid} pbm=$portPrefix$i,$portPrefix${nextport} ubm=$portPrefix$i,$portPrefix${nextport}'
for j=0,$portMaxId,1 '
expr ${j}+100; local pvid $?;
pvlan set $portPrefix$j ${pvid}'
注意:不能有空行,否则会报错。。
BCM.0> test.soc
starting 128x100 vlan setting
ERROR: Command line ended while in a quoted string
Error: file ./test.soc: line 11 (error code -1): script terminated