[VOL-3245] Consume port capability on port creation
This commit consists of the changes needed in the Core to build
a logical port without having to request port capability from
the adapters.
This commit requires changes in the OLT and ONU adapters to be
completed. These are tracked under jira
https://jira.opencord.org/browse/VOL-3202. Until the adapters
changes are committed this commit will not pass jenkins.
Change-Id: I0cae167375b9a8c67a83202e25abcec6ae013a88
diff --git a/rw_core/mocks/adapter_olt.go b/rw_core/mocks/adapter_olt.go
index 61f431a..c567e40 100644
--- a/rw_core/mocks/adapter_olt.go
+++ b/rw_core/mocks/adapter_olt.go
@@ -60,11 +60,22 @@
if res := oltA.coreProxy.DeviceUpdate(context.TODO(), d); res != nil {
logger.Fatalf("deviceUpdate-failed-%s", res)
}
+ capability := uint32(of.OfpPortFeatures_OFPPF_1GB_FD | of.OfpPortFeatures_OFPPF_FIBER)
nniPort := &voltha.Port{
PortNo: 2,
Label: fmt.Sprintf("nni-%d", 2),
Type: voltha.Port_ETHERNET_NNI,
OperStatus: voltha.OperStatus_ACTIVE,
+ OfpPort: &of.OfpPort{
+ HwAddr: macAddressToUint32Array("11:22:33:44:55:66"),
+ Config: 0,
+ State: uint32(of.OfpPortState_OFPPS_LIVE),
+ Curr: capability,
+ Advertised: capability,
+ Peer: capability,
+ CurrSpeed: uint32(of.OfpPortFeatures_OFPPF_1GB_FD),
+ MaxSpeed: uint32(of.OfpPortFeatures_OFPPF_1GB_FD),
+ },
}
var err error
if err = oltA.coreProxy.PortCreated(context.TODO(), d.Id, nniPort); err != nil {
@@ -138,30 +149,6 @@
}, nil
}
-// Get_ofp_port_info returns ofp port info
-func (oltA *OLTAdapter) Get_ofp_port_info(device *voltha.Device, portNo int64) (*ic.PortCapability, error) { // nolint
- if d := oltA.getDevice(device.Id); d == nil {
- logger.Fatalf("device-not-found-%s", device.Id)
- }
- capability := uint32(of.OfpPortFeatures_OFPPF_1GB_FD | of.OfpPortFeatures_OFPPF_FIBER)
- return &ic.PortCapability{
- Port: &voltha.LogicalPort{
- OfpPort: &of.OfpPort{
- HwAddr: macAddressToUint32Array("11:22:33:44:55:66"),
- Config: 0,
- State: uint32(of.OfpPortState_OFPPS_LIVE),
- Curr: capability,
- Advertised: capability,
- Peer: capability,
- CurrSpeed: uint32(of.OfpPortFeatures_OFPPF_1GB_FD),
- MaxSpeed: uint32(of.OfpPortFeatures_OFPPF_1GB_FD),
- },
- DeviceId: device.Id,
- DevicePortNo: uint32(portNo),
- },
- }, nil
-}
-
// GetNumONUPerOLT returns number of ONUs per OLT
func (oltA *OLTAdapter) GetNumONUPerOLT() int {
return numONUPerOLT