def set_det44_interface(node, if_key, is_inside): """Enable DET44 feature on the interface. :param node: DUT node. :param if_key: Interface key from topology file of interface to enable DET44 feature on. :param is_inside: True if interface is inside, False if outside. :type node: dict :type if_key: str :type is_inside: bool """ cmd = u"det44_interface_add_del_feature" err_msg = f"Failed to enable DET44 feature on the interface {if_key} " \ f"on the host {node[u'host']}!" args_in = dict( is_add=True, is_inside=is_inside, sw_if_index=Topology.get_interface_sw_index(node, if_key) ) with PapiSocketExecutor(node) as papi_exec: papi_exec.add(cmd, **args_in).get_reply(err_msg)
def vpp_ipsec_spd_add_if(node, spd_id, interface): """Add interface to the Security Policy Database. :param node: VPP node. :param spd_id: SPD ID to add interface on. :param interface: Interface name or sw_if_index. :type node: dict :type spd_id: int :type interface: str or int """ sw_if_index = Topology.get_interface_sw_index(node, interface)\ if isinstance(interface, basestring) else interface out = VatExecutor.cmd_from_template( node, "ipsec/ipsec_interface_add_spd.vat", spd_id=spd_id, sw_if_id=sw_if_index) VatJsonUtil.verify_vat_retval( out[0], err_msg='Add interface {0} to SPD {1} failed on {2}'.format( interface, spd_id, node['host']))
def create_vlan_subinterface(node, interface, vlan): """Create VLAN subinterface on node. :param node: Node to add VLAN subinterface on. :param interface: Interface name on which create VLAN subinterface. :param vlan: VLAN ID of the subinterface to be created. :type node: dict :type interface: str :type vlan: int :returns: Name and index of created subinterface. :rtype: tuple :raises RuntimeError: if it is unable to create VLAN subinterface on the node. """ iface_key = Topology.get_interface_by_name(node, interface) sw_if_index = Topology.get_interface_sw_index(node, iface_key) output = VatExecutor.cmd_from_template(node, "create_vlan_subif.vat", sw_if_index=sw_if_index, vlan=vlan) if output[0]["retval"] == 0: sw_subif_idx = output[0]["sw_if_index"] logger.trace( 'VLAN subinterface with sw_if_index {} and VLAN ID {} ' 'created on node {}'.format(sw_subif_idx, vlan, node['host'])) if_key = Topology.add_new_port(node, "vlan_subif") Topology.update_interface_sw_if_index(node, if_key, sw_subif_idx) ifc_name = InterfaceUtil.vpp_get_interface_name(node, sw_subif_idx) Topology.update_interface_name(node, if_key, ifc_name) else: raise RuntimeError( 'Unable to create VLAN subinterface on node {}'.format( node['host'])) with VatTerminal(node, False) as vat: vat.vat_terminal_exec_cmd('exec show interfaces') return '{}.{}'.format(interface, vlan), sw_subif_idx
def add_ip_neighbor(node, interface, ip_address, mac_address): """Add IP neighbor. :param node: VPP node to add ip neighbor. :param interface: Interface name or sw_if_index. :param ip_address: IP address. :param mac_address: MAC address. :type node: dict :type interface: str or int :type ip_address: str :type mac_address: str """ if isinstance(interface, basestring): sw_if_index = Topology.get_interface_sw_index(node, interface) else: sw_if_index = interface with VatTerminal(node) as vat: vat.vat_terminal_exec_cmd_from_template("add_ip_neighbor.vat", sw_if_index=sw_if_index, ip_address=ip_address, mac_address=mac_address)
def vpp_enable_input_acl_interface(node, interface, ip_version, table_index): """Enable input acl on interface. :param node: VPP node to setup interface for input acl. :param interface: Interface to setup input acl. :param ip_version: Version of IP protocol. :param table_index: Classify table index. :type node: dict :type interface: str or int :type ip_version: str :type table_index: int """ if isinstance(interface, basestring): sw_if_index = Topology.get_interface_sw_index(node, interface) else: sw_if_index = interface with VatTerminal(node) as vat: vat.vat_terminal_exec_cmd_from_template("input_acl_int.vat", sw_if_index=sw_if_index, ip_version=ip_version, table_index=table_index)
def enable_interface_geneve_bypass(node, interface, is_ipv6=False): """Add ipv4/ipv6-geneve-bypass graph node for a given interface on the specified VPP node. :param node: Topology node. :param interface: Interface key from topology file of interface to add geneve bypass node for. :param is_ipv6: Enable ipv6-geneve-bypass graph node if True else enable ipv4-geneve-bypass graph node. :type node: dict :type interface: str :type is_ipv6: bool """ cmd = u"sw_interface_set_geneve_bypass" args = dict(is_ipv6=is_ipv6, enable=True, sw_if_index=Topology.get_interface_sw_index( node, interface)) err_msg = ( f"Failed to enable {u'ipv6' if is_ipv6 else u'ipv4'}-geneve-bypass " f"on interface {interface} on host {node[u'host']}!") with PapiSocketExecutor(node) as papi_exec: papi_exec.add(cmd, **args).get_reply(err_msg)
def l2_vlan_tag_rewrite(node, interface, tag_rewrite_method, push_dot1q=True, tag1_id=None, tag2_id=None): """Rewrite tags in ethernet frame. :param node: Node to rewrite tags. :param interface: Interface on which rewrite tags. :param tag_rewrite_method: Method of tag rewrite. :param push_dot1q: Optional parameter to disable to push dot1q tag instead of dot1ad. :param tag1_id: Optional tag1 ID for VLAN. :param tag2_id: Optional tag2 ID for VLAN. :type node: dict :type interface: str or int :type tag_rewrite_method: str :type push_dot1q: bool :type tag1_id: int :type tag2_id: int """ push_dot1q = 'push_dot1q 0' if not push_dot1q else '' tag1_id = 'tag1 {0}'.format(tag1_id) if tag1_id else '' tag2_id = 'tag2 {0}'.format(tag2_id) if tag2_id else '' if isinstance(interface, basestring): iface_key = Topology.get_interface_by_name(node, interface) sw_if_index = Topology.get_interface_sw_index(node, iface_key) else: sw_if_index = interface with VatTerminal(node) as vat: vat.vat_terminal_exec_cmd_from_template("l2_vlan_tag_rewrite.vat", sw_if_index=sw_if_index, tag_rewrite_method= tag_rewrite_method, push_dot1q=push_dot1q, tag1_optional=tag1_id, tag2_optional=tag2_id)
def set_acl_list_for_interface(node, interface, acl_type, acl_idx=None): """Set the list of input or output ACLs applied to the interface. It unapplies any previously applied ACLs. :param node: VPP node to set ACL on. :param interface: Interface name or sw_if_index. :param acl_type: Type of ACL(s) - input or output. :param acl_idx: Index(ies) of ACLs to be applied on the interface. :type node: dict :type interface: str or int :type acl_type: str :type acl_idx: list """ if isinstance(interface, basestring): sw_if_index = Topology.get_interface_sw_index(node, interface) else: sw_if_index = int(interface) acls = acl_idx if isinstance(acl_idx, list) else list() Classify._acl_interface_set_acl_list(node=node, sw_if_index=sw_if_index, acl_type=acl_type, acls=acls)
def vpp_flow_disable(node, interface, flow_index=0): """Flow disable. :param node: DUT node. :param interface: Interface sw_if_index. :param flow_index: Flow index. :type node: dict :type interface: int :type flow_index: int :returns: Nothing. """ from vpp_papi import VppEnum cmd = u"flow_disable" sw_if_index = Topology.get_interface_sw_index(node, interface) args = dict( flow_index=int(flow_index), hw_if_index=int(sw_if_index) ) err_msg = u"Failed to disable flow on host {node[u'host']}" with PapiSocketExecutor(node) as papi_exec: papi_exec.add(cmd, **args).get_reply(err_msg)
def set_dhcp_client_on_interface(vpp_node, interface, hostname=None): """Set DHCP client on interface. :param vpp_node: VPP node to set DHCP client on. :param interface: Interface name to set DHCP client on. :param hostname: Hostname used in DHCP DISCOVER. :type vpp_node: dict :type interface: str :type hostname: str :raises RuntimeError: If unable to set DHCP client on interface. """ sw_if_index = Topology.get_interface_sw_index(vpp_node, interface) interface = 'sw_if_index {}'.format(sw_if_index) hostname = 'hostname {}'.format(hostname) if hostname else '' output = VatExecutor.cmd_from_template(vpp_node, "dhcp_client.vat", interface=interface, hostname=hostname) output = output[0] if output["retval"] != 0: raise RuntimeError('Unable to set DHCP client on node {} and' ' interface {}.' .format(vpp_node, interface))
def create_subinterface(node, interface, sub_id, outer_vlan_id=None, inner_vlan_id=None, type_subif=None): """Create sub-interface on node. It is possible to set required sub-interface type and VLAN tag(s). :param node: Node to add sub-interface. :param interface: Interface name on which create sub-interface. :param sub_id: ID of the sub-interface to be created. :param outer_vlan_id: Optional outer VLAN ID. :param inner_vlan_id: Optional inner VLAN ID. :param type_subif: Optional type of sub-interface. Values supported by VPP: [no_tags] [one_tag] [two_tags] [dot1ad] [exact_match] [default_sub] :type node: dict :type interface: str or int :type sub_id: int :type outer_vlan_id: int :type inner_vlan_id: int :type type_subif: str :returns: Name and index of created sub-interface. :rtype: tuple :raises RuntimeError: If it is not possible to create sub-interface. """ outer_vlan_id = 'outer_vlan_id {0}'.format(outer_vlan_id)\ if outer_vlan_id else '' inner_vlan_id = 'inner_vlan_id {0}'.format(inner_vlan_id)\ if inner_vlan_id else '' if type_subif is None: type_subif = '' if isinstance(interface, basestring): iface_key = Topology.get_interface_by_name(node, interface) sw_if_index = Topology.get_interface_sw_index(node, iface_key) else: sw_if_index = interface output = VatExecutor.cmd_from_template(node, "create_sub_interface.vat", sw_if_index=sw_if_index, sub_id=sub_id, outer_vlan_id=outer_vlan_id, inner_vlan_id=inner_vlan_id, type_subif=type_subif) if output[0]["retval"] == 0: sw_subif_idx = output[0]["sw_if_index"] logger.trace('Created subinterface with index {}' .format(sw_subif_idx)) if_key = Topology.add_new_port(node, "subinterface") Topology.update_interface_sw_if_index(node, if_key, sw_subif_idx) ifc_name = InterfaceUtil.vpp_get_interface_name(node, sw_subif_idx) Topology.update_interface_name(node, if_key, ifc_name) else: raise RuntimeError('Unable to create sub-interface on node {}' .format(node['host'])) with VatTerminal(node, json_param=False) as vat: vat.vat_terminal_exec_cmd('exec show interfaces') name = '{}.{}'.format(interface, sub_id) return name, sw_subif_idx
def vpp_route_add(node, network, prefix_len, gateway=None, interface=None, use_sw_index=True, resolve_attempts=10, count=1, vrf=None, lookup_vrf=None, multipath=False, weight=None): """Add route to the VPP node. :param node: Node to add route on. :param network: Route destination network address. :param prefix_len: Route destination network prefix length. :param gateway: Route gateway address. :param interface: Route interface. :param vrf: VRF table ID (Optional). :param use_sw_index: Use sw_if_index in VAT command. :param resolve_attempts: Resolve attempts IP route add parameter. :param count: number of IP addresses to add starting from network IP with same prefix (increment is 1). If None, then is not used. :param lookup_vrf: VRF table ID for lookup. :param multipath: Enable multipath routing. :param weight: Weight value for unequal cost multipath routing. :type node: dict :type network: str :type prefix_len: int :type gateway: str :type interface: str :type use_sw_index: bool :type resolve_attempts: int :type count: int :type vrf: int :type lookup_vrf: int :type multipath: bool :type weight: int """ if use_sw_index: int_cmd = ('sw_if_index {}'.format( Topology.get_interface_sw_index(node, interface))) else: int_cmd = interface rap = 'resolve-attempts {}'.format(resolve_attempts) \ if resolve_attempts else '' via = 'via {}'.format(gateway) if gateway else '' cnt = 'count {}'.format(count) \ if count else '' vrf = 'vrf {}'.format(vrf) if vrf else '' lookup_vrf = 'lookup-in-vrf {}'.format( lookup_vrf) if lookup_vrf else '' multipath = 'multipath' if multipath else '' weight = 'weight {}'.format(weight) if weight else '' with VatTerminal(node, json_param=False) as vat: vat.vat_terminal_exec_cmd_from_template('add_route.vat', network=network, prefix_length=prefix_len, via=via, vrf=vrf, interface=int_cmd, resolve_attempts=rap, count=cnt, lookup_vrf=lookup_vrf, multipath=multipath, weight=weight)
def vpp_put_vxlan_and_vlan_interfaces_to_bridge_domain( node, node_vxlan_if, vxlan_count, op_node, op_node_if, dst_ip_start, ip_step, bd_id_start): """ Configure ARPs and routes for VXLAN interfaces and put each pair of VXLAN tunnel interface and VLAN sub-interface to separate bridge-domain. :param node: VPP node. :param node_vxlan_if: VPP node interface key where VXLAN tunnel interfaces have been created. :param vxlan_count: Number of tunnel interfaces. :param op_node: Opposite VPP node for VXLAN tunnel interfaces. :param op_node_if: Opposite VPP node interface key for VXLAN tunnel interfaces. :param dst_ip_start: VXLAN tunnel destination IP address start. :param ip_step: IP address incremental step. :param bd_id_start: Bridge-domain ID start. :type node: dict :type node_vxlan_if: str :type vxlan_count: int :type op_node: dict :type op_node_if: :type dst_ip_start: str :type ip_step: int :type bd_id_start: int """ dst_ip_start = ip_address(dst_ip_start) if vxlan_count > 1: idx_vxlan_if = Topology.get_interface_sw_index(node, node_vxlan_if) commands = list() for i in range(0, vxlan_count): dst_ip = dst_ip_start + i * ip_step commands.append( f"exec ip neighbor " f"{Topology.get_interface_name(node, node_vxlan_if)} " f"{dst_ip} " f"{Topology.get_interface_mac(op_node, op_node_if)} static " f"\n" ) commands.append( f"ip_route_add_del " f"{dst_ip}/{128 if dst_ip.version == 6 else 32} count 1 " f"via {dst_ip} sw_if_index {idx_vxlan_if}\n" ) sw_idx_vxlan = Topology.get_interface_sw_index( node, f"vxlan_tunnel{i + 1}" ) commands.append( f"sw_interface_set_l2_bridge sw_if_index {sw_idx_vxlan} " f"bd_id {bd_id_start + i} shg 0 enable\n" ) sw_idx_vlan = Topology.get_interface_sw_index( node, f"vlan_subif{i + 1}" ) commands.append( f"sw_interface_set_l2_bridge sw_if_index {sw_idx_vlan} " f"bd_id {bd_id_start + i} shg 0 enable\n" ) VatExecutor().write_and_execute_script( node, u"/tmp/configure_routes_and_bridge_domains.config", commands ) return cmd1 = u"ip_neighbor_add_del" neighbor = dict( sw_if_index=Topology.get_interface_sw_index(node, node_vxlan_if), flags=0, mac_address=Topology.get_interface_mac(op_node, op_node_if), ip_address=u"" ) args1 = dict( is_add=1, neighbor=neighbor ) cmd2 = u"ip_route_add_del" kwargs = dict( interface=node_vxlan_if, gateway=str(dst_ip_start) ) route = IPUtil.compose_vpp_route_structure( node, str(dst_ip_start), 128 if dst_ip_start.version == 6 else 32, **kwargs ) args2 = dict( is_add=1, is_multipath=0, route=route ) cmd3 = u"sw_interface_set_l2_bridge" args3 = dict( rx_sw_if_index=None, bd_id=None, shg=0, port_type=0, enable=1 ) args4 = dict( rx_sw_if_index=None, bd_id=None, shg=0, port_type=0, enable=1 ) with PapiSocketExecutor(node) as papi_exec: for i in range(0, vxlan_count): args1[u"neighbor"][u"ip_address"] = \ str(dst_ip_start + i * ip_step) args2[u"route"][u"prefix"][u"address"][u"un"] = \ IPAddress.union_addr(dst_ip_start + i * ip_step) args2[u"route"][u"paths"][0][u"nh"][u"address"] = \ IPAddress.union_addr(dst_ip_start + i * ip_step) args3[u"rx_sw_if_index"] = Topology.get_interface_sw_index( node, f"vxlan_tunnel{i+1}" ) args3[u"bd_id"] = int(bd_id_start+i) args4[u"rx_sw_if_index"] = Topology.get_interface_sw_index( node, f"vlan_subif{i+1}" ) args4[u"bd_id"] = int(bd_id_start+i) history = bool(not 1 < i < vxlan_count - 1) papi_exec.add(cmd1, history=history, **args1). \ add(cmd2, history=history, **args2). \ add(cmd3, history=history, **args3). \ add(cmd3, history=history, **args4) papi_exec.get_replies()
def vpp_create_vxlan_and_vlan_interfaces(node, node_vxlan_if, node_vlan_if, vxlan_count, vni_start, src_ip_start, dst_ip_start, ip_step): """ Configure IPs, create VXLAN interfaces and VLAN sub-interfaces on VPP node. :param node: VPP node. :param node_vxlan_if: VPP node interface key to create VXLAN tunnel interfaces. :param node_vlan_if: VPP node interface key to create VLAN sub-interface. :param vxlan_count: Number of tunnel interfaces to create. :param vni_start: VNI start ID. :param src_ip_start: VXLAN tunnel source IP address start. :param dst_ip_start: VXLAN tunnel destination IP address start. :param ip_step: IP address incremental step. :type node: dict :type node_vxlan_if: str :type node_vlan_if: str :type vxlan_count: int :type vni_start: int :type src_ip_start: str :type dst_ip_start: str :type ip_step: int :returns: Number of created VXLAN interfaces. :rtype: int """ src_ip_addr_start = ip_address(unicode(src_ip_start)) dst_ip_addr_start = ip_address(unicode(dst_ip_start)) if vxlan_count > 10: commands = list() tmp_fn = '/tmp/create_vxlan_interfaces.config' for i in xrange(0, vxlan_count): try: src_ip = src_ip_addr_start + i * ip_step dst_ip = dst_ip_addr_start + i * ip_step except AddressValueError: logger.warn("Can't do more iterations - IP address limit " "has been reached.") vxlan_count = i break commands.append( 'sw_interface_add_del_address sw_if_index {sw_idx} ' '{ip}/{ip_len}\n'.format( sw_idx=Topology.get_interface_sw_index( node, node_vxlan_if), ip=src_ip, ip_len=128 if src_ip.version == 6 else 32)) commands.append( 'vxlan_add_del_tunnel src {srcip} dst {dstip} vni {vni}\n'\ .format(srcip=src_ip, dstip=dst_ip, vni=vni_start + i)) commands.append( 'create_vlan_subif sw_if_index {sw_idx} vlan {vlan}\n'\ .format(sw_idx=Topology.get_interface_sw_index( node, node_vlan_if), vlan=i + 1)) VatExecutor().write_and_execute_script(node, tmp_fn, commands) return vxlan_count cmd1 = 'sw_interface_add_del_address' args1 = dict( sw_if_index=InterfaceUtil.get_interface_index(node, node_vxlan_if), is_add=1, is_ipv6=1 if src_ip_addr_start.version == 6 else 0, del_all=0, address_length=128 if src_ip_addr_start.version == 6 else 32, address=None) cmd2 = 'vxlan_add_del_tunnel' args2 = dict(is_add=1, is_ipv6=0, instance=Constants.BITWISE_NON_ZERO, src_address=None, dst_address=None, mcast_sw_if_index=Constants.BITWISE_NON_ZERO, encap_vrf_id=0, decap_next_index=Constants.BITWISE_NON_ZERO, vni=None) cmd3 = 'create_vlan_subif' args3 = dict(sw_if_index=InterfaceUtil.get_interface_index( node, node_vlan_if), vlan_id=None) err_msg = 'Failed to create VXLAN and VLAN interfaces on host {host}'.\ format(host=node['host']) with PapiExecutor(node) as papi_exec: for i in xrange(0, vxlan_count): try: src_ip = src_ip_addr_start + i * ip_step dst_ip = dst_ip_addr_start + i * ip_step except AddressValueError: logger.warn("Can't do more iterations - IP address limit " "has been reached.") vxlan_count = i break args1['address'] = src_ip.packed args2['src_address'] = src_ip.packed args2['dst_address'] = dst_ip.packed args2['vni'] = int(vni_start) + i args3['vlan_id'] = i + 1 history = False if 1 < i < vxlan_count else True papi_exec.add(cmd1, history=history, **args1).\ add(cmd2, history=history, **args2).\ add(cmd3, history=history, **args3) if i > 0 and i % (Constants.PAPI_MAX_API_BULK / 3) == 0: papi_exec.get_replies(err_msg) papi_exec.get_replies() return vxlan_count
def vpp_put_vxlan_and_vlan_interfaces_to_bridge_domain( node, node_vxlan_if, vxlan_count, op_node, op_node_if, dst_ip_start, ip_step, bd_id_start): """ Configure ARPs and routes for VXLAN interfaces and put each pair of VXLAN tunnel interface and VLAN sub-interface to separate bridge-domain. :param node: VPP node. :param node_vxlan_if: VPP node interface key where VXLAN tunnel interfaces have been created. :param vxlan_count: Number of tunnel interfaces. :param op_node: Opposite VPP node for VXLAN tunnel interfaces. :param op_node_if: Opposite VPP node interface key for VXLAN tunnel interfaces. :param dst_ip_start: VXLAN tunnel destination IP address start. :param ip_step: IP address incremental step. :param bd_id_start: Bridge-domain ID start. :type node: dict :type node_vxlan_if: str :type vxlan_count: int :type op_node: dict :type op_node_if: :type dst_ip_start: str :type ip_step: int :type bd_id_start: int """ dst_ip_addr_start = ip_address(unicode(dst_ip_start)) if vxlan_count > 1: sw_idx_vxlan = Topology.get_interface_sw_index(node, node_vxlan_if) tmp_fn = '/tmp/configure_routes_and_bridge_domains.config' commands = list() for i in xrange(0, vxlan_count): dst_ip = dst_ip_addr_start + i * ip_step commands.append( 'ip_neighbor_add_del sw_if_index {sw_idx} dst {ip} ' 'mac {mac}\n'.format(sw_idx=sw_idx_vxlan, ip=dst_ip, mac=Topology.get_interface_mac( op_node, op_node_if))) commands.append( 'ip_route_add_del {ip}/{ip_len} count 1 via {ip} ' 'sw_if_index {sw_idx}\n'.format( ip=dst_ip, ip_len=128 if dst_ip.version == 6 else 32, sw_idx=sw_idx_vxlan)) commands.append( 'sw_interface_set_l2_bridge sw_if_index {sw_idx} ' 'bd_id {bd_id} shg 0 enable\n'.format( sw_idx=Topology.get_interface_sw_index( node, 'vxlan_tunnel{nr}'.format(nr=i + 1)), bd_id=bd_id_start + i)) commands.append( 'sw_interface_set_l2_bridge sw_if_index {sw_idx} ' 'bd_id {bd_id} shg 0 enable\n'.format( sw_idx=Topology.get_interface_sw_index( node, 'vlan_subif{nr}'.format(nr=i + 1)), bd_id=bd_id_start + i)) VatExecutor().write_and_execute_script(node, tmp_fn, commands) return cmd1 = 'ip_neighbor_add_del' neighbor = dict( sw_if_index=Topology.get_interface_sw_index(node, node_vxlan_if), flags=0, mac_address=Topology.get_interface_mac(op_node, op_node_if), ip_address='') args1 = dict(is_add=1, neighbor=neighbor) cmd2 = 'ip_route_add_del' kwargs = dict(interface=node_vxlan_if, gateway=str(dst_ip_addr_start)) route = IPUtil.compose_vpp_route_structure( node, str(dst_ip_addr_start), 128 if dst_ip_addr_start.version == 6 else 32, **kwargs) args2 = dict(is_add=1, is_multipath=0, route=route) cmd3 = 'sw_interface_set_l2_bridge' args3 = dict(rx_sw_if_index=None, bd_id=None, shg=0, port_type=0, enable=1) args4 = dict(rx_sw_if_index=None, bd_id=None, shg=0, port_type=0, enable=1) err_msg = 'Failed to put VXLAN and VLAN interfaces to bridge domain ' \ 'on host {host}'.format(host=node['host']) with PapiExecutor(node) as papi_exec: for i in xrange(0, vxlan_count): dst_ip = dst_ip_addr_start + i * ip_step args1['neighbor']['ip_address'] = str(dst_ip) args2['route']['prefix']['address']['un'] = \ IPUtil.union_addr(dst_ip) args2['route']['paths'][0]['nh']['address'] = \ IPUtil.union_addr(dst_ip) args3['rx_sw_if_index'] = Topology.get_interface_sw_index( node, 'vxlan_tunnel{nr}'.format(nr=i + 1)) args3['bd_id'] = int(bd_id_start + i) args4['rx_sw_if_index'] = Topology.get_interface_sw_index( node, 'vlan_subif{nr}'.format(nr=i + 1)) args4['bd_id'] = int(bd_id_start + i) history = False if 1 < i < vxlan_count else True papi_exec.add(cmd1, history=history, **args1). \ add(cmd2, history=history, **args2). \ add(cmd3, history=history, **args3). \ add(cmd3, history=history, **args4) if i > 0 and i % (Constants.PAPI_MAX_API_BULK / 4) == 0: papi_exec.get_replies(err_msg) papi_exec.get_replies()