use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface.OperStatus in project genius by opendaylight.
the class ItmTunnelAggregationHelper method getAggregatedOperStatus.
private OperStatus getAggregatedOperStatus(Interface ifaceState, InterfaceParentEntry parentEntry) {
String logicalTunnelName = parentEntry.getParentInterface();
if (!logicalTunnelName.equals(ifaceState.getName()) && ifaceState.getOperStatus() == OperStatus.Up) {
return OperStatus.Up;
}
List<InterfaceChildEntry> interfaceChildEntries = parentEntry.getInterfaceChildEntry();
if (interfaceChildEntries == null || interfaceChildEntries.isEmpty()) {
LOG.debug("MULTIPLE_VxLAN_TUNNELS: OperStatus is Down, because of the empty child list in group {}", parentEntry.getParentInterface());
return OperStatus.Down;
}
for (InterfaceChildEntry interfaceChildEntry : interfaceChildEntries) {
String curChildInterface = interfaceChildEntry.getChildInterface();
if (!curChildInterface.equals(ifaceState.getName())) {
InterfaceInfo ifInfo = interfaceManager.getInterfaceInfoFromOperationalDataStore(curChildInterface);
if (ifInfo != null && InterfaceInfo.InterfaceOpState.UP.equals(ifInfo.getOpState())) {
return OperStatus.Up;
}
}
}
return OperStatus.Down;
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface.OperStatus in project genius by opendaylight.
the class ItmTunnelAggregationHelper method updateInterfaceOperStatus.
private void updateInterfaceOperStatus(String ifaceName, Interface ifaceState, OperStatus st, WriteTransaction tx) {
LOG.debug("MULTIPLE_VxLAN_TUNNELS: update OperStatus to be {} for {}", st.toString(), ifaceName);
InstanceIdentifier<Interface> idLogicGroup = ItmUtils.buildStateInterfaceId(ifaceName);
InterfaceBuilder ifaceBuilderChild = new InterfaceBuilder(ifaceState);
ifaceBuilderChild.setOperStatus(st);
tx.merge(LogicalDatastoreType.OPERATIONAL, idLogicGroup, ifaceBuilderChild.build(), true);
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface.OperStatus in project genius by opendaylight.
the class ItmTunnelAggregationHelper method updateLogicalTunnelGroupOperStatus.
private void updateLogicalTunnelGroupOperStatus(String logicalTunnelIfaceName, Interface ifaceState, InterfaceParentEntry parentEntry, ReadWriteTransaction tx) throws ReadFailedException {
if (parentEntry == null) {
LOG.debug("MULTIPLE_VxLAN_TUNNELS: uninitialized parent entry {}", logicalTunnelIfaceName);
return;
}
OperStatus newOperStatus = getAggregatedOperStatus(ifaceState, parentEntry);
if (logicalTunnelIfaceName.equals(ifaceState.getName())) {
// the current interface is logical tunnel itself
if (ifaceState.getOperStatus() != newOperStatus) {
updateInterfaceOperStatus(logicalTunnelIfaceName, ifaceState, newOperStatus, tx);
}
} else {
InterfaceInfo ifLogicInfo = interfaceManager.getInterfaceInfoFromOperationalDataStore(logicalTunnelIfaceName);
if (isLogicalTunnelStateUpdateNeeded(newOperStatus, ifLogicInfo)) {
InstanceIdentifier<Interface> id = ItmUtils.buildStateInterfaceId(logicalTunnelIfaceName);
Optional<Interface> ifState = tx.read(LogicalDatastoreType.OPERATIONAL, id).checkedGet();
if (ifState.isPresent()) {
Interface ifStateLogicTunnel = ifState.get();
updateInterfaceOperStatus(logicalTunnelIfaceName, ifStateLogicTunnel, newOperStatus, tx);
}
}
}
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface.OperStatus in project genius by opendaylight.
the class InterfaceManagerCommonUtils method updateOperStatus.
public static void updateOperStatus(String interfaceName, org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface.OperStatus operStatus, WriteTransaction transaction) {
LOG.info("updating operational status {} for interface {}", interfaceName, operStatus);
InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface> ifChildStateId = IfmUtil.buildStateInterfaceId(interfaceName);
InterfaceBuilder ifaceBuilderChild = new InterfaceBuilder();
ifaceBuilderChild.setOperStatus(operStatus);
ifaceBuilderChild.setKey(IfmUtil.getStateInterfaceKeyFromName(interfaceName));
transaction.merge(LogicalDatastoreType.OPERATIONAL, ifChildStateId, ifaceBuilderChild.build());
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface.OperStatus in project genius by opendaylight.
the class InterfaceManagerCommonUtils method addStateEntry.
public org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface addStateEntry(Interface interfaceInfo, String interfaceName, WriteTransaction transaction, PhysAddress physAddress, OperStatus operStatus, AdminStatus adminStatus, NodeConnectorId nodeConnectorId) {
LOG.debug("adding interface state for {}", interfaceName);
InterfaceBuilder ifaceBuilder = new InterfaceBuilder().setType(Other.class).setIfIndex(IfmConstants.DEFAULT_IFINDEX);
Integer ifIndex;
Class<? extends InterfaceType> interfaceType = null;
if (interfaceInfo != null) {
if (!interfaceInfo.isEnabled()) {
operStatus = OperStatus.Down;
}
interfaceType = interfaceInfo.getType();
ifaceBuilder.setType(interfaceType);
// retrieve if-index only for northbound configured interfaces
ifIndex = IfmUtil.allocateId(idManager, IfmConstants.IFM_IDPOOL_NAME, interfaceName);
ifaceBuilder.setIfIndex(ifIndex);
interfaceMetaUtils.createLportTagInterfaceMap(interfaceName, ifIndex);
}
InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface> ifStateId = IfmUtil.buildStateInterfaceId(interfaceName);
List<String> childLowerLayerIfList = new ArrayList<>();
if (nodeConnectorId != null) {
childLowerLayerIfList.add(0, nodeConnectorId.getValue());
} else {
// logical tunnel group doesn't have OF port
ParentRefs parentRefs = interfaceInfo.getAugmentation(ParentRefs.class);
if (parentRefs != null) {
BigInteger dpId = parentRefs.getDatapathNodeIdentifier();
String lowref = MDSALUtil.NODE_PREFIX + MDSALUtil.SEPARATOR + dpId + MDSALUtil.SEPARATOR + 0;
childLowerLayerIfList.add(0, lowref);
}
}
ifaceBuilder.setAdminStatus(adminStatus).setOperStatus(operStatus).setLowerLayerIf(childLowerLayerIfList);
if (physAddress != null) {
ifaceBuilder.setPhysAddress(physAddress);
}
ifaceBuilder.setKey(IfmUtil.getStateInterfaceKeyFromName(interfaceName));
ifaceBuilder.setStatistics(new StatisticsBuilder().setDiscontinuityTime(DateAndTime.getDefaultInstance(ZonedDateTime.now().format(DateTimeFormatter.ISO_INSTANT))).build());
org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface ifState = ifaceBuilder.build();
boolean isTunnelInterface = InterfaceManagerCommonUtils.isTunnelInterface(interfaceInfo);
boolean isOfTunnelInterface = InterfaceManagerCommonUtils.isOfTunnelInterface(interfaceInfo);
if (isTunnelInterface && !isOfTunnelInterface) {
batchingUtils.write(ifStateId, ifState, BatchingUtils.EntityType.DEFAULT_OPERATIONAL);
} else {
transaction.put(LogicalDatastoreType.OPERATIONAL, ifStateId, ifState, true);
}
if (nodeConnectorId != null) {
BigInteger dpId = IfmUtil.getDpnFromNodeConnectorId(nodeConnectorId);
// Update the DpnToInterfaceList OpDS
createOrUpdateDpnToInterface(dpId, interfaceName, interfaceType);
}
return ifState;
}
Aggregations