Ports
Port inventory, VLAN usage, port orders with dry run, LAG, and port packages.
Inventory#
import com.eqixiac.equinix.core.http.response.PaginatedFilteredList;
import com.eqixiac.equinix.fabric.model.Port;
import com.eqixiac.equinix.fabric.model.implementation.filter.FilterPropertyList;
import com.eqixiac.equinix.fabric.model.implementation.filter.FilterType;
List<Port> ports = fabric.ports().list();
for (Port port : ports) {
System.out.println(port.getUuid() + " " + port.getName()
+ " " + port.getLocation().getMetroCode()
+ " " + port.getEncapsulation().getType()
+ " used " + port.getUsedBandwidth() + "/" + port.getBandwidth() + " Mbps");
}
PaginatedFilteredList<Port> inAshburn = fabric.ports().search(
new FilterPropertyList(FilterType.AND).equals("/location/metroCode", "DC"));In 4.0 ports().list() returns a java.util.List<Port>, and search(...) returns a paginated list.
VLAN usage#
getVlans(portUuid) lists the link protocols in use on a port, which shows the VLAN tags that a new connection cannot take.
import com.eqixiac.equinix.fabric.model.PortVlan;
Set<Integer> used = new HashSet<>();
for (PortVlan vlan : fabric.ports().getVlans(portUuid)) {
if (vlan.getVlanTag() != null) {
used.add(vlan.getVlanTag());
}
}
int free = java.util.stream.IntStream.rangeClosed(1000, 1999)
.filter(tag -> !used.contains(tag)).findFirst().orElseThrow();Another request can take the tag between this read and the create. A connection create with dryRun() has Fabric check the tag at that moment, and connections().validate(filter) asks Fabric whether a VLAN is free on a port.
Port orders#
ports().define() builds a port order. A create without dryRun() places a billable order that leads to a physical cross connect. The SDK's live test tiers send port creates as dry runs against WireMock only.
import com.eqixiac.equinix.fabric.enums.PhysicalPortType;
import com.eqixiac.equinix.fabric.enums.PortType;
Port validatedOrder = fabric.ports().define()
.ofType(PortType.XF_PORT)
.metroCode("DC")
.demarcationPointIbx("DC6")
.physicalPortsSpeed(10000) // Mbps
.physicalPortsType(PhysicalPortType._10GBASE_LR)
.physicalPortsCount(1)
.lagEnabled(false)
.accountNumber(123456L)
.projectId(projectId)
.dryRun()
.create();The builder also takes encapsulation, redundancy, the demarcation point, notifications, LOAs and a port package. The request body follows the port examples in the Fabric specification. Fields that the 3.0.0 builder accepted and the specification does not define, such as a port name on create, are removed.
Update and delete#
import com.eqixiac.equinix.fabric.enums.EncapsulationType;
fabric.ports().update(portUuid).name("dc6-cage-12-primary").save();
fabric.ports().update(portUuid).encapsulation(EncapsulationType.QINQ, "0x8100").dryRun().save();
Port wouldBeDeleted = fabric.ports().delete(portUuid, true); // dryRun = trueaddToLag(portUuid, physicalPorts) adds physical ports to a LAG port.
Port packages#
fabric.portPackages() lists the port packages. The live service returns a bare array for GET /portPackages, and the SDK reads both that shape and the documented envelope.
Traffic data#
Port and connection statistics are read through the metrics API, see Observability.