From 9b936b0cb2b31e1b3fca1cd9521df20dd05033af Mon Sep 17 00:00:00 2001 From: Tomasz Tutka Date: Thu, 3 Oct 2024 08:20:05 +0200 Subject: [PATCH 1/5] fixes --- .../com/equinix/openapi/fabric/tests/ConnectionsApiTest.java | 2 +- templates/Java/libraries/okhttp-gson/JSON.mustache | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/equinix-openapi-fabric-tests/src/test/java/com/equinix/openapi/fabric/tests/ConnectionsApiTest.java b/equinix-openapi-fabric-tests/src/test/java/com/equinix/openapi/fabric/tests/ConnectionsApiTest.java index 7dfdbe5..8b87a9d 100644 --- a/equinix-openapi-fabric-tests/src/test/java/com/equinix/openapi/fabric/tests/ConnectionsApiTest.java +++ b/equinix-openapi-fabric-tests/src/test/java/com/equinix/openapi/fabric/tests/ConnectionsApiTest.java @@ -364,7 +364,7 @@ public static boolean waitForConnectionIsInState(String connectionUuid, EquinixS } } try { - Thread.sleep(15000); + Thread.sleep(30000); } catch (InterruptedException e) { throw new RuntimeException(e); } diff --git a/templates/Java/libraries/okhttp-gson/JSON.mustache b/templates/Java/libraries/okhttp-gson/JSON.mustache index c0141b3..a36067e 100644 --- a/templates/Java/libraries/okhttp-gson/JSON.mustache +++ b/templates/Java/libraries/okhttp-gson/JSON.mustache @@ -4,6 +4,7 @@ package {{invokerPackage}}; import com.equinix.openapi.fabric.v4.model.PortDeviceRedundancy; import com.equinix.openapi.fabric.v4.model.PortEncapsulation; +import com.equinix.openapi.fabric.v4.model.PortPriority; import com.fasterxml.jackson.databind.util.StdDateFormat; import com.google.gson.Gson; import com.google.gson.GsonBuilder; @@ -164,6 +165,7 @@ public class JSON { {{/models}} gsonBuilder.registerTypeAdapter(PortEncapsulation.TypeEnum.class,new UppercaseEnumAdapter()); gsonBuilder.registerTypeAdapter(PortDeviceRedundancy.PriorityEnum.class,new UppercaseEnumAdapter()); + gsonBuilder.registerTypeAdapter(PortPriority.class, new UppercaseEnumAdapter()); gson = gsonBuilder.setPrettyPrinting().create(); } From 10d292829de605b3197ce19489ed277bc4d0678a Mon Sep 17 00:00:00 2001 From: "equinix-labs@auto-commit-workflow" Date: Thu, 3 Oct 2024 06:27:34 +0000 Subject: [PATCH 2/5] Auto commit generated client changes - Thu Oct 3 06:27:34 UTC 2024 --- .../src/main/java/com/equinix/openapi/fabric/JSON.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/equinix-openapi-fabric/src/main/java/com/equinix/openapi/fabric/JSON.java b/equinix-openapi-fabric/src/main/java/com/equinix/openapi/fabric/JSON.java index 6bacc54..75fff56 100644 --- a/equinix-openapi-fabric/src/main/java/com/equinix/openapi/fabric/JSON.java +++ b/equinix-openapi-fabric/src/main/java/com/equinix/openapi/fabric/JSON.java @@ -13,6 +13,7 @@ import com.equinix.openapi.fabric.v4.model.PortDeviceRedundancy; import com.equinix.openapi.fabric.v4.model.PortEncapsulation; +import com.equinix.openapi.fabric.v4.model.PortPriority; import com.fasterxml.jackson.databind.util.StdDateFormat; import com.google.gson.Gson; import com.google.gson.GsonBuilder; @@ -431,6 +432,7 @@ public Enum deserialize(JsonElement json, java.lang.reflect.Type type, JsonDeser gsonBuilder.registerTypeAdapterFactory(new com.equinix.openapi.fabric.v4.model.VpicInterface.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapter(PortEncapsulation.TypeEnum.class,new UppercaseEnumAdapter()); gsonBuilder.registerTypeAdapter(PortDeviceRedundancy.PriorityEnum.class,new UppercaseEnumAdapter()); + gsonBuilder.registerTypeAdapter(PortPriority.class, new UppercaseEnumAdapter()); gson = gsonBuilder.setPrettyPrinting().create(); } From 6103b4aede06924357eeeff2a0772cd4fd074890 Mon Sep 17 00:00:00 2001 From: Tomasz Tutka Date: Mon, 7 Oct 2024 08:55:41 +0200 Subject: [PATCH 3/5] added user prefix for creating resources, added protection to remove all created resources during tests --- .../fabric/tests/CloudRoutersApiTest.java | 12 ++++++++---- .../fabric/tests/ConnectionsApiTest.java | 19 +++++++++++-------- .../openapi/fabric/tests/NetworksApiTest.java | 9 ++++----- .../fabric/tests/RoutingProtocolsApiTest.java | 2 +- .../fabric/tests/ServiceProfilesApiTest.java | 15 +++++++++------ 5 files changed, 33 insertions(+), 24 deletions(-) diff --git a/equinix-openapi-fabric-tests/src/test/java/com/equinix/openapi/fabric/tests/CloudRoutersApiTest.java b/equinix-openapi-fabric-tests/src/test/java/com/equinix/openapi/fabric/tests/CloudRoutersApiTest.java index 38708a6..40105ea 100644 --- a/equinix-openapi-fabric-tests/src/test/java/com/equinix/openapi/fabric/tests/CloudRoutersApiTest.java +++ b/equinix-openapi-fabric-tests/src/test/java/com/equinix/openapi/fabric/tests/CloudRoutersApiTest.java @@ -35,7 +35,11 @@ public class CloudRoutersApiTest { public static void removeCloudRouters(UsersItem.UserName userName) { users.get(userName).getUserResources().getCloudRoutersUuid().forEach(uuid -> { if (getCloudRouterStatus(uuid) == CloudRouterAccessPointState.PROVISIONED) { - deleteCloudRouter(uuid); + try { + deleteCloudRouter(uuid); + } catch (Exception e) { + + } } }); } @@ -192,7 +196,7 @@ public void searchCloudRouters() throws ApiException { @Test public void updateCloudRouterByUuid() throws ApiException { CloudRouter cloudRouter = createRouter(); - String updatedName = "panthers_new_fcr_name"; + String updatedName = "panthers_new_fcr_name" + getCurrentUser().getValue(); CloudRouterChangeOperation cloudRouterChangeOperation = new CloudRouterChangeOperation() .op(CloudRouterChangeOperation.OpEnum.REPLACE) @@ -209,7 +213,7 @@ public static void deleteCloudRouter(UUID uuid) { waitForCloudRouterIsProvisioned(uuid); cloudRoutersApi.deleteCloudRouterByUuid(uuid); } catch (ApiException e) { - throw new RuntimeException(e); + System.out.println("Cloud router has not been removed for " + uuid); } assertEquals(204, cloudRoutersApi.getApiClient().getStatusCode()); } @@ -225,7 +229,7 @@ public static CloudRouterAccessPointState getCloudRouterStatus(UUID cloudRouterU public static CloudRouter createRouter() throws ApiException { UsersItem user = Utils.getUserData(getCurrentUser()); - String cloudRouterName = "panthers-test-java-sdk"; + String cloudRouterName = "panthers-fcr-java" + getCurrentUser().getValue(); CloudRouterPostRequest cloudRouterPostRequest = new CloudRouterPostRequest(); cloudRouterPostRequest.type(CloudRouterPostRequest.TypeEnum.XF_ROUTER) .name(cloudRouterName) diff --git a/equinix-openapi-fabric-tests/src/test/java/com/equinix/openapi/fabric/tests/ConnectionsApiTest.java b/equinix-openapi-fabric-tests/src/test/java/com/equinix/openapi/fabric/tests/ConnectionsApiTest.java index 8b87a9d..9ed56c9 100644 --- a/equinix-openapi-fabric-tests/src/test/java/com/equinix/openapi/fabric/tests/ConnectionsApiTest.java +++ b/equinix-openapi-fabric-tests/src/test/java/com/equinix/openapi/fabric/tests/ConnectionsApiTest.java @@ -45,7 +45,6 @@ public static void removeConnections(UsersItem.UserName userName) { try { deleteConnection(uuid); } catch (ApiException e) { - throw new RuntimeException(e); } }); } @@ -212,7 +211,7 @@ public static Connection createConnectionFCR2ToPort() throws ApiException { public static ConnectionPostRequest getDefaultConnectionRequest(String name) { return new ConnectionPostRequest() - .name(name) + .name(name + getCurrentUser().getValue()) .notifications(singletonList(new SimplifiedNotification() .type(SimplifiedNotification.TypeEnum.ALL) .emails(singletonList("test@test.com")))); @@ -275,7 +274,7 @@ public static Connection createPort2SpConnection() throws ApiException { @Test public void updateConnectionByUuid() throws ApiException { Connection connection = createPort2Port(); - String updatedName = "updated_p2p_connection"; + String updatedName = "updated_p2p_connection" + getCurrentUser().getValue(); ConnectionChangeOperation connectionChangeOperation = new ConnectionChangeOperation() .op(OpEnum.REPLACE.getValue()) @@ -364,7 +363,7 @@ public static boolean waitForConnectionIsInState(String connectionUuid, EquinixS } } try { - Thread.sleep(30000); + Thread.sleep(15000); } catch (InterruptedException e) { throw new RuntimeException(e); } @@ -378,10 +377,14 @@ public static boolean waitForConnectionIsInState(String connectionUuid, EquinixS private static void deleteConnection(String uuid) throws ApiException { for (int i = 0; i < 3; i++) { - connectionsApi.deleteConnectionByUuid(uuid); - boolean isDeleted = waitForConnectionIsInState(uuid, EquinixStatus.DELETED, EquinixStatus.DEPROVISIONED); - if (isDeleted) { - break; + try { + connectionsApi.deleteConnectionByUuid(uuid); + boolean isDeleted = waitForConnectionIsInState(uuid, EquinixStatus.DELETED, EquinixStatus.DEPROVISIONED); + if (isDeleted) { + break; + } + } catch (Exception e) { + System.out.println("Connection has not been removed for " + uuid); } } } diff --git a/equinix-openapi-fabric-tests/src/test/java/com/equinix/openapi/fabric/tests/NetworksApiTest.java b/equinix-openapi-fabric-tests/src/test/java/com/equinix/openapi/fabric/tests/NetworksApiTest.java index f196088..ee21e9a 100644 --- a/equinix-openapi-fabric-tests/src/test/java/com/equinix/openapi/fabric/tests/NetworksApiTest.java +++ b/equinix-openapi-fabric-tests/src/test/java/com/equinix/openapi/fabric/tests/NetworksApiTest.java @@ -20,8 +20,7 @@ import java.util.UUID; -import static com.equinix.openapi.fabric.tests.helpers.Apis.networksApi; -import static com.equinix.openapi.fabric.tests.helpers.Apis.setUserName; +import static com.equinix.openapi.fabric.tests.helpers.Apis.*; import static com.equinix.openapi.fabric.tests.helpers.TokenGenerator.users; import static java.util.Collections.singletonList; import static org.junit.Assert.assertEquals; @@ -50,7 +49,7 @@ public static void removeResources() { public Network createNetwork() throws ApiException { UsersItem user = Utils.getUserData(userName); NetworkPostRequest networkPostRequest = new NetworkPostRequest() - .name("network_panthers_test") + .name("network_panthers_test" + getCurrentUser().getValue()) .type(NetworkType.EVPLAN) .scope(NetworkScope.LOCAL) .project(new Project().projectId(user.getProjectId())) @@ -94,7 +93,7 @@ public static void deleteNetwork(UUID uuid) { assertEquals(202, networksApi.getApiClient().getStatusCode()); } } catch (ApiException e) { - throw new RuntimeException(e); + System.out.println("Network has not been removed for " + uuid); } } @@ -124,7 +123,7 @@ public void getNetworkByUuid() throws ApiException { */ @Test public void updateNetwork() throws ApiException { - String updatedName = "network_new_updatedName"; + String updatedName = "network_new_updatedName" + getCurrentUser().getValue(); Network network = createNetwork(); NetworkChangeOperation changeOperation = new NetworkChangeOperation() .op(NetworkChangeOperation.OpEnum.REPLACE) diff --git a/equinix-openapi-fabric-tests/src/test/java/com/equinix/openapi/fabric/tests/RoutingProtocolsApiTest.java b/equinix-openapi-fabric-tests/src/test/java/com/equinix/openapi/fabric/tests/RoutingProtocolsApiTest.java index fc47ec0..e8716b8 100644 --- a/equinix-openapi-fabric-tests/src/test/java/com/equinix/openapi/fabric/tests/RoutingProtocolsApiTest.java +++ b/equinix-openapi-fabric-tests/src/test/java/com/equinix/openapi/fabric/tests/RoutingProtocolsApiTest.java @@ -93,7 +93,7 @@ public static void deleteRoutingProtocol(UserResources.RoutingProtocolDto routin routingProtocolsApi.deleteConnectionRoutingProtocolByUuid(routingProtocolDto.getRoutingInstanceUuid(), String.valueOf(routingProtocolDto.getConnectionUuid())); assertEquals(202, routingProtocolsApi.getApiClient().getStatusCode()); } catch (ApiException e) { - throw new RuntimeException(e); + System.out.println("Routing protocol has not been removed for " + routingProtocolDto.getRoutingInstanceUuid()); } } diff --git a/equinix-openapi-fabric-tests/src/test/java/com/equinix/openapi/fabric/tests/ServiceProfilesApiTest.java b/equinix-openapi-fabric-tests/src/test/java/com/equinix/openapi/fabric/tests/ServiceProfilesApiTest.java index 25181c6..8215e5e 100644 --- a/equinix-openapi-fabric-tests/src/test/java/com/equinix/openapi/fabric/tests/ServiceProfilesApiTest.java +++ b/equinix-openapi-fabric-tests/src/test/java/com/equinix/openapi/fabric/tests/ServiceProfilesApiTest.java @@ -25,8 +25,7 @@ import java.util.UUID; import static com.equinix.openapi.fabric.tests.PortsApiTest.getPorts; -import static com.equinix.openapi.fabric.tests.helpers.Apis.serviceProfilesApi; -import static com.equinix.openapi.fabric.tests.helpers.Apis.setUserName; +import static com.equinix.openapi.fabric.tests.helpers.Apis.*; import static com.equinix.openapi.fabric.tests.helpers.TokenGenerator.users; import static com.equinix.openapi.fabric.v4.model.Expression.OperatorEnum.EQUAL; import static java.util.Collections.singletonList; @@ -169,9 +168,13 @@ public void updateServiceProfileByUuid() throws ApiException { } private static void deleteServiceProfile(UUID uuid) throws ApiException { - serviceProfilesApi.deleteServiceProfileByUuid(uuid); - assertEquals(200, serviceProfilesApi.getApiClient().getStatusCode()); - waitForSpIsInState(uuid, ServiceProfileStateEnum.DELETED); + try { + serviceProfilesApi.deleteServiceProfileByUuid(uuid); + assertEquals(200, serviceProfilesApi.getApiClient().getStatusCode()); + waitForSpIsInState(uuid, ServiceProfileStateEnum.DELETED); + } catch (Exception e) { + System.out.println("Service profile has not been removed for " + uuid); + } } private static void waitForSpIsInState(UUID uuid, ServiceProfileStateEnum state) throws ApiException { @@ -208,7 +211,7 @@ private ServiceProfileRequest getServiceProfileRequest() throws ApiException { .filter(p -> p.getName().contains("Dot1q")) .findFirst().get(); return new ServiceProfileRequest() - .name("panthers-sp2-test" + RandomStringUtils.randomAlphabetic(5)) + .name("panthers-sp2-test" + RandomStringUtils.randomAlphabetic(5) + getCurrentUser().getValue()) .description("desc") .type(ServiceProfileTypeEnum.L2_PROFILE) .notifications( From 52e7018459b5b74fc3c14bd1520539c2468362a3 Mon Sep 17 00:00:00 2001 From: Tomasz Tutka Date: Mon, 7 Oct 2024 08:56:13 +0200 Subject: [PATCH 4/5] Revert "added user prefix for creating resources, added protection to remove all created resources during tests" This reverts commit 373e1f85ac23162f88ab0ca0109cf65cc24b7f3b. --- .../fabric/tests/CloudRoutersApiTest.java | 12 ++++-------- .../fabric/tests/ConnectionsApiTest.java | 17 +++++++---------- .../openapi/fabric/tests/NetworksApiTest.java | 9 +++++---- .../fabric/tests/RoutingProtocolsApiTest.java | 2 +- .../fabric/tests/ServiceProfilesApiTest.java | 15 ++++++--------- 5 files changed, 23 insertions(+), 32 deletions(-) diff --git a/equinix-openapi-fabric-tests/src/test/java/com/equinix/openapi/fabric/tests/CloudRoutersApiTest.java b/equinix-openapi-fabric-tests/src/test/java/com/equinix/openapi/fabric/tests/CloudRoutersApiTest.java index 40105ea..38708a6 100644 --- a/equinix-openapi-fabric-tests/src/test/java/com/equinix/openapi/fabric/tests/CloudRoutersApiTest.java +++ b/equinix-openapi-fabric-tests/src/test/java/com/equinix/openapi/fabric/tests/CloudRoutersApiTest.java @@ -35,11 +35,7 @@ public class CloudRoutersApiTest { public static void removeCloudRouters(UsersItem.UserName userName) { users.get(userName).getUserResources().getCloudRoutersUuid().forEach(uuid -> { if (getCloudRouterStatus(uuid) == CloudRouterAccessPointState.PROVISIONED) { - try { - deleteCloudRouter(uuid); - } catch (Exception e) { - - } + deleteCloudRouter(uuid); } }); } @@ -196,7 +192,7 @@ public void searchCloudRouters() throws ApiException { @Test public void updateCloudRouterByUuid() throws ApiException { CloudRouter cloudRouter = createRouter(); - String updatedName = "panthers_new_fcr_name" + getCurrentUser().getValue(); + String updatedName = "panthers_new_fcr_name"; CloudRouterChangeOperation cloudRouterChangeOperation = new CloudRouterChangeOperation() .op(CloudRouterChangeOperation.OpEnum.REPLACE) @@ -213,7 +209,7 @@ public static void deleteCloudRouter(UUID uuid) { waitForCloudRouterIsProvisioned(uuid); cloudRoutersApi.deleteCloudRouterByUuid(uuid); } catch (ApiException e) { - System.out.println("Cloud router has not been removed for " + uuid); + throw new RuntimeException(e); } assertEquals(204, cloudRoutersApi.getApiClient().getStatusCode()); } @@ -229,7 +225,7 @@ public static CloudRouterAccessPointState getCloudRouterStatus(UUID cloudRouterU public static CloudRouter createRouter() throws ApiException { UsersItem user = Utils.getUserData(getCurrentUser()); - String cloudRouterName = "panthers-fcr-java" + getCurrentUser().getValue(); + String cloudRouterName = "panthers-test-java-sdk"; CloudRouterPostRequest cloudRouterPostRequest = new CloudRouterPostRequest(); cloudRouterPostRequest.type(CloudRouterPostRequest.TypeEnum.XF_ROUTER) .name(cloudRouterName) diff --git a/equinix-openapi-fabric-tests/src/test/java/com/equinix/openapi/fabric/tests/ConnectionsApiTest.java b/equinix-openapi-fabric-tests/src/test/java/com/equinix/openapi/fabric/tests/ConnectionsApiTest.java index 9ed56c9..7dfdbe5 100644 --- a/equinix-openapi-fabric-tests/src/test/java/com/equinix/openapi/fabric/tests/ConnectionsApiTest.java +++ b/equinix-openapi-fabric-tests/src/test/java/com/equinix/openapi/fabric/tests/ConnectionsApiTest.java @@ -45,6 +45,7 @@ public static void removeConnections(UsersItem.UserName userName) { try { deleteConnection(uuid); } catch (ApiException e) { + throw new RuntimeException(e); } }); } @@ -211,7 +212,7 @@ public static Connection createConnectionFCR2ToPort() throws ApiException { public static ConnectionPostRequest getDefaultConnectionRequest(String name) { return new ConnectionPostRequest() - .name(name + getCurrentUser().getValue()) + .name(name) .notifications(singletonList(new SimplifiedNotification() .type(SimplifiedNotification.TypeEnum.ALL) .emails(singletonList("test@test.com")))); @@ -274,7 +275,7 @@ public static Connection createPort2SpConnection() throws ApiException { @Test public void updateConnectionByUuid() throws ApiException { Connection connection = createPort2Port(); - String updatedName = "updated_p2p_connection" + getCurrentUser().getValue(); + String updatedName = "updated_p2p_connection"; ConnectionChangeOperation connectionChangeOperation = new ConnectionChangeOperation() .op(OpEnum.REPLACE.getValue()) @@ -377,14 +378,10 @@ public static boolean waitForConnectionIsInState(String connectionUuid, EquinixS private static void deleteConnection(String uuid) throws ApiException { for (int i = 0; i < 3; i++) { - try { - connectionsApi.deleteConnectionByUuid(uuid); - boolean isDeleted = waitForConnectionIsInState(uuid, EquinixStatus.DELETED, EquinixStatus.DEPROVISIONED); - if (isDeleted) { - break; - } - } catch (Exception e) { - System.out.println("Connection has not been removed for " + uuid); + connectionsApi.deleteConnectionByUuid(uuid); + boolean isDeleted = waitForConnectionIsInState(uuid, EquinixStatus.DELETED, EquinixStatus.DEPROVISIONED); + if (isDeleted) { + break; } } } diff --git a/equinix-openapi-fabric-tests/src/test/java/com/equinix/openapi/fabric/tests/NetworksApiTest.java b/equinix-openapi-fabric-tests/src/test/java/com/equinix/openapi/fabric/tests/NetworksApiTest.java index ee21e9a..f196088 100644 --- a/equinix-openapi-fabric-tests/src/test/java/com/equinix/openapi/fabric/tests/NetworksApiTest.java +++ b/equinix-openapi-fabric-tests/src/test/java/com/equinix/openapi/fabric/tests/NetworksApiTest.java @@ -20,7 +20,8 @@ import java.util.UUID; -import static com.equinix.openapi.fabric.tests.helpers.Apis.*; +import static com.equinix.openapi.fabric.tests.helpers.Apis.networksApi; +import static com.equinix.openapi.fabric.tests.helpers.Apis.setUserName; import static com.equinix.openapi.fabric.tests.helpers.TokenGenerator.users; import static java.util.Collections.singletonList; import static org.junit.Assert.assertEquals; @@ -49,7 +50,7 @@ public static void removeResources() { public Network createNetwork() throws ApiException { UsersItem user = Utils.getUserData(userName); NetworkPostRequest networkPostRequest = new NetworkPostRequest() - .name("network_panthers_test" + getCurrentUser().getValue()) + .name("network_panthers_test") .type(NetworkType.EVPLAN) .scope(NetworkScope.LOCAL) .project(new Project().projectId(user.getProjectId())) @@ -93,7 +94,7 @@ public static void deleteNetwork(UUID uuid) { assertEquals(202, networksApi.getApiClient().getStatusCode()); } } catch (ApiException e) { - System.out.println("Network has not been removed for " + uuid); + throw new RuntimeException(e); } } @@ -123,7 +124,7 @@ public void getNetworkByUuid() throws ApiException { */ @Test public void updateNetwork() throws ApiException { - String updatedName = "network_new_updatedName" + getCurrentUser().getValue(); + String updatedName = "network_new_updatedName"; Network network = createNetwork(); NetworkChangeOperation changeOperation = new NetworkChangeOperation() .op(NetworkChangeOperation.OpEnum.REPLACE) diff --git a/equinix-openapi-fabric-tests/src/test/java/com/equinix/openapi/fabric/tests/RoutingProtocolsApiTest.java b/equinix-openapi-fabric-tests/src/test/java/com/equinix/openapi/fabric/tests/RoutingProtocolsApiTest.java index e8716b8..fc47ec0 100644 --- a/equinix-openapi-fabric-tests/src/test/java/com/equinix/openapi/fabric/tests/RoutingProtocolsApiTest.java +++ b/equinix-openapi-fabric-tests/src/test/java/com/equinix/openapi/fabric/tests/RoutingProtocolsApiTest.java @@ -93,7 +93,7 @@ public static void deleteRoutingProtocol(UserResources.RoutingProtocolDto routin routingProtocolsApi.deleteConnectionRoutingProtocolByUuid(routingProtocolDto.getRoutingInstanceUuid(), String.valueOf(routingProtocolDto.getConnectionUuid())); assertEquals(202, routingProtocolsApi.getApiClient().getStatusCode()); } catch (ApiException e) { - System.out.println("Routing protocol has not been removed for " + routingProtocolDto.getRoutingInstanceUuid()); + throw new RuntimeException(e); } } diff --git a/equinix-openapi-fabric-tests/src/test/java/com/equinix/openapi/fabric/tests/ServiceProfilesApiTest.java b/equinix-openapi-fabric-tests/src/test/java/com/equinix/openapi/fabric/tests/ServiceProfilesApiTest.java index 8215e5e..25181c6 100644 --- a/equinix-openapi-fabric-tests/src/test/java/com/equinix/openapi/fabric/tests/ServiceProfilesApiTest.java +++ b/equinix-openapi-fabric-tests/src/test/java/com/equinix/openapi/fabric/tests/ServiceProfilesApiTest.java @@ -25,7 +25,8 @@ import java.util.UUID; import static com.equinix.openapi.fabric.tests.PortsApiTest.getPorts; -import static com.equinix.openapi.fabric.tests.helpers.Apis.*; +import static com.equinix.openapi.fabric.tests.helpers.Apis.serviceProfilesApi; +import static com.equinix.openapi.fabric.tests.helpers.Apis.setUserName; import static com.equinix.openapi.fabric.tests.helpers.TokenGenerator.users; import static com.equinix.openapi.fabric.v4.model.Expression.OperatorEnum.EQUAL; import static java.util.Collections.singletonList; @@ -168,13 +169,9 @@ public void updateServiceProfileByUuid() throws ApiException { } private static void deleteServiceProfile(UUID uuid) throws ApiException { - try { - serviceProfilesApi.deleteServiceProfileByUuid(uuid); - assertEquals(200, serviceProfilesApi.getApiClient().getStatusCode()); - waitForSpIsInState(uuid, ServiceProfileStateEnum.DELETED); - } catch (Exception e) { - System.out.println("Service profile has not been removed for " + uuid); - } + serviceProfilesApi.deleteServiceProfileByUuid(uuid); + assertEquals(200, serviceProfilesApi.getApiClient().getStatusCode()); + waitForSpIsInState(uuid, ServiceProfileStateEnum.DELETED); } private static void waitForSpIsInState(UUID uuid, ServiceProfileStateEnum state) throws ApiException { @@ -211,7 +208,7 @@ private ServiceProfileRequest getServiceProfileRequest() throws ApiException { .filter(p -> p.getName().contains("Dot1q")) .findFirst().get(); return new ServiceProfileRequest() - .name("panthers-sp2-test" + RandomStringUtils.randomAlphabetic(5) + getCurrentUser().getValue()) + .name("panthers-sp2-test" + RandomStringUtils.randomAlphabetic(5)) .description("desc") .type(ServiceProfileTypeEnum.L2_PROFILE) .notifications( From 5affe17b0177d138ccabe67e41d1fdd381a6ebbd Mon Sep 17 00:00:00 2001 From: Tomasz Tutka Date: Mon, 7 Oct 2024 13:11:24 +0200 Subject: [PATCH 5/5] fixed issues --- .../fabric/tests/ConnectionsApiTest.java | 21 ++++++++++--------- .../openapi/fabric/tests/NetworksApiTest.java | 7 +++---- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/equinix-openapi-fabric-tests/src/test/java/com/equinix/openapi/fabric/tests/ConnectionsApiTest.java b/equinix-openapi-fabric-tests/src/test/java/com/equinix/openapi/fabric/tests/ConnectionsApiTest.java index 7dfdbe5..54fc2b0 100644 --- a/equinix-openapi-fabric-tests/src/test/java/com/equinix/openapi/fabric/tests/ConnectionsApiTest.java +++ b/equinix-openapi-fabric-tests/src/test/java/com/equinix/openapi/fabric/tests/ConnectionsApiTest.java @@ -38,16 +38,16 @@ public class ConnectionsApiTest { public static void removeConnections(UsersItem.UserName userName) { try { Thread.sleep(20000); + users.get(userName).getUserResources().getConnectionsUuid().forEach(uuid -> { + try { + deleteConnection(uuid); + } catch (ApiException e) { + throw new RuntimeException(e); + } + }); } catch (InterruptedException e) { throw new RuntimeException(e); } - users.get(userName).getUserResources().getConnectionsUuid().forEach(uuid -> { - try { - deleteConnection(uuid); - } catch (ApiException e) { - throw new RuntimeException(e); - } - }); } @BeforeClass @@ -177,7 +177,7 @@ public static Connection createConnectionFCR2ToPort() throws ApiException { Port port = portList.get(r.nextInt(portList.size())); - ConnectionPostRequest connectionPostRequest = getDefaultConnectionRequest("panthers-con-fcr-2-port") + ConnectionPostRequest connectionPostRequest = getDefaultConnectionRequest("panthers-con-fc2p") .type(ConnectionType.IP_VC) .bandwidth(1000) .project(new Project().projectId(userDto.getProjectId())) @@ -229,7 +229,7 @@ public static Connection createPort2SpConnection() throws ApiException { UsersItem usersItem = Utils.getUserData(getCurrentUser()); PortDto portDto = usersItem.getPorts().get(0); - ConnectionPostRequest connectionPostRequest = getDefaultConnectionRequest("panthers-con-port-2-sp") + ConnectionPostRequest connectionPostRequest = getDefaultConnectionRequest("panthers-con-p2sp") .bandwidth(serviceProfile.getAccessPointTypeConfigs().get(0).getServiceProfileAccessPointTypeCOLO().getSupportedBandwidths().get(0)) .type(ConnectionType.EVPL_VC) .redundancy(new ConnectionRedundancy().priority(ConnectionPriority.PRIMARY)) @@ -275,6 +275,7 @@ public static Connection createPort2SpConnection() throws ApiException { @Test public void updateConnectionByUuid() throws ApiException { Connection connection = createPort2Port(); + waitForConnectionIsInState(connection.getUuid(), EquinixStatus.PROVISIONED); String updatedName = "updated_p2p_connection"; ConnectionChangeOperation connectionChangeOperation = new ConnectionChangeOperation() @@ -312,7 +313,7 @@ public static Connection createPort2Port() throws ApiException { int tagAside = getRandomVlanNumber(); int tagZside = getRandomVlanNumber(); - ConnectionPostRequest connectionPostRequest = getDefaultConnectionRequest("panthers-con-port-2-port") + ConnectionPostRequest connectionPostRequest = getDefaultConnectionRequest("panthers-con-p2p") .bandwidth(1000) .type(ConnectionType.EVPL_VC) .redundancy(new ConnectionRedundancy().priority(ConnectionPriority.PRIMARY)) diff --git a/equinix-openapi-fabric-tests/src/test/java/com/equinix/openapi/fabric/tests/NetworksApiTest.java b/equinix-openapi-fabric-tests/src/test/java/com/equinix/openapi/fabric/tests/NetworksApiTest.java index f196088..a2d0112 100644 --- a/equinix-openapi-fabric-tests/src/test/java/com/equinix/openapi/fabric/tests/NetworksApiTest.java +++ b/equinix-openapi-fabric-tests/src/test/java/com/equinix/openapi/fabric/tests/NetworksApiTest.java @@ -20,8 +20,7 @@ import java.util.UUID; -import static com.equinix.openapi.fabric.tests.helpers.Apis.networksApi; -import static com.equinix.openapi.fabric.tests.helpers.Apis.setUserName; +import static com.equinix.openapi.fabric.tests.helpers.Apis.*; import static com.equinix.openapi.fabric.tests.helpers.TokenGenerator.users; import static java.util.Collections.singletonList; import static org.junit.Assert.assertEquals; @@ -50,7 +49,7 @@ public static void removeResources() { public Network createNetwork() throws ApiException { UsersItem user = Utils.getUserData(userName); NetworkPostRequest networkPostRequest = new NetworkPostRequest() - .name("network_panthers_test") + .name("panthers_network" + getCurrentUser().getValue()) .type(NetworkType.EVPLAN) .scope(NetworkScope.LOCAL) .project(new Project().projectId(user.getProjectId())) @@ -124,7 +123,7 @@ public void getNetworkByUuid() throws ApiException { */ @Test public void updateNetwork() throws ApiException { - String updatedName = "network_new_updatedName"; + String updatedName = "panthers_network_updated"; Network network = createNetwork(); NetworkChangeOperation changeOperation = new NetworkChangeOperation() .op(NetworkChangeOperation.OpEnum.REPLACE)