initial add
deleting bin/cert
adding license info

tweaking packages to match go standard conventions

updating to match tweaked package names

Change-Id: I78b395a778c0ceb649e2aa4491c81fd3dc28d0c0
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..261eeb9
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,201 @@
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   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.
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..b41c5d9
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,68 @@
+#
+#   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.
+#
+
+SERVER_OUT	 := "bin/AbstractOLT"
+CLIENT_OUT	 := "bin/client"
+API_OUT		 := "api/abstract_olt_api.pb.go"
+API_REST_OUT     := "api/abstract_olt_api.pb.gw.go"
+SWAGGER_OUT      := "api/abstract_olt_api.swagger.json"
+PKG	         := "gerrit.opencord.org/abstract-olt"
+SERVER_PKG_BUILD := "${PKG}/cmd/AbstractOLT"
+CLIENT_PKG_BUILD := "${PKG}/client"
+PKG_LIST := $(shell go list ${PKG}/... | grep -v /vendor/)
+
+
+.PHONY: all api server client
+
+all: server client
+
+api/abstract_olt_api.pb.go:
+	@protoc -I api/ \
+	-I${GOPATH}/src \
+	-I${GOPATH}/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \
+	--go_out=plugins=grpc:api \
+	api/abstract_olt_api.proto
+
+api/abstract_olt_api.pb.gw.go :
+	  @protoc -I api/ \
+	-I${GOPATH}/src \
+	-I${GOPATH}/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \
+	--grpc-gateway_out=logtostderr=true:api \
+	 api/abstract_olt_api.proto
+
+swagger:
+	protoc -I api/ \
+  -I${GOPATH}/src \
+  -I${GOPATH}/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \
+  --swagger_out=logtostderr=true:api \
+  api/abstract_olt_api.proto
+
+api: api/abstract_olt_api.pb.go api/abstract_olt_api.pb.gw.go swagger
+
+dep: ## Get the dependencies
+	@go get -v -d ./...
+
+server: dep api ## Build the binary file for server
+	@go build -i -v -o $(SERVER_OUT) $(SERVER_PKG_BUILD)
+
+client: dep api ## Build the binary file for client
+	@go build -i -v -o $(CLIENT_OUT) $(CLIENT_PKG_BUILD)
+
+clean: ## Remove previous builds
+	@rm $(SERVER_OUT) $(CLIENT_OUT) $(API_OUT) $(API_REST_OUT) $(SWAGGER_OUT)
+
+help: ## Display this help screen
+	@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..1ea093c
--- /dev/null
+++ b/README.md
@@ -0,0 +1,48 @@
+# AbstractOLT
+AbstractOLT provides a mapping service from AT&T's, and potentially other's, provisioning platform to SEBA/Voltha.
+It presents a facade of the hardware that resembles a 16 slot / with 16 PON ports each.
+Internally it maps PON ports on the abstractOLT to PON ports on physical OLT chasssis.
+
+
+## Dependencies
+```go
+go get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway
+go get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger
+go get -u github.com/golang/protobuf/protoc-gen-go
+```
+## Retrieving code
+```go
+go get gerrit.opencord.org/abstract-olt/cmd/AbstractOLT
+```
+## Makefile
+```sh
+make clean # clears all generated and compiler output.
+make dep # pulls any go dependencies.
+make api # generates grpc code and swagger files
+make server # compiles AbstractOLT into bin directory
+make client # compiles a test client which exercises some of the server api functions
+make all # builds everything
+```
+### Certificates
+Before running you will need to create a cert directory under bin and generate ssl certificates
+```sh
+cd bin
+mkdir cert
+openssl genrsa -out cert/server.key 204
+openssl req -new -x509 -sha256 -key cert/server.key -out cert/server.crt -days 3650
+openssl req -new -sha256 -key cert/server.key -out cert/server.csr
+openssl x509 -req -sha256 -in cert/server.csr -signkey cert/server.key -out cert/server.crt -days 3650
+```
+
+## Running
+```sh
+cd bin
+./AbstractOLT # or
+./AbstractOLT -d # for debug logging
+```
+This will create/append an AbstractOLT.log file in the current directory that will contain some runtime information
+
+
+
+
+
diff --git a/api/abstract_olt_api.proto b/api/abstract_olt_api.proto
new file mode 100644
index 0000000..2dfeff0
--- /dev/null
+++ b/api/abstract_olt_api.proto
@@ -0,0 +1,106 @@
+//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.
+
+syntax = "proto3";
+package api;
+import "google/api/annotations.proto";
+
+message AddChassisMessage{
+   string CLLI =1;
+   string VCoreIP =2;
+   int32 VCorePort=3;
+}
+message Error {
+   int32 ErrorNum = 1;
+   string ErrorMessage=2;
+   int32 Serverity=3;
+}
+message AddChassisReturn{
+   string DeviceID = 1;
+   Error error = 2;
+}
+message AddOLTChassisMessage{
+   string CLLI=1;
+   string SlotIP=2;
+   fixed32 SlotPort=3;
+   string Hostname=4;
+   fixed32 NumPorts = 5;
+   bool Activate = 6;
+   enum OltDriver {
+      openoltDriver = 0;
+      asfvolt16Driver=1;
+      adtranDriver=2;
+      tibitsDriver=3;
+   }
+   OltDriver Driver=7;
+   enum OltType{
+      edgecore=0;
+      adtran=1;
+      tibit=2;
+   }
+   OltType Type=8;
+
+}
+message AddOLTChassisReturn {
+   string DeviceID =1;
+   string ChassisDeviceID =2;
+   Error error = 3;
+}
+message ActivateSlotMessage{
+   string SlotDeviceID = 1;
+}
+message ActivateSlotReturn{
+   bool Success = 1;
+   Error error = 2;
+}
+message AddOntMessage{
+   string ChassisDeviceID=1;
+   string SlotDeviceID=2;
+   int32 PortNumber=3;
+   int32 OntNumber=4;
+}
+message AddOntReturn{
+   bool Success=1;
+   Error error = 2;
+}
+
+service AddChassis{
+   rpc CreateChassis(AddChassisMessage) returns (AddChassisReturn) {
+      option(google.api.http) = {
+         post: "/1/CreateAbstractChassis"
+	 body:"*"
+      };
+   }
+}
+
+service AddOLTChassis {
+   rpc CreateOLTChassis(AddOLTChassisMessage) returns (AddOLTChassisReturn) {
+      option(google.api.http) = {
+         post: "/1/CreateOLTChassis"
+	 body:"*"
+      };
+   }
+}
+service ActivateSlot{
+   rpc EnableSlot(ActivateSlotMessage) returns (ActivateSlotReturn){
+      option(google.api.http) = {
+         post: "/1/EnableSlot"
+	 body:"*"
+      };
+   }
+}
+service ActivateOnt {
+   rpc ProvisionOnt(AddOntMessage) returns (AddOntReturn) {}
+}
+
diff --git a/api/handler.go b/api/handler.go
new file mode 100644
index 0000000..ec7ce86
--- /dev/null
+++ b/api/handler.go
@@ -0,0 +1,111 @@
+/*
+ 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
+
+import (
+	"fmt"
+	"log"
+	"net"
+	"strings"
+
+	"gerrit.opencord.org/abstract-olt/internal/pkg/settings"
+	"gerrit.opencord.org/abstract-olt/models"
+	"gerrit.opencord.org/abstract-olt/models/abstract"
+	"gerrit.opencord.org/abstract-olt/models/physical"
+	context "golang.org/x/net/context"
+)
+
+/*
+Server instance of the grpc server
+*/
+type Server struct {
+}
+
+/*
+CreateChassis - allocates a new Chassis struct and stores it in chassisMap
+*/
+func (s *Server) CreateChassis(ctx context.Context, in *AddChassisMessage) (*AddChassisReturn, error) {
+	phyChassisMap := models.GetPhyChassisMap()
+	absChassisMap := models.GetAbstractChassisMap()
+	clli := in.GetCLLI()
+
+	chassis := (*phyChassisMap)[clli]
+	if chassis != nil {
+		return &AddChassisReturn{DeviceID: chassis.CLLI}, nil
+	}
+	abstractChassis := abstract.GenerateChassis(clli)
+	phyChassis := physical.Chassis{CLLI: clli}
+	if settings.GetDebug() {
+		output := fmt.Sprintf("%v", abstractChassis)
+		formatted := strings.Replace(output, "{", "\n{", -1)
+		log.Printf("new chassis %s\n", formatted)
+	}
+	(*phyChassisMap)[clli] = &phyChassis
+	(*absChassisMap)[clli] = abstractChassis
+	return &AddChassisReturn{DeviceID: clli}, nil
+}
+
+/*
+AddOLTChassis adds an OLT chassis/line card to the Physical chassis
+*/
+func (s *Server) CreateOLTChassis(ctx context.Context, in *AddOLTChassisMessage) (*AddOLTChassisReturn, error) {
+	fmt.Printf(" CreateOLTChassis %v \n", *in)
+	phyChassisMap := models.GetPhyChassisMap()
+	clli := in.GetCLLI()
+	chassis := (*phyChassisMap)[clli]
+	if chassis == nil {
+	}
+	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}
+
+	var olt physical.OLT
+	switch oltType {
+	case AddOLTChassisMessage_edgecore:
+		olt = physical.CreateEdgecore(&sOlt)
+	case AddOLTChassisMessage_adtran:
+	case AddOLTChassisMessage_tibit:
+	}
+
+	err := AddCard(chassis, olt)
+	if err != nil {
+		//TODO do something
+	}
+
+	return &AddOLTChassisReturn{DeviceID: in.GetHostname(), ChassisDeviceID: clli}, nil
+
+}
+
+/*
+AddCard Adds an OLT card to an existing physical chassis, allocating ports
+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)
+
+	ports := olt.GetPorts()
+	absChassis := (*models.GetAbstractChassisMap())[physChassis.CLLI]
+
+	for i := 0; i < len(ports); i++ {
+		absPort, _ := absChassis.NextPort()
+		absPort.PhysPort = &ports[i]
+		//AssignTraits(&ports[i], absPort)
+	}
+
+	//should probably worry about error at some point
+	return nil
+}
diff --git a/client/main.go b/client/main.go
new file mode 100644
index 0000000..5594a09
--- /dev/null
+++ b/client/main.go
@@ -0,0 +1,80 @@
+/*
+   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 main
+
+import (
+	"log"
+
+	"runtime/debug"
+
+	"gerrit.opencord.org/abstract-olt/api"
+	"golang.org/x/net/context"
+	"google.golang.org/grpc"
+	"google.golang.org/grpc/credentials"
+)
+
+// Authentication holds the login/password
+type Authentication struct {
+	Login    string
+	Password string
+}
+
+// GetRequestMetadata gets the current request metadata
+func (a *Authentication) GetRequestMetadata(context.Context, ...string) (map[string]string, error) {
+	return map[string]string{
+		"login":    a.Login,
+		"password": a.Password,
+	}, nil
+}
+
+// RequireTransportSecurity indicates whether the credentials requires transport security
+func (a *Authentication) RequireTransportSecurity() bool {
+	return true
+}
+
+func main() {
+	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.NewAddChassisClient(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)
+	}
+	log.Printf("Response from server: %s", response.GetDeviceID())
+	d := api.NewAddOLTChassisClient(conn)
+	newResponse, err := d.CreateOLTChassis(context.Background(), &api.AddOLTChassisMessage{CLLI: "my cilli", SlotIP: "12.2.2.0", SlotPort: 9191, Hostname: "SlotOne", Type: api.AddOLTChassisMessage_edgecore})
+	if err != nil {
+		debug.PrintStack()
+		log.Fatalf("Error when calling SayHello: %s", err)
+	}
+	log.Printf("Response from server: %s", newResponse.GetDeviceID())
+}
diff --git a/cmd/AbstractOLT/AbstractOLT.go b/cmd/AbstractOLT/AbstractOLT.go
new file mode 100644
index 0000000..19acd72
--- /dev/null
+++ b/cmd/AbstractOLT/AbstractOLT.go
@@ -0,0 +1,185 @@
+/*
+   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 main
+
+import (
+	"flag"
+	"fmt"
+	"log"
+	"net"
+	"net/http"
+	"os"
+	"strings"
+
+	"gerrit.opencord.org/abstract-olt/api"
+	"gerrit.opencord.org/abstract-olt/internal/pkg/settings"
+	"github.com/grpc-ecosystem/grpc-gateway/runtime"
+	"golang.org/x/net/context"
+	"google.golang.org/grpc"
+	"google.golang.org/grpc/credentials"
+	"google.golang.org/grpc/metadata"
+)
+
+// private type for Context keys
+type contextKey int
+
+const (
+	clientIDKey contextKey = iota
+)
+
+/*
+GetLogger - returns the logger
+*/
+func credMatcher(headerName string) (mdName string, ok bool) {
+	if headerName == "Login" || headerName == "Password" {
+		return headerName, true
+	}
+	return "", false
+}
+
+// authenticateAgent check the client credentials
+func authenticateClient(ctx context.Context, s *api.Server) (string, error) {
+	if md, ok := metadata.FromIncomingContext(ctx); ok {
+		clientLogin := strings.Join(md["login"], "")
+		clientPassword := strings.Join(md["password"], "")
+
+		if clientLogin != "john" {
+			return "", fmt.Errorf("unknown user %s", clientLogin)
+		}
+		if clientPassword != "doe" {
+			return "", fmt.Errorf("bad password %s", clientPassword)
+		}
+
+		log.Printf("authenticated client: %s", clientLogin)
+		return "42", nil
+	}
+	return "", fmt.Errorf("missing credentials")
+}
+
+// unaryInterceptor call authenticateClient with current context
+func unaryInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) {
+	s, ok := info.Server.(*api.Server)
+	if !ok {
+		return nil, fmt.Errorf("unable to cast server")
+	}
+	clientID, err := authenticateClient(ctx, s)
+	if err != nil {
+		return nil, err
+	}
+
+	ctx = context.WithValue(ctx, clientIDKey, clientID)
+	return handler(ctx, req)
+}
+
+func startGRPCServer(address, certFile, keyFile string) error {
+	// create a listener on TCP port
+	lis, err := net.Listen("tcp", address)
+	if err != nil {
+		return fmt.Errorf("failed to listen: %v", err)
+	}
+
+	// create a server instance
+	s := api.Server{}
+
+	// Create the TLS credentials
+	creds, err := credentials.NewServerTLSFromFile(certFile, keyFile)
+	if err != nil {
+		return fmt.Errorf("could not load TLS keys: %s", err)
+	}
+
+	// Create an array of gRPC options with the credentials
+	opts := []grpc.ServerOption{grpc.Creds(creds),
+		grpc.UnaryInterceptor(unaryInterceptor)}
+
+	// create a gRPC server object
+	grpcServer := grpc.NewServer(opts...)
+
+	// attach the Ping service to the server
+	api.RegisterAddChassisServer(grpcServer, &s)
+	api.RegisterAddOLTChassisServer(grpcServer, &s)
+
+	// start the server
+	log.Printf("starting HTTP/2 gRPC server on %s", address)
+	if err := grpcServer.Serve(lis); err != nil {
+		return fmt.Errorf("failed to serve: %s", err)
+	}
+
+	return nil
+}
+func startRESTServer(address, grpcAddress, certFile string) error {
+	ctx := context.Background()
+	ctx, cancel := context.WithCancel(ctx)
+	defer cancel()
+
+	mux := runtime.NewServeMux(runtime.WithIncomingHeaderMatcher(credMatcher))
+	creds, err := credentials.NewClientTLSFromFile(certFile, "")
+	if err != nil {
+		return fmt.Errorf("could not load TLS certificate: %s", err)
+	}
+
+	// Setup the client gRPC options
+	opts := []grpc.DialOption{grpc.WithTransportCredentials(creds)}
+	err = api.RegisterAddChassisHandlerFromEndpoint(ctx, mux, grpcAddress, opts)
+	_ = api.RegisterAddOLTChassisHandlerFromEndpoint(ctx, mux, grpcAddress, opts)
+	if err != nil {
+		return fmt.Errorf("could not register service Ping: %s", err)
+	}
+
+	log.Printf("starting HTTP/1.1 REST server on %s", address)
+	http.ListenAndServe(address, mux)
+
+	return nil
+}
+func main() {
+	debugPtr := flag.Bool("d", false, "Log Level Debug")
+	flag.Parse()
+	settings.SetDebug(*debugPtr)
+
+	file, err := os.OpenFile("AbstractOLT.log", os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0666)
+	if err != nil {
+		log.Fatalln("Failed to open log file", file, ":", err)
+	}
+	log.SetOutput(file)
+	log.SetFlags(log.Ldate | log.Ltime | log.Lmicroseconds | log.Lshortfile)
+	log.Printf("Setting Debug to %t\n", settings.GetDebug())
+
+	grpcAddress := fmt.Sprintf("%s:%d", "AbstractOLT.dev.atl.foundry.att.com", 7777)
+	restAddress := fmt.Sprintf("%s:%d", "AbstractOLT.dev.atl.foundry.att.com", 7778)
+	certFile := "cert/server.crt"
+	keyFile := "cert/server.key"
+
+	// fire the gRPC server in a goroutine
+	go func() {
+		err := startGRPCServer(grpcAddress, certFile, keyFile)
+		if err != nil {
+			log.Fatalf("failed to start gRPC server: %s", err)
+		}
+	}()
+
+	// fire the REST server in a goroutine
+	go func() {
+		err := startRESTServer(restAddress, grpcAddress, certFile)
+		if err != nil {
+			log.Fatalf("failed to start gRPC server: %s", err)
+		}
+	}()
+
+	// infinite loop
+	log.Printf("Entering infinite loop")
+	select {}
+	fmt.Println("AbstractOLT")
+}
diff --git a/internal/pkg/chassisSerialize/serialize.go b/internal/pkg/chassisSerialize/serialize.go
new file mode 100644
index 0000000..6e947a5
--- /dev/null
+++ b/internal/pkg/chassisSerialize/serialize.go
@@ -0,0 +1,47 @@
+/*
+   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 chassisSerialize
+
+import (
+	"encoding/json"
+
+	"gerrit.opencord.org/abstract-olt/models/abstract"
+)
+
+func Serialize(chassis *abstract.Chassis) ([]byte, error) {
+	return json.Marshal(chassis)
+}
+
+func Deserialize(jsonData []byte) (*abstract.Chassis, error) {
+	var chassis abstract.Chassis
+	err := json.Unmarshal(jsonData, &chassis)
+
+	for i := 0; i < len(chassis.Slots); i++ {
+		var slot *abstract.Slot
+		slot = &chassis.Slots[i]
+		slot.Parent = &chassis
+		for j := 0; j < len(slot.Ports); j++ {
+			var port *abstract.Port
+			port = &slot.Ports[j]
+			port.Parent = slot
+			for k := 0; k < len(port.Onts); k++ {
+				port.Onts[k].Parent = port
+			}
+		}
+	}
+
+	return &chassis, err
+}
diff --git a/internal/pkg/settings/Settings.go b/internal/pkg/settings/Settings.go
new file mode 100644
index 0000000..f1f7f72
--- /dev/null
+++ b/internal/pkg/settings/Settings.go
@@ -0,0 +1,33 @@
+/*
+   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 settings
+
+var debug = false
+
+/*
+SetDebug - sets debug setting
+*/
+func SetDebug(logDebug bool) {
+	debug = logDebug
+}
+
+/*
+GetDebug returns debug setting
+*/
+func GetDebug() bool {
+	return debug
+}
diff --git a/models/abstract/ChassisUtils.go b/models/abstract/ChassisUtils.go
new file mode 100644
index 0000000..4c41698
--- /dev/null
+++ b/models/abstract/ChassisUtils.go
@@ -0,0 +1,105 @@
+/*
+   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 abstract
+
+import "errors"
+
+/*
+GenerateChassis - constructs a new AbstractOLT Chassis
+*/
+func GenerateChassis(CLLI string) *Chassis {
+	chassis := Chassis{CLLI: CLLI}
+
+	var slots [16]Slot
+	for i := 0; i < 16; i++ {
+		slots[i] = generateSlot(i, &chassis)
+	}
+
+	chassis.Slots = slots
+	return &chassis
+}
+
+func generateSlot(n int, c *Chassis) Slot {
+	slot := Slot{Number: n, Parent: c}
+
+	var ports [16]Port
+	for i := 0; i < 16; i++ {
+		ports[i] = generatePort(i, &slot)
+	}
+
+	slot.Ports = ports
+	return slot
+}
+func generatePort(n int, s *Slot) Port {
+	port := Port{Number: n, Parent: s}
+
+	var onts [64]Ont
+	for i := 0; i < 64; 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}
+	}
+
+	port.Onts = onts
+	return port
+}
+
+func calculateCvlan(slot int, port int, ont int) int {
+	ontPortOffset := 120 // Max(ONT_SLOT) * Max(ONT_PORT) = 10 * 12 = 120
+	ontSlotOffset := 12  //= Max(ONT_PORT) = 12
+	vlanOffset := 1      //(VID 1 is reserved)
+
+	cVid := ((ont-1)%32)*ontPortOffset +
+		(slot-1)*ontSlotOffset + port + vlanOffset
+
+	return cVid
+}
+
+func calculateSvlan(slot int, port int, ont int) int {
+	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
+
+	return sVid
+}
+
+/*
+NextPort pulls the first unMapped port in the abstract chassis so the next physical port can be mapped to it
+*/
+func (chassis *Chassis) NextPort() (*Port, error) {
+	info := &chassis.AllocInfo
+
+	if info.outOfPorts {
+		return nil, errors.New("Abstract chassis out of ports")
+	}
+
+	nextPort := &chassis.Slots[info.slot].Ports[info.port]
+
+	info.port++
+	if info.port == MAX_PORTS {
+		info.port = 0
+		info.slot++
+		if info.slot == MAX_SLOTS {
+			info.slot = 0
+			info.outOfPorts = true
+		}
+	}
+
+	return nextPort, nil
+}
diff --git a/models/abstract/chassis.go b/models/abstract/chassis.go
new file mode 100644
index 0000000..52de90d
--- /dev/null
+++ b/models/abstract/chassis.go
@@ -0,0 +1,36 @@
+/*
+   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 abstract
+
+const MAX_SLOTS int = 16
+const MAX_PORTS int = 16
+
+/*
+Chassis is a model that takes up to 16 discreet OLT chassis as if it is a 16 slot OLT chassis
+*/
+type Chassis struct {
+	CLLI      string
+	Slots     [16]Slot
+	AllocInfo PortAllocationInfo
+}
+
+type PortAllocationInfo struct {
+	// Current info on next port to be allocated
+	slot       int
+	port       int
+	outOfPorts bool
+}
diff --git a/models/abstract/ont.go b/models/abstract/ont.go
new file mode 100644
index 0000000..bfd6d60
--- /dev/null
+++ b/models/abstract/ont.go
@@ -0,0 +1,27 @@
+/*
+   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 abstract
+
+/*
+Ont represents a single ont/onu connect to a splitter on a Port
+*/
+type Ont struct {
+	Number int
+	Svlan  int
+	Cvlan  int
+	Parent *Port `json:"-"`
+}
diff --git a/models/abstract/port.go b/models/abstract/port.go
new file mode 100644
index 0000000..c23249a
--- /dev/null
+++ b/models/abstract/port.go
@@ -0,0 +1,30 @@
+/*
+   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 abstract
+
+import "gerrit.opencord.org/abstract-olt/models/physical"
+
+/*
+Port represents a single PON port on the OLT chassis
+*/
+type Port struct {
+	Number int
+	// DeviceID string
+	Onts     [64]Ont
+	PhysPort *physical.PONPort
+	Parent   *Slot `json:"-"`
+}
diff --git a/models/abstract/slot.go b/models/abstract/slot.go
new file mode 100644
index 0000000..343542e
--- /dev/null
+++ b/models/abstract/slot.go
@@ -0,0 +1,30 @@
+/*
+   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 abstract
+
+/*
+Slot models a collection of PON ports (likely a single chassis) as if it is a
+line card within a chassis
+*/
+type Slot struct {
+	// DeviceID string
+	// Hostname string
+	// Address  net.TCPAddr
+	Number int
+	Ports  [16]Port
+	Parent *Chassis `json:"-"`
+}
diff --git a/models/chassisMap.go b/models/chassisMap.go
new file mode 100644
index 0000000..30ae8e3
--- /dev/null
+++ b/models/chassisMap.go
@@ -0,0 +1,53 @@
+/*
+   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 models
+
+import (
+	"fmt"
+
+	"gerrit.opencord.org/abstract-olt/models/abstract"
+	"gerrit.opencord.org/abstract-olt/models/physical"
+)
+
+var chassisMap map[string]*physical.Chassis
+var abstractChassisMap map[string]*abstract.Chassis
+
+/*
+GetPhyChassisMap return the chassis map singleton
+*/
+func GetPhyChassisMap() *map[string]*physical.Chassis {
+	if chassisMap == nil {
+		fmt.Println("chassisMap was nil")
+		chassisMap = make(map[string]*physical.Chassis)
+
+	}
+	fmt.Printf("chassis map %v\n", chassisMap)
+	return &chassisMap
+}
+
+/*
+GetAbstractChassisMap return the chassis map singleton
+*/
+func GetAbstractChassisMap() *map[string]*abstract.Chassis {
+	if abstractChassisMap == nil {
+		fmt.Println("chassisMap was nil")
+		abstractChassisMap = make(map[string]*abstract.Chassis)
+
+	}
+	fmt.Printf("chassis map %v\n", chassisMap)
+	return &abstractChassisMap
+}
diff --git a/models/physical/chassis.go b/models/physical/chassis.go
new file mode 100644
index 0000000..339a610
--- /dev/null
+++ b/models/physical/chassis.go
@@ -0,0 +1,29 @@
+/*
+   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 physical
+
+import "net"
+
+/*
+Chassis is a model that takes up to 16 discreet OLT chassis as if it is a 16 slot OLT chassis
+*/
+type Chassis struct {
+	CLLI         string
+	VCoreAddress net.TCPAddr
+	Dataswitch   DataSwitch
+	Linecards    []OLT
+}
diff --git a/models/physical/dataswitch.go b/models/physical/dataswitch.go
new file mode 100644
index 0000000..9146e7f
--- /dev/null
+++ b/models/physical/dataswitch.go
@@ -0,0 +1,30 @@
+/*
+   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 physical
+
+import "net"
+
+type DataSwitch struct {
+	Ports        [32]EthPort
+	Driver       string
+	Ipv4Loopback net.TCPAddr
+	Ipv4NodeSid  int
+	isEdgeRouter bool
+	Name         string
+	OfId         string
+	RouterMac    string
+}
diff --git a/models/physical/edgecore.go b/models/physical/edgecore.go
new file mode 100644
index 0000000..196d44e
--- /dev/null
+++ b/models/physical/edgecore.go
@@ -0,0 +1,34 @@
+/*
+   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 physical
+
+/*
+Edgecore Implements the Edgecore linecard as an OLT
+*/
+type Edgecore struct {
+	SimpleOLT
+}
+
+/*
+CreateEdgecore takes simple olt struct and generates Edgecore OLT
+*/
+func CreateEdgecore(olt *SimpleOLT) *Edgecore {
+	var newPorts [16]PONPort
+	edge := Edgecore{SimpleOLT: *olt}
+	edge.Ports = newPorts[:]
+	return &edge
+}
diff --git a/models/physical/ethdevice.go b/models/physical/ethdevice.go
new file mode 100644
index 0000000..979edb2
--- /dev/null
+++ b/models/physical/ethdevice.go
@@ -0,0 +1,27 @@
+/*
+   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 physical
+
+/*
+EthDevice represents a device with an ethernet port
+*/
+type EthDevice interface {
+}
+
+type EthPort struct {
+	Connected *EthDevice
+}
diff --git a/models/physical/olt.go b/models/physical/olt.go
new file mode 100644
index 0000000..3c2094d
--- /dev/null
+++ b/models/physical/olt.go
@@ -0,0 +1,74 @@
+/*
+   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 physical
+
+import "net"
+
+/*
+Represents an arbitrary OLT linecard
+*/
+type OLT interface {
+	GetCLLI() string
+	GetHostname() string
+	GetAddress() net.TCPAddr
+	GetNumber() int
+	GetPorts() []PONPort
+	GetParent() *Chassis
+	GetDataSwitchPort() int
+}
+
+/*
+A basic representation of an OLT which fulfills the above interface,
+and can be used in other OLT implementations
+*/
+type SimpleOLT struct {
+	CLLI           string
+	Hostname       string
+	Address        net.TCPAddr
+	Number         int
+	Ports          []PONPort
+	Parent         *Chassis `json:"-"`
+	DataSwitchPort int
+}
+
+func (s *SimpleOLT) GetCLLI() string {
+	return s.CLLI
+}
+
+func (s *SimpleOLT) GetHostname() string {
+	return s.Hostname
+}
+
+func (s *SimpleOLT) GetAddress() net.TCPAddr {
+	return s.Address
+}
+
+func (s *SimpleOLT) GetNumber() int {
+	return s.Number
+}
+
+func (s *SimpleOLT) GetPorts() []PONPort {
+	return s.Ports
+}
+
+func (s *SimpleOLT) GetParent() *Chassis {
+	return s.Parent
+}
+
+func (s *SimpleOLT) GetDataSwitchPort() int {
+	return s.DataSwitchPort
+}
diff --git a/models/physical/ont.go b/models/physical/ont.go
new file mode 100644
index 0000000..4bd47ac
--- /dev/null
+++ b/models/physical/ont.go
@@ -0,0 +1,27 @@
+/*
+   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 physical
+
+/*
+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:"-"`
+}
diff --git a/models/physical/ponport.go b/models/physical/ponport.go
new file mode 100644
index 0000000..99c282a
--- /dev/null
+++ b/models/physical/ponport.go
@@ -0,0 +1,27 @@
+/*
+   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 physical
+
+/*
+Port represents a single PON port on the OLT chassis
+*/
+type PONPort struct {
+	Number   int
+	DeviceID string
+	Onts     [64]Ont
+	Parent   *Edgecore `json:"-"`
+}
diff --git a/scripts/build.sh b/scripts/build.sh
new file mode 100755
index 0000000..6cb7d72
--- /dev/null
+++ b/scripts/build.sh
@@ -0,0 +1,24 @@
+#
+#   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.
+#
+
+#! /bin/bash
+
+protoc -I api/ \
+-I${GOPATH}/src \
+--go_out=plugins=grpc:api \
+api/abstract_olt_api.proto
+
+go build cmd/AbstractOLT/AbstractOLT.go
diff --git a/test/integration/TestUtils.go b/test/integration/TestUtils.go
new file mode 100644
index 0000000..52a1348
--- /dev/null
+++ b/test/integration/TestUtils.go
@@ -0,0 +1,52 @@
+/*
+   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 integration
+
+import (
+	"fmt"
+	"path/filepath"
+	"reflect"
+	"runtime"
+	"testing"
+)
+
+// assert fails the test if the condition is false.
+func assert(tb testing.TB, condition bool, msg string, v ...interface{}) {
+	if !condition {
+		_, file, line, _ := runtime.Caller(1)
+		fmt.Printf("\033[31m%s:%d: "+msg+"\033[39m\n\n", append([]interface{}{filepath.Base(file), line}, v...)...)
+		tb.FailNow()
+	}
+}
+
+// ok fails the test if an err is not nil.
+func ok(tb testing.TB, err error) {
+	if err != nil {
+		_, file, line, _ := runtime.Caller(1)
+		fmt.Printf("\033[31m%s:%d: unexpected error: %s\033[39m\n\n", filepath.Base(file), line, err.Error())
+		tb.FailNow()
+	}
+}
+
+// equals fails the test if exp is not equal to act.
+func equals(tb testing.TB, exp, act interface{}) {
+	if !reflect.DeepEqual(exp, act) {
+		_, file, line, _ := runtime.Caller(1)
+		fmt.Printf("\033[31m%s:%d:\n\n\texp: %#v\n\n\tgot: %#v\033[39m\n\n", filepath.Base(file), line, exp, act)
+		tb.FailNow()
+	}
+}
diff --git a/test/integration/serialize_test.go b/test/integration/serialize_test.go
new file mode 100644
index 0000000..9e8575f
--- /dev/null
+++ b/test/integration/serialize_test.go
@@ -0,0 +1,82 @@
+/*
+   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 integration
+
+import (
+	"net"
+	"testing"
+
+	"gerrit.opencord.org/abstract-olt/internal/pkg/chassisSerialize"
+	"gerrit.opencord.org/abstract-olt/models/abstract"
+)
+
+func TestSerialize(t *testing.T) {
+	chassis1 := generateTestChassis()
+	bytes1, err1 := chassisSerialize.Serialize(chassis1)
+	chassis2, err2 := chassisSerialize.Deserialize(bytes1)
+	bytes2, err3 := chassisSerialize.Serialize(chassis2)
+	chassis3, err4 := chassisSerialize.Deserialize(bytes2)
+
+	ok(t, err1)
+	ok(t, err2)
+	ok(t, err3)
+	ok(t, err4)
+	equals(t, chassis1, chassis3)
+	equals(t, chassis3.Slots[2].Parent, chassis3)
+	equals(t, chassis3.Slots[15].Ports[8].Parent, &chassis3.Slots[15])
+	equals(t, chassis3.Slots[0].Ports[10].Onts[15].Parent, &chassis3.Slots[0].Ports[10])
+}
+
+func generateTestChassis() *abstract.Chassis {
+	addr := net.TCPAddr{IP: net.IPv4(1, 2, 3, 4), Port: 500, Zone: "VCore ZONE"}
+	chassis := abstract.Chassis{VCoreAddress: addr, CLLI: "CLLI STRING"}
+
+	var slots [16]abstract.Slot
+	for i := 0; i < 16; i++ {
+		slots[i] = generateTestSlot(i, &chassis)
+	}
+
+	chassis.Slots = slots
+	return &chassis
+}
+
+func generateTestSlot(n int, c *abstract.Chassis) abstract.Slot {
+	addr := net.TCPAddr{IP: net.IPv4(1, 2, 3, byte(n)), Port: 400 + n, Zone: "Slot " + string(n) + "Zone"}
+	slot := abstract.Slot{DeviceID: "Device Slot " + string(n), Hostname: "Host " + string(n),
+		Address: addr, Number: n, Parent: c}
+
+	var ports [16]abstract.Port
+	for i := 0; i < 16; i++ {
+		ports[i] = generateTestPort(16*n+i, &slot)
+	}
+
+	slot.Ports = ports
+	return slot
+}
+
+func generateTestPort(n int, s *abstract.Slot) abstract.Port {
+	port := abstract.Port{Number: n, DeviceID: "Device Port " + string(n), Parent: s}
+
+	var onts [64]abstract.Ont
+	for i := 0; i < 64; i++ {
+		j := n*64 + i
+		onts[i] = abstract.Ont{Number: j, Svlan: j * 10, Cvlan: j*10 + 5, Parent: &port}
+	}
+
+	port.Onts = onts
+	return port
+}