nuagenetworks / vsd-api-specifications

api specifications of vsd
Other
6 stars 8 forks source link

Unpredictable behavior in dhcpoption resource #35

Open miguelagd opened 7 years ago

miguelagd commented 7 years ago

Following the documentation, if actualType and actualValues are defined, in a dhcpoption, they override the values of type and value, respectively. However, in a modification (PUT) of a dhcpoption, when both actualType and actualValues are explicitly defined (with no null values) sometimes they are taking into account, modifying the dhcpoption using them, but sometimes they are ignored, using the values of type and value instead.

Please, find below a concrete sequence of steps that reproduce the issue:

  1. Create a dhcpoption--> OK.

Json sent:

{
    "actualType": 6,
    "actualValues": ["8.8.8.8" ,"1.1.1.1"],
    "length": null,
    "type": null,
    "value": null
}

Json received:

[{
   "children": null,
   "parentType": "subnet",
   "entityScope": "ENTERPRISE",
   "lastUpdatedBy": "8a6f0e20-a4db-4878-ad84-9cc61756cd5e",
   "lastUpdatedDate": 1500975979000,
   "creationDate": 1500975979000,
   "type": "06",
   "length": "08",
   "value": "0808080801010101",
   "actualValues":    [
      "8.8.8.8",
      "1.1.1.1"
   ],
   "actualType": 6,
   "owner": "8a6f0e20-a4db-4878-ad84-9cc61756cd5e",
   "ID": "cf053e41-1c1f-4dd8-b1ea-bd4a5a88f4ec",
   "parentID": "d21961d1-a43f-43a9-915b-02d07cda98de",
   "externalID": null
}]
  1. Update the dhcpoption: --> OK.

Json sent:

{
    "actualType": 6,
    "actualValues": ["8.8.8.8" ,"1.1.1.5"],
    "length": "08",
    "type": "06",
    "value": "0808080801010101"
}

Json received after a read of the dhcpoption:

[{
   "children": null,
   "parentType": "subnet",
   "entityScope": "ENTERPRISE",
   "lastUpdatedBy": "8a6f0e20-a4db-4878-ad84-9cc61756cd5e",
   "lastUpdatedDate": 1500976666000,
   "creationDate": 1500976592000,
   "type": "06",
   "length": "08",
   "value": "0808080801010102",
   "actualValues":    [
      "8.8.8.8",
      "1.1.1.2"
   ],
   "actualType": 6,
   "owner": "8a6f0e20-a4db-4878-ad84-9cc61756cd5e",
   "ID": "0ba86451-be88-4821-8782-d5541f2ddff3",
   "parentID": "d21961d1-a43f-43a9-915b-02d07cda98de",
   "externalID": null
}]
  1. Update the dhcpoption again --> fails -->actualValues is ignored, going back to the original value, contained in value:

Json sent:

{
    "actualType": 6,
    "actualValues": ["8.8.8.8" ,"1.1.1.3"],
    "length": "08",
    "type": "06",
    "value": "0808080801010101"
}

Json received after a read of the dhcpoption:

[{
   "children": null,
   "parentType": "subnet",
   "entityScope": "ENTERPRISE",
   "lastUpdatedBy": "8a6f0e20-a4db-4878-ad84-9cc61756cd5e",
   "lastUpdatedDate": 1500976804000,
   "creationDate": 1500976592000,
   "type": "06",
   "length": "08",
   "value": "0808080801010101",
   "actualValues":    [
      "8.8.8.8",
      "1.1.1.1"
   ],
   "actualType": 6,
   "owner": "8a6f0e20-a4db-4878-ad84-9cc61756cd5e",
   "ID": "0ba86451-be88-4821-8782-d5541f2ddff3",
   "parentID": "d21961d1-a43f-43a9-915b-02d07cda98de",
   "externalID": null
}]
  1. Additional updates behave alternatively like steps 2. and 3.

This behavior has been found in 4.0 R4 and 4.0 R7.

pdellaert commented 7 years ago

@miguelagd have you tried sending type and value as null during your PUT commands and just have the actualType and actualValue set?

pdellaert commented 7 years ago

@miguelagd any feedback, otherwise i'm going to close this...

miguelagd commented 7 years ago

Sorry. For any reason I did not read the comment you wrote on July. I will test it today, during the day, and I will give you an answer.

Thanks.

miguelagd commented 7 years ago

@miguelagd have you tried sending type and value as null during your PUT commands and just have the actualType and actualValue set?

I have tried what you proposed without success: Nuage's VSD returns an error if value is null. Let me give you a complete example of what I tested:

  1. Creating a DHCP option:
    • JSON sent:
      {
      "actualType": 6,
      "actualValues": ["8.8.8.8" ,"1.1.1.1"],
      "length": null,
      "type": null,
      "value": null
      }
    • JSON received:
      [{
      "children": null,
      "parentType": "subnet",
      "entityScope": "ENTERPRISE",
      "lastUpdatedBy": "8a6f0e20-a4db-4878-ad84-9cc61756cd5e",
      "lastUpdatedDate": 1509979009000,
      "creationDate": 1509979009000,
      "type": "06",
      "length": "08",
      "value": "0808080801010101",
      "actualValues":    [
      "8.8.8.8",
      "1.1.1.1"
      ],
      "actualType": 6,
      "owner": "8a6f0e20-a4db-4878-ad84-9cc61756cd5e",
      "ID": "b14566a8-1bfc-4679-9c96-d75151bf21b5",
      "parentID": "30119341-9373-47d5-b6c6-f192e8dfe376",
      "externalID": null
      }]
  2. Updating the IP:
    • JSON sent:
      {
      "actualType": 6,
      "actualValues": ["8.8.8.8" ,"1.1.1.2"],
      "length": "08",
      "type": null,
      "value": null
      }
    • JSON received:
      {
      "errors":    [
          {
       "property": "value",
       "descriptions": [         {
          "title": "Invalid hexadecimal number",
          "description": "Value must be a valid padded (multiple of 2) hexadecimal number."
       }]
      },
          {
       "property": "type",
       "descriptions": [         {
          "title": "Invalid hexadecimal number",
          "description": "Value must be a valid padded (multiple of 2) hexadecimal number."
       }]
      }
      ],
      "internalErrorCode": 5000
      }