|
|
@ -1,10 +1,12 @@ |
|
|
import re |
|
|
import re |
|
|
import socket |
|
|
import socket |
|
|
import binascii |
|
|
import binascii |
|
|
|
|
|
from abc import ABCMeta |
|
|
from hashlib import md5 |
|
|
from hashlib import md5 |
|
|
from ipaddress import ip_network |
|
|
from ipaddress import ip_network |
|
|
from typing import Iterable, Optional, Tuple, Generator, Dict |
|
|
from typing import Iterable, Optional, Tuple, Generator, Dict |
|
|
|
|
|
|
|
|
|
|
|
from djing.lib.decorators import LazyInitMetaclass |
|
|
from .structs import TariffStruct, AbonStruct, IpStruct, VectorAbon, VectorTariff |
|
|
from .structs import TariffStruct, AbonStruct, IpStruct, VectorAbon, VectorTariff |
|
|
from . import settings as local_settings |
|
|
from . import settings as local_settings |
|
|
from django.conf import settings |
|
|
from django.conf import settings |
|
|
@ -30,8 +32,6 @@ class ApiRos(object): |
|
|
sk.connect((ip, port or 8728)) |
|
|
sk.connect((ip, port or 8728)) |
|
|
self.sk = sk |
|
|
self.sk = sk |
|
|
|
|
|
|
|
|
self.currenttag = 0 |
|
|
|
|
|
|
|
|
|
|
|
def login(self, username, pwd): |
|
|
def login(self, username, pwd): |
|
|
if self.is_login: |
|
|
if self.is_login: |
|
|
return |
|
|
return |
|
|
@ -172,7 +172,7 @@ class IpAddressListObj(IpStruct): |
|
|
self.mk_id = str(mk_id).replace('*', '') |
|
|
self.mk_id = str(mk_id).replace('*', '') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class MikrotikTransmitter(BaseTransmitter, ApiRos): |
|
|
|
|
|
|
|
|
class MikrotikTransmitter(BaseTransmitter, ApiRos, metaclass=type('_ABC_Lazy_mcs', (ABCMeta, LazyInitMetaclass), {})): |
|
|
|
|
|
|
|
|
def __init__(self, login=None, password=None, ip=None, port=None): |
|
|
def __init__(self, login=None, password=None, ip=None, port=None): |
|
|
ip = ip or getattr(local_settings, 'NAS_IP') |
|
|
ip = ip or getattr(local_settings, 'NAS_IP') |
|
|
|