2 * Copyright (c) 2015 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.openflowplugin.impl.util;
11 import java.util.concurrent.atomic.AtomicInteger;
12 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId;
13 import org.slf4j.Logger;
14 import org.slf4j.LoggerFactory;
17 * Created by Martin Bobak <mbobak@cisco.com> on 8.4.2015.
19 public final class FlowUtil {
21 private static final String ALIEN_SYSTEM_FLOW_ID = "#UF$TABLE*";
22 private static final AtomicInteger unaccountedFlowsCounter = new AtomicInteger(0);
23 private static final Logger LOG = LoggerFactory.getLogger(FlowUtil.class);
27 throw new IllegalStateException("This class should not be instantiated.");
30 public static FlowId createAlienFlowId(final short tableId) {
31 final StringBuilder sBuilder = new StringBuilder(ALIEN_SYSTEM_FLOW_ID)
32 .append(tableId).append('-').append(unaccountedFlowsCounter.incrementAndGet());
33 String alienId = sBuilder.toString();
34 return new FlowId(alienId);