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);
}
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);
}
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());
});
}
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);
}
}
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);
}
Aggregations