<commit_before>#!/bin/env python
"""
  Demonstrate use of netmiko to change configuration of device
"""

from netmiko import ConnectHandler

pynet1 = {
    'device_type': 'cisco_ios',
    'ip': '172.16.31.10',
    'username': 'pyclass',
    'password': '<PASSWORD>',
}

pynet2 = {
    'device_type': 'cisco_ios',
    'ip': '172.16.58.3',
    'username': 'pyclass',
    'password': '<PASSWORD>',
}

juniper_srx = {
    'device_type': 'juniper',
    'ip': '172.16.31.10',
    'username': 'pyclass',
    'password': '<PASSWORD>',
    'secret': ''
}

sess1=ConnectHandler(**pynet2)
sess1.config_mode()
print "CONFIG MODE %s" %sess1.check_config_mode()

for device in [pynet1,pynet2]:
    print "\nDEVICE %s" %device['ip']
    sess=ConnectHandler(**device)
    sess.config_mode()
    sess.send_config_from_file('config.txt')
    print "%s" %sess.send_command('sho run | i logging')
    sess.disconnect()
    
<commit_msg>minor changes to ex8.py<commit_after>#!/bin/env python
"""
  Demonstrate use of netmiko to change configuration of device
  using configuration file
"""

from netmiko import ConnectHandler

pynet1 = {
    'device_type': 'cisco_ios',
    'ip': '172.16.31.10',
    'username': 'pyclass',
    'password': '<PASSWORD>',
}

pynet2 = {
    'device_type': 'cisco_ios',
    'ip': '172.16.58.3',
    'username': 'pyclass',
    'password': '<PASSWORD>',
}

for device in [pynet1,pynet2]:
    print "\nDEVICE %s" %device['ip']
    sess=ConnectHandler(**device)
    print sess.config_mode()
    print sess.send_config_from_file('config.txt')
    print "%s" %sess.send_command('sho run | i logging')
    sess.disconnect()

{'fraction_non_alphanumeric': 0.17661538461538462, 'fraction_numerical': 0.03446153846153846, 'mean_word_length': 3.8249258160237387, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 5, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5765378', 'n_tokens_mistral': 648, 'n_tokens_neox': 625, 'n_words': 127}