Search in sources :

Example 1 with 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 DisplayNaptSwithcesCli method getPortsNode.

@SuppressWarnings("unchecked")
private Optional<Node> getPortsNode(BigInteger dpnId) {
    InstanceIdentifier<BridgeRefEntry> bridgeRefInfoPath = InstanceIdentifier.create(BridgeRefInfo.class).child(BridgeRefEntry.class, new BridgeRefEntryKey(dpnId));
    Optional<BridgeRefEntry> bridgeRefEntry = SingleTransactionDataBroker.syncReadOptionalAndTreatReadFailedExceptionAsAbsentOptional(dataBroker, LogicalDatastoreType.OPERATIONAL, bridgeRefInfoPath);
    if (!bridgeRefEntry.isPresent()) {
        return Optional.absent();
    }
    InstanceIdentifier<Node> nodeId = bridgeRefEntry.get().getBridgeReference().getValue().firstIdentifierOf(Node.class);
    return SingleTransactionDataBroker.syncReadOptionalAndTreatReadFailedExceptionAsAbsentOptional(dataBroker, LogicalDatastoreType.OPERATIONAL, nodeId);
}
Also used : BridgeRefInfo(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.BridgeRefInfo) BridgeRefEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.bridge.ref.info.BridgeRefEntry) Node(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node) BridgeRefEntryKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.bridge.ref.info.BridgeRefEntryKey)

Example 2 with 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 QosNeutronUtils method getBridgeRefEntryFromOperDS.

@Nullable
private OvsdbBridgeRef getBridgeRefEntryFromOperDS(BigInteger dpId) {
    BridgeRefEntryKey bridgeRefEntryKey = new BridgeRefEntryKey(dpId);
    InstanceIdentifier<BridgeRefEntry> bridgeRefEntryIid = getBridgeRefEntryIdentifier(bridgeRefEntryKey);
    BridgeRefEntry bridgeRefEntry = getBridgeRefEntryFromOperDS(bridgeRefEntryIid);
    if (bridgeRefEntry == null) {
        // bridge ref entry will be null if the bridge is disconnected from controller.
        // In that case, fetch bridge reference from bridge interface entry config DS
        BridgeEntry bridgeEntry = getBridgeEntryFromConfigDS(dpId);
        if (bridgeEntry == null) {
            return null;
        }
        return bridgeEntry.getBridgeReference();
    }
    return bridgeRefEntry.getBridgeReference();
}
Also used : BridgeRefEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.bridge.ref.info.BridgeRefEntry) BridgeEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.bridge._interface.info.BridgeEntry) BridgeRefEntryKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.bridge.ref.info.BridgeRefEntryKey) Nullable(javax.annotation.Nullable)

Example 3 with 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 InterfaceManagerConfigurationTest method setupAndAssertBridgeCreation.

private void setupAndAssertBridgeCreation() throws InterruptedException, TransactionCommitFailedException {
    OvsdbSouthboundTestUtil.createBridge(dataBroker);
    // a) Check bridgeRefEntry in cache and OperDS are same and use the
    // right DPN_ID
    BridgeRefEntryKey bridgeRefEntryKey = new BridgeRefEntryKey(DPN_ID_1);
    InstanceIdentifier<BridgeRefEntry> bridgeRefEntryIid = InterfaceMetaUtils.getBridgeRefEntryIdentifier(bridgeRefEntryKey);
    InterfaceManagerTestUtil.waitTillOperationCompletes("bridge creation", coordinatorEventsWaiter, 3, asyncEventsWaiter);
    BridgeRefEntry bridgeRefEntry = IfmUtil.read(LogicalDatastoreType.OPERATIONAL, bridgeRefEntryIid, dataBroker).orNull();
    assertEqualBeans(bridgeRefEntry.getDpid(), DPN_ID_1);
// FIXME AsyncEventsWaiter does not help in this case, need to enhance -- TODO
// assertEqualBeans(interfaceMetaUtils.getBridgeRefEntryFromCache(DPN_ID_1), bridgeRefEntry);
}
Also used : BridgeRefEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.bridge.ref.info.BridgeRefEntry) BridgeRefEntryKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.bridge.ref.info.BridgeRefEntryKey)

Example 4 with 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 ItmManagerRpcService method getNodeId.

private String getNodeId(BigInteger dpnId) throws ReadFailedException {
    InstanceIdentifier<BridgeRefEntry> path = InstanceIdentifier.builder(BridgeRefInfo.class).child(BridgeRefEntry.class, new BridgeRefEntryKey(dpnId)).build();
    BridgeRefEntry bridgeRefEntry = singleTransactionDataBroker.syncRead(LogicalDatastoreType.OPERATIONAL, path);
    return bridgeRefEntry.getBridgeReference().getValue().firstKeyOf(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node.class).getNodeId().getValue();
}
Also used : BridgeRefEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.bridge.ref.info.BridgeRefEntry) BridgeRefEntryKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.bridge.ref.info.BridgeRefEntryKey)

Example 5 with 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 getBridgeReferenceForInterface.

public BridgeRefEntry getBridgeReferenceForInterface(Interface interfaceInfo) {
    ParentRefs parentRefs = interfaceInfo.getAugmentation(ParentRefs.class);
    BigInteger dpn = parentRefs.getDatapathNodeIdentifier();
    return getBridgeRefEntryFromOperDS(dpn);
}
Also used : ParentRefs(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.ParentRefs) BigInteger(java.math.BigInteger)

Aggregations

BridgeRefEntry (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.bridge.ref.info.BridgeRefEntry)13 BridgeRefEntryKey (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.bridge.ref.info.BridgeRefEntryKey)10 Node (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node)4 BigInteger (java.math.BigInteger)3 BridgeRefInfo (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.BridgeRefInfo)2 BridgeEntry (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.bridge._interface.info.BridgeEntry)2 ParentRefs (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.ParentRefs)2 OvsdbBridgeRef (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeRef)2 TerminationPoint (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint)2 Collections (java.util.Collections)1 ExecutionException (java.util.concurrent.ExecutionException)1 Nullable (javax.annotation.Nullable)1 Ignore (org.junit.Ignore)1 Test (org.junit.Test)1 ExpectedTerminationPoint (org.opendaylight.genius.interfacemanager.test.xtend.ExpectedTerminationPoint)1 AssertDataObjects.assertEqualBeans (org.opendaylight.mdsal.binding.testutils.AssertDataObjects.assertEqualBeans)1 Tunnel (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana._if.type.rev140508.Tunnel)1 Interface (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface)1 FlowCapableNode (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode)1 BridgeEntryKey (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.bridge._interface.info.BridgeEntryKey)1