python script for functions
interface field | |
python script def clear_bgp(ngbr_ips,table_name,group_name,prefix_for,**kwargs): #headers = { 'Accept' : 'application/json', 'Content-Type' : 'application/json' } r = requests.get('http://api_server:9000/api/v1/device/%s/' % kwargs['device_id'], verify=False) print ("Connected to API server") print(r.status_code, file=sys.stderr) if r.status_code != 200: return False device_info = r.json() junos_host = device_info['host'] junos_user = device_info['authentication']['password']['username'] junos_password = device_info['authentication']['password']['password'] | |