SEBA-122
bin/client is now cmdline app, tosca is sent to xos

Change-Id: I7bbf59569b5c96062aa1c7681708a4cf39532ae2
diff --git a/api/abstract_olt_api.proto b/api/abstract_olt_api.proto
index 72dad9b..6da61c8 100644
--- a/api/abstract_olt_api.proto
+++ b/api/abstract_olt_api.proto
@@ -20,6 +20,8 @@
    string CLLI =1;
    string VCoreIP =2;
    int32 VCorePort=3;
+   int32 Rack=4;
+   int32 Shelf=5;
 }
 message AddChassisReturn{
    string DeviceID = 1;
@@ -32,7 +34,7 @@
    fixed32 NumPorts = 5;
    bool Activate = 6;
    enum OltDriver {
-      openoltDriver = 0;
+      openoltDriver= 0;
       asfvolt16Driver=1;
       adtranDriver=2;
       tibitsDriver=3;
diff --git a/api/handler.go b/api/handler.go
index 6beba76..bb1a9b3 100644
--- a/api/handler.go
+++ b/api/handler.go
@@ -17,6 +17,7 @@
 package api
 
 import (
+	"errors"
 	"fmt"
 	"log"
 	"net"
@@ -46,8 +47,8 @@
 	if chassis != nil {
 		return &AddChassisReturn{DeviceID: chassis.CLLI}, nil
 	}
-	abstractChassis := abstract.GenerateChassis(clli)
-	phyChassis := &physical.Chassis{CLLI: clli, VCoreAddress: net.TCPAddr{IP: net.ParseIP(in.GetVCoreIP()), Port: int(in.GetVCorePort())}}
+	abstractChassis := abstract.GenerateChassis(clli, int(in.GetRack()), int(in.GetShelf()))
+	phyChassis := &physical.Chassis{CLLI: clli, VCoreAddress: net.TCPAddr{IP: net.ParseIP(in.GetVCoreIP()), Port: int(in.GetVCorePort())}, Rack: int(in.GetRack()), Shelf: int(in.GetShelf())}
 	if settings.GetDebug() {
 		output := fmt.Sprintf("%v", abstractChassis)
 		formatted := strings.Replace(output, "{", "\n{", -1)
@@ -68,6 +69,8 @@
 	clli := in.GetCLLI()
 	chassis := (*phyChassisMap)[clli]
 	if chassis == nil {
+		errString := fmt.Sprintf("There is no chassis with CLLI of %s", clli)
+		return &AddOLTChassisReturn{DeviceID: "", ChassisDeviceID: ""}, errors.New(errString)
 	}
 	oltType := in.GetType()
 	address := net.TCPAddr{IP: net.ParseIP(in.GetSlotIP()), Port: int(in.GetSlotPort())}
@@ -80,12 +83,10 @@
 	case AddOLTChassisMessage_adtran:
 	case AddOLTChassisMessage_tibit:
 	}
-
 	err := AddCard(chassis, olt)
 	if err != nil {
 		//TODO do something
 	}
-
 	return &AddOLTChassisReturn{DeviceID: in.GetHostname(), ChassisDeviceID: clli}, nil
 
 }
@@ -102,6 +103,7 @@
 
 	for i := 0; i < len(ports); i++ {
 		absPort, _ := absChassis.NextPort()
+
 		absPort.PhysPort = &ports[i]
 		//AssignTraits(&ports[i], absPort)
 	}
@@ -116,6 +118,10 @@
 	absChassisMap := models.GetAbstractChassisMap()
 	clli := in.GetCLLI()
 	chassis := (*absChassisMap)[clli]
+	if chassis == nil {
+		errString := fmt.Sprintf("There is no chassis with CLLI of %s", clli)
+		return &AddOntReturn{Success: false}, errors.New(errString)
+	}
 	err := chassis.ActivateONT(int(in.GetSlotNumber()), int(in.GetPortNumber()), int(in.GetOntNumber()), in.GetSerialNumber())
 
 	if err != nil {
diff --git a/api/handler_test.go b/api/handler_test.go
deleted file mode 100644
index 59aad10..0000000
--- a/api/handler_test.go
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- Copyright 2017 the original author or authors.
-
- 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 api_test
-
-import (
-	"fmt"
-	"testing"
-
-	"gerrit.opencord.org/abstract-olt/api"
-	"gerrit.opencord.org/abstract-olt/models/abstract"
-	"gerrit.opencord.org/abstract-olt/models/physical"
-	"golang.org/x/net/context"
-)
-
-var clli string
-var slotHostname = "SlotOne"
-var ctx context.Context
-var server api.Server
-
-func TestHandler_CreateChassis(t *testing.T) {
-	fmt.Println("in handlerTest_CreateChassis")
-	ctx = context.Background()
-	server = api.Server{}
-	message := &api.AddChassisMessage{CLLI: "my cilli", VCoreIP: "192.168.0.1", VCorePort: 9191}
-	ret, err := server.CreateChassis(ctx, message)
-	if err != nil {
-		t.Fatalf("CreateChassis failed %v\n", err)
-	}
-	clli = ret.DeviceID
-}
-func TestHandler_CreateOLTChassis(t *testing.T) {
-	fmt.Println("in handlerTest_CreateOltChassis")
-	message := &api.AddOLTChassisMessage{CLLI: clli, SlotIP: "12.2.2.0", SlotPort: 9191,
-		Hostname: slotHostname, Type: api.AddOLTChassisMessage_edgecore}
-	ret, err := server.CreateOLTChassis(ctx, message)
-	if err != nil {
-		t.Fatalf("CreateOLTChassis failed %v\n", err)
-	}
-	fmt.Printf("CreateOLTChassis success %v\n", ret)
-}
-func TestHandler_ProvisionOnt(t *testing.T) {
-	ctx = context.Background()
-	server = api.Server{}
-	fmt.Println("in handlerTest_ProvisonOnt")
-	// this one should succeed
-	message := &api.AddOntMessage{CLLI: clli, SlotNumber: 1, PortNumber: 3, OntNumber: 2, SerialNumber: "2033029402"}
-	ret, err := server.ProvisionOnt(ctx, message)
-	if err != nil {
-		t.Fatalf("ProvisionOnt failed %v\n", err)
-	}
-	// do it again on same ont/port should fail with AllReadyActiveError
-	ret, err = server.ProvisionOnt(ctx, message)
-	if err != nil {
-		switch err.(type) {
-		case *physical.AllReadyActiveError:
-			fmt.Printf("ProvisionOnt failed as it should with %v\n", err)
-		default:
-			t.Fatalf("ProvsionOnt test failed with %v\n", err)
-		}
-
-	} else {
-		t.Fatalf("ProvsionOnt should have failed with AllReadyActiveError but didn't")
-	}
-
-	// this one should fail
-	//SlotNumber 1 hasn't been provisioned
-	message = &api.AddOntMessage{CLLI: clli, SlotNumber: 2, PortNumber: 3, OntNumber: 2, SerialNumber: "2033029402"}
-	ret, err = server.ProvisionOnt(ctx, message)
-	if err != nil {
-		switch err.(type) {
-		case *abstract.UnprovisonedPortError:
-			fmt.Printf("ProvisionOnt failed as it should with %v\n", err)
-		default:
-			t.Fatalf("ProvsionOnt test failed with %v\n", err)
-		}
-	} else {
-		t.Fatalf("ProvsionOnt should have failed but didn't")
-	}
-	fmt.Printf("ProvisionOnt success %v\n", ret)
-}
-func TestHandler_DeleteOnt(t *testing.T) {
-	ctx = context.Background()
-	server = api.Server{}
-	fmt.Println("in handlerTest_DeleteOnt")
-	// this one should succeed
-	//De-Activate ONT 3 on PONPort 0 Slot 0 on my cilli but not active
-	message := &api.DeleteOntMessage{CLLI: clli, SlotNumber: 1, PortNumber: 3, OntNumber: 2, SerialNumber: "2033029402"}
-	ret, err := server.DeleteOnt(ctx, message)
-	if err != nil {
-		t.Fatalf("DeleteOnt failed %v\n", err)
-	}
-	// This should fail with AllReadyDeactivatedError
-	ret, err = server.DeleteOnt(ctx, message)
-	if err != nil {
-		switch err.(type) {
-		case *physical.AllReadyDeactivatedError:
-			fmt.Printf("DeleteOnt failed as expected with %v\n", err)
-		default:
-			t.Fatalf("DeleteOnt failed with %v\n", err)
-		}
-	} else {
-		t.Fatal("DeleteOnt should have failed with AllReadyDeactivatedError")
-	}
-
-	// this one should fail
-	//SlotNumber 1 hasn't been provisioned
-	message = &api.DeleteOntMessage{CLLI: clli, SlotNumber: 2, PortNumber: 3, OntNumber: 2, SerialNumber: "2033029402"}
-	ret, err = server.DeleteOnt(ctx, message)
-	if err != nil {
-		switch err.(type) {
-		case *abstract.UnprovisonedPortError:
-			fmt.Printf("DeleteOnt failed as it should with %v\n", err)
-		default:
-			t.Fatalf("DeleteOnt test failed with %v\n", err)
-		}
-	} else {
-		t.Fatalf("DeleteOnt should have failed but didn't")
-	}
-	fmt.Printf("DeletenOnt success %v\n", ret)
-}
diff --git a/client/main.go b/client/main.go
index 94cd1e5..884274b 100644
--- a/client/main.go
+++ b/client/main.go
@@ -17,16 +17,77 @@
 package main
 
 import (
+	"context"
+	"flag"
+	"fmt"
 	"log"
-
 	"runtime/debug"
 
 	"gerrit.opencord.org/abstract-olt/api"
-	"golang.org/x/net/context"
 	"google.golang.org/grpc"
 	"google.golang.org/grpc/credentials"
 )
 
+func main() {
+	create := flag.Bool("c", false, "create?")
+	addOlt := flag.Bool("s", false, "addOlt?")
+	provOnt := flag.Bool("o", false, "provisionOnt?")
+	clli := flag.String("clli", "", "clli of abstract chassis")
+	xosAddress := flag.String("xos_address", "", "xos address")
+	xosPort := flag.Uint("xos_port", 0, "xos port")
+	rack := flag.Uint("rack", 1, "rack number for chassis")
+	shelf := flag.Uint("shelf", 1, "shelf number for chassis")
+	oltAddress := flag.String("olt_address", "", "ip address for olt chassis")
+	oltPort := flag.Uint("olt_port", 0, "listen port for olt chassis")
+	name := flag.String("name", "", "friendly name for olt chassis")
+	driver := flag.String("driver", "", "driver to use with olt chassis")
+	oltType := flag.String("type", "", "olt chassis type")
+	slot := flag.Uint("slot", 1, "slot number 1-16 to provision ont to")
+	port := flag.Uint("port", 1, "port number 1-16 to provision ont to")
+	ont := flag.Uint("ont", 1, "ont number 1-64")
+	serial := flag.String("serial", "", "serial number of ont")
+
+	flag.Parse()
+
+	if (*create && *addOlt) || (*create && *provOnt) || (*addOlt && *provOnt) {
+		fmt.Println("You can only call one method at a time")
+		usage()
+		return
+	}
+	if !(*create || *provOnt || *addOlt) {
+		fmt.Println("You didn't specify an operation to perform")
+		usage()
+		return
+	}
+	var conn *grpc.ClientConn
+	creds, err := credentials.NewClientTLSFromFile("cert/server.crt", "AbstractOLT.dev.atl.foundry.att.com")
+	if err != nil {
+		log.Fatalf("could not load tls cert: %s", err)
+	}
+	// Setup the login/pass
+	auth := Authentication{
+		Login:    "john",
+		Password: "doe",
+	}
+	conn, err = grpc.Dial(":7777", grpc.WithTransportCredentials(creds), grpc.WithPerRPCCredentials(&auth))
+	if err != nil {
+		log.Fatalf("did not connect: %s", err)
+	}
+	defer conn.Close()
+
+	c := api.NewAbstractOLTClient(conn)
+	if *create {
+		createChassis(c, clli, xosAddress, xosPort, rack, shelf)
+	} else if *addOlt {
+		addOltChassis(c, clli, oltAddress, oltPort, name, driver, oltType)
+	} else if *provOnt {
+		provisionONT(c, clli, slot, port, ont, serial)
+	} else {
+	}
+
+	fmt.Println("TODO - Do something")
+}
+
 // Authentication holds the login/password
 type Authentication struct {
 	Login    string
@@ -46,34 +107,95 @@
 	return true
 }
 
-func main() {
-	var conn *grpc.ClientConn
-	creds, err := credentials.NewClientTLSFromFile("cert/server.crt", "AbstractOLT.dev.atl.foundry.att.com")
+func createChassis(c api.AbstractOLTClient, clli *string, xosAddress *string, xosPort *uint, rack *uint, shelf *uint) error {
+	fmt.Println("Calling Create Chassis")
+	fmt.Println("clli", *clli)
+	fmt.Println("xos_address", *xosAddress)
+	fmt.Println("xos_port", *xosPort)
+	fmt.Println("rack", *rack)
+	fmt.Println("shelf", *shelf)
+	response, err := c.CreateChassis(context.Background(), &api.AddChassisMessage{CLLI: *clli, VCoreIP: *xosAddress, VCorePort: int32(*xosPort), Rack: int32(*rack), Shelf: int32(*shelf)})
 	if err != nil {
-		log.Fatalf("could not load tls cert: %s", err)
-	}
-	// Setup the login/pass
-	auth := Authentication{
-		Login:    "john",
-		Password: "doe",
-	}
-	conn, err = grpc.Dial(":7777", grpc.WithTransportCredentials(creds), grpc.WithPerRPCCredentials(&auth))
-	if err != nil {
-		log.Fatalf("did not connect: %s", err)
-	}
-	defer conn.Close()
-
-	c := api.NewAbstractOLTClient(conn)
-
-	response, err := c.CreateChassis(context.Background(), &api.AddChassisMessage{CLLI: "my cilli", VCoreIP: "192.168.0.1", VCorePort: 9191})
-	if err != nil {
-		log.Fatalf("Error when calling SayHello: %s", err)
+		fmt.Printf("Error when calling CreateChassis: %s", err)
+		return err
 	}
 	log.Printf("Response from server: %s", response.GetDeviceID())
-	newResponse, err := c.CreateOLTChassis(context.Background(), &api.AddOLTChassisMessage{CLLI: "my cilli", SlotIP: "12.2.2.0", SlotPort: 9191, Hostname: "SlotOne", Type: api.AddOLTChassisMessage_edgecore})
+	return nil
+}
+func addOltChassis(c api.AbstractOLTClient, clli *string, oltAddress *string, oltPort *uint, name *string, driver *string, oltType *string) error {
+	fmt.Println("clli", *clli)
+	fmt.Println("olt_address", *oltAddress)
+	fmt.Println("olt_port", *oltPort)
+	fmt.Println("name", *name)
+	fmt.Println("driver", *driver)
+	fmt.Println("type", *oltType)
+	var driverType api.AddOLTChassisMessage_OltDriver
+	var chassisType api.AddOLTChassisMessage_OltType
+	switch *oltType {
+	case "edgecore":
+		chassisType = api.AddOLTChassisMessage_edgecore
+	}
+	switch *driver {
+	case "openolt":
+		driverType = api.AddOLTChassisMessage_openoltDriver
+
+	}
+
+	res, err := c.CreateOLTChassis(context.Background(), &api.AddOLTChassisMessage{CLLI: *clli, SlotIP: *oltAddress, SlotPort: uint32(*oltPort), Hostname: *name, Type: chassisType, Driver: driverType})
 	if err != nil {
 		debug.PrintStack()
-		log.Fatalf("Error when calling SayHello: %s", err)
+		fmt.Printf("Error when calling CreateOLTChassis: %s", err)
+		return err
 	}
-	log.Printf("Response from server: %s", newResponse.GetDeviceID())
+	log.Printf("Response from server: %s", res.GetDeviceID())
+	return nil
+}
+func provisionONT(c api.AbstractOLTClient, clli *string, slot *uint, port *uint, ont *uint, serial *string) error {
+	fmt.Println("clli", *clli)
+	fmt.Println("slot", *slot)
+	fmt.Println("port", *port)
+	fmt.Println("ont", *ont)
+	fmt.Println("serial", *serial)
+	res, err := c.ProvisionOnt(context.Background(), &api.AddOntMessage{CLLI: *clli, SlotNumber: int32(*slot), PortNumber: int32(*port), OntNumber: int32(*ont), SerialNumber: *serial})
+	if err != nil {
+		debug.PrintStack()
+		fmt.Printf("Error when calling ProvsionOnt %s", err)
+		return err
+	}
+	log.Printf("Response from server: %t", res.GetSuccess())
+	return nil
+
+	return nil
+}
+func usage() {
+	var output = `
+   Usage ./client -[methodFlag] params
+   methFlags:
+   -c create chassis
+      params:
+         -clli CLLI_NAME
+	 -xos_address XOS_TOSCA_IP
+	 -xos_port XOS_TOSCA_LISTEN_PORT
+	 -rack [optional default 1]
+	 -shelf [optional default 1]
+   e.g. ./client -c -clli MY_CLLI -xos_address 192.168.0.1 -xos_port 30007 -rack 1 -shelf 1
+   -s add physical olt chassis to chassis
+      params:
+         -clli CLLI_NAME - identifies abstract chassis to assign olt chassis to
+	 -olt_address - OLT_CHASSIS_IP_ADDRESS
+	 -olt_port - OLT_CHASSIS_LISTEN_PORT
+	 -name - OLT_NAME internal human readable name to identify OLT_CHASSIS
+	 -driver [openolt,asfvolt16,adtran,tibits] - used to tell XOS which driver should be used to manange chassis
+	 -type [edgecore,adtran,tibit] - used to tell AbstractOLT how many ports are available on olt chassis
+   e.g. ./client -s -clli MY_CLLI -olt_address 192.168.1.100 -olt_port=9191 -name=slot1 -driver=openolt -type=adtran
+   -o provision ont - adds ont to whitelist in XOS  on a specific port on a specific olt chassis based on abstract -> phyisical mapping
+      params:
+	 -clli CLLI_NAME
+	 -slot SLOT_NUMBER [1-16]
+	 -port OLT_PORT_NUMBER [1-16]
+	 -ont ONT_NUMBER [1-64]
+	 -serial ONT_SERIAL_NUM
+	e.g. ./client -o -clli=MY_CLLI -slot=1 -port=1 -ont=22 -serial=aer900jasdf `
+
+	fmt.Println(output)
 }
diff --git a/models/abstract/ChassisUtils.go b/models/abstract/ChassisUtils.go
index 2377453..5e38890 100644
--- a/models/abstract/ChassisUtils.go
+++ b/models/abstract/ChassisUtils.go
@@ -19,8 +19,8 @@
 /*
 GenerateChassis - constructs a new AbstractOLT Chassis
 */
-func GenerateChassis(CLLI string) *Chassis {
-	chassis := Chassis{CLLI: CLLI}
+func GenerateChassis(CLLI string, rack int, shelf int) *Chassis {
+	chassis := Chassis{CLLI: CLLI, Rack: rack, Shelf: shelf}
 
 	var slots [16]Slot
 	for i := 0; i < 16; i++ {
@@ -32,11 +32,11 @@
 }
 
 func generateSlot(n int, c *Chassis) Slot {
-	slot := Slot{Number: n, Parent: c}
+	slot := Slot{Number: n + 3, Parent: c}
 
 	var ports [16]Port
 	for i := 0; i < 16; i++ {
-		ports[i] = generatePort(i, &slot)
+		ports[i] = generatePort(i+1, &slot)
 	}
 
 	slot.Ports = ports
@@ -46,10 +46,11 @@
 	port := Port{Number: n, Parent: s}
 
 	var onts [64]Ont
-	for i := 0; i < 64; i++ {
+	//i starts with 1 because :P Architects - blah
+	for i := 1; i < 65; i++ {
 		/* adding one because the system that provisions is 1 based on everything not 0 based*/
-		onts[i] = Ont{Number: i, Svlan: calculateSvlan(s.Number+1, n+1, i+1),
-			Cvlan: calculateCvlan(s.Number+1, n+1, i+1), Parent: &port}
+		onts[i-1] = Ont{Number: i, Svlan: calculateSvlan(s.Number, n, i),
+			Cvlan: calculateCvlan(s.Number, n, i+1), Parent: &port}
 	}
 
 	port.Onts = onts
@@ -61,8 +62,7 @@
 	ontSlotOffset := 12  //= Max(ONT_PORT) = 12
 	vlanOffset := 1      //(VID 1 is reserved)
 
-	cVid := ((ont-1)%32)*ontPortOffset +
-		(slot-1)*ontSlotOffset + port + vlanOffset
+	cVid := ((ont-2)%32)*ontPortOffset + (slot-3)*ontSlotOffset + port + vlanOffset
 
 	return cVid
 }
@@ -71,8 +71,7 @@
 	ltSlotOffset := 16
 	vlanGap := 288  // Max(LT_SLOT) * Max(ltSlotOffset) = 18 * 16 = 288
 	vlanOffset := 1 //(VID 1 is reserved)
-
-	sVid := ((slot-1)*ltSlotOffset + port) + ((ont-1)/32)*vlanGap + vlanOffset
+	sVid := ((slot-3)*ltSlotOffset + port) + ((ont-1)/32)*vlanGap + vlanOffset
 
 	return sVid
 }
diff --git a/models/abstract/ChassisUtils_test.go b/models/abstract/ChassisUtils_test.go
index ecc5752..d6043f4 100644
--- a/models/abstract/ChassisUtils_test.go
+++ b/models/abstract/ChassisUtils_test.go
@@ -23,17 +23,16 @@
 )
 
 func TestChassisUtils_GenerateChassis(t *testing.T) {
-	chassis := abstract.GenerateChassis("MY_CLLI")
+	chassis := abstract.GenerateChassis("MY_CLLI", 1, 1)
 	slot := chassis.Slots[6]
 	port := slot.Ports[0]
 	ont := port.Onts[3]
 	svlan := ont.Svlan
 	cvlan := ont.Cvlan
 	if svlan != 98 { // see map doc
-		t.Fail()
+		t.Errorf("SVlan should be 98 and is %d\n", svlan)
 	}
 	if cvlan != 434 { // see map doc
-		t.Fail()
+		t.Errorf("CVlan should be 434 and is %d\n", cvlan)
 	}
-
 }
diff --git a/models/abstract/chassis.go b/models/abstract/chassis.go
index 687ecae..06e0002 100644
--- a/models/abstract/chassis.go
+++ b/models/abstract/chassis.go
@@ -16,7 +16,10 @@
 
 package abstract
 
-import "errors"
+import (
+	"errors"
+	"fmt"
+)
 
 const MAX_SLOTS int = 16
 const MAX_PORTS int = 16
@@ -27,6 +30,8 @@
 type Chassis struct {
 	CLLI      string
 	Slots     [16]Slot
+	Rack      int
+	Shelf     int
 	AllocInfo PortAllocationInfo
 }
 
@@ -59,6 +64,7 @@
 	return nextPort, nil
 }
 func (chassis *Chassis) ActivateONT(slotNumber int, portNumber int, ontNumber int, serialNumber string) error {
+	fmt.Printf("chassis.ActivateONT(slot:%d,portNumber:%d,ontNumber:%d,serialNumber:%s\n", slotNumber, portNumber, ontNumber, serialNumber)
 	err := chassis.Slots[slotNumber-1].Ports[portNumber-1].provisionOnt(ontNumber, serialNumber)
 	return err
 }
diff --git a/models/abstract/port.go b/models/abstract/port.go
index 2c2e07c..e626e7c 100644
--- a/models/abstract/port.go
+++ b/models/abstract/port.go
@@ -49,15 +49,22 @@
 	return fmt.Sprintf("Port %d for olt %d on AbstractChasis  %s is not provisioned", e.portNum, e.oltNum, e.clli)
 }
 func (port *Port) provisionOnt(ontNumber int, serialNumber string) error {
+
+	fmt.Printf("My Number:%d abstract.port.provisionOnt(ontNumber:%d,serialNumber:%s\n", port.Number, ontNumber, serialNumber)
+	slot := port.Parent
+	chassis := *slot.Parent
+	baseID := fmt.Sprintf("%d/%d/%d/%d:%d.1.1", chassis.Rack, chassis.Shelf, slot.Number, port.Number, ontNumber)
+	nasPortID := fmt.Sprintf("PON %s", baseID)
+	circuitID := fmt.Sprintf("%s %s", chassis.CLLI, baseID)
+
 	if port.PhysPort == nil {
-		slot := port.Parent
 		chassis := slot.Parent
 		err := UnprovisonedPortError{oltNum: slot.Number, clli: chassis.CLLI, portNum: port.Number}
 		return &err
 	}
 	phyPort := port.PhysPort
 	ont := port.Onts[ontNumber-1]
-	err := phyPort.ActivateOnt(ontNumber, ont.Svlan, ont.Cvlan, serialNumber)
+	err := phyPort.ActivateOnt(ontNumber, ont.Svlan, ont.Cvlan, serialNumber, nasPortID, circuitID)
 	return err
 }
 func (port *Port) deleteOnt(ontNumber int, serialNumber string) error {
diff --git a/models/physical/chassis.go b/models/physical/chassis.go
index 705de80..4e0c4da 100644
--- a/models/physical/chassis.go
+++ b/models/physical/chassis.go
@@ -19,6 +19,10 @@
 import (
 	"fmt"
 	"net"
+	"net/http"
+	"strings"
+
+	"gerrit.opencord.org/abstract-olt/models/tosca"
 )
 
 /*
@@ -29,6 +33,8 @@
 	VCoreAddress net.TCPAddr
 	Dataswitch   DataSwitch
 	Linecards    []OLT
+	Rack         int
+	Shelf        int
 }
 type UnprovisionedSlotError struct {
 	CLLI       string
@@ -46,10 +52,59 @@
 	chassis.Linecards = append(chassis.Linecards, olt)
 	//TODO - api call to add olt i.e. preprovision_olt
 	fmt.Printf("chassis.AddOLTChassis(%s)\n", olt.GetHostname())
+	//S>103 func NewOltProvision(name string, deviceType string, host string, port int) OltProvsion {
+	ipString := olt.GetAddress().IP.String()
+	webServerPort := olt.GetAddress().Port
+	oltStruct := tosca.NewOltProvision(chassis.CLLI, olt.GetHostname(), "openolt", ipString, webServerPort)
+	yaml, _ := oltStruct.ToYaml()
+	fmt.Printf("yaml:%s\n", yaml)
+	client := &http.Client{}
+	requestList := fmt.Sprintf("http://%s:%d/run", chassis.VCoreAddress.IP.String(), chassis.VCoreAddress.Port)
+	req, err := http.NewRequest("POST", requestList, strings.NewReader(yaml))
+	req.Header.Add("xos-username", "admin@opencord.org")
+	req.Header.Add("xos-password", "letmein")
+	resp, err := client.Do(req)
+	if err != nil {
+		fmt.Printf("ERROR :) %v\n", err)
+		// handle error
+	}
+	fmt.Printf("Response is %v\n", resp)
+
 }
 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)
+	ponPort := ont.Parent
+	slot := ponPort.Parent
+
+	//func NewOntProvision(serialNumber string, oltIP net.IP, ponPortNumber int) OntProvision {
+	ontStruct := tosca.NewOntProvision(ont.SerialNumber, slot.Address.IP, ponPort.Number)
+	yaml, _ := ontStruct.ToYaml()
+
+	fmt.Printf("yaml:%s\n", yaml)
+	client := &http.Client{}
+	requestList := fmt.Sprintf("http://%s:%d/run", chassis.VCoreAddress.IP.String(), chassis.VCoreAddress.Port)
+	req, err := http.NewRequest("POST", requestList, strings.NewReader(yaml))
+	req.Header.Add("xos-username", "admin@opencord.org")
+	req.Header.Add("xos-password", "letmein")
+	resp, err := client.Do(req)
+	if err != nil {
+		fmt.Printf("ERROR :) %v\n", err)
+		// handle error
+	}
+	fmt.Printf("Response is %v\n", resp)
+	rgName := fmt.Sprintf("%s_%d_%d_%d_RG", chassis.CLLI, slot.Number, ponPort.Number, ont.Number)
+	subStruct := tosca.NewSubscriberProvision(rgName, ont.Cvlan, ont.Svlan, ont.SerialNumber, ont.NasPortID, ont.CircuitID, chassis.CLLI)
+	yaml, _ = subStruct.ToYaml()
+	fmt.Printf("yaml:%s\n", yaml)
+	req, err = http.NewRequest("POST", requestList, strings.NewReader(yaml))
+	req.Header.Add("xos-username", "admin@opencord.org")
+	req.Header.Add("xos-password", "letmein")
+	resp, err = client.Do(req)
+	if err != nil {
+		fmt.Printf("ERROR :) %v\n", err)
+		// handle error
+	}
 }
 func (chassis *Chassis) deleteONT(ont Ont) {
 	//TODO - api call to provison s/c vlans and ont serial number etc
diff --git a/models/physical/ont.go b/models/physical/ont.go
index 3e5e659..79c21ee 100644
--- a/models/physical/ont.go
+++ b/models/physical/ont.go
@@ -26,4 +26,6 @@
 	SerialNumber string
 	Parent       *PONPort `json:"-"`
 	Active       bool
+	NasPortID    string
+	CircuitID    string
 }
diff --git a/models/physical/ponport.go b/models/physical/ponport.go
index 15b7328..ca321fd 100644
--- a/models/physical/ponport.go
+++ b/models/physical/ponport.go
@@ -16,7 +16,9 @@
 
 package physical
 
-import "fmt"
+import (
+	"fmt"
+)
 
 /*
 PONPort represents a single PON port on the OLT chassis
@@ -65,7 +67,7 @@
 /*
 ActivateOnt - passes ont information to chassis to make call to NEM to activate (whitelist) ont
 */
-func (port *PONPort) ActivateOnt(number int, sVlan int, cVlan int, serialNumber string) error {
+func (port *PONPort) ActivateOnt(number int, sVlan int, cVlan int, serialNumber string, nasPortID string, circuitID string) error {
 	slot := port.Parent
 	chassis := slot.Parent
 	fmt.Printf("Calling ActivateOnt and port state is %t\n", port.Onts[number-1].Active)
@@ -74,7 +76,7 @@
 		e := AllReadyActiveError{ontNumber: number, slotNum: slot.Number, ponportNum: port.Number, clli: chassis.CLLI}
 		return &e
 	}
-	ont := Ont{Number: number, Svlan: sVlan, Cvlan: cVlan, SerialNumber: serialNumber, Parent: port}
+	ont := Ont{Number: number, Svlan: sVlan, Cvlan: cVlan, SerialNumber: serialNumber, Parent: port, NasPortID: nasPortID, CircuitID: circuitID}
 	port.Onts[number-1] = ont
 	port.Parent.Parent.provisionONT(ont)
 	port.Onts[number-1].Active = true
diff --git a/models/tosca/addOlt.go b/models/tosca/addOlt.go
new file mode 100644
index 0000000..0005800
--- /dev/null
+++ b/models/tosca/addOlt.go
@@ -0,0 +1,124 @@
+/*
+   Copyright 2017 the original author or authors.
+
+   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 tosca
+
+import (
+	"log"
+
+	yaml "gopkg.in/yaml.v2"
+)
+
+var templateData = `
+tosca_definitions_version: tosca_simple_yaml_1_0
+imports:
+  - custom_types/oltdevice.yaml
+  - custom_types/onudevice.yaml
+  - custom_types/ponport.yaml
+  - custom_types/voltservice.yaml
+description: Create a simulated OLT Device in VOLTHA
+topology_template:
+  node_templates:
+      service#volt:
+        type: tosca.nodes.VOLTService
+        properties:
+          name: volt
+          must-exist: true
+      olt_device:
+        type: tosca.nodes.OLTDevice
+        properties:
+           name: test
+           type: test
+           host: test
+           port: 32
+           outer_tpid: "0x8100"
+           uplink: "65536"
+           nas_id:
+        requirements:
+          - volt_service:
+              node: service#volt
+              relationship: tosca.relationships.BelongsToOne
+`
+
+type OltProvsion struct {
+	ToscaDefinitionsVersion string   `yaml:"tosca_definitions_version"`
+	Imports                 []string `yaml:"imports"`
+	Description             string   `yaml:"description"`
+	TopologyTemplate        struct {
+		NodeTemplates struct {
+			ServiceVolt struct {
+				Type       string `yaml:"type"`
+				Properties struct {
+					Name      string `yaml:"name"`
+					MustExist bool   `yaml:"must-exist"`
+				} `yaml:"properties"`
+			} `yaml:"service#volt"`
+			OltDevice struct {
+				DeviceType string `yaml:"type"`
+				Properties struct {
+					Name      string `yaml:"name"`
+					Type      string `yaml:"device_type"`
+					Host      string `yaml:"host"`
+					Port      int    `yaml:"port"`
+					OuterTpid string `yaml:"outer_tpid"`
+					Uplink    string `yaml:"uplink"`
+					NasID     string `yaml:"nas_id"`
+				} `yaml:"properties"`
+				Requirements []struct {
+					VoltService struct {
+						Node         string `yaml:"node"`
+						Relationship string `yaml:"relationship"`
+					} `yaml:"volt_service"`
+				} `yaml:"requirements"`
+			} `yaml:"olt_device"`
+		} `yaml:"node_templates"`
+	} `yaml:"topology_template"`
+}
+
+/*var templateData = `
+tosca_definitions_version: tosca_simple_yaml_1_0
+imports:
+   - custom_types/oltdevice.yaml
+   - custom_types/onudevice.yaml
+   - custom_types/ponport.yaml
+   - custom_types/voltservice.yaml
+`
+
+type OltProvsion struct {
+	Tosca_Definitions_Version string
+	Imports                   []string
+}
+*/
+
+func NewOltProvision(clli string, name string, deviceType string, host string, port int) OltProvsion {
+	o := OltProvsion{}
+	err := yaml.Unmarshal([]byte(templateData), &o)
+	if err != nil {
+		log.Printf("Error un-marshalling template data %v\n", err)
+	}
+
+	props := &o.TopologyTemplate.NodeTemplates.OltDevice.Properties
+	props.Name = name
+	props.Type = deviceType
+	props.Host = host
+	props.Port = port
+	props.NasID = clli
+	return o
+}
+
+func (olt *OltProvsion) ToYaml() (string, error) {
+	b, err := yaml.Marshal(olt)
+	return string(b), err
+}
diff --git a/models/tosca/addOlt_test.go b/models/tosca/addOlt_test.go
new file mode 100644
index 0000000..1b2f667
--- /dev/null
+++ b/models/tosca/addOlt_test.go
@@ -0,0 +1,79 @@
+/*
+   Copyright 2017 the original author or authors.
+
+   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 tosca_test
+
+import (
+	"fmt"
+	"strings"
+	"testing"
+
+	"gerrit.opencord.org/abstract-olt/models/tosca"
+)
+
+var output = `tosca_definitions_version: tosca_simple_yaml_1_0
+imports:
+- custom_types/oltdevice.yaml
+- custom_types/onudevice.yaml
+- custom_types/ponport.yaml
+- custom_types/voltservice.yaml
+description: Create a simulated OLT Device in VOLTHA
+topology_template:
+  node_templates:
+    service#volt:
+      type: tosca.nodes.VOLTService
+      properties:
+        name: volt
+        must-exist: true
+    olt_device:
+      type: tosca.nodes.OLTDevice
+      properties:
+        name: myName
+        device_type: openolt
+        host: 192.168.1.1
+        port: 9191
+        outer_tpid: "0x8100"
+        uplink: "65536"
+        nas_id: my_clli
+      requirements:
+      - volt_service:
+          node: service#volt
+          relationship: tosca.relationships.BelongsToOne
+`
+
+var olt tosca.OltProvsion
+
+func TestAddOlt_NewOltProvsion(t *testing.T) {
+	fmt.Println("In TestAddOlt_NewOltProvsion")
+	olt = tosca.NewOltProvision("my_clli", "myName", "openolt", "192.168.1.1", 9191)
+	fmt.Printf("%v\n\n", olt)
+}
+
+func TestAddOlt_ToYaml(t *testing.T) {
+	y, err := olt.ToYaml()
+	if err != nil {
+		t.Fatalf("olt.ToYaml() failed with %v\n", err)
+	}
+	x := strings.Compare(y, output)
+	if x != 0 {
+		t.Fatal("ToYaml didn't produce the expected yaml")
+	}
+	fmt.Printf("Compare is %d\n", x)
+
+	fmt.Printf(y)
+	fmt.Println("******")
+	fmt.Print(output)
+	fmt.Println("******")
+}
diff --git a/models/tosca/addSubscriber.go b/models/tosca/addSubscriber.go
new file mode 100644
index 0000000..448569c
--- /dev/null
+++ b/models/tosca/addSubscriber.go
@@ -0,0 +1,89 @@
+/*
+   Copyright 2017 the original author or authors.
+
+   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 tosca
+
+import (
+	"log"
+	"strings"
+
+	yaml "gopkg.in/yaml.v2"
+)
+
+var subSubscriberTemplate = `tosca_definitions_version: tosca_simple_yaml_1_0
+imports:
+  - custom_types/rcordsubscriber.yaml
+
+description: Pre-provsion a subscriber
+topology_template:
+  node_templates:
+    RG_NAME:
+      type: tosca.nodes.RCORDSubscriber
+      properties:
+        name:
+        status: pre-provisioned
+        c_tag:
+        s_tag:
+        onu_device:
+        nas_port_id:
+        circuit_id:
+        remote_id:`
+
+type SubscriberProvision struct {
+	ToscaDefinitionsVersion string   `yaml:"tosca_definitions_version"`
+	Imports                 []string `yaml:"imports"`
+	Description             string   `yaml:"description"`
+	TopologyTemplate        struct {
+		NodeTemplates struct {
+			RgName struct {
+				Type       string `yaml:"type`
+				Properties struct {
+					Name      string `yaml:"name"`
+					Status    string `yaml:"status"`
+					CTag      int    `yaml:"c_tag"`
+					STag      int    `yaml:"s_tag"`
+					OnuDevice string `yaml:"onu_device"`
+					NasPortID string `yaml:"nas_port_id"`
+					CircuitID string `yaml:"circuit_id"`
+					RemoteID  string `yaml:"remote_id"`
+				} `yaml:"properties"`
+			} `yaml:"RG_NAME"`
+		} `yaml:"node_templates"`
+	} `yaml:"topology_template"`
+}
+
+func NewSubscriberProvision(name string, cTag int, sTag int, onuDevice string, nasPortID string, circuitID string, remoteID string) SubscriberProvision {
+	s := SubscriberProvision{}
+	err := yaml.Unmarshal([]byte(subSubscriberTemplate), &s)
+	if err != nil {
+		log.Printf("Error un-marshalling template data %v\n", err)
+	}
+	props := &s.TopologyTemplate.NodeTemplates.RgName.Properties
+	props.Name = name
+	props.CTag = cTag
+	props.STag = sTag
+	props.OnuDevice = onuDevice
+	props.NasPortID = nasPortID
+	props.CircuitID = circuitID
+	props.RemoteID = remoteID
+	return s
+}
+func (sub *SubscriberProvision) ToYaml() (string, error) {
+	b, err := yaml.Marshal(sub)
+	ret := string(b)
+	name := sub.TopologyTemplate.NodeTemplates.RgName.Properties.Name
+	ret = strings.Replace(ret, "RG_NAME", name, -1)
+	return ret, err
+}
diff --git a/models/tosca/addSubscriber_test.go b/models/tosca/addSubscriber_test.go
new file mode 100644
index 0000000..0d48340
--- /dev/null
+++ b/models/tosca/addSubscriber_test.go
@@ -0,0 +1,75 @@
+/*
+   Copyright 2017 the original author or authors.
+
+   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 tosca_test
+
+import (
+	"fmt"
+	"strings"
+	"testing"
+
+	"gerrit.opencord.org/abstract-olt/models/tosca"
+)
+
+var expectedOutput = `tosca_definitions_version: tosca_simple_yaml_1_0
+imports:
+- custom_types/rcordsubscriber.yaml
+description: Pre-provsion a subscriber
+topology_template:
+  node_templates:
+    myName:
+      type: tosca.nodes.RCORDSubscriber
+      properties:
+        name: myName
+        status: pre-provisioned
+        c_tag: 20
+        s_tag: 2
+        onu_device: onuSerialNumber
+        nas_port_id: /1/1/1/1/1.9
+        circuit_id: /1/1/1/1/1.9-CID
+        remote_id: myCilli
+`
+
+var sub tosca.SubscriberProvision
+
+func TestAddSubscriber_NewSubscriberProvision(t *testing.T) {
+	fmt.Println("Int TestAddSubscriber_NewSubscriberProvision")
+	sub = tosca.NewSubscriberProvision("myName", 20, 2, "onuSerialNumber", "/1/1/1/1/1.9", "/1/1/1/1/1.9-CID", "myCilli")
+	fmt.Printf("%v\n\n", sub)
+}
+
+func TestAddSubscriber_ToYaml(t *testing.T) {
+	y, err := sub.ToYaml()
+	if err != nil {
+		t.Fatalf("olt.ToYaml() failed with %v\n", err)
+	}
+
+	x := strings.Compare(y, expectedOutput)
+	if x != 0 {
+		fmt.Println("******")
+		fmt.Println(expectedOutput)
+		fmt.Println("******")
+		fmt.Println(y)
+		fmt.Println("******")
+		t.Fatal("ToYaml didn't produce the expected yaml")
+	}
+	fmt.Printf("Compare is %d\n", x)
+
+	fmt.Printf(y)
+	fmt.Println("******")
+	fmt.Print(output)
+	fmt.Println("******")
+}
diff --git a/models/tosca/provisionOnt.go b/models/tosca/provisionOnt.go
new file mode 100644
index 0000000..c83cc4d
--- /dev/null
+++ b/models/tosca/provisionOnt.go
@@ -0,0 +1,103 @@
+/*
+   Copyright 2017 the original author or authors.
+
+   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 tosca
+
+import (
+	"fmt"
+	"net"
+	"strings"
+
+	yaml "gopkg.in/yaml.v2"
+)
+
+var ontTemplate = `tosca_definitions_version: tosca_simple_yaml_1_0
+imports:
+  - custom_types/attworkflowdriverwhitelistentry.yaml
+  - custom_types/attworkflowdriverservice.yaml
+description: Create an entry in the whitelist
+topology_template:
+  node_templates:
+    service#att:
+      type: tosca.nodes.AttWorkflowDriverService
+      properties:
+        name: att-workflow-driver
+        must-exist: true
+    ont:
+      type: tosca.nodes.AttWorkflowDriverWhiteListEntry
+      properties:
+        serial_number: ALPHe3d1cf57
+        pon_port_id: 536870912
+        device_id: of:000000000a4001ce
+      requirements:
+        - owner:
+            node: service#att
+            relationship: tosca.relationships.BelongsToOne`
+
+type OntProvision struct {
+	ToscaDefinitionsVersion string   `yaml:"tosca_definitions_version"`
+	Imports                 []string `yaml:"imports"`
+	Description             string   `yaml:"description"`
+	TopologyTemplate        struct {
+		NodeTemplates struct {
+			ServiceATT struct {
+				Type       string `yaml:"type"`
+				Properties struct {
+					Name      string `yaml:"name"`
+					MustExist bool   `yaml:"must-exist"`
+				} `yaml:"properties"`
+			} `yaml:"service#att"`
+			Ont struct {
+				DeviceType string `yaml:"type"`
+				Properties struct {
+					SerialNumber string `yaml:"serial_number"`
+					PonPortID    int    `yaml:"pon_port_id"`
+					DeviceID     string `yaml:"device_id"`
+				} `yaml:"properties"`
+				Requirements []struct {
+					Owner struct {
+						Node         string `yaml:"node"`
+						Relationship string `yaml:"relationship"`
+					} `yaml:"owner"`
+				} `yaml:"requirements"`
+			} `yaml:"ont"`
+		} `yaml:"node_templates"`
+	} `yaml:"topology_template"`
+}
+
+func NewOntProvision(serialNumber string, oltIP net.IP, ponPortNumber int) OntProvision {
+	offset := 1 << 29
+	o := OntProvision{}
+	err := yaml.Unmarshal([]byte(ontTemplate), &o)
+	if err != nil {
+	}
+	props := &o.TopologyTemplate.NodeTemplates.Ont.Properties
+	props.PonPortID = offset + ponPortNumber
+	props.SerialNumber = serialNumber
+	ipNum := []byte(oltIP[12:16]) //only handling ipv4
+	ofID := fmt.Sprintf("of:00000000%0x", ipNum)
+	props.DeviceID = ofID
+	fmt.Printf("%v\n", o)
+	return o
+
+}
+func (ont *OntProvision) ToYaml() (string, error) {
+	b, err := yaml.Marshal(ont)
+	ret := string(b)
+	// Damn dirty hack but what are you going to do????
+	serialNumber := ont.TopologyTemplate.NodeTemplates.Ont.Properties.SerialNumber
+	ret = strings.Replace(ret, "ont", serialNumber, -1)
+	return ret, err
+}
diff --git a/models/tosca/provisionOnt_test.go b/models/tosca/provisionOnt_test.go
new file mode 100644
index 0000000..ff7cd85
--- /dev/null
+++ b/models/tosca/provisionOnt_test.go
@@ -0,0 +1,62 @@
+/*
+   Copyright 2017 the original author or authors.
+
+   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 tosca_test
+
+import (
+	"fmt"
+	"net"
+	"testing"
+
+	"gerrit.opencord.org/abstract-olt/models/tosca"
+)
+
+var expected = `tosca_definitions_version: tosca_simple_yaml_1_0
+imports:
+- custom_types/attworkflowdriverwhitelistentry.yaml
+- custom_types/attworkflowdriverservice.yaml
+description: Create an entry in the whitelist
+topology_template:
+  node_templates:
+    service#att:
+      type: tosca.nodes.AttWorkflowDriverService
+      properties:
+        name: att-workflow-driver
+        must-exist: true
+    some_serial:
+      type: tosca.nodes.AttWorkflowDriverWhiteListEntry
+      properties:
+        serial_number: some_serial
+        pon_port_id: 536870914
+        device_id: of:00000000c0a8010b
+      requirements:
+      - owner:
+          node: service#att
+          relationship: tosca.relationships.BelongsToOne
+`
+var ont tosca.OntProvision
+
+//func NewOntProvision(serialNumber string, oltIP net.IP, ponPortNumber int) OntProvision {
+
+func TestOntProvision_NewOntProvision(t *testing.T) {
+	ont = tosca.NewOntProvision("some_serial", net.ParseIP("192.168.1.11"), 2)
+	ontYaml, _ := ont.ToYaml()
+	if ontYaml != expected {
+		t.Fatalf("Didn't generate the expected yaml\n Generated:\n%s \nExpected:\n%s\n", ontYaml, expected)
+	}
+	fmt.Println(ontYaml)
+	fmt.Println("******************")
+}
diff --git a/test/integration/serialize_test.go b/test/integration/serialize_test.go
index fbc6932..c1524bb 100644
--- a/test/integration/serialize_test.go
+++ b/test/integration/serialize_test.go
@@ -41,7 +41,7 @@
 }
 
 func generateTestChassis() *abstract.Chassis {
-	chassis := abstract.GenerateChassis("My_CLLI")
+	chassis := abstract.GenerateChassis("My_CLLI", 1, 1)
 
 	var slots [16]abstract.Slot
 	for i := 0; i < 16; i++ {