-
Notifications
You must be signed in to change notification settings - Fork 34
Added ndo_fabric_span_session_source_filter module to manage the SPAN session source filter (DCNE-376) #677
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added ndo_fabric_span_session_source_filter module to manage the SPAN session source filter (DCNE-376) #677
Conversation
16a41fc
to
37bc01c
Compare
37bc01c
to
d04bc8e
Compare
plugins/module_utils/template.py
Outdated
""" | ||
existing_objects = self.template.get("monitoringTemplate", {}).get("template", {}).get("spanSessions", []) | ||
if uuid or name: # Query a specific object | ||
return self.get_object_by_key_value_pairs("SPAN Sessions", existing_objects, [KVPair("uuid", uuid) if uuid else KVPair("name", name)], fail_module) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is plural form correct here?
return self.get_object_by_key_value_pairs("SPAN Sessions", existing_objects, [KVPair("uuid", uuid) if uuid else KVPair("name", name)], fail_module) | |
return self.get_object_by_key_value_pairs("SPAN Session", existing_objects, [KVPair("uuid", uuid) if uuid else KVPair("name", name)], fail_module) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
applies to all 3
plugins/module_utils/template.py
Outdated
KVPair("destPortTo", int(PORT_MAPPING.get(filter_config.get("destination_port_to")))), | ||
KVPair("ipProtocol", IP_PROTOCOL_MAPPING.get(filter_config.get("ip_protocol"))), | ||
] | ||
return self.get_object_by_key_value_pairs("SPAN Sessions Source", search_list, KVPairs, fail_module) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return self.get_object_by_key_value_pairs("SPAN Sessions Source", search_list, KVPairs, fail_module) | |
return self.get_object_by_key_value_pairs("SPAN Sessions Source Filter", search_list, KVPairs, fail_module) |
plugins/module_utils/template.py
Outdated
return self.get_object_by_key_value_pairs("SPAN Session Source", search_list, [KVPair("name", name)], fail_module) | ||
return search_list # Query all objects | ||
|
||
def get_fabric_span_session_source_filter(self, filter_config, search_list, fail_module=False): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this function is used only in one module, this should be moved inside the module.
state: present | ||
register: update_filter_l3out_ansible_test_source_2 | ||
|
||
- name: Assertion check for update SPAN Session source with different options |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This assesrtion is task is too big, it has to split based on add, remove, update according to the tasks
- This parameter or O(filter_epg.epg) is required. | ||
type: str | ||
aliases: [ epg_uuid ] | ||
epg: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to name this epg
or something like reference
? I personally find the filter_epg.epg a bit redundant. In my PR I have a port_channel
dict, which would then be port_channel.port_channel.some_key
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
type: list | ||
elements: dict | ||
suboptions: | ||
access_path_type: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we use an alias of type? or is this a reserved key in ansible?
choices: [ incoming, outgoing, both ] | ||
span_drop_packets: | ||
description: | ||
- The SPAN Drop Packets of the SPAN Session source. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we add a explanation of behaviour here?
description: | ||
- The Filter L3Out of the SPAN Session source. | ||
- When the Filter L3Out is specified in the configuration, the Filter EPG will be removed. | ||
- Filter L3Out and Filter EPG cannot be configured simultaneously. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so we are adding this line now as standard? Should this also be added then to the OR description for all other mutual exclusives? uuid/name because or would not indicate that they cannot be provided together?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do not have a standard sentence for mutual exclusives condition. But changed the current description to match the current format.
template_id: | ||
description: | ||
- The ID of the Fabric Resource Policy template. | ||
- This parameter or O(access_paths.template) is required to configure the 'Port Channel' or 'Virtual Port Channel' Access Path. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we use O(access_path_type= port_channel) for these references?
a45edda
to
7ce2355
Compare
- The SPAN Drop Packets of the SPAN Session source. | ||
- SPAN Drop Packets are packets that get dropped when the SPAN destination port cannot handle the volume of mirrored traffic from the source ports. | ||
- Defaults to O(span_drop_packets=false) when unset during creation. | ||
- The O(filter_epg) and O(filter_l3out) is not configurable when this parameter O(span_drop_packets=true) set to true. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- The O(filter_epg) and O(filter_l3out) is not configurable when this parameter O(span_drop_packets=true) set to true. | |
- The O(filter_epg) and O(filter_l3out) are not configurable when O(span_drop_packets=true). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
uuid: | ||
description: | ||
- The UUID of the EPG used to configure the Filter EPG. | ||
- This parameter or O(filter_epg.epg_reference) is required. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I personally do not like this form. The original comment was to avoid double usage of a object naming in nesting of dictionaries. Originally you proposed for name filter_epg.epg.name
and now this becomes filter_epg.epg_reference.name
where we already now that the reference is for a epg. I proposed filter_epg.reference.name
, to avoid this double usage of epg. In my case it would become virtual_port_channel.virtual_port_channel_reference.name
. I think if we prefer epg_reference
we might as well use epg
.
I understand that the team is not a fan of the reference
wording (which is/was used in MSO/NDO to point to objects within a schema). Thus far I proposed reference, object, instance which were all not fitting, but I do not see any alternatives. @anvitha-jain, @samiib, @shrsr, @gmicol, @lhercot, can you provide other proposals or your preference for this to @sajagana?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am happy with using reference
. I see how it can become quite verbose when the object name is long eg. virtual_port_channel
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes i also think alias can help to shorten this even further, alias ref for reference for instance and vpc for virtual_port_channel.
This way virtual_port_channel.reference.name
could become vpc.ref.name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm good with reference as well!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on the discussion, "reference" was chosen as the primary attribute name, with "ref" used as its alias.
…n the ndo_fabric_span_session_source module
…nce in ndo_fabric_span_session_source module
7ce2355
to
f7b6f74
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
source_port_from: | ||
description: | ||
- The starting source port number for the SPAN Session source filter. | ||
- This parameter is required to query/delete a specific SPAN session source filter when it is configured with a non-default value. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this mean when it is not configured with "unspecified"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, some attributes default to "unspecified" if not provided during creation, update, query, or deletion. If a filter is created without a default value, I need the non-default value to query or delete that specific object.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall we be more specific then saying when not configured with "unspecified"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
source_port_to: | ||
description: | ||
- The ending source port number for the SPAN Session source filter. | ||
- This parameter is required to query/delete a specific SPAN session source filter when it is configured with a non-default value. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same question as above?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, some attributes default to "unspecified" if not provided during creation, update, query, or deletion. If a filter is created without a default value, I need the non-default value to query or delete that specific object.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -1891,8 +1891,8 @@ def listener_rules_spec(): | |||
) | |||
|
|||
|
|||
def epg_object_reference_spec(): | |||
return dict( | |||
def epg_object_reference_spec(aliases=None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should aliases
here be alias
as its currently only defined as a single string? Or should this be list of strings and the below code would be: epg_reference_spec["aliases"] = aliases
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed!
…o list of strings
…manage the SPAN session source filter
…emplate functions
…mplate.py to ndo_fabric_span_session_source_filter.py
…umentation to query/delete a specific object using default value
3b654ac
to
131c14f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Added parent ndo_fabric_span_session_source module changes for the testing purpose.