Implemented the provision / activate ont workflow
Change-Id: Ife684f41e54e176879332922ad86f517358f15e7
diff --git a/models/physical/chassis.go b/models/physical/chassis.go
index 339a610..3f050aa 100644
--- a/models/physical/chassis.go
+++ b/models/physical/chassis.go
@@ -16,7 +16,10 @@
package physical
-import "net"
+import (
+ "fmt"
+ "net"
+)
/*
Chassis is a model that takes up to 16 discreet OLT chassis as if it is a 16 slot OLT chassis
@@ -27,3 +30,16 @@
Dataswitch DataSwitch
Linecards []OLT
}
+
+/*
+AddOLTChassis - adds a reference to a new olt chassis
+*/
+func (chassis *Chassis) AddOLTChassis(olt OLT) {
+ chassis.Linecards = append(chassis.Linecards, olt)
+ //TODO - api call to add olt i.e. preprovision_olt
+ fmt.Printf("chassis.AddOLTChassis(%s)\n", olt.GetHostname())
+}
+func (chassis *Chassis) provisionONT(ont Ont) {
+ //TODO - api call to provison s/c vlans and ont serial number etc
+ fmt.Printf("chassis.provisionONT(%s,SVlan:%d,CVlan:%d)\n", ont.SerialNumber, ont.Svlan, ont.Cvlan)
+}
diff --git a/models/physical/edgecore.go b/models/physical/edgecore.go
index 196d44e..cded2dc 100644
--- a/models/physical/edgecore.go
+++ b/models/physical/edgecore.go
@@ -29,6 +29,9 @@
func CreateEdgecore(olt *SimpleOLT) *Edgecore {
var newPorts [16]PONPort
edge := Edgecore{SimpleOLT: *olt}
+ for i := 0; i < 16; i++ {
+ newPorts[i].Parent = &edge
+ }
edge.Ports = newPorts[:]
return &edge
}
diff --git a/models/physical/olt.go b/models/physical/olt.go
index 3c2094d..beffec8 100644
--- a/models/physical/olt.go
+++ b/models/physical/olt.go
@@ -41,6 +41,7 @@
Address net.TCPAddr
Number int
Ports []PONPort
+ Active bool
Parent *Chassis `json:"-"`
DataSwitchPort int
}
diff --git a/models/physical/ont.go b/models/physical/ont.go
index 4bd47ac..4a9ca89 100644
--- a/models/physical/ont.go
+++ b/models/physical/ont.go
@@ -20,8 +20,9 @@
Ont represents a single ont/onu connect to a splitter on a Port
*/
type Ont struct {
- Number int
- Svlan int
- Cvlan int
- Parent *PONPort `json:"-"`
+ Number int
+ Svlan int
+ Cvlan int
+ SerialNumber string
+ Parent *PONPort `json:"-"`
}
diff --git a/models/physical/ponport.go b/models/physical/ponport.go
index 99c282a..e17a07e 100644
--- a/models/physical/ponport.go
+++ b/models/physical/ponport.go
@@ -17,7 +17,7 @@
package physical
/*
-Port represents a single PON port on the OLT chassis
+PONPort represents a single PON port on the OLT chassis
*/
type PONPort struct {
Number int
@@ -25,3 +25,10 @@
Onts [64]Ont
Parent *Edgecore `json:"-"`
}
+
+func (port *PONPort) ActivateOnt(number int, sVlan int, cVlan int, serialNumber string) {
+ ont := Ont{Number: number, Svlan: sVlan, Cvlan: cVlan, SerialNumber: serialNumber, Parent: port}
+ port.Onts[number-1] = ont
+ port.Parent.Parent.provisionONT(ont)
+
+}