use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.bridge.ref.info.BridgeRefEntry in project genius by opendaylight.
the class InterfaceMetaUtils method deleteBridgeRefEntry.
public static void deleteBridgeRefEntry(BigInteger dpnId, WriteTransaction tx) {
LOG.debug("Deleting bridge ref entry for dpn: {}", dpnId);
BridgeRefEntryKey bridgeRefEntryKey = new BridgeRefEntryKey(dpnId);
InstanceIdentifier<BridgeRefEntry> bridgeEntryId = InterfaceMetaUtils.getBridgeRefEntryIdentifier(bridgeRefEntryKey);
tx.delete(LogicalDatastoreType.OPERATIONAL, bridgeEntryId);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.bridge.ref.info.BridgeRefEntry in project genius by opendaylight.
the class InterfaceMetaUtils method getTerminationPointsOnBridge.
public List<TerminationPoint> getTerminationPointsOnBridge(BigInteger dpnId) {
BridgeRefEntry bridgeRefEntry = getBridgeRefEntryFromOperDS(dpnId);
if (bridgeRefEntry == null || bridgeRefEntry.getBridgeReference() == null) {
LOG.debug("BridgeRefEntry for DPNID {} not found", dpnId);
return Collections.emptyList();
}
InstanceIdentifier<Node> nodeIid = bridgeRefEntry.getBridgeReference().getValue().firstIdentifierOf(Node.class);
com.google.common.base.Optional<Node> optNode = IfmUtil.read(LogicalDatastoreType.OPERATIONAL, nodeIid, dataBroker);
if (optNode.isPresent()) {
return optNode.get().getTerminationPoint();
}
return Collections.emptyList();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.bridge.ref.info.BridgeRefEntry in project genius by opendaylight.
the class InterfaceMetaUtils method getBridgeRefEntryFromOperationalDS.
public BridgeRefEntry getBridgeRefEntryFromOperationalDS(BigInteger dpId) {
BridgeRefEntryKey bridgeRefEntryKey = new BridgeRefEntryKey(dpId);
InstanceIdentifier<BridgeRefEntry> bridgeRefEntryIid = InterfaceMetaUtils.getBridgeRefEntryIdentifier(bridgeRefEntryKey);
BridgeRefEntry bridgeRefEntry = IfmUtil.read(LogicalDatastoreType.OPERATIONAL, bridgeRefEntryIid, dataBroker).orNull();
if (bridgeRefEntry != null) {
addBridgeRefEntryToCache(dpId, bridgeRefEntry);
}
return bridgeRefEntry;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.bridge.ref.info.BridgeRefEntry in project genius by opendaylight.
the class InterfaceMetaUtils method getBridgeRefEntryFromOperDS.
public BridgeRefEntry getBridgeRefEntryFromOperDS(BigInteger dpId) {
BridgeRefEntry bridgeRefEntry = getBridgeRefEntryFromCache(dpId);
if (bridgeRefEntry != null) {
return bridgeRefEntry;
}
BridgeRefEntryKey bridgeRefEntryKey = new BridgeRefEntryKey(dpId);
InstanceIdentifier<BridgeRefEntry> bridgeRefEntryIid = InterfaceMetaUtils.getBridgeRefEntryIdentifier(bridgeRefEntryKey);
bridgeRefEntry = IfmUtil.read(LogicalDatastoreType.OPERATIONAL, bridgeRefEntryIid, dataBroker).orNull();
if (bridgeRefEntry != null) {
addBridgeRefEntryToCache(dpId, bridgeRefEntry);
}
return bridgeRefEntry;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.bridge.ref.info.BridgeRefEntry in project netvirt by opendaylight.
the class TransportZoneNotificationUtil method getPortsNode.
@SuppressWarnings("unchecked")
private Optional<Node> getPortsNode(BigInteger dpnId, ReadTransaction tx) throws ReadFailedException {
InstanceIdentifier<BridgeRefEntry> bridgeRefInfoPath = InstanceIdentifier.create(BridgeRefInfo.class).child(BridgeRefEntry.class, new BridgeRefEntryKey(dpnId));
// FIXME: Read this through a cache
Optional<BridgeRefEntry> optionalBridgeRefEntry = tx.read(LogicalDatastoreType.OPERATIONAL, bridgeRefInfoPath).checkedGet();
if (!optionalBridgeRefEntry.isPresent()) {
LOG.error("no bridge ref entry found for dpnId {}", dpnId);
return Optional.absent();
}
InstanceIdentifier<Node> nodeId = optionalBridgeRefEntry.get().getBridgeReference().getValue().firstIdentifierOf(Node.class);
// FIXME: Read this through a cache
Optional<Node> optionalNode = tx.read(LogicalDatastoreType.OPERATIONAL, nodeId).checkedGet();
if (!optionalNode.isPresent()) {
LOG.error("missing node for dpnId {}", dpnId);
}
return optionalNode;
}
Aggregations