Skip to content

Commit

Permalink
Implement the determinations of RFD 285 (#1329)
Browse files Browse the repository at this point in the history
  • Loading branch information
ahl authored Jul 6, 2022
1 parent 9c1fab7 commit 13d56ba
Show file tree
Hide file tree
Showing 9 changed files with 606 additions and 633 deletions.
527 changes: 264 additions & 263 deletions nexus/src/external_api/http_entrypoints.rs

Large diffs are not rendered by default.

14 changes: 4 additions & 10 deletions nexus/src/external_api/tag-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
"url": "http://oxide.computer/docs/#xxx"
}
},
"racks": {
"hardware": {
"description": "These operations pertain to hardware inventory and management. Racks are the unit of expansion of an Oxide deployment. Racks are in turn composed of sleds, switches, power supplies, and a cabled backplane.",
"external_docs": {
"url": "http://oxide.computer/docs/#xxx"
Expand Down Expand Up @@ -110,20 +110,14 @@
"url": "http://oxide.computer/docs/#xxx"
}
},
"sleds": {
"description": "This tag should be moved into hardware",
"external_docs": {
"url": "http://oxide.computer/docs/#xxx"
}
},
"snapshots": {
"description": "Snapshots of Virtual Disks at a particular point in time.",
"external_docs": {
"url": "http://oxide.computer/docs/#xxx"
}
},
"sshkeys": {
"description": "Public SSH keys for an individual user",
"session": {
"description": "Information pertaining to the current session.",
"external_docs": {
"url": "http://oxide.computer/docs/#xxx"
}
Expand Down Expand Up @@ -153,4 +147,4 @@
}
}
}
}
}
8 changes: 4 additions & 4 deletions nexus/tests/integration_tests/endpoints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ lazy_static! {
pub static ref DEMO_INSTANCE_NICS_URL: String =
format!("{}/network-interfaces", *DEMO_INSTANCE_URL);
pub static ref DEMO_INSTANCE_SERIAL_URL: String =
format!("{}/serial", *DEMO_INSTANCE_URL);
format!("{}/serial-console", *DEMO_INSTANCE_URL);
pub static ref DEMO_INSTANCE_CREATE: params::InstanceCreate =
params::InstanceCreate {
identity: IdentityMetadataCreateParams {
Expand Down Expand Up @@ -299,7 +299,7 @@ lazy_static! {
).unwrap());
pub static ref DEMO_IP_POOL_RANGES_URL: String = format!("{}/ranges", *DEMO_IP_POOL_URL);
pub static ref DEMO_IP_POOL_RANGES_ADD_URL: String = format!("{}/add", *DEMO_IP_POOL_RANGES_URL);
pub static ref DEMO_IP_POOL_RANGES_DEL_URL: String = format!("{}/delete", *DEMO_IP_POOL_RANGES_URL);
pub static ref DEMO_IP_POOL_RANGES_DEL_URL: String = format!("{}/remove", *DEMO_IP_POOL_RANGES_URL);

// Snapshots
pub static ref DEMO_SNAPSHOT_NAME: Name = "demo-snapshot".parse().unwrap();
Expand Down Expand Up @@ -456,7 +456,7 @@ impl AllowedMethod {

lazy_static! {
pub static ref URL_USERS_DB_INIT: String =
format!("/users_builtin/{}", authn::USER_DB_INIT.name);
format!("/system/user/{}", authn::USER_DB_INIT.name);

/// List of endpoints to be verified
pub static ref VERIFY_ENDPOINTS: Vec<VerifyEndpoint> = vec![
Expand Down Expand Up @@ -1000,7 +1000,7 @@ lazy_static! {
},

VerifyEndpoint {
url: "/users_builtin",
url: "/system/user",
visibility: Visibility::Public,
allowed_methods: vec![AllowedMethod::Get],
},
Expand Down
8 changes: 4 additions & 4 deletions nexus/tests/integration_tests/instances.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2298,17 +2298,17 @@ async fn test_instance_serial(cptestctx: &ControlPlaneTestContext) {
let nexus = &apictx.nexus;

// Create a project that we'll use for testing.
create_ip_pool(&client, POOL_NAME, None).await;
create_organization(&client, ORGANIZATION_NAME).await;
create_ip_pool(client, POOL_NAME, None).await;
create_organization(client, ORGANIZATION_NAME).await;
let url_instances = format!(
"/organizations/{}/projects/{}/instances",
ORGANIZATION_NAME, PROJECT_NAME
);
let _ = create_project(&client, ORGANIZATION_NAME, PROJECT_NAME).await;
let _ = create_project(client, ORGANIZATION_NAME, PROJECT_NAME).await;

// Make sure we get a 404 if we try to access the serial console before creation.
let instance_serial_url =
format!("{}/kris-picks/serial?from_start=0", url_instances);
format!("{}/kris-picks/serial-console?from_start=0", url_instances);
let error: HttpErrorResponseBody = NexusRequest::expect_failure(
client,
StatusCode::NOT_FOUND,
Expand Down
12 changes: 6 additions & 6 deletions nexus/tests/integration_tests/ip_pools.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,8 @@ async fn test_ip_pool_basic_crud(cptestctx: &ControlPlaneTestContext) {
// that the modification time has changed.
let new_pool_name = "p1";
let new_ip_pool_url = format!("{}/{}", ip_pools_url, new_pool_name);
let new_ip_pool_del_range_url =
format!("{}/ranges/delete", new_ip_pool_url);
let new_ip_pool_rem_range_url =
format!("{}/ranges/remove", new_ip_pool_url);
let updates = IpPoolUpdate {
identity: IdentityMetadataUpdateParams {
name: Some(String::from(new_pool_name).parse().unwrap()),
Expand Down Expand Up @@ -249,7 +249,7 @@ async fn test_ip_pool_basic_crud(cptestctx: &ControlPlaneTestContext) {
// Delete the range, then verify we can delete the pool and everything looks
// gravy.
NexusRequest::new(
RequestBuilder::new(client, Method::POST, &new_ip_pool_del_range_url)
RequestBuilder::new(client, Method::POST, &new_ip_pool_rem_range_url)
.body(Some(&range))
.expect_status(Some(StatusCode::NO_CONTENT)),
)
Expand Down Expand Up @@ -566,7 +566,7 @@ async fn test_ip_range_delete_with_allocated_external_ip_fails(
let ip_pool_url = format!("{}/{}", ip_pools_url, pool_name);
let ip_pool_ranges_url = format!("{}/ranges", ip_pool_url);
let ip_pool_add_range_url = format!("{}/add", ip_pool_ranges_url);
let ip_pool_del_range_url = format!("{}/delete", ip_pool_ranges_url);
let ip_pool_rem_range_url = format!("{}/remove", ip_pool_ranges_url);

// Add a pool and range.
let params = IpPoolCreate {
Expand Down Expand Up @@ -618,7 +618,7 @@ async fn test_ip_range_delete_with_allocated_external_ip_fails(
// We should not be able to delete the range, since there's an external IP
// address in use out of it.
let err: HttpErrorResponseBody = NexusRequest::new(
RequestBuilder::new(client, Method::POST, &ip_pool_del_range_url)
RequestBuilder::new(client, Method::POST, &ip_pool_rem_range_url)
.body(Some(&range))
.expect_status(Some(StatusCode::BAD_REQUEST)),
)
Expand Down Expand Up @@ -663,7 +663,7 @@ async fn test_ip_range_delete_with_allocated_external_ip_fails(

// Now verify that we _can_ delete the IP range.
NexusRequest::new(
RequestBuilder::new(client, Method::POST, &ip_pool_del_range_url)
RequestBuilder::new(client, Method::POST, &ip_pool_rem_range_url)
.body(Some(&range))
.expect_status(Some(StatusCode::NO_CONTENT)),
)
Expand Down
2 changes: 1 addition & 1 deletion nexus/tests/integration_tests/users_builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use std::collections::BTreeMap;
async fn test_users_builtin(cptestctx: &ControlPlaneTestContext) {
let testctx = &cptestctx.external_client;

let mut users = NexusRequest::object_get(&testctx, "/users_builtin")
let mut users = NexusRequest::object_get(testctx, "/system/user")
.authn_as(AuthnMode::PrivilegedUser)
.execute()
.await
Expand Down
Loading

0 comments on commit 13d56ba

Please sign in to comment.