Exemple #1
0
    def test_one_rxq(self):
        # retrieve pmd object.
        pmd = self.pmd_map[self.core_id]

        # one dummy port is required for this test.
        port_name = 'virtport'

        # create port class of name 'virtport'.
        dataif.make_dataif_port(port_name)

        # add port object into pmd.
        fx_port = pmd.add_port(port_name)
        fx_port.numa_id = pmd.numa_id

        # add a dummy rxq into port.
        fx_rxq = fx_port.add_rxq(0)

        # add some cpu consumption for this rxq.
        for i in range(0, config.ncd_samples_max):
            fx_rxq.cpu_cyc[i] = (1000 + (100 * i))

        dataif.update_pmd_load(self.pmd_map)
        variance_value = dataif.pmd_load_variance(self.pmd_map)

        self.assertEqual(variance_value, 0)

        # del port object from pmd.
        pmd.del_port(port_name)
Exemple #2
0
def fx_1pmd_for_2rxq(testobj):
    # retrieve pmd object.
    pmd1 = testobj.pmd_map[testobj.core1_id]

    # one dummy port is required for this test.
    port1_name = 'virtport1'
    port2_name = 'virtport2'

    # create port class of name 'virtport'.
    dataif.make_dataif_port(port1_name)
    dataif.make_dataif_port(port2_name)

    # add port object into pmd.
    fx_port1 = pmd1.add_port(port1_name)
    fx_port1.numa_id = pmd1.numa_id

    # add second port as well into pmd 1
    fx_port2 = pmd1.add_port(port2_name)
    fx_port2.numa_id = pmd1.numa_id

    # add a dummy rxq into port.
    fx_p1rxq = fx_port1.add_rxq(0)
    fx_p1rxq.pmd = pmd1
    fx_p2rxq = fx_port2.add_rxq(0)
    fx_p2rxq.pmd = pmd1

    # add some cpu consumption for these rxqs.
    for i in range(0, config.ncd_samples_max):
        fx_p1rxq.cpu_cyc[i] = (1000 + (100 * i))
        fx_p2rxq.cpu_cyc[i] = (2000 + (200 * i))
Exemple #3
0
    def setUp(self):
        # create one pmd object
        self.pmd1 = dataif.Dataif_Pmd(1)

        # set pmd numa id
        self.pmd1.numa_id = 0

        # create port1 object
        dataif.make_dataif_port("port1")

        # add port object to pmd object
        self.port1 = self.pmd1.add_port("port1")

        # set port numa id
        self.port1.numa_id = self.pmd1.numa_id

        # create port2 object
        dataif.make_dataif_port("port2")

        # add port object to pmd object
        self.port2 = self.pmd1.add_port("port2")

        # set port numa id
        self.port2.numa_id = self.pmd1.numa_id

        # add rxq1 to port1 object
        self.rxq1 = self.port1.add_rxq(1)

        # add rxq2 to port1 object
        self.rxq2 = self.port1.add_rxq(2)

        # add rxq1 to port2 object
        self.rxq1 = self.port2.add_rxq(1)
Exemple #4
0
    def setUp(self):
        # create one pmd object
        self.pmd1 = dataif.Dataif_Pmd(1)

        # set pmd numa id
        self.pmd1.numa_id = 0

        dataif.make_dataif_port("port2")
        self.port2 = self.pmd1.add_port("port2")
        self.port2.numa_id = self.pmd1.numa_id
Exemple #5
0
    def test_pmd_add_port_1(self):
        # create one port object
        dataif.make_dataif_port("port1")

        # add port object to pmd object
        port1 = self.pmd1.add_port("port1")

        # set port numa id
        port1.numa_id = self.pmd1.numa_id

        self.assertEqual(self.pmd1.find_port_by_name("port1"), port1)
Exemple #6
0
    def setUp(self):
        # create one pmd object
        self.pmd1 = dataif.Dataif_Pmd(1)

        # set pmd numa id
        self.pmd1.numa_id = 0

        # create port1 object
        dataif.make_dataif_port("port1")

        # add port object to pmd object
        self.port1 = self.pmd1.add_port("port1")

        # set port numa id
        self.port1.numa_id = self.pmd1.numa_id
Exemple #7
0
    def setUp(self):
        # turn off limited info shown in assert failure for pmd object.
        self.maxDiff = None

        dataif.Context.nlog = NlogNoop()

        # create one pmd object.
        fx_pmd_1 = dataif.Dataif_Pmd(1)

        # let it be in numa 0.
        fx_pmd_1.numa_id = 0

        # add it to pmd_map
        self.pmd_map[1] = fx_pmd_1

        # create port class of name 'port1'.
        dataif.make_dataif_port("port1")

        # add port object into pmd.
        port1 = fx_pmd_1.add_port("port1")
        port1.numa_id = fx_pmd_1.numa_id

        # add rxq to port object
        rxq_1 = port1.add_rxq(0)  # noqa: F841

        # create another pmd object.
        fx_pmd_2 = dataif.Dataif_Pmd(13)

        # let it be in numa 0.
        fx_pmd_2.numa_id = 0

        # add it to pmd_map
        self.pmd_map[13] = fx_pmd_2

        # create port class of name 'port2'.
        dataif.make_dataif_port("port2")

        # add port object into pmd.
        port2 = fx_pmd_2.add_port("port2")
        port2.numa_id = fx_pmd_2.numa_id

        # add rxq to port object
        rxq_2 = port2.add_rxq(0)  # noqa: F841

        return