VOL-637 - Support configuring ONU to not add/remove C-VLAN tags
Change-Id: I4a500a760134cd296b783cf1951b2c954f8c6eff
diff --git a/voltha/adapters/asfvolt16_olt/asfvolt16_device_handler.py b/voltha/adapters/asfvolt16_olt/asfvolt16_device_handler.py
index 746f0ed..2d65164 100644
--- a/voltha/adapters/asfvolt16_olt/asfvolt16_device_handler.py
+++ b/voltha/adapters/asfvolt16_olt/asfvolt16_device_handler.py
@@ -107,6 +107,8 @@
ASFVOLT_DNS_ID = 15
ASFVOLT_DOWNLINK_DNS_ID = 16
+RESERVED_VLAN_ID = 4095
+
class FlowInfo(object):
@@ -1905,7 +1907,10 @@
# Copy O_OVID
downlink_classifier['vlan_vid'] = downlink_action['vlan_vid']
# Copy I_OVID
- downlink_classifier['metadata'] = uplink_classifier['vlan_vid']
+ if uplink_classifier['vlan_vid'] != RESERVED_VLAN_ID:
+ # downlink_classifier['metadata'] is the I_VID, which is not required
+ # when we use transparent tagging
+ downlink_classifier['metadata'] = uplink_classifier['vlan_vid']
if 'push_vlan' in downlink_action:
downlink_action.pop('push_vlan')
downlink_action['trap_to_host'] = True
@@ -1913,7 +1918,6 @@
downlink_classifier['pkt_tag_type'] = 'untagged'
downlink_classifier.pop('vlan_vid')
-
downlink_flow_id = self.get_flow_id(onu_device.proxy_address.onu_id,
onu_device.proxy_address.channel_id,
downlink_dhcp_id)
@@ -1954,7 +1958,14 @@
downlink_classifier['pkt_tag_type'] = 'double_tag'
downlink_classifier['vlan_vid'] = uplink_action['vlan_vid']
- downlink_classifier['metadata'] = uplink_classifier['vlan_vid']
+
+ if uplink_classifier['vlan_vid'] != RESERVED_VLAN_ID:
+ downlink_classifier['metadata'] = uplink_classifier['vlan_vid']
+ else:
+ # when we use transparent tagging, we need not use any vlan classifier,
+ # vlan tagging will happen based on pkt_tag_type
+ del uplink_classifier['vlan_vid']
+
del downlink_action['push_vlan']
downlink_action['pop_vlan'] = True
diff --git a/voltha/adapters/broadcom_onu/broadcom_onu.py b/voltha/adapters/broadcom_onu/broadcom_onu.py
index 113245a..3543776 100644
--- a/voltha/adapters/broadcom_onu/broadcom_onu.py
+++ b/voltha/adapters/broadcom_onu/broadcom_onu.py
@@ -53,6 +53,7 @@
BRDCM_DEFAULT_VLAN = 4091
ADMIN_STATE_LOCK = 1
ADMIN_STATE_UNLOCK = 0
+RESERVED_VLAN_ID = 4095
@implementer(IAdapterInterface)
class BroadcomOnuAdapter(object):
@@ -611,20 +612,32 @@
self.send_delete_vlan_tagging_filter_data(0x2102)
yield self.wait_for_response()
- #self.send_set_vlan_tagging_filter_data(0x2102, _set_vlan_vid)
- self.send_create_vlan_tagging_filter_data(0x2102, _set_vlan_vid)
- yield self.wait_for_response()
-
- for port_id in self.uni_ports:
-
- self.send_set_extended_vlan_tagging_operation_vlan_configuration_data_untagged(0x200 + port_id, 0x1000, _set_vlan_vid)
+ # self.send_set_vlan_tagging_filter_data(0x2102, _set_vlan_vid)
+ if _set_vlan_vid != RESERVED_VLAN_ID:
+ # As per G.988 - Table 9.3.11-1 - Forward operation attribute values
+ # Forward action of 0x10 allows VID Investigation
+ self.send_create_vlan_tagging_filter_data(0x2102, _set_vlan_vid, 0x10)
yield self.wait_for_response()
- self.send_set_extended_vlan_tagging_operation_vlan_configuration_data_single_tag(0x200 + port_id, 8, 0, 0,
- 1, 8, _set_vlan_vid)
+ for port_id in self.uni_ports:
+
+ self.send_set_extended_vlan_tagging_operation_vlan_configuration_data_untagged(\
+ 0x200 + port_id, 0x1000, _set_vlan_vid)
+ yield self.wait_for_response()
+
+ self.send_set_extended_vlan_tagging_operation_vlan_configuration_data_single_tag(0x200 + port_id, 8, 0, 0,
+ 1, 8, _set_vlan_vid)
+ yield self.wait_for_response()
+ else:
+ # As per G.988 - Table 9.3.11-1 - Forward operation attribute values
+ # Forward action of 0x00 does not perform VID Investigation for transparent vlan case
+ self.send_create_vlan_tagging_filter_data(0x2102, _set_vlan_vid, 0x00)
yield self.wait_for_response()
-
+ for port_id in self.uni_ports:
+ self.send_set_extended_vlan_tagging_operation_vlan_configuration_data_single_tag(\
+ 0x200 + port_id, 14, 4096, 0, 0, 15, 0)
+ yield self.wait_for_response()
except Exception as e:
self.log.exception('failed-to-install-flow', e=e, flow=flow)
@@ -892,7 +905,8 @@
def send_create_vlan_tagging_filter_data(self,
entity_id,
- vlan_id):
+ vlan_id,
+ fwd_operation):
frame = OmciFrame(
transaction_id=self.get_tx_id(),
message_type=OmciCreate.message_id,
@@ -901,7 +915,7 @@
entity_id=entity_id,
data=dict(
vlan_filter_0=vlan_id,
- forward_operation=0x10,
+ forward_operation=fwd_operation,
number_of_entries=1
)
)
@@ -1352,7 +1366,8 @@
# VLAN Tagging Filter config
# Create AR - VlanTaggingFilterData - 8450 - c-vid
- self.send_create_vlan_tagging_filter_data(0x2102, cvid)
+ # As per G.988 - Table 9.3.11-1 - Forward operation attribute values
+ self.send_create_vlan_tagging_filter_data(0x2102, cvid, 0x10)
yield self.wait_for_response()