mirror of
https://github.com/logicog/RTLPlayground.git
synced 2026-11-01 18:04:12 +08:00
Driving responses to be based on number of ports in machine
configuration
This commit is contained in:
1 parent
77fc545c6a
commit
4dee3d2ad2
1 file changed
+28
-65
+28
-65
@@ -50,7 +50,13 @@ state = {
|
|||||||
"lldp_enabled": False,
|
"lldp_enabled": False,
|
||||||
"vlans": {1: {"active": True, "name": "", "untagged":[1,2,3,4,5,6,7,8], "tagged":[], "pvid":[1,2,3,4,5,6,7,8]}},
|
"vlans": {1: {"active": True, "name": "", "untagged":[1,2,3,4,5,6,7,8], "tagged":[], "pvid":[1,2,3,4,5,6,7,8]}},
|
||||||
"cmd_history": [],
|
"cmd_history": [],
|
||||||
"mgmt_vlan": 1
|
"mgmt_vlan": 1,
|
||||||
|
"lags": [
|
||||||
|
{"cfg":"0000","aggValid":0,"agg":"000000000000","members":"0000"},
|
||||||
|
{"cfg":"0000","aggValid":0,"agg":"000000000000","members":"0000"},
|
||||||
|
{"cfg":"0000","aggValid":0,"agg":"000000000000","members":"0000"},
|
||||||
|
{"cfg":"0000","aggValid":0,"agg":"000000000000","members":"0000"}
|
||||||
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -371,16 +377,10 @@ class Handler(SimpleHTTPRequestHandler):
|
|||||||
return b"DNS servers 0.0.0.0 0.0.0.0, from DHCP 0.0.0.0"
|
return b"DNS servers 0.0.0.0 0.0.0.0, from DHCP 0.0.0.0"
|
||||||
|
|
||||||
def _api_storm(self):
|
def _api_storm(self):
|
||||||
|
global state
|
||||||
return [
|
return [
|
||||||
{"portNum":1,"en":"0000","pps":"0000","rate":"000000000000000000000000"},
|
{"portNum":i,"en":"0000","pps":"0000","rate":"000000000000000000000000"}
|
||||||
{"portNum":2,"en":"0000","pps":"0000","rate":"000000000000000000000000"},
|
for i in range(1, PORTS + 1)
|
||||||
{"portNum":3,"en":"0000","pps":"0000","rate":"000000000000000000000000"},
|
|
||||||
{"portNum":4,"en":"0000","pps":"0000","rate":"000000000000000000000000"},
|
|
||||||
{"portNum":5,"en":"0000","pps":"0000","rate":"000000000000000000000000"},
|
|
||||||
{"portNum":6,"en":"0000","pps":"0000","rate":"000000000000000000000000"},
|
|
||||||
{"portNum":7,"en":"0000","pps":"0000","rate":"000000000000000000000000"},
|
|
||||||
{"portNum":8,"en":"0000","pps":"0000","rate":"000000000000000000000000"},
|
|
||||||
{"portNum":9,"en":"0000","pps":"0000","rate":"000000000000000000000000"}
|
|
||||||
]
|
]
|
||||||
|
|
||||||
def _api_stp(self):
|
def _api_stp(self):
|
||||||
@@ -500,29 +500,23 @@ class Handler(SimpleHTTPRequestHandler):
|
|||||||
}
|
}
|
||||||
|
|
||||||
def _api_lacp(self):
|
def _api_lacp(self):
|
||||||
|
global state
|
||||||
return {
|
return {
|
||||||
"on": 0,
|
"on": 0,
|
||||||
"lags": [
|
"lags": state["lags"],
|
||||||
{"cfg":"0000","aggValid":0,"agg":"000000000000","members":"0000"},
|
|
||||||
{"cfg":"0000","aggValid":0,"agg":"000000000000","members":"0000"},
|
|
||||||
{"cfg":"0000","aggValid":0,"agg":"000000000000","members":"0000"},
|
|
||||||
{"cfg":"0000","aggValid":0,"agg":"000000000000","members":"0000"}
|
|
||||||
],
|
|
||||||
"ports": [
|
"ports": [
|
||||||
{"p":1,"lag":255,"a":"00","pt":"00","rs":0,"rx":"0000","psys":"000000000000"},
|
{
|
||||||
{"p":2,"lag":255,"a":"00","pt":"00","rs":0,"rx":"0000","psys":"000000000000"},
|
"p":i,
|
||||||
{"p":3,"lag":255,"a":"00","pt":"00","rs":0,"rx":"0000","psys":"000000000000"},
|
"lag":255,
|
||||||
{"p":4,"lag":255,"a":"00","pt":"00","rs":0,"rx":"0000","psys":"000000000000"},
|
"a":"00",
|
||||||
{"p":5,"lag":255,"a":"00","pt":"00","rs":0,"rx":"0000","psys":"000000000000"},
|
"pt":"00",
|
||||||
{"p":6,"lag":255,"a":"00","pt":"00","rs":0,"rx":"0000","psys":"000000000000"},
|
"rs":0,
|
||||||
{"p":7,"lag":255,"a":"00","pt":"00","rs":0,"rx":"0000","psys":"000000000000"},
|
"rx":"0000",
|
||||||
{"p":8,"lag":255,"a":"00","pt":"00","rs":0,"rx":"0000","psys":"000000000000"},
|
"psys":"000000000000"
|
||||||
{"p":9,"lag":255,"a":"00","pt":"00","rs":0,"rx":"0000","psys":"000000000000"}
|
} for i in range(1, PORTS + 1)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def _api_lag(self):
|
def _api_lag(self):
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
@@ -627,45 +621,14 @@ class Handler(SimpleHTTPRequestHandler):
|
|||||||
return text.encode("utf-8"), "text/plain"
|
return text.encode("utf-8"), "text/plain"
|
||||||
|
|
||||||
def _api_isolation(self):
|
def _api_isolation(self):
|
||||||
|
global state
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
"portNum": 1,
|
"portNum": i,
|
||||||
"allow": "03ff"
|
"allow": "03ff"
|
||||||
},
|
}
|
||||||
{
|
for i in range(1, PORTS + 1)
|
||||||
"portNum": 2,
|
]
|
||||||
"allow": "03ff"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"portNum": 3,
|
|
||||||
"allow": "03ff"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"portNum": 4,
|
|
||||||
"allow": "03ff"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"portNum": 5,
|
|
||||||
"allow": "03ff"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"portNum": 6,
|
|
||||||
"allow": "03ff"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"portNum": 7,
|
|
||||||
"allow": "03ff"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"portNum": 8,
|
|
||||||
"allow": "03ff"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"portNum": 9,
|
|
||||||
"allow": "03ff"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
def _api_information(self):
|
def _api_information(self):
|
||||||
return {
|
return {
|
||||||
|
|||||||
Reference in new issue
Block a user