Skip to content

Commit

Permalink
Merge branch 'master' into spurious-session-close-error
Browse files Browse the repository at this point in the history
  • Loading branch information
einarnn committed Aug 20, 2018
2 parents ace0cae + fb094c7 commit 9569a55
Show file tree
Hide file tree
Showing 12 changed files with 2,564 additions and 177 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ncclient/_version.py export-subst
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
include *.rst requirements.txt LICENSE
graft docs
graft examples
include versioneer.py
include ncclient/_version.py
93 changes: 74 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ by [Leonidas Poulopoulos (@leopoul)](http://ncclient.org) and Einar Nilsen-Nygaa

| Date | Release | Description |
| :----: | :-----: | :---------- |
| 08/20/18 | `0.6.1` | Migration to user `selectors` instead of `select`, allowing higher scale operations; improved `netconf:base:1.1` parsing. |
| 07/02/18 | `0.6.0` | Minor release reinstating Python 3.7 and greater compatibility, but necessitating a change to client code that uses `async_mode`. |
| 07/02/18 | `0.5.4` | New release rolling up myriad of small commits since `0.5.3`. Please note that this release is **incompatible wth Python 3.7** due to the use of a new Python 3.7 keyword, `async`, in function signatures. This will be resolved in 0.6.0|

Expand All @@ -41,6 +42,10 @@ or via pip:

pip install ncclient

Also locally via pip from within local clone:

pip install -U .

## Examples:

[ncclient] $ python examples/juniper/*.py
Expand All @@ -61,29 +66,36 @@ or integrate the following in your code:
As of 0.4.1 ncclient integrates Juniper's and Cisco's forks, lots of new concepts
have been introduced that ease management of Juniper and Cisco devices respectively.
The biggest change is the introduction of device handlers in connection paramms.
For example to invoke Juniper's functions annd params one has to re-write the above with ***device_params={'name':'junos'}***:
For example to invoke Juniper's functions annd params one has to re-write the above with `device_params={'name':'junos'}`:

from ncclient import manager

with manager.connect(host=host, port=830, username=user, hostkey_verify=False, device_params={'name':'junos'}) as m:
with manager.connect(host=host, port=830,
username=user, hostkey_verify=False,
device_params={'name':'junos'}) as m:
c = m.get_config(source='running').data_xml
with open("%s.xml" % host, 'w') as f:
f.write(c)

Device handlers are easy to implement and prove to be futureproof.

## Supported device handlers
### Supported device handlers

When instantiating a connection to a known type of NETCONF server:

* Juniper: device_params={'name':'junos'}
* Cisco CSR: device_params={'name':'csr'}
* Cisco Nexus: device_params={'name':'nexus'}
* Cisco IOS XR: device_params={'name':'iosxr'}
* Cisco IOS XE: device_params={'name':'iosxe'}
* Huawei: device_params={'name':'huawei'}
* Alcatel Lucent: device_params={'name':'alu'}
* H3C: device_params={'name':'h3c'}
* HP Comware: device_params={'name':'hpcomware'}
* Server or anything not in above: device_params={'name':'default'}
* Juniper: `device_params={'name':'junos'}`
* Cisco:
- CSR: `device_params={'name':'csr'}`
- Nexus: `device_params={'name':'nexus'}`
- IOS XR: `device_params={'name':'iosxr'}`
- IOS XE: `device_params={'name':'iosxe'}`
* Huawei:
- `device_params={'name':'huawei'}`
- `device_params={'name':'huaweiyang'}`
* Alcatel Lucent: `device_params={'name':'alu'}`
* H3C: `device_params={'name':'h3c'}`
* HP Comware: `device_params={'name':'hpcomware'}`
* Server or anything not in above: `device_params={'name':'default'}`


## For Developers
Expand All @@ -98,10 +110,10 @@ To run the same tests locally as are run via GitHub's CI/CD integration with Tra
mkvirtualenv ncclient-testing
```

1. Install your local `ncclient` package:
1. Install your local `ncclient` package (ensuring you are in your virtual environment):

```
python setup.py install
pip install -U .
```

1. Install testing dependencies:
Expand All @@ -116,15 +128,58 @@ To run the same tests locally as are run via GitHub's CI/CD integration with Tra
nosetests test --rednose --verbosity=3
```

### Making a Release

As of `0.6.1`, `versioneer` has been integrated into the `ncclient` codebase. This simplifies the creation of a new release, by ensuring that version numbers are automatically generated from the git tag used for the release, which **must** be in the form `v0.1.2`. Versioneer also allows for the clean install of development versions locally using pip. For example:

```
$ pip install -U .
Processing /opt/git-repos/versioneer-ncclient
## Changes | brief - v0.5.3
[...intermediate ouput elided...]
* Add notifications support
* Add support for ecdsa keys
* Various bug fixes
Building wheels for collected packages: ncclient
Running setup.py bdist_wheel for ncclient ... done
Stored in directory: /Users/einarnn/Library/Caches/pip/wheels/fb/48/a8/5c781ebcfff7f091e18950e125c0ff638a5a2dc006610aa1e5
Successfully built ncclient
Installing collected packages: ncclient
Found existing installation: ncclient 0.6.1
Uninstalling ncclient-0.6.1:
Successfully uninstalled ncclient-0.6.1
Successfully installed ncclient-0.6.0+23.g0d9ccd6.dirty
```

Thus, making a release becomes a simple process:

1. Ensure all tests run clean (ideally both locally and via Travis) and that `README.md` (yes, this file!!) has been updated appropriately.
2. Apply appropriate version tag, e.g. `git tag v0.6.1`
3. Build packages:

```
python setup.py bdist sdist
```

4. After ensuring twine is installed, test twine upload:

```
twine upload \
--repository-url https://test.pypi.org/legacy/ \
-u ******* -p ******* \
dist/ncclient-0.6.1.tar.gz
````

5. Push git tags back to origin, `git push --tags`
6. Do real twine upload:

```
twine upload \
-u ******* -p ******* \
dist/ncclient-0.6.1.tar.gz
```

## Contributors

* v0.6.1: @einarnn, @glennmatthews, @bryan-stripe, @nickylba
* v0.6.0: @einarnn
* v0.5.4: @adamcubel, Joel Teichroeb, @leopoul, Chase Garner, @budhadityabanerjee, @earies, @ganeshrn, @vnitinv, Siming Yuan, @mirceaaulinic, @stacywsmith, Xavier Hardy, @jwwilcox, @QijunPan, @avangel, @marekgr, @hugovk, @felixonmars, @dexteradeus
* v0.5.3: [Justin Wilcox](https://github.com/jwwilcox), [Stacy W. Smith](https://github.com/stacywsmith), [Mircea Ulinic](https://github.com/mirceaulinic), [Ebben Aries](https://github.com/earies), [Einar Nilsen-Nygaard](https://github.com/einarnn), [QijunPan](https://github.com/QijunPan)
Expand Down
4 changes: 4 additions & 0 deletions ncclient/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,7 @@
class NCClientError(Exception):
"Base type for all NCClient errors"
pass

from ._version import get_versions
__version__ = get_versions()['version']
del get_versions
Loading

0 comments on commit 9569a55

Please sign in to comment.