blob: 80ff7b45481f84878cb9ef7ee2fc76ccef38ceaf [file] [log] [blame]
Matteo Scandolo4a8b4d62018-03-06 17:18:46 -08001# 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
15import json
16from synchronizers.new_base.SyncInstanceUsingAnsible import SyncStep
17from synchronizers.new_base.modelaccessor import VOLTService
18
19from xosconfig import Config
20from multistructlog import create_logger
21from time import sleep
22import requests
23from requests.auth import HTTPBasicAuth
24
25log = create_logger(Config().get('logging'))
26
27class SyncOLTService(SyncStep):
28 provides = [VOLTService]
Matteo Scandolo4a8b4d62018-03-06 17:18:46 -080029 observes = VOLTService
30
Matteo Scandolo4a8b4d62018-03-06 17:18:46 -080031 def sync_record(self, o):
Luca Preteca974c82018-05-01 18:06:16 -070032 log.info("synching OLT service", object=str(o), **o.tologdict())
Matteo Scandolo4a8b4d62018-03-06 17:18:46 -080033
34 if o.onu_provisioning == "allow_all":
Luca Preteca974c82018-05-01 18:06:16 -070035 # TODO: Tell ONOS to create the ONU device (POST xosapi/v1/volt/onudevices)
Matteo Scandolo4a8b4d62018-03-06 17:18:46 -080036 pass
37 if o.onu_provisioning == "pre_provisioned" or o.onu_provisioning == "oss":
Luca Preteca974c82018-05-01 18:06:16 -070038 # TODO: Tell ONOS to update the ONU device (POST xosapi/v1/volt/onudevices/<id>)
39 # ONOS will need to find the <id>
40 # if onu_provisioning == oss then XOS will need to make a call to the oss server to validate the ONU
Matteo Scandolo4a8b4d62018-03-06 17:18:46 -080041 pass
42
Matteo Scandolo4a8b4d62018-03-06 17:18:46 -080043 def delete_record(self, o):
44 pass