use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana._if.type.rev170119.Tunnel in project netvirt by opendaylight.
the class ElanInterfaceManager method validateExternalTunnelStateEvent.
/**
* Validate external tunnel state event.
*
* @param externalTunnel
* the external tunnel
* @param intrf
* the intrf
* @return true, if successful
*/
private boolean validateExternalTunnelStateEvent(ExternalTunnel externalTunnel, Interface intrf) {
if (intrf.getOperStatus() == Interface.OperStatus.Up) {
String srcDevice = externalTunnel.getDestinationDevice();
String destDevice = externalTunnel.getSourceDevice();
ExternalTunnel otherEndPointExtTunnel = elanUtils.getExternalTunnel(srcDevice, destDevice, LogicalDatastoreType.CONFIGURATION);
LOG.trace("Validating external tunnel state: src tunnel {}, dest tunnel {}", externalTunnel, otherEndPointExtTunnel);
if (otherEndPointExtTunnel != null) {
boolean otherEndPointInterfaceOperational = ElanUtils.isInterfaceOperational(otherEndPointExtTunnel.getTunnelInterfaceName(), broker);
if (otherEndPointInterfaceOperational) {
return true;
} else {
LOG.debug("Other end [{}] of the external tunnel is not yet UP for {}", otherEndPointExtTunnel.getTunnelInterfaceName(), externalTunnel);
}
}
}
return false;
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana._if.type.rev170119.Tunnel in project netvirt by opendaylight.
the class ElanTunnelInterfaceStateListener method add.
@Override
public void add(InstanceIdentifier<StateTunnelList> key, StateTunnelList add) {
LOG.info("processing add state for StateTunnelList {}", add);
if (!isInternalTunnel(add)) {
LOG.trace("tunnel {} is not a internal vxlan tunnel", add);
return;
}
if (elanUtils.isTunnelInLogicalGroup(add.getTunnelInterfaceName())) {
LOG.trace("MULTIPLE_VxLAN_TUNNELS: ignoring the tunnel event for {}", add.getTunnelInterfaceName());
return;
}
TunnelOperStatus tunOpStatus = add.getOperState();
if (tunOpStatus != TunnelOperStatus.Down && tunOpStatus != TunnelOperStatus.Up) {
LOG.trace("Returning because unsupported tunnelOperStatus {}", tunOpStatus);
return;
}
try {
Uint64 srcDpId = Uint64.valueOf(add.getSrcInfo().getTepDeviceId());
Uint64 dstDpId = Uint64.valueOf(add.getDstInfo().getTepDeviceId());
jobCoordinator.enqueueJob(add.getTunnelInterfaceName(), () -> {
LOG.info("Handling tunnel state event for srcDpId {} and dstDpId {} ", srcDpId, dstDpId);
elanInterfaceManager.handleInternalTunnelStateEvent(srcDpId, dstDpId);
return Collections.emptyList();
}, ElanConstants.JOB_MAX_RETRIES);
} catch (NumberFormatException e) {
LOG.error("Invalid source TepDeviceId {} or destination TepDeviceId {}", add.getSrcInfo().getTepDeviceId(), add.getDstInfo().getTepDeviceId());
}
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana._if.type.rev170119.Tunnel in project netvirt by opendaylight.
the class TunnelStateChangeListener method bindService.
private void bindService(String tunnelInterfaceName) {
coordinator.enqueueJob(tunnelInterfaceName, () -> {
LOG.info("Bind egress policy service on tunnel {}", tunnelInterfaceName);
List<Instruction> instructions = Collections.singletonList(MDSALUtil.buildAndGetGotoTableInstruction(NwConstants.EGRESS_POLICY_CLASSIFIER_TABLE, 0));
BoundServices boundServices = getBoundServices(tunnelInterfaceName, instructions);
interfaceManager.bindService(tunnelInterfaceName, ServiceModeEgress.class, boundServices);
return null;
});
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana._if.type.rev170119.Tunnel in project netvirt by opendaylight.
the class TunnelStateChangeListener method populatePolicyRoutesToDpn.
private void populatePolicyRoutesToDpn(StateTunnelList tunnelState, int addOrRemove) {
BigInteger srcDpId = getTepDpnId(tunnelState.getSrcInfo());
BigInteger dstDpId = getTepDpnId(tunnelState.getDstInfo());
String tunnelInterfaceName = tunnelState.getTunnelInterfaceName();
if (BigInteger.ZERO.equals(srcDpId) || BigInteger.ZERO.equals(dstDpId)) {
LOG.warn("No valid DPN found for logical tunnel {}", tunnelInterfaceName);
return;
}
List<PolicyProfile> policyProfiles = policyServiceUtil.getAllPolicyProfiles();
if (policyProfiles == null || policyProfiles.isEmpty()) {
LOG.debug("No policy profiles found on addition of {}", tunnelInterfaceName);
return;
}
policyProfiles.forEach(policyProfile -> {
String policyClassifier = policyProfile.getPolicyClassifier();
List<String> underlayNetworks = PolicyServiceUtil.getUnderlayNetworksFromPolicyRoutes(policyProfile.getPolicyRoute());
underlayNetworks.forEach(underlayNetwork -> {
if (policyServiceUtil.underlayNetworkContainsDpn(underlayNetwork, srcDpId) && policyServiceUtil.underlayNetworkContainsRemoteDpn(underlayNetwork, dstDpId)) {
routeFlowProgrammer.programPolicyClassifierFlow(policyClassifier, srcDpId, dstDpId, addOrRemove, true);
} else {
LOG.trace("logical tunnel {} source DPN {} dest DPN {} not associated to policy classifier {}", tunnelInterfaceName, srcDpId, dstDpId, policyClassifier);
}
});
});
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana._if.type.rev170119.Tunnel in project netvirt by opendaylight.
the class TunnelStateChangeListener method unbindService.
private void unbindService(String tunnelInterfaceName) {
coordinator.enqueueJob(tunnelInterfaceName, () -> {
LOG.info("Unbind egress policy service on tunnel {}", tunnelInterfaceName);
BoundServices boundServices = getBoundServices(tunnelInterfaceName, Collections.emptyList());
interfaceManager.unbindService(tunnelInterfaceName, ServiceModeEgress.class, boundServices);
return null;
});
}
Aggregations