[VOL-1524] Use port labels as port IDs
This commit consists of the following:
1) Update the simulated OLT and ONU adapters to set the port label
using the port number
2) Update the ponsim OLT and ONU adapters to set the port label
using the port number.
3) Update the logic to verify whether a logical port exist using
the port label.
4) Update the logical device lock when adding a port to the logical
device to prevent two requests to add the same port from
occuring in parallel.
Change-Id: Ia5a732db1f3fc6e559acd7e70ae9659113b6fa9f
diff --git a/adapters/simulated_olt/adaptercore/device_handler.go b/adapters/simulated_olt/adaptercore/device_handler.go
index b83f265..e7a86ac 100644
--- a/adapters/simulated_olt/adaptercore/device_handler.go
+++ b/adapters/simulated_olt/adaptercore/device_handler.go
@@ -17,6 +17,7 @@
import (
"context"
+ "fmt"
"github.com/gogo/protobuf/proto"
com "github.com/opencord/voltha-go/adapters/common"
"github.com/opencord/voltha-go/common/log"
@@ -107,7 +108,7 @@
// Now create the NNI Port
dh.nniPort = &voltha.Port{
PortNo: 2,
- Label: "NNI facing Ethernet port",
+ Label: fmt.Sprintf("nni-%d", 2),
Type: voltha.Port_ETHERNET_NNI,
OperStatus: voltha.OperStatus_ACTIVE,
}
@@ -120,7 +121,7 @@
// Now create the PON Port
dh.ponPort = &voltha.Port{
PortNo: 1,
- Label: "PON port",
+ Label: fmt.Sprintf("pon-%d", 1),
Type: voltha.Port_PON_OLT,
OperStatus: voltha.OperStatus_ACTIVE,
}