Search in sources :

Example 1 with InterfaceBfdStatus

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.InterfaceBfdStatus in project genius by opendaylight.

the class OvsInterfaceTopologyStateUpdateHelper method getTunnelOpState.

private static Interface.OperStatus getTunnelOpState(OvsdbTerminationPointAugmentation terminationPoint) {
    if (!SouthboundUtils.bfdMonitoringEnabled(terminationPoint.getInterfaceBfd())) {
        return Interface.OperStatus.Up;
    }
    Interface.OperStatus livenessState = Interface.OperStatus.Down;
    List<InterfaceBfdStatus> tunnelBfdStatus = terminationPoint.getInterfaceBfdStatus();
    if (tunnelBfdStatus != null && !tunnelBfdStatus.isEmpty()) {
        for (InterfaceBfdStatus bfdState : tunnelBfdStatus) {
            if (bfdState.getBfdStatusKey().equalsIgnoreCase(SouthboundUtils.BFD_OP_STATE)) {
                String bfdOpState = bfdState.getBfdStatusValue();
                livenessState = SouthboundUtils.BFD_STATE_UP.equalsIgnoreCase(bfdOpState) ? Interface.OperStatus.Up : Interface.OperStatus.Down;
                break;
            }
        }
    }
    return livenessState;
}
Also used : InterfaceBfdStatus(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.InterfaceBfdStatus) Interface(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface)

Example 2 with InterfaceBfdStatus

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.InterfaceBfdStatus in project genius by opendaylight.

the class OvsInterfaceTopologyStateUpdateHelper method updateTunnelState.

public List<ListenableFuture<Void>> updateTunnelState(OvsdbTerminationPointAugmentation terminationPointNew) {
    final Interface.OperStatus interfaceBfdStatus = getTunnelOpState(terminationPointNew);
    final String interfaceName = terminationPointNew.getName();
    interfaceManagerCommonUtils.addBfdStateToCache(interfaceName, interfaceBfdStatus);
    if (!entityOwnershipUtils.isEntityOwner(IfmConstants.INTERFACE_CONFIG_ENTITY, IfmConstants.INTERFACE_CONFIG_ENTITY)) {
        return Collections.emptyList();
    }
    coordinator.enqueueJob(interfaceName, () -> {
        // update opstate of interface if TEP has gone down/up as a result
        // of BFD monitoring
        final Interface interfaceState = interfaceManagerCommonUtils.getInterfaceStateFromOperDS(terminationPointNew.getName());
        if (interfaceState != null && interfaceState.getOperStatus() != Interface.OperStatus.Unknown && interfaceState.getOperStatus() != interfaceBfdStatus) {
            LOG.debug("updating tunnel state for interface {} as {}", interfaceName, interfaceBfdStatus);
            return Collections.singletonList(txRunner.callWithNewWriteOnlyTransactionAndSubmit(tx -> InterfaceManagerCommonUtils.updateOpState(tx, interfaceName, interfaceBfdStatus)));
        }
        return Collections.emptyList();
    });
    return Collections.emptyList();
}
Also used : IfmConstants(org.opendaylight.genius.interfacemanager.IfmConstants) OvsdbTerminationPointAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbTerminationPointAugmentation) InterfaceBfdStatus(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.InterfaceBfdStatus) ListenableFuture(com.google.common.util.concurrent.ListenableFuture) LoggerFactory(org.slf4j.LoggerFactory) Singleton(javax.inject.Singleton) InterfacemgrProvider(org.opendaylight.genius.interfacemanager.InterfacemgrProvider) Inject(javax.inject.Inject) OvsdbBridgeAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeAugmentation) ManagedNewTransactionRunnerImpl(org.opendaylight.genius.infra.ManagedNewTransactionRunnerImpl) BigInteger(java.math.BigInteger) SouthboundUtils(org.opendaylight.genius.interfacemanager.renderer.ovs.utilities.SouthboundUtils) IfmUtil(org.opendaylight.genius.interfacemanager.IfmUtil) Logger(org.slf4j.Logger) EntityOwnershipUtils(org.opendaylight.genius.utils.clustering.EntityOwnershipUtils) ManagedNewTransactionRunner(org.opendaylight.genius.infra.ManagedNewTransactionRunner) JobCoordinator(org.opendaylight.infrautils.jobcoordinator.JobCoordinator) InterfaceManagerCommonUtils(org.opendaylight.genius.interfacemanager.commons.InterfaceManagerCommonUtils) Interface(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface) BridgeEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.bridge._interface.info.BridgeEntry) DataBroker(org.opendaylight.controller.md.sal.binding.api.DataBroker) List(java.util.List) InstanceIdentifier(org.opendaylight.yangtools.yang.binding.InstanceIdentifier) InterfaceMetaUtils(org.opendaylight.genius.interfacemanager.commons.InterfaceMetaUtils) Collections(java.util.Collections) Interface(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface)

Example 3 with InterfaceBfdStatus

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.InterfaceBfdStatus in project genius by opendaylight.

the class OvsdbSouthboundTestUtil method updateTerminationPoint.

public static void updateTerminationPoint(DataBroker dataBroker, String interfaceName, Class<? extends InterfaceTypeBase> type) throws TransactionCommitFailedException {
    final OvsdbBridgeName ovsdbBridgeName = new OvsdbBridgeName("s2");
    final InstanceIdentifier<Node> bridgeIid = createInstanceIdentifier("192.168.56.101", 6640, ovsdbBridgeName);
    InstanceIdentifier<TerminationPoint> tpId = createTerminationPointInstanceIdentifier(InstanceIdentifier.keyOf(bridgeIid.firstIdentifierOf(Node.class)), interfaceName);
    TerminationPointBuilder tpBuilder = new TerminationPointBuilder();
    tpBuilder.setKey(InstanceIdentifier.keyOf(tpId));
    OvsdbTerminationPointAugmentationBuilder tpAugmentationBuilder = new OvsdbTerminationPointAugmentationBuilder();
    tpAugmentationBuilder.setName(interfaceName);
    if (type != null) {
        tpAugmentationBuilder.setInterfaceType(type);
    }
    List<InterfaceBfdStatus> interfaceBfdStatuses = Arrays.asList(new InterfaceBfdStatusBuilder().setBfdStatusKey("state").setBfdStatusValue("down").build());
    tpAugmentationBuilder.setInterfaceBfdStatus(interfaceBfdStatuses);
    tpBuilder.addAugmentation(OvsdbTerminationPointAugmentation.class, tpAugmentationBuilder.build());
    WriteTransaction tx = dataBroker.newWriteOnlyTransaction();
    tx.merge(OPERATIONAL, tpId, tpBuilder.build(), true);
    tx.submit().checkedGet();
}
Also used : WriteTransaction(org.opendaylight.controller.md.sal.binding.api.WriteTransaction) InterfaceBfdStatusBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.InterfaceBfdStatusBuilder) OvsdbBridgeName(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeName) Node(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node) OvsdbTerminationPointAugmentationBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbTerminationPointAugmentationBuilder) InterfaceBfdStatus(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.InterfaceBfdStatus) TerminationPointBuilder(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointBuilder) TerminationPoint(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint)

Aggregations

InterfaceBfdStatus (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.InterfaceBfdStatus)3 Interface (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface)2 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)1 BigInteger (java.math.BigInteger)1 Collections (java.util.Collections)1 List (java.util.List)1 Inject (javax.inject.Inject)1 Singleton (javax.inject.Singleton)1 DataBroker (org.opendaylight.controller.md.sal.binding.api.DataBroker)1 WriteTransaction (org.opendaylight.controller.md.sal.binding.api.WriteTransaction)1 ManagedNewTransactionRunner (org.opendaylight.genius.infra.ManagedNewTransactionRunner)1 ManagedNewTransactionRunnerImpl (org.opendaylight.genius.infra.ManagedNewTransactionRunnerImpl)1 IfmConstants (org.opendaylight.genius.interfacemanager.IfmConstants)1 IfmUtil (org.opendaylight.genius.interfacemanager.IfmUtil)1 InterfacemgrProvider (org.opendaylight.genius.interfacemanager.InterfacemgrProvider)1 InterfaceManagerCommonUtils (org.opendaylight.genius.interfacemanager.commons.InterfaceManagerCommonUtils)1 InterfaceMetaUtils (org.opendaylight.genius.interfacemanager.commons.InterfaceMetaUtils)1 SouthboundUtils (org.opendaylight.genius.interfacemanager.renderer.ovs.utilities.SouthboundUtils)1 EntityOwnershipUtils (org.opendaylight.genius.utils.clustering.EntityOwnershipUtils)1 JobCoordinator (org.opendaylight.infrautils.jobcoordinator.JobCoordinator)1