VOL-409 Update port operational status and delete port
Change-Id: I6475eb69df34b53941604a818f7148e007bedd7b
diff --git a/voltha/core/adapter_agent.py b/voltha/core/adapter_agent.py
index 02bc395..95fb4d6 100644
--- a/voltha/core/adapter_agent.py
+++ b/voltha/core/adapter_agent.py
@@ -408,6 +408,12 @@
ports = self.root_proxy.get('/devices/{}/ports'.format(device_id))
return [p for p in ports if p.type == port_type]
+ def delete_port(self, device_id, port):
+ assert isinstance(port, Port)
+ # for referential integrity, add/augment references
+ self._del_peer_reference(device_id, port)
+ # Delete port
+ self._remove_node('/devices/{}/ports'.format(device_id), port.port_no)
def disable_all_ports(self, device_id):
"""
@@ -441,6 +447,13 @@
self._make_up_to_date('/devices/{}/ports'.format(device_id),
port.port_no, port)
+ def update_operstatus_all_ports(self, device_id, oper_status):
+ ports = self.root_proxy.get('/devices/{}/ports'.format(device_id))
+ for port in ports:
+ port.oper_status = oper_status
+ self._make_up_to_date('/devices/{}/ports'.format(device_id),
+ port.port_no, port)
+
def delete_all_peer_references(self, device_id):
"""
Remove all peer port references for that device
@@ -570,12 +583,15 @@
self._remove_node('/logical_devices/{}/ports'.format(
logical_device_id), port.id)
+ def delete_logical_port_by_id(self, logical_device_id, port_id):
+ self._remove_node('/logical_devices/{}/ports'.format(
+ logical_device_id), port_id)
+
def update_logical_port(self, logical_device_id, port):
assert isinstance(port, LogicalPort)
self.log.debug('update-logical-port',
logical_device_id=logical_device_id,
port=port)
-
self._make_up_to_date(
'/logical_devices/{}/ports'.format(logical_device_id),
port.id, port)
@@ -704,7 +720,7 @@
for child_id in children_ids:
device = self.get_device(child_id)
- if oper_status:
+ if oper_status is not None:
device.oper_status = oper_status
if connect_status:
device.connect_status = connect_status
diff --git a/voltha/protos/events.proto b/voltha/protos/events.proto
index c6d8979..8bffae9 100644
--- a/voltha/protos/events.proto
+++ b/voltha/protos/events.proto
@@ -71,6 +71,8 @@
message AlarmEventCategory {
enum AlarmEventCategory {
PON = 0;
+ OLT = 1;
+ ONT = 2;
}
}