Giter Club home page Giter Club logo

acos-client's People

Contributors

0xtobit avatar afrin-chakure-a10 avatar bosatsu avatar cedev avatar dougwig avatar hthompson6 avatar jak3kaj avatar jake2184 avatar jeffbuttars avatar jjmanzer-godaddy avatar johno avatar jwilhelm-godaddy avatar krislindgren avatar mmdurrant avatar nehakembalkara10 avatar nickbender avatar omkartelee-a10 avatar rahulkatre-a10 avatar sana-a10 avatar sandplunge avatar ssrinivasan-a10 avatar tom-porat-xyz avatar userlocalhost avatar y2kbadbug avatar ytsai-a10 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

acos-client's Issues

License Manager Support

As an acos-client user, I would like the ability to configure ACOS license management.

  • Set license manager settings
  • Connect to license server
  • Set overage parameters?
  • Reminder List?

Getting AXAPI driver error on json "destination" field

Getting the following error on all calls to vThunder running ACOS 4.1.4-P2

Driver error: 1023590414 Failed to handle json field "destination". Incorrect string value. Only strings defined by schema are allowed.
Neutron server returns request_ids: ['req-79dbb06a-5d31-491f-b274-059dd6498ab0']

Somehow PR #240 is causing this issue. Reverting the PR changes resolves the issue in my test environment. I don't see why this PR is causing the issue since the default values of the optional arguments are identical to the hard coded value in the original code.

Whatever is calling write_memory must be passing different values for those arguments.

slb.virtual_server.vport.get returns any vports and not the ones being searched for

Expected behavior: v21 of slb.virtual_server.vport.get() will return the correct matching vport.

Actual behavior: Doing a GET against slb.virtual_server.vport will return only the first existing vport and not necessarily the correct one. Even if you provide data that does not match any existing vport you will get the first vport.

Reproducible: always

Steps to reproduce:

import acos_client

api = acos_client.Client(
    'x.x.x.x',
    acos.AXAPI_21,
    'user',
    'pass'
)
api.slb.virtual_server.create(
    'vip', '2.1.1.5'
)
api.slb.virtual_server.vport.create(
    'vip',
    'vport',
    api.slb.virtual_server.vport.TCP,
    80,
    service_group_name=''
)
api.slb.virtual_server.vport.get(
    'vip',
    'vport',
    api.slb.virtual_server.vport.TCP,
    81
)
{'protocol': 2, 'port': 80, 'name': 'vport', 'service_group': '', 'connection_limit': {'status': 0}, 'default_selection': 1, 'received_hop': 0, 'status': 1, 'stats_data': 1, 'extended_stats': 0, 'snat_against_vip': 0, 'vport_template': 'default', 'vport_acl_id': 0, 'aflex_list': [], 'send_reset': 0, 'ha_connection_mirror': 0, 'direct_server_return': 0, 'syn_cookie': {'syn_cookie': 0, 'sack': 0}, 'source_nat': '', 'source_nat_auto': 0, 'source_nat_precedence': 0, 'tcp_template': '', 'source_ip_persistence_template': '', 'ip_in_ip': 0, 'pbslb_template': '', 'acl_natpool_binding_list': []}

Nat-Pool creation is not possible without fix. [BUG]

Bug location:

self._post(self.url_prefix + name, params, **kwargs)

Currently NAT-Pool creation using the ACOS-Client is broken. When calling the nat.pool.create() function, a request is sent using an incorrect URL. This request results in a response containing an error message from the A10 device, and leaves the ACOS-Client user unable to create any ipv4 NAT-Pools.

The URL composed by the client is as follows: https://IP/axapi/v3/ip/nat/pool/POOLNAME

POOLNAME is added in the file /acos_client/v30/nat.py at line 40, which should not be the case as a new pool is being created. When inspecting an existing pool this addition of POOLNAME is correct, but should not be done when creating pools.

Bug fix: Simply removing '+ name' at line 40

This fix does not break any other functionality as the __set() method is only used when creating new pools.

vport updates on 4.0.3 sometimes returns error

We might need to catch and maybe send '' or not None? Clearing templates will be tricky.

send: 'POST /axapi/v3/slb/virtual-server/e1ecdb70-2e0a-4451-9e47-2bde8c15ce0b/port/80+tcp HTTP/1.1\r\nHost: 10.90.100.
249\r\nContent-Length: 262\r\nAccept-Encoding: gzip, deflate\r\nAccept: */*\r\nUser-Agent: ACOS-Client-AGENT-1.3.1alph
a\r\nConnection: keep-alive\r\nContent-type: application/json\r\nAuthorization: A10 56d8e5f203ca3f262ef4a3d56c9570\r\n
\r\n{"port": {"service-group": "e1ecdb70-2e0a-4451-9e47-2bde8c15ce0b-PORT-80", "protocol": "tcp", "name": "c5d80c89-9a
55-4e4e-97ed-f50785d895e1", "auto": 1, "template-persist-source-ip": null, "extended-stats": 1, "port-number": 80, "te
mplate-persist-cookie": null}}'
reply: 'HTTP/1.1 400 Bad Request\r\n'
header: Date: Tue, 29 Mar 2016 21:57:55 GMT
header: Server: Apache
header: Content-Length: 200
header: Connection: close
header: Content-Type: application/json
axapi_http: data = {
    "response": {
        "status": "fail",
        "err": {
            "msg": "JSON message is wrong.",
            "code": 1023508480,
            "from": "JSON",
            "location": "port.template-persist-cookie"
        }
    }
}
016-03-29 16:57:55.997 TRACE neutron_lbaas.services.loadbalancer.plugin   File "/usr/local/src/acos-client/acos_client/v30/slb/virtual_port.py", line 115, in update
2016-03-29 16:57:55.997 TRACE neutron_lbaas.services.loadbalancer.plugin     **kwargs)
2016-03-29 16:57:55.997 TRACE neutron_lbaas.services.loadbalancer.plugin   File "/usr/local/src/acos-client/acos_client/v30/slb/virtual_port.py", line 94, in _set
2016-03-29 16:57:55.997 TRACE neutron_lbaas.services.loadbalancer.plugin     return self._post(url, params, **kwargs)
2016-03-29 16:57:55.997 TRACE neutron_lbaas.services.loadbalancer.plugin   File "/usr/local/src/acos-client/acos_client/v30/base.py", line 38, in _post
2016-03-29 16:57:55.997 TRACE neutron_lbaas.services.loadbalancer.plugin     return self._request('POST', action, params, **kwargs)
2016-03-29 16:57:55.997 TRACE neutron_lbaas.services.loadbalancer.plugin   File "/usr/local/src/acos-client/acos_client/v30/base.py", line 32, in _request
2016-03-29 16:57:55.997 TRACE neutron_lbaas.services.loadbalancer.plugin     self.auth_header, **kwargs)
2016-03-29 16:57:55.997 TRACE neutron_lbaas.services.loadbalancer.plugin   File "/usr/local/src/acos-client/acos_client/v30/axapi_http.py", line 127, in request
2016-03-29 16:57:55.997 TRACE neutron_lbaas.services.loadbalancer.plugin     acos_responses.raise_axapi_ex(r, method, api_url)
2016-03-29 16:57:55.997 TRACE neutron_lbaas.services.loadbalancer.plugin   File "/usr/local/src/acos-client/acos_client/v30/responses.py", line 204, in raise_axapi_ex
2016-03-29 16:57:55.997 TRACE neutron_lbaas.services.loadbalancer.plugin     raise ae.ACOSException(code, response['response']['err']['msg'])
2016-03-29 16:57:55.997 TRACE neutron_lbaas.services.loadbalancer.plugin ACOSException: 1023508480 JSON message is wrong.
2016-03-29 16:57:55.997 TRACE neutron_lbaas.services.loadbalancer.plugin

Many slb methods do not return a json response

In both v21 and v30 of acos_client, when calling the .create(), .update() or .delete() method on various slb objects, slb.service.group.create() or slb.server.delete() for example, the acos_client doesn't return anything:

>>> r = v1.slb.server.create('test99', '1.1.1.1')
>>> type(r)
<class 'NoneType'>

This seems to be mostly because there are not return statements in the method itself:

    def create(self, name, ip_address, **kwargs):
        params = {
            "server": {
                "name": name,
                "host": ip_address,
                "status": kwargs.get('status', 1)
            }
        }
        self._post("slb.server.create", params, **kwargs)

It would be helpful, especially in the v21 client which always returns a status code of 200 for these methods to return the json back from the load-balancer.

acos-client/acos_client/version.py is not up to date

The version reported in that file is 1.4.5 though it should be perhaps 2.4.0 per the setup.py file.

>>> acos_client.VERSION
'1.4.6'
>>> exit()
(thor_api) LMTC-JMANZER:thor_api jjmanzer$ pip list acos_client | grep acos
acos-client                      2.4.0

Compatibility with other Python versions

My team and I need to be able to use this library in Python 3.6, so I've begun testing against that.

In the process, however, I found that the tests are currently only passing against 2.7; they are not even passing currently against 2.6 or pypy2. Interestingly, it appears that Travis is no longer building this project, so this was never exposed.

I have begun the process of fixing the compatibility, which will likely result in a number of pull requests in order to make them smaller and more easily consumable.

Needs examples of how to list information

The README.md shows an example of how to manipulate information through the client, but not how to obtain information.

For example, how do I get list of slb.virtual_server? Can I filter them? How do I get from virtual_server to service_group, and from there to the server objects in that group?

(There is a general need for more documentation, but having more examples would be a great start)

v21 and v30 slb.virtual_server.vport.create does not support tcp_template (and presumably udp_template)

Given an existing virtual_server on an A10 with V21 or V30 API support
when calling slb.virtual_server.vport.create('foo', tcp_template='CONN-TIMEOUT-15S')
or when calling slb.virtual_server.vport.create('foo', udp_template='CONN-TIMEOUT-15S')
then the tcp or udp templates should be applied like so...

!! slb virtual-server SG2NLHG558C1558-WEB-VS x.x.x.x /24
!!    port 80  tcp
!!       name foo
!!       template tcp CONN-TIMEOUT-15S

or

!! slb virtual-server SG2NLHG558C1558-WEB-VS x.x.x.x /24
!!    port 80  udp
!!       name foo
!!       template dup CONN-TIMEOUT-15S

This is so API users can control their own idle-timeout values on vports.

acos_client 21 has weird data for connection limit

When I do a slb.virtual_server.vport.get against an AX2500 using version 21 of the API I get the following data. Note that connection_limit returns a status which makes no sense here.

{
    "protocol": 11,
    "port": 80,
    "name": "TEST-1.1.1.1-TCP-80",
    "service_group": "TEST-SG",
    "connection_limit": {
        "status": 0
    },
    "default_selection": 1,
    "received_hop": 0,
    "status": 1,
    "stats_data": 1,
    "extended_stats": 0,
    "snat_against_vip": 0,
    "vport_template": "default",
    "vport_acl_id": 0,
    "aflex_list": [],
    "send_reset": 0,
    "direct_server_return": 0,
    "syn_cookie": {
        "syn_cookie": 0,
        "sack": 0
    },
    "source_nat": "",
    "source_nat_auto": 0,
    "source_nat_precedence": 0,
    "http_template": "",
    "ram_cache_template": "",
    "tcp_proxy_template": "",
    "tcp_proxy_server_template": "",
    "tcp_proxy_client_template": "",
    "server_ssl_template": "",
    "conn_reuse_template": "",
    "source_ip_persistence_template": "",
    "pbslb_template": "",
    "acl_natpool_binding_list": []
}

Here is an example of the GET against acos_client 30 to compare with:

{
    "port": {
        "port-number": 81,
        "protocol": "tcp",
        "range": 0,
        "name": "_2.1.1.3_TCP_81",
        "conn-limit": 8000000,
        "reset": 0,
        "no-logging": 0,
        "use-alternate-port": 0,
        "action": "enable",
        "def-selection-if-pref-failed": "def-selection-if-pref-failed",
        "ha-conn-mirror": 0,
        "skip-rev-hash": 0,
        "message-switching": 0,
        "force-routing-mode": 0,
        "reset-on-server-selection-fail": 0,
        "clientip-sticky-nat": 0,
        "extended-stats": 1,
        "snat-on-vip": 0,
        "stats-data-action": "stats-data-enable",
        "syn-cookie": 0,
        "no-auto-up-on-aflex": 0,
        "scaleout-bucket-count": 32,
        "auto": 0,
        "service-group": "pool1",
        "ipinip": 0,
        "rtp-sip-call-id-match": 0,
        "use-rcv-hop-for-resp": 0,
        "template-tcp": "default",
        "template-virtual-port": "default",
        "use-default-if-no-server": 0,
        "no-dest-nat": 0,
        "uuid": "8df0f65a-9245-11e8-9bf6-c3c3b3edcd4e"
    }
}

Create server when creating new member

Request

As an acos-client user, I would like to have the ability to create a new server when creating a new member for a specified service group should said server not exist.

Argument

Currently, ACOS users have the ability to either add an existing server to a service group or create and then add a server within a single step. Acos-client users on the other hand only have the ability to add an existing server through the create function.

Updated workflow

Existing Server -> (associate) -> Member Created -> Added to Service Group

(create) -> Server Created -> Member Created -> Added to Service Group

Tab Error

I believe the following code introduced a Tab Error:

params['monitor']['override-port'] = int(port)

  File "<string>", line 91
    params['monitor']['override-port'] = int(port)
    ^
TabError: inconsistent use of tabs and spaces in indentation

Looks like this is resolved in #176 and in #178

The sample provided in the Readme does not work

Maybe something changed in the API since the sample has been written.
Had to modify it to make it work:

import acos_client as acos

c = acos.Client('172.31.31.31', acos.AXAPI_21, 'admin', 'a10')
c.slb.server.create('s1', '1.1.1.1')
c.slb.server.create('s2', '1.1.1.2')
c.slb.service_group.create('pool1', c.slb.service_group.TCP,
c.slb.service_group.ROUND_ROBIN)
c.slb.virtual_server.create("vip1", '1.1.1.3', 1,)
c.slb.virtual_server.vport.create("vip1", "vs1", c.slb.virtual_server.vport.HTTP, 80, "pool1")
c.slb.hm.create("hm1", c.slb.hm.HTTP, 5, 5, 5, 'GET', '/', '19', 80)
c.slb.service_group.update('pool1', health_monitor='hm1')
c.slb.service_group.member.create("pool1", "s1", 80)
c.slb.service_group.member.create("pool1", "s2", 80)

need way to set ha-conn-mirror in v21 and v30

Given an existing virtual_server called foo on an A10 with V21 or V30 API support
When calling slb.virtual_server.vport.create('foo', 'bar', ha_conn_mirror=1)
Then the attribute should assigned like so...

!! slb virtual-server foo x.x.x.x /24
!!    port 80  tcp
!!       name bar
!!       ha-conn-mirror

A question about the aXAPI reference of v3.0

We use virtual appliances of ACOS v4.1.1. And they could be managed through the aXAPI v3.0 as you know.

I could get the aXAPI reference of v2.1 by following.

ftp://srv01.marubeni-sys.com/other/network1/A10/%8E%91%97%BF/ACOS%202.7.2/references/A10_Thunder_aXAPI_Ref-v21-2014_05_16b.pdf

But I have never found the API reference of v3.0.

If that is public, could you please tell me the URL of it.

Thank you.

Should have compatibility with python3

Here I am testing with python 3.4.2

[1]> import acos_client
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-1-7f16c23ae206> in <module>()
----> 1 import acos_client

/home/traff/code/a10/acos-client/acos_client/__init__.py in <module>()
     15 
     16 from acos_client.version import VERSION
---> 17 from acos_client.client import Client
     18 from acos_client.hash import Hash
     19 

/home/traff/code/a10/acos-client/acos_client/client.py in <module>()
     15 import acos_client
     16 
---> 17 import errors as acos_errors
     18 import v21.axapi_http
     19 from v21.ha import HA as v21_HA

ImportError: No module named 'errors'

Call to v21 AXAPI slb.virtual_server.vport.get() results in TypeError

Issue:
Calling slb.virtual_server.vport.get() using v21 client results in a type error.

Traceback:

Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/Users/jjmanzer/development/thor_api/.venv/src/acos-client/acos_client/v21/slb/virtual_port.py", line 105, in get
    if len(filtered_vports) > 0:
TypeError: object of type 'filter' has no len()

Steps to reproduce:

import acos_client as acos
api = acos.Client(ip_address, acos.AXAPI_21, username, password)
api.slb.hm.create('healthcheck1', api.slb.hm.HTTP, 5, 5, 5, 'GET', '/', '200', 80)

api.slb.service_group.create('pool1',
                             protocol=api.slb.service_group.TCP,
                             hm_name='healthcheck1',
                             lb_method=api.slb.service_group.LEAST_CONNECTION)

api.slb.server.create('server1', '2.1.1.7',
                           conn_limit=100,
                           conn_resume=90)

api.slb.server.port.create('server1', 80, api.slb.service_group.TCP,
                           conn_limit=100,
                           conn_resume=90)

api.slb.service_group.member.create('pool1', 'server1', 80)

api.slb.virtual_server.create('testvserver1', '1.1.1.5',
                              vrid=1,
                              template_virtual_server='ICMP-RATE-LIMIT')

api.slb.virtual_server.vport.create('testvserver1', '_2.1.1.3_TCP_80', api.slb.virtual_server.vport.HTTP, 80,
                                    service_group_name='pool1',
                                    conn_limit=100000,
                                    ha_conn_mirror=1,
                                    template_tcp='CONN-TIMEOUT-30S',
                                    no_dest_nat=0)

api.slb.virtual_server.vport.get('testvserver1', '_2.1.1.3_TCP_80', api.slb.virtual_server.vport.HTTP, 80)

slb delete() methods do not raise NotFound exception

In both v21 and v30 of acos_client, when calling the .delete() method on any slb object, slb.server.delete() for example, if the object does not exist on the Load-Balancer, the method returns nothing, rather than raising acos_client.errors.NotFound, similar to the .update() or '.get() methods.

Need a way to set conn-limit on virtual_servers

Given an A10 with V21 or V30 API support
When calling slb.virtual_server.create('foo', conn_limit=1000)
Then the attribute should be assigned like so...

!! slb virtual-server foo x.x.x.x /24
!!    conn-limit 1000

How to Enable the attribute of "Client IP Sticky NAT" on AXAPI_21 Version

Background

A10 Version: 2.7.2-P8(build: 164)
acos-client: 1.4.6
Python Version: 3.7.4

Promblem

When I use acos-client 1.4.6 to set my own A10Networks, the attribute of "Client IP Sticky NAT" is always disable, and I can not find the site where to set it, it does not appear in the json value which I got it from the 'cl.slb.virtual_server.vport.get' method. How can I enable the "Client IP Sticky NAT" to use AXAPI_21 Version?

need way to clear connections on a slb.server

This is a feature request to update acos_client (preferably both 21 and 30) to support clearing of slb.server connections. Perhaps with something like api.slb.server.clear(name).

'ServiceGroup' object has no attribute 'all'

Good Afternoon,

am currently unable to pull all service groups, the ServiceGroup class does have a all function in it but for some reason is not working.

this is using AXAPI_30

>>> c.slb.service_group.all()
Traceback (most recent call last):
  File "<console>", line 1, in <module>
AttributeError: 'ServiceGroup' object has no attribute 'all'
>>>

c.slb.virtual_server.all() works fine

No dest nat

As a 4.x acos_client user, I'd like to be able to specify no-dest-nat on virtual server ports.

v21, httplib connection not close

The following is fixed function

    def _http(self, method, api_url, payload):
        if self.protocol == 'https':
            http = httplib.HTTPSConnection(self.host, self.port, timeout=self.timeout)
            http.connect = lambda: force_tlsv1_connect(http)
        else:
            http = httplib.HTTPConnection(self.host, self.port, timeout=self.timeout)

        LOG.debug("axapi_http: url:     %s", api_url)
        LOG.debug("axapi_http: method:  %s", method)
        LOG.debug("axapi_http: headers: %s", logutils.clean(self.HEADERS))
        LOG.debug("axapi_http: payload: %s", logutils.clean(payload))

        http.request(method, api_url, body=payload, headers=self.headers)

        r = http.getresponse()
        r_data = r.read()

        # Workaround for zero length response
        def handle_empty_response(data):
            if not data:
                raise EmptyHttpResponse(r)
            return data

        http.close()

        return handle_empty_response(r_data)

Return created virtual server

As an acos_client user, I'd like the created or updated virtual server to be returned from client.slb.virtual_server.create, client.slb.virtual_server.update, client.slb.service_group.create, and client.slb.service_group.update

  • v2.1
  • v3.0

Need a way to clear connections for a server

Given a slb.server that has current sessions on either a v21 or v30 API.
When a call to slb.server.clear_sessions('foo') happens
Then sessions are cleared for that server.

Can this be done with a raw CLI call? If so what would be the correct way to do this?

v21 and v30 slb.virtual_server.create does not support vip_template

Given a fresh A10 with V21 or V30 API support
when calling slb.virtual_server.create('foo', vip_template='ICMP-RATE-LIMIT')
then the virtual-server template should be applied like so...

!! slb virtual-server foo x.x.x.x /24
!!    template virtual-server ICMP-RATE-LIMIT

This is so API users can control their own ICMP rate limit values on vips.

Beed way to set conn-resume and conn-limit on slb.servers

Given an A10 with V21 or V30 API support
When calling slb.virtual_server.create('foo', 'x.x.x.x', conn_limit=1000, conn_resume=1900)
Then the attribute should be assigned like so...

!! slb server foo x.x.x.x
!!    conn-limit 100000
!!    conn-resume 98000

v30 client does not support slb.service_group.all() method

The v21 client provides a method to retrieve all service groups from a device, via client.slb.service_group.all():

from acos_client/v21/slb/service_group.py:

    def all(self, **kwargs):
        return self._get('slb.service_group.getAll', **kwargs)

The v30 client does not provide this method.

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.