Author Name | a594e63 | 2018-08-10 11:33:58 -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 | |
| 17 | package physical |
| 18 | |
| 19 | import "net" |
| 20 | |
| 21 | /* |
| 22 | Represents an arbitrary OLT linecard |
| 23 | */ |
| 24 | type OLT interface { |
| 25 | GetCLLI() string |
| 26 | GetHostname() string |
| 27 | GetAddress() net.TCPAddr |
| 28 | GetNumber() int |
| 29 | GetPorts() []PONPort |
| 30 | GetParent() *Chassis |
| 31 | GetDataSwitchPort() int |
donNewtonAlpha | 8205a4d | 2018-08-16 18:27:20 -0400 | [diff] [blame] | 32 | activate() error |
Author Name | a594e63 | 2018-08-10 11:33:58 -0400 | [diff] [blame] | 33 | } |
| 34 | |
| 35 | /* |
| 36 | A basic representation of an OLT which fulfills the above interface, |
| 37 | and can be used in other OLT implementations |
| 38 | */ |
| 39 | type SimpleOLT struct { |
| 40 | CLLI string |
| 41 | Hostname string |
| 42 | Address net.TCPAddr |
| 43 | Number int |
| 44 | Ports []PONPort |
donNewtonAlpha | 5234b13 | 2018-08-16 14:12:28 -0400 | [diff] [blame] | 45 | Active bool |
Author Name | a594e63 | 2018-08-10 11:33:58 -0400 | [diff] [blame] | 46 | Parent *Chassis `json:"-"` |
| 47 | DataSwitchPort int |
| 48 | } |
| 49 | |
| 50 | func (s *SimpleOLT) GetCLLI() string { |
| 51 | return s.CLLI |
| 52 | } |
| 53 | |
| 54 | func (s *SimpleOLT) GetHostname() string { |
| 55 | return s.Hostname |
| 56 | } |
| 57 | |
| 58 | func (s *SimpleOLT) GetAddress() net.TCPAddr { |
| 59 | return s.Address |
| 60 | } |
| 61 | |
| 62 | func (s *SimpleOLT) GetNumber() int { |
| 63 | return s.Number |
| 64 | } |
| 65 | |
| 66 | func (s *SimpleOLT) GetPorts() []PONPort { |
| 67 | return s.Ports |
| 68 | } |
| 69 | |
| 70 | func (s *SimpleOLT) GetParent() *Chassis { |
| 71 | return s.Parent |
| 72 | } |
| 73 | |
| 74 | func (s *SimpleOLT) GetDataSwitchPort() int { |
| 75 | return s.DataSwitchPort |
| 76 | } |
donNewtonAlpha | 8205a4d | 2018-08-16 18:27:20 -0400 | [diff] [blame] | 77 | func (s *SimpleOLT) activate() error { |
| 78 | s.Active = true |
| 79 | //TODO make call to XOS to activate phyiscal OLT |
| 80 | return nil |
| 81 | } |