VOL-2463 : Enable/Disable ports changes, Adding IAdapter changes in pyvoltha
Change-Id: I97ad8970ecd5db00399994babc7f48b4be785059
diff --git a/VERSION b/VERSION
index 5aa7c52..9fa5f12 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2.3.9
+2.3.10
diff --git a/pyvoltha/adapters/interface.py b/pyvoltha/adapters/interface.py
index e7ba52e..e5f8e00 100644
--- a/pyvoltha/adapters/interface.py
+++ b/pyvoltha/adapters/interface.py
@@ -162,6 +162,28 @@
:return: (Deferred) OperationResponse object.
"""
+ def enable_port(device_id, port):
+ """
+ This is called to enable the specified port.
+
+ Depending on the implementation, this call may or may
+ not cause port enable.
+ This call is expected to be non-blocking.
+ :param device_id: A voltha.Device.id object.
+ :param port: A voltha.Port object
+ """
+
+ def disable_port(device_id, port):
+ """
+ This is called to disable the specified port.
+
+ Depending on the implementation, this call may or may
+ not cause port disable.
+ This call is expected to be non-blocking.
+ :param device_id: A voltha.Device.id object.
+ :param port: A voltha.Port object
+ """
+
def self_test_device(device):
"""
This is called to Self a device based on a NBI call.
diff --git a/pyvoltha/adapters/kafka/adapter_request_facade.py b/pyvoltha/adapters/kafka/adapter_request_facade.py
index b2356ba..4780153 100644
--- a/pyvoltha/adapters/kafka/adapter_request_facade.py
+++ b/pyvoltha/adapters/kafka/adapter_request_facade.py
@@ -27,7 +27,7 @@
from afkak.consumer import OFFSET_LATEST, OFFSET_EARLIEST
from pyvoltha.adapters.interface import IAdapterInterface
from voltha_protos.inter_container_pb2 import IntType, InterAdapterMessage, StrType, Error, ErrorCode
-from voltha_protos.device_pb2 import Device, ImageDownload, SimulateAlarmRequest
+from voltha_protos.device_pb2 import Device, Port, ImageDownload, SimulateAlarmRequest
from voltha_protos.openflow_13_pb2 import FlowChanges, FlowGroups, Flows, \
FlowGroupChanges, ofp_packet_out
from pyvoltha.adapters.kafka.kafka_inter_container_library import IKafkaMessagingProxy, \
@@ -248,6 +248,31 @@
return True, self.adapter.revert_image_update(device, request)
+ def enable_port(self, device_id, port, **kwargs):
+ if not device_id:
+ return False, Error(code=ErrorCode.INVALID_PARAMETER,
+ reason="device")
+ p = Port()
+ if port:
+ port.Unpack(p)
+ else:
+ return False, Error(code=ErrorCode.INVALID_PARAMETERS,
+ reason="port-invalid")
+
+ return (True, self.adapter.enable_port(device_id, port))
+
+ def disable_port(self, device_id, port, **kwargs):
+ if not device_id:
+ return False, Error(code=ErrorCode.INVALID_PARAMETER,
+ reason="device")
+ p = Port()
+ if port:
+ port.Unpack(p)
+ else:
+ return False, Error(code=ErrorCode.INVALID_PARAMETERS,
+ reason="port-invalid")
+
+ return (True, self.adapter.disable_port(device_id, port))
def self_test(self, device, **kwargs):
return self.adapter.self_test_device(device)