Skip to main content

NAPALM driver for Eltex switches

Project description

NAPALM_ELTEX

Napalm driver for Eltes switches.

Requirements

  • napalm (3.3)
  • pandas (1.3.5) (pandas is needed to parse fucking tables)

see requirements.txt

Implemented methods

open() - Open a connection to the device.

driver = get_network_driver('eltex')
device = driver(
                device_type=device_type, 
                host=self.hostname, 
                username=self.username, 
                password=self.password
                optional_args={
                    'port': 22
                }
           )
device.open()
...
...
device.close()

close() - Close the connection to the device.

device.close()

is_alive() - Return a flag with the state of the SSH connection.

device.is_alive()

get_facts() - Return a set of facts from the devices.

facts = device.get_facts()
print(facts)

return:

{
    'uptime': 7502146, 
    'vendor': 'Eltex', 
    'os_version': '4.0.14.3', 
    'serial_number': 'Unknown', 
    'model': 'MES2324P AC 28-port 1G/10G Managed Switch with 24 POE+ ports', 
    'hostname': '001.209.F2.MES2324PWR.1540024', 
    'fqdn': 'Unknown', 
    'interface_list': [
        'gi1/0/1', 
        'gi1/0/2', 
        'gi1/0/3', 
        'te1/0/1', 
        'te1/0/2',
        ...
        ...
    ]
}

cli(commands) - Execute raw CLI commands and returns their output.

get_interfaces() - Get interface details.

return:

 {
    'gi1/0/12': {
        'is_enabled': false,
        'description': '',
        'last_flapped': -1.0,
        'is_up': false,
        'mac_address': '0C:45:BA:7D:83:E6',
        'speed': 1000,
        'mtu': 1500
    },
    'gi1/0/13': {
         'is_enabled': true,
         'description': 'USERS',
         'last_flapped': -1.0,
         'is_up': true,
         'mac_address': '0C:45:BA:7D:83:E4',
         'speed': 1000,
         'mtu': 1500
     }
...
...
}

get_interfaces_ip() - Get interface IP details. Returns a dictionary of dictionaries.

return:

{
    'gi1/0/1': {
        'ipv4': {
            '192.168.0.9': {
                'prefix_length': 16
            }
        }
    },
    'Vlan10': {
        'ipv4': {
            '192.168.200.3': {
                'prefix_length': 24
            },
            '192.168.200.6': {
                'prefix_length': 24
            },
            '192.168.200.8': {
                'prefix_length': 24
            }
        }
    }
...
...
}

get_interfaces_counters() - Return interfaces counters.

return:

{
    'gi1/0/1': 
        {
            'tx_error': 0, 
            'rx_error': 0, 
            'tx_discards': 0, 
            'rx_discards': 0,
            'tx_octets': '4258380107556',
            'rx_octets': '106144858448', 
            'tx_unicast_packets': '4194039722', 
            'rx_unicast_packets': '1396550631', 
            'tx_multicast_packets': '19499222', 
            'rx_multicast_packets': '314766', 
            'tx_broadcast_packets': '14928742', 
            'rx_broadcast_packets': '59701'
    }, 
    'gi1/0/2': 
        {
            'tx_error': 0, 
            'rx_error': 0, 
            'tx_discards': 0, 
            'rx_discards': 0, 
            'tx_octets': '17163865943', 
            'rx_octets': '10026935164', 
            'tx_unicast_packets': '19699662', 
            'rx_unicast_packets': '42074088', 
            'tx_multicast_packets': '19443159', 
            'rx_multicast_packets': '317637', 
            'tx_broadcast_packets': '14916046', 
            'rx_broadcast_packets': '20190'}, 
    }
...
...
}

get_environment() - Return environment details.

return:

{
    'cpu': {
        '0': {
            '%usage': 18.0
        }
    },
    'fans': {
        'FAN1': {
            'status': true
        }
    },
    'memory': {
        'available_ram': 3884224,
        'used_ram': 784552
    },
    'power': {
        'PWR1': {
            'capacity': 600.0,
            'output': 92.0,
            'status': true
        }
    },
    'temperature': {
        'CPU': {
            'is_alert': false,
            'is_critical': false,
            'temperature': 45.0
        }
    }
}

get_arp_table() - Get arp table information.

return:

[
    {
        'interface': 'gi1/0/24', 
        'mac': '00:26:cb:32:d1:3f', 
        'ip': '10.154.1.1', 'age': -1
    }, 
    {
        'interface': 'gi1/0/24', 
        'mac': '9c:1d:36:fe:c0:42', 
        'ip': '10.154.1.41', 'age': -1
    }, 
    {
        'interface': 'gi1/0/24', 
        'mac': 'c4:b8:b4:63:44:2b', 
        'ip': '10.154.1.63', 
        'age': -1
    }, 
    {
        'interface': 'gi1/0/24', 
        'mac': 'c4:b8:b4:63:44:36', 
        'ip': '10.154.1.93', 'age': -1
    }, 
...
...
]

get_config(retrieve='all|running|startup') - Get config from device.

return:

spanning-tree hello-time 1
spanning-tree max-age 6
spanning-tree forward-time 4
!
vlan database
 vlan 19,800
exit
!
voice vlan id 800
voice vlan state oui-enabled
voice vlan oui-table add 805ec0
!
lldp med network-policy 1 voice vlan 800 vlan-type tagged up 5
!
errdisable recovery interval 30
errdisable recovery cause loopback-detection
errdisable recovery cause stp-bpdu-guard
errdisable recovery cause stp-loopback-guard
!
mac address-table notification change
mac address-table notification change history 100
...
...

get_lldp_neighbors() - Return LLDP neighbors details.

return:

{
    'gi1/0/1': [
        {
            'hostname': 'SIP-T46S', 
            'port': '80:5e:c0:53:82:05'
        }
    ], 
    'gi1/0/2': [
        {
            'hostname': 'SIP-T43U', 
            'port': '80:5e:c0:9e:6b:19'
        }
    ], 
    'gi1/0/3': [
        {
            'hostname': 'SIP-T46S', 
            'port': '80:5e:c0:53:82:ea'
        }
    ], 
    'gi1/0/4': [
        {
            'hostname': 'SIP-T19P_E2', 
            'port': '80:5e:c0:b8:0d:35'
        }
    ],
...
...
}

get_mac_address_table() - Return the MAC address table.

return:

[
    {
        'active': True, 
        'interface': 'gi1/0/24', 
        'last_move': -1.0, 
        'mac': '00:16:b9:ba:17:c0', 
        'moves': -1, 
        'static': False, 
        'vlan': '1'
    }, 
    {
        'active': True, 
        'interface': 'gi1/0/24', 
        'last_move': -1.0, 
        'mac': '00:18:fe:d4:5b:40', 
        'moves': -1, 
        'static': False, 
        'vlan': '1'
    }, 
    {
        'active': True, 
        'interface': 'gi1/0/24', 
        'last_move': -1.0, 
        'mac': '00:1d:b3:3e:ad:a0', 
        'moves': -1, 
        'static': False, 
        'vlan': '1'
    },
...
...
]

get_users

return:

{
    'admin': {
        'level': 3,
        'password': '',
        'sshkeys': []
    }
}

Skipped methods

compare_config()

discard_config()

commit_config()

load_merge_candidate(filename=None, config=None)

load_replace_candidate(filename=None, config=None)

rollback()

ping(destination, source=c.PING_SOURCE, ttl=c.PING_TTL, timeout=c.PING_TIMEOUT, size=c.PING_SIZE, count=c.PING_COUNT, vrf=c.PING_VRF, **kwargs)

__get_lldp_neighbors_detail(interface='')

__get_ntp_peers()

__get_ntp_servers()

__get_ntp_stats()

_delete_file(filename)

_save_config(filename='')

_load_config(config_file)

_replace_candidate(filename, config)

_verify_remote_file_exists(dst, file_system='flash:')

_check_file_exists(cfg_file)

_check_md5(dst)

_get_remote_md5(dst)

_commit_merge()

_get_merge_diff()

_get_diff(filename=None)

_enough_space(filename)

_get_flash_size()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

napalm_eltex2448-0.1.7.tar.gz (17.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

napalm_eltex2448-0.1.7-py3-none-any.whl (15.0 kB view details)

Uploaded Python 3

File details

Details for the file napalm_eltex2448-0.1.7.tar.gz.

File metadata

  • Download URL: napalm_eltex2448-0.1.7.tar.gz
  • Upload date:
  • Size: 17.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for napalm_eltex2448-0.1.7.tar.gz
Algorithm Hash digest
SHA256 b0a49f8cb49542c0e19be9f89e466ae819d2f2a071ba0d42bde70454d3d87686
MD5 a414ff87ef6fd835fe412099b0481f9a
BLAKE2b-256 ddd4eb2e45642fb5d076a6228ea49f88403a298ff2fea0962b89c3e592668a03

See more details on using hashes here.

File details

Details for the file napalm_eltex2448-0.1.7-py3-none-any.whl.

File metadata

File hashes

Hashes for napalm_eltex2448-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 0f7f4abe56566bef11a4953a176f785ff8cca5a4f99a15af818561c04ec18769
MD5 1488ceb3e254ef7851cf333b21dfc867
BLAKE2b-256 340e285f7b4562ecd14f42b8e5197787ee6e03ce11fa991e7ca5b2b3e08b9a1c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page