Code Monkey home page Code Monkey logo

tpn-sdk-python's Introduction

master build CodeQL codecov Language grade: Python

Telstra Programmable Network Python SDK

Telstra Programmable Network is a self-provisioning platform that allows its users to create on-demand connectivity services between multiple end-points and add various network functions to those services. Programmable Network enables to connectivity to a global ecosystem of networking services as well as public and private cloud services. Once you are connected to the platform on one or more POPs (points of presence), you can start creating those services based on the use case that you want to accomplish. The Programmable Network API is available to all customers who have registered to use the Programmable Network. To register, please contact your account representative.

  • API version: 2.5.3
  • Package version: 0.1

For more information, please visit https://dev.telstra.com/content/programmable-network-api

Requirements.

Python 3.7+

Installation & Usage

pip install

pip install git+https://github.com/telstra/tpn-sdk-python.git

(you may need to run pip with root permission: sudo pip install git+https://github.com/telstra/tpn-sdk-python.git)

import telstra_pn 

Getting Started

Please follow the installation procedure and then run the following:

import telstra_pn
from telstra_pn import latency, renewal

tpns = telstra_pn.Session(accountid='34324',  # nosec
                          username='[email protected]',
                          password='154jk43l')

# allocate a new port in the AMLS data centre and select VLAN 20
e1 = tpns.switchports.create(
    datacentre=tpns.datacentres['AMLS'],
    interface_type='1000Base-TX',
    name='backup_dc_a'
    ).vlan(20)

# use an existing port named "primary_dc_a" and select VLAN 30
e2 = tpns.switchports['primary_dc_a'].vlan(30)

# create a flow (with an initial bandwidth contract) between
# the two switch ports (vlan 20 on one end, vlan 30 on the other)
# and add to the 'testtopo' topology.
flow = tpns.p2plinks.create(
    endpoints=[e1, e2],
    latency=latency.low,
    duration_hours=1,
    bandwidth_mbps=1000,
    renewal_option=renewal.auto_renew,
    topology=tpns.topologies('testtopo')
)

print(f'number of contracts: {len(flow.active_contracts)}')
print(f'total bandwidth: {flow.total_bandwidth}')
print(f'total price per hour: {flow.total_price}')
print(f'link status: {flow.status}')

Author

[email protected]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.