Skip to content

Commit

Permalink
V 1.0.1
Browse files Browse the repository at this point in the history
added support for netbox 3.7.5 or higher, code optimization and bug fixes.
  • Loading branch information
Kaioguilherme1 committed Apr 20, 2024
1 parent 27fa137 commit 4a9d8dc
Show file tree
Hide file tree
Showing 110 changed files with 5,179 additions and 4,193 deletions.
19 changes: 7 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
Lista as dependencias
* requests
* python 3.11 ou superior
* [netbox](https://github.com/netbox-community/netbox)
* [netbox >=3.7.5](https://github.com/netbox-community/netbox)

## 🔧Instalação

Expand Down Expand Up @@ -130,7 +130,7 @@ Aqui está um checklist do que está atualmente disponível no NetboxCli e do qu
- [x] **Connections:** Interaja com conexões físicas e lógicas entre dispositivos de rede.
- [x] **Wireless:** Gerencie redes sem fio, pontos de acesso e configurações de Wi-Fi.
- [x] **IPAM:** Simplifique a gestão de blocos de endereços IP, facilitando a adição, recuperação e atualização.
- [x] **Overlay:** Suporte para redes de sobreposição, como VPNs e túneis.
- [x] **Vpn:** Suporte para redes de sobreposição, como VPNs e túneis.
- [x] **Virtualização:** Gerencie máquinas virtuais de maneira eficaz, desde a criação até a exclusão.
- [x] **Circuits:** Gerencie circuitos de rede, como conexões de fibra óptica e links externos.
- [x] **Power:** Acesse informações relacionadas ao fornecimento de energia e energia de seus dispositivos.
Expand All @@ -142,18 +142,13 @@ Aqui está um checklist do que está atualmente disponível no NetboxCli e do qu
Este checklist será atualizado à medida que novas funcionalidades forem implementadas.
Agradecemos por seu interesse e paciência enquanto trabalhamos para tornar o NetboxCli mais abrangente e útil para suas necessidades de automação e gerenciamento de rede.

## 📌 Versão 1.0.0
## 📌 Versão 1.0.1

### **Adições na Versão 1.0.0**

- **Connections:** Adicionado suporte para conexões físicas e lógicas entre dispositivos de rede.
- **Overlay:** Adicionado suporte para redes de sobreposição, como VPNs e túneis.
- **Circuits:** Adicionado suporte para circuitos de rede, como conexões de fibra óptica e links externos.
- **Power:** Adicionado suporte para informações relacionadas ao fornecimento de energia e energia de seus dispositivos.
- **Provisioning:** Adicionado suporte para provisionamento de rede, incluindo configurações de DHCP e DNS.
- **Customization:** Adicionado suporte para modelos e configurações personalizadas para seus dispositivos de rede.
- **Operations:** Adicionado suporte para informações sobre operações de rede, como manutenção e atualizações.
### **Adições na Versão 1.0.1**

- **Atualização do Overlay:** atualização do overlay atualmente tendo o nome de vpn com adicição de novos parametros
- **Correção de Bugs:** correção de bugs e melhorias no código
- **Criação de sistema de testes:** criação de testes para garantir a qualidade do código por enquanto openrando fazendo a validação dos metodos get()


## ✒️ Autores
Expand Down
99 changes: 51 additions & 48 deletions netboxCli/circuits/circuit_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,61 +8,64 @@ class CircuitTypes:
Attributes:
core (obj): Core object for create, retrieve, update, and delete actions.
Methods:
create(data):
Create a new resource using the provided data.
Args:
data (dict): Data to create the resource.
Returns:
dict: Data of the created resource.
get(id=None, name=None, tags=None):
Retrieve a resource based on ID or name.
Args:
id (int, optional): ID of the resource to retrieve.
name (str, optional): Name of the resource to retrieve.
Returns:
dict: Data of the retrieved resource.
update(data):
Update an existing resource.
Args:
data (dict): Updated data for the resource.
Returns:
dict: Data of the resource after the update.
delete(id):
Delete a resource based on its ID.
Args:
id (int): ID of the resource to delete.
Returns:
bool: True if deletion is successful, False otherwise.
"""

def __init__(self, core):
self._core = core

def create(self, data):
"""Create a new resource using the provided data."""
return self._core.create(data)

def get(self, id: int = None, name: str = None, tags: list = None, search: str = None, limit: int = 1000):
"""Retrieve a resource based on ID or name."""
"""
Retrieve a resource from the NetBox API based on ID, name, tags, or search query.
Args:
id (int, optional): The ID of the resource to retrieve.
name (str, optional): The name of the resource to retrieve.
tags (list, optional): List of tags to filter resources.
search (str, optional): Search query to filter resources.
limit (int, optional): Maximum number of results to return. Defaults to 1000.
Returns:
dict or list: If a single resource is found, returns a dictionary containing the data of the retrieved resource.
If multiple resources are found, returns a list of dictionaries containing the data of the retrieved resources.
If no resources are found, returns an empty list.
"""
return self._core.get(id, name, tags, search, limit)


def create(self, data):
"""
Create a new resource using the provided data.
Args:
data (dict): Data to create the resource. It should contain all the necessary information to create the resource.
Returns:
dict: Data of the created resource if successful.
If the creation fails or if the data is invalid, returns None.
"""
return self._core.create(data)

def update(self, data):
"""Update an existing resource."""
"""
Update an existing resource with the provided data.
Args:
data (dict): Updated data for the resource. It should contain all the necessary information to update the resource.
Returns:
dict: Data of the resource after the update if successful.
If the update fails or if the data is invalid, returns None.
"""
return self._core.update(data)

def delete(self, id: int):
"""Delete a resource based on its ID."""
"""
Delete a resource based on its ID.
Args:
id (int): ID of the resource to delete.
Returns:
bool: True if deletion is successful, False otherwise.
"""
return self._core.delete(id)

99 changes: 51 additions & 48 deletions netboxCli/circuits/circuits.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,61 +8,64 @@ class CircuitsClass:
Attributes:
core (obj): Core object for create, retrieve, update, and delete actions.
Methods:
create(data):
Create a new resource using the provided data.
Args:
data (dict): Data to create the resource.
Returns:
dict: Data of the created resource.
get(id=None, name=None, tags=None):
Retrieve a resource based on ID or name.
Args:
id (int, optional): ID of the resource to retrieve.
name (str, optional): Name of the resource to retrieve.
Returns:
dict: Data of the retrieved resource.
update(data):
Update an existing resource.
Args:
data (dict): Updated data for the resource.
Returns:
dict: Data of the resource after the update.
delete(id):
Delete a resource based on its ID.
Args:
id (int): ID of the resource to delete.
Returns:
bool: True if deletion is successful, False otherwise.
"""

def __init__(self, core):
self._core = core

def create(self, data):
"""Create a new resource using the provided data."""
return self._core.create(data)

def get(self, id: int = None, name: str = None, tags: list = None, search: str = None, limit: int = 1000):
"""Retrieve a resource based on ID or name."""
"""
Retrieve a resource from the NetBox API based on ID, name, tags, or search query.
Args:
id (int, optional): The ID of the resource to retrieve.
name (str, optional): The name of the resource to retrieve.
tags (list, optional): List of tags to filter resources.
search (str, optional): Search query to filter resources.
limit (int, optional): Maximum number of results to return. Defaults to 1000.
Returns:
dict or list: If a single resource is found, returns a dictionary containing the data of the retrieved resource.
If multiple resources are found, returns a list of dictionaries containing the data of the retrieved resources.
If no resources are found, returns an empty list.
"""
return self._core.get(id, name, tags, search, limit)


def create(self, data):
"""
Create a new resource using the provided data.
Args:
data (dict): Data to create the resource. It should contain all the necessary information to create the resource.
Returns:
dict: Data of the created resource if successful.
If the creation fails or if the data is invalid, returns None.
"""
return self._core.create(data)

def update(self, data):
"""Update an existing resource."""
"""
Update an existing resource with the provided data.
Args:
data (dict): Updated data for the resource. It should contain all the necessary information to update the resource.
Returns:
dict: Data of the resource after the update if successful.
If the update fails or if the data is invalid, returns None.
"""
return self._core.update(data)

def delete(self, id: int):
"""Delete a resource based on its ID."""
"""
Delete a resource based on its ID.
Args:
id (int): ID of the resource to delete.
Returns:
bool: True if deletion is successful, False otherwise.
"""
return self._core.delete(id)

99 changes: 51 additions & 48 deletions netboxCli/circuits/provider_accounts.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,61 +8,64 @@ class ProviderAccounts:
Attributes:
core (obj): Core object for create, retrieve, update, and delete actions.
Methods:
create(data):
Create a new resource using the provided data.
Args:
data (dict): Data to create the resource.
Returns:
dict: Data of the created resource.
get(id=None, name=None, tags=None):
Retrieve a resource based on ID or name.
Args:
id (int, optional): ID of the resource to retrieve.
name (str, optional): Name of the resource to retrieve.
Returns:
dict: Data of the retrieved resource.
update(data):
Update an existing resource.
Args:
data (dict): Updated data for the resource.
Returns:
dict: Data of the resource after the update.
delete(id):
Delete a resource based on its ID.
Args:
id (int): ID of the resource to delete.
Returns:
bool: True if deletion is successful, False otherwise.
"""

def __init__(self, core):
self._core = core

def create(self, data):
"""Create a new resource using the provided data."""
return self._core.create(data)

def get(self, id: int = None, name: str = None, tags: list = None, search: str = None, limit: int = 1000):
"""Retrieve a resource based on ID or name."""
"""
Retrieve a resource from the NetBox API based on ID, name, tags, or search query.
Args:
id (int, optional): The ID of the resource to retrieve.
name (str, optional): The name of the resource to retrieve.
tags (list, optional): List of tags to filter resources.
search (str, optional): Search query to filter resources.
limit (int, optional): Maximum number of results to return. Defaults to 1000.
Returns:
dict or list: If a single resource is found, returns a dictionary containing the data of the retrieved resource.
If multiple resources are found, returns a list of dictionaries containing the data of the retrieved resources.
If no resources are found, returns an empty list.
"""
return self._core.get(id, name, tags, search, limit)


def create(self, data):
"""
Create a new resource using the provided data.
Args:
data (dict): Data to create the resource. It should contain all the necessary information to create the resource.
Returns:
dict: Data of the created resource if successful.
If the creation fails or if the data is invalid, returns None.
"""
return self._core.create(data)

def update(self, data):
"""Update an existing resource."""
"""
Update an existing resource with the provided data.
Args:
data (dict): Updated data for the resource. It should contain all the necessary information to update the resource.
Returns:
dict: Data of the resource after the update if successful.
If the update fails or if the data is invalid, returns None.
"""
return self._core.update(data)

def delete(self, id: int):
"""Delete a resource based on its ID."""
"""
Delete a resource based on its ID.
Args:
id (int): ID of the resource to delete.
Returns:
bool: True if deletion is successful, False otherwise.
"""
return self._core.delete(id)

Loading

0 comments on commit 4a9d8dc

Please sign in to comment.