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 RouterOS 7.x support to '/mpls ldp' path #271

Merged

Conversation

samburney
Copy link
Contributor

@samburney samburney commented Mar 30, 2024

SUMMARY

RouterOS 7.1 completely re-writes the MPLS implementation (As per https://cdn.mikrotik.com/routeros/7.1/CHANGELOG), including support for multiple LDP instances.

This PR implements support for RouterOS 7.x LDP instances while retaining backwards compatibility with 6.x.

Some things to note:

  • The 'vrf' value isn't required by the API, however as only one VRF is allowed per entry it seems sensible to consider this value s the primary key.
  • As 'main' is the default VRF even when not defined, attempting to add an entry in the 'main' VRF while an entry with the VRF undefined is present will result in the error:
    Error while creating entry: failure: one active instance per VRF allowed
  • Whilst 'lsr-id' is able to be disabled, the router will not consider entries valid without it specified. I've not set this as a required value, but I think perhaps it should be.
ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME
  • api_info
  • api_modify
ADDITIONAL INFORMATION

Test tasks:

  tasks:
    - name: Enable MPLS LDP instance on RouterOS 6.x
      when: "'routeros6' in group_names"
      community.routeros.api_modify:
        path: mpls ldp
        data:
          - enabled: true
            lsr-id: 1.2.3.4

    - name: Enable MPLS LDP instance on RouterOS 7.x
      when: "'routeros6' not in group_names"
      community.routeros.api_modify:
        path: mpls ldp
        handle_entries_content: remove_as_much_as_possible
        data:
          - vrf: main
            lsr-id: 1.2.3.4

Resulting data from api_info:

RouterOS 6.49.10

ok: [testrtr2] => {
    "queue_simple_api_info": {
        "changed": false,
        "failed": false,
        "result": [
            {
                "enabled": true,
                "lsr-id": "1.2.3.4"
            }
        ]
    }
}

RouterOS 7.14.2

ok: [testrtr1] => {
    "queue_simple_api_info": {
        "changed": false,
        "failed": false,
        "result": [
            {
                "!afi": null,
                "!comment": null,
                "!distribute-for-default": null,
                "!hop-limit": null,
                "!loop-detect": null,
                "!path-vector-limit": null,
                "!preferred-afi": null,
                "!transport-addresses": null,
                "!use-explicit-null": null,
                ".id": "*19",
                "lsr-id": "1.2.3.4",
                "vrf": "main"
            }
        ]
    }
}

Copy link

codecov bot commented Mar 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.99%. Comparing base (a3fbe88) to head (554f12d).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #271   +/-   ##
=======================================
  Coverage   82.99%   82.99%           
=======================================
  Files          32       32           
  Lines        4051     4051           
  Branches      873      873           
=======================================
  Hits         3362     3362           
  Misses        506      506           
  Partials      183      183           
Flag Coverage Δ
integration 66.86% <ø> (ø)
sanity 22.08% <ø> (ø)
units 82.93% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

- Reordered fields to match CLI
- Set 'vrf' field as primary key
- Fixed distribute-for-default field
- Added missing fields from RouterOS 7.x
@samburney samburney marked this pull request as ready for review March 31, 2024 01:05
@felixfontein felixfontein merged commit 59f6591 into ansible-collections:main Apr 17, 2024
44 of 45 checks passed
@felixfontein
Copy link
Collaborator

@samburney thanks as well!

Copy link

Docs Build 📝

Thank you for contribution!✨

This PR has been merged and the docs are now incorporated into main:
https://ansible-collections.github.io/community.routeros/branch/main

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants