2 * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.groupbasedpolicy.neutron.mapper.util;
11 import com.google.common.base.Optional;
12 import javax.annotation.Nullable;
13 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l3.rev150712.routers.attributes.Routers;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l3.rev150712.routers.attributes.routers.Router;
17 public final class RouterUtils {
18 private RouterUtils() {
21 public static Optional<Router> findRouter(Uuid uuid, @Nullable Routers routers) {
22 if (routers == null || routers.getRouter() == null) {
23 return Optional.absent();
25 for (Router router : routers.getRouter()) {
26 if (router.getUuid().equals(uuid)) {
27 return Optional.of(router);
30 return Optional.absent();