2 * Copyright (c) 2016 Cisco and/or its affiliates.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at:
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package io.fd.honeycomb.translate.vpp.util;
19 import java.util.List;
20 import javax.annotation.Nonnegative;
21 import javax.annotation.Nullable;
22 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.Tags;
23 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.base.attributes.tags.Tag;
25 public final class SubInterfaceUtils {
27 private SubInterfaceUtils() {
28 throw new UnsupportedOperationException("Utility class cannot be instantiated.");
31 public static String getSubInterfaceName(final String superIfName, final int subIfaceId) {
32 return String.format("%s.%d", superIfName, subIfaceId);
36 * Returns number of sub-interface tags.
38 * @param tags data object that represents sub-interface tags
39 * @return number of sub interface tags
42 public static int getNumberOfTags(@Nullable final Tags tags) {
46 final List<Tag> tagList = tags.getTag();
47 if (tagList == null) {
50 return tagList.size();