Esempio n. 1
0
 def testc_delete_ofc_tenant(self):
     """test delete ofc_tenant"""
     t, n, p, f, none = self.get_random_params()
     self.ofc.create_ofc_tenant(self.ctx, t)
     self.assertTrue(ndb.get_ofc_item(self.ctx.session, 'ofc_tenant', t))
     self.ofc.delete_ofc_tenant(self.ctx, t)
     self.assertFalse(ndb.get_ofc_item(self.ctx.session, 'ofc_tenant', t))
Esempio n. 2
0
 def testc_delete_ofc_tenant(self):
     """test delete ofc_tenant"""
     t, n, p, f, none = self.get_random_params()
     self.ofc.create_ofc_tenant(self.ctx, t)
     self.assertTrue(ndb.get_ofc_item(self.ctx.session, 'ofc_tenant', t))
     self.ofc.delete_ofc_tenant(self.ctx, t)
     self.assertFalse(ndb.get_ofc_item(self.ctx.session, 'ofc_tenant', t))
Esempio n. 3
0
 def testa_create_ofc_tenant(self):
     """test create ofc_tenant"""
     t, n, p, f, none = self.get_random_params()
     self.assertFalse(ndb.get_ofc_item(self.ctx.session, 'ofc_tenant', t))
     self.ofc.create_ofc_tenant(self.ctx, t)
     self.assertTrue(ndb.get_ofc_item(self.ctx.session, 'ofc_tenant', t))
     tenant = ndb.get_ofc_item(self.ctx.session, 'ofc_tenant', t)
     self.assertEqual(tenant.ofc_id, "ofc-" + t[:-4])
Esempio n. 4
0
 def testf_delete_ofc_network(self):
     """test delete ofc_network"""
     t, n, p, f, none = self.get_random_params()
     self.ofc.create_ofc_tenant(self.ctx, t)
     self.ofc.create_ofc_network(self.ctx, t, n)
     self.assertTrue(ndb.get_ofc_item(self.ctx.session, 'ofc_network', n))
     self.ofc.delete_ofc_network(self.ctx, n, {'tenant_id': t})
     self.assertFalse(ndb.get_ofc_item(self.ctx.session, 'ofc_network', n))
Esempio n. 5
0
 def testf_delete_ofc_network(self):
     """test delete ofc_network"""
     t, n, p, f, none = self.get_random_params()
     self.ofc.create_ofc_tenant(self.ctx, t)
     self.ofc.create_ofc_network(self.ctx, t, n)
     self.assertTrue(ndb.get_ofc_item(self.ctx.session, 'ofc_network', n))
     self.ofc.delete_ofc_network(self.ctx, n, {'tenant_id': t})
     self.assertFalse(ndb.get_ofc_item(self.ctx.session, 'ofc_network', n))
Esempio n. 6
0
 def testa_create_ofc_tenant(self):
     """test create ofc_tenant"""
     t, n, p, f, none = self.get_random_params()
     self.assertFalse(ndb.get_ofc_item(self.ctx.session, 'ofc_tenant', t))
     self.ofc.create_ofc_tenant(self.ctx, t)
     self.assertTrue(ndb.get_ofc_item(self.ctx.session, 'ofc_tenant', t))
     tenant = ndb.get_ofc_item(self.ctx.session, 'ofc_tenant', t)
     self.assertEqual(tenant.ofc_id, "ofc-" + t[:-4])
Esempio n. 7
0
 def testd_create_ofc_network(self):
     """test create ofc_network"""
     t, n, p, f, none = self.get_random_params()
     self.ofc.create_ofc_tenant(self.ctx, t)
     self.assertFalse(ndb.get_ofc_item(self.ctx.session, 'ofc_network', n))
     self.ofc.create_ofc_network(self.ctx, t, n)
     self.assertTrue(ndb.get_ofc_item(self.ctx.session, 'ofc_network', n))
     network = ndb.get_ofc_item(self.ctx.session, 'ofc_network', n)
     self.assertEqual(network.ofc_id, "ofc-" + n[:-4])
Esempio n. 8
0
 def testd_create_ofc_network(self):
     """test create ofc_network"""
     t, n, p, f, none = self.get_random_params()
     self.ofc.create_ofc_tenant(self.ctx, t)
     self.assertFalse(ndb.get_ofc_item(self.ctx.session, 'ofc_network', n))
     self.ofc.create_ofc_network(self.ctx, t, n)
     self.assertTrue(ndb.get_ofc_item(self.ctx.session, 'ofc_network', n))
     network = ndb.get_ofc_item(self.ctx.session, 'ofc_network', n)
     self.assertEqual(network.ofc_id, "ofc-" + n[:-4])
Esempio n. 9
0
    def testb_get_ofc_item(self):
        """test get OFC item."""
        o, q, n = self.get_ofc_item_random_params()
        ndb.add_ofc_item(self.session, 'ofc_tenant', q, o)
        tenant = ndb.get_ofc_item(self.session, 'ofc_tenant', q)
        self.assertEqual(tenant.ofc_id, o)
        self.assertEqual(tenant.quantum_id, q)

        tenant_none = ndb.get_ofc_item(self.session, 'ofc_tenant', n)
        self.assertEqual(None, tenant_none)
Esempio n. 10
0
    def testb_get_ofc_item(self):
        """test get OFC item"""
        o, q, n = self.get_ofc_item_random_params()
        ndb.add_ofc_item(self.session, 'ofc_tenant', q, o)
        tenant = ndb.get_ofc_item(self.session, 'ofc_tenant', q)
        self.assertEqual(tenant.ofc_id, o)
        self.assertEqual(tenant.quantum_id, q)

        tenant_none = ndb.get_ofc_item(self.session, 'ofc_tenant', n)
        self.assertEqual(None, tenant_none)
Esempio n. 11
0
    def testb_get_ofc_item(self):
        """test get OFC item"""
        o, q, n = self.get_ofc_item_random_params()
        ndb.add_ofc_item(nmodels.OFCTenant, o, q)
        tenant = ndb.get_ofc_item(nmodels.OFCTenant, o)
        self.assertEqual(tenant.id, o)
        self.assertEqual(tenant.quantum_id, q)

        tenant_none = ndb.get_ofc_item(nmodels.OFCTenant, n)
        self.assertEqual(None, tenant_none)
Esempio n. 12
0
    def testb_get_ofc_item(self):
        """test get OFC item"""
        o, q, n = self.get_ofc_item_random_params()
        ndb.add_ofc_item(nmodels.OFCTenant, o, q)
        tenant = ndb.get_ofc_item(nmodels.OFCTenant, o)
        self.assertEqual(tenant.id, o)
        self.assertEqual(tenant.quantum_id, q)

        tenant_none = ndb.get_ofc_item(nmodels.OFCTenant, n)
        self.assertEqual(None, tenant_none)
Esempio n. 13
0
    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)
Esempio n. 14
0
    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)
Esempio n. 15
0
 def testi_delete_ofc_port(self):
     """test delete ofc_port"""
     t, n, p, f, none = self.get_random_params()
     self.ofc.create_ofc_tenant(self.ctx, t)
     self.ofc.create_ofc_network(self.ctx, t, n)
     ndb.add_portinfo(self.ctx.session, p, "0xabc", 3, 65535,
                      "00:13:22:33:44:55")
     port = {'tenant_id': t, 'network_id': n}
     self.ofc.create_ofc_port(self.ctx, p, port)
     self.assertTrue(ndb.get_ofc_item(self.ctx.session, 'ofc_port', p))
     self.ofc.delete_ofc_port(self.ctx, p, port)
     self.assertFalse(ndb.get_ofc_item(self.ctx.session, 'ofc_port', p))
Esempio n. 16
0
 def testl_delete_ofc_packet_filter(self):
     """test delete ofc_filter"""
     t, n, p, f, none = self.get_random_params()
     self.ofc.create_ofc_tenant(self.ctx, t)
     self.ofc.create_ofc_network(self.ctx, t, n)
     pf = {'tenant_id': t, 'network_id': n}
     self.ofc.create_ofc_packet_filter(self.ctx, f, pf)
     self.assertTrue(ndb.get_ofc_item(self.ctx.session,
                                      'ofc_packet_filter', f))
     self.ofc.delete_ofc_packet_filter(self.ctx, f)
     self.assertFalse(ndb.get_ofc_item(self.ctx.session,
                                       'ofc_packet_filter', f))
Esempio n. 17
0
 def testi_delete_ofc_port(self):
     """test delete ofc_port"""
     t, n, p, f, none = self.get_random_params()
     self.ofc.create_ofc_tenant(self.ctx, t)
     self.ofc.create_ofc_network(self.ctx, t, n)
     ndb.add_portinfo(self.ctx.session, p, "0xabc", 3, 65535,
                      "00:13:22:33:44:55")
     port = {'tenant_id': t, 'network_id': n}
     self.ofc.create_ofc_port(self.ctx, p, port)
     self.assertTrue(ndb.get_ofc_item(self.ctx.session, 'ofc_port', p))
     self.ofc.delete_ofc_port(self.ctx, p, port)
     self.assertFalse(ndb.get_ofc_item(self.ctx.session, 'ofc_port', p))
Esempio n. 18
0
 def testl_delete_ofc_packet_filter(self):
     """test delete ofc_filter"""
     t, n, p, f, none = self.get_random_params()
     self.ofc.create_ofc_tenant(self.ctx, t)
     self.ofc.create_ofc_network(self.ctx, t, n)
     pf = {'tenant_id': t, 'network_id': n}
     self.ofc.create_ofc_packet_filter(self.ctx, f, pf)
     self.assertTrue(
         ndb.get_ofc_item(self.ctx.session, 'ofc_packet_filter', f))
     self.ofc.delete_ofc_packet_filter(self.ctx, f)
     self.assertFalse(
         ndb.get_ofc_item(self.ctx.session, 'ofc_packet_filter', f))
Esempio n. 19
0
 def testg_create_ofc_port(self):
     """test create ofc_port"""
     t, n, p, f, none = self.get_random_params()
     self.ofc.create_ofc_tenant(self.ctx, t)
     self.ofc.create_ofc_network(self.ctx, t, n)
     ndb.add_portinfo(self.ctx.session, p, "0xabc", 1, 65535,
                      "00:11:22:33:44:55")
     self.assertFalse(ndb.get_ofc_item(self.ctx.session, 'ofc_port', p))
     port = {'tenant_id': t, 'network_id': n}
     self.ofc.create_ofc_port(self.ctx, p, port)
     self.assertTrue(ndb.get_ofc_item(self.ctx.session, 'ofc_port', p))
     port = ndb.get_ofc_item(self.ctx.session, 'ofc_port', p)
     self.assertEqual(port.ofc_id, "ofc-" + p[:-4])
Esempio n. 20
0
 def testj_create_ofc_packet_filter(self):
     """test create ofc_filter"""
     t, n, p, f, none = self.get_random_params()
     self.ofc.create_ofc_tenant(self.ctx, t)
     self.ofc.create_ofc_network(self.ctx, t, n)
     self.assertFalse(ndb.get_ofc_item(self.ctx.session,
                                       'ofc_packet_filter', f))
     pf = {'tenant_id': t, 'network_id': n}
     self.ofc.create_ofc_packet_filter(self.ctx, f, pf)
     self.assertTrue(ndb.get_ofc_item(self.ctx.session,
                                      'ofc_packet_filter', f))
     _filter = ndb.get_ofc_item(self.ctx.session, 'ofc_packet_filter', f)
     self.assertEqual(_filter.ofc_id, "ofc-" + f[:-4])
Esempio n. 21
0
 def testg_create_ofc_port(self):
     """test create ofc_port"""
     t, n, p, f, none = self.get_random_params()
     self.ofc.create_ofc_tenant(self.ctx, t)
     self.ofc.create_ofc_network(self.ctx, t, n)
     ndb.add_portinfo(self.ctx.session, p, "0xabc", 1, 65535,
                      "00:11:22:33:44:55")
     self.assertFalse(ndb.get_ofc_item(self.ctx.session, 'ofc_port', p))
     port = {'tenant_id': t, 'network_id': n}
     self.ofc.create_ofc_port(self.ctx, p, port)
     self.assertTrue(ndb.get_ofc_item(self.ctx.session, 'ofc_port', p))
     port = ndb.get_ofc_item(self.ctx.session, 'ofc_port', p)
     self.assertEqual(port.ofc_id, "ofc-" + p[:-4])
Esempio n. 22
0
 def testj_create_ofc_packet_filter(self):
     """test create ofc_filter"""
     t, n, p, f, none = self.get_random_params()
     self.ofc.create_ofc_tenant(self.ctx, t)
     self.ofc.create_ofc_network(self.ctx, t, n)
     self.assertFalse(
         ndb.get_ofc_item(self.ctx.session, 'ofc_packet_filter', f))
     pf = {'tenant_id': t, 'network_id': n}
     self.ofc.create_ofc_packet_filter(self.ctx, f, pf)
     self.assertTrue(
         ndb.get_ofc_item(self.ctx.session, 'ofc_packet_filter', f))
     _filter = ndb.get_ofc_item(self.ctx.session, 'ofc_packet_filter', f)
     self.assertEqual(_filter.ofc_id, "ofc-" + f[:-4])
Esempio n. 23
0
    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)
Esempio n. 24
0
    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)
Esempio n. 25
0
    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)
Esempio n. 26
0
    def testc_del_ofc_item(self):
        """test delete OFC item"""
        o, q, n = self.get_ofc_item_random_params()
        ndb.add_ofc_item(nmodels.OFCTenant, o, q)
        ndb.del_ofc_item(nmodels.OFCTenant, o)

        tenant_none = ndb.get_ofc_item(nmodels.OFCTenant, q)
        self.assertEqual(None, tenant_none)
        tenant_none = ndb.find_ofc_item(nmodels.OFCTenant, q)
        self.assertEqual(None, tenant_none)
Esempio n. 27
0
    def testc_del_ofc_item(self):
        """test delete OFC item"""
        o, q, n = self.get_ofc_item_random_params()
        ndb.add_ofc_item(nmodels.OFCTenant, o, q)
        ndb.del_ofc_item(nmodels.OFCTenant, o)

        tenant_none = ndb.get_ofc_item(nmodels.OFCTenant, q)
        self.assertEqual(None, tenant_none)
        tenant_none = ndb.find_ofc_item(nmodels.OFCTenant, q)
        self.assertEqual(None, tenant_none)
Esempio n. 28
0
    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)
Esempio n. 29
0
    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)
Esempio n. 30
0
    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)
Esempio n. 31
0
    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)