from vpp_interface import VppInterface


class VppVhostInterface(VppInterface):
    """VPP vhost interface."""

    def __init__(
        self,
        test,
        sock_filename,
        is_server=0,
        renumber=0,
        disable_mrg_rxbuf=0,
        disable_indirect_desc=0,
        enable_gso=0,
        enable_packed_ring=0,
        enable_event_idx=0,
        custom_dev_instance=0xFFFFFFFF,
        use_custom_mac=0,
        mac_address="",
        tag="",
    ):
        """Create VPP Vhost interface"""
        super(VppVhostInterface, self).__init__(test)
        self.is_server = is_server
        self.sock_filename = sock_filename
        self.renumber = renumber
        self.disable_mrg_rxbuf = disable_mrg_rxbuf
        self.disable_indirect_desc = disable_indirect_desc
        self.enable_gso = enable_gso
        self.enable_packed_ring = enable_packed_ring
        self.enable_event_idx = enable_event_idx
        self.custom_dev_instance = custom_dev_instance
        self.use_custom_mac = use_custom_mac
        self.mac_address = mac_address
        self.tag = tag

    def add_vpp_config(self):
        r = self.test.vapi.create_vhost_user_if_v2(
            self.is_server,
            self.sock_filename,
            self.renumber,
            self.disable_mrg_rxbuf,
            self.disable_indirect_desc,
            self.enable_gso,
            self.enable_packed_ring,
            self.enable_event_idx,
            self.custom_dev_instance,
            self.use_custom_mac,
            self.mac_address,
            self.tag,
        )
        self.set_sw_if_index(r.sw_if_index)

    def remove_vpp_config(self):
        self.test.vapi.delete_vhost_user_if(self.sw_if_index)

    def is_interface_config_in_dump(self, dump):
        for i in dump:
            if i.sw_if_index == self.sw_if_index:
                return True
        else:
            return False
