.adminStateUp(true)
.deviceId("d6b4d3a5-c700-476f-b609-1493dd9dadc0")
.allowedAddressPairs(ImmutableSet.of(AddressPair.createOptions("12", "111.222.333.444").build()))
.build();
Port port = api.create(createPort);
/*
* Check request
*/
assertAuthentication(server);
assertRequest(server.takeRequest(), "POST", "/v2.0/ports", "/port_create_request.json");
/*
* Check response
*/
assertNotNull(port);
assertEquals(port.getAllowedAddressPairs().iterator().next().getIpAddress(), "192.168.1.1");
assertEquals(port.getAllowedAddressPairs().iterator().next().getMacAddress(), "12:12");
assertEquals(port.getName(), "port1");
assertEquals(port.getStatus(), NetworkStatus.ACTIVE);
assertEquals(port.getId(), "ebe69f1e-bc26-4db5-bed0-c0afb4afe3db");
assertEquals(port.getDeviceId(), "d6b4d3a5-c700-476f-b609-1493dd9dadc0");
assertEquals(port.getDeviceOwner(), "");
assertEquals(port.getMacAddress(), "fa:16:3e:a6:50:c1");
assertEquals(port.getNetworkId(), "6aeaf34a-c482-4bd3-9dc3-7faf36412f12");
assertEquals(port.getFixedIps().iterator().next().getIpAddress(), "192.168.111.4");
assertEquals(port.getFixedIps().iterator().next().getSubnetId(), "22b44fc2-4ffb-4de4-b0f9-69d58b37ae27");
assertEquals(port.getTenantId(), "cf1a5775e766426cb1968766d0191908");
} finally {
server.shutdown();
}
}