Don Newton | e973d34 | 2018-10-26 16:44:12 -0400 | [diff] [blame] | 1 | /* |
| 2 | Copyright 2017 the original author or authors. |
| 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 | package impl |
| 17 | |
| 18 | import "gerrit.opencord.org/abstract-olt/models" |
| 19 | |
| 20 | /* |
| 21 | Reflow - takes internal config and resends to xos |
| 22 | */ |
| 23 | func Reflow() (bool, error) { |
| 24 | myChan := getSyncChannel() |
| 25 | <-myChan |
| 26 | defer done(myChan, true) |
| 27 | chassisMap := models.GetChassisMap() |
| 28 | for _, chassisHolder := range *chassisMap { |
| 29 | physical := chassisHolder.PhysicalChassis |
| 30 | for index := range physical.Linecards { |
| 31 | olt := physical.Linecards[index] |
| 32 | physical.SendOltTosca(olt) |
| 33 | for portIndex := range olt.Ports { |
| 34 | port := olt.Ports[portIndex] |
| 35 | for ontIndex := range port.Onts { |
| 36 | ont := port.Onts[ontIndex] |
| 37 | if ont.Active { |
| 38 | physical.SendOntTosca(ont) |
| 39 | physical.SendSubscriberTosca(ont) |
| 40 | |
| 41 | } |
| 42 | |
| 43 | } |
| 44 | |
| 45 | } |
| 46 | } |
| 47 | } |
| 48 | return true, nil |
| 49 | //TODO lots of this could throw errors |
| 50 | } |