Example #1
0
def main():
    for device_name in topology.connected_nodes():
        print('%s:' % device_name)
        for interface_name in topology_interface.interface_names(device_name):
            #print('Interface Properties for %s:' % interface_name)
            interface_properties = topology_interface.interface_properties(device_name, interface_name)
            print('\t', interface_name, '-->',  interface_properties)
Example #2
0
def main():
    for device_name in topology.connected_nodes():
        print('%s:' % device_name)
        for interface_name in topology_interface.interface_names(device_name):
            #print('Interface Properties for %s:' % interface_name)
            interface_configuration = topology_interface.interface_configuration(device_name, interface_name)
            print('\t', interface_name, '-->',  interface_configuration)
Example #3
0
def main():
    for device_name in topology.connected_nodes():
        print('%s:' % device_name)
        for interface_name in topology_interface.interface_names(device_name):
            #print('Interface Properties for %s:' % interface_name)
            interface_properties = topology_interface.interface_properties(
                device_name, interface_name)
            print(
                '\t', interface_name, '-->',
                interface_properties['interface'][0]['state'].encode('utf-8'))
Example #4
0
def main():
    connected_nodes = topology.connected_nodes()
    if connected_nodes:
        node_id = connected_nodes[0]
        interface_names = topology_interface.interface_names(node_id)
        if interface_names:
            interface_name = interface_names[0]
            print('Starting up interface %s on %s' % (interface_name, node_id))
            topology_interface.interface_startup(node_id, interface_name)
        else:
            print('No interfaces on %s' % node_id)
    else:
        print('No connected devices')
Example #5
0
def main():
    connected_nodes = topology.connected_nodes()
    if connected_nodes:
        node_id = connected_nodes[0]
        interface_names = topology_interface.interface_names(node_id)
        if interface_names:
            interface_name = interface_names[0]
            print('Shutting down interface %s on %s' % (interface_name, node_id))
            topology_interface.interface_shutdown(node_id, interface_name)
        else:
            print('No interfaces on %s' % node_id)        
    else:
        print('No connected devices')
Example #6
0
 request_content1 = {'Cisco-IOS-XR-ip-static-cfg:vrf-prefix': [{'prefix': '27.27.27.27', 'vrf-route': {'vrf-next-hops': {'next-hop-address': [{'next-hop-address': '45.0.0.27'}]}}, 'prefix-length': 32}]}
 response1 = odl_http_post(_static_route_url_template, {'node-id' : device_name1}, 'application/json', request_content1, expected_status_code=[204, 409])
 
 device_name5 = 'iosxrv-5'
 request_content5 = {'Cisco-IOS-XR-ip-static-cfg:vrf-prefix': [{'prefix': '21.21.21.21', 'vrf-route': {'vrf-next-hops': {'next-hop-address': [{'next-hop-address': '45.0.0.21'}]}}, 'prefix-length': 32}]}
 response5 = odl_http_post(_static_route_url_template, {'node-id' : device_name5}, 'application/json', request_content5, expected_status_code=[204, 409])
 
 #read interface state for every 5 second
 count = 0
 for i in range(0,9):
     flag = True
     for device_name in topology.connected_nodes():
         #print('%s:' % device_name)
         
         if device_name == "iosxrv-1":
             for interface_name in topology_interface.interface_names(device_name):
                 #print('Interface Properties for %s:' % interface_name)
                 if interface_name == "GigabitEthernet0/0/0/4":
                     interface_properties = topology_interface.interface_properties(device_name, interface_name)
                     print('\t', interface_name, '-->',  interface_properties['interface'][0]['state'].encode('utf-8'))
                     interface_status = interface_properties['interface'][0]['state'].encode('utf-8')
                     
                     #if interface status is shutdown, count++
                     if interface_status == "im-state-up":
                         pass
                     else:
                         flag = False
                         break
                     
         elif device_name == "iosxrv-5":
                 for interface_name in topology_interface.interface_names(device_name):
Example #7
0
def main():
    for device_name in topology.connected_nodes():
        print('Interface Names for %s:' % device_name, 
              topology_interface.interface_names(device_name))