Hi,
If I know the fixed IP, what is efficient way of getting the port which is
associated with this IP, using neutron api?
Currently I am doing like below, but it is not efficient.
- List all the ports using port API
- go through each port and get all fixed IPs
- go through each fixed IP and check whether it is equal to my fixed IP.
List<Port> ports = api.list().concat().toList();
for (Iterator<Port> iterator = ports.iterator();
iterator.hasNext();) {
Port port = (Port) iterator.next();
for (IP ip : port.getFixedIps()) {
if (ip.getIpAddress().equals(myFixedIP)) {
// so this "port" is what I am searching
}
}
}
Is there any efficient way to do this?
Thanks.
--
Rajkumar Rajaratnam
Committer & PMC Member, Apache Stratos
Software Engineer, WSO2