当前位置: 首页>>代码示例>>Python>>正文


Python db.fixed_ip_associate函数代码示例

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


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

示例1: test_fixed_ip_associate_succeeds_and_sets_network

 def test_fixed_ip_associate_succeeds_and_sets_network(self):
     address = self.create_fixed_ip()
     db.fixed_ip_associate(self.ctxt, address, self.instance.id,
                           network_id=self.network.id)
     fixed_ip = db.fixed_ip_get_by_address(self.ctxt, address)
     self.assertEqual(fixed_ip.instance_id, self.instance.id)
     self.assertEqual(fixed_ip.network_id, self.network.id)
开发者ID:matiu2,项目名称:nova,代码行数:7,代码来源:test_db_api.py

示例2: test_vpn_allocate_fixed_ip

    def test_vpn_allocate_fixed_ip(self):
        self.mox.StubOutWithMock(db, "fixed_ip_associate")
        self.mox.StubOutWithMock(db, "fixed_ip_update")
        self.mox.StubOutWithMock(db, "virtual_interface_get_by_instance_and_network")

        db.fixed_ip_associate(mox.IgnoreArg(), mox.IgnoreArg(), mox.IgnoreArg(), reserved=True).AndReturn("192.168.0.1")
        db.fixed_ip_update(mox.IgnoreArg(), mox.IgnoreArg(), mox.IgnoreArg())
        db.virtual_interface_get_by_instance_and_network(mox.IgnoreArg(), mox.IgnoreArg(), mox.IgnoreArg()).AndReturn(
            {"id": 0}
        )
        self.mox.ReplayAll()

        network = dict(networks[0])
        network["vpn_private_address"] = "192.168.0.2"
        self.network.allocate_fixed_ip(None, 0, network, vpn=True)
开发者ID:rlz,项目名称:osc-build-nova,代码行数:15,代码来源:test_network.py

示例3: associate

 def associate(cls, context, address, instance_uuid, network_id=None,
               reserved=False, vif_id=None):
     db_fixedip = db.fixed_ip_associate(context, address, instance_uuid,
                                        network_id=network_id,
                                        reserved=reserved,
                                        virtual_interface_id=vif_id)
     return cls._from_db_object(context, cls(context), db_fixedip)
开发者ID:375670450,项目名称:nova,代码行数:7,代码来源:fixed_ip.py

示例4: test_vpn_allocate_fixed_ip

    def test_vpn_allocate_fixed_ip(self):
        self.mox.StubOutWithMock(db, 'fixed_ip_associate')
        self.mox.StubOutWithMock(db, 'fixed_ip_update')
        self.mox.StubOutWithMock(db,
                              'virtual_interface_get_by_instance_and_network')

        db.fixed_ip_associate(mox.IgnoreArg(),
                              mox.IgnoreArg(),
                              mox.IgnoreArg()).AndReturn('192.168.0.1')
        db.fixed_ip_update(mox.IgnoreArg(),
                           mox.IgnoreArg(),
                           mox.IgnoreArg())
        db.virtual_interface_get_by_instance_and_network(mox.IgnoreArg(),
                mox.IgnoreArg(), mox.IgnoreArg()).AndReturn({'id': 0})
        self.mox.ReplayAll()

        network = dict(networks[0])
        network['vpn_private_address'] = '192.168.0.2'
        self.network.allocate_fixed_ip(None, 0, network, vpn=True)
开发者ID:lovocas,项目名称:nova,代码行数:19,代码来源:test_network.py

示例5: associate

 def associate(cls, context, address, instance_uuid, network_id=None, reserved=False):
     db_fixedip = db.fixed_ip_associate(context, address, instance_uuid, network_id=network_id, reserved=reserved)
     return cls._from_db_object(context, cls(), db_fixedip)
开发者ID:wputra,项目名称:MOS-centos,代码行数:3,代码来源:fixed_ip.py


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