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