def delete_static_route(device_name, destination_network, print_tag): #if static route exist, delete it first if static_route_exists(device_name, destination_network): static_route_delete(device_name, destination_network) if print_tag == 1: print('remove route to %s' % destination_network, 'in %s' % device_name)
def demonstrate_one(device_name, destination_network): """ Apply function 'static_route_delete' to the specified device and destination. """ print('static_route_delete(%s, %s)' % (device_name, destination_network)) static_route_delete(device_name, destination_network) print() print('static_route_list(%s)' % device_name) print_table(static_route_list(device_name), headers='destination-network')
def add_static_route(device_name, destination_network, next_hop_address, print_tag): #if static route exist, delete it first if static_route_exists(device_name, destination_network): static_route_delete(device_name, destination_network) if print_tag == 1: print('remove route to %s' % destination_network, 'in %s' % device_name) #add the static route static_route_create(device_name, destination_network, next_hop_address) if print_tag == 1: print('add route to %s' % destination_network, ' next_hop: %s' % next_hop_address, 'in %s' % device_name)
def demonstrate_all(device_name): """ Apply function 'static_route_delete' to all routes on the specified device. """ print() print('static_route_delete(%s)' % device_name) static_route_delete(device_name) print() print('static_route_list(%s)' % device_name) print_table(static_route_list(device_name), headers='destination-network')
def demonstrate(device_name): ''' Apply function 'static_route_delete' to any route of the specified device.''' print() print('static_route_list(' + device_name, sep=', ', end=')\n') route_list=static_route_list(device_name) print('\t', [str(route) for route in route_list]) for destination_network in route_list: print() print('static_route_delete(' + device_name, destination_network, sep=', ', end=')\n') static_route_delete(device_name, destination_network) return True return False
def demonstrate(device_name): ''' Apply function 'static_route_delete' to any route of the specified device.''' print() print('static_route_list(' + device_name, sep=', ', end=')\n') route_list = static_route_list(device_name) print('\t', [str(route) for route in route_list]) for destination_network in route_list: print() print('static_route_delete(' + device_name, destination_network, sep=', ', end=')\n') static_route_delete(device_name, destination_network) return True return False
def demonstrate(device_name): """ Apply function 'static_route_delete' to the specified device. Return True if one or more static routes are deleted. """ print() print('static_route_list(%s)' % device_name) route_list = static_route_list(device_name) if not route_list: print('\t', None) else: print('\t', [str(route) for route in route_list]) for destination_network in route_list: print() print('static_route_delete(' + device_name, destination_network, sep=', ', end=')\n') static_route_delete(device_name, destination_network) return bool(route_list)
def delete(self): device_name = self.devicename.get() destination_network = self.ipset.get() netmask = self.netmask.get() dest = to_ip_network(destination_network, netmask) static_route_delete(device_name, dest)