コード例 #1
0
ファイル: test_db_api.py プロジェクト: matiu2/nova
 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)
コード例 #2
0
 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)
コード例 #3
0
ファイル: test_network.py プロジェクト: rlz/osc-build-nova
    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)
コード例 #4
0
ファイル: fixed_ip.py プロジェクト: 375670450/nova
 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)
コード例 #5
0
 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)
コード例 #6
0
ファイル: test_network.py プロジェクト: termie/nova
    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)
コード例 #7
0
ファイル: test_network.py プロジェクト: lovocas/nova
    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)
コード例 #8
0
 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)
コード例 #9
0
ファイル: fixed_ip.py プロジェクト: wputra/MOS-centos
 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)