コード例 #1
0
 def _test_update(self):
     nic = self.store.nic
     address = self.store.address
     netmask = self.store.netmask
     nic.ip = schema.new(schema.IP)
     nic.ip.address = util.ip_from_net(address, netmask, 2)
     nic.ip.netmask = netmask
     nic.ip.gateway = util.ip_from_net(address, netmask, 1)
     # BUG: PUT method not implemented
     # BUG: ID changes here
     nic2 = self.api.update(nic)
     assert isinstance(nic2, schema.HostNIC)
     #assert nic2.id == nic.id
     assert nic2.name == nic.name
     assert nic2.ip.address == nic.ip.address
     assert nic2.ip.netmask == nic.ip.netmask
     assert nic2.ip.gateway == nic.ip.gateway
     nic = self.api.reload(nic2)
     assert isinstance(nic2, schema.HostNIC)
     #assert nic.id == nic2.id
     assert nic.name == nic2.name
     assert nic.ip.address == nic2.ip.address
     assert nic.ip.netmask == nic2.ip.netmask
     assert nic.ip.gateway == nic2.ip.gateway
     self.store.nic = nic2  # store back changed ID
コード例 #2
0
ファイル: base.py プロジェクト: Jitendrakry/rhevm-api
 def get_unused_ip(self):
     address = self.get_config('address')
     netmask = self.get_config('netmask')
     ip = schema.new(schema.IP)
     ip.address = util.ip_from_net(address, netmask, 2)
     ip.netmask = netmask
     ip.gateway = util.ip_from_net(address, netmask, 1)
     return ip