python-hnvclient
Python client for the HNV (Hyper-V Network Virtualization) REST API.
Free software: Apache license
Documentation: http://docs.openstack.org/developer/python-hnvclient
Source: http://git.openstack.org/cgit/openstack/python-hnvclient
Features
The Python interface matches the underlying REST API and can be employed in 3rd party projects.
>>> from hnvclient import client
>>> logical_networks = client.LogicalNetworks.get()
>>> for logical_network in logical_networks:
... print(logical_network.resource_id)
...
"63606911-e053-42cf-842e-29f67c90d5c6"
"c4cd42ff-5efb-4006-ac56-479730557926"
"cd804db3-df59-4f57-8a7d-11cc3f3c4d98"
>>> logical_network = client.LogicalNetworks.get(resource_id="cd804db3-df59-4f57-8a7d-11cc3f3c4d98")
>>> logical_network
<hnvclient.client.LogicalNetworks object at 0x7fcd79419910>
>>> logical_network.provisioning_state
u'Succeeded'
>>> logical_network.subnetworks
[<hnvclient.client.LogicalSubnetworks object at 0x7fcd79419150>]
>>> logical_network.subnetworks[0].resource_id
u'4390e3d8-c527-4534-882f-906c47ffd0bb'
from __future__ import print_function
import json
import sys
from hnvclient import client
def view_logical_networks():
"""List all the available logical networks."""
logical_networks = client.LogicalNetworks.get()
print("Logical networks:")
for logical_network in logical_networks:
print("\t - ", logical_network.resource_ref)
print("\t\t", "Logical subnetworks:")
for logical_subnetwork in logical_network.subnetworks:
print("\t\t - %s (%s)" % (logical_subnetwork.resource_id,
logical_subnetwork.address_prefix))
print("\t\t", "Virtual networks:")
for virtual_network in logical_network.virtual_networks:
print("\t\t - %s" % virtual_network.resource_ref)
def create_virtual_network():
"""Create a new virtual network on the first logical network."""
print("Creating a new virtual network.")
address_space = client.AddressSpace(
address_prefixes=["192.168.133.0/24"])
logical_network = client.Resource(
resource_ref=client.LogicalNetworks.get()[0].resource_ref)
virtual_network = client.VirtualNetworks(
resource_id="hvn-test",
address_space=address_space,
logical_network=logical_network,
)
virtual_network.commit()
print("The raw content of the new Virtual Network")
print(json.dumps(virtual_network.dump(), indent=4))
def remove_virtual_network():
"""Remove the new virtual network."""
print("Remove the new virtual network")
client.VirtualNetworks.remove(resource_id="hvn-test")
def main():
"""Logical networks sample entry point."""
client.setup()
view_logical_networks()
create_virtual_network()
view_logical_networks()
remove_virtual_network()
view_logical_networks()
Metadata
Release files for python-hnvclient 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| python-hnvclient-0.1.0.tar.gz | 75.8 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| python_hnvclient-0.1.0-py2-none-any.whl | Python 2 | none | any | Details |
Total release size: 155.8 kB
Release files / python-hnvclient-0.1.0.tar.gz
| Download URL | python-hnvclient-0.1.0.tar.gz |
|---|---|
| Size | 75.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
77b09e1cc7f28ade7a15976a34ff85a244fd358641fc19ad4a6618de541f74f7
|
|
BLAKE2b-256 checksum How to use checksums |
a9c8f8b8e19c12910b9fb918724fe722410a462a644aabfef614d638ed9e2b51
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / python_hnvclient-0.1.0-py2-none-any.whl
| Download URL | python_hnvclient-0.1.0-py2-none-any.whl |
|---|---|
| Size | 79.9 kB |
| Tags | Python 2 |
|
SHA-256 checksum How to use checksums |
5f478c926e1d8262d8a8a593b1de6b481e362b0c319dc996f4f39131f67daa23
|
|
BLAKE2b-256 checksum How to use checksums |
e519a6f762f677ded653adf7b2971145cc0de03912f46f15ac2cf930df6fdab6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for python-hnvclient 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.