[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/core/device/remote/adapter_proxy.go b/rw_core/core/device/remote/adapter_proxy.go
index 4cbb363..6bb318b 100755
--- a/rw_core/core/device/remote/adapter_proxy.go
+++ b/rw_core/core/device/remote/adapter_proxy.go
@@ -166,21 +166,6 @@
return ap.sendRPC(ctx, rpc, toTopic, &replyToTopic, true, device.Id, args...)
}
-// GetOfpPortInfo invokes get ofp port info rpc
-func (ap *AdapterProxy) GetOfpPortInfo(ctx context.Context, device *voltha.Device, portNo uint32) (chan *kafka.RpcResponse, error) {
- logger.Debugw("GetOfpPortInfo", log.Fields{"device-id": device.Id, "port-no": portNo})
- toTopic, err := ap.getAdapterTopic(device.Id, device.Adapter)
- if err != nil {
- return nil, err
- }
- args := []*kafka.KVArg{
- {Key: "device", Value: device},
- {Key: "port_no", Value: &ic.IntType{Val: int64(portNo)}},
- }
- replyToTopic := ap.getCoreTopic()
- return ap.sendRPC(ctx, "get_ofp_port_info", toTopic, &replyToTopic, true, device.Id, args...)
-}
-
// ReconcileDevice invokes reconcile device rpc
func (ap *AdapterProxy) ReconcileDevice(ctx context.Context, device *voltha.Device) (chan *kafka.RpcResponse, error) {
logger.Debugw("ReconcileDevice", log.Fields{"device-id": device.Id})
diff --git a/rw_core/core/device/remote/adapter_proxy_test.go b/rw_core/core/device/remote/adapter_proxy_test.go
index 17627dc..b9755c7 100755
--- a/rw_core/core/device/remote/adapter_proxy_test.go
+++ b/rw_core/core/device/remote/adapter_proxy_test.go
@@ -178,24 +178,6 @@
assert.Equal(t, switchCap.String(), expectedCap.String())
}
-func testGetPortInfoFromAdapter(t *testing.T) {
- ap := NewAdapterProxy(coreKafkaICProxy, coreName, mock_kafka.NewEndpointManager())
- d := &voltha.Device{Id: "deviceId", Adapter: adapterName}
- ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)
- defer cancel()
- portNo := uint32(1)
- rpcResponse, err := ap.GetOfpPortInfo(ctx, d, portNo)
- assert.Nil(t, err)
- response, err := waitForResponse(ctx, rpcResponse)
- assert.Nil(t, err)
- portCap := &ic.PortCapability{}
- err = ptypes.UnmarshalAny(response, portCap)
- assert.Nil(t, err)
- assert.NotNil(t, portCap)
- expectedPortInfo, _ := adapter.Get_ofp_port_info(d, int64(portNo))
- assert.Equal(t, portCap.String(), expectedPortInfo.String())
-}
-
func testPacketOut(t *testing.T) {
ap := NewAdapterProxy(coreKafkaICProxy, coreName, mock_kafka.NewEndpointManager())
d := &voltha.Device{Id: "deviceId", Adapter: adapterName}
@@ -243,15 +225,12 @@
//2. Test get switch capability
testGetSwitchCapabilityFromAdapter(t)
- //3. Test get port info
- testGetPortInfoFromAdapter(t)
-
- //4. Test PacketOut
+ //3. Test PacketOut
testPacketOut(t)
- // 5. Test flow updates
+ //4. Test flow updates
testFlowUpdates(t)
- //6. Pm configs
+ //5. Pm configs
testPmUpdates(t)
}