public function testCreateNic() { $nic = new \Swagger\Client\Model\Nic(); $props = new \Swagger\Client\Model\NicProperties(); $props->setName("jclouds-nic")->setLan(1); $nic->setProperties($props); self::$testNic = self::$nic_api->create(self::$testDatacenter->getId(), self::$testServer->getId(), $nic); $result = self::assertPredicate(function () { $nic = self::$nic_api->findById(self::$testDatacenter->getId(), self::$testServer->getId(), self::$testNic->getId()); if ($nic->getMetadata()->getState() == 'AVAILABLE') { return $nic; } }); $this->assertEquals($result->getProperties()->getName(), "jclouds-nic"); }
public function testUpdate() { $nic = new \Swagger\Client\Model\Nic(); $props = new \Swagger\Client\Model\NicProperties(); $props->setName("new-name"); $nic->setProperties($props); self::$nic_api->partialUpdate(self::$testDatacenter->getId(), self::$testServer->getId(), self::$testNic->getId(), $props); $result = self::assertPredicate(function () { $nic = self::$nic_api->findById(self::$testDatacenter->getId(), self::$testServer->getId(), self::$testNic->getId()); if ($nic->getMetadata()->getState() == 'AVAILABLE') { return $nic; } }); self::assertDatacenterAvailable(self::$testDatacenter->getId()); $updatedNic = self::$nic_api->findById(self::$testDatacenter->getId(), self::$testServer->getId(), self::$testNic->getId()); $this->assertEquals($updatedNic->getProperties()->getName(), "new-name"); }