2 * Copyright (c) 2016 Ericsson India Global Services Pvt Ltd. 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.genius.itm.cli;
11 import com.google.common.base.Preconditions;
12 import java.math.BigInteger;
13 import java.util.ArrayList;
14 import java.util.List;
15 import org.apache.commons.lang3.StringUtils;
18 * The Utility class for ITM CLI.
20 public final class ItmCliUtils {
21 private ItmCliUtils() {
26 * Construct dpn id list.
32 public static List<BigInteger> constructDpnIdList(final String dpnIds) {
33 final List<BigInteger> lstDpnIds = new ArrayList<>();
34 if (StringUtils.isNotBlank(dpnIds)) {
35 final String[] arrDpnIds = StringUtils.split(dpnIds, ',');
36 for (String dpn : arrDpnIds) {
37 String trimmedDpn = StringUtils.trim(dpn);
38 Preconditions.checkArgument(StringUtils.isNumeric(trimmedDpn),
39 "DPN ID [" + dpn + "] is not a numeric value.");
40 lstDpnIds.add(new BigInteger(trimmedDpn));