Adding PROX(Packet pROcessing eXecution engine) VNF to sampleVNF
[samplevnf.git] / VNFs / DPPD-PROX / config / user_table-65K-bng.lua
1 --
2 -- Copyright (c) 2010-2017 Intel Corporation
3 --
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
7 --
8 --     http://www.apache.org/licenses/LICENSE-2.0
9 --
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.
15 --
16
17 -- This script generates a user table containing 65536 users. It is
18 -- meant to be used in a BNG with 2 CPE facing ports. Each of the CPE
19 -- facing ports has 32768 users behind it. Each user has a unique
20 -- svlan/cvlan combination. The only difference between the two sets
21 -- of users is the svlan id. Note that any arbitrary configuration is
22 -- possible.
23
24 local user_table = {}
25
26 for i = 1,2^15 do
27    idx = i - 1
28    user_table[i] = {
29       gre_id   = idx,
30       -- svlan_id is 000000000XXXXXXX at the bit level
31       -- cvlan_id is 0000XXXX00XX00XX at the bit level
32       svlan_id = mask(idx, 0x7f00) / 2^8,
33       cvlan_id = mask(idx, 0xf0) * 2^4 + mask(idx, 0xc) * 2^2 + mask(idx, 0x3),
34       user_id  = idx,
35    }
36 end
37
38 for i = 1,2^15 do
39    idx = i - 1
40    user_table[2^15 + i] = {
41       gre_id   = 2^15 + idx,
42       -- svlan_id is 000000001XXXXXXX at the bit level
43       -- cvlan_id is 0000XXXX00XX00XX at the bit level
44       svlan_id = mask(idx, 0x7f00) / 2^8 + 0x80,
45       cvlan_id = mask(idx, 0xf0) * 2^4 + mask(idx, 0xc) * 2^2 + mask(idx, 0x3),
46       user_id  = idx,
47    }
48 end
49
50 return user_table