#!/usr/bin/env python

'''
- Allows you to send sample change to an IOS-XR device
- If changes are required these will be printed and deployed
- If no changes are required a message will be printed

'''

from napalm_base import get_network_driver


driver = get_network_driver('iosxr')
device = driver(hostname='10.4.37.16', username='cisco',
             password='cisco')


device.open()
device.load_merge_candidate(filename='prefix_list.cfg')
diffs = device.compare_config()


if len(diffs) > 0:
    print(diffs)
    device.commit_config()


else:
    print('No changes needed')
    device.discard_config()

device.close()
cd234ee95fb94c3fd8834acffb1ff6bceec7dc78
<mask token>

<mask token>
device.open()
device.load_merge_candidate(filename='prefix_list.cfg')
<mask token>
if len(diffs) > 0:
    print(diffs)
    device.commit_config()
else:
    print('No changes needed')
    device.discard_config()
device.close()

<mask token>
driver = get_network_driver('iosxr')
device = driver(hostname='10.4.37.16', username='cisco', password='cisco')
device.open()
device.load_merge_candidate(filename='prefix_list.cfg')
diffs = device.compare_config()
if len(diffs) > 0:
    print(diffs)
    device.commit_config()
else:
    print('No changes needed')
    device.discard_config()
device.close()

<mask token>
from napalm_base import get_network_driver
driver = get_network_driver('iosxr')
device = driver(hostname='10.4.37.16', username='cisco', password='cisco')
device.open()
device.load_merge_candidate(filename='prefix_list.cfg')
diffs = device.compare_config()
if len(diffs) > 0:
    print(diffs)
    device.commit_config()
else:
    print('No changes needed')
    device.discard_config()
device.close()

#!/usr/bin/env python

'''
- Allows you to send sample change to an IOS-XR device
- If changes are required these will be printed and deployed
- If no changes are required a message will be printed

'''

from napalm_base import get_network_driver


driver = get_network_driver('iosxr')
device = driver(hostname='10.4.37.16', username='cisco',
             password='cisco')


device.open()
device.load_merge_candidate(filename='prefix_list.cfg')
diffs = device.compare_config()


if len(diffs) > 0:
    print(diffs)
    device.commit_config()


else:
    print('No changes needed')
    device.discard_config()

device.close()