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.vpnservice.itm.cli;
11 import java.math.BigInteger;
12 import java.util.ArrayList;
13 import java.util.List;
15 import org.apache.commons.lang3.StringUtils;
17 import com.google.common.base.Preconditions;
20 * The Utility class for ITM CLI.
22 public final class ItmCliUtils {
25 * Construct dpn id list.
31 public static List<BigInteger> constructDpnIdList(final String dpnIds) {
32 final List<BigInteger> lstDpnIds = new ArrayList<>();
33 if (StringUtils.isNotBlank(dpnIds)) {
34 final String[] arrDpnIds = StringUtils.split(dpnIds, ',');
35 for (String dpn : arrDpnIds) {
36 if (StringUtils.isNumeric(StringUtils.trim(dpn))) {
37 lstDpnIds.add(new BigInteger(StringUtils.trim(dpn)));
39 Preconditions.checkArgument(false, String.format("DPN ID [%s] is not a numeric value.", dpn));