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