www.usr.com/support/gpl/USR9113_release1.0.tar.gz
[bcm963xx.git] / userapps / broadcom / cfm / html / qoscls.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2 <!--
3         (c) 2005 U.S. Robotics Corporation
4 -->
5 <html>
6 <head>
7         <title>Add Network Traffic Class</title>
8
9         <link href="usr_layout.css" type="text/css" rel="stylesheet" /><script src="usr_layout.js" type="text/javascript"></script>
10         <link href="usr_menus_dropdown.css" rel="stylesheet" type="text/css"><script src="usr_menus_dropdown.js" type="text/javascript"></script><script src="usr_menus_build.js" type="text/javascript"></script>
11         <link href="usr_device.css" type="text/css" rel="stylesheet" /><script src="usr_device.js" type="text/javascript"></script><link href="usr_91xx.css" type="text/css" rel="stylesheet" /><script src="usr_91xx.js" type="text/javascript"></script><script src="usr_resources.js" type="text/javascript"></script>
12         <script src="portName.js" type="text/javascript"></script>
13
14    <meta HTTP-EQUIV='Pragma' CONTENT='no-cache'>
15
16    <script type="text/javascript" src="util.js"></script>
17    <script type="text/javascript">
18 <!-- hide
19
20 var glbDisplayPhysicalPort = false;
21
22 /*if (document.getElementById) onload = function () {
23    var i, a;
24    for(i=0; (a = document.getElementsByTagName('tr')[i]); i++) {
25       if ((/SrcMacAddr/i.test(a.id)) ||
26           (/SrcMacMask/i.test(a.id)) ||
27           (/DstMacAddr/i.test(a.id)) ||
28           (/DstMacMask/i.test(a.id)) ||
29           (/DscpMark/i.test(a.id)))
30                 {
31          a.style.display = "none";
32       }
33       else
34          a.style.display = "";
35    }
36 }
37 */
38 function diffServCfgCb (cb) {
39    var i, a;
40    if (cb.checked == true) {
41       for(i=0; (a = document.getElementsByTagName('tr')[i]); i++) {
42          if ((/IpPre/i.test(a.id)) ||
43              (/IpTos/i.test(a.id)))
44                 {
45                  a.style.display = "none";
46          }
47          if ((/SrcMacAddr/i.test(a.id)) ||
48              (/SrcMacMask/i.test(a.id)) ||
49              (/DstMacAddr/i.test(a.id)) ||
50              (/DstMacMask/i.test(a.id)) ||
51              (/DscpMark/i.test(a.id)))
52         {
53                 a.style.display = "";
54          }
55       }
56    } else {
57       for(i=0; (a = document.getElementsByTagName('tr')[i]); i++) {
58          if ((/SrcMacAddr/i.test(a.id)) ||
59              (/SrcMacMask/i.test(a.id)) ||
60              (/DstMacAddr/i.test(a.id)) ||
61              (/DstMacMask/i.test(a.id)) ||
62              (/DscpMark/i.test(a.id)))
63          {
64                  a.style.display = "none";
65          }
66          else
67                  a.style.display = "";
68       }
69    }
70 }
71
72 function btnApply() {
73    var loc = 'qoscls.cmd?action=add';
74
75    with ( document.forms[0] ) {
76       if ( txtclsname.value == '' )
77       {
78          alert('Please enter a Quality of Service class name.');
79          return;
80       }
81
82       if (!isValidName(txtclsname.value))
83       {
84          alert('Please enter valid Quality of Service class name. Special characters are not permitted.');
85          return;
86       }
87
88 // priority.selected index == 0 is valid value.
89
90 // Some conditions are specified by default.
91
92       if (optTraffic[0].checked)
93       {
94                 if (srcaddr.value != "" && !isValidIpAddress(srcaddr.value))
95                 {
96                         alert('Source address "' + srcaddr.value + '" is an invalid IP address.');
97                         return;
98                 }
99
100                 if (srcmask.value != "" && !isValidSubnetMask(srcmask.value))
101                 {
102                         alert('Source subnet mask "' + srcmask.value + '" is an invalid subnet mask.');
103                         return;
104                 }
105
106                 if ( srcaddr.value == "" && srcmask.value != "" ) {
107                         alert('Cannot have source subnet mask without source IP address.');
108                         return;
109                 }
110
111                 if (srcport.value != "" && !isValidPort(srcport.value))
112                 {
113                         alert('Source port "' + srcport.value + '" is an invalid port number or port range.');
114                         return;
115                 }
116
117                 if (dstaddr.value != "" && !isValidIpAddress(dstaddr.value))
118                 {
119                         alert('Destination address "' + dstaddr.value + '" is invalid IP address.');
120                         return;
121                 }
122
123                 if (dstmask.value != "" && !isValidSubnetMask(dstmask.value))
124                 {
125                         alert('Destination subnet mask "' + dstmask.value + '" is an invalid subnet mask.');
126                         return;
127                 }
128
129                 if ( dstaddr.value == "" && dstmask.value != "" ) {
130                         alert('Cannot have destination subnet mask without destination IP address.');
131                         return;
132                         }
133
134                 if (dstport.value != "" && !isValidPort(dstport.value))
135                 {
136                         alert('Destination port "' + dstport.value + '" is invalid port number or port range.');
137                         return;
138                 }
139
140                 if ( srcmacaddr.value != "" && isValidMacAddress(srcmacaddr.value) == false ) {
141                         alert('Source MAC address "' + srcmacaddr.value + '" is invalid MAC address.');
142                         return;
143                 }
144                 
145                 if ( srcmacaddr.value == "" && srcmacmask.value != "" ) {
146                         alert('Cannot have source MAC mask without source MAC address.');
147                         return;
148                 }
149                 
150                 if ( dstmacaddr.value != "" && isValidMacAddress(dstmacaddr.value) == false ) {
151                         alert('Destination MAC address "' + dstmacaddr.value + '" is invalid MAC address.');
152                         return;
153                 }
154                 
155                 if ( dstmacaddr.value == "" && dstmacmask.value != "" ) {
156                         alert('Cannot have destination MAC mask without destination MAC address.');
157                         return;
158                 }
159
160                 if ( (srcport.value != "" || dstport.value != "") &&
161                         (protocol.selectedIndex > 2) )
162                 {
163                         alert("The ports must be entered if the TCP or UDP protocol is selected.");
164                         return;
165                 }
166       }
167
168       // class name
169       loc += '&clsName=' + encodeUrl(txtclsname.value);
170
171       // priority
172       var idx = priority.selectedIndex;
173       val = priority.options[idx].value;
174       loc += '&priority=' + val;
175
176       // IP precedence bits
177       idx = precedence.selectedIndex;
178       val = precedence.options[idx].value;
179       loc += '&precedence=' + val;
180
181       // IP type of service bits
182       idx = tos.selectedIndex;
183       val = tos.options[idx].value;
184       loc += '&tos=' + val;
185
186       if (optTraffic[0].checked)
187       {
188          // physical lan port ifc name
189          idx = lanIfcName.selectedIndex;
190          val = lanIfcName.options[idx].value;
191          loc += '&lanIfcName=' + val;
192
193          // protocol
194          idx = protocol.selectedIndex;
195          val = protocol.options[idx].value;
196          loc += '&protocol=' + val;
197
198          // VLAN 802.1p priority
199          loc += '&vlan8021p=-1';
200       } 
201       else 
202       {
203          // physical lan port ifc name
204          loc += '&lanIfcName=';
205
206          // protocol
207          loc += '&protocol=-1';
208
209          // VLAN 802.1p priority
210          idx = vlan8021p.selectedIndex;
211          val = vlan8021p.options[idx].value;
212          loc += '&vlan8021p=' + val;
213       }
214
215       // Check if the DiffServ configuration is enabled
216       if (enblDiffServCb.checked == false) {
217          // IP precedence bits
218          idx = precedence.selectedIndex;
219          val = precedence.options[idx].value;
220          loc += '&precedence=' + val;
221
222          // IP type of service bits
223          idx = tos.selectedIndex;
224          val = tos.options[idx].value;
225          loc += '&tos=' + val;
226       } else {
227          idx = dscp.selectedIndex;
228          if ( idx > 0 ) {
229             loc += '&dscpMark=' + dscp.options[idx].value;
230          }
231       }
232
233       // physical lan port ifc name
234      if (glbDisplayPhysicalPort)
235         loc += '&lanIfcName=' + lanIfcName.options[lanIfcName.selectedIndex].value;
236       // protocol
237       idx = protocol.selectedIndex;
238       val = protocol.options[idx].value;
239       loc += '&protocol=' + val;
240
241       // source address
242       if ( srcaddr.value != "" )
243          loc += '&srcAddr=' + srcaddr.value;
244
245       // source subnet mask
246       if ( srcmask.value != "" )
247          loc += '&srcMask=' + srcmask.value;
248
249       // source port
250       if ( srcport.value != "" )
251          loc += '&srcPort=' + srcport.value;
252
253       // destination address
254       if ( dstaddr.value != "" )
255          loc += '&dstAddr=' + dstaddr.value;
256
257       // destination subnet mask
258       if ( dstaddr.value != "" )
259          loc += '&dstMask=' + dstmask.value;
260
261       // destination port
262       if ( dstport.value != "" )
263          loc += '&dstPort=' + dstport.value;
264
265       // DiffServ configuration
266       if ( enblDiffServCb.checked == true ) {
267          loc += '&diffServCfg=' + 3;
268       } else {
269          loc += '&diffServCfg=' + 0;
270       }
271
272       // source MAC address
273       if ( srcmacaddr.value != "" )
274          loc += '&srcMacAddr=' + srcmacaddr.value;
275
276       // destination MAC address
277       if ( dstmacaddr.value != "" )
278          loc += '&dstMacAddr=' + dstmacaddr.value;
279
280       // source MAC mask
281       if ( srcmacmask.value != "" )
282          loc += '&srcMacMask=' + srcmacmask.value;
283
284       // destination MAC mask
285       if ( dstmacmask.value != "" )
286          loc += '&dstMacMask=' + dstmacmask.value;
287
288       // Check if DiffServ configuration is enabled
289       //if (enblDiffServCb.checked == false) {
290       // VLAN 802.1p priority
291       idx = vlan8021p.selectedIndex;
292       val = vlan8021p.options[idx].value;
293       loc += '&vlan8021p=' + val;
294
295            // WAN 802.1p priority
296       idx = wanVlan8021p.selectedIndex;
297       val = wanVlan8021p.options[idx].value;
298       loc += '&wanVlan8021p=' + val;
299       //}
300    }
301    var code = 'location="' + loc + '"';
302    eval(code);
303 }
304
305 function manageTrafficOptions()
306 {
307         with ( document.forms[0] )
308         {
309                 setVisibility("idIPtraffic", optTraffic[0].checked);
310                 setVisibility("id8021p", optTraffic[1].checked);
311            if (optTraffic[1].checked)
312            {
313               srcaddr.value = "";
314               srcmask.value = "";
315               srcport.value = "";
316               dstaddr.value = "";
317               dstmask.value = "";
318               dstport.value = "";
319               vlan8021p.selectedIndex = 0;
320               lanIfcName.selectedIndex = 0;
321            }
322         }
323 }
324 // done hiding -->
325    </script>
326 </head>
327 <body onload="initMenu(); manageTrafficOptions();">
328
329 <script type="text/javascript">
330         writeHeader("Add Network Traffic Class");
331 </script>
332
333 <form>
334         <p>This page creates a traffic class rule to classify the upstream traffic,
335                 assign queuing priority, and optionally overwrite the IP header TOS byte. A rule
336                 consists of a class name and at least one condition below. All of the specified
337                 conditions in this classification rule must be satisfied for the rule to take
338                 effect. Press <b>Apply</b> to save and activate the rule.</p>
339         <p><label for="txtclsname">Traffic class name:</label>
340                 <input type='text' size="20" name="txtclsname" id="txtclsname"></p>
341
342         <h4>Class Priority, IP Precedence, and Type of Service</h4>
343         <p>
344                 <input type="checkbox" name="enblDiffServCb" id="enblDiffServCb" onClick="diffServCfgCb(this)">
345                 <label for="enblDiffServCb">Enable differentiated service configuration</label>
346         </p>
347         <p>If a non-zero value is selected for <b>IP precedence</b> or
348         a value other than "Normal" for <b>IP type of service</b>,
349         the corresponding TOS byte in the IP header of the upstream packet will be
350         overwritten by the selected value.</p>
351         <p><b>Note:</b> If <b>Differentiated service configuration</b> checkbox is selected,
352         you will only need to assign <b>ATM transmit priority</b>. <b>IP Precedence</b> will not
353         be used for classification. IP TOS byte will be used for DSCP mark.</p>
354 <table id="qosCls" border="0">
355       <tr id="tblItmAtmPrio">
356          <td><label>ATM transmit priority:</label></td>
357          <td><select name='priority' id='priority'>
358                                 <option value="1">Low</option>
359                                 <option value="2">Medium</option>
360                                 <option value="3">High</option>
361             </select></td>
362       </tr>
363       <tr id="tblItmDscpMark" style="display: none">
364          <td><label>Differentiated services code point (DSCP):</label></td>
365          <td><select name="dscp" id="dscp">
366                                 <option value="0" selected>None</option>
367                                 <option value="0">default(000000)</option>
368                                 <option value="56">AF13(001110)</option>
369                                 <option value="48">AF12(001010)</option>
370                                 <option value="40">AF11(001001)</option>
371                                 <option value="32">CS1(001000)</option>
372                                 <option value="88">AF23(010110)</option>
373                                 <option value="80">AF22(010010)</option>
374                                 <option value="72">AF21(010001)</option>
375                                 <option value="64">CS2(010000)</option>
376                                 <option value="120">AF33(011110)</option>
377                                 <option value="112">AF32(011010)</option>
378                                 <option value="104">AF31(011001)</option>
379                                 <option value="96">CS3(011000)</option>
380                                 <option value="152">AF43(100110)</option>
381                                 <option value="144">AF42(100010)</option>
382                                 <option value="136">AF41(100001)</option>
383                                 <option value="128">CS4(100000)</option>
384                                 <option value="184">EF(101110)</option>
385                                 <option value="160">CS5(101000)</option>
386                                 <option value="192">CS6(110000)</option>
387                                 <option value="224">CS7(111000)</option>
388             </select></td>
389       </tr>
390       <tr id="tblItmIpPre">
391          <td><label>IP precedence:</label></td>
392          <td><select name='precedence' id='precedence'>
393                                 <option value="-1" selected>None</option>
394                                 <option value="0">0</option>
395                                 <option value="1">1</option>
396                                 <option value="2">2</option>
397                                 <option value="3">3</option>
398                                 <option value="4">4</option>
399                                 <option value="5">5</option>
400                                 <option value="6">6</option>
401                                 <option value="7">7</option>
402             </select></td>
403       </tr>
404       <tr id="tblItmIpTos">
405          <td><label>IP type of service:</label></td>
406          <td><select name='tos' id='tos'>
407                                 <option value="-1" selected>None</option>
408                                 <option value="0">Normal service</option>
409                                 <option value="2">Minimize cost</option>
410                                 <option value="4">Maximize reliability</option>
411                                 <option value="8">Maximize throughput</option>
412                                 <option value="16">Minimize delay</option>
413             </select></td>
414       </tr>
415       <tr id="tblItmDot1p">
416              <td><label>802.1p (if 802.1q is enabled on WAN):</label></td>
417              <td><select name="wanVlan8021p" id="wanVlan8021p">
418                                 <option value="-1" selected>None</option>
419                                 <option value="0">0</option>
420                                 <option value="1">1</option>
421                                 <option value="2">2</option>
422                                 <option value="3">3</option>
423                                 <option value="4">4</option>
424                                 <option value="5">5</option>
425                                 <option value="6">6</option>
426                                 <option value="7">7</option>
427                     </select></td>
428         </tr>
429         </table>
430
431         <h4>Class Traffic Conditions</h4>
432         <p>Please select a method for controlling the data traffic priority.</p>
433
434         <p>
435                 <input type="radio" name="optTraffic" id="optIP" value="trafficIP" onclick="manageTrafficOptions();" checked /> <label for="optIP">IP traffic</label><br/>
436                 <input type="radio" name="optTraffic" id="opt8021p" value="traffic8021p" onclick="manageTrafficOptions();" /> <label for="opt8021p">802.1p priority</label>
437         </p>
438
439    <table id="idIPtraffic" border="0">
440       <tr> 
441          <td><label>Physical LAN port:</label></td>
442          <td><select name="lanIfcName" id="lanIfcName">
443              <option value="" selected>None</option>
444 <script type="text/javascript">
445 <!-- hide
446 {
447    var i = 0;
448    var interfaceInfo = '';
449    var dispName = '';
450    var brdId = '<%ejGetJS(boardID)%>';
451    
452    interfaceInfo = '<%ejGetOther(bridgeInterfaceInfo, all)%>';
453    var interfaces = interfaceInfo.split('|');
454    interfaces.sort();
455    glbDisplayPhysicalPort = true;
456    for ( i = 0; i < interfaces.length; i++ ) {
457       dispName = getUNameByLName(brdId + '|' + interfaces[i]);
458       if (dispName.indexOf('nas_') != -1)
459          continue;      // skip nas_ ifc
460       if (interfaces[i] != '') {
461          document.writeln("  <option value='" + interfaces[i] + "'>" + dispName + "</option>");
462       }
463    }
464 }
465 // done hiding -->
466 </script>
467             </select>
468          </td>
469       </tr>
470       <tr>
471          <td><label>Protocol:</label></td>
472          <td><select name='protocol' id='protocol'>
473                <option value="0">TCP/UDP</option>
474                <option value="1">TCP</option>
475                <option value="2">UDP</option>
476                <option value="3">ICMP</option>
477             </select></td>
478       </tr>
479
480       <tr><th align="left" colspan="2">Source</td></tr>
481       <tr>
482          <td><label for="srcaddr">IP address:</label></td>
483          <td><input type='text' size="20" name="srcaddr" id="srcaddr"></td>
484       </tr>
485       <tr>
486          <td><label for="srcport">UDP/TCP port(s):</label></td>
487          <td><input type='text' size="20" name="srcport" id="srcport"> <label class="clsNote" for="srcport">(port or port:port)</label></td>
488       </tr>
489       <tr>
490          <td><label for="srcmask">Subnet mask:</label></td>
491          <td><input type='text' size="20" name="srcmask" id="srcmask"></td>
492       </tr>
493           <tr id="tblItmSrcMacAddr" style="display: none">
494              <td><label>Source MAC address:</label></td>
495              <td><input type="text" size="20" name="srcmacaddr" id="srcmacaddr" maxlength="17"></td>
496           </tr>
497           <tr id="tblItmSrcMacMask" style="display: none">
498              <td><label>Source MAC mask:</label></td>
499              <td><input type="text" size="20" name="srcmacmask" id="srcmacmask" maxlength="17"></td>
500           </tr>
501
502       <tr><th align="left" colspan="2">Destination</th></tr>
503       <tr>
504          <td><label for="dstaddr">IP address:</label></td>
505          <td><input type='text' size="20" name="dstaddr" id="dstaddr"></td>
506       </tr>
507       <tr>
508          <td><label for="dstport">UDP/TCP port(s):</label></td>
509          <td><input type='text' size="20" name="dstport" id="dstport"> <label class="clsNote" for="dstport">(port or port:port)</label></td>
510       </tr>
511       <tr>
512          <td><label for="dstmask">Subnet mask:</label></td>
513          <td><input type='text' size="20" name="dstmask" id="dstmask"></td>
514       </tr>
515       <tr id="tblItmDstMacAddr" style="display: none">
516              <td><label>Destination MAC address:</label></td>
517              <td><input type="text" size="20" name="dstmacaddr" id="dstmacaddr" maxlength="17"></td>
518           </tr>
519           <tr id="tblItmDstMacMask" style="display: none">
520              <td><label>Destination MAC mask:</label></td>
521              <td><input type="text" size="20" name="dstmacmask" id="dstmacmask" maxlength="17"></td>
522           </tr>
523    </table>
524
525         <p id="id8021p"><label>802.1p priority:</label>
526                 <select name='vlan8021p' id='vlan8021p'>
527                         <option value="0">0</option>
528                         <option value="1">1</option>
529                         <option value="2">2</option>
530                         <option value="3">3</option>
531                         <option value="4">4</option>
532                         <option value="5">5</option>
533                         <option value="6">6</option>
534                         <option value="7">7</option>
535                 </select>
536         </p>
537
538         <p><input type='button' onClick='btnApply()' value='Apply'></p>
539 </form>
540
541 <script type="text/javascript">
542         writeFooter();
543 </script>
544
545 </body>
546 </html>
547