• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python api.add_ofc_item函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中quantum.plugins.nec.db.api.add_ofc_item函数的典型用法代码示例。如果您正苦于以下问题:Python add_ofc_item函数的具体用法?Python add_ofc_item怎么用?Python add_ofc_item使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了add_ofc_item函数的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: testb_get_ofc_id

    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)
开发者ID:AmirolAhmad,项目名称:quantum,代码行数:9,代码来源:test_db.py


示例2: testb_exists_ofc_item

    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)
开发者ID:AmirolAhmad,项目名称:quantum,代码行数:9,代码来源:test_db.py


示例3: test_exists_ofc_port

    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))
开发者ID:StackOps,项目名称:quantum,代码行数:9,代码来源:test_ofc_manager.py


示例4: testb_get_ofc_item

    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)
开发者ID:rosstaylor,项目名称:quantum,代码行数:10,代码来源:test_db.py


示例5: testc_del_ofc_item

    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)
开发者ID:FreescaleSemiconductor,项目名称:quantum,代码行数:10,代码来源:test_db.py


示例6: testc_del_ofc_item

    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)
开发者ID:rosstaylor,项目名称:quantum,代码行数:10,代码来源:test_db.py


示例7: testc_find_ofc_item

    def testc_find_ofc_item(self):
        """test find OFC item"""
        o, q, n = self.get_ofc_item_random_params()
        ndb.add_ofc_item(nmodels.OFCTenant, o, q)
        tenant = ndb.find_ofc_item(nmodels.OFCTenant, q)
        self.assertEqual(tenant.id, o)
        self.assertEqual(tenant.quantum_id, q)

        tenant_none = ndb.find_ofc_item(nmodels.OFCTenant, n)
        self.assertEqual(None, tenant_none)
开发者ID:FreescaleSemiconductor,项目名称:quantum,代码行数:10,代码来源:test_db.py


示例8: testc_find_ofc_item

    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)
开发者ID:AmirolAhmad,项目名称:quantum,代码行数:10,代码来源:test_db.py


示例9: _check_exists_ofc_item

    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))
开发者ID:rosstaylor,项目名称:quantum,代码行数:12,代码来源:test_db.py


示例10: testa_add_ofc_item

    def testa_add_ofc_item(self):
        """test add OFC item"""
        o, q, n = self.get_ofc_item_random_params()
        tenant = ndb.add_ofc_item(nmodels.OFCTenant, o, q)
        self.assertEqual(tenant.id, o)
        self.assertEqual(tenant.quantum_id, q)

        exception_raised = False
        try:
            ndb.add_ofc_item(nmodels.OFCTenant, o, q)
        except nexc.NECDBException:
            exception_raised = True
        self.assertTrue(exception_raised)
开发者ID:FreescaleSemiconductor,项目名称:quantum,代码行数:13,代码来源:test_db.py


示例11: test_delete_ofc_packet_filter

    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))
开发者ID:StackOps,项目名称:quantum,代码行数:13,代码来源:test_ofc_manager.py


示例12: test_delete_ofc_port

    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))
开发者ID:StackOps,项目名称:quantum,代码行数:13,代码来源:test_ofc_manager.py


示例13: testa_add_ofc_item

    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)
开发者ID:rosstaylor,项目名称:quantum,代码行数:8,代码来源:test_db.py


示例14: test_add_ofc_item_old

    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)
开发者ID:AmirolAhmad,项目名称:quantum,代码行数:11,代码来源:test_db.py


示例15: _check_delete_ofc_item

    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)
开发者ID:AmirolAhmad,项目名称:quantum,代码行数:20,代码来源:test_db.py


示例16: _add_ofc_item

 def _add_ofc_item(self, context, resource, quantum_id, ofc_id):
     # Ensure a new item is added to the new mapping table
     ndb.add_ofc_item(context.session, resource, quantum_id, ofc_id)
开发者ID:Apsu,项目名称:quantum,代码行数:3,代码来源:ofc_manager.py


示例17: test_get_ofc_id_old

 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)
开发者ID:AmirolAhmad,项目名称:quantum,代码行数:6,代码来源:test_db.py



注:本文中的quantum.plugins.nec.db.api.add_ofc_item函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python api.add_portinfo函数代码示例发布时间:2022-05-26
下一篇:
Python meta_db_v2.get_flavor_by_network函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap