Skip to content

Commit

Permalink
corrected dto's and updated flow to use secrets
Browse files Browse the repository at this point in the history
  • Loading branch information
tutkat committed May 29, 2024
1 parent 42a4846 commit 5aa0aaf
Show file tree
Hide file tree
Showing 13 changed files with 355 additions and 154 deletions.
12 changes: 9 additions & 3 deletions .github/workflows/auto-commit-client-updates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ jobs:
build:
runs-on: ubuntu-latest

env:
TEST_DATA_UAT_QINQ_PORT: ${{ secrets.TEST_DATA_UAT_QINQ_PORT }}

steps:
- uses: actions/checkout@v3

Expand All @@ -22,16 +25,19 @@ jobs:
distribution: 'temurin'
cache: maven

- name: Set git user and generate files
- name: Set git user
run: |
git config --global user.name 'equinix-labs@auto-commit-workflow'
git config --global user.email '[email protected]'
git config advice.addIgnoredFile false
git fetch
echo -e "\nThis is executing for branch: ${GITHUB_REF##*/}."
git checkout ${GITHUB_REF##*/}
git checkout ${GITHUB_REF##*/}
- name: Setup variables and generate files
run: |
echo $TEST_DATA_UAT_QINQ_PORT >> "./v4/api/json/port-2-public-service-profile-connection.json"
make generate
echo -e "Make execution completed."
- name: Tests
env:
Expand Down
2 changes: 1 addition & 1 deletion v4/api/AbstractTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
import com.equinix.openapi.fabric.ApiException;
import com.equinix.openapi.fabric.Configuration;
import com.equinix.openapi.fabric.Pair;
import com.equinix.openapi.fabric.v4.api.dto.PortDto;
import com.equinix.openapi.fabric.v4.api.dto.TokenRequestDto;
import com.equinix.openapi.fabric.v4.api.dto.TokenResponseDto;
import com.equinix.openapi.fabric.v4.api.dto.port.PortDto;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectWriter;
Expand Down
6 changes: 3 additions & 3 deletions v4/api/PortsApiTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
package com.equinix.openapi.fabric.v4.api;

import com.equinix.openapi.fabric.ApiException;
import com.equinix.openapi.fabric.v4.api.dto.PortDto;
import com.equinix.openapi.fabric.v4.api.dto.port.PortDto;
import com.equinix.openapi.fabric.v4.model.*;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Disabled;
Expand Down Expand Up @@ -108,9 +108,9 @@ public void getPortByUuidTest() throws ApiException {
@Test
public void getPortsTest() throws ApiException {
PortDto portDto = getPort(JsonFiles.PORT_2_PUBLIC_SERVICE_PROFILE_CONNECTION);
AllPortsResponse response = api.getPorts(portDto.getAsidePortName());
AllPortsResponse response = api.getPorts(portDto.getName());
assertEquals(200, api.getApiClient().getStatusCode());
assertEquals(portDto.getAsidePortName(), response.getData().get(0).getName());
assertEquals(portDto.getName(), response.getData().get(0).getName());
}

/**
Expand Down
89 changes: 34 additions & 55 deletions v4/api/StatisticsApiTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,47 +9,37 @@
* Do not edit the class manually.
*/


package com.equinix.openapi.fabric.v4.api;

import com.equinix.openapi.fabric.ApiException;
import com.equinix.openapi.fabric.v4.model.Duration;
import com.equinix.openapi.fabric.v4.model.Error;
import com.equinix.openapi.fabric.v4.model.MetricInterval;
import java.time.OffsetDateTime;
import com.equinix.openapi.fabric.v4.model.QueryDirection;
import com.equinix.openapi.fabric.v4.model.Sort;
import com.equinix.openapi.fabric.v4.model.Statistics;
import com.equinix.openapi.fabric.v4.model.TopUtilizedStatistics;
import java.util.UUID;
import com.equinix.openapi.fabric.v4.model.ViewPoint;
import org.junit.jupiter.api.Test;
import org.junit.Assert;
import com.equinix.openapi.fabric.v4.api.dto.port.PortDto;
import com.equinix.openapi.fabric.v4.model.*;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;

import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.time.ZoneOffset;
import java.time.temporal.ChronoUnit;
import java.util.Collections;
import java.util.UUID;

import static org.junit.jupiter.api.Assertions.assertEquals;

/**
* API tests for StatisticsApi
*/
@Disabled
public class StatisticsApiTest extends AbstractTest {

private final StatisticsApi api = new StatisticsApi(generateToken());

/**
* Get Stats by uuid
*
* <p>
* This API provides service-level metrics so that you can view access and gather key information required to manage service subscription sizing and capacity
*
* @throws ApiException
* if the Api call fails
* @throws ApiException if the Api call fails
*/
@Disabled
@Test
public void getConnectionStatsByPortUuidTest() throws ApiException {
//
Expand All @@ -65,54 +55,43 @@ public void getConnectionStatsByPortUuidTest() throws ApiException {

// TODO: test validations
}

/**
* Top Port Statistics
*
* <p>
* This API provides top utilized service-level traffic metrics so that you can view access and gather key information required to manage service subscription sizing and capacity.
*
* @throws ApiException
* if the Api call fails
* @throws ApiException if the Api call fails
*/
@Test
public void getPortStatsTest() throws ApiException {
//
//List<String> metros = null;
//
//Sort sort = null;
//
//Integer top = null;
//
//Duration duration = null;
//
//QueryDirection direction = null;
//
//MetricInterval metricInterval = null;
//
//String projectId = null;
//
//TopUtilizedStatistics response = api.getPortStats(metros, sort, top, duration, direction, metricInterval, projectId);

// TODO: test validations
String projectId = "291639000636552";
TopUtilizedStatistics response = api.getPortStats(
Collections.singletonList(""),
Sort._BANDWIDTHUTILIZATION,
5,
Duration.P7D,
QueryDirection.OUTBOUND,
MetricInterval.P7D,
projectId);
assertEquals(200, api.getApiClient().getStatusCode());
}

/**
* Get Stats by uuid
*
* <p>
* This API provides service-level traffic metrics so that you can view access and gather key information required to manage service subscription sizing and capacity.
*
* @throws ApiException
* if the Api call fails
* @throws ApiException if the Api call fails
*/
@Test
public void getPortStatsByPortUuidTest() throws ApiException {
//
//UUID portId = null;
//
//OffsetDateTime startDateTime = null;
//
//OffsetDateTime endDateTime = null;
//
//Statistics response = api.getPortStatsByPortUuid(portId, startDateTime, endDateTime);
PortDto portDto = getPort(JsonFiles.PORT_2_PUBLIC_SERVICE_PROFILE_CONNECTION);
OffsetDateTime startDate = OffsetDateTime.now().minusMonths(3).withOffsetSameLocal(ZoneOffset.UTC).truncatedTo(ChronoUnit.SECONDS);
OffsetDateTime endDate = OffsetDateTime.now().withOffsetSameLocal(ZoneOffset.UTC).truncatedTo(ChronoUnit.SECONDS);

// TODO: test validations
Statistics response = api.getPortStatsByPortUuid(UUID.fromString(portDto.getUuid()), startDate, endDate);
assertEquals(200, api.getApiClient().getStatusCode());
assertEquals(portDto.getName(), response.getAdditionalProperties().get("name"));
}
}
92 changes: 0 additions & 92 deletions v4/api/dto/PortDto.java

This file was deleted.

20 changes: 20 additions & 0 deletions v4/api/dto/port/Device.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.equinix.openapi.fabric.v4.api.dto.port;

import com.google.gson.annotations.SerializedName;

public class Device{

@SerializedName("name")
private String name;

@SerializedName("redundancy")
private Redundancy redundancy;

public String getName(){
return name;
}

public Redundancy getRedundancy(){
return redundancy;
}
}
20 changes: 20 additions & 0 deletions v4/api/dto/port/Encapsulation.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.equinix.openapi.fabric.v4.api.dto.port;

import com.google.gson.annotations.SerializedName;

public class Encapsulation{

@SerializedName("tagProtocolId")
private String tagProtocolId;

@SerializedName("type")
private String type;

public String getTagProtocolId(){
return tagProtocolId;
}

public String getType(){
return type;
}
}
27 changes: 27 additions & 0 deletions v4/api/dto/port/Lag.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.equinix.openapi.fabric.v4.api.dto.port;

import com.google.gson.annotations.SerializedName;

public class Lag{

@SerializedName("name")
private String name;

@SerializedName("id")
private String id;

@SerializedName("enabled")
private boolean enabled;

public String getName(){
return name;
}

public String getId(){
return id;
}

public boolean isEnabled(){
return enabled;
}
}
Loading

0 comments on commit 5aa0aaf

Please sign in to comment.