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)
Exemple #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_properties = topology_interface.interface_properties(
                device_name, interface_name)
            print('\t', interface_name, '-->', interface_properties)
Exemple #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'))
Exemple #4
0
 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):
                     #print('Interface Properties for %s:' % interface_name)
                     if interface_name == "GigabitEthernet0/0/0/2":
                         interface_properties = topology_interface.interface_properties(device_name, interface_name)