Search in sources :

Example 1 with IVirtualSubnet

use of org.opendaylight.netvirt.ipv6service.api.IVirtualSubnet 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;
}
Also used : IVirtualRouter(org.opendaylight.netvirt.ipv6service.api.IVirtualRouter) IVirtualSubnet(org.opendaylight.netvirt.ipv6service.api.IVirtualSubnet) TablePrinter(org.opendaylight.infrautils.utils.TablePrinter) IVirtualPort(org.opendaylight.netvirt.ipv6service.api.IVirtualPort) IVirtualNetwork(org.opendaylight.netvirt.ipv6service.api.IVirtualNetwork) List(java.util.List)

Aggregations

List (java.util.List)1 TablePrinter (org.opendaylight.infrautils.utils.TablePrinter)1 IVirtualNetwork (org.opendaylight.netvirt.ipv6service.api.IVirtualNetwork)1 IVirtualPort (org.opendaylight.netvirt.ipv6service.api.IVirtualPort)1 IVirtualRouter (org.opendaylight.netvirt.ipv6service.api.IVirtualRouter)1 IVirtualSubnet (org.opendaylight.netvirt.ipv6service.api.IVirtualSubnet)1