From ce66bc4168bd46e318ecc039fc5578ba7f4b0535 Mon Sep 17 00:00:00 2001 From: kk Date: Tue, 10 Sep 2019 21:06:33 +0300 Subject: [PATCH 1/4] move lib/text to core/text. add tests --- cm/models/confdbquery.py | 2 +- cm/models/errortype.py | 2 +- cm/parsers/Cisco/ASA/base.py | 4 +- cm/parsers/Cisco/IOS/base.py | 16 +- cm/parsers/Huawei/VRP/base.py | 2 +- cm/parsers/Qtech/QSW2800/base.py | 4 +- commands/dnszone.py | 4 +- commands/interface-profile.py | 2 +- commands/nri.py | 2 +- commands/parse-events.py | 2 +- commands/service.py | 4 +- core/etl/bi/extractor/managedobject.py | 4 +- core/matcher.py | 6 +- core/prettyjson.py | 2 +- core/script/cli/base.py | 4 +- core/snmp/ber.py | 4 +- core/span.py | 2 +- {lib => core}/text.py | 0 core/topology/base.py | 2 +- dev/models/quiz.py | 2 +- dev/models/spec.py | 2 +- fm/models/alarmclass.py | 2 +- fm/models/alarmseverity.py | 2 +- fm/models/cloneclassificationrule.py | 2 +- fm/models/enumeration.py | 2 +- fm/models/eventclass.py | 2 +- fm/models/eventclassificationrule.py | 2 +- gis/models/layer.py | 2 +- inv/models/capability.py | 2 +- inv/models/connectionrule.py | 2 +- inv/models/connectiontype.py | 2 +- inv/models/firmwarepolicy.py | 2 +- inv/models/objectmodel.py | 2 +- inv/models/technology.py | 2 +- phone/models/phonenumber.py | 2 +- phone/models/phonerange.py | 2 +- pm/models/metrictype.py | 2 +- sa/interfaces/base.py | 2 +- sa/models/action.py | 2 +- sa/models/actioncommands.py | 2 +- sa/models/profilecheckrule.py | 2 +- sa/profiles/APC/AOS/get_chassis_id.py | 4 +- sa/profiles/APC/AOS/get_inventory.py | 4 +- sa/profiles/APC/AOS/get_version.py | 4 +- sa/profiles/Alcatel/7302/get_capabilities.py | 4 +- sa/profiles/Alcatel/7324RU/get_interfaces.py | 2 +- sa/profiles/Alcatel/7324RU/get_switchport.py | 2 +- sa/profiles/Alcatel/AOS/get_capabilities.py | 4 +- .../Alcatel/OS62xx/get_lldp_neighbors.py | 4 +- .../Alcatel/OS62xx/get_mac_address_table.py | 5 +- sa/profiles/Alcatel/OS62xx/get_vlans.py | 5 +- .../AlliedTelesis/AT8000S/get_capabilities.py | 4 +- .../AlliedTelesis/AT8000S/get_chassis_id.py | 12 +- .../AT8000S/get_lldp_neighbors.py | 4 +- .../AlliedTelesis/AT8100/get_interfaces.py | 4 +- sa/profiles/AlliedTelesis/AT8100/get_vlans.py | 8 +- sa/profiles/Alstec/24xx/get_arp.py | 2 +- sa/profiles/Alstec/24xx/get_lldp_neighbors.py | 2 +- sa/profiles/Alstec/24xx/get_metrics.py | 4 +- sa/profiles/Alstec/ALS/get_lldp_neighbors.py | 2 +- .../Angtel/Topaz/get_lldp_neighbors.py | 2 +- sa/profiles/Arista/EOS/get_inventory.py | 4 +- sa/profiles/Arista/EOS/get_vlans.py | 4 +- .../Audiocodes/Mediant2000/get_version.py | 4 +- sa/profiles/BDCOM/IOS/get_interfaces.py | 8 +- .../BDCOM/IOS/get_mac_address_table.py | 4 +- sa/profiles/BDCOM/IOS/get_vlans.py | 6 +- sa/profiles/BDCOM/xPON/get_interfaces.py | 5 +- .../BDCOM/xPON/get_mac_address_table.py | 2 +- sa/profiles/BDCOM/xPON/get_vlans.py | 2 +- sa/profiles/Carelink/SWG/get_interfaces.py | 2 +- .../Carelink/SWG/get_mac_address_table.py | 4 +- sa/profiles/Carelink/SWG/get_vlans.py | 2 +- sa/profiles/Cisco/IOS/get_metrics.py | 2 +- sa/profiles/Cisco/IOS/get_portchannel.py | 4 +- sa/profiles/Cisco/IOS/get_spanning_tree.py | 4 +- sa/profiles/Cisco/IOS/set_switchport.py | 2 +- sa/profiles/Cisco/SMB/get_arp.py | 2 +- sa/profiles/Cisco/SMB/get_interfaces.py | 2 +- sa/profiles/Cisco/SMB/get_lldp_neighbors.py | 2 +- sa/profiles/Cisco/SMB/get_portchannel.py | 2 +- sa/profiles/Cisco/SMB/get_spanning_tree.py | 2 +- sa/profiles/DLink/DxS/get_chassis_id.py | 12 +- .../DLink/DxS_Industrial_CLI/get_arp.py | 8 +- .../DxS_Industrial_CLI/get_lldp_neighbors.py | 7 +- .../get_mac_address_table.py | 8 +- sa/profiles/EdgeCore/ES/confdb/normalizer.py | 2 +- sa/profiles/Eltex/ESR/get_arp.py | 4 +- sa/profiles/Eltex/ESR/get_interface_status.py | 2 +- sa/profiles/Eltex/ESR/get_interfaces.py | 2 +- sa/profiles/Eltex/ESR/get_ipv6_neighbor.py | 2 +- .../Eltex/ESR/get_mac_address_table.py | 4 +- sa/profiles/Eltex/ESR/get_vlans.py | 4 +- sa/profiles/Eltex/LTP/get_interfaces.py | 4 +- sa/profiles/Eltex/LTP/get_lldp_neighbors.py | 4 +- .../Eltex/LTP/get_mac_address_table.py | 4 +- sa/profiles/Eltex/MA4000/get_dom_status.py | 5 +- sa/profiles/Eltex/MA4000/get_interfaces.py | 2 +- sa/profiles/Eltex/MA4000/get_inventory.py | 2 +- .../Eltex/MA4000/get_lldp_neighbors.py | 4 +- sa/profiles/Eltex/MA4000/get_local_users.py | 4 +- .../Eltex/MA4000/get_mac_address_table.py | 4 +- sa/profiles/Eltex/MES/confdb/normalizer.py | 2 +- sa/profiles/Eltex/MES/get_capabilities.py | 2 +- sa/profiles/Eltex/MES/get_interfaces.py | 2 +- sa/profiles/Eltex/MES/get_inventory.py | 2 +- sa/profiles/Eltex/MES/get_lldp_neighbors.py | 2 +- sa/profiles/Eltex/MES/get_spanning_tree.py | 2 +- sa/profiles/Eltex/MES/get_switchport.py | 4 +- sa/profiles/Eltex/MES/set_switchport.py | 4 +- sa/profiles/Eltex/MES5448/get_arp.py | 4 +- sa/profiles/Eltex/MES5448/get_capabilities.py | 2 +- sa/profiles/Eltex/MES5448/get_interfaces.py | 2 +- sa/profiles/Eltex/MES5448/get_inventory.py | 2 +- .../Eltex/MES5448/get_lacp_neighbors.py | 2 +- .../Eltex/MES5448/get_lldp_neighbors.py | 2 +- .../Eltex/MES5448/get_mac_address_table.py | 4 +- sa/profiles/Eltex/MES5448/get_portchannel.py | 4 +- sa/profiles/Eltex/MES5448/get_vlans.py | 4 +- .../MINI_LINK/get_mac_address_table.py | 2 +- .../Ericsson/SEOS/get_mac_address_table.py | 2 +- sa/profiles/Extreme/XOS/get_capabilities.py | 4 +- sa/profiles/Extreme/XOS/get_dom_status.py | 2 +- sa/profiles/Extreme/XOS/get_inventory.py | 5 +- sa/profiles/Force10/FTOS/get_spanning_tree.py | 2 +- sa/profiles/Force10/FTOS/get_vlans.py | 2 +- sa/profiles/Force10/SFTOS/get_arp.py | 4 +- sa/profiles/Force10/SFTOS/get_vlans.py | 4 +- sa/profiles/HP/1910/set_switchport.py | 4 +- sa/profiles/HP/GbE2/get_mac_address_table.py | 2 +- sa/profiles/HP/ProCurve/get_inventory.py | 3 +- sa/profiles/HP/ProCurve/get_spanning_tree.py | 2 +- sa/profiles/HP/ProCurve/get_vlans.py | 7 +- sa/profiles/Huawei/MA5600T/get_cpe.py | 7 +- sa/profiles/Huawei/MA5600T/get_cpe_status.py | 5 +- sa/profiles/Huawei/MA5600T/get_metrics.py | 2 +- sa/profiles/Huawei/VRP/get_dom_status.py | 4 +- sa/profiles/Huawei/VRP/get_inventory.py | 4 +- sa/profiles/Huawei/VRP/get_lldp_neighbors.py | 4 +- sa/profiles/Iskratel/ESCOM/get_interfaces.py | 6 +- .../Iskratel/ESCOM/get_lldp_neighbors.py | 2 +- .../Iskratel/MSAN/get_lldp_neighbors.py | 4 +- sa/profiles/Juniper/JUNOS/get_bfd_sessions.py | 4 +- sa/profiles/Juniper/JUNOSe/get_metrics.py | 6 +- sa/profiles/Linksys/VoIP/get_chassis_id.py | 4 +- sa/profiles/Linksys/VoIP/get_config.py | 4 +- sa/profiles/Linksys/VoIP/get_version.py | 4 +- .../Nateks/FlexGainACE16/get_version.py | 2 +- sa/profiles/Planet/WGSD/get_capabilities.py | 2 +- sa/profiles/Planet/WGSD/get_interfaces.py | 4 +- sa/profiles/Planet/WGSD/get_spanning_tree.py | 4 +- sa/profiles/Qtech/QOS/get_interfaces.py | 4 +- sa/profiles/Qtech/QSW2500/get_interfaces.py | 2 +- .../Qtech/QSW2800/confdb/normalizer.py | 2 +- sa/profiles/Raisecom/ROS/get_interfaces.py | 2 +- sa/profiles/SKS/SKS/get_interfaces.py | 3 +- sa/profiles/SKS/SKS/get_inventory.py | 2 +- sa/profiles/SKS/SKS/get_lldp_neighbors.py | 3 +- sa/profiles/SKS/SKS/get_version.py | 2 +- sa/profiles/SKS/SKS/get_vlans.py | 10 +- sa/profiles/Supertel/K2X/set_switchport.py | 4 +- sa/profiles/TFortis/PSW/get_version.py | 4 +- sa/profiles/Upvel/UP/get_interfaces.py | 8 +- sa/profiles/Vitesse/VSC/get_interfaces.py | 8 +- .../ZTE/ZXDSL531/get_dot11_associations.py | 14 +- sa/profiles/ZTE/ZXDSL531/get_version.py | 14 +- sa/profiles/Zhone/Bitstorm/get_version.py | 4 +- sa/profiles/Zyxel/MSAN/get_inventory.py | 4 +- services/card/cards/managedobject.py | 2 +- services/datasource/datasources/base.py | 2 +- services/datastream/streams/managedobject.py | 4 +- services/discovery/jobs/box/asset.py | 4 +- services/discovery/jobs/box/interface.py | 2 +- services/discovery/jobs/box/suggestcli.py | 2 +- services/syslogcollector/service.py | 2 +- .../web/apps/fm/reportlocalrules/views.py | 2 +- services/web/apps/inv/interface/views.py | 2 +- services/web/apps/inv/map/views.py | 2 +- .../web/apps/inv/reportifacestatus/views.py | 2 +- services/web/apps/pm/ddash/dashboards/mo.py | 2 +- services/web/apps/sa/managedobject/views.py | 4 +- tests/test_text.py | 184 +++++++++++++++++- 182 files changed, 517 insertions(+), 303 deletions(-) rename {lib => core}/text.py (100%) diff --git a/cm/models/confdbquery.py b/cm/models/confdbquery.py index 61f3740304..9ce7c130bf 100644 --- a/cm/models/confdbquery.py +++ b/cm/models/confdbquery.py @@ -25,7 +25,7 @@ import cachetools # NOC modules from noc.core.prettyjson import to_json -from noc.lib.text import quote_safe_path +from noc.core.text import quote_safe_path from noc.core.model.decorator import on_delete_check from noc.sa.interfaces.base import StringParameter, IntParameter, BooleanParameter diff --git a/cm/models/errortype.py b/cm/models/errortype.py index bab6b2469e..a280f354e5 100644 --- a/cm/models/errortype.py +++ b/cm/models/errortype.py @@ -16,7 +16,7 @@ from mongoengine.fields import StringField, UUIDField # NOC modules from noc.core.prettyjson import to_json -from noc.lib.text import quote_safe_path +from noc.core.text import quote_safe_path @six.python_2_unicode_compatible diff --git a/cm/parsers/Cisco/ASA/base.py b/cm/parsers/Cisco/ASA/base.py index 25a5eb9e91..6520471efd 100644 --- a/cm/parsers/Cisco/ASA/base.py +++ b/cm/parsers/Cisco/ASA/base.py @@ -10,13 +10,13 @@ import re # Third-party modules -from pyparsing import * +from pyparsing import LineStart, Literal, Word, alphanums, Optional, restOfLine, ZeroOrMore, nums # NOC modules from noc.core.ip import IPv4 from noc.cm.parsers.pyparser import BasePyParser from noc.cm.parsers.tokens import INDENT, IPv4_ADDRESS, LINE, REST, DIGITS, ALPHANUMS -from noc.lib.text import ranges_to_list +from noc.core.text import ranges_to_list from noc.lib.validators import is_ipv4, is_int diff --git a/cm/parsers/Cisco/IOS/base.py b/cm/parsers/Cisco/IOS/base.py index 0041fd61a3..ee99f70015 100644 --- a/cm/parsers/Cisco/IOS/base.py +++ b/cm/parsers/Cisco/IOS/base.py @@ -2,7 +2,7 @@ # --------------------------------------------------------------------- # Basic IOS parser # --------------------------------------------------------------------- -# Copyright (C) 2007-2015 The NOC Project +# Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # --------------------------------------------------------------------- @@ -10,13 +10,23 @@ import re # Third-party modules -from pyparsing import * +from pyparsing import ( + LineStart, + Literal, + Word, + alphanums, + Optional, + restOfLine, + Combine, + ZeroOrMore, + nums, +) # NOC modules from noc.core.ip import IPv4 from noc.cm.parsers.pyparser import BasePyParser from noc.cm.parsers.tokens import INDENT, IPv4_ADDRESS, LINE, REST, DIGITS, ALPHANUMS, RD -from noc.lib.text import ranges_to_list +from noc.core.text import ranges_to_list from noc.lib.validators import is_ipv4, is_int diff --git a/cm/parsers/Huawei/VRP/base.py b/cm/parsers/Huawei/VRP/base.py index b8dc16d7a8..096886948e 100644 --- a/cm/parsers/Huawei/VRP/base.py +++ b/cm/parsers/Huawei/VRP/base.py @@ -10,7 +10,7 @@ from collections import defaultdict # NOC modules -from noc.lib.text import ranges_to_list +from noc.core.text import ranges_to_list from noc.cm.parsers.base import BaseParser from noc.core.ip import IPv4 from noc.lib.validators import is_ipv4 diff --git a/cm/parsers/Qtech/QSW2800/base.py b/cm/parsers/Qtech/QSW2800/base.py index 093c4b1040..b6798dd4f1 100644 --- a/cm/parsers/Qtech/QSW2800/base.py +++ b/cm/parsers/Qtech/QSW2800/base.py @@ -2,7 +2,7 @@ # --------------------------------------------------------------------- # Basic Junos parser # --------------------------------------------------------------------- -# Copyright (C) 2007-2018 The NOC Project +# Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # --------------------------------------------------------------------- @@ -12,7 +12,7 @@ from pyparsing import OneOrMore, Word, alphanums, QuotedString # NOC modules from noc.core.ip import IPv4 from noc.cm.parsers.base import BaseParser -from noc.lib.text import ranges_to_list +from noc.core.text import ranges_to_list class BaseQSW2800Parser(BaseParser): diff --git a/commands/dnszone.py b/commands/dnszone.py index 7c692b9b54..c640de6f59 100644 --- a/commands/dnszone.py +++ b/commands/dnszone.py @@ -25,7 +25,7 @@ from noc.ip.models.addressprofile import AddressProfile from noc.ip.models.address import Address from noc.lib.validators import is_int from noc.dns.utils.rr import RR -from noc.lib.text import split_alnum +from noc.core.text import split_alnum class Command(BaseCommand): @@ -249,7 +249,7 @@ class Command(BaseCommand): start = 0 for match in cls.rx_q.finditer(s): if start < match.start(): - yield s[start : match.start()] + yield s[start: match.start()] yield match.group(0) start = match.end() if start < len(s) - 1: diff --git a/commands/interface-profile.py b/commands/interface-profile.py index 2abae05049..647c193d26 100644 --- a/commands/interface-profile.py +++ b/commands/interface-profile.py @@ -16,7 +16,7 @@ from noc.inv.models.interface import Interface from noc.inv.models.interfaceprofile import InterfaceProfile from noc.inv.models.interfaceclassificationrule import InterfaceClassificationRule from noc.sa.models.managedobjectselector import ManagedObjectSelector -from noc.lib.text import split_alnum +from noc.core.text import split_alnum class Command(BaseCommand): diff --git a/commands/nri.py b/commands/nri.py index 8138f58b21..1dff695c95 100755 --- a/commands/nri.py +++ b/commands/nri.py @@ -16,7 +16,7 @@ from noc.core.mongo.connection import connect from noc.inv.models.interface import Interface from noc.sa.models.managedobjectselector import ManagedObjectSelector from noc.core.etl.portmapper.loader import loader -from noc.lib.text import split_alnum, format_table +from noc.core.text import split_alnum, format_table class Command(BaseCommand): diff --git a/commands/parse-events.py b/commands/parse-events.py index 986342692f..e0ce13d24a 100755 --- a/commands/parse-events.py +++ b/commands/parse-events.py @@ -24,7 +24,7 @@ from noc.fm.models.mib import MIB from noc.sa.models.managedobject import ManagedObject from noc.fm.models.activeevent import ActiveEvent from noc.core.fileutils import iter_open -from noc.lib.text import format_table +from noc.core.text import format_table from noc.core.perf import metrics diff --git a/commands/service.py b/commands/service.py index 339c4e9f9f..34f5981f89 100644 --- a/commands/service.py +++ b/commands/service.py @@ -2,7 +2,7 @@ # ---------------------------------------------------------------------- # Service command # ---------------------------------------------------------------------- -# Copyright (C) 2007-2015 The NOC Project +# Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # ---------------------------------------------------------------------- @@ -15,7 +15,7 @@ import six # NOC modules from noc.core.management.base import BaseCommand from noc.core.service.loader import get_service -from noc.lib.text import format_table +from noc.core.text import format_table class Command(BaseCommand): diff --git a/core/etl/bi/extractor/managedobject.py b/core/etl/bi/extractor/managedobject.py index 7a2e6785e1..6743fb8cb1 100644 --- a/core/etl/bi/extractor/managedobject.py +++ b/core/etl/bi/extractor/managedobject.py @@ -2,18 +2,18 @@ # ---------------------------------------------------------------------- # Managed Object Extractor # ---------------------------------------------------------------------- -# Copyright (C) 2007-2017 The NOC Project +# Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # ---------------------------------------------------------------------- # Python modules from __future__ import absolute_import import datetime -from noc.lib.text import ch_escape from collections import defaultdict # NOC modules from .base import BaseExtractor +from noc.core.text import ch_escape from noc.sa.models.managedobject import ManagedObject, ManagedObjectAttribute from noc.bi.models.managedobjects import ManagedObject as ManagedObjectBI from noc.core.etl.bi.stream import Stream diff --git a/core/matcher.py b/core/matcher.py index 459e518a83..a3c4aa367f 100644 --- a/core/matcher.py +++ b/core/matcher.py @@ -2,17 +2,19 @@ # ---------------------------------------------------------------------- # Expression matcher # ---------------------------------------------------------------------- -# Copyright (C) 2007-2017 The NOC Project +# Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # ---------------------------------------------------------------------- # Python modules import re from collections import Iterable + +# Third-party modules import six # NOC modules -from noc.lib.text import split_alnum +from noc.core.text import split_alnum __all__ = ["match"] diff --git a/core/prettyjson.py b/core/prettyjson.py index e3ac59cda4..984f0bc949 100644 --- a/core/prettyjson.py +++ b/core/prettyjson.py @@ -15,7 +15,7 @@ import six # NOC modules from noc.core.escape import json_escape -from noc.lib.text import indent +from noc.core.text import indent class PrettyJSON(object): diff --git a/core/script/cli/base.py b/core/script/cli/base.py index ea3725e656..68e771aea8 100644 --- a/core/script/cli/base.py +++ b/core/script/cli/base.py @@ -2,7 +2,7 @@ # ---------------------------------------------------------------------- # CLI FSM # ---------------------------------------------------------------------- -# Copyright (C) 2007-2018 The NOC Project +# Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # ---------------------------------------------------------------------- @@ -24,7 +24,7 @@ import six # NOC modules from noc.core.log import PrefixLoggerAdapter -from noc.lib.text import replace_re_group +from noc.core.text import replace_re_group from .error import ( CLIError, CLIAuthFailed, diff --git a/core/snmp/ber.py b/core/snmp/ber.py index 13099ff28c..90eb7faea1 100644 --- a/core/snmp/ber.py +++ b/core/snmp/ber.py @@ -9,7 +9,9 @@ # Python modules import math import struct - +## Third-party modules +import pyximport +pyximport.install() # NOC modules from noc.speedup.ber import parse_tlv_header, parse_p_oid, encode_int diff --git a/core/span.py b/core/span.py index df39b45953..6006a39011 100644 --- a/core/span.py +++ b/core/span.py @@ -22,7 +22,7 @@ import tornado.gen from noc.core.error import NO_ERROR, ERR_UNKNOWN from noc.core.perf import metrics from noc.config import config -from noc.lib.text import ch_escape +from noc.core.text import ch_escape from noc.core.backport.time import perf_counter forensic_logger = logging.getLogger("noc.core.forensic") diff --git a/lib/text.py b/core/text.py similarity index 100% rename from lib/text.py rename to core/text.py diff --git a/core/topology/base.py b/core/topology/base.py index c19ef4f437..88eae47631 100644 --- a/core/topology/base.py +++ b/core/topology/base.py @@ -17,7 +17,7 @@ import cachetools # NOC modules from noc.core.stencil import stencil_registry -from noc.lib.text import split_alnum +from noc.core.text import split_alnum from .layout.ring import RingLayout from .layout.spring import SpringLayout from .layout.tree import TreeLayout diff --git a/dev/models/quiz.py b/dev/models/quiz.py index b5e382db86..4e50d92b07 100644 --- a/dev/models/quiz.py +++ b/dev/models/quiz.py @@ -25,7 +25,7 @@ import cachetools # NOC modules from noc.core.prettyjson import to_json -from noc.lib.text import quote_safe_path +from noc.core.text import quote_safe_path from noc.core.model.decorator import on_delete_check id_lock = Lock() diff --git a/dev/models/spec.py b/dev/models/spec.py index c191aa49c0..bd044d6dfc 100644 --- a/dev/models/spec.py +++ b/dev/models/spec.py @@ -27,7 +27,7 @@ import cachetools # NOC modules from noc.core.prettyjson import to_json -from noc.lib.text import quote_safe_path +from noc.core.text import quote_safe_path from noc.core.mongo.fields import PlainReferenceField from noc.sa.models.profile import Profile from .quiz import Quiz, Q_TYPES diff --git a/fm/models/alarmclass.py b/fm/models/alarmclass.py index 4c8d467242..afac4cc8b8 100644 --- a/fm/models/alarmclass.py +++ b/fm/models/alarmclass.py @@ -32,7 +32,7 @@ import cachetools # NOC modules from noc.core.mongo.fields import PlainReferenceField from noc.core.escape import json_escape as q -from noc.lib.text import quote_safe_path +from noc.core.text import quote_safe_path from noc.core.handler import get_handler from noc.core.bi.decorator import bi_sync from noc.core.model.decorator import on_delete_check diff --git a/fm/models/alarmseverity.py b/fm/models/alarmseverity.py index d6bd20c838..92aaab5014 100644 --- a/fm/models/alarmseverity.py +++ b/fm/models/alarmseverity.py @@ -20,7 +20,7 @@ import cachetools # NOC modules from noc.main.models.style import Style from noc.core.mongo.fields import ForeignKeyField -from noc.lib.text import quote_safe_path +from noc.core.text import quote_safe_path from core.prettyjson import to_json from noc.core.model.decorator import on_delete_check diff --git a/fm/models/cloneclassificationrule.py b/fm/models/cloneclassificationrule.py index dc773e7ede..6c604bdb03 100644 --- a/fm/models/cloneclassificationrule.py +++ b/fm/models/cloneclassificationrule.py @@ -15,7 +15,7 @@ from mongoengine.document import Document from mongoengine import fields # NOC modules -from noc.lib.text import quote_safe_path +from noc.core.text import quote_safe_path from noc.core.prettyjson import to_json diff --git a/fm/models/enumeration.py b/fm/models/enumeration.py index 7fe93c2854..e7036906df 100644 --- a/fm/models/enumeration.py +++ b/fm/models/enumeration.py @@ -12,7 +12,7 @@ from mongoengine.document import Document from mongoengine.fields import StringField, DictField, UUIDField # Python modules -from noc.lib.text import quote_safe_path +from noc.core.text import quote_safe_path from noc.core.prettyjson import to_json diff --git a/fm/models/eventclass.py b/fm/models/eventclass.py index 0aa733600f..593f7c5d16 100644 --- a/fm/models/eventclass.py +++ b/fm/models/eventclass.py @@ -31,7 +31,7 @@ import cachetools # NOC modules from noc.core.mongo.fields import PlainReferenceField from noc.core.escape import json_escape as q -from noc.lib.text import quote_safe_path +from noc.core.text import quote_safe_path from noc.core.handler import get_handler from noc.core.model.decorator import on_delete_check from .alarmclass import AlarmClass diff --git a/fm/models/eventclassificationrule.py b/fm/models/eventclassificationrule.py index 39f8f4f553..cba35b1a0a 100644 --- a/fm/models/eventclassificationrule.py +++ b/fm/models/eventclassificationrule.py @@ -20,7 +20,7 @@ from .eventclass import EventClass from .datasource import DataSource from noc.core.mongo.fields import PlainReferenceField from noc.core.escape import json_escape as jq -from noc.lib.text import quote_safe_path +from noc.core.text import quote_safe_path @six.python_2_unicode_compatible diff --git a/gis/models/layer.py b/gis/models/layer.py index 9a9a3f91d2..89fc44e6a4 100644 --- a/gis/models/layer.py +++ b/gis/models/layer.py @@ -19,7 +19,7 @@ import cachetools # NOC modules from noc.core.prettyjson import to_json -from noc.lib.text import quote_safe_path +from noc.core.text import quote_safe_path from noc.core.model.decorator import on_delete_check id_lock = Lock() diff --git a/inv/models/capability.py b/inv/models/capability.py index 71563e7188..bbdbe63afa 100644 --- a/inv/models/capability.py +++ b/inv/models/capability.py @@ -20,7 +20,7 @@ import cachetools # NOC modules from noc.main.models.doccategory import category from core.prettyjson import to_json -from noc.lib.text import quote_safe_path +from noc.core.text import quote_safe_path from noc.core.model.decorator import on_delete_check id_lock = Lock() diff --git a/inv/models/connectionrule.py b/inv/models/connectionrule.py index 98398b5318..965e43e526 100644 --- a/inv/models/connectionrule.py +++ b/inv/models/connectionrule.py @@ -16,7 +16,7 @@ from mongoengine.fields import StringField, UUIDField, ListField, EmbeddedDocume # NOC modules from noc.core.prettyjson import to_json -from noc.lib.text import quote_safe_path +from noc.core.text import quote_safe_path from noc.core.model.decorator import on_delete_check diff --git a/inv/models/connectiontype.py b/inv/models/connectiontype.py index ef22029295..7b7cf81ccf 100644 --- a/inv/models/connectiontype.py +++ b/inv/models/connectiontype.py @@ -24,7 +24,7 @@ from mongoengine.fields import ( # NOC modules from noc.core.mongo.fields import PlainReferenceField from noc.core.prettyjson import to_json -from noc.lib.text import quote_safe_path +from noc.core.text import quote_safe_path from noc.main.models.doccategory import category from noc.core.model.decorator import on_delete_check diff --git a/inv/models/firmwarepolicy.py b/inv/models/firmwarepolicy.py index f1bb8ca784..decd6b385b 100644 --- a/inv/models/firmwarepolicy.py +++ b/inv/models/firmwarepolicy.py @@ -18,7 +18,7 @@ from noc.sa.models.managedobjectprofile import ManagedObjectProfile from .firmware import Firmware from .platform import Platform from noc.core.mongo.fields import ForeignKeyField, PlainReferenceField -from noc.lib.text import split_alnum +from noc.core.text import split_alnum FS_RECOMMENDED = "r" diff --git a/inv/models/objectmodel.py b/inv/models/objectmodel.py index 951345c000..43697615a9 100644 --- a/inv/models/objectmodel.py +++ b/inv/models/objectmodel.py @@ -34,7 +34,7 @@ from .vendor import Vendor from noc.main.models.doccategory import category from noc.core.mongo.fields import PlainReferenceField from noc.core.prettyjson import to_json -from noc.lib.text import quote_safe_path +from noc.core.text import quote_safe_path from noc.core.model.decorator import on_delete_check, on_save id_lock = Lock() diff --git a/inv/models/technology.py b/inv/models/technology.py index 5afedb1f46..1bd69edcc3 100644 --- a/inv/models/technology.py +++ b/inv/models/technology.py @@ -21,7 +21,7 @@ import cachetools from noc.core.model.decorator import on_delete_check from noc.core.bi.decorator import bi_sync from noc.core.prettyjson import to_json -from noc.lib.text import quote_safe_path +from noc.core.text import quote_safe_path id_lock = threading.Lock() diff --git a/phone/models/phonenumber.py b/phone/models/phonenumber.py index 2f774b8ae1..4cd466a305 100644 --- a/phone/models/phonenumber.py +++ b/phone/models/phonenumber.py @@ -25,7 +25,7 @@ from noc.sa.models.service import Service from noc.project.models.project import Project from noc.sa.models.administrativedomain import AdministrativeDomain from noc.core.mongo.fields import ForeignKeyField, PlainReferenceField -from noc.lib.text import clean_number +from noc.core.text import clean_number from noc.core.resourcegroup.decorator import resourcegroup from noc.wf.models.state import State from noc.core.wf.decorator import workflow diff --git a/phone/models/phonerange.py b/phone/models/phonerange.py index 2bf1c246cc..971645a5b8 100644 --- a/phone/models/phonerange.py +++ b/phone/models/phonerange.py @@ -30,7 +30,7 @@ from noc.wf.models.state import State from noc.core.wf.decorator import workflow from noc.core.model.decorator import on_save, on_delete, on_delete_check from noc.core.defer import call_later -from noc.lib.text import clean_number +from noc.core.text import clean_number from noc.core.resourcegroup.decorator import resourcegroup from .dialplan import DialPlan from .phonerangeprofile import PhoneRangeProfile diff --git a/pm/models/metrictype.py b/pm/models/metrictype.py index 56519ed09d..94356b5c82 100644 --- a/pm/models/metrictype.py +++ b/pm/models/metrictype.py @@ -23,7 +23,7 @@ from .metricscope import MetricScope from noc.inv.models.capability import Capability from noc.core.mongo.fields import PlainReferenceField from noc.main.models.doccategory import category -from noc.lib.text import quote_safe_path +from noc.core.text import quote_safe_path from noc.core.prettyjson import to_json from noc.core.defer import call_later from noc.core.model.decorator import on_save diff --git a/sa/interfaces/base.py b/sa/interfaces/base.py index 68b89a8c74..306b214309 100644 --- a/sa/interfaces/base.py +++ b/sa/interfaces/base.py @@ -14,7 +14,7 @@ import datetime import six # NOC Modules -from noc.lib.text import list_to_ranges, ranges_to_list +from noc.core.text import list_to_ranges, ranges_to_list from noc.core.ip import IPv6 from noc.core.mac import MAC from noc.lib.validators import is_ipv6 diff --git a/sa/models/action.py b/sa/models/action.py index 5f2ddbf4ea..8f45f65b1e 100644 --- a/sa/models/action.py +++ b/sa/models/action.py @@ -27,7 +27,7 @@ import jinja2 import cachetools # NOC modules -from noc.lib.text import quote_safe_path +from noc.core.text import quote_safe_path from noc.core.prettyjson import to_json from noc.core.ip import IP diff --git a/sa/models/actioncommands.py b/sa/models/actioncommands.py index 62a8310996..aa6fb8c6c8 100644 --- a/sa/models/actioncommands.py +++ b/sa/models/actioncommands.py @@ -26,7 +26,7 @@ from mongoengine.fields import ( # NOC modules from noc.core.mongo.fields import PlainReferenceField from .profile import Profile -from noc.lib.text import quote_safe_path +from noc.core.text import quote_safe_path from noc.core.prettyjson import to_json from .action import Action diff --git a/sa/models/profilecheckrule.py b/sa/models/profilecheckrule.py index 60c272929a..74cb92f27f 100644 --- a/sa/models/profilecheckrule.py +++ b/sa/models/profilecheckrule.py @@ -20,7 +20,7 @@ from noc.core.mongo.fields import PlainReferenceField from noc.sa.models.profile import Profile from noc.main.models.doccategory import category from noc.core.prettyjson import to_json -from noc.lib.text import quote_safe_path +from noc.core.text import quote_safe_path @category diff --git a/sa/profiles/APC/AOS/get_chassis_id.py b/sa/profiles/APC/AOS/get_chassis_id.py index 1295a53e2f..ef86a80d99 100644 --- a/sa/profiles/APC/AOS/get_chassis_id.py +++ b/sa/profiles/APC/AOS/get_chassis_id.py @@ -2,7 +2,7 @@ # --------------------------------------------------------------------- # APC.AOS.get_chassis_id # --------------------------------------------------------------------- -# Copyright (C) 2007-2018 The NOC Project +# Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # --------------------------------------------------------------------- @@ -11,7 +11,7 @@ from noc.sa.profiles.Generic.get_chassis_id import Script as BaseScript from noc.sa.interfaces.igetchassisid import IGetChassisID from noc.core.mac import MAC from noc.core.mib import mib -from noc.lib.text import parse_kv +from noc.core.text import parse_kv class Script(BaseScript): diff --git a/sa/profiles/APC/AOS/get_inventory.py b/sa/profiles/APC/AOS/get_inventory.py index b77ac29d33..94e114e864 100644 --- a/sa/profiles/APC/AOS/get_inventory.py +++ b/sa/profiles/APC/AOS/get_inventory.py @@ -2,7 +2,7 @@ # --------------------------------------------------------------------- # APC.AOS.get_inventory # --------------------------------------------------------------------- -# Copyright (C) 2007-2013 The NOC Project +# Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # --------------------------------------------------------------------- @@ -11,7 +11,7 @@ import datetime # NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.igetinventory import IGetInventory -from noc.lib.text import parse_kv +from noc.core.text import parse_kv class Script(BaseScript): diff --git a/sa/profiles/APC/AOS/get_version.py b/sa/profiles/APC/AOS/get_version.py index 58e24002a8..54a37f48af 100644 --- a/sa/profiles/APC/AOS/get_version.py +++ b/sa/profiles/APC/AOS/get_version.py @@ -2,7 +2,7 @@ # ---------------------------------------------------------------------- # APC.AOS.get_version # ---------------------------------------------------------------------- -# Copyright (C) 2007-2011 The NOC Project +# Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # ---------------------------------------------------------------------- @@ -12,7 +12,7 @@ import re # NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.igetversion import IGetVersion -from noc.lib.text import parse_kv +from noc.core.text import parse_kv from noc.core.mib import mib diff --git a/sa/profiles/Alcatel/7302/get_capabilities.py b/sa/profiles/Alcatel/7302/get_capabilities.py index 0a11f32e5d..22a699a11f 100644 --- a/sa/profiles/Alcatel/7302/get_capabilities.py +++ b/sa/profiles/Alcatel/7302/get_capabilities.py @@ -2,12 +2,12 @@ # ---------------------------------------------------------------------- # Alcatel.7302.get_capabilities # ---------------------------------------------------------------------- -# Copyright (C) 2007-2016 The NOC Project +# Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # ---------------------------------------------------------------------- # NOC modules -from noc.lib.text import parse_table +from noc.core.text import parse_table from noc.sa.profiles.Generic.get_capabilities import Script as BaseScript from noc.sa.profiles.Generic.get_capabilities import false_on_cli_error diff --git a/sa/profiles/Alcatel/7324RU/get_interfaces.py b/sa/profiles/Alcatel/7324RU/get_interfaces.py index 1218f64dc4..8435869cef 100644 --- a/sa/profiles/Alcatel/7324RU/get_interfaces.py +++ b/sa/profiles/Alcatel/7324RU/get_interfaces.py @@ -13,7 +13,7 @@ from collections import defaultdict # NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.igetinterfaces import IGetInterfaces -from noc.lib.text import parse_table +from noc.core.text import parse_table from noc.core.ip import IPv4 diff --git a/sa/profiles/Alcatel/7324RU/get_switchport.py b/sa/profiles/Alcatel/7324RU/get_switchport.py index b20113cc53..0bec8a122c 100644 --- a/sa/profiles/Alcatel/7324RU/get_switchport.py +++ b/sa/profiles/Alcatel/7324RU/get_switchport.py @@ -13,7 +13,7 @@ from collections import defaultdict # NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.igetswitchport import IGetSwitchport -from noc.lib.text import parse_table +from noc.core.text import parse_table class Script(BaseScript): diff --git a/sa/profiles/Alcatel/AOS/get_capabilities.py b/sa/profiles/Alcatel/AOS/get_capabilities.py index b51d6c835a..9d7d73b61f 100644 --- a/sa/profiles/Alcatel/AOS/get_capabilities.py +++ b/sa/profiles/Alcatel/AOS/get_capabilities.py @@ -2,7 +2,7 @@ # ---------------------------------------------------------------------- # Alcatel.AOS.get_capabilities # ---------------------------------------------------------------------- -# Copyright (C) 2007-2016 The NOC Project +# Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # ---------------------------------------------------------------------- @@ -10,7 +10,7 @@ import re # NOC modules -from noc.lib.text import parse_table +from noc.core.text import parse_table from noc.sa.profiles.Generic.get_capabilities import Script as BaseScript from noc.sa.profiles.Generic.get_capabilities import false_on_cli_error diff --git a/sa/profiles/Alcatel/OS62xx/get_lldp_neighbors.py b/sa/profiles/Alcatel/OS62xx/get_lldp_neighbors.py index ff63660018..a4bccf08a4 100644 --- a/sa/profiles/Alcatel/OS62xx/get_lldp_neighbors.py +++ b/sa/profiles/Alcatel/OS62xx/get_lldp_neighbors.py @@ -2,7 +2,7 @@ # --------------------------------------------------------------------- # Alcatel.OS62xx.get_lldp_neighbors # --------------------------------------------------------------------- -# Copyright (C) 2007-2018 The NOC Project +# Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # --------------------------------------------------------------------- @@ -13,7 +13,7 @@ import re from noc.core.script.base import BaseScript from noc.sa.interfaces.igetlldpneighbors import IGetLLDPNeighbors from noc.lib.validators import is_ipv4, is_ipv6, is_mac -from noc.lib.text import parse_table +from noc.core.text import parse_table class Script(BaseScript): diff --git a/sa/profiles/Alcatel/OS62xx/get_mac_address_table.py b/sa/profiles/Alcatel/OS62xx/get_mac_address_table.py index 13d3955102..82254d8e56 100644 --- a/sa/profiles/Alcatel/OS62xx/get_mac_address_table.py +++ b/sa/profiles/Alcatel/OS62xx/get_mac_address_table.py @@ -2,13 +2,14 @@ # ---------------------------------------------------------------------- # Alcatel.OS62xx.get_mac_address_table # ---------------------------------------------------------------------- -# Copyright (C) 2007-2018 The NOC Project +# Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # ---------------------------------------------------------------------- +# NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.igetmacaddresstable import IGetMACAddressTable -from noc.lib.text import parse_table +from noc.core.text import parse_table class Script(BaseScript): diff --git a/sa/profiles/Alcatel/OS62xx/get_vlans.py b/sa/profiles/Alcatel/OS62xx/get_vlans.py index a03a9f2568..a2b68655b2 100644 --- a/sa/profiles/Alcatel/OS62xx/get_vlans.py +++ b/sa/profiles/Alcatel/OS62xx/get_vlans.py @@ -2,13 +2,14 @@ # ---------------------------------------------------------------------- # Alcatel.OS62xx.get_vlans # ---------------------------------------------------------------------- -# Copyright (C) 2007-2018 The NOC Project +# Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # ---------------------------------------------------------------------- +# NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.igetvlans import IGetVlans -from noc.lib.text import parse_table +from noc.core.text import parse_table class Script(BaseScript): diff --git a/sa/profiles/AlliedTelesis/AT8000S/get_capabilities.py b/sa/profiles/AlliedTelesis/AT8000S/get_capabilities.py index 4e6133f8c7..4f433b1cf6 100644 --- a/sa/profiles/AlliedTelesis/AT8000S/get_capabilities.py +++ b/sa/profiles/AlliedTelesis/AT8000S/get_capabilities.py @@ -2,14 +2,14 @@ # --------------------------------------------------------------------- # AlliedTelesis.AT8000S.get_capabilities # --------------------------------------------------------------------- -# Copyright (C) 2007-2018 The NOC Project +# Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # --------------------------------------------------------------------- # NOC modules from noc.sa.profiles.Generic.get_capabilities import Script as BaseScript from noc.sa.profiles.Generic.get_capabilities import false_on_cli_error -from noc.lib.text import parse_table +from noc.core.text import parse_table class Script(BaseScript): diff --git a/sa/profiles/AlliedTelesis/AT8000S/get_chassis_id.py b/sa/profiles/AlliedTelesis/AT8000S/get_chassis_id.py index b29c447b0f..211109b9f6 100644 --- a/sa/profiles/AlliedTelesis/AT8000S/get_chassis_id.py +++ b/sa/profiles/AlliedTelesis/AT8000S/get_chassis_id.py @@ -2,15 +2,17 @@ # --------------------------------------------------------------------- # AlliedTelesis.AT8000S.get_chassis_id # --------------------------------------------------------------------- -# Copyright (C) 2007-2018 The NOC Project +# Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # --------------------------------------------------------------------- -""" -""" + +# Python modules +import re + +# NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.igetchassisid import IGetChassisID -from noc.lib.text import parse_table -import re +from noc.core.text import parse_table class Script(BaseScript): diff --git a/sa/profiles/AlliedTelesis/AT8000S/get_lldp_neighbors.py b/sa/profiles/AlliedTelesis/AT8000S/get_lldp_neighbors.py index 757a0b8c9c..2d05702efa 100644 --- a/sa/profiles/AlliedTelesis/AT8000S/get_lldp_neighbors.py +++ b/sa/profiles/AlliedTelesis/AT8000S/get_lldp_neighbors.py @@ -2,7 +2,7 @@ # --------------------------------------------------------------------- # AlliedTelesis.AT8000S.get_lldp_neighbors # --------------------------------------------------------------------- -# Copyright (C) 2007-2018 The NOC Project +# Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # --------------------------------------------------------------------- @@ -13,7 +13,7 @@ import re from noc.core.script.base import BaseScript from noc.sa.interfaces.igetlldpneighbors import IGetLLDPNeighbors from noc.lib.validators import is_ipv4, is_ipv6, is_mac -from noc.lib.text import parse_table +from noc.core.text import parse_table class Script(BaseScript): diff --git a/sa/profiles/AlliedTelesis/AT8100/get_interfaces.py b/sa/profiles/AlliedTelesis/AT8100/get_interfaces.py index 341c9e140d..a818d42aca 100644 --- a/sa/profiles/AlliedTelesis/AT8100/get_interfaces.py +++ b/sa/profiles/AlliedTelesis/AT8100/get_interfaces.py @@ -2,7 +2,7 @@ # --------------------------------------------------------------------- # AlliedTelesis.AT8100.get_interfaces # --------------------------------------------------------------------- -# Copyright (C) 2007-2018 The NOC Project +# Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # --------------------------------------------------------------------- @@ -12,7 +12,7 @@ import re # NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.igetinterfaces import IGetInterfaces -from noc.lib.text import parse_table +from noc.core.text import parse_table class Script(BaseScript): diff --git a/sa/profiles/AlliedTelesis/AT8100/get_vlans.py b/sa/profiles/AlliedTelesis/AT8100/get_vlans.py index 12f190a99c..3ca1839bce 100644 --- a/sa/profiles/AlliedTelesis/AT8100/get_vlans.py +++ b/sa/profiles/AlliedTelesis/AT8100/get_vlans.py @@ -2,15 +2,15 @@ # --------------------------------------------------------------------- # AlliedTelesis.AT8100.get_vlans # --------------------------------------------------------------------- -# Copyright (C) 2007-2018 The NOC Project +# Copyright (C) 2007-2019 The NOC Project # coded by azhur # See LICENSE for details # --------------------------------------------------------------------- -""" -""" + +# NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.igetvlans import IGetVlans -from noc.lib.text import parse_table +from noc.core.text import parse_table class Script(BaseScript): diff --git a/sa/profiles/Alstec/24xx/get_arp.py b/sa/profiles/Alstec/24xx/get_arp.py index a15aa516f9..6803836229 100644 --- a/sa/profiles/Alstec/24xx/get_arp.py +++ b/sa/profiles/Alstec/24xx/get_arp.py @@ -13,7 +13,7 @@ import re from noc.core.script.base import BaseScript from noc.sa.interfaces.igetarp import IGetARP from noc.sa.interfaces.base import MACAddressParameter -from noc.lib.text import parse_table +from noc.core.text import parse_table class Script(BaseScript): diff --git a/sa/profiles/Alstec/24xx/get_lldp_neighbors.py b/sa/profiles/Alstec/24xx/get_lldp_neighbors.py index 9c9bdda535..52a402afe8 100644 --- a/sa/profiles/Alstec/24xx/get_lldp_neighbors.py +++ b/sa/profiles/Alstec/24xx/get_lldp_neighbors.py @@ -11,7 +11,7 @@ import re # NOC modules from noc.core.script.base import BaseScript -from noc.lib.text import parse_table +from noc.core.text import parse_table from noc.sa.interfaces.igetlldpneighbors import IGetLLDPNeighbors from noc.sa.interfaces.base import MACAddressParameter from noc.lib.validators import is_ipv4, is_ipv6 diff --git a/sa/profiles/Alstec/24xx/get_metrics.py b/sa/profiles/Alstec/24xx/get_metrics.py index 8cecb0311b..7cf1faff40 100644 --- a/sa/profiles/Alstec/24xx/get_metrics.py +++ b/sa/profiles/Alstec/24xx/get_metrics.py @@ -2,7 +2,7 @@ # --------------------------------------------------------------------- # Alstec.24xx.get_metrics # --------------------------------------------------------------------- -# Copyright (C) 2007-2016 The NOC Project +# Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # --------------------------------------------------------------------- @@ -11,7 +11,7 @@ import six # NOC modules from noc.sa.profiles.Generic.get_metrics import Script as GetMetricsScript, metrics -from noc.lib.text import parse_table +from noc.core.text import parse_table class Script(GetMetricsScript): diff --git a/sa/profiles/Alstec/ALS/get_lldp_neighbors.py b/sa/profiles/Alstec/ALS/get_lldp_neighbors.py index 681abfc6ea..2dbd68ad40 100644 --- a/sa/profiles/Alstec/ALS/get_lldp_neighbors.py +++ b/sa/profiles/Alstec/ALS/get_lldp_neighbors.py @@ -14,7 +14,7 @@ from noc.core.script.base import BaseScript from noc.sa.interfaces.igetlldpneighbors import IGetLLDPNeighbors from noc.sa.interfaces.base import MACAddressParameter from noc.lib.validators import is_ipv4, is_ipv6 -from noc.lib.text import parse_table +from noc.core.text import parse_table class Script(BaseScript): diff --git a/sa/profiles/Angtel/Topaz/get_lldp_neighbors.py b/sa/profiles/Angtel/Topaz/get_lldp_neighbors.py index eb705cbfa6..b8f45649b3 100644 --- a/sa/profiles/Angtel/Topaz/get_lldp_neighbors.py +++ b/sa/profiles/Angtel/Topaz/get_lldp_neighbors.py @@ -11,7 +11,7 @@ import re # NOC modules from noc.core.script.base import BaseScript -from noc.lib.text import parse_table +from noc.core.text import parse_table from noc.sa.interfaces.igetlldpneighbors import IGetLLDPNeighbors from noc.lib.validators import is_ipv4, is_ipv6, is_mac from noc.core.lldp import ( diff --git a/sa/profiles/Arista/EOS/get_inventory.py b/sa/profiles/Arista/EOS/get_inventory.py index e7c76b94a0..6c811b24db 100644 --- a/sa/profiles/Arista/EOS/get_inventory.py +++ b/sa/profiles/Arista/EOS/get_inventory.py @@ -2,7 +2,7 @@ # --------------------------------------------------------------------- # Arista.EOS.get_inventory # --------------------------------------------------------------------- -# Copyright (C) 2007-2013 The NOC Project +# Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # --------------------------------------------------------------------- @@ -12,7 +12,7 @@ import re # NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.igetinventory import IGetInventory -from noc.lib.text import parse_table +from noc.core.text import parse_table class Script(BaseScript): diff --git a/sa/profiles/Arista/EOS/get_vlans.py b/sa/profiles/Arista/EOS/get_vlans.py index 17cef4bf39..4ae0519737 100644 --- a/sa/profiles/Arista/EOS/get_vlans.py +++ b/sa/profiles/Arista/EOS/get_vlans.py @@ -2,14 +2,14 @@ # --------------------------------------------------------------------- # Arista.EOS.get_vlans # --------------------------------------------------------------------- -# Copyright (C) 2007-2013 The NOC Project +# Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # --------------------------------------------------------------------- # NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.igetvlans import IGetVlans -from noc.lib.text import parse_table +from noc.core.text import parse_table class Script(BaseScript): diff --git a/sa/profiles/Audiocodes/Mediant2000/get_version.py b/sa/profiles/Audiocodes/Mediant2000/get_version.py index 7d4eeb9666..3a064fa85f 100644 --- a/sa/profiles/Audiocodes/Mediant2000/get_version.py +++ b/sa/profiles/Audiocodes/Mediant2000/get_version.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # --------------------------------------------------------------------- -# Copyright (C) 2007-2011 The NOC Project +# Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # --------------------------------------------------------------------- @@ -10,7 +10,7 @@ import re # NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.igetversion import IGetVersion -from noc.lib.text import strip_html_tags +from noc.core.text import strip_html_tags class Script(BaseScript): diff --git a/sa/profiles/BDCOM/IOS/get_interfaces.py b/sa/profiles/BDCOM/IOS/get_interfaces.py index d66c19597b..5e62958780 100644 --- a/sa/profiles/BDCOM/IOS/get_interfaces.py +++ b/sa/profiles/BDCOM/IOS/get_interfaces.py @@ -2,15 +2,17 @@ # --------------------------------------------------------------------- # BDCOM.IOS.get_interfaces # --------------------------------------------------------------------- -# Copyright (C) 2007-2017 The NOC Project +# Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # --------------------------------------------------------------------- +# Python modules +import re +# NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.igetinterfaces import IGetInterfaces -from noc.lib.text import parse_table -import re +from noc.core.text import parse_table class Script(BaseScript): diff --git a/sa/profiles/BDCOM/IOS/get_mac_address_table.py b/sa/profiles/BDCOM/IOS/get_mac_address_table.py index 00f22da8cc..4d10a92d88 100644 --- a/sa/profiles/BDCOM/IOS/get_mac_address_table.py +++ b/sa/profiles/BDCOM/IOS/get_mac_address_table.py @@ -2,14 +2,14 @@ # --------------------------------------------------------------------- # BDCOM.IOS.get_mac_address_table # --------------------------------------------------------------------- -# Copyright (C) 2007-2017 The NOC Project +# Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # --------------------------------------------------------------------- # NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.igetmacaddresstable import IGetMACAddressTable -from noc.lib.text import parse_table +from noc.core.text import parse_table from noc.core.mac import MAC diff --git a/sa/profiles/BDCOM/IOS/get_vlans.py b/sa/profiles/BDCOM/IOS/get_vlans.py index 59a4d75bff..2f5c2e69ee 100644 --- a/sa/profiles/BDCOM/IOS/get_vlans.py +++ b/sa/profiles/BDCOM/IOS/get_vlans.py @@ -2,14 +2,14 @@ # --------------------------------------------------------------------- # BDCOM.IOS.get_vlans # --------------------------------------------------------------------- -# Copyright (C) 2007-2017 The NOC Project +# Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # --------------------------------------------------------------------- - +# NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.igetvlans import IGetVlans -from noc.lib.text import parse_table +from noc.core.text import parse_table class Script(BaseScript): diff --git a/sa/profiles/BDCOM/xPON/get_interfaces.py b/sa/profiles/BDCOM/xPON/get_interfaces.py index c6cd4a5ce3..7dc6778c35 100644 --- a/sa/profiles/BDCOM/xPON/get_interfaces.py +++ b/sa/profiles/BDCOM/xPON/get_interfaces.py @@ -5,15 +5,14 @@ # Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # --------------------------------------------------------------------- -""" -""" + # Python modules import re # NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.igetinterfaces import IGetInterfaces -from noc.lib.text import parse_table +from noc.core.text import parse_table from noc.lib.validators import is_int diff --git a/sa/profiles/BDCOM/xPON/get_mac_address_table.py b/sa/profiles/BDCOM/xPON/get_mac_address_table.py index b0e62eb71d..f6db78f4eb 100644 --- a/sa/profiles/BDCOM/xPON/get_mac_address_table.py +++ b/sa/profiles/BDCOM/xPON/get_mac_address_table.py @@ -9,7 +9,7 @@ # NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.igetmacaddresstable import IGetMACAddressTable -from noc.lib.text import parse_table +from noc.core.text import parse_table from noc.core.mac import MAC diff --git a/sa/profiles/BDCOM/xPON/get_vlans.py b/sa/profiles/BDCOM/xPON/get_vlans.py index 3dde101db0..1a02f9b79a 100644 --- a/sa/profiles/BDCOM/xPON/get_vlans.py +++ b/sa/profiles/BDCOM/xPON/get_vlans.py @@ -9,7 +9,7 @@ # NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.igetvlans import IGetVlans -from noc.lib.text import parse_table +from noc.core.text import parse_table class Script(BaseScript): diff --git a/sa/profiles/Carelink/SWG/get_interfaces.py b/sa/profiles/Carelink/SWG/get_interfaces.py index a5d612809a..015278a6d1 100644 --- a/sa/profiles/Carelink/SWG/get_interfaces.py +++ b/sa/profiles/Carelink/SWG/get_interfaces.py @@ -14,7 +14,7 @@ from noc.core.script.base import BaseScript from noc.sa.interfaces.igetinterfaces import IGetInterfaces from noc.core.ip import IPv4 from noc.lib.validators import is_int -from noc.lib.text import parse_table +from noc.core.text import parse_table class Script(BaseScript): diff --git a/sa/profiles/Carelink/SWG/get_mac_address_table.py b/sa/profiles/Carelink/SWG/get_mac_address_table.py index 62e92fb71f..8854538ccd 100644 --- a/sa/profiles/Carelink/SWG/get_mac_address_table.py +++ b/sa/profiles/Carelink/SWG/get_mac_address_table.py @@ -2,14 +2,14 @@ # --------------------------------------------------------------------- # Carelink.SWG.get_mac_address_table # --------------------------------------------------------------------- -# Copyright (C) 2007-2017 The NOC Project +# Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # --------------------------------------------------------------------- # NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.igetmacaddresstable import IGetMACAddressTable -from noc.lib.text import parse_table +from noc.core.text import parse_table class Script(BaseScript): diff --git a/sa/profiles/Carelink/SWG/get_vlans.py b/sa/profiles/Carelink/SWG/get_vlans.py index a7095b2d9a..89f37f6e9f 100644 --- a/sa/profiles/Carelink/SWG/get_vlans.py +++ b/sa/profiles/Carelink/SWG/get_vlans.py @@ -10,7 +10,7 @@ from noc.core.script.base import BaseScript from noc.sa.interfaces.igetvlans import IGetVlans from noc.lib.validators import is_int -from noc.lib.text import parse_table +from noc.core.text import parse_table class Script(BaseScript): diff --git a/sa/profiles/Cisco/IOS/get_metrics.py b/sa/profiles/Cisco/IOS/get_metrics.py index 7cfc1902b1..6ae0fb093f 100644 --- a/sa/profiles/Cisco/IOS/get_metrics.py +++ b/sa/profiles/Cisco/IOS/get_metrics.py @@ -10,7 +10,7 @@ import re # NOC modules -from noc.lib.text import parse_kv +from noc.core.text import parse_kv from noc.sa.profiles.Generic.get_metrics import Script as GetMetricsScript, metrics diff --git a/sa/profiles/Cisco/IOS/get_portchannel.py b/sa/profiles/Cisco/IOS/get_portchannel.py index a8ebbd3ecd..bd228aa6ad 100644 --- a/sa/profiles/Cisco/IOS/get_portchannel.py +++ b/sa/profiles/Cisco/IOS/get_portchannel.py @@ -2,7 +2,7 @@ # --------------------------------------------------------------------- # Cisco.IOS.get_portchannel # --------------------------------------------------------------------- -# Copyright (C) 2007-2018 The NOC Project +# Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # --------------------------------------------------------------------- @@ -11,7 +11,7 @@ import re # NOC modules from noc.sa.profiles.Generic.get_portchannel import Script as BaseScript from noc.sa.interfaces.igetportchannel import IGetPortchannel -from noc.lib.text import parse_table +from noc.core.text import parse_table class Script(BaseScript): diff --git a/sa/profiles/Cisco/IOS/get_spanning_tree.py b/sa/profiles/Cisco/IOS/get_spanning_tree.py index ad62b1d544..fd0d49a7c0 100644 --- a/sa/profiles/Cisco/IOS/get_spanning_tree.py +++ b/sa/profiles/Cisco/IOS/get_spanning_tree.py @@ -2,7 +2,7 @@ # --------------------------------------------------------------------- # Cisco.IOS.get_spanning_tree # --------------------------------------------------------------------- -# Copyright (C) 2007-2018 The NOC Project +# Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # --------------------------------------------------------------------- @@ -12,7 +12,7 @@ import re # NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.igetspanningtree import IGetSpanningTree -from noc.lib.text import parse_table +from noc.core.text import parse_table class Script(BaseScript): diff --git a/sa/profiles/Cisco/IOS/set_switchport.py b/sa/profiles/Cisco/IOS/set_switchport.py index 493dfdd9d3..43d12dd489 100644 --- a/sa/profiles/Cisco/IOS/set_switchport.py +++ b/sa/profiles/Cisco/IOS/set_switchport.py @@ -9,7 +9,7 @@ # NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.isetswitchport import ISetSwitchport -from noc.lib.text import list_to_ranges +from noc.core.text import list_to_ranges from noc.sa.profiles.Cisco.IOS.profile import MESeries diff --git a/sa/profiles/Cisco/SMB/get_arp.py b/sa/profiles/Cisco/SMB/get_arp.py index a288598de5..eb48067c57 100644 --- a/sa/profiles/Cisco/SMB/get_arp.py +++ b/sa/profiles/Cisco/SMB/get_arp.py @@ -12,7 +12,7 @@ import re # NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.igetarp import IGetARP -from noc.lib.text import parse_table +from noc.core.text import parse_table class Script(BaseScript): diff --git a/sa/profiles/Cisco/SMB/get_interfaces.py b/sa/profiles/Cisco/SMB/get_interfaces.py index 8562fd286c..3532fd0ca9 100644 --- a/sa/profiles/Cisco/SMB/get_interfaces.py +++ b/sa/profiles/Cisco/SMB/get_interfaces.py @@ -12,7 +12,7 @@ import re # NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.igetinterfaces import IGetInterfaces -from noc.lib.text import parse_table +from noc.core.text import parse_table class Script(BaseScript): diff --git a/sa/profiles/Cisco/SMB/get_lldp_neighbors.py b/sa/profiles/Cisco/SMB/get_lldp_neighbors.py index b65d6c2813..b45c3dfc75 100644 --- a/sa/profiles/Cisco/SMB/get_lldp_neighbors.py +++ b/sa/profiles/Cisco/SMB/get_lldp_neighbors.py @@ -13,7 +13,7 @@ import re from noc.core.script.base import BaseScript from noc.sa.interfaces.igetlldpneighbors import IGetLLDPNeighbors from noc.lib.validators import is_int, is_ipv4, is_ipv6, is_mac -from noc.lib.text import parse_table +from noc.core.text import parse_table class Script(BaseScript): diff --git a/sa/profiles/Cisco/SMB/get_portchannel.py b/sa/profiles/Cisco/SMB/get_portchannel.py index 4907623095..fad20c0cfa 100644 --- a/sa/profiles/Cisco/SMB/get_portchannel.py +++ b/sa/profiles/Cisco/SMB/get_portchannel.py @@ -12,7 +12,7 @@ import re # NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.igetportchannel import IGetPortchannel -from noc.lib.text import split_alnum +from noc.core.text import split_alnum class Script(BaseScript): diff --git a/sa/profiles/Cisco/SMB/get_spanning_tree.py b/sa/profiles/Cisco/SMB/get_spanning_tree.py index 84ff3d0515..f5f9896814 100644 --- a/sa/profiles/Cisco/SMB/get_spanning_tree.py +++ b/sa/profiles/Cisco/SMB/get_spanning_tree.py @@ -12,7 +12,7 @@ import re # NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.igetspanningtree import IGetSpanningTree -from noc.lib.text import parse_table +from noc.core.text import parse_table class Script(BaseScript): diff --git a/sa/profiles/DLink/DxS/get_chassis_id.py b/sa/profiles/DLink/DxS/get_chassis_id.py index c79893c93a..40b2706942 100644 --- a/sa/profiles/DLink/DxS/get_chassis_id.py +++ b/sa/profiles/DLink/DxS/get_chassis_id.py @@ -2,17 +2,19 @@ # --------------------------------------------------------------------- # DLink.DxS.get_chassis_id # --------------------------------------------------------------------- -# Copyright (C) 2007-2018 The NOC Project +# Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # --------------------------------------------------------------------- -""" -""" + +# Python modules +import re + +# NOC modules from noc.sa.profiles.Generic.get_chassis_id import Script as BaseScript from noc.sa.interfaces.igetchassisid import IGetChassisID from noc.lib.validators import is_mac -from noc.lib.text import parse_table +from noc.core.text import parse_table from noc.core.mib import mib -import re class Script(BaseScript): diff --git a/sa/profiles/DLink/DxS_Industrial_CLI/get_arp.py b/sa/profiles/DLink/DxS_Industrial_CLI/get_arp.py index 2fc5e1a75e..6dfa15ee46 100644 --- a/sa/profiles/DLink/DxS_Industrial_CLI/get_arp.py +++ b/sa/profiles/DLink/DxS_Industrial_CLI/get_arp.py @@ -2,14 +2,14 @@ # --------------------------------------------------------------------- # DLink.DxS_Industrial_CLI.get_arp # --------------------------------------------------------------------- -# Copyright (C) 2007-2018 The NOC Project +# Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # --------------------------------------------------------------------- -""" -""" + +# NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.igetarp import IGetARP -from noc.lib.text import parse_table +from noc.core.text import parse_table class Script(BaseScript): diff --git a/sa/profiles/DLink/DxS_Industrial_CLI/get_lldp_neighbors.py b/sa/profiles/DLink/DxS_Industrial_CLI/get_lldp_neighbors.py index 04f7413358..0aff50e9f3 100644 --- a/sa/profiles/DLink/DxS_Industrial_CLI/get_lldp_neighbors.py +++ b/sa/profiles/DLink/DxS_Industrial_CLI/get_lldp_neighbors.py @@ -2,11 +2,10 @@ # --------------------------------------------------------------------- # DLink.DxS_Industrial_CLI.get_lldp_neighbors # --------------------------------------------------------------------- -# Copyright (C) 2007-2016 The NOC Project +# Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # --------------------------------------------------------------------- -""" -""" + # Python modules import re @@ -15,7 +14,7 @@ from noc.core.script.base import BaseScript from noc.sa.interfaces.igetlldpneighbors import IGetLLDPNeighbors from noc.sa.interfaces.base import MACAddressParameter from noc.sa.interfaces.base import IPv4Parameter -from noc.lib.text import parse_table +from noc.core.text import parse_table class Script(BaseScript): diff --git a/sa/profiles/DLink/DxS_Industrial_CLI/get_mac_address_table.py b/sa/profiles/DLink/DxS_Industrial_CLI/get_mac_address_table.py index 0c169f2547..981d2f449d 100644 --- a/sa/profiles/DLink/DxS_Industrial_CLI/get_mac_address_table.py +++ b/sa/profiles/DLink/DxS_Industrial_CLI/get_mac_address_table.py @@ -2,14 +2,14 @@ # --------------------------------------------------------------------- # DLink.DxS_Industrial_CLI.get_mac_address_table # --------------------------------------------------------------------- -# Copyright (C) 2007-2018 The NOC Project +# Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # --------------------------------------------------------------------- -""" -""" + +# NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.igetmacaddresstable import IGetMACAddressTable -from noc.lib.text import parse_table +from noc.core.text import parse_table class Script(BaseScript): diff --git a/sa/profiles/EdgeCore/ES/confdb/normalizer.py b/sa/profiles/EdgeCore/ES/confdb/normalizer.py index 7521cc3f23..3a522ff2c7 100644 --- a/sa/profiles/EdgeCore/ES/confdb/normalizer.py +++ b/sa/profiles/EdgeCore/ES/confdb/normalizer.py @@ -8,7 +8,7 @@ # NOC modules from noc.core.confdb.normalizer.base import BaseNormalizer, match, ANY, REST -from noc.lib.text import ranges_to_list +from noc.core.text import ranges_to_list class ESNormalizer(BaseNormalizer): diff --git a/sa/profiles/Eltex/ESR/get_arp.py b/sa/profiles/Eltex/ESR/get_arp.py index ed76dd5263..bb22dab5fa 100644 --- a/sa/profiles/Eltex/ESR/get_arp.py +++ b/sa/profiles/Eltex/ESR/get_arp.py @@ -2,14 +2,14 @@ # --------------------------------------------------------------------- # Eltex.ESR.get_arp # --------------------------------------------------------------------- -# Copyright (C) 2007-2017 The NOC Project +# Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # --------------------------------------------------------------------- # NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.igetarp import IGetARP -from noc.lib.text import parse_table +from noc.core.text import parse_table class Script(BaseScript): diff --git a/sa/profiles/Eltex/ESR/get_interface_status.py b/sa/profiles/Eltex/ESR/get_interface_status.py index 9782490a09..27a01b388a 100644 --- a/sa/profiles/Eltex/ESR/get_interface_status.py +++ b/sa/profiles/Eltex/ESR/get_interface_status.py @@ -9,7 +9,7 @@ # NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.igetinterfacestatus import IGetInterfaceStatus -from noc.lib.text import parse_table +from noc.core.text import parse_table class Script(BaseScript): diff --git a/sa/profiles/Eltex/ESR/get_interfaces.py b/sa/profiles/Eltex/ESR/get_interfaces.py index 4bfd2bee68..1eab14a1af 100644 --- a/sa/profiles/Eltex/ESR/get_interfaces.py +++ b/sa/profiles/Eltex/ESR/get_interfaces.py @@ -12,7 +12,7 @@ import re # NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.igetinterfaces import IGetInterfaces -from noc.lib.text import parse_table +from noc.core.text import parse_table class Script(BaseScript): diff --git a/sa/profiles/Eltex/ESR/get_ipv6_neighbor.py b/sa/profiles/Eltex/ESR/get_ipv6_neighbor.py index e3b66a76c7..300557ee97 100644 --- a/sa/profiles/Eltex/ESR/get_ipv6_neighbor.py +++ b/sa/profiles/Eltex/ESR/get_ipv6_neighbor.py @@ -9,7 +9,7 @@ # NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.igetipv6neighbor import IGetIPv6Neighbor -from noc.lib.text import parse_table +from noc.core.text import parse_table class Script(BaseScript): diff --git a/sa/profiles/Eltex/ESR/get_mac_address_table.py b/sa/profiles/Eltex/ESR/get_mac_address_table.py index b6c769fa78..ce05fc097a 100644 --- a/sa/profiles/Eltex/ESR/get_mac_address_table.py +++ b/sa/profiles/Eltex/ESR/get_mac_address_table.py @@ -2,14 +2,14 @@ # --------------------------------------------------------------------- # Eltex.ESR.get_mac_address_table # --------------------------------------------------------------------- -# Copyright (C) 2007-2017 The NOC Project +# Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # --------------------------------------------------------------------- # NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.igetmacaddresstable import IGetMACAddressTable -from noc.lib.text import parse_table +from noc.core.text import parse_table class Script(BaseScript): diff --git a/sa/profiles/Eltex/ESR/get_vlans.py b/sa/profiles/Eltex/ESR/get_vlans.py index d423fbfaf1..371e15e5db 100644 --- a/sa/profiles/Eltex/ESR/get_vlans.py +++ b/sa/profiles/Eltex/ESR/get_vlans.py @@ -2,14 +2,14 @@ # --------------------------------------------------------------------- # Eltex.ESR.get_vlans # --------------------------------------------------------------------- -# Copyright (C) 2007-2017 The NOC Project +# Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # --------------------------------------------------------------------- # NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.igetvlans import IGetVlans -from noc.lib.text import parse_table +from noc.core.text import parse_table class Script(BaseScript): diff --git a/sa/profiles/Eltex/LTP/get_interfaces.py b/sa/profiles/Eltex/LTP/get_interfaces.py index f152b8b2ce..bea9de07a3 100644 --- a/sa/profiles/Eltex/LTP/get_interfaces.py +++ b/sa/profiles/Eltex/LTP/get_interfaces.py @@ -2,7 +2,7 @@ # --------------------------------------------------------------------- # Eltex.LTP.get_interfaces # --------------------------------------------------------------------- -# Copyright (C) 2007-2018 The NOC Project +# Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # --------------------------------------------------------------------- @@ -13,7 +13,7 @@ import re from noc.core.script.base import BaseScript from noc.sa.interfaces.igetinterfaces import IGetInterfaces from noc.core.ip import IPv4 -from noc.lib.text import parse_table +from noc.core.text import parse_table class Script(BaseScript): diff --git a/sa/profiles/Eltex/LTP/get_lldp_neighbors.py b/sa/profiles/Eltex/LTP/get_lldp_neighbors.py index ef5243fa35..b900a79819 100644 --- a/sa/profiles/Eltex/LTP/get_lldp_neighbors.py +++ b/sa/profiles/Eltex/LTP/get_lldp_neighbors.py @@ -2,7 +2,7 @@ # --------------------------------------------------------------------- # Eltex.LTP.get_lldp_neighbors # --------------------------------------------------------------------- -# Copyright (C) 2007-2018 The NOC Project +# Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # --------------------------------------------------------------------- @@ -14,7 +14,7 @@ from noc.sa.profiles.Generic.get_lldp_neighbors import Script as BaseScript from noc.sa.interfaces.igetlldpneighbors import IGetLLDPNeighbors from noc.sa.interfaces.base import MACAddressParameter from noc.lib.validators import is_int, is_ipv4, is_ipv6, is_mac -from noc.lib.text import parse_table +from noc.core.text import parse_table class Script(BaseScript): diff --git a/sa/profiles/Eltex/LTP/get_mac_address_table.py b/sa/profiles/Eltex/LTP/get_mac_address_table.py index 1edc26f273..f98ec2a8ac 100644 --- a/sa/profiles/Eltex/LTP/get_mac_address_table.py +++ b/sa/profiles/Eltex/LTP/get_mac_address_table.py @@ -2,7 +2,7 @@ # --------------------------------------------------------------------- # Eltex.LTP.get_mac_address_table # --------------------------------------------------------------------- -# Copyright (C) 2007-2017 The NOC Project +# Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # --------------------------------------------------------------------- @@ -12,7 +12,7 @@ import re # NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.igetmacaddresstable import IGetMACAddressTable -from noc.lib.text import parse_table +from noc.core.text import parse_table class Script(BaseScript): diff --git a/sa/profiles/Eltex/MA4000/get_dom_status.py b/sa/profiles/Eltex/MA4000/get_dom_status.py index e7b5f9f6ec..a381b0b9e1 100644 --- a/sa/profiles/Eltex/MA4000/get_dom_status.py +++ b/sa/profiles/Eltex/MA4000/get_dom_status.py @@ -2,15 +2,14 @@ # --------------------------------------------------------------------- # Eltex.MA4000.get_dom_status # --------------------------------------------------------------------- -# Copyright (C) 2007-2017 The NOC Project +# Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # --------------------------------------------------------------------- - # NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.igetdomstatus import IGetDOMStatus -from noc.lib.text import parse_table +from noc.core.text import parse_table class Script(BaseScript): diff --git a/sa/profiles/Eltex/MA4000/get_interfaces.py b/sa/profiles/Eltex/MA4000/get_interfaces.py index 32f9dde450..ce03ee3b52 100644 --- a/sa/profiles/Eltex/MA4000/get_interfaces.py +++ b/sa/profiles/Eltex/MA4000/get_interfaces.py @@ -13,7 +13,7 @@ import re from noc.core.script.base import BaseScript from noc.sa.interfaces.igetinterfaces import IGetInterfaces from noc.core.ip import IPv4 -from noc.lib.text import parse_table +from noc.core.text import parse_table class Script(BaseScript): diff --git a/sa/profiles/Eltex/MA4000/get_inventory.py b/sa/profiles/Eltex/MA4000/get_inventory.py index 8ed248c1b8..1c56a0a990 100644 --- a/sa/profiles/Eltex/MA4000/get_inventory.py +++ b/sa/profiles/Eltex/MA4000/get_inventory.py @@ -12,7 +12,7 @@ import re # NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.igetinventory import IGetInventory -from noc.lib.text import parse_table +from noc.core.text import parse_table class Script(BaseScript): diff --git a/sa/profiles/Eltex/MA4000/get_lldp_neighbors.py b/sa/profiles/Eltex/MA4000/get_lldp_neighbors.py index fed482129b..c96dfb459a 100644 --- a/sa/profiles/Eltex/MA4000/get_lldp_neighbors.py +++ b/sa/profiles/Eltex/MA4000/get_lldp_neighbors.py @@ -2,7 +2,7 @@ # --------------------------------------------------------------------- # Eltex.MA4000.get_lldp_neighbors # --------------------------------------------------------------------- -# Copyright (C) 2007-2018 The NOC Project +# Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # --------------------------------------------------------------------- @@ -13,7 +13,7 @@ import re from noc.core.script.base import BaseScript from noc.sa.interfaces.igetlldpneighbors import IGetLLDPNeighbors from noc.lib.validators import is_ipv4, is_ipv6, is_mac -from noc.lib.text import parse_table +from noc.core.text import parse_table from noc.core.lldp import ( LLDP_CHASSIS_SUBTYPE_MAC, LLDP_CHASSIS_SUBTYPE_NETWORK_ADDRESS, diff --git a/sa/profiles/Eltex/MA4000/get_local_users.py b/sa/profiles/Eltex/MA4000/get_local_users.py index ff3df62d15..643525c37c 100644 --- a/sa/profiles/Eltex/MA4000/get_local_users.py +++ b/sa/profiles/Eltex/MA4000/get_local_users.py @@ -2,14 +2,14 @@ # --------------------------------------------------------------------- # Eltex.MA4000.get_local_users # --------------------------------------------------------------------- -# Copyright (C) 2007-2017 The NOC Project +# Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # --------------------------------------------------------------------- # NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.igetlocalusers import IGetLocalUsers -from noc.lib.text import parse_table +from noc.core.text import parse_table class Script(BaseScript): diff --git a/sa/profiles/Eltex/MA4000/get_mac_address_table.py b/sa/profiles/Eltex/MA4000/get_mac_address_table.py index 403bf6e2dc..b9c8891a45 100644 --- a/sa/profiles/Eltex/MA4000/get_mac_address_table.py +++ b/sa/profiles/Eltex/MA4000/get_mac_address_table.py @@ -2,14 +2,14 @@ # --------------------------------------------------------------------- # Eltex.MA4000.get_mac_address_table # --------------------------------------------------------------------- -# Copyright (C) 2007-2017 The NOC Project +# Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # --------------------------------------------------------------------- # NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.igetmacaddresstable import IGetMACAddressTable -from noc.lib.text import parse_table +from noc.core.text import parse_table class Script(BaseScript): diff --git a/sa/profiles/Eltex/MES/confdb/normalizer.py b/sa/profiles/Eltex/MES/confdb/normalizer.py index 84fc4cb3c1..ba9de38eb0 100644 --- a/sa/profiles/Eltex/MES/confdb/normalizer.py +++ b/sa/profiles/Eltex/MES/confdb/normalizer.py @@ -8,7 +8,7 @@ # NOC modules from noc.core.confdb.normalizer.base import BaseNormalizer, match, ANY, REST -from noc.lib.text import ranges_to_list +from noc.core.text import ranges_to_list class MESNormalizer(BaseNormalizer): diff --git a/sa/profiles/Eltex/MES/get_capabilities.py b/sa/profiles/Eltex/MES/get_capabilities.py index 2d33fc73bb..27f0a15619 100644 --- a/sa/profiles/Eltex/MES/get_capabilities.py +++ b/sa/profiles/Eltex/MES/get_capabilities.py @@ -10,7 +10,7 @@ import re # NOC modules -from noc.lib.text import parse_table +from noc.core.text import parse_table from noc.sa.profiles.Generic.get_capabilities import Script as BaseScript from noc.sa.profiles.Generic.get_capabilities import false_on_cli_error diff --git a/sa/profiles/Eltex/MES/get_interfaces.py b/sa/profiles/Eltex/MES/get_interfaces.py index 0eeb17cfc6..31fe7ab111 100644 --- a/sa/profiles/Eltex/MES/get_interfaces.py +++ b/sa/profiles/Eltex/MES/get_interfaces.py @@ -15,7 +15,7 @@ import time from noc.sa.profiles.Generic.get_interfaces import Script as BaseScript from noc.sa.interfaces.igetinterfaces import IGetInterfaces from noc.sa.interfaces.base import MACAddressParameter -from noc.lib.text import parse_table +from noc.core.text import parse_table from noc.core.mac import MAC from noc.core.mib import mib from noc.core.ip import IPv4 diff --git a/sa/profiles/Eltex/MES/get_inventory.py b/sa/profiles/Eltex/MES/get_inventory.py index b312f0403e..d06c95a83f 100644 --- a/sa/profiles/Eltex/MES/get_inventory.py +++ b/sa/profiles/Eltex/MES/get_inventory.py @@ -12,7 +12,7 @@ import re # NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.igetinventory import IGetInventory -from noc.lib.text import parse_table +from noc.core.text import parse_table from noc.lib.validators import is_int diff --git a/sa/profiles/Eltex/MES/get_lldp_neighbors.py b/sa/profiles/Eltex/MES/get_lldp_neighbors.py index 5a1a6e9b98..49bcb986fc 100644 --- a/sa/profiles/Eltex/MES/get_lldp_neighbors.py +++ b/sa/profiles/Eltex/MES/get_lldp_neighbors.py @@ -18,7 +18,7 @@ from noc.core.script.base import BaseScript from noc.sa.interfaces.igetlldpneighbors import IGetLLDPNeighbors from noc.sa.interfaces.base import MACAddressParameter from noc.lib.validators import is_int, is_ipv4, is_ipv6, is_mac -from noc.lib.text import parse_table +from noc.core.text import parse_table from noc.core.mac import MAC from noc.core.mib import mib from noc.core.lldp import ( diff --git a/sa/profiles/Eltex/MES/get_spanning_tree.py b/sa/profiles/Eltex/MES/get_spanning_tree.py index 29ab62bef3..00bcb72624 100644 --- a/sa/profiles/Eltex/MES/get_spanning_tree.py +++ b/sa/profiles/Eltex/MES/get_spanning_tree.py @@ -12,7 +12,7 @@ import re # NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.igetspanningtree import IGetSpanningTree -from noc.lib.text import parse_table +from noc.core.text import parse_table class Script(BaseScript): diff --git a/sa/profiles/Eltex/MES/get_switchport.py b/sa/profiles/Eltex/MES/get_switchport.py index 8981c0643d..2cad671a4d 100644 --- a/sa/profiles/Eltex/MES/get_switchport.py +++ b/sa/profiles/Eltex/MES/get_switchport.py @@ -2,7 +2,7 @@ # --------------------------------------------------------------------- # Eltex.MES.get_switchport # --------------------------------------------------------------------- -# Copyright (C) 2007-2015 The NOC Project +# Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # --------------------------------------------------------------------- @@ -12,7 +12,7 @@ import re # NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.igetswitchport import IGetSwitchport -from noc.lib.text import parse_table +from noc.core.text import parse_table class Script(BaseScript): diff --git a/sa/profiles/Eltex/MES/set_switchport.py b/sa/profiles/Eltex/MES/set_switchport.py index 0da7f223d6..ac5ee54e1e 100644 --- a/sa/profiles/Eltex/MES/set_switchport.py +++ b/sa/profiles/Eltex/MES/set_switchport.py @@ -2,14 +2,14 @@ # --------------------------------------------------------------------- # Eltex.MES.set_switchport # --------------------------------------------------------------------- -# Copyright (C) 2007-2017 The NOC Project +# Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # --------------------------------------------------------------------- # NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.isetswitchport import ISetSwitchport -from noc.lib.text import list_to_ranges +from noc.core.text import list_to_ranges class Script(BaseScript): diff --git a/sa/profiles/Eltex/MES5448/get_arp.py b/sa/profiles/Eltex/MES5448/get_arp.py index 77edd6f11b..5bffe1ad19 100644 --- a/sa/profiles/Eltex/MES5448/get_arp.py +++ b/sa/profiles/Eltex/MES5448/get_arp.py @@ -2,14 +2,14 @@ # --------------------------------------------------------------------- # Eltex.MES5448.get_arp # --------------------------------------------------------------------- -# Copyright (C) 2007-2017 The NOC Project +# Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # --------------------------------------------------------------------- # NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.igetarp import IGetARP -from noc.lib.text import parse_table +from noc.core.text import parse_table class Script(BaseScript): diff --git a/sa/profiles/Eltex/MES5448/get_capabilities.py b/sa/profiles/Eltex/MES5448/get_capabilities.py index b4a57e9f4d..63ada73633 100644 --- a/sa/profiles/Eltex/MES5448/get_capabilities.py +++ b/sa/profiles/Eltex/MES5448/get_capabilities.py @@ -12,7 +12,7 @@ import re # NOC modules from noc.sa.profiles.Generic.get_capabilities import Script as BaseScript from noc.sa.profiles.Generic.get_capabilities import false_on_cli_error -from noc.lib.text import parse_table +from noc.core.text import parse_table class Script(BaseScript): diff --git a/sa/profiles/Eltex/MES5448/get_interfaces.py b/sa/profiles/Eltex/MES5448/get_interfaces.py index 492662b828..67a510d790 100644 --- a/sa/profiles/Eltex/MES5448/get_interfaces.py +++ b/sa/profiles/Eltex/MES5448/get_interfaces.py @@ -13,7 +13,7 @@ import re from noc.core.script.base import BaseScript from noc.sa.interfaces.igetinterfaces import IGetInterfaces from noc.core.ip import IPv4 -from noc.lib.text import parse_table +from noc.core.text import parse_table class Script(BaseScript): diff --git a/sa/profiles/Eltex/MES5448/get_inventory.py b/sa/profiles/Eltex/MES5448/get_inventory.py index d3d3b66da6..c78d697eb6 100644 --- a/sa/profiles/Eltex/MES5448/get_inventory.py +++ b/sa/profiles/Eltex/MES5448/get_inventory.py @@ -9,7 +9,7 @@ # NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.igetinventory import IGetInventory -from noc.lib.text import parse_table +from noc.core.text import parse_table class Script(BaseScript): diff --git a/sa/profiles/Eltex/MES5448/get_lacp_neighbors.py b/sa/profiles/Eltex/MES5448/get_lacp_neighbors.py index bd914f4e84..735e206eee 100644 --- a/sa/profiles/Eltex/MES5448/get_lacp_neighbors.py +++ b/sa/profiles/Eltex/MES5448/get_lacp_neighbors.py @@ -9,7 +9,7 @@ # NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.igetlacpneighbors import IGetLACPNeighbors -from noc.lib.text import parse_table +from noc.core.text import parse_table class Script(BaseScript): diff --git a/sa/profiles/Eltex/MES5448/get_lldp_neighbors.py b/sa/profiles/Eltex/MES5448/get_lldp_neighbors.py index e4388b9eef..8ff6d5afe2 100644 --- a/sa/profiles/Eltex/MES5448/get_lldp_neighbors.py +++ b/sa/profiles/Eltex/MES5448/get_lldp_neighbors.py @@ -12,7 +12,7 @@ import re # NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.igetlldpneighbors import IGetLLDPNeighbors -from noc.lib.text import parse_table +from noc.core.text import parse_table class Script(BaseScript): diff --git a/sa/profiles/Eltex/MES5448/get_mac_address_table.py b/sa/profiles/Eltex/MES5448/get_mac_address_table.py index 2ecb98e67a..90543bb46c 100644 --- a/sa/profiles/Eltex/MES5448/get_mac_address_table.py +++ b/sa/profiles/Eltex/MES5448/get_mac_address_table.py @@ -2,14 +2,14 @@ # --------------------------------------------------------------------- # Eltex.MES5448.get_mac_address_table # --------------------------------------------------------------------- -# Copyright (C) 2007-2017 The NOC Project +# Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # --------------------------------------------------------------------- # NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.igetmacaddresstable import IGetMACAddressTable -from noc.lib.text import parse_table +from noc.core.text import parse_table class Script(BaseScript): diff --git a/sa/profiles/Eltex/MES5448/get_portchannel.py b/sa/profiles/Eltex/MES5448/get_portchannel.py index bd8ade3409..9d4ec2d999 100644 --- a/sa/profiles/Eltex/MES5448/get_portchannel.py +++ b/sa/profiles/Eltex/MES5448/get_portchannel.py @@ -2,14 +2,14 @@ # --------------------------------------------------------------------- # Eltex.MES5448.get_portchannel # --------------------------------------------------------------------- -# Copyright (C) 2007-2017 The NOC Project +# Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # --------------------------------------------------------------------- # NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.igetportchannel import IGetPortchannel -from noc.lib.text import parse_table +from noc.core.text import parse_table class Script(BaseScript): diff --git a/sa/profiles/Eltex/MES5448/get_vlans.py b/sa/profiles/Eltex/MES5448/get_vlans.py index 23b1079200..de8be6442f 100644 --- a/sa/profiles/Eltex/MES5448/get_vlans.py +++ b/sa/profiles/Eltex/MES5448/get_vlans.py @@ -2,14 +2,14 @@ # --------------------------------------------------------------------- # Eltex.MES5448.get_vlans # --------------------------------------------------------------------- -# Copyright (C) 2007-2017 The NOC Project +# Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # --------------------------------------------------------------------- # NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.igetvlans import IGetVlans -from noc.lib.text import parse_table +from noc.core.text import parse_table class Script(BaseScript): diff --git a/sa/profiles/Ericsson/MINI_LINK/get_mac_address_table.py b/sa/profiles/Ericsson/MINI_LINK/get_mac_address_table.py index e6fe93589f..91bdba133f 100644 --- a/sa/profiles/Ericsson/MINI_LINK/get_mac_address_table.py +++ b/sa/profiles/Ericsson/MINI_LINK/get_mac_address_table.py @@ -9,7 +9,7 @@ # NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.igetmacaddresstable import IGetMACAddressTable -from noc.lib.text import parse_table +from noc.core.text import parse_table class Script(BaseScript): diff --git a/sa/profiles/Ericsson/SEOS/get_mac_address_table.py b/sa/profiles/Ericsson/SEOS/get_mac_address_table.py index 5db556f965..eb22304e33 100644 --- a/sa/profiles/Ericsson/SEOS/get_mac_address_table.py +++ b/sa/profiles/Ericsson/SEOS/get_mac_address_table.py @@ -9,7 +9,7 @@ # NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.igetmacaddresstable import IGetMACAddressTable -from noc.lib.text import parse_table +from noc.core.text import parse_table from noc.lib.validators import is_int diff --git a/sa/profiles/Extreme/XOS/get_capabilities.py b/sa/profiles/Extreme/XOS/get_capabilities.py index 054bb98307..483e8e13e4 100644 --- a/sa/profiles/Extreme/XOS/get_capabilities.py +++ b/sa/profiles/Extreme/XOS/get_capabilities.py @@ -2,7 +2,7 @@ # --------------------------------------------------------------------- # Extreme.XOS.get_capabilities # --------------------------------------------------------------------- -# Copyright (C) 2007-2017 The NOC Project +# Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # --------------------------------------------------------------------- @@ -12,7 +12,7 @@ import re # NOC modules from noc.sa.profiles.Generic.get_capabilities import Script as BaseScript from noc.sa.profiles.Generic.get_capabilities import false_on_cli_error -from noc.lib.text import parse_table +from noc.core.text import parse_table class Script(BaseScript): diff --git a/sa/profiles/Extreme/XOS/get_dom_status.py b/sa/profiles/Extreme/XOS/get_dom_status.py index 097d4a2da6..ddd46f3bb3 100644 --- a/sa/profiles/Extreme/XOS/get_dom_status.py +++ b/sa/profiles/Extreme/XOS/get_dom_status.py @@ -12,7 +12,7 @@ import re # NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.igetdomstatus import IGetDOMStatus -from noc.lib.text import parse_kv +from noc.core.text import parse_kv from noc.lib.validators import is_int from noc.core.convert.dbm import mw2dbm diff --git a/sa/profiles/Extreme/XOS/get_inventory.py b/sa/profiles/Extreme/XOS/get_inventory.py index 9a6e7449d3..e9b4751fc7 100644 --- a/sa/profiles/Extreme/XOS/get_inventory.py +++ b/sa/profiles/Extreme/XOS/get_inventory.py @@ -2,10 +2,11 @@ # --------------------------------------------------------------------- # Extreme.XOS.get_inventory # --------------------------------------------------------------------- -# Copyright (C) 2007-2017 The NOC Project +# Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # --------------------------------------------------------------------- +# Python modules import re import datetime from collections import defaultdict @@ -13,7 +14,7 @@ from collections import defaultdict # NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.igetinventory import IGetInventory -from noc.lib.text import parse_kv +from noc.core.text import parse_kv from noc.lib.validators import is_int diff --git a/sa/profiles/Force10/FTOS/get_spanning_tree.py b/sa/profiles/Force10/FTOS/get_spanning_tree.py index 8736523154..4617e254b3 100644 --- a/sa/profiles/Force10/FTOS/get_spanning_tree.py +++ b/sa/profiles/Force10/FTOS/get_spanning_tree.py @@ -12,7 +12,7 @@ import re # NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.igetspanningtree import IGetSpanningTree -from noc.lib.text import parse_table +from noc.core.text import parse_table class Script(BaseScript): diff --git a/sa/profiles/Force10/FTOS/get_vlans.py b/sa/profiles/Force10/FTOS/get_vlans.py index 0e2d5507a3..f1360824f8 100644 --- a/sa/profiles/Force10/FTOS/get_vlans.py +++ b/sa/profiles/Force10/FTOS/get_vlans.py @@ -9,7 +9,7 @@ # NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.igetvlans import IGetVlans -from noc.lib.text import parse_table +from noc.core.text import parse_table class Script(BaseScript): diff --git a/sa/profiles/Force10/SFTOS/get_arp.py b/sa/profiles/Force10/SFTOS/get_arp.py index cc500897f7..a617b79b49 100644 --- a/sa/profiles/Force10/SFTOS/get_arp.py +++ b/sa/profiles/Force10/SFTOS/get_arp.py @@ -2,14 +2,14 @@ # --------------------------------------------------------------------- # Force10.SFTOS.get_arp # --------------------------------------------------------------------- -# Copyright (C) 2007-2013 The NOC Project +# Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # --------------------------------------------------------------------- # NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.igetarp import IGetARP -from noc.lib.text import parse_table +from noc.core.text import parse_table class Script(BaseScript): diff --git a/sa/profiles/Force10/SFTOS/get_vlans.py b/sa/profiles/Force10/SFTOS/get_vlans.py index fc39517994..906b4a2ea2 100644 --- a/sa/profiles/Force10/SFTOS/get_vlans.py +++ b/sa/profiles/Force10/SFTOS/get_vlans.py @@ -2,14 +2,14 @@ # --------------------------------------------------------------------- # Force10.SFTOS.get_vlans # --------------------------------------------------------------------- -# Copyright (C) 2007-2013 The NOC Project +# Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # --------------------------------------------------------------------- # NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.igetvlans import IGetVlans -from noc.lib.text import parse_table +from noc.core.text import parse_table class Script(BaseScript): diff --git a/sa/profiles/HP/1910/set_switchport.py b/sa/profiles/HP/1910/set_switchport.py index 95fbbb6680..2358c4abe1 100644 --- a/sa/profiles/HP/1910/set_switchport.py +++ b/sa/profiles/HP/1910/set_switchport.py @@ -2,14 +2,14 @@ # --------------------------------------------------------------------- # HP.1910.set_switchport # --------------------------------------------------------------------- -# Copyright (C) 2007-2017 The NOC Project +# Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # --------------------------------------------------------------------- # NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.isetswitchport import ISetSwitchport -from noc.lib.text import list_to_ranges +from noc.core.text import list_to_ranges class Script(BaseScript): diff --git a/sa/profiles/HP/GbE2/get_mac_address_table.py b/sa/profiles/HP/GbE2/get_mac_address_table.py index 278e104595..3b11bd38f8 100644 --- a/sa/profiles/HP/GbE2/get_mac_address_table.py +++ b/sa/profiles/HP/GbE2/get_mac_address_table.py @@ -9,7 +9,7 @@ # NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.igetmacaddresstable import IGetMACAddressTable -from noc.lib.text import parse_table +from noc.core.text import parse_table class Script(BaseScript): diff --git a/sa/profiles/HP/ProCurve/get_inventory.py b/sa/profiles/HP/ProCurve/get_inventory.py index 2d7d016cc0..f610996829 100644 --- a/sa/profiles/HP/ProCurve/get_inventory.py +++ b/sa/profiles/HP/ProCurve/get_inventory.py @@ -5,13 +5,14 @@ # Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # ---------------------------------------------------------------------- + # Python modules import re # NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.igetinventory import IGetInventory -from noc.lib.text import parse_table +from noc.core.text import parse_table class Script(BaseScript): diff --git a/sa/profiles/HP/ProCurve/get_spanning_tree.py b/sa/profiles/HP/ProCurve/get_spanning_tree.py index b95dba3c7b..e1633c83ce 100644 --- a/sa/profiles/HP/ProCurve/get_spanning_tree.py +++ b/sa/profiles/HP/ProCurve/get_spanning_tree.py @@ -15,7 +15,7 @@ import six # NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.igetspanningtree import IGetSpanningTree -from noc.lib.text import list_to_ranges +from noc.core.text import list_to_ranges class Script(BaseScript): diff --git a/sa/profiles/HP/ProCurve/get_vlans.py b/sa/profiles/HP/ProCurve/get_vlans.py index f058fbe88d..6f456334da 100644 --- a/sa/profiles/HP/ProCurve/get_vlans.py +++ b/sa/profiles/HP/ProCurve/get_vlans.py @@ -2,15 +2,14 @@ # --------------------------------------------------------------------- # HP.ProCurve.get_vlans # --------------------------------------------------------------------- -# Copyright (C) 2007-2010 The NOC Project +# Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # --------------------------------------------------------------------- -""" -""" + # NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.igetvlans import IGetVlans -from noc.lib.text import parse_table +from noc.core.text import parse_table class Script(BaseScript): diff --git a/sa/profiles/Huawei/MA5600T/get_cpe.py b/sa/profiles/Huawei/MA5600T/get_cpe.py index 394f6b8211..7c073a9554 100644 --- a/sa/profiles/Huawei/MA5600T/get_cpe.py +++ b/sa/profiles/Huawei/MA5600T/get_cpe.py @@ -2,18 +2,19 @@ # --------------------------------------------------------------------- # Huawei.MA5600T.get_cpe # --------------------------------------------------------------------- -# Copyright (C) 2007-2017 The NOC Project +# Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # --------------------------------------------------------------------- +# Python modules import re import six # NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.igetcpe import IGetCPE -from noc.lib.text import parse_table_header -from noc.lib.text import parse_kv +from noc.core.text import parse_table_header +from noc.core.text import parse_kv from noc.core.mib import mib diff --git a/sa/profiles/Huawei/MA5600T/get_cpe_status.py b/sa/profiles/Huawei/MA5600T/get_cpe_status.py index 8913bd337f..edc67d6b7c 100644 --- a/sa/profiles/Huawei/MA5600T/get_cpe_status.py +++ b/sa/profiles/Huawei/MA5600T/get_cpe_status.py @@ -2,17 +2,18 @@ # --------------------------------------------------------------------- # Huawei.MA5600T.get_cpe_status # --------------------------------------------------------------------- -# Copyright (C) 2007-2017 The NOC Project +# Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # --------------------------------------------------------------------- +# Python modules import re import six # NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.igetcpe import IGetCPE -from noc.lib.text import parse_table_header +from noc.core.text import parse_table_header from noc.core.mib import mib diff --git a/sa/profiles/Huawei/MA5600T/get_metrics.py b/sa/profiles/Huawei/MA5600T/get_metrics.py index 606344d452..54384f3397 100644 --- a/sa/profiles/Huawei/MA5600T/get_metrics.py +++ b/sa/profiles/Huawei/MA5600T/get_metrics.py @@ -12,7 +12,7 @@ import six # NOC modules from noc.sa.profiles.Generic.get_metrics import Script as GetMetricsScript, metrics -from noc.lib.text import parse_kv +from noc.core.text import parse_kv from noc.core.mib import mib SNMP_UNKNOWN_VALUE = 2147483647 diff --git a/sa/profiles/Huawei/VRP/get_dom_status.py b/sa/profiles/Huawei/VRP/get_dom_status.py index 9277960489..07fc4b9f76 100644 --- a/sa/profiles/Huawei/VRP/get_dom_status.py +++ b/sa/profiles/Huawei/VRP/get_dom_status.py @@ -2,7 +2,7 @@ # --------------------------------------------------------------------- # Huawei.VRP.get_dom_status # --------------------------------------------------------------------- -# Copyright (C) 2007-2017 The NOC Project +# Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # --------------------------------------------------------------------- @@ -12,7 +12,7 @@ import re # NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.igetdomstatus import IGetDOMStatus -from noc.lib.text import parse_table, parse_kv +from noc.core.text import parse_table, parse_kv class Script(BaseScript): diff --git a/sa/profiles/Huawei/VRP/get_inventory.py b/sa/profiles/Huawei/VRP/get_inventory.py index 4893ed4695..6a82ba2e40 100644 --- a/sa/profiles/Huawei/VRP/get_inventory.py +++ b/sa/profiles/Huawei/VRP/get_inventory.py @@ -2,7 +2,7 @@ # --------------------------------------------------------------------- # Huawei.VRP.get_inventory # --------------------------------------------------------------------- -# Copyright (C) 2007-2018 The NOC Project +# Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # --------------------------------------------------------------------- @@ -15,7 +15,7 @@ from six.moves import zip # NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.igetinventory import IGetInventory -from noc.lib.text import parse_kv +from noc.core.text import parse_kv class Script(BaseScript): diff --git a/sa/profiles/Huawei/VRP/get_lldp_neighbors.py b/sa/profiles/Huawei/VRP/get_lldp_neighbors.py index e01daf562b..0ccffc2345 100644 --- a/sa/profiles/Huawei/VRP/get_lldp_neighbors.py +++ b/sa/profiles/Huawei/VRP/get_lldp_neighbors.py @@ -2,7 +2,7 @@ # --------------------------------------------------------------------- # Huawei.VRP.get_lldp_neighbors # --------------------------------------------------------------------- -# Copyright (C) 2007-2018 The NOC Project +# Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # --------------------------------------------------------------------- @@ -12,7 +12,7 @@ import re # NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.igetlldpneighbors import IGetLLDPNeighbors, MACAddressParameter -from noc.lib.text import parse_kv +from noc.core.text import parse_kv class Script(BaseScript): diff --git a/sa/profiles/Iskratel/ESCOM/get_interfaces.py b/sa/profiles/Iskratel/ESCOM/get_interfaces.py index 95150ab7f6..c7ee7a8c22 100644 --- a/sa/profiles/Iskratel/ESCOM/get_interfaces.py +++ b/sa/profiles/Iskratel/ESCOM/get_interfaces.py @@ -2,18 +2,20 @@ # --------------------------------------------------------------------- # Iskratel.ESCOM.get_interfaces # --------------------------------------------------------------------- -# Copyright (C) 2007-2018 The NOC Project +# Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # --------------------------------------------------------------------- # Python modules import re + +# Third-party modules import six # NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.igetinterfaces import IGetInterfaces -from noc.lib.text import parse_table +from noc.core.text import parse_table class Script(BaseScript): diff --git a/sa/profiles/Iskratel/ESCOM/get_lldp_neighbors.py b/sa/profiles/Iskratel/ESCOM/get_lldp_neighbors.py index c0793e096c..dfcc025018 100644 --- a/sa/profiles/Iskratel/ESCOM/get_lldp_neighbors.py +++ b/sa/profiles/Iskratel/ESCOM/get_lldp_neighbors.py @@ -13,7 +13,7 @@ import re from noc.core.script.base import BaseScript from noc.sa.interfaces.igetlldpneighbors import IGetLLDPNeighbors from noc.lib.validators import is_ipv4, is_ipv6, is_mac -from noc.lib.text import parse_table +from noc.core.text import parse_table class Script(BaseScript): diff --git a/sa/profiles/Iskratel/MSAN/get_lldp_neighbors.py b/sa/profiles/Iskratel/MSAN/get_lldp_neighbors.py index 60ae91c855..e32a4f5f92 100644 --- a/sa/profiles/Iskratel/MSAN/get_lldp_neighbors.py +++ b/sa/profiles/Iskratel/MSAN/get_lldp_neighbors.py @@ -2,7 +2,7 @@ # --------------------------------------------------------------------- # Iskratel.MSAN.get_lldp_neighbors # --------------------------------------------------------------------- -# Copyright (C) 2007-2018 The NOC Project +# Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # --------------------------------------------------------------------- @@ -12,7 +12,7 @@ import re # NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.igetlldpneighbors import IGetLLDPNeighbors -from noc.lib.text import parse_table +from noc.core.text import parse_table class Script(BaseScript): diff --git a/sa/profiles/Juniper/JUNOS/get_bfd_sessions.py b/sa/profiles/Juniper/JUNOS/get_bfd_sessions.py index 158add2764..f012d6f37b 100644 --- a/sa/profiles/Juniper/JUNOS/get_bfd_sessions.py +++ b/sa/profiles/Juniper/JUNOS/get_bfd_sessions.py @@ -2,7 +2,7 @@ # --------------------------------------------------------------------- # Juniper.JUNOS.get_bfd_sessions # --------------------------------------------------------------------- -# Copyright (C) 2007-2013 The NOC Project +# Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # --------------------------------------------------------------------- @@ -12,7 +12,7 @@ import re # NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.igetbfdsessions import IGetBFDSessions -from noc.lib.text import find_indented +from noc.core.text import find_indented class Script(BaseScript): diff --git a/sa/profiles/Juniper/JUNOSe/get_metrics.py b/sa/profiles/Juniper/JUNOSe/get_metrics.py index a793b37955..37e5312918 100644 --- a/sa/profiles/Juniper/JUNOSe/get_metrics.py +++ b/sa/profiles/Juniper/JUNOSe/get_metrics.py @@ -2,18 +2,20 @@ # --------------------------------------------------------------------- # Juniper.JUNOSe.get_metrics # --------------------------------------------------------------------- -# Copyright (C) 2007-2016 The NOC Project +# Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # --------------------------------------------------------------------- # Python modules from __future__ import absolute_import + +# Third-party modules import six # NOC modules from noc.sa.profiles.Generic.get_metrics import Script as GetMetricsScript, metrics from .oidrules.slot import SlotRule -from noc.lib.text import parse_table +from noc.core.text import parse_table class Script(GetMetricsScript): diff --git a/sa/profiles/Linksys/VoIP/get_chassis_id.py b/sa/profiles/Linksys/VoIP/get_chassis_id.py index 374fd9e851..d229707301 100644 --- a/sa/profiles/Linksys/VoIP/get_chassis_id.py +++ b/sa/profiles/Linksys/VoIP/get_chassis_id.py @@ -2,7 +2,7 @@ # --------------------------------------------------------------------- # Linksys.VoIP.get_chassis_id # --------------------------------------------------------------------- -# Copyright (C) 2007-2012 The NOC Project +# Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # --------------------------------------------------------------------- @@ -12,7 +12,7 @@ import re # NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.igetchassisid import IGetChassisID -from noc.lib.text import strip_html_tags +from noc.core.text import strip_html_tags class Script(BaseScript): diff --git a/sa/profiles/Linksys/VoIP/get_config.py b/sa/profiles/Linksys/VoIP/get_config.py index 8abaf37136..4736a060bb 100644 --- a/sa/profiles/Linksys/VoIP/get_config.py +++ b/sa/profiles/Linksys/VoIP/get_config.py @@ -2,7 +2,7 @@ # --------------------------------------------------------------------- # Linksys.VoIP.get_config # --------------------------------------------------------------------- -# Copyright (C) 2007-2012 The NOC Project +# Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # --------------------------------------------------------------------- @@ -12,7 +12,7 @@ import re # NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.igetconfig import IGetConfig -from noc.lib.text import strip_html_tags +from noc.core.text import strip_html_tags class Script(BaseScript): diff --git a/sa/profiles/Linksys/VoIP/get_version.py b/sa/profiles/Linksys/VoIP/get_version.py index 34cd75aa3c..dbf1e200c3 100644 --- a/sa/profiles/Linksys/VoIP/get_version.py +++ b/sa/profiles/Linksys/VoIP/get_version.py @@ -2,7 +2,7 @@ # --------------------------------------------------------------------- # Linksys.VoIP.get_version # --------------------------------------------------------------------- -# Copyright (C) 2007-2012 The NOC Project +# Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # --------------------------------------------------------------------- @@ -12,7 +12,7 @@ import re # NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.igetversion import IGetVersion -from noc.lib.text import strip_html_tags +from noc.core.text import strip_html_tags class Script(BaseScript): diff --git a/sa/profiles/Nateks/FlexGainACE16/get_version.py b/sa/profiles/Nateks/FlexGainACE16/get_version.py index 7834581a55..c61d54d999 100644 --- a/sa/profiles/Nateks/FlexGainACE16/get_version.py +++ b/sa/profiles/Nateks/FlexGainACE16/get_version.py @@ -9,7 +9,7 @@ # NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.igetversion import IGetVersion -from noc.lib.text import parse_kv +from noc.core.text import parse_kv class Script(BaseScript): diff --git a/sa/profiles/Planet/WGSD/get_capabilities.py b/sa/profiles/Planet/WGSD/get_capabilities.py index 4babf0840b..517efb82a8 100644 --- a/sa/profiles/Planet/WGSD/get_capabilities.py +++ b/sa/profiles/Planet/WGSD/get_capabilities.py @@ -10,7 +10,7 @@ import re # NOC modules -from noc.lib.text import parse_table +from noc.core.text import parse_table from noc.sa.profiles.Generic.get_capabilities import Script as BaseScript from noc.sa.profiles.Generic.get_capabilities import false_on_cli_error diff --git a/sa/profiles/Planet/WGSD/get_interfaces.py b/sa/profiles/Planet/WGSD/get_interfaces.py index 6f530b6778..9ba56e2d43 100644 --- a/sa/profiles/Planet/WGSD/get_interfaces.py +++ b/sa/profiles/Planet/WGSD/get_interfaces.py @@ -2,7 +2,7 @@ # --------------------------------------------------------------------- # Planet.WGSD.get_interfaces # --------------------------------------------------------------------- -# Copyright (C) 2007-2018 The NOC Project +# Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # --------------------------------------------------------------------- @@ -10,7 +10,7 @@ import re # NOC modules -from noc.lib.text import parse_table +from noc.core.text import parse_table from noc.core.script.base import BaseScript from noc.sa.interfaces.igetinterfaces import IGetInterfaces from noc.sa.interfaces.base import MACAddressParameter diff --git a/sa/profiles/Planet/WGSD/get_spanning_tree.py b/sa/profiles/Planet/WGSD/get_spanning_tree.py index 9ec501472f..3ea46b0ef2 100644 --- a/sa/profiles/Planet/WGSD/get_spanning_tree.py +++ b/sa/profiles/Planet/WGSD/get_spanning_tree.py @@ -2,7 +2,7 @@ # --------------------------------------------------------------------- # Planet.WGSD.get_spanning_tree # --------------------------------------------------------------------- -# Copyright (C) 2007-2015 The NOC Project +# Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # --------------------------------------------------------------------- @@ -12,7 +12,7 @@ import re # NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.igetspanningtree import IGetSpanningTree -from noc.lib.text import parse_table +from noc.core.text import parse_table class Script(BaseScript): diff --git a/sa/profiles/Qtech/QOS/get_interfaces.py b/sa/profiles/Qtech/QOS/get_interfaces.py index 1ccf13b06e..5ee3f44431 100644 --- a/sa/profiles/Qtech/QOS/get_interfaces.py +++ b/sa/profiles/Qtech/QOS/get_interfaces.py @@ -2,7 +2,7 @@ # --------------------------------------------------------------------- # Qtech.QOS.get_interfaces # --------------------------------------------------------------------- -# Copyright (C) 2007-2017 The NOC Project +# Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # --------------------------------------------------------------------- @@ -12,7 +12,7 @@ import re # NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.igetinterfaces import IGetInterfaces -from noc.lib.text import ranges_to_list +from noc.core.text import ranges_to_list from noc.core.ip import IPv4 diff --git a/sa/profiles/Qtech/QSW2500/get_interfaces.py b/sa/profiles/Qtech/QSW2500/get_interfaces.py index 7101c2ff35..1b1c4fe5d3 100644 --- a/sa/profiles/Qtech/QSW2500/get_interfaces.py +++ b/sa/profiles/Qtech/QSW2500/get_interfaces.py @@ -12,7 +12,7 @@ import re # NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.igetinterfaces import IGetInterfaces -from noc.lib.text import ranges_to_list +from noc.core.text import ranges_to_list from noc.core.ip import IPv4 diff --git a/sa/profiles/Qtech/QSW2800/confdb/normalizer.py b/sa/profiles/Qtech/QSW2800/confdb/normalizer.py index 545ab7f022..f976780afb 100644 --- a/sa/profiles/Qtech/QSW2800/confdb/normalizer.py +++ b/sa/profiles/Qtech/QSW2800/confdb/normalizer.py @@ -8,7 +8,7 @@ # NOC modules from noc.core.confdb.normalizer.base import BaseNormalizer, match, ANY, REST -from noc.lib.text import ranges_to_list +from noc.core.text import ranges_to_list class Qtech2800Normalizer(BaseNormalizer): diff --git a/sa/profiles/Raisecom/ROS/get_interfaces.py b/sa/profiles/Raisecom/ROS/get_interfaces.py index a457a94fa5..5388441ed8 100644 --- a/sa/profiles/Raisecom/ROS/get_interfaces.py +++ b/sa/profiles/Raisecom/ROS/get_interfaces.py @@ -16,7 +16,7 @@ import six # NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.igetinterfaces import IGetInterfaces -from noc.lib.text import ranges_to_list +from noc.core.text import ranges_to_list from noc.core.ip import IPv4 diff --git a/sa/profiles/SKS/SKS/get_interfaces.py b/sa/profiles/SKS/SKS/get_interfaces.py index a9178b0b05..0a7c45ba41 100644 --- a/sa/profiles/SKS/SKS/get_interfaces.py +++ b/sa/profiles/SKS/SKS/get_interfaces.py @@ -6,14 +6,13 @@ # See LICENSE for details # --------------------------------------------------------------------- - # Python modules import re # NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.igetinterfaces import IGetInterfaces -from noc.lib.text import parse_table +from noc.core.text import parse_table class Script(BaseScript): diff --git a/sa/profiles/SKS/SKS/get_inventory.py b/sa/profiles/SKS/SKS/get_inventory.py index 193478b17b..ceabc378f3 100644 --- a/sa/profiles/SKS/SKS/get_inventory.py +++ b/sa/profiles/SKS/SKS/get_inventory.py @@ -9,7 +9,7 @@ # NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.igetinventory import IGetInventory -from noc.lib.text import parse_table +from noc.core.text import parse_table class Script(BaseScript): diff --git a/sa/profiles/SKS/SKS/get_lldp_neighbors.py b/sa/profiles/SKS/SKS/get_lldp_neighbors.py index a2ec9587a6..8cd4e1475a 100644 --- a/sa/profiles/SKS/SKS/get_lldp_neighbors.py +++ b/sa/profiles/SKS/SKS/get_lldp_neighbors.py @@ -6,7 +6,6 @@ # See LICENSE for details # --------------------------------------------------------------------- - # Python modules import re @@ -14,7 +13,7 @@ import re from noc.core.script.base import BaseScript from noc.sa.interfaces.igetlldpneighbors import IGetLLDPNeighbors from noc.lib.validators import is_ipv4, is_ipv6, is_mac -from noc.lib.text import parse_table +from noc.core.text import parse_table class Script(BaseScript): diff --git a/sa/profiles/SKS/SKS/get_version.py b/sa/profiles/SKS/SKS/get_version.py index ad79e49b80..acf9bfdfcf 100644 --- a/sa/profiles/SKS/SKS/get_version.py +++ b/sa/profiles/SKS/SKS/get_version.py @@ -12,7 +12,7 @@ import re # NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.igetversion import IGetVersion -from noc.lib.text import parse_table +from noc.core.text import parse_table class Script(BaseScript): diff --git a/sa/profiles/SKS/SKS/get_vlans.py b/sa/profiles/SKS/SKS/get_vlans.py index 08c1526d28..84b1b1d97e 100644 --- a/sa/profiles/SKS/SKS/get_vlans.py +++ b/sa/profiles/SKS/SKS/get_vlans.py @@ -2,15 +2,17 @@ # --------------------------------------------------------------------- # SKS.SKS.get_vlans # --------------------------------------------------------------------- -# Copyright (C) 2007-2016 The NOC Project +# Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # --------------------------------------------------------------------- -""" -""" + +# Python modules import re + +# NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.igetvlans import IGetVlans -from noc.lib.text import parse_table +from noc.core.text import parse_table class Script(BaseScript): diff --git a/sa/profiles/Supertel/K2X/set_switchport.py b/sa/profiles/Supertel/K2X/set_switchport.py index a0d204c116..8fb2c8a701 100644 --- a/sa/profiles/Supertel/K2X/set_switchport.py +++ b/sa/profiles/Supertel/K2X/set_switchport.py @@ -2,14 +2,14 @@ # --------------------------------------------------------------------- # Supertel.K2X.set_switchport # --------------------------------------------------------------------- -# Copyright (C) 2007-2017 The NOC Project +# Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # --------------------------------------------------------------------- # NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.isetswitchport import ISetSwitchport -from noc.lib.text import list_to_ranges +from noc.core.text import list_to_ranges class Script(BaseScript): diff --git a/sa/profiles/TFortis/PSW/get_version.py b/sa/profiles/TFortis/PSW/get_version.py index 14095ad9e4..3f9285fae9 100644 --- a/sa/profiles/TFortis/PSW/get_version.py +++ b/sa/profiles/TFortis/PSW/get_version.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # --------------------------------------------------------------------- -# Copyright (C) 2007-2016 The NOC Project +# Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # --------------------------------------------------------------------- @@ -10,7 +10,7 @@ import re # NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.igetversion import IGetVersion -from noc.lib.text import strip_html_tags +from noc.core.text import strip_html_tags class Script(BaseScript): diff --git a/sa/profiles/Upvel/UP/get_interfaces.py b/sa/profiles/Upvel/UP/get_interfaces.py index dfdd2ec48b..6c3598213d 100644 --- a/sa/profiles/Upvel/UP/get_interfaces.py +++ b/sa/profiles/Upvel/UP/get_interfaces.py @@ -2,15 +2,17 @@ # --------------------------------------------------------------------- # Upvel.UP.get_interfaces # --------------------------------------------------------------------- -# Copyright (C) 2007-2018 The NOC Project +# Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # --------------------------------------------------------------------- +# Python modules +import re +# NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.igetinterfaces import IGetInterfaces -from noc.lib.text import parse_table -import re +from noc.core.text import parse_table class Script(BaseScript): diff --git a/sa/profiles/Vitesse/VSC/get_interfaces.py b/sa/profiles/Vitesse/VSC/get_interfaces.py index 807fc1098c..3fbdb6844a 100644 --- a/sa/profiles/Vitesse/VSC/get_interfaces.py +++ b/sa/profiles/Vitesse/VSC/get_interfaces.py @@ -2,15 +2,17 @@ # --------------------------------------------------------------------- # Vitesse.VSC.get_interfaces # --------------------------------------------------------------------- -# Copyright (C) 2007-2018 The NOC Project +# Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # --------------------------------------------------------------------- +# Python modules +import re +# NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.igetinterfaces import IGetInterfaces -from noc.lib.text import parse_table -import re +from noc.core.text import parse_table class Script(BaseScript): diff --git a/sa/profiles/ZTE/ZXDSL531/get_dot11_associations.py b/sa/profiles/ZTE/ZXDSL531/get_dot11_associations.py index 4a0a8b924a..f70beb38a1 100644 --- a/sa/profiles/ZTE/ZXDSL531/get_dot11_associations.py +++ b/sa/profiles/ZTE/ZXDSL531/get_dot11_associations.py @@ -1,14 +1,18 @@ # -*- coding: utf-8 -*- # --------------------------------------------------------------------- -# Copyright (C) 2007-2009 The NOC Project +# ZTE.ZXDSL531.get_dot11_associations +# --------------------------------------------------------------------- +# Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # --------------------------------------------------------------------- -""" -""" + +# Python modules +import re + +# NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.igetdot11associations import IGetDot11Associations -from noc.lib.text import strip_html_tags -import re +from noc.core.text import strip_html_tags rx_mac = re.compile( "(?P[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2})" diff --git a/sa/profiles/ZTE/ZXDSL531/get_version.py b/sa/profiles/ZTE/ZXDSL531/get_version.py index dda99aecc3..bff38a5a0c 100644 --- a/sa/profiles/ZTE/ZXDSL531/get_version.py +++ b/sa/profiles/ZTE/ZXDSL531/get_version.py @@ -1,14 +1,18 @@ # -*- coding: utf-8 -*- # --------------------------------------------------------------------- -# Copyright (C) 2007-2009 The NOC Project +# ZTE.ZXDSL531.get_version +# --------------------------------------------------------------------- +# Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # --------------------------------------------------------------------- -""" -""" + +# Python modules +import re + +# NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.igetversion import IGetVersion -from noc.lib.text import strip_html_tags -import re +from noc.core.text import strip_html_tags rx_html_ver = re.compile(r"Firmware Version\s+\S+\s+(?P\S+)") diff --git a/sa/profiles/Zhone/Bitstorm/get_version.py b/sa/profiles/Zhone/Bitstorm/get_version.py index e17cc8bd5a..dc2055fd89 100644 --- a/sa/profiles/Zhone/Bitstorm/get_version.py +++ b/sa/profiles/Zhone/Bitstorm/get_version.py @@ -2,7 +2,7 @@ # --------------------------------------------------------------------- # Zhone.Bitstorm.get_version # --------------------------------------------------------------------- -# Copyright (C) 2007-2017 The NOC Project +# Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # --------------------------------------------------------------------- @@ -10,7 +10,7 @@ import re # NOC modules -from noc.lib.text import parse_table +from noc.core.text import parse_table from noc.core.script.base import BaseScript from noc.sa.interfaces.igetversion import IGetVersion diff --git a/sa/profiles/Zyxel/MSAN/get_inventory.py b/sa/profiles/Zyxel/MSAN/get_inventory.py index 07fbba7268..c3cd81152a 100644 --- a/sa/profiles/Zyxel/MSAN/get_inventory.py +++ b/sa/profiles/Zyxel/MSAN/get_inventory.py @@ -2,7 +2,7 @@ # --------------------------------------------------------------------- # Zyxel.MSAN.get_inventory # --------------------------------------------------------------------- -# Copyright (C) 2007-2018 The NOC Project +# Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # --------------------------------------------------------------------- @@ -12,7 +12,7 @@ import re # NOC modules from noc.core.script.base import BaseScript from noc.sa.interfaces.igetinventory import IGetInventory -from noc.lib.text import parse_table +from noc.core.text import parse_table class Script(BaseScript): diff --git a/services/card/cards/managedobject.py b/services/card/cards/managedobject.py index 1bcc9b369c..354f7fc4d7 100644 --- a/services/card/cards/managedobject.py +++ b/services/card/cards/managedobject.py @@ -31,7 +31,7 @@ from noc.inv.models.link import Link from noc.sa.models.service import Service from noc.inv.models.firmwarepolicy import FirmwarePolicy from noc.sa.models.servicesummary import ServiceSummary -from noc.lib.text import split_alnum, list_to_ranges +from noc.core.text import split_alnum, list_to_ranges from noc.maintenance.models.maintenance import Maintenance from noc.sa.models.useraccess import UserAccess from noc.core.pm.utils import get_interface_metrics, get_objects_metrics diff --git a/services/datasource/datasources/base.py b/services/datasource/datasources/base.py index acb44e7d64..45db525d7c 100644 --- a/services/datasource/datasources/base.py +++ b/services/datasource/datasources/base.py @@ -13,7 +13,7 @@ import six from noc.main.models.datasourcecache import DataSourceCache from noc.core.perf import metrics from noc.config import config -from noc.lib.text import ch_escape +from noc.core.text import ch_escape class BaseDataSource(object): diff --git a/services/datastream/streams/managedobject.py b/services/datastream/streams/managedobject.py index 2e9ce855d0..4d23976cd6 100644 --- a/services/datastream/streams/managedobject.py +++ b/services/datastream/streams/managedobject.py @@ -2,7 +2,7 @@ # ---------------------------------------------------------------------- # managedobject datastream # ---------------------------------------------------------------------- -# Copyright (C) 2007-2018 The NOC Project +# Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # ---------------------------------------------------------------------- @@ -19,7 +19,7 @@ from noc.inv.models.interface import Interface from noc.inv.models.subinterface import SubInterface from noc.inv.models.link import Link from noc.inv.models.discoveryid import DiscoveryID -from noc.lib.text import split_alnum +from noc.core.text import split_alnum def qs(s): diff --git a/services/discovery/jobs/box/asset.py b/services/discovery/jobs/box/asset.py index bcf2ab1c3a..e5e2b92725 100644 --- a/services/discovery/jobs/box/asset.py +++ b/services/discovery/jobs/box/asset.py @@ -2,7 +2,7 @@ # --------------------------------------------------------------------- # Asset check # --------------------------------------------------------------------- -# Copyright (C) 2007-2017 The NOC Project +# Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # --------------------------------------------------------------------- @@ -22,7 +22,7 @@ from noc.inv.models.vendor import Vendor from noc.inv.models.unknownmodel import UnknownModel from noc.inv.models.modelmapping import ModelMapping from noc.inv.models.error import ConnectionError -from noc.lib.text import str_dict +from noc.core.text import str_dict class AssetCheck(DiscoveryCheck): diff --git a/services/discovery/jobs/box/interface.py b/services/discovery/jobs/box/interface.py index 9ce2ed334a..64462ba599 100644 --- a/services/discovery/jobs/box/interface.py +++ b/services/discovery/jobs/box/interface.py @@ -13,7 +13,7 @@ from collections import defaultdict import six # NOC modules -from noc.lib.text import ranges_to_list +from noc.core.text import ranges_to_list from noc.services.discovery.jobs.base import PolicyDiscoveryCheck from noc.core.vpn import get_vpn_id from noc.core.service.rpc import RPCError diff --git a/services/discovery/jobs/box/suggestcli.py b/services/discovery/jobs/box/suggestcli.py index a5f5fd95b0..043ff5a6c5 100644 --- a/services/discovery/jobs/box/suggestcli.py +++ b/services/discovery/jobs/box/suggestcli.py @@ -11,7 +11,7 @@ from noc.services.discovery.jobs.base import DiscoveryCheck from noc.core.service.client import open_sync_rpc from noc.core.service.error import RPCError from noc.core.script.scheme import SSH -from noc.lib.text import safe_shadow +from noc.core.text import safe_shadow class SuggestCLICheck(DiscoveryCheck): diff --git a/services/syslogcollector/service.py b/services/syslogcollector/service.py index f10976feb1..fd9f5e5cb7 100755 --- a/services/syslogcollector/service.py +++ b/services/syslogcollector/service.py @@ -23,7 +23,7 @@ from noc.core.service.base import Service from noc.core.perf import metrics from noc.services.syslogcollector.syslogserver import SyslogServer from noc.services.syslogcollector.datastream import SysologDataStreamClient -from noc.lib.text import ch_escape +from noc.core.text import ch_escape SourceConfig = namedtuple( "SourceConfig", ["id", "addresses", "bi_id", "process_events", "archive_events"] diff --git a/services/web/apps/fm/reportlocalrules/views.py b/services/web/apps/fm/reportlocalrules/views.py index 01bb22bbe2..1035e9307c 100644 --- a/services/web/apps/fm/reportlocalrules/views.py +++ b/services/web/apps/fm/reportlocalrules/views.py @@ -12,7 +12,7 @@ from django.utils.html import escape # NOC modules from noc.lib.app.reportapplication import ReportApplication from noc.fm.models.eventclassificationrule import EventClassificationRule -from noc.lib.text import indent +from noc.core.text import indent from noc.core.translation import ugettext as _ from noc.core.collection.base import Collection diff --git a/services/web/apps/inv/interface/views.py b/services/web/apps/inv/interface/views.py index 61fa0b3938..2a1fef8278 100644 --- a/services/web/apps/inv/interface/views.py +++ b/services/web/apps/inv/interface/views.py @@ -24,7 +24,7 @@ from noc.sa.interfaces.base import ( from noc.main.models.resourcestate import ResourceState from noc.project.models.project import Project from noc.vc.models.vcdomain import VCDomain -from noc.lib.text import split_alnum +from noc.core.text import split_alnum from noc.core.translation import ugettext as _ from noc.config import config diff --git a/services/web/apps/inv/map/views.py b/services/web/apps/inv/map/views.py index 0549f3519e..cc44dc6e74 100644 --- a/services/web/apps/inv/map/views.py +++ b/services/web/apps/inv/map/views.py @@ -27,7 +27,7 @@ from noc.fm.models.activealarm import ActiveAlarm from noc.core.topology.segment import SegmentTopology from noc.inv.models.discoveryid import DiscoveryID from noc.maintenance.models.maintenance import Maintenance -from noc.lib.text import split_alnum +from noc.core.text import split_alnum from noc.core.pm.utils import get_interface_metrics from noc.sa.interfaces.base import ( ListOfParameter, diff --git a/services/web/apps/inv/reportifacestatus/views.py b/services/web/apps/inv/reportifacestatus/views.py index 3a2304993b..ce6dd30b9c 100644 --- a/services/web/apps/inv/reportifacestatus/views.py +++ b/services/web/apps/inv/reportifacestatus/views.py @@ -28,7 +28,7 @@ from noc.sa.models.administrativedomain import AdministrativeDomain from noc.sa.models.useraccess import UserAccess from noc.core.translation import ugettext as _ from noc.sa.interfaces.base import StringParameter -from noc.lib.text import list_to_ranges +from noc.core.text import list_to_ranges logger = logging.getLogger(__name__) diff --git a/services/web/apps/pm/ddash/dashboards/mo.py b/services/web/apps/pm/ddash/dashboards/mo.py index 9fdd24d31b..23492fb719 100644 --- a/services/web/apps/pm/ddash/dashboards/mo.py +++ b/services/web/apps/pm/ddash/dashboards/mo.py @@ -19,7 +19,7 @@ from .base import BaseDashboard from noc.config import config from noc.inv.models.interface import Interface from noc.inv.models.subinterface import SubInterface -from noc.lib.text import split_alnum +from noc.core.text import split_alnum from noc.pm.models.metrictype import MetricType from noc.sa.models.managedobject import ManagedObject diff --git a/services/web/apps/sa/managedobject/views.py b/services/web/apps/sa/managedobject/views.py index f29ccd3e56..3184fdb17e 100644 --- a/services/web/apps/sa/managedobject/views.py +++ b/services/web/apps/sa/managedobject/views.py @@ -12,8 +12,6 @@ import zlib # Third-party modules from django.http import HttpResponse - -# Third-party modules import ujson from mongoengine.queryset import Q as MQ @@ -39,7 +37,7 @@ from noc.main.models.resourcestate import ResourceState from noc.project.models.project import Project from noc.vc.models.vcdomain import VCDomain from noc.sa.models.objectcapabilities import ObjectCapabilities -from noc.lib.text import split_alnum +from noc.core.text import split_alnum from noc.sa.interfaces.base import ( ListOfParameter, ModelParameter, diff --git a/tests/test_text.py b/tests/test_text.py index a5afe3b29e..6ea154785c 100644 --- a/tests/test_text.py +++ b/tests/test_text.py @@ -2,15 +2,30 @@ # ---------------------------------------------------------------------- # noc.lib.text tests # ---------------------------------------------------------------------- -# Copyright (C) 2007-2018 The NOC Project +# Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # ---------------------------------------------------------------------- -# Thirt-party modules +# Third-party modules import pytest # NOC modules -from noc.lib.text import parse_table +from noc.core.text import ( + parse_table, + strip_html_tags, + xml_to_table, + list_to_ranges, + ranges_to_list, + replace_re_group, + indent, + split_alnum, + find_indented, + to_seconds, + format_table, + clean_number, + safe_shadow, + ch_escape, +) @pytest.mark.parametrize( @@ -248,3 +263,166 @@ te1/0/3 (1RY\t# GigabitEthernet1/ MBH_75_00020_1 B, R 1 ) def test_parse_table(value, kwargs, expected): assert parse_table(value, **kwargs) == expected + + +@pytest.mark.parametrize("expected", ["Title Body Text"]) +def test_strip_html_tags(expected): + html = """ + + + Title + + +

Body

+

Text

+ + + """ + out = strip_html_tags(html) + out = out.strip() + out = out.replace("\n", "") + assert out == expected + + +@pytest.mark.parametrize( + "config, expected", + [ + ( + [ + '1234' # noqa + ], + [{"a": "1", "b": "2"}, {"a": "3", "b": "4"}], + ) + ], +) +def test_xml_to_table(config, expected): + assert xml_to_table(str(config), "action", "row") == expected + + +@pytest.mark.parametrize( + "config, expected", + [ + ([], ""), + ([1], "1"), + ([1, 2], "1-2"), + ([1, 2, 3], "1-3"), + ([1, 2, 3, 5], "1-3,5"), + ([1, 2, 3, 5, 6, 7], "1-3,5-7"), + (range(1, 4001), "1-4000"), + ], +) +def test_list_to_ranges(config, expected): + assert list_to_ranges(config) == expected + + +@pytest.mark.parametrize( + "config, expected", + [ + ("1", [1]), + ("1, 2", [1, 2]), + ("1, 10-12", [1, 10, 11, 12]), + ("1, 10-12, 15, 17-19", [1, 10, 11, 12, 15, 17, 18, 19]), + ], +) +def test_ranges_to_list(config, expected): + assert ranges_to_list(config) == expected + + +@pytest.mark.parametrize( + "config, expected", + [ + ("nothing", "nothing"), + ("the (?Psimple) test", "the groupvalue test"), + ("the (?P nested (test)>)", "the groupvalue"), + ], +) +def test_replace_re_group(config, expected): + assert replace_re_group(config, "(?P", "groupvalue") == expected + + +@pytest.mark.parametrize( + "config, expected", + [ + ("", ""), + ( + "the quick brown fox\\njumped over an lazy dog\\nend", + " the quick brown fox\\njumped over an lazy dog\\nend", + ), + ], +) +def test_indent(config, expected): + assert indent(config, n=1) == expected + + +@pytest.mark.parametrize( + "config, expected", + [ + ("Fa 0/1", ["Fa ", 0, "/", 1]), + ("Fa 0/1.15", ["Fa ", 0, "/", 1, ".", 15]), + ("ge-1/0/1", ["ge-", 1, "/", 0, "/", 1]), + ("ge-1/0/1.15", ["ge-", 1, "/", 0, "/", 1, ".", 15]), + ], +) +def test_split_alnum(config, expected): + assert split_alnum(config) == expected + + +@pytest.mark.parametrize( + "config, expected", + [ + ( + "section0\nsection 1\n line 1-1\n line 1-2\n\n section 2\n line 2-1\n line 2-2", + ["section 1\n line 1-1\n line 1-2\n section 2\n line 2-1\n line 2-2"], + ) + ], +) +def test_find_indented(config, expected): + assert find_indented(config) == expected + + +@pytest.mark.parametrize( + "config, expected", + [("1h", 3600), ("1d", 86400), ("1w", 604800), ("1m", 2592000), ("1y", 31536000)], +) +def test_to_seconds(config, expected): + assert to_seconds(config) == expected + + +@pytest.mark.parametrize( + "config, expected", + [ + ( + [["H1", "H2", "H3"], ["s1", "s2", "s3"], ["s1.1", "s2.1", "s3.1"]], + "H1 H2 H3 \n---- ---- ----\ns1 s2 s3 \ns1.1 s2.1 s3.1", + ) + ], +) +def test_format_table(config, expected): + assert format_table([0, 0, 0, 0, 0], config) == expected + + +@pytest.mark.parametrize( + "config, expected", + [("12w34r5t6y7", "1234567"), (" 223ssSSSf*3", "2233"), ("(032HDWeg sda^@3f ", "0323")], +) +def test_clean_number(config, expected): + assert clean_number(config) == expected + + +@pytest.mark.parametrize( + "config, expected", + [(None, "None"), ("s", "******"), ("sssssss", "s******s"), ("1", "******"), ([1, 2], "******")], +) +def test_safe_shadow(config, expected): + assert safe_shadow(config) == expected + + +@pytest.mark.parametrize( + "config, expected", + [ + ("aaaa\nbbbb\nssssss\n", "aaaa\\\\nbbbb\\\\nssssss\\\\n"), + ("aaaa\nbbbb\nsss sss\n", "aaaa\\\\nbbbb\\\\nsss sss\\\\n"), + ], +) +def test_ch_escape(config, expected): + assert ch_escape(config) == expected -- GitLab From 8dfe8a7178e5a5f8db7f3861067a38be8b2d175b Mon Sep 17 00:00:00 2001 From: kk Date: Tue, 10 Sep 2019 21:12:30 +0300 Subject: [PATCH 2/4] move lib/text to core/text. revert core/snmp/ber.py --- core/snmp/ber.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/core/snmp/ber.py b/core/snmp/ber.py index 90eb7faea1..13099ff28c 100644 --- a/core/snmp/ber.py +++ b/core/snmp/ber.py @@ -9,9 +9,7 @@ # Python modules import math import struct -## Third-party modules -import pyximport -pyximport.install() + # NOC modules from noc.speedup.ber import parse_tlv_header, parse_p_oid, encode_int -- GitLab From f0c2a0ad50b5dd028578b12eb891de9db32c3d37 Mon Sep 17 00:00:00 2001 From: kk Date: Tue, 10 Sep 2019 21:28:25 +0300 Subject: [PATCH 3/4] move lib/text to core/text. black --- commands/dnszone.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commands/dnszone.py b/commands/dnszone.py index c640de6f59..35e363246d 100644 --- a/commands/dnszone.py +++ b/commands/dnszone.py @@ -249,7 +249,7 @@ class Command(BaseCommand): start = 0 for match in cls.rx_q.finditer(s): if start < match.start(): - yield s[start: match.start()] + yield s[start : match.start()] yield match.group(0) start = match.end() if start < len(s) - 1: -- GitLab From 7d498963e91dd1dcf6cba6ac855a0264d69f59b1 Mon Sep 17 00:00:00 2001 From: Dmitry Volodin Date: Wed, 11 Sep 2019 10:25:23 +0300 Subject: [PATCH 4/4] Place deprecation warnings --- lib/text.py | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 lib/text.py diff --git a/lib/text.py b/lib/text.py new file mode 100644 index 0000000000..774cc98c67 --- /dev/null +++ b/lib/text.py @@ -0,0 +1,42 @@ +# -*- coding: utf-8 -*- +# ---------------------------------------------------------------------- +# noc.core.text legacy wrappers +# flake8: noqa +# ---------------------------------------------------------------------- +# Copyright (C) 2007-2019 The NOC Project +# See LICENSE for details +# ---------------------------------------------------------------------- + +# Python modules +import warnings + +# NOC modules +from noc.core.text import ( + parse_table, + strip_html_tags, + xml_to_table, + list_to_ranges, + ranges_to_list, + replace_re_group, + indent, + split_alnum, + find_indented, + parse_kv, + str_dict, + quote_safe_path, + to_seconds, + format_table, + clean_number, + safe_shadow, + ch_escape, + tsv_escape, + parse_table_header, +) +from noc.core.deprecations import RemovedInNOC1905Warning + +warnings.warn( + "noc.lib.text is deprecated and will be removed in NOC 19.5. " + "Please replace imports to noc.core.text", + RemovedInNOC1905Warning, + stacklevel=2, +) -- GitLab