예제 #1
0
    def test_del_ofc_item(self):
        o, q, n = self.get_ofc_item_random_params()
        ndb.add_ofc_item(self.session, 'ofc_tenant', q, o)
        self.assertTrue(ndb.del_ofc_item(self.session, 'ofc_tenant', q))

        self.assertIsNone(ndb.get_ofc_item(self.session, 'ofc_tenant', q))
        self.assertIsNone(ndb.find_ofc_item(self.session, 'ofc_tenant', o))
예제 #2
0
    def test_del_ofc_item(self):
        o, q, n = self.get_ofc_item_random_params()
        ndb.add_ofc_item(self.session, 'ofc_tenant', q, o)
        self.assertTrue(ndb.del_ofc_item(self.session, 'ofc_tenant', q))

        self.assertIsNone(ndb.get_ofc_item(self.session, 'ofc_tenant', q))
        self.assertIsNone(ndb.find_ofc_item(self.session, 'ofc_tenant', o))
예제 #3
0
파일: test_db.py 프로젝트: rhel-osp/neutron
    def testb_exists_ofc_item(self):
        """test get OFC d."""
        o, q, n = self.get_ofc_item_random_params()
        ndb.add_ofc_item(self.session, 'ofc_tenant', q, o)
        ret = ndb.exists_ofc_item(self.session, 'ofc_tenant', q)
        self.assertTrue(ret)

        tenant_none = ndb.get_ofc_item(self.session, 'ofc_tenant', n)
        self.assertEqual(None, tenant_none)
예제 #4
0
    def test_exists_ofc_port(self):
        t, n, p, f, none = self.get_random_params()
        ofc_t, ofc_n, ofc_p, ofc_f, ofc_none = self.get_random_params()

        self.assertFalse(self.ofc.exists_ofc_port(self.ctx, p))

        session = self.ctx.session
        ndb.add_ofc_item(session, 'ofc_port', p, ofc_p, old_style=True)
        self.assertTrue(self.ofc.exists_ofc_port(self.ctx, p))
    def testb_get_ofc_id(self):
        """test get OFC d."""
        o, q, n = self.get_ofc_item_random_params()
        ndb.add_ofc_item(self.session, 'ofc_tenant', q, o)
        tenant_id = ndb.get_ofc_id(self.session, 'ofc_tenant', q)
        self.assertEqual(tenant_id, o)

        tenant_none = ndb.get_ofc_item(self.session, 'ofc_tenant', n)
        self.assertEqual(None, tenant_none)
예제 #6
0
    def test_exists_ofc_item(self):
        o, q, n = self.get_ofc_item_random_params()
        self.assertFalse(ndb.exists_ofc_item(self.session, 'ofc_tenant', q))

        ndb.add_ofc_item(self.session, 'ofc_tenant', q, o)
        self.assertTrue(ndb.exists_ofc_item(self.session, 'ofc_tenant', q))

        ndb.del_ofc_item(self.session, 'ofc_tenant', q)
        self.assertFalse(ndb.exists_ofc_item(self.session, 'ofc_tenant', q))
    def testb_exists_ofc_item(self):
        """test get OFC d."""
        o, q, n = self.get_ofc_item_random_params()
        ndb.add_ofc_item(self.session, 'ofc_tenant', q, o)
        ret = ndb.exists_ofc_item(self.session, 'ofc_tenant', q)
        self.assertTrue(ret)

        tenant_none = ndb.get_ofc_item(self.session, 'ofc_tenant', n)
        self.assertEqual(None, tenant_none)
    def test_exists_ofc_port(self):
        t, n, p, f, none = self.get_random_params()
        ofc_t, ofc_n, ofc_p, ofc_f, ofc_none = self.get_random_params()

        self.assertFalse(self.ofc.exists_ofc_port(self.ctx, p))

        session = self.ctx.session
        ndb.add_ofc_item(session, 'ofc_port', p, ofc_p, old_style=True)
        self.assertTrue(self.ofc.exists_ofc_port(self.ctx, p))
예제 #9
0
파일: test_db.py 프로젝트: rhel-osp/neutron
    def testb_get_ofc_id(self):
        """test get OFC d."""
        o, q, n = self.get_ofc_item_random_params()
        ndb.add_ofc_item(self.session, 'ofc_tenant', q, o)
        tenant_id = ndb.get_ofc_id(self.session, 'ofc_tenant', q)
        self.assertEqual(tenant_id, o)

        tenant_none = ndb.get_ofc_item(self.session, 'ofc_tenant', n)
        self.assertEqual(None, tenant_none)
예제 #10
0
    def test_exists_ofc_item(self):
        o, q, n = self.get_ofc_item_random_params()
        self.assertFalse(ndb.exists_ofc_item(self.session, 'ofc_tenant', q))

        ndb.add_ofc_item(self.session, 'ofc_tenant', q, o)
        self.assertTrue(ndb.exists_ofc_item(self.session, 'ofc_tenant', q))

        ndb.del_ofc_item(self.session, 'ofc_tenant', q)
        self.assertFalse(ndb.exists_ofc_item(self.session, 'ofc_tenant', q))
    def testc_find_ofc_item(self):
        """test find OFC item."""
        o, q, n = self.get_ofc_item_random_params()
        ndb.add_ofc_item(self.session, 'ofc_tenant', q, o)
        tenant = ndb.find_ofc_item(self.session, 'ofc_tenant', o)
        self.assertEqual(tenant.ofc_id, o)
        self.assertEqual(tenant.quantum_id, q)

        tenant_none = ndb.find_ofc_item(self.session, 'ofc_tenant', n)
        self.assertEqual(None, tenant_none)
예제 #12
0
파일: test_db.py 프로젝트: rhel-osp/neutron
    def testc_del_ofc_item(self):
        """test delete OFC item."""
        o, q, n = self.get_ofc_item_random_params()
        ndb.add_ofc_item(self.session, 'ofc_tenant', q, o)
        ndb.del_ofc_item(self.session, 'ofc_tenant', q)

        tenant_none = ndb.get_ofc_item(self.session, 'ofc_tenant', q)
        self.assertEqual(None, tenant_none)
        tenant_none = ndb.find_ofc_item(self.session, 'ofc_tenant', o)
        self.assertEqual(None, tenant_none)
예제 #13
0
파일: test_db.py 프로젝트: rhel-osp/neutron
    def testc_find_ofc_item(self):
        """test find OFC item."""
        o, q, n = self.get_ofc_item_random_params()
        ndb.add_ofc_item(self.session, 'ofc_tenant', q, o)
        tenant = ndb.find_ofc_item(self.session, 'ofc_tenant', o)
        self.assertEqual(tenant.ofc_id, o)
        self.assertEqual(tenant.quantum_id, q)

        tenant_none = ndb.find_ofc_item(self.session, 'ofc_tenant', n)
        self.assertEqual(None, tenant_none)
    def testc_del_ofc_item(self):
        """test delete OFC item."""
        o, q, n = self.get_ofc_item_random_params()
        ndb.add_ofc_item(self.session, 'ofc_tenant', q, o)
        ndb.del_ofc_item(self.session, 'ofc_tenant', q)

        tenant_none = ndb.get_ofc_item(self.session,
                                       'ofc_tenant', q)
        self.assertEqual(None, tenant_none)
        tenant_none = ndb.find_ofc_item(self.session,
                                        'ofc_tenant', o)
        self.assertEqual(None, tenant_none)
    def test_delete_ofc_port(self):
        t, n, p, f, none = self.get_random_params()
        ofc_t, ofc_n, ofc_p, ofc_f, ofc_none = self.get_random_params()

        self.assertFalse(self.ofc.exists_ofc_port(self.ctx, p))

        session = self.ctx.session
        ndb.add_ofc_item(session, 'ofc_port', p, ofc_p, old_style=True)
        self.assertTrue(self.ofc.exists_ofc_port(self.ctx, p))

        port = {'tenant_id': t, 'network_id': n}
        self.ofc.delete_ofc_port(self.ctx, p, port)
        self.assertFalse(self.ofc.exists_ofc_port(self.ctx, p))
    def test_delete_ofc_packet_filter(self):
        t, n, p, f, none = self.get_random_params()
        ofc_t, ofc_n, ofc_p, ofc_f, ofc_none = self.get_random_params()

        self.assertFalse(self.ofc.exists_ofc_packet_filter(self.ctx, f))

        session = self.ctx.session
        ndb.add_ofc_item(session, 'ofc_packet_filter', f, ofc_f,
                         old_style=True)
        self.assertTrue(self.ofc.exists_ofc_packet_filter(self.ctx, f))

        self.ofc.delete_ofc_packet_filter(self.ctx, f)
        self.assertFalse(self.ofc.exists_ofc_packet_filter(self.ctx, f))
예제 #17
0
    def test_delete_ofc_port(self):
        t, n, p, f, none = self.get_random_params()
        ofc_t, ofc_n, ofc_p, ofc_f, ofc_none = self.get_random_params()

        self.assertFalse(self.ofc.exists_ofc_port(self.ctx, p))

        session = self.ctx.session
        ndb.add_ofc_item(session, 'ofc_port', p, ofc_p, old_style=True)
        self.assertTrue(self.ofc.exists_ofc_port(self.ctx, p))

        port = {'tenant_id': t, 'network_id': n}
        self.ofc.delete_ofc_port(self.ctx, p, port)
        self.assertFalse(self.ofc.exists_ofc_port(self.ctx, p))
예제 #18
0
    def test_delete_ofc_packet_filter(self):
        t, n, p, f, none = self.get_random_params()
        ofc_t, ofc_n, ofc_p, ofc_f, ofc_none = self.get_random_params()

        self.assertFalse(self.ofc.exists_ofc_packet_filter(self.ctx, f))

        session = self.ctx.session
        ndb.add_ofc_item(session, 'ofc_packet_filter', f, ofc_f,
                         old_style=True)
        self.assertTrue(self.ofc.exists_ofc_packet_filter(self.ctx, f))

        self.ofc.delete_ofc_packet_filter(self.ctx, f)
        self.assertFalse(self.ofc.exists_ofc_packet_filter(self.ctx, f))
예제 #19
0
파일: test_db.py 프로젝트: rhel-osp/neutron
    def _check_exists_ofc_item(self, mode, exp_new, exp_old):
        o, q, n = self.get_ofc_item_random_params()
        self._check_new_old_item(ndb.exists_ofc_item, q, False, False)
        self.assertFalse(
            ndb.exists_ofc_item_lookup_both(self.session, 'ofc_tenant', q))

        ndb.add_ofc_item(self.session, 'ofc_tenant', q, o, mode)
        self._check_new_old_item(ndb.exists_ofc_item, q, exp_new, exp_old)
        self.assertTrue(
            ndb.exists_ofc_item_lookup_both(self.session, 'ofc_tenant', q))

        ndb.del_ofc_item(self.session, 'ofc_tenant', q, mode)
        self._check_new_old_item(ndb.exists_ofc_item, q, False, False)
        self.assertFalse(
            ndb.exists_ofc_item_lookup_both(self.session, 'ofc_tenant', q))
    def _check_exists_ofc_item(self, mode, exp_new, exp_old):
        o, q, n = self.get_ofc_item_random_params()
        self._check_new_old_item(ndb.exists_ofc_item, q, False, False)
        self.assertFalse(ndb.exists_ofc_item_lookup_both(
            self.session, 'ofc_tenant', q))

        ndb.add_ofc_item(self.session, 'ofc_tenant', q, o, mode)
        self._check_new_old_item(ndb.exists_ofc_item, q, exp_new, exp_old)
        self.assertTrue(ndb.exists_ofc_item_lookup_both(
            self.session, 'ofc_tenant', q))

        ndb.del_ofc_item(self.session, 'ofc_tenant', q, mode)
        self._check_new_old_item(ndb.exists_ofc_item, q, False, False)
        self.assertFalse(ndb.exists_ofc_item_lookup_both(
            self.session, 'ofc_tenant', q))
예제 #21
0
파일: test_db.py 프로젝트: rhel-osp/neutron
    def testa_add_ofc_item(self):
        """test add OFC item."""
        o, q, n = self.get_ofc_item_random_params()
        tenant = ndb.add_ofc_item(self.session, 'ofc_tenant', q, o)
        self.assertEqual(tenant.ofc_id, o)
        self.assertEqual(tenant.quantum_id, q)

        self.assertRaises(nexc.NECDBException, ndb.add_ofc_item, self.session,
                          'ofc_tenant', q, o)
    def testa_add_ofc_item(self):
        """test add OFC item."""
        o, q, n = self.get_ofc_item_random_params()
        tenant = ndb.add_ofc_item(self.session, 'ofc_tenant', q, o)
        self.assertEqual(tenant.ofc_id, o)
        self.assertEqual(tenant.quantum_id, q)

        self.assertRaises(nexc.NECDBException,
                          ndb.add_ofc_item,
                          self.session, 'ofc_tenant', q, o)
    def test_add_ofc_item_old(self):
        o, q, n = self.get_ofc_item_random_params()
        ret = ndb.add_ofc_item(self.session, 'ofc_tenant', q, o, self.OLD)
        self.assertEqual(ret.id, o)
        self.assertEqual(ret.quantum_id, q)

        ret = ndb.get_ofc_item(self.session, 'ofc_tenant', q, self.NEW)
        self.assertEqual(ret, None)
        ret = ndb.get_ofc_item(self.session, 'ofc_tenant', q, self.OLD)
        self.assertEqual(ret.id, o)
        self.assertEqual(ret.quantum_id, q)
예제 #24
0
파일: test_db.py 프로젝트: rhel-osp/neutron
    def test_add_ofc_item_old(self):
        o, q, n = self.get_ofc_item_random_params()
        ret = ndb.add_ofc_item(self.session, 'ofc_tenant', q, o, self.OLD)
        self.assertEqual(ret.id, o)
        self.assertEqual(ret.quantum_id, q)

        ret = ndb.get_ofc_item(self.session, 'ofc_tenant', q, self.NEW)
        self.assertEqual(ret, None)
        ret = ndb.get_ofc_item(self.session, 'ofc_tenant', q, self.OLD)
        self.assertEqual(ret.id, o)
        self.assertEqual(ret.quantum_id, q)
예제 #25
0
파일: test_db.py 프로젝트: rhel-osp/neutron
    def _check_delete_ofc_item(self, mode, detect_mode=False):
        o, q, n = self.get_ofc_item_random_params()
        ret = ndb.add_ofc_item(self.session, 'ofc_tenant', q, o, mode)
        ofc_id = ret.ofc_id if mode == self.NEW else ret.id
        self.assertEqual(ofc_id, o)
        self.assertEqual(ret.quantum_id, q)
        ret = ndb.get_ofc_item(self.session, 'ofc_tenant', q, mode)
        ofc_id = ret.ofc_id if mode == self.NEW else ret.id
        self.assertEqual(ofc_id, o)
        self.assertEqual(ret.quantum_id, q)

        if detect_mode:
            ndb.del_ofc_item_lookup_both(self.session, 'ofc_tenant', q)
        else:
            ndb.del_ofc_item(self.session, 'ofc_tenant', q, mode)

        ret = ndb.get_ofc_item(self.session, 'ofc_tenant', q, self.NEW)
        self.assertEqual(ret, None)
        ret = ndb.get_ofc_item(self.session, 'ofc_tenant', q, self.OLD)
        self.assertEqual(ret, None)
    def _check_delete_ofc_item(self, mode, detect_mode=False):
        o, q, n = self.get_ofc_item_random_params()
        ret = ndb.add_ofc_item(self.session, 'ofc_tenant', q, o, mode)
        ofc_id = ret.ofc_id if mode == self.NEW else ret.id
        self.assertEqual(ofc_id, o)
        self.assertEqual(ret.quantum_id, q)
        ret = ndb.get_ofc_item(self.session, 'ofc_tenant', q, mode)
        ofc_id = ret.ofc_id if mode == self.NEW else ret.id
        self.assertEqual(ofc_id, o)
        self.assertEqual(ret.quantum_id, q)

        if detect_mode:
            ndb.del_ofc_item_lookup_both(self.session, 'ofc_tenant', q)
        else:
            ndb.del_ofc_item(self.session, 'ofc_tenant', q, mode)

        ret = ndb.get_ofc_item(self.session, 'ofc_tenant', q, self.NEW)
        self.assertEqual(ret, None)
        ret = ndb.get_ofc_item(self.session, 'ofc_tenant', q, self.OLD)
        self.assertEqual(ret, None)
예제 #27
0
 def test_add_ofc_item_duplicate_entry(self):
     o, q, n = self.get_ofc_item_random_params()
     ndb.add_ofc_item(self.session, 'ofc_tenant', q, o)
     self.assertRaises(nexc.NECDBException, ndb.add_ofc_item, self.session,
                       'ofc_tenant', q, o)
예제 #28
0
 def test_add_ofc_item(self):
     """test add OFC item."""
     o, q, n = self.get_ofc_item_random_params()
     tenant = ndb.add_ofc_item(self.session, 'ofc_tenant', q, o)
     self.assertEqual(tenant.ofc_id, o)
     self.assertEqual(tenant.quantum_id, q)
예제 #29
0
 def test_add_ofc_item(self):
     """test add OFC item."""
     o, q, n = self.get_ofc_item_random_params()
     tenant = ndb.add_ofc_item(self.session, 'ofc_tenant', q, o)
     self.assertEqual(tenant.ofc_id, o)
     self.assertEqual(tenant.neutron_id, q)
예제 #30
0
 def test_find_ofc_item(self):
     o, q, n = self.get_ofc_item_random_params()
     ndb.add_ofc_item(self.session, 'ofc_tenant', q, o)
     tenant = ndb.find_ofc_item(self.session, 'ofc_tenant', o)
     self.assertEqual(tenant.ofc_id, o)
     self.assertEqual(tenant.quantum_id, q)
예제 #31
0
 def _add_ofc_item(self, context, resource, neutron_id, ofc_id):
     # Ensure a new item is added to the new mapping table
     ndb.add_ofc_item(context.session, resource, neutron_id, ofc_id)
예제 #32
0
 def _add_ofc_item(self, context, resource, neutron_id, ofc_id):
     # Ensure a new item is added to the new mapping table
     ndb.add_ofc_item(context.session, resource, neutron_id, ofc_id)
예제 #33
0
 def test_find_ofc_item(self):
     o, q, n = self.get_ofc_item_random_params()
     ndb.add_ofc_item(self.session, 'ofc_tenant', q, o)
     tenant = ndb.find_ofc_item(self.session, 'ofc_tenant', o)
     self.assertEqual(tenant.ofc_id, o)
     self.assertEqual(tenant.neutron_id, q)
예제 #34
0
 def test_add_ofc_item_duplicate_entry(self):
     o, q, n = self.get_ofc_item_random_params()
     ndb.add_ofc_item(self.session, 'ofc_tenant', q, o)
     self.assertRaises(nexc.NECDBException,
                       ndb.add_ofc_item,
                       self.session, 'ofc_tenant', q, o)
예제 #35
0
 def test_get_ofc_id(self):
     o, q, n = self.get_ofc_item_random_params()
     ndb.add_ofc_item(self.session, 'ofc_tenant', q, o)
     tenant_id = ndb.get_ofc_id(self.session, 'ofc_tenant', q)
     self.assertEqual(tenant_id, o)
예제 #36
0
파일: test_db.py 프로젝트: rhel-osp/neutron
 def test_get_ofc_id_old(self):
     o, q, n = self.get_ofc_item_random_params()
     ndb.add_ofc_item(self.session, 'ofc_tenant', q, o, self.OLD)
     self._check_new_old_item(ndb.get_ofc_id, q, None, o)
     ret = ndb.get_ofc_id_lookup_both(self.session, 'ofc_tenant', q)
     self.assertEqual(ret, o)
예제 #37
0
 def test_get_ofc_id(self):
     o, q, n = self.get_ofc_item_random_params()
     ndb.add_ofc_item(self.session, 'ofc_tenant', q, o)
     tenant_id = ndb.get_ofc_id(self.session, 'ofc_tenant', q)
     self.assertEqual(tenant_id, o)
 def test_get_ofc_id_old(self):
     o, q, n = self.get_ofc_item_random_params()
     ndb.add_ofc_item(self.session, 'ofc_tenant', q, o, self.OLD)
     self._check_new_old_item(ndb.get_ofc_id, q, None, o)
     ret = ndb.get_ofc_id_lookup_both(self.session, 'ofc_tenant', q)
     self.assertEqual(ret, o)