nuagenetworks / vspk-python

A Python library for managing Nuage through its API
http://www.nuagenetworks.net
BSD 3-Clause "New" or "Revised" License
17 stars 19 forks source link

NSG RG Port fails to create if component ports were created with VSPK on NSG instances #28

Closed hellt closed 6 years ago

hellt commented 6 years ago

Hi @pdellaert

We see a very interesting issue detected during the automation prj in Telia FI. When one wants to create NSG RG and the redundant port there are two different ways:

  1. create NSG template and define ports in the template.
  2. create NSG template without ports and define ports in the NSG Instance.

Then create NSG RG and create RG Port out of two ports in NSG instances.

In case 1 executed via VSPK everything works fine

In case 2 executed via VSPK a workflow fails during the creation of NSG RG Port with the following error message

"errors": [
        {
            "property": "", 
            "descriptions": [
                {
                    "description": "Server encountered an unknown exception, please report it back", 
                    "title": "Internal server error"

It was observed initially with CATS, then we recreated the procedure with pure VSPK to eliminate the prob. issue in CATS. That is the code snippet that can demonstrate the failure on 5.1.1 5.1.2 5.2.1 (we did not test the v4):

from vspk import v5_0 as vsdk

session = vsdk.NUVSDSession(
    username='csproot',
    password='csproot',
    enterprise='csp',
    api_url='https://10.57.100.101:8443'
)

session.start()

nuage_user = session.user

enterprise = nuage_user.enterprises.get_first(filter='name == "ORG"')

nsg_template = nuage_user.ns_gateway_templates.get_first(filter='name == "NSG_TEMP"')

NSG1 = vsdk.NUNSGateway(name='NSG1', template_id=nsg_template.id)
enterprise.create_child(NSG1)
NSG_PORT1 = vsdk.NUNSPort(name='port1', physical_name='port1', port_type='ACCESS')
NSG1.create_child(NSG_PORT1)

NSG2 = vsdk.NUNSGateway(name='NSG2', template_id=nsg_template.id)
enterprise.create_child(NSG2)
NSG2.create_child(NSG_PORT1)

NSG_RG = vsdk.NUNSRedundantGatewayGroup(name='RG', gateway_peer1_id=NSG1.id, gateway_peer2_id=NSG2.id)
enterprise.create_child(NSG_RG)

NSG_RG_PORT = vsdk.NURedundantPort(name='RG_PORT', physical_name="port1", port_type='ACCESS', vlan_range='0-4094')
NSG_RG.create_child(NSG_RG_PORT)

The piquancy of this issue is that if you perform an update of the Port objects under each NSG Instance (say rename port names from port1 to Port1) then you will be able to create RG Port.

Also do note, that manual execution of the exact same steps leads to no errors.

pdellaert commented 6 years ago

@hellt what do you mean with

manual execution of the exact same steps leads to no errors

Is that with manual API calls (without VSPK), or through UI? Have you looked at what the UI does for API calls and compared that to what you are doing in VSPK?

hellt commented 6 years ago

Is that with manual API calls (without VSPK), or through UI?

through UI. I have not tried manual API calls, though my expectation would be that the issue is not with VSPK but rather with the backend somehow.

I just got the idea that I want to test now -> try to fetch the port objects in both NSGs after the intial creation under the instance and then attempting to create the RG Port again

pdellaert commented 6 years ago

If the issue is the backend, please open a 3LS ticket, as I share your expectation this is not a VSPK issue

hellt commented 6 years ago

got it, closing this one then

pdellaert commented 6 years ago

Thanks, feel free to tag me on the 3LS issue, just want to make sure we track it in the right place :). VSPK specific can be tracked here or on specs, depending where the issue is. backend behaviour is in the normal support tools.