VOL-2029: Fix for OLT delete device.
Don't call core to get child device as onu might not exist during delete of parent device.
This would cause delays in delete and leaks with not releasing uniport resources.
Add the uni port to device handler for OLT when the uniport resources are allocated while adding flows.
Clear the uni port resources allocated during delete of olt device.
Also ensure the resources for the PON port are deleted in the background since the olt device delete
needs to finish within transaction timeout (8 seconds by default) and this can be time consuming.

Make the call to add uniPort to the ONU device after trap-nni flows.
make sca fixes to comment exported function.
And also change the uniPorts from array to a map for the onu device.

Change-Id: I4889032eab9c72acd64b5f553d5507c4d3bb00da
(cherry picked from commit bcdef458a348e0f6312c2e08221f5488fdec9ad4)
2 files changed
tree: 17d9521faf8c71ab4d6039fe03ccbc4a842bafcb
  1. .gitignore
  2. .golangci.yml
  3. Gopkg.lock
  4. Gopkg.toml
  5. Makefile
  6. README.md
  8. adaptercore/
  9. compose/
  10. config/
  11. docker/
  12. main.go
  13. main_test.go
  14. mocks/
  15. vendor/

How to Build and Run a GOlang based OpenOLT Adapter

Assuming the VOLTHA2.0 environment is made using the quickstart.md in voltha-go.

Dependencies are committed to the repos as per current standard practice. If you need to update them you can do so with dep. This includes the voltha-protos and voltha-go dependencies.

Ensure your GOPATH variable is set according to the quickstart Create a symbolic link in the $GOPATH/src tree to the voltha-openolt-adapter repository:

mkdir -p $GOPATH/src/github.com/opencord
ln -s ~/repos/voltha-openolt-adapter $GOPATH/src/github.com/opencord/voltha-openolt-adapter

Install dep for fetching dependencies

mkdir -p $GOPATH/bin
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh

Pull and build dependencies for the project.  This may take a while.  This may likely update versions of 3rd party packages in the vendor folder.   This may introduce unexpected changes.   If everything still works feel free to check in the vendor updates as needed.

cd $GOPATH/src/github.com/opencord/voltha-go/
dep ensure

If you are using a custom local copy of protos or voltha-go

Just export LOCAL_PROTOS=true or LOCAL_VOLTHAGO=true to use that instead, assuming you have set them up on GOPATH. See the quickstart.

mkdir -p ~/source
cd ~/source
git clone https://github.com/opencord/voltha-openolt-adapter.git
cd voltha-openolt-adapter
make build

This will create the voltha-openolt-adapter-go docker image

$ docker images | grep openolt voltha-openolt-adapter latest a0f2ba883655 5 seconds ago 842MB voltha-openolt-adapter latest-py a0f2ba883655 5 seconds ago 842MB voltha-openolt-adapter latest-go 801070129648 About a minute ago 34.5MB

In case the python voltha openolt adapter is started, stop the python voltha openolt docker container

To start the GOlang based OpenOLT adapter

cd ~/source/voltha-go
docker-compose -f compose/system-test-openolt-go.yml up -d

To start the Python based adapter based OpenOLT adapter

cd ~/source/voltha-go
docker-compose -f compose/system-test.yml up -d

The functionality of OLT activation can be verified through BBSIM Follow the below steps to start BBSIM and provision it through VOLTHA-CLI https://github.com/opencord/voltha-bbsim/blob/master/README.md