Skip to content

Commit

Permalink
Merge branch 'connector' into 'main'
Browse files Browse the repository at this point in the history
Add Connector

See merge request su_pub/ansible-i-doit!13
  • Loading branch information
fzakfeld committed Apr 11, 2023
2 parents 3f6b8cc + 8f957d8 commit 890ffb1
Show file tree
Hide file tree
Showing 4 changed files with 282 additions and 1 deletion.
129 changes: 129 additions & 0 deletions plugins/modules/idoit_cat_connector.py
@@ -0,0 +1,129 @@
#!/usr/bin/python

# Autogenerated by build.py DO NOT EDIT HERE

# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type


DOCUMENTATION = r'''
author:
- Sven Anders (during work by ScaleUp Technologies) (@tabacha)
description: Adds C__CATG__CONNECTOR category to an object if not there
or update values
extends_documentation_fragment:
- scaleuptechnologies.idoit.idoit_option
- scaleuptechnologies.idoit.category_options
- scaleuptechnologies.idoit.multi_category_options
module: idoit_cat_connector
options:
connection_type:
description: Schuko, ...
type: str
connection_type_id:
description: Id of connection_type
type: int
connector_sibling:
description: Assinged Input or Output id
type: int
description:
description: Description of the Model
type: str
in_or_output:
description: input (1) or output (2)
type: int
interface:
description: Speed of the interface
type: str
interface_id:
description: Id of Interface
type: int
title:
description: Title
type: str
short_description: Create or update a connector category to an object
'''

EXAMPLES = r'''
- name: Set a new Power Port
scaleuptechnologies.idoit.idoit_cat_connector:
connection_type: Schuko
idoit: '{{ idoit_access }}'
in_or_output: 1
obj_id: 1320
title: '01'
'''

RETURN = r'''
changed:
description: Are there changes?
returned: always
type: bool
data:
description: New data
sample:
description: ''
firmware: ''
manufacturer_id: 5
model_id: 22
product_id: ''
serial: Test 42
service_tag: CZJ037040C
type: complex
id:
description: Category Id of the saved category
type: int
return:
description: I-Doit API Result
type: complex
'''

IDOIT_SPEC = r'''
category: C__CATG__CONNECTOR
fields:
connection_type:
description: Schuko, ...
description_id: Id of connection_type
type: dialog
connector_sibling:
description: Assinged Input or Output id
type: int
description:
description: Description of the Model
type: html
interface:
description: Speed of the interface
description_id: Id of Interface
type: dialog
title:
description: Title
type: str
type:
ansible_name: in_or_output
description: input (1) or output (2)
type: int
single_value_cat: false
'''

from ansible_collections.scaleuptechnologies.idoit.plugins.module_utils.idoit import IdoitCategoryModule
import yaml


def run_module():
module = IdoitCategoryModule(
idoit_spec=yaml.safe_load(IDOIT_SPEC),
)
module.run()


def main():
run_module()


if __name__ == '__main__':
main()
88 changes: 88 additions & 0 deletions plugins/modules/idoit_cat_connector_info.py
@@ -0,0 +1,88 @@
#!/usr/bin/python

# Autogenerated by build.py DO NOT EDIT HERE

# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type


DOCUMENTATION = r'''
author:
- Scaleup Technologies
- Sven Anders (@tabacha)
description: Gets C__CATG__CONNECTOR category values
extends_documentation_fragment:
- scaleuptechnologies.idoit.idoit_option
- scaleuptechnologies.idoit.category_options
module: idoit_cat_connector_info
options: {}
short_description: Get values from a connector category to an object
'''

EXAMPLES = r'''
name: Search for a category for object 1320
scaleuptechnologies.idoit.idoit_cat_connector_info:
idoit: '{{ idoit_access }}'
obj_id: 1320
'''

RETURN = r'''
changed:
description: Are there changes?
returned: always
type: bool
data:
description: Data of the category
returned: always
type: complex
'''

IDOIT_SPEC = r'''
category: C__CATG__CONNECTOR
fields:
connection_type:
description: Schuko, ...
description_id: Id of connection_type
type: dialog
connector_sibling:
description: Assinged Input or Output id
type: int
description:
description: Description of the Model
type: html
interface:
description: Speed of the interface
description_id: Id of Interface
type: dialog
title:
description: Title
type: str
type:
ansible_name: in_or_output
description: input (1) or output (2)
type: int
single_value_cat: false
'''

from ansible_collections.scaleuptechnologies.idoit.plugins.module_utils.idoit import IdoitCategoryInfoModule
import yaml


def run_module():
module = IdoitCategoryInfoModule(
idoit_spec=yaml.safe_load(IDOIT_SPEC),
)
module.run()


def main():
run_module()


if __name__ == '__main__':
main()
33 changes: 33 additions & 0 deletions src/idoit/category/connector.yml
@@ -0,0 +1,33 @@
category: C__CATG__CONNECTOR
basename: connector
single_value_cat: False
fields:
title:
description: Title
type: str
type:
type: int
ansible_name: in_or_output
description: input (1) or output (2)
connection_type:
type: dialog
description: Schuko, ...
description_id: Id of connection_type
interface:
type: dialog
description: Speed of the interface
description_id: Id of Interface
description:
type: html
description: Description of the Model
connector_sibling:
type: int
description: Assinged Input or Output id
doc_examples:
- name: Set a new Power Port
scaleuptechnologies.idoit.idoit_cat_connector:
idoit: "{{ idoit_access }}"
obj_id: 1320
title: "01"
in_or_output: 1
connection_type: Schuko
33 changes: 32 additions & 1 deletion test/test.yml
Expand Up @@ -264,7 +264,7 @@
- name: Set Log Network Port
scaleuptechnologies.idoit.idoit_cat_net_log_port:
idoit: "{{ idoit_access_test_log }}"
obj_id: {{ my_obj_id }}
obj_id: "{{ my_obj_id }}"
search_by_fields:
- title
addresses:
Expand All @@ -289,13 +289,44 @@
- C__CATS__LAYER2_NET
tags:
- objects_read

- name: Create Layer2 Net
scaleuptechnologies.idoit.idoit_object:
idoit: "{{ idoit_access_test_log }}"
type: C__OBJTYPE__LAYER2_NET
title: "Mein VLAN 2"
tags:
- object_create

- name: Set a new Power Port
scaleuptechnologies.idoit.idoit_cat_connector:
idoit: "{{ idoit_access_test }}"
obj_id: 1567
title: "POWER IN"
search_by_fields:
- title
in_or_output: 1
connection_type: Schuko
register: conn_in
tags:
- connector

- name: Set output Power Port
scaleuptechnologies.idoit.idoit_cat_connector:
idoit: "{{ idoit_access_test }}"
obj_id: 1567
title: "{{ item }}"
in_or_output: 2
search_by_fields:
- title
connection_type: Schuko
connector_sibling: "{{ conn_in.id }}"
loop:
- OUT 01
- OUT 02
tags:
- connector

vars:
idoit_access_test:
api_key: "{{ lookup('ansible.builtin.env', 'IDOIT_KEY') }}"
Expand Down

0 comments on commit 890ffb1

Please sign in to comment.