Implemented the provision / activate ont workflow

Change-Id: Ife684f41e54e176879332922ad86f517358f15e7
diff --git a/api/handler.go b/api/handler.go
index 7414e19..4aeae13 100644
--- a/api/handler.go
+++ b/api/handler.go
@@ -17,6 +17,7 @@
 package api
 
 import (
+	"errors"
 	"fmt"
 	"log"
 	"net"
@@ -47,7 +48,7 @@
 		return &AddChassisReturn{DeviceID: chassis.CLLI}, nil
 	}
 	abstractChassis := abstract.GenerateChassis(clli)
-	phyChassis := &physical.Chassis{CLLI: clli}
+	phyChassis := &physical.Chassis{CLLI: clli, VCoreAddress: net.TCPAddr{IP: net.ParseIP(in.GetVCoreIP()), Port: int(in.GetVCorePort())}}
 	if settings.GetDebug() {
 		output := fmt.Sprintf("%v", abstractChassis)
 		formatted := strings.Replace(output, "{", "\n{", -1)
@@ -71,7 +72,7 @@
 	}
 	oltType := in.GetType()
 	address := net.TCPAddr{IP: net.ParseIP(in.GetSlotIP()), Port: int(in.GetSlotPort())}
-	sOlt := physical.SimpleOLT{CLLI: clli, Hostname: in.GetHostname(), Address: address}
+	sOlt := physical.SimpleOLT{CLLI: clli, Hostname: in.GetHostname(), Address: address, Parent: chassis}
 
 	var olt physical.OLT
 	switch oltType {
@@ -95,7 +96,7 @@
 in the physical card to those in the abstract model
 */
 func AddCard(physChassis *physical.Chassis, olt physical.OLT) error {
-	physChassis.Linecards = append(physChassis.Linecards, olt)
+	physChassis.AddOLTChassis(olt)
 
 	ports := olt.GetPorts()
 	absChassis := (*models.GetAbstractChassisMap())[physChassis.CLLI]
@@ -105,7 +106,28 @@
 		absPort.PhysPort = &ports[i]
 		//AssignTraits(&ports[i], absPort)
 	}
-
 	//should probably worry about error at some point
 	return nil
 }
+
+/*
+EnableSlot - activates an OLT Chassis
+*/
+func (s *Server) EnableSlot(ctx context.Context, in *ActivateSlotMessage) (*ActivateSlotReturn, error) {
+	return nil, errors.New("garbage error")
+}
+
+/*
+ProvisionOnt provisions an ONT on a specific Chassis/LineCard/Port
+*/
+func (s *Server) ProvisionOnt(ctx context.Context, in *AddOntMessage) (*AddOntReturn, error) {
+	absChassisMap := models.GetAbstractChassisMap()
+	clli := in.GetCLLI()
+	chassis := (*absChassisMap)[clli]
+	err := chassis.ActivateONT(int(in.GetSlotNumber()), int(in.GetPortNumber()), int(in.GetPortNumber()), in.GetSerialNumber())
+
+	if err != nil {
+		return nil, err
+	}
+	return &AddOntReturn{Success: true}, nil
+}