def login(): global apic, username, password, apic_session login_form = LoginForm(request.form) if 'login' in request.form: apic = request.form['apic'] username = request.form['username'] password = request.form['password'] if apic and username and password: # Network connection objects apic_session = FindEncap.apic_login(username, password, apic) if apic_session is not None: GetPolicies.vlan_pools(apic_session, apic) GetPolicies.domains(apic_session, apic) session_time(username, password, apic) return redirect(url_for('base_blueprint.find_encap')) else: flash("Login Failed") return render_template('accounts/login.html', form=login_form) if not current_user.is_authenticated: return render_template('accounts/login.html', form=login_form) return redirect(url_for('home_blueprint.index'))
def submit_subnet(): session_time(username, password, apic) gateway = request.form.get("gateway") get_gateway = GetGateway.find_gateways(gateway, apic_session, apic) return jsonify( {'data': render_template('map_subnet.html', object_list=get_gateway)})
def submit_encap(): """Find requested encap from user""" session_time(username, password, apic) encap = request.form.get("encap") get_policies = GetPolicies.map_policy_configurations( apic_session, apic, encap) return jsonify({ 'data': render_template('map_policies.html', object_list=get_policies) })
def submit_endpoint(): session_time(username, password, apic) endpoint = request.form.get("endpoint") try: ipaddress.IPv4Address(endpoint) get_endpoint = EpTracker.find_ip_endpoints(endpoint, apic_session, apic) get_reverse = EpTracker.find_mac_endpoints(get_endpoint[0], apic_session, apic) except ipaddress.AddressValueError: get_endpoint = EpTracker.find_mac_endpoints(endpoint, apic_session, apic) get_reverse = EpTracker.find_ip_endpoints(get_endpoint[0], apic_session, apic) return jsonify({ 'data': render_template('map_endpoint.html', object_list=get_endpoint, reverse=get_reverse) })
def find_encap(): """Gets ACI policies""" session_time(username, password, apic) return render_template('submit_encap.html')
def view_infra(): session_time(username, password, apic) get_infra_info = AciOps.infr(apic_session, apic) return render_template('infra.html', fabric_infra=get_infra_info)
def find_subnet(): session_time(username, password, apic) return render_template('submit_subnet.html')