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 |
| 32 | } |
| 33 | |
| 34 | /* |
| 35 | A basic representation of an OLT which fulfills the above interface, |
| 36 | and can be used in other OLT implementations |
| 37 | */ |
| 38 | type SimpleOLT struct { |
| 39 | CLLI string |
| 40 | Hostname string |
| 41 | Address net.TCPAddr |
| 42 | Number int |
| 43 | Ports []PONPort |
| 44 | Parent *Chassis `json:"-"` |
| 45 | DataSwitchPort int |
| 46 | } |
| 47 | |
| 48 | func (s *SimpleOLT) GetCLLI() string { |
| 49 | return s.CLLI |
| 50 | } |
| 51 | |
| 52 | func (s *SimpleOLT) GetHostname() string { |
| 53 | return s.Hostname |
| 54 | } |
| 55 | |
| 56 | func (s *SimpleOLT) GetAddress() net.TCPAddr { |
| 57 | return s.Address |
| 58 | } |
| 59 | |
| 60 | func (s *SimpleOLT) GetNumber() int { |
| 61 | return s.Number |
| 62 | } |
| 63 | |
| 64 | func (s *SimpleOLT) GetPorts() []PONPort { |
| 65 | return s.Ports |
| 66 | } |
| 67 | |
| 68 | func (s *SimpleOLT) GetParent() *Chassis { |
| 69 | return s.Parent |
| 70 | } |
| 71 | |
| 72 | func (s *SimpleOLT) GetDataSwitchPort() int { |
| 73 | return s.DataSwitchPort |
| 74 | } |