2 * Copyright (c) 2024 Smartoptics 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.transportpce.pce.networkanalyzer.port;
14 public class ClientPreference implements Preference {
16 Map<String, Set<String>> nodePortPreference;
18 public ClientPreference(Map<String, Set<String>> nodePortPreference) {
19 this.nodePortPreference = nodePortPreference;
23 public boolean isPreferredPort(String node, String portName) {
25 //If there is no preferred port registered for the node, it means
26 //the client has no preference regarding the node.
27 //Therefore, we'll treat the node as it was preferred to
28 //prevent it from NOT being used.
29 return !nodePortPreference.containsKey(node) || nodePortPreference.get(node).contains(portName);