# nsg-python-sdk
This repository contains changes for nsg-python-sdk python package. This package will be uploaded to the PyPI so that customer can install package and test their changes.
## nsg-python-sdk package
Install nsg-python-sdk from PyPI. This package exposes nsgsdk binary.
`pip install nsg-python-sdk`
currently nsgsdk supports running tags, variables and views app request. Supported apps can be found by running the following command.
```sh
# nsgsdk -h
Usage: nsgsdk [OPTIONS] COMMAND [ARGS]...
Options:
--version Show the version and exit.
-h, --help Show this message and exit.
Commands:
tags run tags application
test run tests in the current repository
variables run variable builder application
views run views application
```
### How to run apps on local machine
Go to the directory which contains scripts for testing.
To run module `tags` using embedded `tags_app.py`, we could use the following steps
to check the required parameters and options we can use the help option
```sh
# nsgsdk tags -h
Usage: nsgsdk tags [OPTIONS] INPUT_DEVICE
NetSpyGlass tags assignment Python application
Options:
-f, --format [json|pb] use this format to generate output [default: json]
-o, --output TEXT the file name where the result should be stored; if
missing or equal to "-", use stdout
-h, --help Show this message and exit.
```
`tags` command specifies that we want to run the tags app.
then to run it with input
```sh
nsgsdk tags <path_to_input_file> -o <path_to_output_file>
```
### Run unit test cases.
* cd to the scripts directory.
* create directory `tests` and put your test modules there. If your tests need data files, we recommend
placing them in the directory `tests/fixtures`. Directory structure should look like this:
```
~/src/test-repo/scripts$ tree
├── __init__.py
├── rules.py
├── tags.py
├── tests
│ ├── __init__.py
│ ├── fixtures
│ │ └── ex2200-pb.json
│ └── test_tags.py
├── var_builder.py
└── views.py
```
to run the tests, change to the directory which contains scripts directory. We can use the following command
`nsgsdk test`
To check the required parameters and option we can use the following command:
```commandline
nsgsdk test -h
Usage: nsgsdk test [OPTIONS] PATH
Options:
-h, --help Show this message and exit.
```
here Path can be module or directory path.
To run the tests in the directory, we can use the following command:
`nsgsdk test scripts/tests`
To run the tests in module, we can use the following command:
` nsgsdk test scripts/tests/test_tags_1.py`
Raw data
{
"_id": null,
"home_page": "https://github.com/happygears/nsg-python-sdk",
"name": "nsg-python-sdk",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": "",
"keywords": "",
"author": "Happy Gears, Inc",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/98/12/44b40b0f36ff07d42b22cd16fc0e1789fc6825c849fc9152af3751436e6e/nsg-python-sdk-0.0.4.tar.gz",
"platform": null,
"description": "# nsg-python-sdk\n\nThis repository contains changes for nsg-python-sdk python package. This package will be uploaded to the PyPI so that customer can install package and test their changes. \n\n## nsg-python-sdk package\n\nInstall nsg-python-sdk from PyPI. This package exposes nsgsdk binary. \n\n`pip install nsg-python-sdk`\n\ncurrently nsgsdk supports running tags, variables and views app request. Supported apps can be found by running the following command.\n\n```sh\n# nsgsdk -h\nUsage: nsgsdk [OPTIONS] COMMAND [ARGS]...\n\nOptions:\n --version Show the version and exit.\n -h, --help Show this message and exit.\n\nCommands:\n tags run tags application\n test run tests in the current repository\n variables run variable builder application\n views run views application\n```\n\n### How to run apps on local machine \n\nGo to the directory which contains scripts for testing.\n\nTo run module `tags` using embedded `tags_app.py`, we could use the following steps\n\nto check the required parameters and options we can use the help option \n\n```sh\n# nsgsdk tags -h\nUsage: nsgsdk tags [OPTIONS] INPUT_DEVICE\n\n NetSpyGlass tags assignment Python application\n\nOptions:\n -f, --format [json|pb] use this format to generate output [default: json]\n -o, --output TEXT the file name where the result should be stored; if\n missing or equal to \"-\", use stdout\n -h, --help Show this message and exit.\n```\n\n`tags` command specifies that we want to run the tags app.\n\nthen to run it with input\n\n```sh\nnsgsdk tags <path_to_input_file> -o <path_to_output_file>\n```\n\n### Run unit test cases. \n\n* cd to the scripts directory.\n* create directory `tests` and put your test modules there. If your tests need data files, we recommend\n placing them in the directory `tests/fixtures`. Directory structure should look like this:\n\n```\n ~/src/test-repo/scripts$ tree\n \u251c\u2500\u2500 __init__.py\n \u251c\u2500\u2500 rules.py\n \u251c\u2500\u2500 tags.py\n \u251c\u2500\u2500 tests\n \u2502 \u251c\u2500\u2500 __init__.py\n \u2502 \u251c\u2500\u2500 fixtures\n \u2502 \u2502 \u2514\u2500\u2500 ex2200-pb.json\n \u2502 \u2514\u2500\u2500 test_tags.py\n \u251c\u2500\u2500 var_builder.py\n \u2514\u2500\u2500 views.py\n```\n\nto run the tests, change to the directory which contains scripts directory. We can use the following command\n\n`nsgsdk test`\n\nTo check the required parameters and option we can use the following command:\n\n```commandline\nnsgsdk test -h\nUsage: nsgsdk test [OPTIONS] PATH\n\nOptions:\n -h, --help Show this message and exit.\n```\n\nhere Path can be module or directory path.\n\nTo run the tests in the directory, we can use the following command:\n\n`nsgsdk test scripts/tests`\n\nTo run the tests in module, we can use the following command:\n\n` nsgsdk test scripts/tests/test_tags_1.py`\n\n\n",
"bugtrack_url": null,
"license": "Apache",
"summary": "NetSpyGlass SDK",
"version": "0.0.4",
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "b5e8f9b9d281ca9773312c7c9d3d751a102ee492df874726de0078ab3f0fe3db",
"md5": "464c37b881584475109475d7c043d141",
"sha256": "4d70c55e6a99670aca3aa627db6f76942cde1d3f4f1cc5f7292820ff27afe5f7"
},
"downloads": -1,
"filename": "nsg_python_sdk-0.0.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "464c37b881584475109475d7c043d141",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 85800,
"upload_time": "2023-01-05T10:11:22",
"upload_time_iso_8601": "2023-01-05T10:11:22.314700Z",
"url": "https://files.pythonhosted.org/packages/b5/e8/f9b9d281ca9773312c7c9d3d751a102ee492df874726de0078ab3f0fe3db/nsg_python_sdk-0.0.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "981244b40b0f36ff07d42b22cd16fc0e1789fc6825c849fc9152af3751436e6e",
"md5": "0171c796a73f30318b2dadbcf7c38dd1",
"sha256": "6faefc49f19c930776c762a79b0ab78c9b9d09e65926f9c00bced6b7339a5f4f"
},
"downloads": -1,
"filename": "nsg-python-sdk-0.0.4.tar.gz",
"has_sig": false,
"md5_digest": "0171c796a73f30318b2dadbcf7c38dd1",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 65589,
"upload_time": "2023-01-05T10:11:25",
"upload_time_iso_8601": "2023-01-05T10:11:25.368318Z",
"url": "https://files.pythonhosted.org/packages/98/12/44b40b0f36ff07d42b22cd16fc0e1789fc6825c849fc9152af3751436e6e/nsg-python-sdk-0.0.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-01-05 10:11:25",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "happygears",
"github_project": "nsg-python-sdk",
"lcname": "nsg-python-sdk"
}