def main(): data = yaml_ops.read_yaml("lag_data.yaml") if not data['switchip']: data['switchip'] = input("Switch IP Address: ") if data['bypassproxy']: os.environ['no_proxy'] = data['switchip'] os.environ['NO_PROXY'] = data['switchip'] base_url = "https://{0}/rest/{1}/".format(data['switchip'], data['version']) try: session_dict = dict(s=session.login(base_url, data['username'], data['password']), url=base_url) system_info_dict = system.get_system_info(**session_dict) platform_name = system_info_dict['platform_name'] # Create VLANs and L2 LAG; assign VLANs as trunk VLANs on LAG for l2_lag_data in data['l2_lags']: # Create VLANs for vlan_id in l2_lag_data['trunk_vlans']: vlan.create_vlan(vlan_id, "vlan%s" % vlan_id, **session_dict) # Create L2 LAG, add L2 ports to the LAG, and assign VLANs as trunk VLANs on the LAG lag.create_l2_lag_interface( l2_lag_data.get('name'), l2_lag_data.get('interfaces'), vlan_ids_list=l2_lag_data.get('trunk_vlans'), lacp_mode=l2_lag_data.get('lacp_mode'), mc_lag=l2_lag_data.get('mc_lag'), **session_dict) # Create L3 LAGs for l3_lag_data in data['l3_lags']: # Create L3 LAG and add L2 ports to the LAG lag.create_l3_lag_interface(l3_lag_data.get('name'), l3_lag_data.get('interfaces'), l3_lag_data.get('ipv4'), lacp_mode=l3_lag_data.get('lacp_mode'), desc=l3_lag_data.get('description'), **session_dict) except Exception as error: print('Ran into exception: {}. Logging out..'.format(error)) session.logout(**session_dict)
def main(): data = yaml_ops.read_yaml("evpn_vxlan_data.yaml") if not data['version']: data['version'] = "v1" # Setting up Spines for Fabric Infrastructure print("Setting up Spines for Fabric Infrastructure...") for spine_data in data['spines']: if data['bypassproxy']: os.environ['no_proxy'] = spine_data['mgmtip'] os.environ['NO_PROXY'] = spine_data['mgmtip'] base_url = "https://{0}/rest/{1}/".format(spine_data['mgmtip'], data['version']) try: print("Setting up Spine at %s" % spine_data['mgmtip']) session_dict = dict(s=session.login(base_url, spine_data['username'], spine_data['password']), url=base_url) # Create OSPFv2 ID ospf.create_ospf_id(spine_data['ospfvrf'], spine_data['ospfid'], **session_dict) # Create an OSPFv2 Area for OSPF ID ospf.create_ospf_area(spine_data['ospfvrf'], spine_data['ospfid'], spine_data['ospfarea'], **session_dict) # Create Loopback interface interface.create_loopback_interface( spine_data['loopbackinterface'], spine_data['ospfvrf'], spine_data['loopbackip'], **session_dict) ospf.create_ospf_interface(spine_data['ospfvrf'], spine_data['ospfid'], spine_data['ospfarea'], spine_data['loopbackinterface'], **session_dict) # Create downstream interfaces for downstream in spine_data['downstreaminterface']: interface.add_l3_ipv4_interface(downstream['interface'], downstream['ipaddress'], **session_dict) interface.enable_disable_interface(downstream['interface'], "up", **session_dict) # Attach downstream interface to OSPF ID ospf.create_ospf_interface(spine_data['ospfvrf'], spine_data['ospfid'], spine_data['ospfarea'], downstream['interface'], **session_dict) ospf.update_ospf_interface_type(spine_data['ospfvrf'], spine_data['ospfid'], downstream['interface'], spine_data['ospftype'], **session_dict) # Create BGP ASN and Router ID bgp.create_bgp_asn(spine_data['ospfvrf'], spine_data['bgpasn'], spine_data['bgprouterid'], **session_dict) # Set BGP Neighbors for neighbors in spine_data['neighborips']: bgp.create_bgp_neighbors( spine_data['ospfvrf'], spine_data['bgpasn'], neighbors, spine_data['addressfamilytype'], reflector=True, send_community=True, local_interface=spine_data['loopbackinterface'], **session_dict) except Exception as error: print('Ran into exception: {}. Logging out..'.format(error)) session.logout(**session_dict) # Setting up Leafs for Fabric Infrastructure print("Setting up Leafs for Fabric Infrastructure...") for leaf_data in data['leafs']: if data['bypassproxy']: os.environ['no_proxy'] = leaf_data['mgmtip'] os.environ['NO_PROXY'] = leaf_data['mgmtip'] base_url = "https://{0}/rest/{1}/".format(leaf_data['mgmtip'], data['version']) try: print("Setting up Leaf at %s" % leaf_data['mgmtip']) session_dict = dict(s=session.login(base_url, leaf_data['username'], leaf_data['password']), url=base_url) # Create OSPFv2 ID ospf.create_ospf_id(leaf_data['ospfvrf'], leaf_data['ospfid'], **session_dict) # Create an OSPFv2 Area for OSPF ID ospf.create_ospf_area(leaf_data['ospfvrf'], leaf_data['ospfid'], leaf_data['ospfarea'], **session_dict) # Create Loopback interface interface.create_loopback_interface(leaf_data['loopbackinterface'], leaf_data['ospfvrf'], leaf_data['loopbackip'], **session_dict) ospf.create_ospf_interface(leaf_data['ospfvrf'], leaf_data['ospfid'], leaf_data['ospfarea'], leaf_data['loopbackinterface'], **session_dict) # Create upstream interfaces for upstream in leaf_data['upstreaminterface']: interface.add_l3_ipv4_interface(upstream['interface'], upstream['ipaddress'], **session_dict) interface.enable_disable_interface(upstream['interface'], "up", **session_dict) # Attach upstream interface to OSPF ID ospf.create_ospf_interface(leaf_data['ospfvrf'], leaf_data['ospfid'], leaf_data['ospfarea'], upstream['interface'], **session_dict) ospf.update_ospf_interface_type(leaf_data['ospfvrf'], leaf_data['ospfid'], upstream['interface'], leaf_data['ospftype'], **session_dict) # Create BGP ASN and Router ID bgp.create_bgp_asn(leaf_data['ospfvrf'], leaf_data['bgpasn'], leaf_data['bgprouterid'], **session_dict) # Set BGP Neighbors for neighbors in leaf_data['neighborips']: bgp.create_bgp_neighbors( leaf_data['ospfvrf'], leaf_data['bgpasn'], neighbors, leaf_data['addressfamilytype'], reflector=False, send_community=True, local_interface=leaf_data['loopbackinterface'], **session_dict) # Create VLANs for vlan_id in leaf_data['vnivlans']: vlan.create_vlan(vlan_id, "VLAN%d" % vlan_id, **session_dict) # Create LAGs to Downstream Servers for lag_data in leaf_data['lagtoserver']: lag.create_l2_lag_interface(lag_data['name'], lag_data['interfaces'], lag_data['lacp_mode'], lag_data['mc_lag'], False, lag_data['trunk_vlans'], **session_dict) # Create VXLAN vxlan.create_vxlan_interface(leaf_data['vxlanname'], leaf_data['vxlanip'], **session_dict) # Map VNI to VLAN for vni_list in leaf_data['vnivlans']: vxlan.add_vni_mapping(vni_list, leaf_data['vxlanname'], vni_list, **session_dict) # Create EVPN instance evpn.create_evpn_instance(**session_dict) # Configure EVPN Routes for vlan_id in leaf_data['vnivlans']: evpn.add_evpn_vlan(vlan_id, **session_dict) except Exception as error: print('Ran into exception: {}. Logging out..'.format(error)) session.logout(**session_dict) # Setup Border Leaf print("Setting up Border Leaf...") border_data = data['borderleaf'][0] if data['bypassproxy']: os.environ['no_proxy'] = border_data['mgmtip'] os.environ['NO_PROXY'] = border_data['mgmtip'] base_url = "https://{0}/rest/{1}/".format(border_data['mgmtip'], data['version']) try: session_dict = dict(s=session.login(base_url, border_data['username'], border_data['password']), url=base_url) # Create VRF to Core vrf.add_vrf(border_data['vrftocore'], border_data['rd'], **session_dict) vrf.add_vrf_address_family(border_data['vrftocore'], border_data['addressfamilytype'], border_data['addressfamilyexports'], border_data['addressfamilyimports'], **session_dict) # Setup link to Core interface.add_l3_ipv4_interface( border_data['interfacetocore'], ip_address=border_data['interfacetocoreip'], vrf=border_data['vrftocore'], **session_dict) # Setup BGP to Core bgp.create_bgp_asn(border_data['vrftocore'], border_data['neighbortocoreasn'], **session_dict) bgp.create_bgp_neighbors(border_data['vrftocore'], border_data['neighbortocoreasn'], border_data['neighbortocoreip'], border_data['addressfamilytype'], reflector=False, send_community=False, **session_dict) # Configure Leaf VRF Routes and Address-family for tenants in border_data['tenantvrfs']: vrf.add_vrf(tenants['name'], tenants['rd'], **session_dict) vrf.add_vrf_address_family(tenants['name'], border_data['addressfamilytype'], tenants['addressfamilyexports'], tenants['addressfamilyimports'], **session_dict) bgp.create_bgp_asn(tenants['name'], border_data['bgpasn'], **session_dict) bgp.create_bgp_vrf(tenants['name'], border_data['bgpasn'], tenants['redistribute'], **session_dict) # Attach Leaf VRFs and give IP Addresses to VLANs for border_vlan in border_data['interfacevlans']: vlan.create_vlan_and_svi(border_vlan['vlanid'], "VLAN%d" % border_vlan['vlanid'], "vlan%d" % border_vlan['vlanid'], "vlan%d" % border_vlan['vlanid'], vlan_desc=None, ipv4=border_vlan['vlanip'], vrf_name=border_vlan['vlanvrf'], **session_dict) vsx.update_vsx_interface_vlan(border_vlan['vlanid'], False, [], border_vlan['activegatewaymac'], border_vlan['activegatewayip'], **session_dict) except Exception as error: print('Ran into exception: {}. Logging out..'.format(error)) session.logout(**session_dict)
def main(): data = yaml_ops.read_yaml("loop_protect_data.yaml") if not data['switchip']: data['switchip'] = input("Switch IP Address: ") if data['bypassproxy']: os.environ['no_proxy'] = data['switchip'] os.environ['NO_PROXY'] = data['switchip'] base_url = "https://{0}/rest/{1}/".format(data['switchip'], data['version']) try: session_dict = dict(s=session.login(base_url, data['username'], data['password']), url=base_url) # Create VLANs and L2 LAG; assign VLANs as trunk VLANs on LAG for l2_lag_data in data['lags']: # Create VLANs for vlan_id in l2_lag_data['trunk_vlans']: vlan.create_vlan(vlan_id, "vlan%s" % vlan_id, **session_dict) # Create L2 LAG and assign VLANs as trunk VLANs on the LAG lag.create_l2_lag_interface( data['lags'][0]['name'], data['lags'][0]['interfaces'], vlan_ids_list=data['lags'][0]['trunk_vlans'], lacp_mode=data['lags'][0]['lacp_mode'], mc_lag=data['lags'][0]['mc_lag'], **session_dict) # Add a new entry to the Port table if it doesn't yet exist interface.add_l2_interface(data['interfacename'], **session_dict) vlan.port_add_vlan_trunks(data['interfacename'], data['lags'][0]['trunk_vlans'], **session_dict) # Update the Interface table entry with "user-config": {"admin": "up"} interface.enable_disable_interface(data['interfacename'], **session_dict) # Enable Loop-protect on Interface loop_protect.update_port_loop_protect(data['interfacename'], action=None, vlan_list=[], **session_dict) # Enable Loop-protect for specific VLANs on Interface loop_protect.update_port_loop_protect( data['interfacename'], action=None, vlan_list=data['lags'][0]['trunk_vlans'], **session_dict) # Enable Loop-protect on LAG loop_protect.update_port_loop_protect(data['lags'][0]['name'], action=None, vlan_list=[], **session_dict) # Enable Loop-protect for specific VLANs on LAG loop_protect.update_port_loop_protect( data['lags'][0]['name'], action=None, vlan_list=data['lags'][0]['trunk_vlans'], **session_dict) # Update Loop-protect Actions on Interface loop_protect.update_port_loop_protect(data['interfacename'], action=data['interfaceaction'], vlan_list=None, **session_dict) # Update Loop-protect Actions on LAG loop_protect.update_port_loop_protect(l2_lag_data.get('name'), action=data['lagaction'], vlan_list=[], **session_dict) except Exception as error: print('Ran into exception: {}. Logging out..'.format(error)) session.logout(**session_dict)
data = getyaml.readyaml() for ip in data['ipadd']: baseurl = "https://{}/rest/v4/".format(ip) try: cookie_header = loginOS.login_os(data, baseurl) # --------------- Name the Ports --------------- # portname = data['port'] print('Port Information: {}'.format(portname)) for name in portname: ports.name_ports(baseurl, cookie_header, name) # --------------- Create Vlans tagged and untagged --------------- # vlandata = data['vlan'] for vlans in vlandata: print("Vlan to create \n", vlans) vlan.create_vlan(baseurl, cookie_header, vlans) # --------------- Get all Vlans --------------- # vlans = vlan.get_vlan(baseurl, cookie_header) print('Vlans in the system are: \n') for i in range(len(vlans['vlan_element'])): print("Vlan ID: {} and Vlan Name: {}".format( vlans['vlan_element'][i]['vlan_id'], vlans['vlan_element'][i]['name'])) # --------------- create LACP ports with trunk --------------- # lacpport = data['lacpport'] for i in range(len(lacpport)): ports.create_lacp_port(baseurl, cookie_header, lacpport[i]) # --------------- Get LACP ports with trunk --------------- # lacpports = ports.get_lacp_port(baseurl, cookie_header) for i in (range(len(lacpports['lacp_element']))): print("Port ID: {}, Trunk Group: {} ".format(
def main(): data = yaml_ops.read_yaml("acl_data.yaml") if not data['switchip']: data['switchip'] = input("Switch IP Address: ") if data['bypassproxy']: os.environ['no_proxy'] = data['switchip'] os.environ['NO_PROXY'] = data['switchip'] if not data['version']: data['version'] = "v10.04" base_url = "https://{0}/rest/{1}/".format(data['switchip'], data['version']) try: session_dict = dict(s=session.login(base_url, data['username'], data['password']), url=base_url) # Create empty IPv4 ACL acl.create_acl(data['ipv4aclname'], "ipv4", **session_dict) # Add entry 10 to IPv4 ACL acl.create_acl_entry(data['ipv4aclname'], "ipv4", 10, action="deny", count=data['hitcount'], ip_protocol=6, src_ip="10.1.2.1/255.255.255.0", **session_dict) # Add entry 20 to IPv4 ACL acl.create_acl_entry(data['ipv4aclname'], "ipv4", 20, action="deny", count=data['hitcount'], ip_protocol=17, dst_ip="10.33.12.3/255.255.255.255", dst_l4_port_min=80, dst_l4_port_max=80, **session_dict) # Add entry 30 to IPv4 ACL acl.create_acl_entry(data['ipv4aclname'], "ipv4", 30, action="permit", count=data['hitcount'], src_ip="10.2.4.2/255.255.255.255", dst_ip="10.33.25.34/255.255.255.0", **session_dict) # Add entry 40 to IPv4 ACL acl.create_acl_entry(data['ipv4aclname'], "ipv4", 40, action="deny", count=data['hitcount'], **session_dict) # Add entry 50 to IPv4 ACL acl.create_acl_entry(data['ipv4aclname'], "ipv4", 50, action="permit", count=data['hitcount'], **session_dict) # Version-up the IPv4 ACL to complete the change acl.update_acl(data['ipv4aclname'], "ipv4", **session_dict) # Create empty IPv6 ACL acl.create_acl(data['ipv6aclname'], "ipv6", **session_dict) # Add entry 10 to IPv6 ACL acl.create_acl_entry(data['ipv6aclname'], "ipv6", 10, action="deny", count=data['hitcount'], ip_protocol=6, dst_ip="22f4:23::1/ffff:ffff:ffff:ffff::", **session_dict) # Add entry 20 to IPv6 ACL acl.create_acl_entry(data['ipv6aclname'], "ipv6", 20, action="permit", count=data['hitcount'], ip_protocol=6, src_ip="3000:323:1221::88/ffff:ffff:ffff:ffff::", **session_dict) # Add entry 30 to IPv6 ACL acl.create_acl_entry( data['ipv6aclname'], "ipv6", 30, action="permit", count=data['hitcount'], ip_protocol=89, dst_ip= "3999:929:fa98:00f0::4/ffff:ffff:ffff:ffff:ffff:ffff:ffff:ff00", **session_dict) # Add entry 40 to IPv6 ACL acl.create_acl_entry(data['ipv6aclname'], "ipv6", 40, action="deny", count=data['hitcount'], **session_dict) # Add entry 50 to IPv6 ACL acl.create_acl_entry(data['ipv6aclname'], "ipv6", 50, action="permit", count=data['hitcount'], **session_dict) # Version-up the IPv6 ACL to complete the change acl.update_acl(data['ipv6aclname'], "ipv6", **session_dict) # Create empty MAC ACL acl.create_acl(data['macaclname'], "mac", **session_dict) # Add entry 10 to MAC ACL acl.create_acl_entry(data['macaclname'], "mac", 10, action="permit", count=data['hitcount'], ethertype=2054, src_mac="ff33.244c.aabb/ffff.ffff.ffff", **session_dict) # Add entry 20 to MAC ACL acl.create_acl_entry(data['macaclname'], "mac", 20, action="permit", count=data['hitcount'], ethertype=34525, src_mac="1f33.cc4c.aaff/ffff.ffff.ffff", dst_mac="ff33.244c.aa11/ffff.ffff.ffff", **session_dict) # Add entry 30 to MAC ACL acl.create_acl_entry(data['macaclname'], "mac", 30, action="permit", count=data['hitcount'], ethertype=35020, src_mac="1f33.cc4c.aaff/ffff.ffff.ffff", dst_mac="ff33.244c.aa11/ffff.ffff.ffff", **session_dict) # Add entry 40 to MAC ACL acl.create_acl_entry(data['macaclname'], "mac", 40, action="permit", count=data['hitcount'], ethertype=32923, src_mac="1f33.cc4c.aaff/ffff.ffff.ffff", dst_mac="ff33.244c.aa11/ffff.ffff.ffff", **session_dict) # Add entry 50 to MAC ACL acl.create_acl_entry(data['macaclname'], "mac", 50, action="deny", count=data['hitcount'], **session_dict) # Version-up the ACL to complete the change acl.update_acl(data['macaclname'], "mac", **session_dict) # Create VLAN and L2 System interfaces interface.add_l2_interface(data['interfaceVLAN'], **session_dict) interface.enable_disable_interface(data['interfaceVLAN'], "up", **session_dict) interface.add_l2_interface(data['ipv4L2ingressinterface'], **session_dict) interface.enable_disable_interface(data['ipv4L2ingressinterface'], "up", **session_dict) vlan.port_set_vlan_mode(data['ipv4L2ingressinterface'], "native-tagged", **session_dict) vlan.port_add_vlan_trunks(data['ipv4L2ingressinterface'], **session_dict) interface.add_l2_interface(data['ipv6L2ingressinterface'], **session_dict) interface.enable_disable_interface(data['ipv6L2ingressinterface'], "up", **session_dict) vlan.port_set_vlan_mode(data['ipv6L2ingressinterface'], "native-tagged", **session_dict) vlan.port_add_vlan_trunks(data['ipv6L2ingressinterface'], **session_dict) # Create LAG Interfaces for LAGinterface in data['LAGinterfaces']: interface.add_l2_interface(LAGinterface, **session_dict) interface.enable_disable_interface(LAGinterface, "up", **session_dict) # Create L3 interface interface.add_l3_ipv4_interface(data['L3egressinterface'], **session_dict) interface.enable_disable_interface(data['L3egressinterface'], "up", **session_dict) # Create LAG interfaces lag.create_l2_lag_interface(data['LAGname'], data['LAGinterfaces'], **session_dict) # Create VLAN vlan.create_vlan(data['aclVLANid'], "vlan%d" % data['aclVLANid'], **session_dict) # Attach the ACL to VLAN vlan.attach_vlan_acl(data['aclVLANid'], data['ipv4aclname'], "ipv4", **session_dict) # Attach VLAN to interface vlan.port_set_vlan_mode(data['interfaceVLAN'], "native-tagged", **session_dict) vlan.port_add_vlan_trunks(data['interfaceVLAN'], [data['aclVLANid']], **session_dict) # Apply IPv4 ACL to L2 interface on ingress acl.update_port_acl_in(data['ipv4L2ingressinterface'], data['ipv4aclname'], 'ipv4', **session_dict) # Apply IPv6 ACL to L2 interface on ingress acl.update_port_acl_in(data['ipv6L2ingressinterface'], data['ipv6aclname'], 'ipv6', **session_dict) # Apply IPv4 ACL to L3 interface on egress acl.update_port_acl_out(data['L3egressinterface'], data['ipv4aclname'], **session_dict) # Apply IPv4 ACL to L2 LAG on ingress acl.update_port_acl_in(data['LAGname'], data['ipv4aclname'], 'ipv4', **session_dict) except Exception as error: print('Ran into exception: {}. Logging out..'.format(error)) session.logout(**session_dict)
def main(): data = yaml_ops.read_yaml("access_security_data.yaml") if not data['switchip']: data['switchip'] = input("Switch IP Address: ") if data['bypassproxy']: os.environ['no_proxy'] = data['switchip'] os.environ['NO_PROXY'] = data['switchip'] base_url = "https://{0}/rest/{1}/".format(data['switchip'], data['version']) try: session_dict = dict(s=session.login(base_url, data['username'], data['password']), url=base_url) system_info_dict = system.get_system_info(**session_dict) platform_name = system_info_dict['platform_name'] # Only execute workflow if the platform is in the 6xxx series if platform_name.startswith("6"): # Configure RADIUS server host access_security.create_radius_host_config( data['radius_server_host']['vrf'], data['radius_server_host']['hostname'], passkey=data['radius_server_host']['passkey'], **session_dict) # Enable 802.1x globally access_security.enable_disable_dot1x_globally(enable=True, **session_dict) # Create L2 interface interface.add_l2_interface(data['802.1x']['port'], **session_dict) # Configure 802.1x on the L2 interface access_security.configure_dot1x_interface( data['802.1x']['port'], auth_enable=data['802.1x']['auth_enable'], cached_reauth_enable=data['802.1x']['cached_reauth_enable'], cached_reauth_period=data['802.1x']['cached_reauth_period'], discovery_period=data['802.1x']['discovery_period'], eapol_timeout=data['802.1x']['eapol_timeout'], max_requests=data['802.1x']['max_requests'], max_retries=data['802.1x']['max_retries'], quiet_period=data['802.1x']['quiet_period'], reauth_enable=data['802.1x']['reauth_enable'], reauth_period=data['802.1x']['reauth_period'], **session_dict) # Enable MAC authentication globally access_security.enable_disable_mac_auth_globally(enable=True, **session_dict) # Create L2 interface interface.add_l2_interface(data['mac_auth']['port'], **session_dict) # Configure MAC authentication on the L2 interface access_security.configure_mac_auth_interface( data['mac_auth']['port'], auth_enable=data['mac_auth']['auth_enable'], cached_reauth_enable=data['mac_auth']['cached_reauth_enable'], cached_reauth_period=data['mac_auth']['cached_reauth_period'], quiet_period=data['mac_auth']['quiet_period'], reauth_enable=data['mac_auth']['reauth_enable'], reauth_period=data['mac_auth']['reauth_period'], **session_dict) # Enable port security globally access_security.enable_disable_port_security_globally( enable=True, **session_dict) # Create reserved VLAN for tunneled clients vlan.create_vlan(data['vlan']['id'], data['vlan']['name'], **session_dict) # Set reserved VLAN for tunneled clients access_security.set_ubt_client_vlan(data['vlan']['id'], **session_dict) # Create user-based-tunneling (UBT) zone access_security.create_ubt_zone( data['zone']['name'], data['zone']['vrf_name'], enable=data['zone']['enable'], pri_ctrlr_ip_addr=data['zone']['pri_ctrlr_ip_addr'], sac_heartbeat_interval=data['zone']['sac_heartbeat_interval'], uac_keepalive_interval=data['zone']['uac_keepalive_interval'], **session_dict) # Create port access role access_security.create_port_access_role( data['role']['name'], gateway_zone=data['role']['gateway_zone'], ubt_gateway_role=data['role']['ubt_gateway_role'], vlan_mode=data['role']['vlan_mode'], vlan_tag=data['role']['vlan_tag'], **session_dict) # Create L2 interface interface.add_l2_interface(data['client_port']['port'], **session_dict) # Enable MAC authentication on client port access_security.configure_mac_auth_interface( data['client_port']['port'], auth_enable=data['client_port']['auth_enable'], reauth_enable=data['client_port']['reauth_enable'], cached_reauth_enable=data['client_port'] ['cached_reauth_enable'], **session_dict) # Set maximum limit of allowable authorized clients on the client port access_security.set_port_access_clients_limit( data['client_port']['port'], data['client_port']['clients_limit'], **session_dict) # Set source IP address for UBT access_security.set_source_ip_ubt( data['ubt_source_ip']['vrf_name'], data['ubt_source_ip']['ip_addr'], **session_dict) else: print("This workflow only applies to access platforms!") except Exception as error: print('Ran into exception: {}. Logging out..'.format(error)) session.logout(**session_dict)