Пример #1
0
    def test_qos_get(self):
        qos11 = self._qos_test_obj(1, 1)
        qos11_id = cdb.add_qos(qos11.tenant, qos11.qname, qos11.desc).qos_id
        qos21 = self._qos_test_obj(2, 1)
        qos21_id = cdb.add_qos(qos21.tenant, qos21.qname, qos21.desc).qos_id
        qos22 = self._qos_test_obj(2, 2)
        qos22_id = cdb.add_qos(qos22.tenant, qos22.qname, qos22.desc).qos_id

        qos = cdb.get_qos(qos11.tenant, qos11_id)
        self._assert_equal(qos, qos11)
        qos = cdb.get_qos(qos21.tenant, qos21_id)
        self._assert_equal(qos, qos21)
        qos = cdb.get_qos(qos21.tenant, qos22_id)
        self._assert_equal(qos, qos22)

        with testtools.ExpectedException(c_exc.QosNotFound):
            cdb.get_qos(qos11.tenant, "dummyQosId")
        with testtools.ExpectedException(c_exc.QosNotFound):
            cdb.get_qos(qos11.tenant, qos21_id)
        with testtools.ExpectedException(c_exc.QosNotFound):
            cdb.get_qos(qos21.tenant, qos11_id)

        qos_all_t1 = cdb.get_all_qoss(qos11.tenant)
        self.assertEqual(len(qos_all_t1), 1)
        qos_all_t2 = cdb.get_all_qoss(qos21.tenant)
        self.assertEqual(len(qos_all_t2), 2)
        qos_all_t3 = cdb.get_all_qoss("tenant3")
        self.assertEqual(len(qos_all_t3), 0)
Пример #2
0
    def test_qos_get(self):
        qos11 = self._qos_test_obj(1, 1)
        qos11_id = cdb.add_qos(qos11.tenant, qos11.qname, qos11.desc).qos_id
        qos21 = self._qos_test_obj(2, 1)
        qos21_id = cdb.add_qos(qos21.tenant, qos21.qname, qos21.desc).qos_id
        qos22 = self._qos_test_obj(2, 2)
        qos22_id = cdb.add_qos(qos22.tenant, qos22.qname, qos22.desc).qos_id

        qos = cdb.get_qos(qos11.tenant, qos11_id)
        self._assert_equal(qos, qos11)
        qos = cdb.get_qos(qos21.tenant, qos21_id)
        self._assert_equal(qos, qos21)
        qos = cdb.get_qos(qos21.tenant, qos22_id)
        self._assert_equal(qos, qos22)

        with testtools.ExpectedException(c_exc.QosNotFound):
            cdb.get_qos(qos11.tenant, "dummyQosId")
        with testtools.ExpectedException(c_exc.QosNotFound):
            cdb.get_qos(qos11.tenant, qos21_id)
        with testtools.ExpectedException(c_exc.QosNotFound):
            cdb.get_qos(qos21.tenant, qos11_id)

        qos_all_t1 = cdb.get_all_qoss(qos11.tenant)
        self.assertEqual(len(qos_all_t1), 1)
        qos_all_t2 = cdb.get_all_qoss(qos21.tenant)
        self.assertEqual(len(qos_all_t2), 2)
        qos_all_t3 = cdb.get_all_qoss("tenant3")
        self.assertEqual(len(qos_all_t3), 0)
Пример #3
0
 def get_all_qoss(self, tenant_id):
     """Get all QoS levels."""
     LOG.debug(_("get_all_qoss() called"))
     qoslist = cdb.get_all_qoss(tenant_id)
     return qoslist
Пример #4
0
 def get_all_qoss(self, tenant_id):
     """Get all QoS levels."""
     LOG.debug(_("get_all_qoss() called"))
     qoslist = cdb.get_all_qoss(tenant_id)
     return qoslist