Skip to content

Commit

Permalink
Merge branch 'main' into restore
Browse files Browse the repository at this point in the history
  • Loading branch information
rohitthakur2590 authored Mar 21, 2024
2 parents 59557f7 + a18d41a commit aa5846f
Show file tree
Hide file tree
Showing 27 changed files with 268 additions and 69 deletions.
32 changes: 32 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,38 @@ Junipernetworks Junos Collection Release Notes
.. contents:: Topics


v6.0.2
======

Bugfixes
--------

- acls
- initialize facts dictionary with empty containers for respective resources mentioned below
- lldp_global
- lldp_interfaces
- logging_global
- ntp_global
- ospf_interfaces
- ospfv2
- ospfv3
- prefix_lists
- routing_instances
- routing_options
- security_policies
- security_policies_global
- security_zones
- snmp_server
- static_routes
- vlans

Documentation Changes
---------------------

- Remove the part of the description which incorrectly describes the behavior and type of confirm attribute.
- Update example performing `confirm_commit`.
- Update with more examples using the `confirm` option to set a timer.

v6.0.1
======

Expand Down
31 changes: 31 additions & 0 deletions changelogs/changelog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -597,3 +597,34 @@ releases:
- module_defaults.yaml
- trivial_lint.yaml
release_date: "2024-01-31"
6.0.2:
changes:
bugfixes:
- acls
- initialize facts dictionary with empty containers for respective resources
mentioned below
- lldp_global
- lldp_interfaces
- logging_global
- ntp_global
- ospf_interfaces
- ospfv2
- ospfv3
- prefix_lists
- routing_instances
- routing_options
- security_policies
- security_policies_global
- security_zones
- snmp_server
- static_routes
- vlans
doc_changes:
- Remove the part of the description which incorrectly describes the behavior
and type of confirm attribute.
- Update example performing `confirm_commit`.
- Update with more examples using the `confirm` option to set a timer.
fragments:
- empty_facts.yaml
- update_junos_config_docs.yaml
release_date: "2024-03-06"
6 changes: 6 additions & 0 deletions changelogs/fragments/fix_upstream_tetst.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
bugfixes:
- Fix the empty facts list placement
trivial:
- Update tests for junos_ospf_interfaces resource module
- Perform config reset for specific resources before performing gathered operation
12 changes: 11 additions & 1 deletion docs/junipernetworks.junos.junos_config_module.rst
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ Parameters
<b>Default:</b><br/><div style="color: blue">0</div>
</td>
<td>
<div>The <code>confirm</code> argument will configure a time out value in minutes for the commit to be confirmed before it is automatically rolled back. If the <code>confirm</code> argument is set to False, this argument is silently ignored. If the value for this argument is set to 0, the commit is confirmed immediately.</div>
<div>The <code>confirm</code> argument will configure a time out value in minutes for the commit to be confirmed before it is automatically rolled back. If the value for this argument is set to 0, the commit is confirmed immediately which is also the default behaviour.</div>
</td>
</tr>
<tr>
Expand Down Expand Up @@ -410,6 +410,16 @@ Examples
filename: backup.cfg
dir_path: /home/user
- name: Set description with timer to confirm commit
junipernetworks.junos.junos_config:
lines:
- set interfaces fxp0 description "wait for a commit confirmation for 3 minutes; otherwise, it will be rolled back."
confirm: 3
- name: Perform confirm commit
junipernetworks.junos.junos_config:
confirm_commit: true
Return Values
Expand Down
2 changes: 1 addition & 1 deletion galaxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ readme: README.md
repository: https://github.com/ansible-collections/junipernetworks.junos
issues: https://github.com/ansible-collections/junipernetworks.junos/issues
tags: [juniper, junipernetworks, junos, networking, security, netconf]
version: 6.0.1
version: 6.0.2
Original file line number Diff line number Diff line change
Expand Up @@ -239,31 +239,32 @@ def _state_deleted(self, want, have):
"""
lldp_xml = []

lldp_root = build_root_xml_node("lldp")
build_child_xml_node(
lldp_root,
"management-address",
None,
{"delete": "delete"},
)
build_child_xml_node(
lldp_root,
"advertisement-interval",
None,
{"delete": "delete"},
)
build_child_xml_node(
lldp_root,
"transmit-delay",
None,
{"delete": "delete"},
)
build_child_xml_node(
lldp_root,
"hold-multiplier",
None,
{"delete": "delete"},
)
build_child_xml_node(lldp_root, "disable", None, {"delete": "delete"})
lldp_xml.append(lldp_root)
if have:
lldp_root = build_root_xml_node("lldp")
build_child_xml_node(
lldp_root,
"management-address",
None,
{"delete": "delete"},
)
build_child_xml_node(
lldp_root,
"advertisement-interval",
None,
{"delete": "delete"},
)
build_child_xml_node(
lldp_root,
"transmit-delay",
None,
{"delete": "delete"},
)
build_child_xml_node(
lldp_root,
"hold-multiplier",
None,
{"delete": "delete"},
)
build_child_xml_node(lldp_root, "disable", None, {"delete": "delete"})
lldp_xml.append(lldp_root)
return lldp_xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def get_ospf_interfaces_facts(self, data=None):
data=data,
)
ospf_interfaces_facts = facts["ansible_network_resources"].get(
"junos_ospf_interfaces",
"ospf_interfaces",
)
if not ospf_interfaces_facts:
return []
Expand Down
5 changes: 2 additions & 3 deletions plugins/module_utils/network/junos/facts/acls/acls.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def populate_facts(self, connection, ansible_facts, data=None):

objs = []
for resource in resources:
if resource:
if resource is not None:
xml = self._get_xml_dict(resource)
for family, sub_dict in xml["firewall"]["family"].items():
sub_dict["family"] = family
Expand All @@ -96,9 +96,8 @@ def populate_facts(self, connection, ansible_facts, data=None):
if obj:
objs.append(obj)

facts = {}
facts = {"acls": []}
if objs:
facts["acls"] = []
params = utils.validate_config(
self.argument_spec,
{"config": objs},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def populate_facts(self, connection, ansible_facts, data=None):
to_bytes(data, errors="surrogate_then_replace"),
)

facts = {}
facts = {"lldp_global": {}}
config = deepcopy(self.generated_spec)
resources = data.xpath("configuration/protocols/lldp")
if resources:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def populate_facts(self, connection, ansible_facts, data=None):
obj = self.render_config(self.generated_spec, resource)
if obj:
objs.append(obj)
facts = {}
facts = {"lldp_interfaces": []}
if objs:
facts["lldp_interfaces"] = []
params = utils.validate_config(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def populate_facts(self, connection, ansible_facts, data=None):
xml = self._get_xml_dict(resource)
objs = self.render_config(self.generated_spec, xml)

facts = {}
facts = {"logging_global": {}}
if objs:
facts["logging_global"] = {}
params = utils.validate_config(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,8 @@ def populate_facts(self, connection, ansible_facts, data=None):
xml = self._get_xml_dict(resource)
objs = self.render_config(self.generated_spec, xml)

facts = {}
facts = {"ntp_global": {}}
if objs:
facts["ntp_global"] = {}
params = utils.validate_config(
self.argument_spec,
{"config": objs},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,8 @@ def populate_facts(self, connection, ansible_facts, data=None):
xml = self._get_xml_dict(resource)
objs = self.render_config(self.generated_spec, xml)

facts = {}
facts = {"ospf_interfaces": []}
if objs:
facts["junos_ospf_interfaces"] = []
params = _validate_config(
self._module,
self.argument_spec,
Expand All @@ -127,7 +126,7 @@ def populate_facts(self, connection, ansible_facts, data=None):
)

for cfg in params["config"]:
facts["junos_ospf_interfaces"].append(remove_empties(cfg))
facts["ospf_interfaces"].append(remove_empties(cfg))

ansible_facts["ansible_network_resources"].update(facts)
return ansible_facts
Expand Down
3 changes: 1 addition & 2 deletions plugins/module_utils/network/junos/facts/ospfv2/ospfv2.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,8 @@ def populate_facts(self, connection, ansible_facts, data=None):
if obj:
objs.append(obj)

facts = {}
facts = {"ospfv2": []}
if objs is not None:
facts["ospfv2"] = []
params = utils.validate_config(
self.argument_spec,
{"config": objs},
Expand Down
3 changes: 1 addition & 2 deletions plugins/module_utils/network/junos/facts/ospfv3/ospfv3.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,8 @@ def populate_facts(self, connection, ansible_facts, data=None):
if obj:
objs.append(obj)

facts = {}
facts = {"ospfv3": []}
if objs:
facts["ospfv3"] = []
params = utils.validate_config(
self.argument_spec,
{"config": objs},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,8 @@ def populate_facts(self, connection, ansible_facts, data=None):
xml = self._get_xml_dict(resource)
objs = self.render_config(self.generated_spec, xml)

facts = {}
facts = {"prefix_lists": []}
if objs:
facts["prefix_lists"] = []
params = utils.validate_config(
self.argument_spec,
{"config": objs},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,8 @@ def populate_facts(self, connection, ansible_facts, data=None):
xml = self._get_xml_dict(resource)
objs = self.render_config(self.generated_spec, xml)

facts = {}
facts = {"routing_instances": []}
if objs:
facts["routing_instances"] = []
params = utils.validate_config(
self.argument_spec,
{"config": objs},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,8 @@ def populate_facts(self, connection, ansible_facts, data=None):
xml = self._get_xml_dict(resource)
objs = self.render_config(self.generated_spec, xml)

facts = {}
facts = {"routing_options": []}
if objs:
facts["routing_options"] = {}
params = utils.validate_config(
self.argument_spec,
{"config": objs},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,8 @@ def populate_facts(self, connection, ansible_facts, data=None):
xml = self._get_xml_dict(resource)
objs = self.render_config(self.generated_spec, xml)

facts = {}
facts = {"security_policies": {}}
if objs:
facts["security_policies"] = {}
params = utils.validate_config(
self.argument_spec,
{"config": objs},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,8 @@ def populate_facts(self, connection, ansible_facts, data=None):
xml = self._get_xml_dict(resource)
objs = self.render_config(self.generated_spec, xml)

facts = {}
facts = {"security_policies_global": {}}
if objs:
facts["security_policies_global"] = {}
params = utils.validate_config(
self.argument_spec,
{"config": objs},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,8 @@ def populate_facts(self, connection, ansible_facts, data=None):
xml = self._get_xml_dict(resource)
objs = self.render_config(self.generated_spec, xml)

facts = {}
facts = {"security_zones": {}}
if objs:
facts["security_zones"] = {}
params = utils.validate_config(
self.argument_spec,
{"config": objs},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,8 @@ def populate_facts(self, connection, ansible_facts, data=None):
xml = self._get_xml_dict(resource)
objs = self.render_config(self.generated_spec, xml)

facts = {}
facts = {"snmp_server": {}}
if objs:
facts["snmp_server"] = {}
params = utils.validate_config(
self.argument_spec,
{"config": objs},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,8 @@ def populate_facts(self, connection, ansible_facts, data=None):
if obj:
objs.append(obj)

facts = {}
facts = {"static_routes": []}
if objs:
facts["static_routes"] = []
params = utils.validate_config(
self.argument_spec,
{"config": objs},
Expand Down
3 changes: 1 addition & 2 deletions plugins/module_utils/network/junos/facts/vlans/vlans.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,8 @@ def populate_facts(self, connection, ansible_facts, data=None):
obj = self.render_config(self.generated_spec, resource)
if obj:
objs.append(obj)
facts = {}
facts = {"vlans": []}
if objs:
facts["vlans"] = []
params = utils.validate_config(
self.argument_spec,
{"config": objs},
Expand Down
Loading

0 comments on commit aa5846f

Please sign in to comment.