Ask is moving to Stack Overflow and Serverfault.com! Please use the "opendaylight" tag on either of these sites. This site is now in Read-Only mode

Revision history [back]

click to hide/show revision 1
initial version

Hi Knv , I think there is no direct API for this . We have to implement . So basically you will give IP as input and you have to fetch other values right? have a look into this

try {
        nodes = tx.read(LogicalDatastoreType.OPERATIONAL, TOPO_IID)
                .checkedGet()
                .get().getNode();

    } catch (ReadFailedException e) {
        throw new IllegalStateException(e);
    }

    for (Node node : nodes) {

        if (node.getNodeId().getValue().startsWith("h")) {
            ipSwitch.put(node.getAugmentation(HostNode.class).getAddresses().get(0).getIp().getIpv4Address().getValue(),node.getAugmentation(HostNode.class).getAttachmentPoints().get(0).getTpId().getValue());
        }
    }

When application launch collect this details ; here looking into data store , and fetching all the nodeID, if it is host then fetch required data and storing into HashMap . So we have data what we looking for; Now when you give ip address as input , take the relevant details from map ! Also aware of updating map if new host added. Thanks !