From 90581c607b7cbf4359fa1b5cadc5a7f31a9cfaf2 Mon Sep 17 00:00:00 2001 From: "Marcus Vinicius G. Cesario" Date: Tue, 6 Oct 2015 21:06:45 -0300 Subject: [PATCH] create class/methods to list and [un]deploy IPv4 and IPv6 networks with for API requests --- networkapiclient/ClientFactory.py | 23 +++++++++++++++++++++++ networkapiclient/Network.py | 8 ++++---- networkapiclient/__init__.py | 2 +- networkapiclient/version_control.py | 2 +- 4 files changed, 29 insertions(+), 6 deletions(-) diff --git a/networkapiclient/ClientFactory.py b/networkapiclient/ClientFactory.py index f24e0c8..2bd8d64 100755 --- a/networkapiclient/ClientFactory.py +++ b/networkapiclient/ClientFactory.py @@ -55,6 +55,8 @@ from networkapiclient.Healthcheck import Healthcheck from networkapiclient.ApiVipRequest import ApiVipRequest from networkapiclient.ApiInterface import ApiInterfaceRequest +from networkapiclient.ApiNetworkIPv4 import ApiNetworkIPv4 +from networkapiclient.ApiNetworkIPv6 import ApiNetworkIPv6 from networkapiclient.Rack import Rack from networkapiclient.RackServers import RackServers @@ -409,6 +411,27 @@ def create_api_interface_request(self): self.user_ldap ) + def create_api_network_ipv4(self): + + """Get an instance of Api Networkv4 services facade.""" + + return ApiNetworkIPv4( + self.networkapi_url, + self.user, + self.password, + self.user_ldap + ) + + def create_api_network_ipv6(self): + + """Get an instance of Api Networkv6 services facade.""" + + return ApiNetworkIPv6( + self.networkapi_url, + self.user, + self.password, + self.user_ldap + ) def create_rack(self): """Get an instance of rack services facade.""" diff --git a/networkapiclient/Network.py b/networkapiclient/Network.py index b6f834c..1054c05 100644 --- a/networkapiclient/Network.py +++ b/networkapiclient/Network.py @@ -626,9 +626,9 @@ def list(self, networkipv4=None, ipv4=None): uri = "api/dhcprelayv4/?" if networkipv4: - uri += "networkipv4=%d&" % networkipv4 + uri += "networkipv4=%s&" % networkipv4 if ipv4: - uri += "ipv4=%d" % ipv4 + uri += "ipv4=%s" % ipv4 return self.get(uri) @@ -753,9 +753,9 @@ def list(self, networkipv6=None, ipv6=None): uri = "api/dhcprelayv6/?" if networkipv6: - uri += "networkipv6=%d&" % networkipv6 + uri += "networkipv6=%s&" % networkipv6 if ipv6: - uri += "ipv6=%d" % ipv6 + uri += "ipv6=%s" % ipv6 return self.get(uri) diff --git a/networkapiclient/__init__.py b/networkapiclient/__init__.py index 43c16b1..58aab37 100644 --- a/networkapiclient/__init__.py +++ b/networkapiclient/__init__.py @@ -16,6 +16,6 @@ MAJOR_VERSION = '0' MINOR_VERSION = '6' -PATCH_VERSION = '7' +PATCH_VERSION = '8' VERSION = '.'.join((MAJOR_VERSION, MINOR_VERSION, PATCH_VERSION,)) diff --git a/networkapiclient/version_control.py b/networkapiclient/version_control.py index ecd1623..953a9e7 100755 --- a/networkapiclient/version_control.py +++ b/networkapiclient/version_control.py @@ -1 +1 @@ -CLIENT_VERSION = '0.6.7' +CLIENT_VERSION = '0.6.8'