use of org.opendaylight.netvirt.ipv6service.api.IVirtualRouter in project netvirt by opendaylight.
the class ShowIpv6Command method doExecute.
@Override
protected Object doExecute() {
TablePrinter tp = new TablePrinter();
if (listResource != null) {
if (listResource.equalsIgnoreCase("networks") || listResource.equalsIgnoreCase("net")) {
tp.setTitle("Network Cache List");
tp.setColumnNames("Sno", "NetworkId", "dpnId");
int count = 1;
List<IVirtualNetwork> vnetworks = elementCache.getNetworkCache();
for (IVirtualNetwork vnet : vnetworks) {
tp.addRow(count++, String.valueOf(vnet.getNetworkUuid().getValue()), vnet.getDpnsHostingNetwork());
}
session.getConsole().print(tp.toString());
} else if (listResource.equalsIgnoreCase("subnets") || listResource.equalsIgnoreCase("subnet")) {
tp.setTitle("Subnet Cache List");
tp.setColumnNames("Sno", "SubnetId", "SubnetCIDR", "ipVersion");
int count = 1;
List<IVirtualSubnet> vsubnets = elementCache.getSubnetCache();
for (IVirtualSubnet vsubnet : vsubnets) {
tp.addRow(count++, String.valueOf(vsubnet.getSubnetUUID().getValue()), String.valueOf(vsubnet.getSubnetCidr().getValue()), vsubnet.getIpVersion());
}
session.getConsole().print(tp.toString());
} else if (listResource.equalsIgnoreCase("routers") || listResource.equalsIgnoreCase("router")) {
tp.setTitle("Router Cache List");
tp.setColumnNames("Sno", "RouterId");
List<IVirtualRouter> vrouters = elementCache.getRouterCache();
int count = 1;
for (IVirtualRouter vrouter : vrouters) {
tp.addRow(count++, String.valueOf(vrouter.getRouterUUID().getValue()));
}
session.getConsole().print(tp.toString());
}
} else {
tp.setTitle("Interface Cache List");
tp.setColumnNames("Sno", "PortId", "Mac Address", "Owner", "dpnId", "FixedIPs");
List<IVirtualPort> vports = elementCache.getInterfaceCache();
int count = 1;
for (IVirtualPort vport : vports) {
String str = vport.getDeviceOwner();
tp.addRow(count++, String.valueOf(vport.getIntfUUID().getValue()), vport.getMacAddress(), str.startsWith("network:") ? str.substring(str.lastIndexOf(':') + 1) : "compute", vport.getDpId(), getPortIpv6Addresses(vport));
}
session.getConsole().print(tp.toString());
}
return null;
}
Aggregations