Search in sources :

Example 1 with DpnToInterface

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.dpn.to._interface.list.DpnToInterface in project netvirt by opendaylight.

the class UnderlayNetworkDpnListener method remove.

@Override
protected void remove(InstanceIdentifier<DpnToInterface> key, DpnToInterface dpnToInterface) {
    String underlayNetwork = key.firstKeyOf(UnderlayNetwork.class).getNetworkName();
    BigInteger dpId = dpnToInterface.getDpId();
    List<TunnelInterface> tunnelInterfaces = dpnToInterface.getTunnelInterface();
    LOG.info("DPN {} removed from underlay network {} with tunnels {}", dpId, underlayNetwork, tunnelInterfaces);
    List<PolicyProfile> profiles = policyServiceUtil.getUnderlayNetworkPolicyProfiles(underlayNetwork);
    if (profiles == null || profiles.isEmpty()) {
        LOG.debug("No policy profiles found for underlay network {}", underlayNetwork);
        return;
    }
    populatePolicyGroupBucketsToDpn(underlayNetwork, profiles, tunnelInterfaces, dpId, NwConstants.DEL_FLOW);
}
Also used : UnderlayNetwork(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.policy.rev170207.underlay.networks.UnderlayNetwork) PolicyProfile(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.policy.rev170207.underlay.networks.underlay.network.PolicyProfile) BigInteger(java.math.BigInteger) TunnelInterface(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.policy.rev170207.underlay.networks.underlay.network.dpn.to._interface.TunnelInterface)

Example 2 with DpnToInterface

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.dpn.to._interface.list.DpnToInterface in project netvirt by opendaylight.

the class UnderlayNetworkDpnListener method add.

@Override
protected void add(InstanceIdentifier<DpnToInterface> key, DpnToInterface dpnToInterface) {
    String underlayNetwork = key.firstKeyOf(UnderlayNetwork.class).getNetworkName();
    BigInteger dpId = dpnToInterface.getDpId();
    List<TunnelInterface> tunnelInterfaces = dpnToInterface.getTunnelInterface();
    LOG.info("DPN {} added to underlay network {} with tunnels {}", dpId, underlayNetwork, tunnelInterfaces);
    List<PolicyProfile> profiles = policyServiceUtil.getUnderlayNetworkPolicyProfiles(underlayNetwork);
    if (profiles == null || profiles.isEmpty()) {
        LOG.debug("No policy profiles found for underlay network {}", underlayNetwork);
        return;
    }
    populatePolicyGroupsToDpn(profiles, tunnelInterfaces, dpId, NwConstants.ADD_FLOW);
    populatePolicyGroupBucketsToDpn(underlayNetwork, profiles, tunnelInterfaces, dpId, NwConstants.ADD_FLOW);
    populatePolicyAclRulesToDpn(dpId, profiles, NwConstants.ADD_FLOW);
    populatePolicyRoutesToDpn(profiles, tunnelInterfaces, dpId, NwConstants.ADD_FLOW);
}
Also used : UnderlayNetwork(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.policy.rev170207.underlay.networks.UnderlayNetwork) PolicyProfile(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.policy.rev170207.underlay.networks.underlay.network.PolicyProfile) BigInteger(java.math.BigInteger) TunnelInterface(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.policy.rev170207.underlay.networks.underlay.network.dpn.to._interface.TunnelInterface)

Example 3 with DpnToInterface

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.dpn.to._interface.list.DpnToInterface in project netvirt by opendaylight.

the class PolicyServiceUtil method updateTunnelInterfacesForUnderlayNetwork.

public void updateTunnelInterfacesForUnderlayNetwork(String underlayNetwork, BigInteger srcDpId, List<TunnelInterface> tunnelInterfaces, boolean isAdded) {
    coordinator.enqueueJob(underlayNetwork, () -> {
        InstanceIdentifier<DpnToInterface> identifier = getUnderlayNetworkDpnIdentifier(underlayNetwork, srcDpId);
        WriteTransaction tx = dataBroker.newWriteOnlyTransaction();
        if (isAdded) {
            DpnToInterface dpnToInterface = new DpnToInterfaceBuilder().setDpId(srcDpId).setTunnelInterface(tunnelInterfaces).build();
            tx.merge(LogicalDatastoreType.OPERATIONAL, identifier, dpnToInterface, true);
            LOG.info("Add tunnel interfaces {} on DPN {} to underlay network {}", tunnelInterfaces, srcDpId, underlayNetwork);
        } else {
            tx.delete(LogicalDatastoreType.OPERATIONAL, identifier);
            LOG.info("Remove tunnel interfaces {} from DPN {} on underlay network {}", tunnelInterfaces, srcDpId, underlayNetwork);
        }
        return Collections.singletonList(tx.submit());
    });
}
Also used : WriteTransaction(org.opendaylight.controller.md.sal.binding.api.WriteTransaction) DpnToInterface(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.policy.rev170207.underlay.networks.underlay.network.DpnToInterface) DpnToInterfaceBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.policy.rev170207.underlay.networks.underlay.network.DpnToInterfaceBuilder)

Example 4 with DpnToInterface

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.dpn.to._interface.list.DpnToInterface in project genius by opendaylight.

the class InterfaceManagerCommonUtils method deleteDpnToInterface.

public void deleteDpnToInterface(BigInteger dpId, String infName, WriteTransaction transaction) {
    DpnToInterfaceKey dpnToInterfaceKey = new DpnToInterfaceKey(dpId);
    InstanceIdentifier<DpnToInterface> dpnToInterfaceId = InstanceIdentifier.builder(DpnToInterfaceList.class).child(DpnToInterface.class, dpnToInterfaceKey).build();
    Optional<DpnToInterface> dpnToInterfaceOptional = IfmUtil.read(LogicalDatastoreType.OPERATIONAL, dpnToInterfaceId, dataBroker);
    if (!dpnToInterfaceOptional.isPresent()) {
        LOG.debug("DPN {} is already removed from the Operational DS", dpId);
        return;
    }
    List<InterfaceNameEntry> interfaceNameEntries = dpnToInterfaceOptional.get().getInterfaceNameEntry();
    InterfaceNameEntryKey interfaceNameEntryKey = new InterfaceNameEntryKey(infName);
    InstanceIdentifier<InterfaceNameEntry> intfid = InstanceIdentifier.builder(DpnToInterfaceList.class).child(DpnToInterface.class, dpnToInterfaceKey).child(InterfaceNameEntry.class, interfaceNameEntryKey).build();
    transaction.delete(LogicalDatastoreType.OPERATIONAL, intfid);
    if (interfaceNameEntries.size() <= 1) {
        transaction.delete(LogicalDatastoreType.OPERATIONAL, dpnToInterfaceId);
    }
}
Also used : InterfaceNameEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.dpn.to._interface.list.dpn.to._interface.InterfaceNameEntry) InterfaceNameEntryKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.dpn.to._interface.list.dpn.to._interface.InterfaceNameEntryKey) DpnToInterface(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.dpn.to._interface.list.DpnToInterface) DpnToInterfaceKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.dpn.to._interface.list.DpnToInterfaceKey) DpnToInterfaceList(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.DpnToInterfaceList)

Example 5 with DpnToInterface

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.dpn.to._interface.list.DpnToInterface in project netvirt by opendaylight.

the class TunnelUnderlayNetworkChangeListener method handleTepIpChangeEvent.

private void handleTepIpChangeEvent(BigInteger dpId, String srcTepIp, String origUnderlayNetwork, String updatedUnderlayNetwork) {
    LOG.debug("Underlay network change for TEP ip {} from {} to {} DPN {}", srcTepIp, origUnderlayNetwork, updatedUnderlayNetwork, dpId);
    com.google.common.base.Optional<DpnToInterface> dpnToInterfaceOpt = policyServiceUtil.getUnderlayNetworkDpnToInterfaces(origUnderlayNetwork, dpId);
    if (!dpnToInterfaceOpt.isPresent()) {
        LOG.debug("No DpnToInterfaces found for underlay network {} DPN {}", origUnderlayNetwork, dpId);
        return;
    }
    DpnToInterface dpnToInterface = dpnToInterfaceOpt.get();
    List<TunnelInterface> tunnelInterfaces = dpnToInterface.getTunnelInterface();
    if (tunnelInterfaces == null || tunnelInterfaces.isEmpty()) {
        LOG.debug("No tunnel interfaces found for underlay network {} on DPN {}", origUnderlayNetwork, dpId);
        return;
    }
    policyServiceUtil.updateTunnelInterfacesForUnderlayNetwork(origUnderlayNetwork, dpId, tunnelInterfaces, false);
    policyServiceUtil.updateTunnelInterfacesForUnderlayNetwork(updatedUnderlayNetwork, dpId, tunnelInterfaces, true);
}
Also used : DpnToInterface(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.policy.rev170207.underlay.networks.underlay.network.DpnToInterface) TunnelInterface(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.policy.rev170207.underlay.networks.underlay.network.dpn.to._interface.TunnelInterface)

Aggregations

BigInteger (java.math.BigInteger)5 TunnelInterface (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.policy.rev170207.underlay.networks.underlay.network.dpn.to._interface.TunnelInterface)5 DpnToInterface (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.dpn.to._interface.list.DpnToInterface)3 DpnToInterfaceKey (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.dpn.to._interface.list.DpnToInterfaceKey)3 UnderlayNetwork (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.policy.rev170207.underlay.networks.UnderlayNetwork)3 DpnToInterface (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.policy.rev170207.underlay.networks.underlay.network.DpnToInterface)3 PolicyProfile (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.policy.rev170207.underlay.networks.underlay.network.PolicyProfile)3 ArrayList (java.util.ArrayList)2 WriteTransaction (org.opendaylight.controller.md.sal.binding.api.WriteTransaction)2 InterfaceNameEntry (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.dpn.to._interface.list.dpn.to._interface.InterfaceNameEntry)2 DpnToInterfaceList (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.DpnToInterfaceList)1 InterfaceNameEntryKey (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.dpn.to._interface.list.dpn.to._interface.InterfaceNameEntryKey)1 GetDpnInterfaceListOutputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetDpnInterfaceListOutputBuilder)1 Interfaces (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.get.dpn._interface.list.output.Interfaces)1 InterfacesBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.get.dpn._interface.list.output.InterfacesBuilder)1 DpnToInterfaceBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.policy.rev170207.underlay.networks.underlay.network.DpnToInterfaceBuilder)1