Skip to content

Commit

Permalink
Merge pull request #55 from equinix-labs/CXF-102607
Browse files Browse the repository at this point in the history
Cxf 102607
  • Loading branch information
tutkat authored Oct 11, 2024
2 parents 119522a + 5affe17 commit 428c520
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()))
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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()))
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
}

Expand Down
2 changes: 2 additions & 0 deletions templates/Java/libraries/okhttp-gson/JSON.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
}

Expand Down

0 comments on commit 428c520

Please sign in to comment.