Loading src/device/service/drivers/p4/p4_common.py +2 −2 Original line number Diff line number Diff line Loading @@ -339,7 +339,7 @@ def parse_action_parameters_from_json(resource): if not resource or ("action-params" not in resource): LOGGER.warning( "JSON entry misses 'action-params' list of attributes") return None return {} chk_type("action-params", resource["action-params"], list) action_name = parse_resource_string_from_json(resource, "action-name") Loading Loading @@ -368,7 +368,7 @@ def parse_replicas_from_json(resource): if not resource or ("replicas" not in resource): LOGGER.warning( "JSON entry misses 'replicas' list of attributes") return None return [] chk_type("replicas", resource["replicas"], list) replicas = {} Loading src/device/service/drivers/p4/p4_driver.py +20 −3 Original line number Diff line number Diff line Loading @@ -35,7 +35,7 @@ from .p4_manager import P4Manager, \ KEY_TABLE, KEY_ACTION, KEY_ACTION_PROFILE, \ KEY_COUNTER, KEY_DIR_COUNTER, KEY_METER, KEY_DIR_METER,\ KEY_CTL_PKT_METADATA, KEY_DIGEST, KEY_CLONE_SESSION,\ KEY_ENDPOINT KEY_MULTICAST_GROUP, KEY_ENDPOINT from .p4_client import WriteOperation try: Loading Loading @@ -482,6 +482,19 @@ class P4Driver(_Driver): ap_name) if ap_entries: entries.append(ap_entries) ap_group_entries = self.__manager.action_prof_group_entries_to_json( ap_name) if ap_group_entries: entries.append(ap_group_entries) elif KEY_MULTICAST_GROUP == resource_key: mc_entries = self.__manager.multicast_group_entries_to_json() if mc_entries: entries.extend(mc_entries) # note: returns a list already, not a dict elif KEY_CLONE_SESSION == resource_key: cs_entries = self.__manager.clone_session_entries_to_json() if cs_entries: entries.extend(cs_entries) # note: returns a list already, not a dict elif KEY_ACTION == resource_key: # To be implemented or deprecated pass Loading Loading @@ -671,11 +684,15 @@ class P4Driver(_Driver): elif KEY_ACTION_PROFILE in resource_key: self.__manager.action_prof_member_entry_operation_from_json( resource_value, operation) self.__manager.action_prof_group_entry_operation_from_json( resource_value, operation) # TODO: See how action profile groups can be incorporated # self.__manager.action_prof_group_entry_operation_from_json( # resource_value, operation) elif KEY_CLONE_SESSION in resource_key: self.__manager.clone_session_entry_operation_from_json( resource_value, operation) elif KEY_MULTICAST_GROUP in resource_key: self.__manager.multicast_group_entry_operation_from_json( resource_value, operation) elif KEY_CTL_PKT_METADATA in resource_key: msg = f"{resource_key.capitalize()} is not a " \ f"configurable resource" Loading src/device/service/drivers/p4/p4_manager.py +220 −97 File changed.Preview size limit exceeded, changes collapsed. Show changes Loading
src/device/service/drivers/p4/p4_common.py +2 −2 Original line number Diff line number Diff line Loading @@ -339,7 +339,7 @@ def parse_action_parameters_from_json(resource): if not resource or ("action-params" not in resource): LOGGER.warning( "JSON entry misses 'action-params' list of attributes") return None return {} chk_type("action-params", resource["action-params"], list) action_name = parse_resource_string_from_json(resource, "action-name") Loading Loading @@ -368,7 +368,7 @@ def parse_replicas_from_json(resource): if not resource or ("replicas" not in resource): LOGGER.warning( "JSON entry misses 'replicas' list of attributes") return None return [] chk_type("replicas", resource["replicas"], list) replicas = {} Loading
src/device/service/drivers/p4/p4_driver.py +20 −3 Original line number Diff line number Diff line Loading @@ -35,7 +35,7 @@ from .p4_manager import P4Manager, \ KEY_TABLE, KEY_ACTION, KEY_ACTION_PROFILE, \ KEY_COUNTER, KEY_DIR_COUNTER, KEY_METER, KEY_DIR_METER,\ KEY_CTL_PKT_METADATA, KEY_DIGEST, KEY_CLONE_SESSION,\ KEY_ENDPOINT KEY_MULTICAST_GROUP, KEY_ENDPOINT from .p4_client import WriteOperation try: Loading Loading @@ -482,6 +482,19 @@ class P4Driver(_Driver): ap_name) if ap_entries: entries.append(ap_entries) ap_group_entries = self.__manager.action_prof_group_entries_to_json( ap_name) if ap_group_entries: entries.append(ap_group_entries) elif KEY_MULTICAST_GROUP == resource_key: mc_entries = self.__manager.multicast_group_entries_to_json() if mc_entries: entries.extend(mc_entries) # note: returns a list already, not a dict elif KEY_CLONE_SESSION == resource_key: cs_entries = self.__manager.clone_session_entries_to_json() if cs_entries: entries.extend(cs_entries) # note: returns a list already, not a dict elif KEY_ACTION == resource_key: # To be implemented or deprecated pass Loading Loading @@ -671,11 +684,15 @@ class P4Driver(_Driver): elif KEY_ACTION_PROFILE in resource_key: self.__manager.action_prof_member_entry_operation_from_json( resource_value, operation) self.__manager.action_prof_group_entry_operation_from_json( resource_value, operation) # TODO: See how action profile groups can be incorporated # self.__manager.action_prof_group_entry_operation_from_json( # resource_value, operation) elif KEY_CLONE_SESSION in resource_key: self.__manager.clone_session_entry_operation_from_json( resource_value, operation) elif KEY_MULTICAST_GROUP in resource_key: self.__manager.multicast_group_entry_operation_from_json( resource_value, operation) elif KEY_CTL_PKT_METADATA in resource_key: msg = f"{resource_key.capitalize()} is not a " \ f"configurable resource" Loading
src/device/service/drivers/p4/p4_manager.py +220 −97 File changed.Preview size limit exceeded, changes collapsed. Show changes