outsource flexgrid constants import in functests
[transportpce.git] / tests / transportpce_tests / common / flexgrid_utils.py
1 #!/usr/bin/env python
2
3 ##############################################################################
4 # Copyright (c) 2020 Orange, Inc. and others.  All rights reserved.
5 #
6 # All rights reserved. This program and the accompanying materials
7 # are made available under the terms of the Apache License, Version 2.0
8 # which accompanies this distribution, and is available at
9 # http://www.apache.org/licenses/LICENSE-2.0
10 ##############################################################################
11
12 # pylint: disable=no-member
13
14 import base64
15
16 def check_freq_map(freq_map):
17     freq_map_array = [int(x) for x in freq_map]
18     return freq_map_array[0] == 255 and freq_map_array[1] == 255
19
20
21 def set_used_index_for_freq_map(freq_map, index):
22     freq_map[index] = 0
23     return freq_map
24
25
26 INDEX_1_USED_FREQ_MAP = base64.b64encode(set_used_index_for_freq_map(bytearray(b'\xFF' * 96), 0)).decode('UTF-8')
27
28 INDEX_1_2_USED_FREQ_MAP = base64.b64encode(set_used_index_for_freq_map(
29     set_used_index_for_freq_map(bytearray(b'\xFF' * 96), 0), 1)).decode('utf-8')
30
31 AVAILABLE_FREQ_MAP = base64.b64encode(bytearray(b'\xFF' * 96)).decode('UTF-8')