blob: 008d81fcc42664d817b510d6939fe95a83e3fd5b [file] [log] [blame]
Illyoung Choia9d2c2c2019-07-12 13:29:42 -07001#!/usr/bin/env python3
2
3# Copyright 2019-present Open Networking Foundation
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16
17"""
18Utils
19"""
20
21import string
22import random
23
24
25class NoopLogger(object):
26 def __init__(self):
27 pass
28
29 def info(self, *args):
30 pass
31
32 def debug(self, *args):
33 pass
34
35 def error(self, *args):
36 pass
37
38 def warn(self, *args):
39 pass
40
41
42def get_noop_logger():
43 return NoopLogger()
44
45
46def gen_id(size=6, chars=string.ascii_uppercase + string.digits):
47 return ''.join(random.choice(chars) for _ in range(size))
48
49
50def gen_seq_id():
51 return random.randint(1010, 101010)