Esempio n. 1
0
    def test_memif_create_custom_socket(self):
        """ Memif create with non-default socket filename """

        memif_sockets = []
        # existing path
        memif_sockets.append(
            VppSocketFilename(
                self, 1, b"%s/memif1.sock" %
                six.ensure_binary(self.tempdir, encoding='utf-8')))
        # default path (test tempdir)
        memif_sockets.append(
            VppSocketFilename(self, 2, b"memif2.sock",
                              add_default_folder=True))
        # create new folder in default folder
        memif_sockets.append(
            VppSocketFilename(self,
                              3,
                              b"sock/memif3.sock",
                              add_default_folder=True))

        memif = VppMemif(self, MEMIF_ROLE.SLAVE, MEMIF_MODE.ETHERNET)

        for sock in memif_sockets:
            sock.add_vpp_config()
            memif.socket_id = sock.socket_id
            memif.role = MEMIF_ROLE.SLAVE
            self._create_delete_test_one_interface(memif)
            memif.role = MEMIF_ROLE.MASTER
            self._create_delete_test_one_interface(memif)
Esempio n. 2
0
    def test_memif_create_custom_socket(self):
        """ Memif create with non-default socket filename """

        memif_sockets = []
        # existing path
        memif_sockets.append(
            VppSocketFilename(self, 1, "%s/memif1.sock" % self.tempdir))
        # default path (test tempdir)
        memif_sockets.append(
            VppSocketFilename(self, 2, "memif2.sock", add_default_folder=True))
        # create new folder in default folder
        memif_sockets.append(
            VppSocketFilename(self,
                              3,
                              "sock/memif3.sock",
                              add_default_folder=True))

        memif = VppMemif(self,
                         VppEnum.vl_api_memif_role_t.MEMIF_ROLE_API_SLAVE,
                         VppEnum.vl_api_memif_mode_t.MEMIF_MODE_API_ETHERNET)

        for sock in memif_sockets:
            sock.add_vpp_config()
            memif.socket_id = sock.socket_id
            memif.role = VppEnum.vl_api_memif_role_t.MEMIF_ROLE_API_SLAVE
            self._create_delete_test_one_interface(memif)
            memif.role = VppEnum.vl_api_memif_role_t.MEMIF_ROLE_API_MASTER
            self._create_delete_test_one_interface(memif)