nuagenetworks / vspk-csharp

A C# library for managing the Nuage through its API
https://www.nuagenetworks.net
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

API requests from C# are translating to incorrect version field in the API call in Nuage 6.0 #31

Closed sukota closed 3 years ago

sukota commented 3 years ago

Hi,

When using the below C# code with Nuage 6.0.10 VSD, the API calls are using "v6_0" instead of "v6" and hence the requests are failing at the VSD:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
**using net.nuagenetworks.vspk.v6;
using net.nuagenetworks.vspk.v6.fetchers;**
namespace test_nuage_support
{
    class Program
    {
        static void Main(string[] args)
        {
            string IP = "https://135.254.134.77:8443";

            VSDSession session = new VSDSession("csproot", "csproot", "csp", IP);
            session.RestCertificateValidationCallback += (sender, certificate, chain, sslPolicyErrors) => true;

            Me NUME = session.getMe();
            EnterprisesFetcher Enterprises = NUME.getEnterprises();
            List<Enterprise> AllEnterprises = Enterprises.fetch(session);
            Console.WriteLine($"Retrieved [{AllEnterprises.Count()}] Enterprises");
        }
    }
}

When we look at the API request at the VSD, it looks like below. Should have been v6 here.

10.143.93.119 [30/Nov/2020:00:49:46 -0500] HTTP/1.1 8443 GET /nuage/api/v6_0/enterprises HTTP/1.1 401 11 - 4
10.143.93.119 [30/Nov/2020:00:49:46 -0500] HTTP/1.1 8443 GET /nuage/api/v6_0/me HTTP/1.1 400 46 - 6

It appears the libraries for C# are translating the calls to 'v6_0' instead of 'v6'. Could you please clarify and correct.

mainTAP commented 3 years ago
public string getRestBaseUrl()
        {
            return String.Format("{0}/{1}/v{2}", apiUrl, apiPrefix, version.ToString("#0.0#############", CultureInfo.CurrentCulture).Replace('.', '_'));
        }
pdumais commented 3 years ago

Thank you. I'll work on fixing this soon.

pdumais commented 3 years ago

PR https://github.com/nuagenetworks/monolithe/pull/163 will allow for a fix to be part of the next release (20.10.2) Please check back in 2w

sukota commented 3 years ago

Thanks @pdumais. Customer is looking for this fix in the next 6.0.x. Could you confirm if this is also fixed in 6.0 stream?

pdumais commented 3 years ago

No, it will only be available for 20.10.

pdumais commented 3 years ago

change of plan, we will release it in 6.0.11 :)

sukota commented 3 years ago

Thanks!

awadhesk commented 3 years ago

Hi @pdumais , I was trying to validate this issue. However I could not find the 6.0.11 VSPK release package, can you share the timeline for the same? Also can you confirm if we can use the latest 20.10.2 package with 6.0.x release VSD.

pdellaert commented 3 years ago

That is my fault as I have not triggered the automatic builds of the vspks.for 6.0.11... Let me have a look at it soon.-- Sent from a mobile device

awadhesk commented 3 years ago

Thanks for the update, as customer is waiting for this fix. Can you please share the time line for this fix release date?

pdellaert commented 3 years ago

Build the new 6.0.11 VSPK, @pdumais does have to run some tests and build the actual csharp library, so give him perhaps a few days to look into that.