def main(): r1_session = Device(ip='10.10.10.110') r1 = r1_session.open() oper = getInterfaceStatus(r1, 'GigabitEthernet0/0') route = dict(dest_prefix='111.111.10.0',dest_prefix_mask=24,next_hop='10.1.1.120', \ out_intf='GigabitEthernet0/2', admin_distance=34) if oper == 'down': status = addRoute(r1, route) else: status = 'Interface is up. Dynamic Route not configured' if status == 'Route Installed': print '\n' + status print 'Check the routing table if you want to see it' print "Use 'show ip route " + route['dest_prefix'] + "'" print 'Look for the (a) route' time.sleep(30) print '\nRoute Removed' else: print status r1.disconnect()
def main(): dev = Device(ip='10.1.1.110') args = sys.argv route = {} route['dest_prefix'] = args[1] route['dest_prefix_mask'] = int(args[2]) route['next_hop'] = args[3] route['out_intf'] = args[4] route['admin_distance'] = int(args[5]) status = addRoute(dev,route) if status == 'Route Installed': print status print "Check the routing table if you want to see it: 'show ip route " + route['dest_prefix'] + "'" time.sleep(10) dev.disconnect() print 'Route Removed' else: print status
def main(): r1_session = Device(ip='10.10.10.110') r1 = r1_session.open() oper = getInterfaceStatus(r1,'GigabitEthernet0/0') route = dict(dest_prefix='111.111.10.0',dest_prefix_mask=24,next_hop='10.1.1.120', \ out_intf='GigabitEthernet0/2', admin_distance=34) if oper == 'down': status = addRoute(r1,route) else: status = 'Interface is up. Dynamic Route not configured' if status == 'Route Installed': print '\n' + status print 'Check the routing table if you want to see it' print "Use 'show ip route " + route['dest_prefix'] + "'" print 'Look for the (a) route' time.sleep(30) print '\nRoute Removed' else: print status r1.disconnect()
def main(): dev = Device(ip='10.1.1.110') args = sys.argv route = {} route['dest_prefix'] = args[1] route['dest_prefix_mask'] = int(args[2]) route['next_hop'] = args[3] route['out_intf'] = args[4] route['admin_distance'] = int(args[5]) status = addRoute(dev, route) if status == 'Route Installed': print status print "Check the routing table if you want to see it: 'show ip route " + route[ 'dest_prefix'] + "'" time.sleep(10) dev.disconnect() print 'Route Removed' else: print status