use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.State in project netvirt by opendaylight.
the class ElanInterfaceManager method setupLeavesLocalBroadcastGroups.
private void setupLeavesLocalBroadcastGroups(ElanInstance elanInfo, DpnInterfaces newDpnInterface, InterfaceInfo interfaceInfo) {
EtreeInstance etreeInstance = elanInfo.getAugmentation(EtreeInstance.class);
if (etreeInstance != null) {
List<Bucket> listBucket = new ArrayList<>();
int bucketId = 0;
List<String> interfaces = new ArrayList<>();
if (newDpnInterface != null) {
interfaces = newDpnInterface.getInterfaces();
}
for (String ifName : interfaces) {
// In case if there is a InterfacePort in the cache which is not
// in
// operational state, skip processing it
InterfaceInfo ifInfo = interfaceManager.getInterfaceInfoFromOperationalDataStore(ifName, interfaceInfo.getInterfaceType());
if (!isOperational(ifInfo)) {
continue;
}
if (!interfaceManager.isExternalInterface(ifName)) {
// only add root interfaces
bucketId = addInterfaceIfRootInterface(bucketId, ifName, listBucket, ifInfo);
}
}
if (listBucket.isEmpty()) {
// No Buckets
createDropBucket(listBucket);
}
long etreeLeafTag = etreeInstance.getEtreeLeafTagVal().getValue();
long groupId = ElanUtils.getEtreeLeafLocalBCGId(etreeLeafTag);
Group group = MDSALUtil.buildGroup(groupId, elanInfo.getElanInstanceName(), GroupTypes.GroupAll, MDSALUtil.buildBucketLists(listBucket));
LOG.trace("installing the localBroadCast Group:{}", group);
mdsalManager.syncInstallGroup(interfaceInfo.getDpId(), group);
}
}
use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.State 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.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.State in project netvirt by opendaylight.
the class ElanInterfaceManager method handleInternalTunnelStateEvent.
@SuppressWarnings("checkstyle:IllegalCatch")
public void handleInternalTunnelStateEvent(BigInteger srcDpId, BigInteger dstDpId) {
ElanDpnInterfaces dpnInterfaceLists = elanUtils.getElanDpnInterfacesList();
LOG.trace("processing tunnel state event for srcDpId {} dstDpId {}" + " and dpnInterfaceList {}", srcDpId, dstDpId, dpnInterfaceLists);
if (dpnInterfaceLists == null) {
return;
}
List<ElanDpnInterfacesList> elanDpnIf = dpnInterfaceLists.getElanDpnInterfacesList();
for (ElanDpnInterfacesList elanDpns : elanDpnIf) {
int cnt = 0;
String elanName = elanDpns.getElanInstanceName();
ElanInstance elanInfo = elanInstanceCache.get(elanName).orNull();
if (elanInfo == null) {
LOG.warn("ELAN Info is null for elanName {} that does exist in elanDpnInterfaceList, " + "skipping this ELAN for tunnel handling", elanName);
continue;
}
if (ElanUtils.isFlat(elanInfo) || ElanUtils.isVlan(elanInfo)) {
LOG.debug("Ignoring internal tunnel state event for Flat/Vlan elan {}", elanName);
continue;
}
List<DpnInterfaces> dpnInterfaces = elanDpns.getDpnInterfaces();
if (dpnInterfaces == null) {
continue;
}
DpnInterfaces dstDpnIf = null;
for (DpnInterfaces dpnIf : dpnInterfaces) {
BigInteger dpnIfDpId = dpnIf.getDpId();
if (dpnIfDpId.equals(srcDpId)) {
cnt++;
} else if (dpnIfDpId.equals(dstDpId)) {
cnt++;
dstDpnIf = dpnIf;
}
}
if (cnt == 2) {
LOG.info("Elan instance:{} is present b/w srcDpn:{} and dstDpn:{}", elanName, srcDpId, dstDpId);
// var needs to be final so it can be accessed in lambda
final DpnInterfaces finalDstDpnIf = dstDpnIf;
jobCoordinator.enqueueJob(elanName, () -> {
// update Remote BC Group
LOG.trace("procesing elan remote bc group for tunnel event {}", elanInfo);
try {
elanL2GatewayMulticastUtils.setupElanBroadcastGroups(elanInfo, srcDpId);
} catch (RuntimeException e) {
LOG.error("Error while adding remote bc group for {} on dpId {} ", elanName, srcDpId);
}
Set<String> interfaceLists = new HashSet<>();
interfaceLists.addAll(finalDstDpnIf.getInterfaces());
for (String ifName : interfaceLists) {
jobCoordinator.enqueueJob(ElanUtils.getElanInterfaceJobKey(ifName), () -> {
LOG.info("Processing tunnel up event for elan {} and interface {}", elanName, ifName);
InterfaceInfo interfaceInfo = interfaceManager.getInterfaceInfo(ifName);
if (isOperational(interfaceInfo)) {
return installDMacAddressTables(elanInfo, interfaceInfo, srcDpId);
}
return Collections.emptyList();
}, ElanConstants.JOB_MAX_RETRIES);
}
return Collections.emptyList();
}, ElanConstants.JOB_MAX_RETRIES);
}
}
}
use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.State in project netvirt by opendaylight.
the class ElanInterfaceManager method setupStandardLocalBroadcastGroups.
public void setupStandardLocalBroadcastGroups(ElanInstance elanInfo, DpnInterfaces newDpnInterface, InterfaceInfo interfaceInfo) {
List<Bucket> listBucket = new ArrayList<>();
int bucketId = 0;
long groupId = ElanUtils.getElanLocalBCGId(elanInfo.getElanTag());
List<String> interfaces = new ArrayList<>();
if (newDpnInterface != null) {
interfaces = newDpnInterface.getInterfaces();
}
for (String ifName : interfaces) {
// In case if there is a InterfacePort in the cache which is not in
// operational state, skip processing it
InterfaceInfo ifInfo = interfaceManager.getInterfaceInfoFromOperationalDataStore(ifName, interfaceInfo.getInterfaceType());
if (!isOperational(ifInfo)) {
continue;
}
if (!interfaceManager.isExternalInterface(ifName)) {
listBucket.add(MDSALUtil.buildBucket(getInterfacePortActions(ifInfo), MDSALUtil.GROUP_WEIGHT, bucketId, MDSALUtil.WATCH_PORT, MDSALUtil.WATCH_GROUP));
bucketId++;
}
}
Group group = MDSALUtil.buildGroup(groupId, elanInfo.getElanInstanceName(), GroupTypes.GroupAll, MDSALUtil.buildBucketLists(listBucket));
LOG.trace("installing the localBroadCast Group:{}", group);
mdsalManager.syncInstallGroup(interfaceInfo.getDpId(), group);
}
use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.State in project netvirt by opendaylight.
the class ElanTunnelInterfaceStateListener method add.
@Override
protected 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;
}
jobCoordinator.enqueueJob(add.getTunnelInterfaceName(), () -> {
BigInteger srcDpId = new BigInteger(add.getSrcInfo().getTepDeviceId());
BigInteger dstDpId = new BigInteger(add.getDstInfo().getTepDeviceId());
LOG.info("Handling tunnel state event for srcDpId {} and dstDpId {} ", srcDpId, dstDpId);
elanInterfaceManager.handleInternalTunnelStateEvent(srcDpId, dstDpId);
return Collections.emptyList();
}, ElanConstants.JOB_MAX_RETRIES);
}
Aggregations