Feb-22-2018, 07:27 AM
Hi Buran,
changed, let me know any this left for improvement?
tried with another device and output is perfect.
changed, let me know any this left for improvement?
for line in output.decode('utf-8').split('\n')[4:]: line = line.split('|') if len(line) == 8: mac, bport, vlan = map(lambda x: x.strip(), line[:3]) mac_address = mac2norm(mac) MyList = host,mac_address, bport, vlan command = "bportr " +bport session.write((command +"\r").encode('ascii')) portoutput = session.read_until("MCR64A >".encode('ascii'), timeout ) for line in portoutput.split('\n'): if 'Port:' in line: port = line.replace(' ','').split(':')[1] MyList += (port,) print('{} {} {} {} {}'.format(host,mac_address, bport, vlan, port))working perfectly
tried with another device and output is perfect.
Output:10.113.1.1 10:62:EB:66:E9 1746 3601 38
10.113.1.1 00:17:7C:6D:FF 1845 3601 20
10.113.1.1 90:8D:78:8B:49 1828 3601 28
10.113.1.1 00:00:0D:48:33 2094 357 34
10.113.1.1 6C:19:8F:5E:BA 1716 3601 24
10.113.1.1 80:26:89:CA:84 2119 3601 44
10.113.1.1 28:28:5D:BF:32 1891 3601 6
10.113.1.1 E8:37:7A:9D:16 1963 3601 16
10.113.1.1 28:28:5D:94:89 1949 3601 9
10.113.1.1 EC:22:80:C4:00 1798 3601 5
10.113.1.1 E4:6F:13:81:00 1969 3601 21
10.113.1.1 E4:6F:13:82:DE 2088 3401 2
10.113.1.1 00:00:0D:48:34 1989 3111 32
10.113.1.1 00:17:7C:7C:3E 1865 3601 31
10.113.1.1 48:EE:00:0C:98 1768 3601 52
10.113.1.1 54:B8:00:0A:41 1712 3601 18
10.113.1.1 00:17:7C:6E:00 2057 3132 10
10.113.1.1 0C:D2:B5:61:CE 1822 3601 15
10.113.1.1 EC:22:80:C4:00 1750 3601 3
10.113.1.1 00:17:7C:6D:C8 2109 3601 23
10.113.1.1 00:17:7C:75:A7 1947 3601 8
10.113.1.1 90:8D:78:84:5C 1983 3125 47
10.113.1.1 80:26:89:C8:EE 2137 3133 37
10.113.1.1 EC:43:F6:7B:22 2090 3401 42
10.113.1.1 E4:6F:13:88:4D 1961 3601 54
10.113.1.1 80:26:89:C7:6D 2133 3142 62
10.113.1.1 00:19:CB:B3:BF 1826 3601 27
10.113.1.1 E4:6F:13:81:00 2021 3601 39
10.113.1.1 00:17:7C:7C:3E 1770 3601 35
10.113.1.1 10:7B:EF:A6:22 1838 3601 53
10.113.1.1 00:17:7C:77:AC 2092 3601 63
10.113.1.1 0C:D2:B5:5E:B4 2116 3601 17