-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathswagbox.js
221 lines (196 loc) · 6.75 KB
/
swagbox.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
// <script type = "text/javascript">
//<![CDATA[
//from panbs.html
boxIndex = "10";
boxFactor = "undefined";
debugTxt = "Debug Information<br>";
function bw() {
contentID = document.getElementById("contentID");
peakBandwidth = document.getElementById("peakBandwidth");
effectiveTP = parseInt(contentID.value) * parseInt(peakBandwidth.value); // rough approximation of needs, multiply BW *2 if using TP
debugTxt = (debugTxt + "<br>effectiveTP = " + effectiveTP);
if (parseInt(contentID.value) == 1) {
boxFactor = ('<ul><li>Peak throughput</li>');
} else if (parseInt(contentID.value) == 2) {
boxFactor = ('<ul><li>Peak throughput</li><li>Use of Content ID</li>');
}
debugTxt = (debugTxt + "<br>Initial boxIndex = " + boxIndex);
if (effectiveTP < 50) {
boxIndex = "10";
} else if (effectiveTP < 250) {
boxIndex = "20";
} else if (effectiveTP < 500) {
boxIndex = "30";
} else if (effectiveTP < 1000) {
boxIndex = "40";
} else if (effectiveTP < 4000) {
boxIndex = "70";
} else if (effectiveTP < 10000) {
boxIndex = "80";
} else if (effectiveTP <= 20000) {
boxIndex = "90";
} else if (effectiveTP > 20000) {
boxIndex = "100";
} //end if
} // end function bw()
function users() {
userCount = document.getElementById("users");
debugTxt = (debugTxt + "<br>userCount = " + userCount.value + " boxindex = " + boxIndex);
if (parseInt(userCount.value) <= 40) {
userIndex = "10";
} else if (parseInt(userCount.value) == 0) {
userIndex = "10";
} else if (parseInt(userCount.value) <= 100) {
userIndex = "20";
} else if (parseInt(userCount.value) <= 500) {
userIndex = "30";
} else if (parseInt(userCount.value) <= 900) {
userIndex = "40";
} else if (parseInt(userCount.value) <= 2000) {
userIndex = "70";
} else if (parseInt(userCount.value) <= 5000) {
userIndex = "80";
} else if (parseInt(userCount.value) <= 10000) {
userIndex = "90";
} else if (parseInt(userCount.value) > 10000) {
userIndex = "100";
} //end if
debugTxt = (debugTxt + "<br>userIndex = " + userIndex + " boxindex = " + boxIndex);
if (userIndex > boxIndex) {
boxIndex = userIndex;
boxFactor = ('<ul><li>Number of users</li>')
} else if (userIndex == boxIndex) {
boxFactor = (boxFactor + "<li>Number of users</li>")
}
} // end function users()
function qos() {
qosBW = document.getElementById("qos");
debugTxt = (debugTxt + "<br>qosBW = " + qosBW.value + " boxindex = " + boxIndex)
if (parseInt(qosBW.value) <= 25) {
qosIndex = "10";
} else if (parseInt(qosBW.value) <= 50) {
qosIndex = "20";
} else if (parseInt(qosBW.value) <= 100) {
qosIndex = "30";
} else if (parseInt(qosBW.value) > 100) {
qosIndex = "70";
}
debugTxt = (debugTxt + "<br>qosIndex = " + qosIndex + " boxindex = " + boxIndex)
if (qosIndex > boxIndex) {
boxIndex = qosIndex;
boxFactor = ('<ul><li>QoS requirements</li>');
} else if (qosIndex == boxIndex) {
boxFactor = (boxFactor + '<li>QoS requirements</li>');
}
} //end func qos
function sessions() {
sessionIndex = document.getElementById("maxSessions");
debugTxt = (debugTxt + "<br>sessionIndex = " + sessionIndex.value + " boxindex = " + boxIndex);
if (parseInt(sessionIndex.value) > boxIndex) {
boxIndex = parseInt(sessionIndex.value);
boxFactor = ('<ul><li>Concurrent sessions</li>')
} else if (parseInt(sessionIndex.value) == boxIndex) {
boxFactor = (boxFactor + "<li>Concurrent sessions</li>")
}
} // end function maxSessions()
function cps() {
cpsIndex = document.getElementById("maxCPS");
debugTxt = (debugTxt + "<br>cpsIndex = " + cpsIndex.value + " boxindex = " + boxIndex);
if (cpsIndex.value > boxIndex) {
boxIndex = cpsIndex.value;
boxFactor = ('<ul><li>Connections per second</li>')
} else if (cpsIndex.value == boxIndex) {
boxFactor = (boxFactor + "<li>Connections per second</li>")
}
} // end function cps()
function copperIf() {
copperIfIndex = document.getElementById("copperIf");
debugTxt = (debugTxt + "<br>copperIfIndex.value = " + copperIfIndex.value + " boxindex = " + boxIndex);
if (copperIfIndex.value > boxIndex) {
boxIndex = copperIfIndex.value;
boxFactor = ('<ul><li>Number of copper interfaces</li>')
} else if (copperIfIndex.value == boxIndex) {
boxFactor = (boxFactor + "<li>Number of copper interfaces</li>")
}
} // end function copperIf
function gbFiber() {
gbFiberIndex = document.getElementById("gbFiber");
debugTxt = (debugTxt + "<br>gbFiberIndex.value = " + gbFiberIndex.value + " boxindex = " + boxIndex);
if (gbFiberIndex.value > boxIndex) {
boxIndex = parseInt(gbFiberIndex.value);
boxFactor = ('<ul><li>Number of 1Gb fiber interfaces</li>')
} else if (gbFiberIndex.value == boxIndex) {
boxFactor = (boxFactor + "<li>Number of 1Gb fiber interfaces</li>")
}
} // end function gbFiber
function tenGb() {
tenGbIndex = document.getElementById("tenGb");
debugTxt = (debugTxt + "<br>tenGbIndex.value = " + tenGbIndex.value + " boxindex = " + boxIndex);
if (parseInt(tenGbIndex.value) > boxIndex) {
boxIndex = parseInt(tenGbIndex.value);
boxFactor = ('<ul><li>10Gb interfaces</li>')
} else if (parseInt(tenGbIndex.value) == boxIndex) {
boxFactor = (boxFactor + "<li>10Gb interfaces</li>")
}
} // end function tenGB
function swagBox() {
resetVar();
evaluateBox();
}
function resetVar() {
boxIndex = "10";
boxFactor = "undefined"
}
function evaluateBox() {
var box = ""
debugTxt = "debug details:<br>"
bw();
users();
qos();
sessions();
cps();
copperIf();
gbFiber();
tenGb();
boxInt = (parseInt(boxIndex));
switch (boxInt) {
case 10:
box = "PA200";
break;
case 20:
box = "PA500";
break;
case 30:
box = "PA2020";
break;
case 40:
box = "PA2050";
break;
case 70:
box = "PA5020";
break;
case 80:
box = "PA5050";
break;
case 90:
box = "PA5060";
break;
case 100:
box = "multiple-device, horizontally scaled solution to meet these requirements. Please work with your Palo Alto Networks SE to come up with a viable design.";
break;
default:
box = "undefined - something went very very wrong"
} //end switch
divOutput = document.getElementById("divOutput");
divOutput.innerHTML = ("You appear to need a " + box);
divDetails = document.getElementById("divDetails");
boxFactor = (boxFactor + "</ul>");
divDetails.innerHTML = ("The primary factor(s) used in this recommendation are:<br> " + boxFactor /*+ "<br>" + debugTxt*/);
divDebug = document.getElementById("divDebug");
//divDebug.innerHTML = (debugTxt);
//document.getElementById('divOutput').scrollIntoView();
setTimeout(function(){document.getElementById('divOutput').scrollIntoView();}, 300);
//window.location.href = "#output";
} // end function evaluateBox()
//]]>
// </script>