def ping(source): """Renders ping form and sends ping""" if not request.form: return render_template('ping.html', source=source.replace('%2f', '/'), vrfs=QueryDbFor.query_vrfs(device)) else: if request.form.get('vrf') == 'none': ping = GetNetmiko.send_ping(netmiko_session, netmiko_session, username, password, device, request.form.get('dest'), request.form.get('source'), request.form.get('count')) else: ping = GetNetmiko.send_ping(netmiko_session, username, password, device, request.form.get('dest'), request.form.get('source'), request.form.get('count'), vrf=request.form.get('vrf')) return render_template('ping.html', source=source.replace('%2f', '/'), vrfs=QueryDbFor.query_vrfs(device), results=ping)
def submit_ping(): """Render OSPF configuration/Form""" if request.form.get('vrf') == 'none': ping = GetInfo.send_ping(netmiko_session, request.form.get('dest'), request.form.get('source'), request.form.get('count')) else: ping = GetInfo.send_ping(netmiko_session, request.form.get('dest'), request.form.get('source'), request.form.get('count'), vrf=request.form.get('vrf')) return jsonify({'data': render_template('ping_status.html', results=ping)})