blob: 3facb51bcc8f6899916697effa4dd5f9ada85903 [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
Zack Williamsc6722d52020-01-13 16:34:33 -070015from __future__ import absolute_import
Kailash22179672019-03-18 20:24:55 -070016
Zack Williamsc6722d52020-01-13 16:34:33 -070017from six.moves import range
18
19
20class bbsim_utils(object):
21 def generate_subscribers(
22 self, num_subs, rcord_service_id, stag=999, ctag_start=900, pon_id=0
23 ):
Kailash22179672019-03-18 20:24:55 -070024 """
25 :param num_subs: Number of subscribers to create
26 :param rcord_service_id: ID of the rcord service
27 :param stag: S_tag of subscriber
28 :param ctag: C_tag of first subscriber (to be incremented by num_subs)
29 :return: List of subscribers to POST
30 """
31 subscribers = []
Zack Williamsc6722d52020-01-13 16:34:33 -070032 for index in range(1, int(num_subs) + 1):
Kailash39443402019-03-19 13:21:04 -070033 sub = {
Zack Williamsc6722d52020-01-13 16:34:33 -070034 "name": "Sub_BBSM"
35 + str("00000")
36 + str(pon_id)
37 + "{0:02x}".format(int(index)),
38 "status": "pre-provisioned",
39 "c_tag": ctag_start + int(index),
40 "s_tag": stag,
41 "onu_device": "BBSM"
42 + str("00000")
43 + str(pon_id)
44 + "{0:02x}".format(int(index)),
45 "circuit_id": "circuit" + "{0:02x}".format(int(index)),
46 "remote_id": "remote" + "{0:02x}".format(int(index)),
47 "nas_port_id": "PON 2/1/01/1:1.1." + "{0:0x}".format(int(index)),
48 "upstream_bps_id": 1,
49 "downstream_bps_id": 1,
50 "tech_profile_id": 64,
Kailash39443402019-03-19 13:21:04 -070051 }
52 subscribers.append(sub)
53 if index == 10:
54 break
55 for index in range(11, int(num_subs) + 1):
Kailash22179672019-03-18 20:24:55 -070056 sub = {
Zack Williamsc6722d52020-01-13 16:34:33 -070057 "name": "Sub_BBSM"
58 + str("00000")
59 + str(pon_id)
60 + "{0:02x}".format(int(index)),
61 "status": "pre-provisioned",
62 "c_tag": ctag_start + int(index),
63 "s_tag": stag,
64 "onu_device": "BBSM"
65 + str("00000")
66 + str(pon_id)
67 + "{0:02x}".format(int(index)),
68 "circuit_id": "circuit" + "{0:02x}".format(int(index)),
69 "remote_id": "remote" + "{0:02x}".format(int(index)),
70 "nas_port_id": "PON 2/1/01/1:1.1."
71 + str(pon_id)
72 + "{0:02x}".format(int(index)),
73 "upstream_bps_id": 1,
74 "downstream_bps_id": 1,
75 "tech_profile_id": 64,
Kailash22179672019-03-18 20:24:55 -070076 }
77 subscribers.append(sub)
78 return subscribers
79
Kailash45ab7e92019-06-10 13:12:05 -070080 def generate_whitelists(self, num_onus, att_service_id, pon_id=0):
Kailash22179672019-03-18 20:24:55 -070081 """
82 :param num_onus: Number of ONUs to be added to the whitelist
83 :param att_service_id: ID of the att workflow service
84 :param olt_id: ID of the pon_port
85 :return: List of whitelists to POST
86 """
87 whitelists = []
88 for index in range(1, int(num_onus) + 1):
89 onu = {
Zack Williamsc6722d52020-01-13 16:34:33 -070090 "serial_number": "BBSM"
91 + str("00000")
92 + str(pon_id)
93 + "{0:02x}".format(int(index)),
94 "device_id": "of:0000626273696d76",
95 "pon_port_id": 536870912,
96 "owner_id": att_service_id,
Kailash22179672019-03-18 20:24:55 -070097 }
98 whitelists.append(onu)
Kailashb022c402019-06-21 12:08:32 -070099 return whitelists