Search in sources :

Example 1 with IVirtualPort

use of org.opendaylight.netvirt.ipv6service.api.IVirtualPort 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)

Example 2 with IVirtualPort

use of org.opendaylight.netvirt.ipv6service.api.IVirtualPort in project netvirt by opendaylight.

the class IfMgr method programIcmpv6PuntFlowsIfNecessary.

public void programIcmpv6PuntFlowsIfNecessary(Uuid vmPortId, BigInteger dpId, VirtualPort routerPort) {
    if (!ipv6ServiceEosHandler.isClusterOwner()) {
        LOG.trace("Not a cluster Owner, skip flow programming.");
        return;
    }
    IVirtualPort vmPort = getPort(vmPortId);
    if (null != vmPort) {
        VirtualNetwork vnet = getNetwork(vmPort.getNetworkID());
        if (null != vnet) {
            VirtualNetwork.DpnInterfaceInfo dpnInfo = vnet.getDpnIfaceInfo(dpId);
            if (null != dpnInfo) {
                Long elanTag = getNetworkElanTag(routerPort.getNetworkID());
                if (vnet.getRSPuntFlowStatusOnDpnId(dpId) == Ipv6Constants.FLOWS_NOT_CONFIGURED) {
                    ipv6ServiceUtils.installIcmpv6RsPuntFlow(NwConstants.IPV6_TABLE, dpId, elanTag, Ipv6Constants.ADD_FLOW);
                    vnet.setRSPuntFlowStatusOnDpnId(dpId, Ipv6Constants.FLOWS_CONFIGURED);
                }
                for (Ipv6Address ipv6Address : routerPort.getIpv6Addresses()) {
                    if (!dpnInfo.ndTargetFlowsPunted.contains(ipv6Address)) {
                        ipv6ServiceUtils.installIcmpv6NsPuntFlow(NwConstants.IPV6_TABLE, dpId, elanTag, ipv6Address.getValue(), Ipv6Constants.ADD_FLOW);
                        dpnInfo.updateNDTargetAddress(ipv6Address, Ipv6Constants.ADD_FLOW);
                    }
                }
            }
        }
    }
}
Also used : IVirtualNetwork(org.opendaylight.netvirt.ipv6service.api.IVirtualNetwork) IVirtualPort(org.opendaylight.netvirt.ipv6service.api.IVirtualPort) Ipv6Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address)

Aggregations

IVirtualNetwork (org.opendaylight.netvirt.ipv6service.api.IVirtualNetwork)2 IVirtualPort (org.opendaylight.netvirt.ipv6service.api.IVirtualPort)2 List (java.util.List)1 TablePrinter (org.opendaylight.infrautils.utils.TablePrinter)1 IVirtualRouter (org.opendaylight.netvirt.ipv6service.api.IVirtualRouter)1 IVirtualSubnet (org.opendaylight.netvirt.ipv6service.api.IVirtualSubnet)1 Ipv6Address (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address)1