Search in sources :

Example 6 with DpnIds

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.vtep.config.schemas.vtep.config.schema.DpnIds in project genius by opendaylight.

the class VtepSchemaAdd method doExecute.

/*
     * (non-Javadoc)
     *
     * @see org.apache.karaf.shell.console.AbstractAction#doExecute()
     */
@SuppressWarnings("checkstyle:IllegalCatch")
@Override
protected Object doExecute() {
    try {
        if (this.schemaName == null || this.portName == null || this.vlanId == null || this.subnetCIDR == null || this.transportZone == null) {
            usage();
            return null;
        }
        LOG.debug("Executing vtep:schema-add command\t {} \t {} \t {} \t {} \t {} \t {} \t {} \t {} \t {}", schemaName, portName, vlanId, subnetCIDR, gatewayIp, transportZone, tunnelType, dpnIds, excludeIpFilter);
        if (null == tunnelType) {
            tunnelType = ITMConstants.TUNNEL_TYPE_VXLAN;
        }
        VtepConfigSchema schema = ItmUtils.constructVtepConfigSchema(schemaName, portName, vlanId, subnetCIDR, gatewayIp, transportZone, tunnelType, ItmCliUtils.constructDpnIdList(dpnIds), excludeIpFilter);
        this.itmProvider.addVtepConfigSchema(schema);
    } catch (Exception e) {
        LOG.error("Exception occurred during execution of command \"vtep:schema-add\": ", e);
        throw e;
    }
    return null;
}
Also used : VtepConfigSchema(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.vtep.config.schemas.VtepConfigSchema)

Example 7 with DpnIds

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.vtep.config.schemas.vtep.config.schema.DpnIds in project netvirt by opendaylight.

the class NeutronvpnUtils method updateVpnInstanceWithFallback.

public void updateVpnInstanceWithFallback(String vpnName, boolean add) {
    VpnInstanceOpDataEntry vpnInstanceOpDataEntry = getVpnInstanceOpDataEntryFromVpnId(vpnName);
    if (vpnInstanceOpDataEntry == null) {
        // BGPVPN context not found
        return;
    }
    String routerIdUuid = getRouterIdfromVpnInstance(vpnInstanceOpDataEntry.getVrfId());
    if (routerIdUuid != null) {
        List<BigInteger> dpnIds = getDpnsForRouter(routerIdUuid);
        if (!dpnIds.isEmpty()) {
            Long vpnId = vpnInstanceOpDataEntry.getVpnId();
            VpnInstanceOpDataEntry vpnOpDataEntry = getVpnInstanceOpDataEntryFromVpnId(routerIdUuid);
            Long routerIdAsLong = vpnOpDataEntry.getVpnId();
            if (routerIdAsLong == null) {
                return;
            }
            for (BigInteger dpnId : dpnIds) {
                if (add) {
                    ipV6InternetDefRt.installDefaultRoute(dpnId, vpnId, routerIdAsLong);
                } else {
                    ipV6InternetDefRt.removeDefaultRoute(dpnId, vpnId, routerIdAsLong);
                }
            }
        }
    }
}
Also used : VpnInstanceOpDataEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.instance.op.data.VpnInstanceOpDataEntry) BigInteger(java.math.BigInteger)

Example 8 with DpnIds

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.vtep.config.schemas.vtep.config.schema.DpnIds in project genius by opendaylight.

the class ItmManagerRpcService method getTunnelEndPointByDpnIdFromTranPortZone.

private Map<BigInteger, ComputesBuilder> getTunnelEndPointByDpnIdFromTranPortZone(Collection<BigInteger> dpnIds) throws ReadFailedException {
    TransportZones transportZones = singleTransactionDataBroker.syncRead(LogicalDatastoreType.CONFIGURATION, InstanceIdentifier.builder(TransportZones.class).build());
    if (transportZones.getTransportZone() == null || transportZones.getTransportZone().isEmpty()) {
        throw new IllegalStateException("Failed to find transport zones in config datastore");
    }
    Map<BigInteger, ComputesBuilder> result = new HashMap<>();
    for (TransportZone transportZone : transportZones.getTransportZone()) {
        if (transportZone.getSubnets() == null || transportZone.getSubnets().isEmpty()) {
            LOG.debug("Transport Zone {} has no subnets", transportZone.getZoneName());
            continue;
        }
        for (Subnets sub : transportZone.getSubnets()) {
            if (sub.getVteps() == null || sub.getVteps().isEmpty()) {
                LOG.debug("Transport Zone {} subnet {} has no vteps configured", transportZone.getZoneName(), sub.getPrefix());
                continue;
            }
            for (Vteps vtep : sub.getVteps()) {
                if (dpnIds.contains(vtep.getDpnId())) {
                    result.putIfAbsent(vtep.getDpnId(), new ComputesBuilder().setZoneName(transportZone.getZoneName()).setPrefix(sub.getPrefix()).setDpnId(vtep.getDpnId()).setPortName(vtep.getPortname()).setNodeId(getNodeId(vtep.getDpnId())).setTepIp(Collections.singletonList(vtep.getIpAddress())));
                }
            }
        }
    }
    for (BigInteger dpnId : dpnIds) {
        if (!result.containsKey(dpnId)) {
            throw new IllegalStateException("Failed to find dpn id " + dpnId + " in transport zone");
        }
    }
    return result;
}
Also used : Subnets(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.Subnets) HashMap(java.util.HashMap) ComputesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.get.dpn.info.output.ComputesBuilder) Vteps(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.subnets.Vteps) DeviceVteps(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.subnets.DeviceVteps) BigInteger(java.math.BigInteger) TransportZones(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.TransportZones) TransportZone(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.TransportZone)

Example 9 with DpnIds

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.vtep.config.schemas.vtep.config.schema.DpnIds in project genius by opendaylight.

the class DPNTEPsInfoCache method getDPNTepListFromDPNId.

public List<DPNTEPsInfo> getDPNTepListFromDPNId(List<BigInteger> dpnIds) {
    Collection<DPNTEPsInfo> meshedDpnList = this.getAllPresent();
    List<DPNTEPsInfo> cfgDpnList = new ArrayList<>();
    for (BigInteger dpnId : dpnIds) {
        for (DPNTEPsInfo teps : meshedDpnList) {
            if (dpnId.equals(teps.getDPNID())) {
                cfgDpnList.add(teps);
            }
        }
    }
    return cfgDpnList;
}
Also used : ArrayList(java.util.ArrayList) BigInteger(java.math.BigInteger) DPNTEPsInfo(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.endpoints.DPNTEPsInfo)

Aggregations

BigInteger (java.math.BigInteger)6 ArrayList (java.util.ArrayList)4 VtepConfigSchema (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.vtep.config.schemas.VtepConfigSchema)2 VtepConfigSchemaBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.vtep.config.schemas.VtepConfigSchemaBuilder)2 DpnIds (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.vtep.config.schemas.vtep.config.schema.DpnIds)2 DPNTEPsInfo (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.endpoints.DPNTEPsInfo)2 HashMap (java.util.HashMap)1 IVirtualNetwork (org.opendaylight.netvirt.ipv6service.api.IVirtualNetwork)1 IVirtualPort (org.opendaylight.netvirt.ipv6service.api.IVirtualPort)1 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)1 IpPrefix (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix)1 Ipv6Address (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address)1 Uuid (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)1 DpnIdsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.vtep.config.schemas.vtep.config.schema.DpnIdsBuilder)1 DpnIdsKey (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.vtep.config.schemas.vtep.config.schema.DpnIdsKey)1 VtepIpPool (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.vtep.ip.pools.VtepIpPool)1 TransportZones (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.TransportZones)1 TransportZone (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.TransportZone)1 Subnets (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.Subnets)1 DeviceVteps (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.subnets.DeviceVteps)1