blob: 78b1d81cbe19ab2ae64f40786c0565a5336151d7 [file] [log] [blame]
Kailash22179672019-03-18 20:24:55 -07001# Copyright 2017-present Open Networking Foundation
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15class bbsim_utils(object):
16
Kailash45ab7e92019-06-10 13:12:05 -070017 def generate_subscribers(self, num_subs, rcord_service_id, stag=999, ctag_start=900, pon_id=0):
Kailash22179672019-03-18 20:24:55 -070018 """
19 :param num_subs: Number of subscribers to create
20 :param rcord_service_id: ID of the rcord service
21 :param stag: S_tag of subscriber
22 :param ctag: C_tag of first subscriber (to be incremented by num_subs)
23 :return: List of subscribers to POST
24 """
25 subscribers = []
Kailash39443402019-03-19 13:21:04 -070026 for index in xrange(1, int(num_subs) + 1):
27 sub = {
Kailash45ab7e92019-06-10 13:12:05 -070028 "name" : "Sub_BBSM" + str("00000") + str(pon_id) + '{0:02x}'.format(int(index)),
Kailash39443402019-03-19 13:21:04 -070029 "status" : "pre-provisioned",
Kailash88ead142019-06-26 13:51:09 -070030 "c_tag" : ctag_start + int(index),
Kailash39443402019-03-19 13:21:04 -070031 "s_tag" : stag,
Kailash45ab7e92019-06-10 13:12:05 -070032 "onu_device" : "BBSM" + str("00000") + str(pon_id) + '{0:02x}'.format(int(index)),
33 "circuit_id" : "circuit" + '{0:02x}'.format(int(index)),
34 "remote_id" : "remote" + '{0:02x}'.format(int(index)),
35 "nas_port_id" : "PON 2/1/01/1:1.1." + '{0:0x}'.format(int(index)),
Kailash88ead142019-06-26 13:51:09 -070036 "upstream_bps_id" : 1,
Kailashb022c402019-06-21 12:08:32 -070037 "downstream_bps_id" : 1,
Kailash88ead142019-06-26 13:51:09 -070038 "tech_profile_id" : 64
Kailash39443402019-03-19 13:21:04 -070039 }
40 subscribers.append(sub)
41 if index == 10:
42 break
43 for index in range(11, int(num_subs) + 1):
Kailash22179672019-03-18 20:24:55 -070044 sub = {
Kailash45ab7e92019-06-10 13:12:05 -070045 "name" : "Sub_BBSM" + str("00000") + str(pon_id) + '{0:02x}'.format(int(index)),
Kailash22179672019-03-18 20:24:55 -070046 "status" : "pre-provisioned",
Kailash45ab7e92019-06-10 13:12:05 -070047 "c_tag" : ctag_start + int(index),
Kailash22179672019-03-18 20:24:55 -070048 "s_tag" : stag,
Kailash45ab7e92019-06-10 13:12:05 -070049 "onu_device" : "BBSM" + str("00000") + str(pon_id) + '{0:02x}'.format(int(index)),
50 "circuit_id" : "circuit" + '{0:02x}'.format(int(index)),
51 "remote_id" : "remote" + '{0:02x}'.format(int(index)),
52 "nas_port_id" : "PON 2/1/01/1:1.1." + str(pon_id) + '{0:02x}'.format(int(index)),
Kailashc97c1f52019-03-26 11:31:56 -070053 "upstream_bps_id" : 1,
Kailashb022c402019-06-21 12:08:32 -070054 "downstream_bps_id" : 1,
Kailash88ead142019-06-26 13:51:09 -070055 "tech_profile_id" : 64
Kailash22179672019-03-18 20:24:55 -070056 }
57 subscribers.append(sub)
58 return subscribers
59
Kailash45ab7e92019-06-10 13:12:05 -070060 def generate_whitelists(self, num_onus, att_service_id, pon_id=0):
Kailash22179672019-03-18 20:24:55 -070061 """
62 :param num_onus: Number of ONUs to be added to the whitelist
63 :param att_service_id: ID of the att workflow service
64 :param olt_id: ID of the pon_port
65 :return: List of whitelists to POST
66 """
67 whitelists = []
68 for index in range(1, int(num_onus) + 1):
69 onu = {
Kailash45ab7e92019-06-10 13:12:05 -070070 "serial_number": "BBSM" + str("00000") + str(pon_id) + '{0:02x}'.format(int(index)),
Kailashdc5e78b2019-03-19 09:24:23 -070071 "device_id" : "of:0000626273696d76",
Kailash45ab7e92019-06-10 13:12:05 -070072 "pon_port_id" : 536870912,
Kailash22179672019-03-18 20:24:55 -070073 "owner_id" : att_service_id
74 }
75 whitelists.append(onu)
Kailashb022c402019-06-21 12:08:32 -070076 return whitelists