Search in sources :

Example 86 with Config

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.monitor.start.input.Config in project genius by opendaylight.

the class ItmProvider method deleteAllVtepSchemas.

@Override
public void deleteAllVtepSchemas() {
    List<VtepConfigSchema> lstSchemas = getAllVtepConfigSchemas();
    if (lstSchemas != null && !lstSchemas.isEmpty()) {
        for (VtepConfigSchema schema : lstSchemas) {
            MDSALUtil.syncDelete(this.dataBroker, LogicalDatastoreType.CONFIGURATION, ItmUtils.getVtepConfigSchemaIdentifier(schema.getSchemaName()));
        }
    }
    LOG.debug("Deleted all Vtep schemas from config DS");
}
Also used : VtepConfigSchema(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.vtep.config.schemas.VtepConfigSchema)

Example 87 with Config

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.monitor.start.input.Config in project genius by opendaylight.

the class ItmInternalTunnelDeleteWorker method removeTrunkInterface.

private void removeTrunkInterface(TunnelEndPoints srcTep, TunnelEndPoints dstTep, BigInteger srcDpnId, BigInteger dstDpnId, WriteTransaction transaction) {
    String trunkfwdIfName = ItmUtils.getTrunkInterfaceName(srcTep.getInterfaceName(), new String(srcTep.getIpAddress().getValue()), new String(dstTep.getIpAddress().getValue()), srcTep.getTunnelType().getName());
    LOG.trace("Removing forward Trunk Interface {}", trunkfwdIfName);
    InstanceIdentifier<Interface> trunkIdentifier = ItmUtils.buildId(trunkfwdIfName);
    LOG.debug(" Removing Trunk Interface Name - {} , Id - {} from Config DS ", trunkfwdIfName, trunkIdentifier);
    transaction.delete(LogicalDatastoreType.CONFIGURATION, trunkIdentifier);
    ItmUtils.ITM_CACHE.removeInterface(trunkfwdIfName);
    // also update itm-state ds -- Delete the forward tunnel-interface from the tunnel list
    InstanceIdentifier<InternalTunnel> path = InstanceIdentifier.create(TunnelList.class).child(InternalTunnel.class, new InternalTunnelKey(dstDpnId, srcDpnId, srcTep.getTunnelType()));
    transaction.delete(LogicalDatastoreType.CONFIGURATION, path);
    ItmUtils.ITM_CACHE.removeInternalTunnel(trunkfwdIfName);
    // Release the Ids for the forward trunk interface Name
    ItmUtils.releaseIdForTrunkInterfaceName(srcTep.getInterfaceName(), new String(srcTep.getIpAddress().getValue()), new String(dstTep.getIpAddress().getValue()), srcTep.getTunnelType().getName());
    removeLogicalGroupTunnel(srcDpnId, dstDpnId);
    String trunkRevIfName = ItmUtils.getTrunkInterfaceName(dstTep.getInterfaceName(), new String(dstTep.getIpAddress().getValue()), new String(srcTep.getIpAddress().getValue()), srcTep.getTunnelType().getName());
    LOG.trace("Removing Reverse Trunk Interface {}", trunkRevIfName);
    trunkIdentifier = ItmUtils.buildId(trunkRevIfName);
    LOG.debug(" Removing Trunk Interface Name - {} , Id - {} from Config DS ", trunkRevIfName, trunkIdentifier);
    transaction.delete(LogicalDatastoreType.CONFIGURATION, trunkIdentifier);
    ItmUtils.ITM_CACHE.removeInternalTunnel(trunkRevIfName);
    // also update itm-state ds -- Delete the reverse tunnel-interface from the tunnel list
    path = InstanceIdentifier.create(TunnelList.class).child(InternalTunnel.class, new InternalTunnelKey(srcDpnId, dstDpnId, dstTep.getTunnelType()));
    transaction.delete(LogicalDatastoreType.CONFIGURATION, path);
    // Release the Ids for the reverse trunk interface Name
    ItmUtils.releaseIdForTrunkInterfaceName(dstTep.getInterfaceName(), new String(dstTep.getIpAddress().getValue()), new String(srcTep.getIpAddress().getValue()), dstTep.getTunnelType().getName());
    removeLogicalGroupTunnel(dstDpnId, srcDpnId);
}
Also used : InternalTunnelKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.tunnel.list.InternalTunnelKey) TunnelList(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.TunnelList) InternalTunnel(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.tunnel.list.InternalTunnel) Interface(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface)

Example 88 with Config

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.monitor.start.input.Config in project genius by opendaylight.

the class ItmExternalTunnelAddWorker method wireUp.

// for tunnels from OVS
private boolean wireUp(BigInteger dpnId, String portname, Integer vlanId, IpAddress srcIp, Boolean remoteIpFlow, String dstNodeId, IpAddress dstIp, IpPrefix srcSubnet, IpAddress gwIp, IpPrefix dstSubnet, Class<? extends TunnelTypeBase> tunType, Boolean monitorEnabled, Integer monitorInterval, Class<? extends TunnelMonitoringTypeBase> monitorProtocol, WriteTransaction transaction) {
    IpAddress gatewayIpObj = IpAddressBuilder.getDefaultInstance("0.0.0.0");
    IpAddress gwyIpAddress = srcSubnet.equals(dstSubnet) ? gatewayIpObj : gwIp;
    String parentIf = ItmUtils.getInterfaceName(dpnId, portname, vlanId);
    String tunTypeStr = tunType.getName();
    String tunnelIfName = ItmUtils.getTrunkInterfaceName(parentIf, new String(srcIp.getValue()), new String(dstIp.getValue()), tunTypeStr);
    LOG.debug(" Creating ExternalTrunk Interface with parameters Name - {}, parent I/f name - {}, " + "source IP - {}, destination IP - {} gateway IP - {}", tunnelIfName, parentIf, srcIp, dstIp, gwyIpAddress);
    Interface extTunnelIf = ItmUtils.buildTunnelInterface(dpnId, tunnelIfName, String.format("%s %s", tunType.getName(), "Trunk Interface"), true, tunType, srcIp, dstIp, gwyIpAddress, vlanId, false, monitorEnabled, monitorProtocol, monitorInterval, remoteIpFlow, null);
    InstanceIdentifier<Interface> ifIID = InstanceIdentifier.builder(Interfaces.class).child(Interface.class, new InterfaceKey(tunnelIfName)).build();
    LOG.trace(" Writing Trunk Interface to Config DS {}, {} ", ifIID, extTunnelIf);
    transaction.merge(LogicalDatastoreType.CONFIGURATION, ifIID, extTunnelIf, true);
    ItmUtils.ITM_CACHE.addInterface(extTunnelIf);
    InstanceIdentifier<ExternalTunnel> path = InstanceIdentifier.create(ExternalTunnelList.class).child(ExternalTunnel.class, new ExternalTunnelKey(getExternalTunnelKey(dstNodeId), dpnId.toString(), tunType));
    ExternalTunnel tnl = ItmUtils.buildExternalTunnel(dpnId.toString(), getExternalTunnelKey(dstNodeId), tunType, tunnelIfName);
    transaction.merge(LogicalDatastoreType.CONFIGURATION, path, tnl, true);
    ItmUtils.ITM_CACHE.addExternalTunnel(tnl);
    return true;
}
Also used : ExternalTunnelList(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.ExternalTunnelList) ExternalTunnelKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.external.tunnel.list.ExternalTunnelKey) ExternalTunnel(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.external.tunnel.list.ExternalTunnel) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress) InterfaceKey(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey) Interface(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface)

Example 89 with Config

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.monitor.start.input.Config in project genius by opendaylight.

the class ItmExternalTunnelAddWorker method buildTunnelsToExternalEndPoint.

public List<ListenableFuture<Void>> buildTunnelsToExternalEndPoint(Collection<DPNTEPsInfo> cfgDpnList, IpAddress extIp, Class<? extends TunnelTypeBase> tunType) {
    if (null != cfgDpnList) {
        WriteTransaction transaction = dataBroker.newWriteOnlyTransaction();
        for (DPNTEPsInfo teps : cfgDpnList) {
            // CHECK -- Assumption -- Only one End Point / Dpn for GRE/Vxlan Tunnels
            TunnelEndPoints firstEndPt = teps.getTunnelEndPoints().get(0);
            String interfaceName = firstEndPt.getInterfaceName();
            String tunTypeStr = tunType.getName();
            String trunkInterfaceName = ItmUtils.getTrunkInterfaceName(interfaceName, new String(firstEndPt.getIpAddress().getValue()), new String(extIp.getValue()), tunTypeStr);
            char[] subnetMaskArray = firstEndPt.getSubnetMask().getValue();
            boolean useOfTunnel = ItmUtils.falseIfNull(firstEndPt.isOptionOfTunnel());
            List<TunnelOptions> tunOptions = ItmUtils.buildTunnelOptions(firstEndPt, itmConfig);
            String subnetMaskStr = String.valueOf(subnetMaskArray);
            SubnetUtils utils = new SubnetUtils(subnetMaskStr);
            String dcGwyIpStr = String.valueOf(extIp.getValue());
            IpAddress gatewayIpObj = IpAddressBuilder.getDefaultInstance("0.0.0.0");
            IpAddress gwyIpAddress = utils.getInfo().isInRange(dcGwyIpStr) ? gatewayIpObj : firstEndPt.getGwIpAddress();
            LOG.debug(" Creating Trunk Interface with parameters trunk I/f Name - {}, parent I/f name - {}," + " source IP - {}, DC Gateway IP - {} gateway IP - {}", trunkInterfaceName, interfaceName, firstEndPt.getIpAddress(), extIp, gwyIpAddress);
            Interface iface = ItmUtils.buildTunnelInterface(teps.getDPNID(), trunkInterfaceName, String.format("%s %s", ItmUtils.convertTunnelTypetoString(tunType), "Trunk Interface"), true, tunType, firstEndPt.getIpAddress(), extIp, gwyIpAddress, firstEndPt.getVLANID(), false, false, ITMConstants.DEFAULT_MONITOR_PROTOCOL, null, useOfTunnel, tunOptions);
            LOG.debug(" Trunk Interface builder - {} ", iface);
            InstanceIdentifier<Interface> trunkIdentifier = ItmUtils.buildId(trunkInterfaceName);
            LOG.debug(" Trunk Interface Identifier - {} ", trunkIdentifier);
            LOG.trace(" Writing Trunk Interface to Config DS {}, {} ", trunkIdentifier, iface);
            transaction.merge(LogicalDatastoreType.CONFIGURATION, trunkIdentifier, iface, true);
            // update external_tunnel_list ds
            InstanceIdentifier<ExternalTunnel> path = InstanceIdentifier.create(ExternalTunnelList.class).child(ExternalTunnel.class, new ExternalTunnelKey(String.valueOf(extIp.getValue()), teps.getDPNID().toString(), tunType));
            ExternalTunnel tnl = ItmUtils.buildExternalTunnel(teps.getDPNID().toString(), String.valueOf(extIp.getValue()), tunType, trunkInterfaceName);
            transaction.merge(LogicalDatastoreType.CONFIGURATION, path, tnl, true);
        }
        return Collections.singletonList(transaction.submit());
    }
    return Collections.emptyList();
}
Also used : WriteTransaction(org.opendaylight.controller.md.sal.binding.api.WriteTransaction) SubnetUtils(org.apache.commons.net.util.SubnetUtils) ExternalTunnelList(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.ExternalTunnelList) ExternalTunnelKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.external.tunnel.list.ExternalTunnelKey) ExternalTunnel(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.external.tunnel.list.ExternalTunnel) TunnelOptions(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.tunnel.optional.params.TunnelOptions) TunnelEndPoints(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.endpoints.dpn.teps.info.TunnelEndPoints) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress) DPNTEPsInfo(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.endpoints.DPNTEPsInfo) Interface(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface)

Example 90 with Config

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.monitor.start.input.Config in project genius by opendaylight.

the class ItmInternalTunnelAddWorker method createTunnelInterface.

private void createTunnelInterface(TunnelEndPoints srcte, TunnelEndPoints dstte, BigInteger srcDpnId, Class<? extends TunnelTypeBase> tunType, String trunkInterfaceName, String parentInterfaceName) {
    String gateway = srcte.getIpAddress().getIpv4Address() != null ? "0.0.0.0" : "::";
    IpAddress gatewayIpObj = IpAddressBuilder.getDefaultInstance(gateway);
    IpAddress gwyIpAddress = srcte.getSubnetMask().equals(dstte.getSubnetMask()) ? gatewayIpObj : srcte.getGwIpAddress();
    LOG.debug(" Creating Trunk Interface with parameters trunk I/f Name - {}, parent I/f name - {}, " + "source IP - {}, destination IP - {} gateway IP - {}", trunkInterfaceName, srcte.getInterfaceName(), srcte.getIpAddress(), dstte.getIpAddress(), gwyIpAddress);
    boolean useOfTunnel = ItmUtils.falseIfNull(srcte.isOptionOfTunnel());
    List<TunnelOptions> tunOptions = ItmUtils.buildTunnelOptions(srcte, itmCfg);
    Boolean isMonitorEnabled = tunType.isAssignableFrom(TunnelTypeLogicalGroup.class) ? false : isTunnelMonitoringEnabled;
    Interface iface = ItmUtils.buildTunnelInterface(srcDpnId, trunkInterfaceName, String.format("%s %s", ItmUtils.convertTunnelTypetoString(tunType), "Trunk Interface"), true, tunType, srcte.getIpAddress(), dstte.getIpAddress(), gwyIpAddress, srcte.getVLANID(), true, isMonitorEnabled, monitorProtocol, monitorInterval, useOfTunnel, parentInterfaceName, tunOptions);
    LOG.debug(" Trunk Interface builder - {} ", iface);
    InstanceIdentifier<Interface> trunkIdentifier = ItmUtils.buildId(trunkInterfaceName);
    LOG.debug(" Trunk Interface Identifier - {} ", trunkIdentifier);
    LOG.trace(" Writing Trunk Interface to Config DS {}, {} ", trunkIdentifier, iface);
    ITMBatchingUtils.update(trunkIdentifier, iface, ITMBatchingUtils.EntityType.DEFAULT_CONFIG);
    ItmUtils.ITM_CACHE.addInterface(iface);
}
Also used : TunnelTypeLogicalGroup(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelTypeLogicalGroup) TunnelOptions(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.tunnel.optional.params.TunnelOptions) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress) Interface(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface)

Aggregations

ArrayList (java.util.ArrayList)47 Test (org.junit.Test)45 BigInteger (java.math.BigInteger)29 ReadFailedException (org.opendaylight.controller.md.sal.common.api.data.ReadFailedException)23 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)23 ByteBuf (io.netty.buffer.ByteBuf)21 MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)21 TransactionCommitFailedException (org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException)20 Interface (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface)19 Uuid (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)19 Node (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node)19 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)16 ExecutionException (java.util.concurrent.ExecutionException)16 Optional (com.google.common.base.Optional)15 List (java.util.List)15 WriteTransaction (org.opendaylight.controller.md.sal.binding.api.WriteTransaction)14 TransportZone (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.TransportZone)14 InstanceIdentifier (org.opendaylight.yangtools.yang.binding.InstanceIdentifier)14 InterfaceKey (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey)12 Vteps (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.subnets.Vteps)12