cisco-open / cisco-catalyst-wan-sdk

Cisco Catalyst WAN SDK
Apache License 2.0
12 stars 1 forks source link

modify_cluster_setup sent payload as url query #185

Closed JimOverholt closed 2 months ago

JimOverholt commented 2 months ago

Summary

def __send_oob_ip_request(vmanage):
    session = vmanage.create_session()
    services = Branch(vmanage).services()
    configuration = ServiceConfigurationData(
        vmanage_id="0",
        device_ip=vmanage.out_of_band_ip,
        username=session.username,
        password=session.password,
        services=services,
    )
    session.api.cluster_management.modify_cluster_setup(configuration)
    session.close()

cluster endpoint sent payload as URL query string

Logs and external information

{'request': {'method': 'PUT',
             'url': 'https://10.0.1.32:8443/dataservice/clusterManagement/setup',
             'headers': {'User-Agent': 'python-requests/2.28.0',
                         'Accept-Encoding': 'gzip, deflate',
                         'Accept': '*/*',
                         'Connection': 'keep-alive',
                         'Content-Length': '250',
                         'Content-Type': 'application/x-www-form-urlencoded',
                         'Cookie': 'JSESSIONID=b1srmmkULFXcFuTP867g_R6SivcnAVrDbo_JIbr_.5aa2b82f2a9724c4faeca9e65936fd3832bab4cc4794c22562db775069ee629d',
                         'x-xsrf-token': '75D3D6A62837FA40BC833B7B5AFD3CE22B48D1FB7A8D9F33F5735018F317A73CF761F7852896CA4D8A99F9C7DFE5506E04F1'},
             'body': 'vmanageID=0&deviceIP=10.0.105.32&services=application-server&services=statistics-db&services=olap-db&services=configuration-db&services=messaging-server&services=container-manager&persona=COMPUTE_AND_DATA&username=admin&password=12323'},
 'response': {'status': 500,
              'reason': 'Internal Server Error',
              'elapsed-seconds': 0.016,
              'headers': {'content-encoding': 'gzip',
                          'cache-control': 'no-cache, no-store, '
                                           'must-revalidate',
                          'x-xss-protection': '1; mode=block',
                          'pragma': 'no-cache',
                          'x-frame-options': 'DENY',
                          'date': 'Thu, 01 Feb 2024 17:29:18 GMT',
                          'vary': 'Accept-Encoding',
                          'vmanagerequestid': 'ce243353-d3db-4476-974f-6399a3e54130',
                          'x-content-type-options': 'nosniff',
                          'strict-transport-security': 'max-age=31536000; '
                                                       'includeSubDomains',
                          'content-type': 'application/json',
                          'server': 'svcproxy',
                          'transfer-encoding': 'chunked'},
              'json': {'error': {'message': 'Server error',
                                 'code': 'REST0001',
                                 'details': 'vManage server experience an '
                                            'unexpected error,If the problem '
                                            'persists, please contact your '
                                            'administrator for details.'}}}}

Reproduction script

def configure_oob_ip():
    # Arrange
    vmanages = Machines().vmanages()
    # Act
    for vmanage in vmanages:
        __send_oob_ip_request(vmanage)
    vmanages_up_status = VmanageWaiter(vmanages).wait_on_vmanages()
    # Assert
    if vmanages_up_status:
        return [True, f'vManages: {vmanages} UP after setting OOB IP']
    return [False, 'Set OOB IP FAILED or Vmanages NOT UP after setting OOB IP']

def __send_oob_ip_request(vmanage):
    session = vmanage.create_session()
    services = Branch(vmanage).services()
    configuration = ServiceConfigurationData(
        vmanage_id="0",
        device_ip=vmanage.out_of_band_ip,
        username=session.username,
        password=session.password,
        services=services,
    )
    session.api.cluster_management.modify_cluster_setup(configuration)
    session.close()

On what platform(s) does it occur?

Linux

Issue Severity

Medium: There is a workaround

JimOverholt commented 2 months ago

This issue was migrated from an old repository: https://github.com/CiscoDevNet/catalystwan/issues/438