In [28]:
import sys
sys.path.append("..")
In [29]:
from os import environ
environ["NETWORK_PROFILE"] = "giles"
In [30]:
from basics.sample import sample_interface
(device_name, interface_name) = sample_interface()
print 'Use', (device_name, interface_name)
In [25]:
from basics.interface_configuration import interface_configuration
interface = interface_configuration(device_name, interface_name)
In [26]:
table_md_template = '''
|Name|Description|Shutdown|Address|NetMask|
|:-|:-|:-:|:-|:-|
|%s|%s|%s|%s|%s|
'''
table_md = table_md_template % (
interface.name,
interface.description,
interface.shutdown,
interface.address,
interface.netmask)
# from basics.markdown import normtable
# print normtable(table_md)
print table_md
In [27]:
from basics.interface_configuration import interface_configuration_update
interface_configuration_update(device_name, interface_name, description='Formerly ' + interface.address,
address='101.101.101.101', netmask='255.255.0.0', shutdown=interface.shutdown)
In [12]:
modified = interface_configuration(device_name, interface_name)
table_md = table_md_template % (
modified.name,
modified.description,
modified.shutdown,
modified.address,
modified.netmask)
# from basics.markdown import normtable
# print normtable(table_md)
print table_md
In [9]:
interface_configuration_update(device_name, interface_name, description=interface.description,
address=interface.address, netmask=interface.netmask, shutdown=interface.shutdown)
In [14]:
restored = interface_configuration(device_name, interface_name)
table_md = table_md_template % (
restored.name,
restored.description,
restored.shutdown,
restored.address,
restored.netmask)
# from basics.markdown import normtable
# print normtable(table_md)
print table_md
In [ ]:
interface_configuration_update(device_name, interface_name, interface.description,
interface.address, interface.netmask, shutdown=True)
In [16]:
shutdown = interface_configuration(device_name, interface_name)
table_md = table_md_template % (
shutdown.name,
shutdown.description,
shutdown.shutdown,
shutdown.address,
shutdown.netmask)
# from basics.markdown import normtable
# print normtable(table_md)
print table_md
In [17]:
interface_configuration_update(device_name, interface_name, interface.description,
interface.address, interface.netmask, shutdown=False)
In [18]:
startup = interface_configuration(device_name, interface_name)
table_md = table_md_template % (
startup.name,
startup.description,
startup.shutdown,
startup.address,
startup.netmask)
# from basics.markdown import normtable
# print normtable(table_md)
print table_md