Skip to content

[Question] Showing VLANs not working #18

@critix

Description

@critix

Hi

I tried to print all the public VLANs with the code which is provided on this git. Unfortunately this didn't work for me. I checked the softlayer portal and my account has private and public VLANs. I am able to print the private VLANs/virtual machine. Can someone help me out printing the public VLANs as well.

Here is my code which is able to print the private VLANs but unable to print the public VLANs:

import com.softlayer.api.service.network.Vlan;

service.withMask().virtualGuests().networkVlans().primaryRouter().datacenter().longName();

printvm(client, account);

public static void printVm(ApiClient client, Account account) {
    System.out.format("\n%d virtual servers\n", account.getVirtualGuests()
            .size());
    for (Guest guest : account.getVirtualGuests()) {
        System.out
                .format("Host: %s, IP: %s (%s),Cores: %s,Status %s, OS: %s, vlan %s, public vlan %s\n",
                        guest.getFullyQualifiedDomainName(), guest
                                .getPrimaryIpAddress(), guest
                                .getPrimaryBackendIpAddress(), guest
                                .getStartCpus(), guest.getPowerState()
                                .getName(), guest
                                .getOperatingSystemReferenceCode(), guest
                                .getNetworkComponents().get(0)
                                .getNetworkVlan().getName(), guest.getNetworkVlans().get(0).getPrimaryRouter().getDatacenter().getLongName());
    }
}

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions