Skip to content

Commit

Permalink
Merge pull request #8 from Onemind-Services-LLC/dev
Browse files Browse the repository at this point in the history
Updated Documentation
  • Loading branch information
abhi1693 authored Jan 23, 2023
2 parents 075897d + 2f58328 commit a373196
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 27 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: Upload Python Package

on:
release:
types: [published]

permissions:
contents: read

jobs:
deploy:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## [Unreleased](https://github.com/Onemind-Services-LLC/netbox-metatype-importer/tree/HEAD)

[Full Changelog](https://github.com/Onemind-Services-LLC/netbox-metatype-importer/compare/v0.0.2...HEAD)

**Merged pull requests:**

- Prepare for public release [\#5](https://github.com/Onemind-Services-LLC/netbox-metatype-importer/pull/5) ([abhi1693](https://github.com/abhi1693))

## [v0.0.2](https://github.com/Onemind-Services-LLC/netbox-metatype-importer/tree/v0.0.2) (2023-01-22)

[Full Changelog](https://github.com/Onemind-Services-LLC/netbox-metatype-importer/compare/v0.0.1...v0.0.2)
Expand Down
52 changes: 29 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,38 @@
The plugin uses [GitHub GraphQL API](https://docs.github.com/en/graphql) to load DeviceType and ModuleType from [NetBox Device Type Library](https://github.com/netbox-community/devicetype-library). The plugin loads only file tree representation from GitHub repo and shows it as a table with vendor and model columns. DeviceType definitions files are loaded when you try to import selected models.
To use GraphQL API you need to set GitHub personal access token in plugin settings. How to create the token, see ["Creating a personal access token."](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token)

## Compatibility
# Compatibility

This plugin in compatible with [NetBox](https://netbox.readthedocs.org/) 3.4 and later
| NetBox Version | Plugin Version |
|:----------------:|:--------------:|
| 3.4.x | 0.0.x |

## Installation
# Installation

The plugin is available as a Python package in pypi and can be installed with pip

```
pip install git+https://github.com/Onemind-Services-LLC/netbox-metatype-importer.git
```
Enable the plugin in [NetBox Configuration](https://netbox.readthedocs.io/en/stable/configuration/)
```
PLUGINS = ['netbox_metatype_importer']
```
* Install NetBox as per NetBox documentation
* Add to local_requirements.txt:
* `netbox-metatype-importer`
* Install requirements: `./venv/bin/pip install -r local_requirements.txt`
* Add to PLUGINS in NetBox configuration:
* `'netbox_metatype_importer',`
* Run migration: `./venv/bin/python netbox/manage.py migrate`

## Configuration
Put your GitHub personal access token to [NetBox plugins config](https://netbox.readthedocs.io/en/stable/configuration/optional-settings/#plugins_config)
```
PLUGINS_CONFIG = {
'netbox_metatype_importer': {
'github_token': '<YOUR-GITHUB-TOKEN>'
}
}
```

## Future
* Import device images from GitHub repo

The following options are available in the configuration file:

- `branch`
- __Type__: `String`
- __Description__: Branch of the NetBox Device Type Library repo
- __Default__: `master`
- `github_token`
- __Type__: `String`
- __Description__: GitHub personal access token
- `repo`
- __Type__: `String`
- __Description__: Name of the NetBox Device Type Library repo
- __Default__: `devicetype-library`
- `repo_owner`
- __Type__: `String`
- __Description__: Owner of the NetBox Device Type Library repo
- __Default__: `netbox-community`
4 changes: 3 additions & 1 deletion configuration/plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,7 @@
]

PLUGINS_CONFIG = { # type: ignore
"netbox_metatype_importer": {},
"netbox_metatype_importer": {
'github_token': 'YOUR_GITHUB_TOKEN'
},
}
4 changes: 2 additions & 2 deletions netbox_metatype_importer/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ class NetBoxMetatypeImporterConfig(PluginConfig):
'repo_owner': 'netbox-community',
'repo': 'devicetype-library',
'branch': 'master',
'github_token': '',
'use_gql': True,
'github_token': ''
}
required_settings = ['github_token']


config = NetBoxMetatypeImporterConfig
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name='netbox-metatype-importer',
version='0.0.2',
version='0.0.3',
description='Import Metatypes',
long_description='Import MetaTypes into NetBox',
long_description_content_type="text/markdown",
Expand Down

0 comments on commit a373196

Please sign in to comment.