Skip to content

Add VLAN-s with same number to different l2 domains #84

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

Closed
TafkaMax opened this issue Aug 19, 2022 · 3 comments · Fixed by #86
Closed

Add VLAN-s with same number to different l2 domains #84

TafkaMax opened this issue Aug 19, 2022 · 3 comments · Fixed by #86
Assignees
Labels
accepted This issue can reproduced and was accepted enhancement New feature or request

Comments

@TafkaMax
Copy link

Is your feature request related to a problem? Please describe.
I have created multiple l2 domains. I want to create a vlan3 in l2 domain number 1. It creates it. Now I want to create a vlan3 in l2 domain number 2. It wont create it.

Describe the solution you'd like
Create vlans with same number and name in different l2 domains.

Describe alternatives you've considered
Create the vlans using GUI.

image

image

image

Additional context

With the latest change from cmeissner in branch bugfix/80 that was merged to develop in codeaffen/php-ansible-modules I can not create vlans at all with the settings i wish.

failed: [REDACATED] (item={'vlan_id': '3', 'name': 'test1', 'description': 'test1', 'routing_domain': 'test_domain'}) => {"ansible_loop_var": "vlan", "changed": false, "msg": "Found no results while searching for vlan at /", "vlan": {"description": "test1", "name": "test1", "routing_domain": "test_domain", "vlan_id": "3"}}
failed: [REDACTED] (item={'vlan_id': '3', 'name': 'test2', 'description': 'test2', 'routing_domain': 'test_domain_2'}) => {"ansible_loop_var": "vlan", "changed": false, "msg": "Found no results while searching for vlan at /", "vlan": {"description": "test2", "name": "test2", "routing_domain": "test_domain_2", "vlan_id": "3"}}
#tasks
- name: IPAM create sections 
  codeaffen.phpipam.section:
    app_id: "ansible"
    username: "admin"
    password: "{{ docker_compose_ipam_admin_password }}"
    server_url: "https://{{ inventory_hostname }}"
    name: "{{ section.name }}"
    description: "{{ section.description }}"
    state: present
  loop: "{{ docker_compose_ipam_sections }}"
  loop_control:
    loop_var: section
  tags: admin_tasks_phpipam

- name: IPAM create L2 domains 
  codeaffen.phpipam.domain:
    app_id: "ansible"
    username: "admin"
    password: "{{ docker_compose_ipam_admin_password }}"
    server_url: "https://{{ inventory_hostname }}"
    name: "{{ l2_domain.name }}"
    description: "{{ l2_domain.description }}"
    sections: "{{ l2_domain.sections }}"
    state: present
  loop: "{{ docker_compose_ipam_l2_domains }}"
  loop_control:
    loop_var: l2_domain
  tags: admin_tasks_phpipam

- name: Create VLANS.
  codeaffen.phpipam.vlan:
    app_id: "ansible"
    username: "admin"
    password: "{{ docker_compose_ipam_admin_password }}"
    server_url: "https://{{ inventory_hostname }}"
    description: "{{ vlan.description }}"
    name: "{{ vlan.name }}"
    vlan_id: "{{ vlan.vlan_id }}"
    routing_domain: "{{ vlan.routing_domain }}"
    state: present
  loop: "{{ docker_compose_ipam_vlans }}"
  loop_control:
    loop_var: vlan
  tags: admin_tasks_phpipam

- name: Create IP subnets.
  codeaffen.phpipam.subnet:
    app_id: "ansible"
    username: "admin"
    password: "{{ docker_compose_ipam_admin_password }}"
    server_url: "https://{{ inventory_hostname }}"
    description: "{{ subnet.description }}"
    cidr: "{{ subnet.cidr }}"
    section: "{{ subnet.section }}"
    location: "{{ subnet.location|default(omit) }}"
    vlan: "{{ subnet.vlan|default(omit) }}"
      #discover_subnet: "{{ subnet.discover_subnet }}"
    dns_records: "{{ subnet.dns_records|default(omit) }}"
    nameserver: "{{ subnet.nameserver|default(omit) }}"
    state: present
  loop: "{{ docker_compose_ipam_subnets }}"
  loop_control:
    loop_var: subnet
  tags: admin_tasks_phpipam
#vars

docker_compose_ipam_sections:
  - name: "test_section"
    description: "test_section" 

docker_compose_ipam_l2_domains:
  - name: "test_domain" 
    description: "test_domain"
    sections:
      - "test_section"
  - name: "test_domain_2" 
    description: "test_domain_2"
    sections:
      - "test_section"

docker_compose_ipam_vlans:
  - vlan_id: "3"
    name: "test1"
    description: "test1"
    routing_domain: "test_domain"
  - vlan_id: "3"
    name: "test2"
    description: "test2"
    routing_domain: "test_domain_2"

docker_compose_ipam_subnets:
  - cidr: "192.168.1.0/24"
    section: "test_section"
    vlan: "3"
    description: "test"

@TafkaMax TafkaMax added the enhancement New feature or request label Aug 19, 2022
@cmeissner
Copy link
Member

Hi @TafkaMax,

Thank you for bringing this topic to our attention. I had already thought about a way to implement this feature and I'm optimistic to implement it in the near future.
I had already some tests with some API calls to have a feeling how to handle it although there is no option yet in API to query vlans for a given l2domain. I plan to implement a filter mechanism inside the phpipam_helper.py to filter results from api/<app_id>/vlan/.

@cmeissner cmeissner added the accepted This issue can reproduced and was accepted label Aug 20, 2022
@cmeissner cmeissner self-assigned this Aug 20, 2022
@TafkaMax
Copy link
Author

TafkaMax commented Aug 22, 2022

Another thing to consider is that when adding a subnet to a VLAN then in the GUI it shows the different l2 domains, but when using the ansible modules, currently the l2 domain can not be specified and it will choose randomly, which l2 domain it picks.

@cmeissner
Copy link
Member

Another thing to consider is that when adding a subnet to a VLAN then in the GUI it shows the different l2 domains, but when using the ansible modules, currently the l2 domain can not be specified and it will choose randomly, which l2 domain it picks.

Thank you for point this out. I created another issue. Feel free to start to contribute ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted This issue can reproduced and was accepted enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants