Giter Site home page Giter Site logo

napalm-h3c-cw7-ssh's Issues

driver.get_interfaces() only one interface

H3C S6520 SW

"display interface" result like this:

"""
<S6520_IRF>display interface
Bridge-Aggregation35
Current state: UP
Line protocol state: UP
IP packet frame type: Ethernet II, hardware address: 600b-038a-a395
Description: fw
Bandwidth: 40000000 kbps
40Gbps-speed mode, full-duplex mode
Link speed type is autonegotiation, link duplex type is autonegotiation
PVID: 1
Port link-type: Trunk
VLAN Passing: 1(default vlan), 12-13, 16-19, 21, 23, 160, 168, 192-193, 1706
VLAN permitted: 1(default vlan), 2-4094
Trunk port encapsulation: IEEE 802.1q
Last clearing of counters: Never
Last 300 seconds input: 11479 packets/sec 3640495 bytes/sec 0%
Last 300 seconds output: 11574 packets/sec 3648299 bytes/sec 0%
Input (total): 71053448389 packets, 47565916009556 bytes
71027994700 unicasts, 1105740 broadcasts, 24347949 multicasts, 0 pauses
Input (normal): 71053448388 packets, - bytes
71027994700 unicasts, 1105740 broadcasts, 24347949 multicasts, 0 pauses
Input: 0 input errors, 0 runts, 0 giants, 0 throttles
0 CRC, 0 frame, - overruns, 0 aborts
- ignored, - parity errors
Output (total): 71382158739 packets, 47594556534427 bytes
71322766211 unicasts, 19229074 broadcasts, 40163454 multicasts, 0 pauses
Output (normal): 71382158732 packets, - bytes
71322766210 unicasts, 19229074 broadcasts, 40163454 multicasts, 0 pauses
Output: 0 output errors, - underruns, - buffer failures
0 aborts, 0 deferred, 0 collisions, 0 late collisions
0 lost carrier, - no carrier

Bridge-Aggregation38
Current state: UP
Line protocol state: UP
IP packet frame type: Ethernet II, hardware address: 600b-038a-a395
Description: abc
Bandwidth: 40000000 kbps
40Gbps-speed mode, full-duplex mode
Link speed type is autonegotiation, link duplex type is autonegotiation
PVID: 1
Port link-type: Trunk
VLAN Passing: 1(default vlan), 12-13, 16-19, 21, 23, 160, 168, 192-193, 1706
VLAN permitted: 1(default vlan), 2-4094
Trunk port encapsulation: IEEE 802.1q
Last clearing of counters: Never
Last 300 seconds input: 109 packets/sec 8177 bytes/sec 0%
Last 300 seconds output: 120 packets/sec 9418 bytes/sec 0%
Input (total): 130998977 packets, 18556616169 bytes
130100036 unicasts, 109839 broadcasts, 789102 multicasts, 0 pauses
Input (normal): 130998977 packets, - bytes
130100036 unicasts, 109839 broadcasts, 789102 multicasts, 0 pauses
Input: 0 input errors, 0 runts, 0 giants, 0 throttles
0 CRC, 0 frame, - overruns, 0 aborts
- ignored, - parity errors
Output (total): 174932435 packets, 24434894669 bytes
137650820 unicasts, 20442493 broadcasts, 16839122 multicasts, 0 pauses
Output (normal): 174932435 packets, - bytes
137650820 unicasts, 20442493 broadcasts, 16839122 multicasts, 0 pauses
Output: 0 output errors, - underruns, - buffer failures
0 aborts, 0 deferred, 0 collisions, 0 late collisions
0 lost carrier, - no carrier

Bridge-Aggregation47
Current state: UP
Line protocol state: UP
IP packet frame type: Ethernet II, hardware address: 600b-038a-a395
Description: vpc1
Bandwidth: 20000000 kbps
20Gbps-speed mode, full-duplex mode
Link speed type is autonegotiation, link duplex type is autonegotiation
PVID: 1
Port link-type: Trunk
VLAN Passing: 1(default vlan), 12-13, 16-19, 21, 23, 160, 168, 192-193, 1706
VLAN permitted: 1(default vlan), 2-4094
Trunk port encapsulation: IEEE 802.1q
Last clearing of counters: Never
Last 300 seconds input: 5978 packets/sec 1780706 bytes/sec 0%
Last 300 seconds output: 5574 packets/sec 1868151 bytes/sec 0%
Input (total): 38336468925 packets, 28317447377454 bytes
38304843420 unicasts, 13089512 broadcasts, 18535993 multicasts, 0 pauses
Input (normal): 38336468925 packets, - bytes
38304843420 unicasts, 13089512 broadcasts, 18535993 multicasts, 0 pauses
Input: 0 input errors, 0 runts, 0 giants, 0 throttles
0 CRC, 0 frame, - overruns, 0 aborts
- ignored, - parity errors
Output (total): 35882826538 packets, 23256221052935 bytes
35874915425 unicasts, 4561193 broadcasts, 3349920 multicasts, 0 pauses
Output (normal): 35882826538 packets, - bytes
35874915425 unicasts, 4561193 broadcasts, 3349920 multicasts, 0 pauses
Output: 0 output errors, - underruns, - buffer failures
0 aborts, 0 deferred, 0 collisions, 0 late collisions
0 lost carrier, - no carrier

FortyGigE1/0/49
Current state: Administratively DOWN
Line protocol state: DOWN
IP packet frame type: Ethernet II, hardware address: b845-f47a-9a74
Description: NO-USE
Bandwidth: 40000000 kbps
Loopback is not set
Media type is optical fiber, Port hardware type is 40G_BASE_CSR4_QSFP_PLUS
Unknown-speed mode, unknown-duplex mode
Link speed type is autonegotiation, link duplex type is autonegotiation
Flow-control is not enabled
Maximum frame length: 10000
Allow jumbo frames to pass
Broadcast max-ratio: 100%
Multicast max-ratio: 100%
Unicast max-ratio: 100%
PVID: 1
MDI type: Automdix
Port link-type: Access
Tagged VLANs: None
Untagged VLANs: 1
Port priority: 0
Last link flapping: Never
Last clearing of counters: Never
Current system time:2022-04-29 21:27:56 beijing+08:00:00
Last time when physical state changed to up:-
Last time when physical state changed to down:2013-01-01 03:12:55 beijing+08:00:00
Peak input rate: 0 bytes/sec, at 2022-03-30 16:38:41
Peak output rate: 0 bytes/sec, at 2022-03-30 16:38:41
Last 300 seconds input: 0 packets/sec 0 bytes/sec -%
Last 300 seconds output: 0 packets/sec 0 bytes/sec -%
Input (total): 0 packets, 0 bytes
0 unicasts, 0 broadcasts, 0 multicasts, 0 pauses
Input (normal): 0 packets, - bytes
0 unicasts, 0 broadcasts, 0 multicasts, 0 pauses
Input: 0 input errors, 0 runts, 0 giants, 0 throttles
0 CRC, 0 frame, - overruns, 0 aborts
- ignored, - parity errors
Output (total): 0 packets, 0 bytes
0 unicasts, 0 broadcasts, 0 multicasts, 0 pauses
Output (normal): 0 packets, - bytes
0 unicasts, 0 broadcasts, 0 multicasts, 0 pauses
Output: 0 output errors, - underruns, - buffer failures
0 aborts, 0 deferred, 0 collisions, 0 late collisions
0 lost carrier, - no carrier
IPv4 traffic statistics:
Last 300 seconds input rate: 0 packets/sec, 0 bytes/sec
Last 300 seconds output rate: 0 packets/sec, 0 bytes/sec
Input: 0 packets, 0 bytes
Output: 0 packets, 0 bytes
IPv6 traffic statistics:
Last 300 seconds input rate: 0 packets/sec, 0 bytes/sec
Last 300 seconds output rate: 0 packets/sec, 0 bytes/sec
Input: 0 packets, 0 bytes
Output: 0 packets, 0 bytes

"""

print result:

[{'interface': 'Bridge-Aggregation35', 'link_status': 'UP', 'protocol_status': 'UP', 'mac_address': '600b-038a-a395', 'description': 'fw', 'bandwidth': '40000000', 'mtu': '', 'speed_mode': '40Gbps', 'duplex_mode': 'full', 'media_type': '', 'hardware_type': '', 'pvid': '1', 'link_type': 'Trunk', 'last_flapping': '', 'primary_ipaddr': '', 'rx_pkts': '86689781', 'rx_bytes': '-', 'rx_unicast': '0', 'rx_broadcast': '0', 'rx_multicast': '1976648', 'rx_errors': '0', 'rx_aborts': '', 'rx_crc': '', 'tx_pkts': '', 'tx_bytes': '', 'tx_unicast': '', 'tx_broadcast': '', 'tx_multicast': '', 'tx_errors': '', 'tx_aborts': ''}]
{'Bridge-Aggregation35': {'is_enabled': True, 'is_up': True, 'description': 'fw', 'speed': 40000000, 'mtu': -1, 'mac_address': '60:0B:03:8A:A3:95', 'last_flapped': -1}}

only one port

Switchname not detected in ouput

I'm using get_mac_address_table() on several comware-switches running version 7.1.070. Since two days, I'm not able to pull the mac-addresses from a single switch called SW01_A-Sued due to the netmiko error Pattern not detected: '\\[SW01_A\\-Sued\\]' in output..

The error suggest to explicitly set the pattern, which I have no influence over, or increase the read_timeout which has no effect on error.

My code is the following:

driver = get_network_driver("h3c_comware")
driver = driver(ip, USERNAME, PASSWORD, timeout=10)
driver.open()
mac = []
try:
    mac = driver.get_mac_address_table()
except Exception as e:
    print(f"Problems access switch: {e}")
print(mac)    

Because all switches are on the same firmware version I am a little clueless. I also already tried querying the command manually, but this either didn't work.

Is there anything I can adjust about my approach?

Charmap Codec Can't Decode Byte

Hi there,

I have a switch stack of S5820X devices which should be compatible with the S5500 series of devices.

Running a simple .get_facts() on the system results in a UnicodeDecodeError with the following traceback:

Traceback (most recent call last):

  File "C:\Users\aarch\.pyenv\pyenv-win\versions\3.10.4\lib\threading.py", line 966, in _bootstrap
    self._bootstrap_inner()
    │    └ <function Thread._bootstrap_inner at 0x000001E764F16710>
    └ <Thread(ThreadPoolExecutor-0_0, started 57100)>

  File "C:\Users\aarch\.pyenv\pyenv-win\versions\3.10.4\lib\threading.py", line 1009, in _bootstrap_inner
    self.run()
    │    └ <function Thread.run at 0x000001E764F16440>
    └ <Thread(ThreadPoolExecutor-0_0, started 57100)>

  File "C:\Users\aarch\.pyenv\pyenv-win\versions\3.10.4\lib\threading.py", line 946, in run
    self._target(*self._args, **self._kwargs)
    │    │        │    │        │    └ {}
    │    │        │    │        └ <Thread(ThreadPoolExecutor-0_0, started 57100)>
    │    │        │    └ (<weakref at 0x000001E769A1E070; to 'ThreadPoolExecutor' at 0x000001E769A28670>, <_queue.SimpleQueue object at 0x000001E769A1...
    │    │        └ <Thread(ThreadPoolExecutor-0_0, started 57100)>
    │    └ <function _worker at 0x000001E764F38430>
    └ <Thread(ThreadPoolExecutor-0_0, started 57100)>

  File "C:\Users\aarch\.pyenv\pyenv-win\versions\3.10.4\lib\concurrent\futures\thread.py", line 83, in _worker
    work_item.run()
    │         └ <function _WorkItem.run at 0x000001E764F38550>
    └ <concurrent.futures.thread._WorkItem object at 0x000001E769A28940>

  File "C:\Users\aarch\.pyenv\pyenv-win\versions\3.10.4\lib\concurrent\futures\thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             │    │   │    │       │    └ {}
             │    │   │    │       └ <concurrent.futures.thread._WorkItem object at 0x000001E769A28940>
             │    │   │    └ (HealthCheck(group='carm', name='core', host='172.16.10.1', port=22, username='redacted', password='redacted', driver='h3c...
             │    │   └ <concurrent.futures.thread._WorkItem object at 0x000001E769A28940>
             │    └ <function HealthCheck.run at 0x000001E7694A83A0>
             └ <concurrent.futures.thread._WorkItem object at 0x000001E769A28940>

> File "D:\Programming\Python\healthcheck\healthcheck\job.py", line 54, in run
    if (value := self._run()) is None:
                 │    └ <function HealthCheck._run at 0x000001E7694A8700>
                 └ HealthCheck(group='carm', name='core', host='172.16.10.1', port=22, username='redacted', password='redacted', driver='h3c_...

  File "D:\Programming\Python\healthcheck\healthcheck\job.py", line 91, in _run
    facts = device.get_facts()
            │      └ <function ComwareDriver.get_facts at 0x000001E769A5CD30>
            └ <napalm_h3c_comware.comware.ComwareDriver object at 0x000001E7699F3910>

  File "D:\Programming\Python\healthcheck\.venv\lib\site-packages\napalm_h3c_comware\comware.py", line 120, in get_facts
    structured_int_info = self._get_structured_output("display interface")
                          │    └ <function ComwareDriver._get_structured_output at 0x000001E769A5CCA0>
                          └ <napalm_h3c_comware.comware.ComwareDriver object at 0x000001E7699F3910>

  File "D:\Programming\Python\healthcheck\.venv\lib\site-packages\napalm_h3c_comware\comware.py", line 88, in _get_structured_output
    result = textfsm_extractor(self, template_name, raw_output)
             │                 │     │              └ ' Bridge-Aggregation1 current state: UP\n IP Packet Frame Type: PKTFMT_ETHNT_2, Hardware Address: 3ce5-a678-4bfe\n Descriptio...
             │                 │     └ 'display_interface'
             │                 └ <napalm_h3c_comware.comware.ComwareDriver object at 0x000001E7699F3910>
             └ <function textfsm_extractor at 0x000001E768C7EC20>

  File "D:\Programming\Python\healthcheck\.venv\lib\site-packages\napalm\base\helpers.py", line 284, in textfsm_extractor
    fsm_handler = textfsm.TextFSM(f)
                  │       │       └ <_io.TextIOWrapper name='D:\\Programming\\Python\\healthcheck\\.venv\\lib\\site-packages\\napalm_h3c_comware/utils/textfsm_te...     
                  │       └ <class 'textfsm.parser.TextFSM'>
                  └ <module 'textfsm' from 'D:\\Programming\\Python\\healthcheck\\.venv\\lib\\site-packages\\textfsm\\__init__.py'>

  File "D:\Programming\Python\healthcheck\.venv\lib\site-packages\textfsm\parser.py", line 586, in __init__
    self._Parse(template)
    │    │      └ <_io.TextIOWrapper name='D:\\Programming\\Python\\healthcheck\\.venv\\lib\\site-packages\\napalm_h3c_comware/utils/textfsm_te...
    │    └ <function TextFSM._Parse at 0x000001E768313250>
    └ <textfsm.parser.TextFSM object at 0x000001E769A67B80>

  File "D:\Programming\Python\healthcheck\.venv\lib\site-packages\textfsm\parser.py", line 684, in _Parse
    self._ParseFSMVariables(template)
    │    │                  └ <_io.TextIOWrapper name='D:\\Programming\\Python\\healthcheck\\.venv\\lib\\site-packages\\napalm_h3c_comware/utils/textfsm_te...
    │    └ <function TextFSM._ParseFSMVariables at 0x000001E7683132E0>
    └ <textfsm.parser.TextFSM object at 0x000001E769A67B80>

  File "D:\Programming\Python\healthcheck\.venv\lib\site-packages\textfsm\parser.py", line 708, in _ParseFSMVariables
    for line in template:
                └ <_io.TextIOWrapper name='D:\\Programming\\Python\\healthcheck\\.venv\\lib\\site-packages\\napalm_h3c_comware/utils/textfsm_te...

  File "C:\Users\aarch\.pyenv\pyenv-win\versions\3.10.4\lib\encodings\cp1252.py", line 23, in decode
    return codecs.charmap_decode(input,self.errors,decoding_table)[0]
           │      │              │     │    │      └ '\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f !...
           │      │              │     │    └ 'strict'
           │      │              │     └ <encodings.cp1252.IncrementalDecoder object at 0x000001E769A66170>
           │      │              └ b'Value Required INTERFACE (\\S+)\nValue LINK_STATUS (.+)\nValue PROTOCOL_STATUS (\\S+)\nValue MAC_ADDRESS (\\S+)\nValue DESC...      
           │      └ <built-in function charmap_decode>
           └ <module 'codecs' from 'C:\\Users\\aarch\\.pyenv\\pyenv-win\\versions\\3.10.4\\lib\\codecs.py'>

UnicodeDecodeError: 'charmap' codec can't decode byte 0x8f in position 406: character maps to <undefined>

Attached is the precise value of raw_output when printed to a file:
105463-1042167.734.txt

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.