tplinkrouterc6u 5.1.0__tar.gz → 5.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {tplinkrouterc6u-5.1.0 → tplinkrouterc6u-5.2.0}/PKG-INFO +39 -4
- {tplinkrouterc6u-5.1.0 → tplinkrouterc6u-5.2.0}/README.md +38 -3
- {tplinkrouterc6u-5.1.0 → tplinkrouterc6u-5.2.0}/setup.py +1 -1
- tplinkrouterc6u-5.1.0/test/test_client.py → tplinkrouterc6u-5.2.0/test/test_client_c6u.py +2 -1
- {tplinkrouterc6u-5.1.0 → tplinkrouterc6u-5.2.0}/test/test_client_mr.py +180 -0
- tplinkrouterc6u-5.2.0/test/test_client_xdr.py +536 -0
- {tplinkrouterc6u-5.1.0 → tplinkrouterc6u-5.2.0}/tplinkrouterc6u/__init__.py +5 -2
- {tplinkrouterc6u-5.1.0 → tplinkrouterc6u-5.2.0}/tplinkrouterc6u/client/c5400x.py +1 -1
- tplinkrouterc6u-5.1.0/tplinkrouterc6u/client/api_cgi_bin.py → tplinkrouterc6u-5.2.0/tplinkrouterc6u/client/c6u.py +1 -0
- {tplinkrouterc6u-5.1.0 → tplinkrouterc6u-5.2.0}/tplinkrouterc6u/client/deco.py +1 -1
- {tplinkrouterc6u-5.1.0 → tplinkrouterc6u-5.2.0}/tplinkrouterc6u/client/mr.py +68 -1
- tplinkrouterc6u-5.2.0/tplinkrouterc6u/client/xdr.py +263 -0
- {tplinkrouterc6u-5.1.0 → tplinkrouterc6u-5.2.0}/tplinkrouterc6u/common/dataclass.py +28 -0
- {tplinkrouterc6u-5.1.0 → tplinkrouterc6u-5.2.0}/tplinkrouterc6u/common/package_enum.py +5 -0
- {tplinkrouterc6u-5.1.0 → tplinkrouterc6u-5.2.0}/tplinkrouterc6u/provider.py +4 -2
- {tplinkrouterc6u-5.1.0 → tplinkrouterc6u-5.2.0}/tplinkrouterc6u.egg-info/PKG-INFO +39 -4
- {tplinkrouterc6u-5.1.0 → tplinkrouterc6u-5.2.0}/tplinkrouterc6u.egg-info/SOURCES.txt +4 -2
- {tplinkrouterc6u-5.1.0 → tplinkrouterc6u-5.2.0}/LICENSE +0 -0
- {tplinkrouterc6u-5.1.0 → tplinkrouterc6u-5.2.0}/setup.cfg +0 -0
- {tplinkrouterc6u-5.1.0 → tplinkrouterc6u-5.2.0}/test/__init__.py +0 -0
- {tplinkrouterc6u-5.1.0 → tplinkrouterc6u-5.2.0}/test/test_client_c1200.py +0 -0
- {tplinkrouterc6u-5.1.0 → tplinkrouterc6u-5.2.0}/test/test_client_deco.py +0 -0
- {tplinkrouterc6u-5.1.0 → tplinkrouterc6u-5.2.0}/test/test_client_ex.py +0 -0
- {tplinkrouterc6u-5.1.0 → tplinkrouterc6u-5.2.0}/tplinkrouterc6u/client/__init__.py +0 -0
- {tplinkrouterc6u-5.1.0 → tplinkrouterc6u-5.2.0}/tplinkrouterc6u/client/c1200.py +0 -0
- {tplinkrouterc6u-5.1.0 → tplinkrouterc6u-5.2.0}/tplinkrouterc6u/client/c6v4.py +0 -0
- {tplinkrouterc6u-5.1.0 → tplinkrouterc6u-5.2.0}/tplinkrouterc6u/client/ex.py +0 -0
- {tplinkrouterc6u-5.1.0 → tplinkrouterc6u-5.2.0}/tplinkrouterc6u/client_abstract.py +0 -0
- {tplinkrouterc6u-5.1.0 → tplinkrouterc6u-5.2.0}/tplinkrouterc6u/common/__init__.py +0 -0
- {tplinkrouterc6u-5.1.0 → tplinkrouterc6u-5.2.0}/tplinkrouterc6u/common/encryption.py +0 -0
- {tplinkrouterc6u-5.1.0 → tplinkrouterc6u-5.2.0}/tplinkrouterc6u/common/exception.py +0 -0
- {tplinkrouterc6u-5.1.0 → tplinkrouterc6u-5.2.0}/tplinkrouterc6u/common/helper.py +0 -0
- {tplinkrouterc6u-5.1.0 → tplinkrouterc6u-5.2.0}/tplinkrouterc6u.egg-info/dependency_links.txt +0 -0
- {tplinkrouterc6u-5.1.0 → tplinkrouterc6u-5.2.0}/tplinkrouterc6u.egg-info/requires.txt +0 -0
- {tplinkrouterc6u-5.1.0 → tplinkrouterc6u-5.2.0}/tplinkrouterc6u.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: tplinkrouterc6u
|
|
3
|
-
Version: 5.
|
|
3
|
+
Version: 5.2.0
|
|
4
4
|
Summary: TP-Link Router API
|
|
5
5
|
Home-page: https://github.com/AlexandrErohin/TP-Link-Archer-C6U
|
|
6
6
|
Author: Alex Erohin
|
|
@@ -45,6 +45,7 @@ from tplinkrouterc6u import (
|
|
|
45
45
|
TplinkC5400XRouter,
|
|
46
46
|
TPLinkMRClient,
|
|
47
47
|
TPLinkEXClient,
|
|
48
|
+
TPLinkXDRClient,
|
|
48
49
|
TPLinkDecoClient,
|
|
49
50
|
Connection
|
|
50
51
|
)
|
|
@@ -107,14 +108,17 @@ or you have TP-link C5400X or similar router you need to get web encrypted passw
|
|
|
107
108
|
| get_ipv4_reservations | | Gets IPv4 reserved addresses (static) | [[IPv4Reservation]](#IPv4Reservation) |
|
|
108
109
|
| get_ipv4_dhcp_leases | | Gets IPv4 addresses assigned via DHCP | [[IPv4DHCPLease]](#IPv4DHCPLease) |
|
|
109
110
|
| set_wifi | wifi: [Connection](#connection), enable: bool | Allow to turn on/of 4 wifi networks | |
|
|
111
|
+
| reboot | | reboot router |
|
|
112
|
+
| authorize | | authorize for actions |
|
|
113
|
+
| logout | | logout after all is done |
|
|
114
|
+
| get_vpn_status | | Gets VPN info for OpenVPN and PPTPVPN and connected clients amount | [VPNStatus](#vpn_status) |
|
|
115
|
+
| set_vpn | vpn: [VPNStatus](#vpn_status), enable: bool | Allow to turn on/of VPN | |
|
|
110
116
|
| send_sms | phone_number: str, message: str | Send sms for LTE routers | |
|
|
111
117
|
| send_ussd | command: str | Send USSD command for LTE routers | str |
|
|
112
118
|
| get_sms | | Get sms messages from the first page for LTE routers | [[SMS]](#sms) |
|
|
113
119
|
| set_sms_read | sms: [SMS](#sms) | Set sms message read from the first page for LTE routers | |
|
|
114
120
|
| delete_sms | sms: [SMS](#sms) | Delete sms message from the first page for LTE routers | |
|
|
115
|
-
|
|
|
116
|
-
| authorize | | authorize for actions |
|
|
117
|
-
| logout | | logout after all is done |
|
|
121
|
+
| get_lte_status | | Get lte info for LTE routers | [LTEStatus](#lte_status) |
|
|
118
122
|
|
|
119
123
|
## Dataclass
|
|
120
124
|
### <a id="firmware">Firmware</a>
|
|
@@ -169,6 +173,7 @@ or you have TP-link C5400X or similar router you need to get web encrypted passw
|
|
|
169
173
|
| packets_received | total packets received | int, None |
|
|
170
174
|
| down_speed | download speed | int, None |
|
|
171
175
|
| up_speed | upload speed | int, None |
|
|
176
|
+
| signal | Signal strength | int, None |
|
|
172
177
|
|
|
173
178
|
### <a id="IPv4Reservation">IPv4Reservation</a>
|
|
174
179
|
| Field | Description | Type |
|
|
@@ -215,6 +220,14 @@ or you have TP-link C5400X or similar router you need to get web encrypted passw
|
|
|
215
220
|
| lan_ipv4_netmask_address | router LAN gateway IP netmask | ipaddress |
|
|
216
221
|
| remote | router remote | bool, None |
|
|
217
222
|
|
|
223
|
+
### <a id="vpn_status">VPNStatus</a>
|
|
224
|
+
| Field | Description | Type |
|
|
225
|
+
| --- |---|---|
|
|
226
|
+
| openvpn_enable | OpenVPN is enabled | bool |
|
|
227
|
+
| pptpvpn_enable | PPTPVPN is enabled | bool |
|
|
228
|
+
| openvpn_clients_total | OpenVPN clients connected | int |
|
|
229
|
+
| pptpvpn_clients_total | PPTPVPN clients connected | int |
|
|
230
|
+
|
|
218
231
|
### <a id="sms">SMS</a>
|
|
219
232
|
| Field | Description | Type |
|
|
220
233
|
| --- |---|---|
|
|
@@ -224,6 +237,23 @@ or you have TP-link C5400X or similar router you need to get web encrypted passw
|
|
|
224
237
|
| received_at| received datetime | datetime |
|
|
225
238
|
| unread| is message unread | bool |
|
|
226
239
|
|
|
240
|
+
### <a id="lte_status">LTEStatus</a>
|
|
241
|
+
| Field | Description | Type |
|
|
242
|
+
| --- |---|---|
|
|
243
|
+
| enable | is enabled | int |
|
|
244
|
+
| connect_status | connect status | int |
|
|
245
|
+
| network_type | network type | int |
|
|
246
|
+
| sim_status | sim status | int |
|
|
247
|
+
| total_statistics | total statistics in bytes | int |
|
|
248
|
+
| cur_rx_speed | current download speed in bytes per second | int |
|
|
249
|
+
| cur_tx_speed | current upload speed in bytes per second | int |
|
|
250
|
+
| sms_unread_count | sms unread amount | int |
|
|
251
|
+
| sig_level | signal level | int |
|
|
252
|
+
| rsrp | RSRP | int |
|
|
253
|
+
| rsrq | RSRQ | int |
|
|
254
|
+
| snr | SNR | int |
|
|
255
|
+
| isp_name | ISP name | str |
|
|
256
|
+
|
|
227
257
|
## Enum
|
|
228
258
|
### <a id="connection">Connection</a>
|
|
229
259
|
- Connection.HOST_2G - host wifi 2.4G
|
|
@@ -237,6 +267,10 @@ or you have TP-link C5400X or similar router you need to get web encrypted passw
|
|
|
237
267
|
- Connection.IOT_6G - IoT wifi 6G
|
|
238
268
|
- Connection.WIRED - Wired
|
|
239
269
|
|
|
270
|
+
### <a id="vpn">VPN</a>
|
|
271
|
+
- VPN.OPEN_VPN
|
|
272
|
+
- VPN.PPTP_VPN
|
|
273
|
+
|
|
240
274
|
## <a id="supports">Supported routers</a>
|
|
241
275
|
### Fully tested Hardware Versions
|
|
242
276
|
- Archer A7 V5
|
|
@@ -291,6 +325,7 @@ or you have TP-link C5400X or similar router you need to get web encrypted passw
|
|
|
291
325
|
- TL-MR105
|
|
292
326
|
- TL-MR6400 (v5, v5.3)
|
|
293
327
|
- TL-MR6500v
|
|
328
|
+
- TL-XDR3010 V2
|
|
294
329
|
- TL-WA3001 v1.0
|
|
295
330
|
|
|
296
331
|
### Not fully tested Hardware Versions
|
|
@@ -23,6 +23,7 @@ from tplinkrouterc6u import (
|
|
|
23
23
|
TplinkC5400XRouter,
|
|
24
24
|
TPLinkMRClient,
|
|
25
25
|
TPLinkEXClient,
|
|
26
|
+
TPLinkXDRClient,
|
|
26
27
|
TPLinkDecoClient,
|
|
27
28
|
Connection
|
|
28
29
|
)
|
|
@@ -85,14 +86,17 @@ or you have TP-link C5400X or similar router you need to get web encrypted passw
|
|
|
85
86
|
| get_ipv4_reservations | | Gets IPv4 reserved addresses (static) | [[IPv4Reservation]](#IPv4Reservation) |
|
|
86
87
|
| get_ipv4_dhcp_leases | | Gets IPv4 addresses assigned via DHCP | [[IPv4DHCPLease]](#IPv4DHCPLease) |
|
|
87
88
|
| set_wifi | wifi: [Connection](#connection), enable: bool | Allow to turn on/of 4 wifi networks | |
|
|
89
|
+
| reboot | | reboot router |
|
|
90
|
+
| authorize | | authorize for actions |
|
|
91
|
+
| logout | | logout after all is done |
|
|
92
|
+
| get_vpn_status | | Gets VPN info for OpenVPN and PPTPVPN and connected clients amount | [VPNStatus](#vpn_status) |
|
|
93
|
+
| set_vpn | vpn: [VPNStatus](#vpn_status), enable: bool | Allow to turn on/of VPN | |
|
|
88
94
|
| send_sms | phone_number: str, message: str | Send sms for LTE routers | |
|
|
89
95
|
| send_ussd | command: str | Send USSD command for LTE routers | str |
|
|
90
96
|
| get_sms | | Get sms messages from the first page for LTE routers | [[SMS]](#sms) |
|
|
91
97
|
| set_sms_read | sms: [SMS](#sms) | Set sms message read from the first page for LTE routers | |
|
|
92
98
|
| delete_sms | sms: [SMS](#sms) | Delete sms message from the first page for LTE routers | |
|
|
93
|
-
|
|
|
94
|
-
| authorize | | authorize for actions |
|
|
95
|
-
| logout | | logout after all is done |
|
|
99
|
+
| get_lte_status | | Get lte info for LTE routers | [LTEStatus](#lte_status) |
|
|
96
100
|
|
|
97
101
|
## Dataclass
|
|
98
102
|
### <a id="firmware">Firmware</a>
|
|
@@ -147,6 +151,7 @@ or you have TP-link C5400X or similar router you need to get web encrypted passw
|
|
|
147
151
|
| packets_received | total packets received | int, None |
|
|
148
152
|
| down_speed | download speed | int, None |
|
|
149
153
|
| up_speed | upload speed | int, None |
|
|
154
|
+
| signal | Signal strength | int, None |
|
|
150
155
|
|
|
151
156
|
### <a id="IPv4Reservation">IPv4Reservation</a>
|
|
152
157
|
| Field | Description | Type |
|
|
@@ -193,6 +198,14 @@ or you have TP-link C5400X or similar router you need to get web encrypted passw
|
|
|
193
198
|
| lan_ipv4_netmask_address | router LAN gateway IP netmask | ipaddress |
|
|
194
199
|
| remote | router remote | bool, None |
|
|
195
200
|
|
|
201
|
+
### <a id="vpn_status">VPNStatus</a>
|
|
202
|
+
| Field | Description | Type |
|
|
203
|
+
| --- |---|---|
|
|
204
|
+
| openvpn_enable | OpenVPN is enabled | bool |
|
|
205
|
+
| pptpvpn_enable | PPTPVPN is enabled | bool |
|
|
206
|
+
| openvpn_clients_total | OpenVPN clients connected | int |
|
|
207
|
+
| pptpvpn_clients_total | PPTPVPN clients connected | int |
|
|
208
|
+
|
|
196
209
|
### <a id="sms">SMS</a>
|
|
197
210
|
| Field | Description | Type |
|
|
198
211
|
| --- |---|---|
|
|
@@ -202,6 +215,23 @@ or you have TP-link C5400X or similar router you need to get web encrypted passw
|
|
|
202
215
|
| received_at| received datetime | datetime |
|
|
203
216
|
| unread| is message unread | bool |
|
|
204
217
|
|
|
218
|
+
### <a id="lte_status">LTEStatus</a>
|
|
219
|
+
| Field | Description | Type |
|
|
220
|
+
| --- |---|---|
|
|
221
|
+
| enable | is enabled | int |
|
|
222
|
+
| connect_status | connect status | int |
|
|
223
|
+
| network_type | network type | int |
|
|
224
|
+
| sim_status | sim status | int |
|
|
225
|
+
| total_statistics | total statistics in bytes | int |
|
|
226
|
+
| cur_rx_speed | current download speed in bytes per second | int |
|
|
227
|
+
| cur_tx_speed | current upload speed in bytes per second | int |
|
|
228
|
+
| sms_unread_count | sms unread amount | int |
|
|
229
|
+
| sig_level | signal level | int |
|
|
230
|
+
| rsrp | RSRP | int |
|
|
231
|
+
| rsrq | RSRQ | int |
|
|
232
|
+
| snr | SNR | int |
|
|
233
|
+
| isp_name | ISP name | str |
|
|
234
|
+
|
|
205
235
|
## Enum
|
|
206
236
|
### <a id="connection">Connection</a>
|
|
207
237
|
- Connection.HOST_2G - host wifi 2.4G
|
|
@@ -215,6 +245,10 @@ or you have TP-link C5400X or similar router you need to get web encrypted passw
|
|
|
215
245
|
- Connection.IOT_6G - IoT wifi 6G
|
|
216
246
|
- Connection.WIRED - Wired
|
|
217
247
|
|
|
248
|
+
### <a id="vpn">VPN</a>
|
|
249
|
+
- VPN.OPEN_VPN
|
|
250
|
+
- VPN.PPTP_VPN
|
|
251
|
+
|
|
218
252
|
## <a id="supports">Supported routers</a>
|
|
219
253
|
### Fully tested Hardware Versions
|
|
220
254
|
- Archer A7 V5
|
|
@@ -269,6 +303,7 @@ or you have TP-link C5400X or similar router you need to get web encrypted passw
|
|
|
269
303
|
- TL-MR105
|
|
270
304
|
- TL-MR6400 (v5, v5.3)
|
|
271
305
|
- TL-MR6500v
|
|
306
|
+
- TL-XDR3010 V2
|
|
272
307
|
- TL-WA3001 v1.0
|
|
273
308
|
|
|
274
309
|
### Not fully tested Hardware Versions
|
|
@@ -445,7 +445,7 @@ class TestTPLinkClient(TestCase):
|
|
|
445
445
|
{"mac": "54:b3:a2:f7:be:ea", "deviceTag":"iot_5G", "isGuest":false, "ip":"192.168.1.188",
|
|
446
446
|
"deviceName":"name3"},
|
|
447
447
|
{"mac": "3c:ae:e1:83:94:9d", "deviceTag":"iot_6G", "isGuest":false, "ip":"192.168.1.189",
|
|
448
|
-
"deviceName":"name4"}
|
|
448
|
+
"deviceName":"name4", "signal": -52}
|
|
449
449
|
],
|
|
450
450
|
"timeout": false,
|
|
451
451
|
"success": true
|
|
@@ -570,6 +570,7 @@ class TestTPLinkClient(TestCase):
|
|
|
570
570
|
self.assertEqual(status.devices[5].hostname, 'name4')
|
|
571
571
|
self.assertEqual(status.devices[5].packets_sent, None)
|
|
572
572
|
self.assertEqual(status.devices[5].packets_received, None)
|
|
573
|
+
self.assertEqual(status.devices[5].signal, -52)
|
|
573
574
|
self.assertIsInstance(status.devices[6], Device)
|
|
574
575
|
self.assertEqual(status.devices[6].type, Connection.HOST_5G)
|
|
575
576
|
self.assertEqual(status.devices[6].macaddr, '1F-7A-BD-F7-20-0D')
|
|
@@ -13,6 +13,9 @@ from tplinkrouterc6u import (
|
|
|
13
13
|
IPv4Status,
|
|
14
14
|
ClientError,
|
|
15
15
|
SMS,
|
|
16
|
+
LTEStatus,
|
|
17
|
+
VPNStatus,
|
|
18
|
+
VPN,
|
|
16
19
|
)
|
|
17
20
|
|
|
18
21
|
|
|
@@ -864,6 +867,183 @@ unread=0
|
|
|
864
867
|
self.assertIn('http:///cgi_gdpr?_=', check_url)
|
|
865
868
|
self.assertEqual(check_data, '4\r\n[LTE_SMS_RECVMSGENTRY#2,0,0,0,0,0#0,0,0,0,0,0]0,0\r\n\r\n')
|
|
866
869
|
|
|
870
|
+
def test_get_lte_status(self) -> None:
|
|
871
|
+
response = '''[2,1,0,0,0,0]0
|
|
872
|
+
enable=1
|
|
873
|
+
connectStatus=4
|
|
874
|
+
networkType=3
|
|
875
|
+
roamingStatus=0
|
|
876
|
+
simStatus=3
|
|
877
|
+
[2,0,0,0,0,0]1
|
|
878
|
+
dataLimit=0
|
|
879
|
+
enablePaymentDay=0
|
|
880
|
+
curStatistics=0
|
|
881
|
+
totalStatistics=32779416.0000
|
|
882
|
+
enableDataLimit=0
|
|
883
|
+
limitation=0
|
|
884
|
+
curRxSpeed=85
|
|
885
|
+
curTxSpeed=1492
|
|
886
|
+
[2,1,0,0,0,0]2
|
|
887
|
+
smsUnreadCount=0
|
|
888
|
+
ussdStatus=0
|
|
889
|
+
smsSendResult=3
|
|
890
|
+
sigLevel=0
|
|
891
|
+
rfInfoRsrp=-105
|
|
892
|
+
rfInfoRsrq=-20
|
|
893
|
+
rfInfoSnr=-44
|
|
894
|
+
[2,1,0,0,0,0]3
|
|
895
|
+
spn=Full name
|
|
896
|
+
ispName=Name
|
|
897
|
+
[error]0
|
|
898
|
+
|
|
899
|
+
'''
|
|
900
|
+
|
|
901
|
+
class TPLinkMRClientTest(TPLinkMRClient):
|
|
902
|
+
def _request(self, url, method='POST', data_str=None, encrypt=False):
|
|
903
|
+
return 200, response
|
|
904
|
+
|
|
905
|
+
client = TPLinkMRClientTest('', '')
|
|
906
|
+
status = client.get_lte_status()
|
|
907
|
+
|
|
908
|
+
self.assertIsInstance(status, LTEStatus)
|
|
909
|
+
self.assertEqual(status.enable, 1)
|
|
910
|
+
self.assertEqual(status.connect_status, 4)
|
|
911
|
+
self.assertEqual(status.network_type, 3)
|
|
912
|
+
self.assertEqual(status.sim_status, 3)
|
|
913
|
+
self.assertEqual(status.total_statistics, 32779416)
|
|
914
|
+
self.assertEqual(status.cur_rx_speed, 85)
|
|
915
|
+
self.assertEqual(status.cur_tx_speed, 1492)
|
|
916
|
+
self.assertEqual(status.sms_unread_count, 0)
|
|
917
|
+
self.assertEqual(status.sig_level, 0)
|
|
918
|
+
self.assertEqual(status.rsrp, -105)
|
|
919
|
+
self.assertEqual(status.rsrq, -20)
|
|
920
|
+
self.assertEqual(status.snr, -44)
|
|
921
|
+
self.assertEqual(status.isp_name, 'Name')
|
|
922
|
+
|
|
923
|
+
def test_get_lte_status_wrong(self) -> None:
|
|
924
|
+
response = '''[2,1,0,0,0,0]0
|
|
925
|
+
enable=1
|
|
926
|
+
connectStatus=1
|
|
927
|
+
networkType=2
|
|
928
|
+
roamingStatus=0
|
|
929
|
+
simStatus=1
|
|
930
|
+
[2,0,0,0,0,0]1
|
|
931
|
+
dataLimit=0
|
|
932
|
+
enablePaymentDay=0
|
|
933
|
+
curStatistics=0
|
|
934
|
+
totalStatistics=32779416.0000
|
|
935
|
+
enableDataLimit=0
|
|
936
|
+
limitation=0
|
|
937
|
+
curRxSpeed=0
|
|
938
|
+
curTxSpeed=0
|
|
939
|
+
[2,1,0,0,0,0]2
|
|
940
|
+
smsUnreadCount=0
|
|
941
|
+
ussdStatus=0
|
|
942
|
+
smsSendResult=3
|
|
943
|
+
sigLevel=2
|
|
944
|
+
rfInfoRsrp=0
|
|
945
|
+
rfInfoRsrq=0
|
|
946
|
+
rfInfoSnr=0
|
|
947
|
+
[2,1,0,0,0,0]3
|
|
948
|
+
spn=Full name
|
|
949
|
+
ispName=Name
|
|
950
|
+
[error]0
|
|
951
|
+
|
|
952
|
+
'''
|
|
953
|
+
|
|
954
|
+
class TPLinkMRClientTest(TPLinkMRClient):
|
|
955
|
+
def _request(self, url, method='POST', data_str=None, encrypt=False):
|
|
956
|
+
return 200, response
|
|
957
|
+
|
|
958
|
+
client = TPLinkMRClientTest('', '')
|
|
959
|
+
status = client.get_lte_status()
|
|
960
|
+
|
|
961
|
+
self.assertIsInstance(status, LTEStatus)
|
|
962
|
+
|
|
963
|
+
def test_get_vpn_status(self) -> None:
|
|
964
|
+
response = '''[0,0,0,0,0,0]0
|
|
965
|
+
enable=1
|
|
966
|
+
[0,0,0,0,0,0]1
|
|
967
|
+
enable=0
|
|
968
|
+
[1,0,0,0,0,0]2
|
|
969
|
+
connAct=0
|
|
970
|
+
[2,0,0,0,0,0]2
|
|
971
|
+
connAct=0
|
|
972
|
+
[3,0,0,0,0,0]2
|
|
973
|
+
connAct=0
|
|
974
|
+
[4,0,0,0,0,0]2
|
|
975
|
+
connAct=0
|
|
976
|
+
[5,0,0,0,0,0]2
|
|
977
|
+
connAct=1
|
|
978
|
+
[6,0,0,0,0,0]2
|
|
979
|
+
connAct=1
|
|
980
|
+
[7,0,0,0,0,0]2
|
|
981
|
+
connAct=0
|
|
982
|
+
[8,0,0,0,0,0]2
|
|
983
|
+
connAct=0
|
|
984
|
+
[9,0,0,0,0,0]2
|
|
985
|
+
connAct=0
|
|
986
|
+
[10,0,0,0,0,0]2
|
|
987
|
+
connAct=0
|
|
988
|
+
[1,0,0,0,0,0]3
|
|
989
|
+
connAct=0
|
|
990
|
+
[2,0,0,0,0,0]3
|
|
991
|
+
connAct=0
|
|
992
|
+
[3,0,0,0,0,0]3
|
|
993
|
+
connAct=0
|
|
994
|
+
[4,0,0,0,0,0]3
|
|
995
|
+
connAct=0
|
|
996
|
+
[5,0,0,0,0,0]3
|
|
997
|
+
connAct=0
|
|
998
|
+
[6,0,0,0,0,0]3
|
|
999
|
+
connAct=0
|
|
1000
|
+
[7,0,0,0,0,0]3
|
|
1001
|
+
connAct=0
|
|
1002
|
+
[8,0,0,0,0,0]3
|
|
1003
|
+
connAct=0
|
|
1004
|
+
[9,0,0,0,0,0]3
|
|
1005
|
+
connAct=0
|
|
1006
|
+
[10,0,0,0,0,0]3
|
|
1007
|
+
connAct=0
|
|
1008
|
+
[error]0
|
|
1009
|
+
|
|
1010
|
+
'''
|
|
1011
|
+
|
|
1012
|
+
class TPLinkMRClientTest(TPLinkMRClient):
|
|
1013
|
+
def _request(self, url, method='POST', data_str=None, encrypt=False):
|
|
1014
|
+
return 200, response
|
|
1015
|
+
|
|
1016
|
+
client = TPLinkMRClientTest('', '')
|
|
1017
|
+
status = client.get_vpn_status()
|
|
1018
|
+
|
|
1019
|
+
self.assertIsInstance(status, VPNStatus)
|
|
1020
|
+
self.assertEqual(status.openvpn_enable, True)
|
|
1021
|
+
self.assertEqual(status.pptpvpn_enable, False)
|
|
1022
|
+
self.assertEqual(status.openvpn_clients_total, 2)
|
|
1023
|
+
self.assertEqual(status.pptpvpn_clients_total, 0)
|
|
1024
|
+
|
|
1025
|
+
def test_set_vpn(self) -> None:
|
|
1026
|
+
response = '''
|
|
1027
|
+
[error]0
|
|
1028
|
+
|
|
1029
|
+
'''
|
|
1030
|
+
|
|
1031
|
+
check_url = ''
|
|
1032
|
+
check_data = ''
|
|
1033
|
+
|
|
1034
|
+
class TPLinkMRClientTest(TPLinkMRClient):
|
|
1035
|
+
def _request(self, url, method='POST', data_str=None, encrypt=False):
|
|
1036
|
+
nonlocal check_url, check_data
|
|
1037
|
+
check_url = url
|
|
1038
|
+
check_data = data_str
|
|
1039
|
+
return 200, response
|
|
1040
|
+
|
|
1041
|
+
client = TPLinkMRClientTest('', '')
|
|
1042
|
+
client.set_vpn(VPN.OPEN_VPN, True)
|
|
1043
|
+
|
|
1044
|
+
self.assertIn('http:///cgi_gdpr?_=', check_url)
|
|
1045
|
+
self.assertEqual(check_data, '2\r\n[OPENVPN#0,0,0,0,0,0#0,0,0,0,0,0]0,1\r\nenable=1\r\n')
|
|
1046
|
+
|
|
867
1047
|
|
|
868
1048
|
if __name__ == '__main__':
|
|
869
1049
|
main()
|