Cleanup
Change-Id: Iceb908751e93e7d42de5f06942092599b1a5509d
diff --git a/internal/bbsim/devices/pon.go b/internal/bbsim/devices/pon.go
new file mode 100644
index 0000000..0e67e51
--- /dev/null
+++ b/internal/bbsim/devices/pon.go
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+
+ * http://www.apache.org/licenses/LICENSE-2.0
+
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package devices
+
+import (
+ "bytes"
+ "errors"
+ "fmt"
+ "github.com/looplab/fsm"
+ "github.com/opencord/voltha-protos/go/openolt"
+)
+
+type PonPort struct {
+ // BBSIM Internals
+ ID uint32
+ NumOnu int
+ Onus []Onu
+ Olt OltDevice
+
+ // PON Attributes
+ OperState *fsm.FSM
+ Type string
+
+ // NOTE do we need a state machine for the PON Ports?
+}
+
+func (p PonPort) getOnuBySn(sn *openolt.SerialNumber) (*Onu, error) {
+ for _, onu := range p.Onus {
+ if bytes.Equal(onu.SerialNumber.VendorSpecific, sn.VendorSpecific) {
+ return &onu, nil
+ }
+ }
+ return nil, errors.New(fmt.Sprintf("Cannot find Onu with serial number %d in PonPort %d", sn, p.ID))
+}
+
+func (p PonPort) getOnuById(id uint32) (*Onu, error) {
+ for _, onu := range p.Onus {
+ if onu.ID == id {
+ return &onu, nil
+ }
+ }
+ return nil, errors.New(fmt.Sprintf("Cannot find Onu with id %d in PonPort %d", id, p.ID))
+}