Skip to content
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

Add loopback interface #9

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/ansible-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ jobs:
- stable-2.13
- stable-2.14
- devel
runs-on: ubuntu-latest
runs-on: >-
${{ contains(fromJson(
'["stable-2.9", "stable-2.10", "stable-2.11" ]'
), matrix.ansible) && 'ubuntu-20.04' || 'ubuntu-latest' }}
steps:

# ansible-test requires the collection to be in a directory in the form
Expand Down
21 changes: 21 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,27 @@ Arubanetworks.Aoscx Release Notes
.. contents:: Topics


v4.3.1
======

Release Summary
---------------

Fixes for documentation, enhancements (aoscx_facts) and bugfixes (aoscx_l3_interface)

Major Changes
-------------

- Add option lldp_neighbors to aoscx_facts (https://github.com/aruba/aoscx-ansible-collection/issues/79)
- Bugfixes for vrf attach in l3 Interface module

Minor Changes
-------------

- Add documentation for passive and active interfaces in ospf module (https://github.com/aruba/aoscx-ansible-collection/issues/65)
- Add support for cgroupv2 and Ubuntu 22.04 by Alexis La Goutte(https://github.com/ansible-collections/collection_template/pull/56)
- Fix in README for requirements documentation by Olivier Magloire (https://github.com/aruba/aoscx-ansible-collection/pull/74)

v4.3.0
======

Expand Down
16 changes: 11 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ Requirements
Installation
------------

Through Galaxy:
* Through Galaxy:

```
ansible-galaxy collection install arubanetworks.aoscx
```

Example Output:
* Example Output:
```
Starting galaxy collection install process
Process install dependency map
Expand All @@ -40,8 +40,14 @@ Skipping 'ansible.netcommon:2.3.0' as it is already installed
Skipping 'ansible.utils:2.3.1' as it is already installed
```

* **Change into the collections directory** where the AOS-CX Ansible collection (arubanetworks.aoscx) was installed, execute `ansible-galaxy collection list` to find:
```
* **Change into the collections directory** where the AOS-CX Ansible collection (arubanetworks.aoscx) was installed.
You can either execute `ansible-galaxy collection list` to find or use the following command:
```
cd "$(ansible-galaxy collection list | grep -E '^#.*\.ansible' | sed 's/\# //')/arubanetworks/aoscx"
```
* Example output of `ansible-galaxy collection list` and `cd` command:

```
ansible-control-machine$ansible-galaxy collection list
# /users/chiapuzi/.ansible/collections/ansible_collections
Collection Version
Expand All @@ -57,7 +63,7 @@ Skipping 'ansible.utils:2.3.1' as it is already installed
docs MANIFEST.json plugins requirements.txt
ansible-control-machine$
```

* Install all Ansible requirements, with the following command:
```
ansible-galaxy install -r requirements.yml
Expand Down
11 changes: 11 additions & 0 deletions changelogs/changelog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,14 @@ releases:
- Fix sanity tests errors.
release_summary: New features (LAG and DNS), enhancements (VLAN) and bugfixes
release_date: '2023-08-30'
4.3.1:
changes:
major_changes:
- Add option lldp_neighbors to aoscx_facts (https://github.com/aruba/aoscx-ansible-collection/issues/79)
- Bugfixes for vrf attach in l3 Interface module
minor_changes:
- Add support for cgroupv2 and Ubuntu 22.04 by Alexis La Goutte(https://github.com/ansible-collections/collection_template/pull/56)
- Fix in README for requirements documentation by Olivier Magloire (https://github.com/aruba/aoscx-ansible-collection/pull/74)
- Add documentation for passive and active interfaces in ospf module (https://github.com/aruba/aoscx-ansible-collection/issues/65)
release_summary: Fixes for documentation, enhancements (aoscx_facts) and bugfixes (aoscx_l3_interface)
release_date: '2023-11-10'
7 changes: 4 additions & 3 deletions docs/aoscx_facts.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,16 @@ available yet, it will be available in a future release.
- software_version
gather_network_resources:
description: >
Retrieve vlan, interface, or vrf information. This can be a single
category or it can be a list. Leaving this field blank returns all all
interfaces, vlans, and vrfs.
Retrieve vlan, interface, lldp_neighbors or vrf information. This can
be a single category or it can be a list. Leaving this field blank
returns all interfaces, vlans, and vrfs.
type: list
elements: str
choices:
- interfaces
- vlans
- vrfs
- lldp_neighbors
required: false
```

Expand Down
8 changes: 7 additions & 1 deletion docs/aoscx_l3_interface.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ This modules provides configuration management of Layer3 Interfaces on AOS-CX de
| `interface` | str | | [x] | Interface name, should be in the format chassis/slot/port, e.g. 1/2/3 |
| `ipv4` | list | | [ ] | The IPv4 address and subnet mask in the address/mask format. The first entry in the list is the primary IPv4, the remainings are secondary IPv4; to remove an IP address pass in the list and use the delete state. |
| `ipv6` | str | | [ ] | The IPv6 address and subnet mask in the address/mask format. To remove an IP address pass in the list and use the delete state. |
| `vrf` | str | | [ ] | The VRF the interface will belong to once created. If none provided, the interface will be in the Default VRF. If an L3 interface is created and the user wants to change the interface's VRF, the user must delete the L3 interface then recreate the interface in the desired VRF. |
| `vrf` | str | | [ ] | VRF to which the port belongs if the port is routing. If none provided, the interface will be in the Default VRF. If the VRF is removed or changed all configuration is erased from the interface. |
| `interface_qos_schedule_profile` | dict | | [ ] | Attaching existing QoS schedule profile to interface. This parameter is deprecated and will be removed in a future version. |
| `interface_qos_rate` | dict | | [ ] | The rate limit value configured for broadcast/multicast/unknown unicast traffic. Dictionary should have the format `type_of_traffic`: speed e.g. {'unknown-unicast': '100pps', 'broadcast': '200pps', 'multicast': '200pps'} |
| `ip_helper_address` | str | | [ ] | Configure a remote DHCP server/relay IP address on the device interface. Here the helper address is same as the DHCP server address or another intermediate DHCP relay. |
Expand Down Expand Up @@ -67,6 +67,12 @@ This modules provides configuration management of Layer3 Interfaces on AOS-CX de
- 10.0.1.1/24
state: delete

- name: Delete VRF attach of the Interface 1/1/3
aoscx_l3_interface:
interface: 1/1/3
vrf: red
state: delete

- name: Deleting L3 Interface - 1/1/3
aoscx_l3_interface:
interface: 1/1/3
Expand Down
24 changes: 21 additions & 3 deletions docs/aoscx_ospf.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ there is a maximum of eight OSPF processes allowed per VRF.
| `vrf` | str | | [x] | Name of the VRF where the router will be in. |
| `instance_tag` | int | | [x] | OSPF process ID (1-63). |
| `redistribute` | list | [`connected`, `local_loopback`, `static`, `bgp`, `ripng`] | [ ] | List with route sources to redistribute in this instance. |
| `active_interfaces` | list | | [ ] | List of the active interfaces. If `passive_interface_default` is set `false`, then this list should be empty. |
| `passive_interface_default` | bool | | [ ] | This determines whether all interfaces should be set to passive by default.
| `passive_interfaces` | list | | [ ] | List of the passive interfaces. If `passive_interface_default` is set `true`, then this list should be empty. |

---
## aoscx_ospf_area
Expand Down Expand Up @@ -164,14 +167,19 @@ connection to the backbone area.

```YAML
- name: >
Create new OSPF Router, with bgp, and static as OSPF redistribution methods
Create new OSPF Router, with bgp, and static as OSPF redistribution methods.
Also set passive interfaces.
aoscx_ospf_router:
state: update
vrf: default
instance_tag: 1
redistribute:
- bgp
- static
passive_interface_default: false
passive_interfaces:
- 1/1/5
- 1/1/6
```

## Update OSPF Router
Expand All @@ -192,28 +200,38 @@ connection to the backbone area.
```YAML
- name: >
Update OSPF Router, set redistribute to connected, and static only. This
deletes bgp from the list.
deletes bgp from the list and remove a previously configured passive
interface (1/1/5).
aoscx_ospf_router:
state: override
vrf: default
instance_tag: 1
redistribute:
- connected
- static
passive_interface_default: false
passive_interfaces:
- 1/1/6

```

## Update OSPF Router

```YAML
- name: >
Update OSPF Router, set redistribute to connected only. This deletes static
from the list.
from the list. Set an active interfaces and remove all passive interfaces.
aoscx_ospf_router:
state: override
vrf: default
instance_tag: 1
redistribute:
- connected
passive_interface_default: true
passive_interfaces: []
active_interfaces:
- 1/1/6

```

## Delete OSPF Router
Expand Down
2 changes: 1 addition & 1 deletion galaxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ namespace: "arubanetworks"

name: "aoscx"

version: "4.3.0"
version: "4.3.1"

authors:
- "Madhusudan Pranav Venugopal"
Expand Down
45 changes: 40 additions & 5 deletions plugins/modules/aoscx_facts.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-

# (C) Copyright 2020-2022 Hewlett Packard Enterprise Development LP.
# (C) Copyright 2020-2023 Hewlett Packard Enterprise Development LP.
# GNU General Public License v3.0+
# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)

Expand Down Expand Up @@ -63,15 +63,16 @@
- software_version
gather_network_resources:
description: >
Retrieve vlan, interface, or vrf information. This can be a single
category or it can be a list. Leaving this field blank returns all all
interfaces, vlans, and vrfs.
Retrieve vlan, interface, lldp_neighbors or vrf information. This can
be a single category or it can be a list. Leaving this field blank
returns all interfaces, vlans, and vrfs.
type: list
elements: str
choices:
- interfaces
- vlans
- vrfs
- lldp_neighbors
required: false
"""

Expand Down Expand Up @@ -208,7 +209,7 @@ def main():
"gather_network_resources": dict(
type="list",
elements="str",
choices=["interfaces", "vlans", "vrfs"],
choices=["interfaces", "vlans", "vrfs", "lldp_neighbors"],
),
}
ansible_module = AnsibleModule(
Expand Down Expand Up @@ -263,6 +264,13 @@ def main():
ansible_network_resources.update(
{"vrfs": Vrf.get_facts(session)}
)
elif resource == "lldp_neighbors":
LLDPNeighbor = session.api.get_module_class(
session, "LLDPNeighbor"
)
ansible_network_resources.update(
{"lldp_neighbors": LLDPNeighbor.get_facts(session)}
)
except Exception as e:
ansible_module.fail_json(
msg="Network resources: {0}".format(str(e))
Expand All @@ -286,6 +294,33 @@ def main():
except Exception as e:
ansible_module.fail_json(msg="System: {0}".format(str(e)))

# LLDP Neighbors for interface mgmt are located in System (switch)
if (
"lldp_neighbors" in ansible_network_resources
and switch.lldp_mgmt_neighbor_info
):
mgmt_lldp_neighbors = {}
for neighbor in switch.lldp_mgmt_neighbor_info.values():
# Creating an entry similar to those obtained
# from LLDPNeighbor.get_facts()
tmp_chassis_id = neighbor.pop("chassis_id", "")
tmp_port_id = neighbor.pop("port_id", "")
tmp_mac_addr = neighbor.pop("mac_addr", "")
neighbor_idx = tmp_chassis_id + "," + tmp_port_id

mgmt_lldp_neighbors[neighbor_idx] = {}
mgmt_lldp_neighbors[neighbor_idx].update(
{
"chassis_id": tmp_chassis_id,
"port_id": tmp_port_id,
"mac_addr": tmp_mac_addr,
"neighbor_info": neighbor,
}
)
ansible_network_resources["lldp_neighbors"].update(
{"mgmt": mgmt_lldp_neighbors}
)

curr_firmware = iter(switch.firmware_version.split("."))
platform = next(curr_firmware)
main_version = int(next(curr_firmware))
Expand Down
Loading