-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
480 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
from networkapiclient.ApiGenericClient import ApiGenericClient | ||
|
||
|
||
class ApiNetworkIPv4(ApiGenericClient): | ||
|
||
def __init__(self, networkapi_url, user, password, user_ldap=None): | ||
"""Class constructor receives parameters to connect to the networkAPI. | ||
:param networkapi_url: URL to access the network API. | ||
:param user: User for authentication. | ||
:param password: Password for authentication. | ||
""" | ||
|
||
super(ApiNetworkIPv4, self).__init__( | ||
networkapi_url, | ||
user, | ||
password, | ||
user_ldap | ||
) | ||
|
||
def deploy(self, id_networkv4): | ||
"""Deploy network in equipments and set column 'active = 1' in tables redeipv4 | ||
:param id_networkv4: ID for NetworkIPv4 | ||
:return: Equipments configuration output | ||
""" | ||
|
||
data = dict() | ||
uri = "api/networkv4/%s/equipments/" % id_networkv4 | ||
return self.post(uri, data=data) | ||
|
||
def get_by_id(self, id_networkv4): | ||
"""Get IPv4 network | ||
:param id_networkv4: ID for NetworkIPv4 | ||
:return: IPv4 Network | ||
""" | ||
|
||
uri = "api/networkv4/%s/" % id_networkv4 | ||
return self.get(uri) | ||
|
||
def list(self, environment_vip=None): | ||
"""List IPv4 networks | ||
:param environment_vip: environment vip to filter | ||
:return: IPv4 Networks | ||
""" | ||
|
||
data = dict() | ||
uri = "api/networkv4/?" | ||
if environment_vip: | ||
uri += "environment_vip=%s" % environment_vip | ||
|
||
return self.get(uri) | ||
|
||
def undeploy(self, id_networkv4): | ||
"""Remove deployment of network in equipments and set column 'active = 0' in tables redeipv4 ] | ||
:param id_networkv4: ID for NetworkIPv4 | ||
:return: Equipments configuration output | ||
""" | ||
|
||
uri = "api/networkv4/%s/equipments/" % id_networkv4 | ||
return self.delete(uri) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
from networkapiclient.ApiGenericClient import ApiGenericClient | ||
|
||
|
||
class ApiNetworkIPv6(ApiGenericClient): | ||
|
||
def __init__(self, networkapi_url, user, password, user_ldap=None): | ||
"""Class constructor receives parameters to connect to the networkAPI. | ||
:param networkapi_url: URL to access the network API. | ||
:param user: User for authentication. | ||
:param password: Password for authentication. | ||
""" | ||
|
||
super(ApiNetworkIPv6, self).__init__( | ||
networkapi_url, | ||
user, | ||
password, | ||
user_ldap | ||
) | ||
|
||
def deploy(self, id_networkv6): | ||
"""Deploy network in equipments and set column 'active = 1' in tables redeipv6 ] | ||
:param id_networkv6: ID for NetworkIPv6 | ||
:return: Equipments configuration output | ||
""" | ||
|
||
data = dict() | ||
uri = "api/networkv6/%s/equipments/" % id_networkv6 | ||
return self.post(uri, data=data) | ||
|
||
def get_by_id(self, id_networkv6): | ||
"""Get IPv6 network | ||
:param id_networkv4: ID for NetworkIPv6 | ||
:return: IPv6 Network | ||
""" | ||
|
||
uri = "api/networkv4/%s/" % id_networkv6 | ||
return self.get(uri) | ||
|
||
def list(self, environment_vip=None): | ||
"""List networks redeipv6 ] | ||
:param environment_vip: environment vip to filter | ||
:return: IPv6 Networks | ||
""" | ||
|
||
data = dict() | ||
uri = "api/networkv6/?" | ||
if environment_vip: | ||
uri += "environment_vip=%s" % environment_vip | ||
|
||
return self.get(uri) | ||
|
||
def undeploy(self, id_networkv6): | ||
"""Remove deployment of network in equipments and set column 'active = 0' in tables redeipv6 ] | ||
:param id_networkv6: ID for NetworkIPv6 | ||
:return: Equipments configuration output | ||
""" | ||
|
||
uri = "api/networkv6/%s/equipments/" % id_networkv6 | ||
return self.delete(uri) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.