Skip to content

Update AR produces an error if it contains Leases #7455

@MarioRobres

Description

@MarioRobres

Description
When trying to update an Address Range (from the CLI), the leases are not parsed correctly, which causes an error when updating the AR.

To Reproduce

  1. Instantiate (at least 1) VM with at least 1 NIC, so a vnet contains some leases:
ADDRESS RANGE POOL                                                              
AR 0                                                                            
SIZE           : 10                  
LEASES         : 4                   

RANGE                                   FIRST                               LAST
MAC                         00:03:c0:a8:96:0a                  00:03:c0:a8:96:13
IP                             192.168.150.10                     192.168.150.19

AR 1                                                                            
SIZE           : 10                  
LEASES         : 0                   

RANGE                                   FIRST                               LAST
MAC                         00:03:c0:a8:96:1e                  00:03:c0:a8:96:27
IP                             192.168.150.30                     192.168.150.39


LEASES                                                                          
AR  OWNER                    MAC             IP PORT_FORWARD   IP6
0   V:1        00:03:c0:a8:96:0a 192.168.150.10     -     -
0   V:2        00:03:c0:a8:96:0b 192.168.150.11     -     -
0   V:3        00:03:c0:a8:96:0c 192.168.150.12     -     -
0   V:4        00:03:c0:a8:96:0d 192.168.150.13     -     -
  1. Try to update the AR from the used vnet:
onevnet updatear <VNET_ID> <AR_ID>
  1. It will promt the contents of the AR, but with a bad format in LEASES:
AR_ID="0"                                                                                                                                                                                                          
IP="192.168.150.10"
MAC="00:03:c0:a8:96:0a"
SIZE="10"
TYPE="IP4"
MAC_END="00:03:c0:a8:96:13"
IP_END="192.168.150.19"
USED_LEASES="4"
LEASES=[
  LEASE="
      ",
  LEASE="
      ",
  LEASE="
      ",
  LEASE="
      " ]
  1. Even if you don't modify anything, that will produce an error:
[one.vn.update_ar] Parse error: syntax error, unexpected OBRACKET, expecting STRING at line 9, columns 164:165

Expected behavior
The leases should be parsed correctly, as they are in the XML representation:

 <AR_POOL>
    <AR>
      <AR_ID><![CDATA[0]]></AR_ID>
      <IP><![CDATA[192.168.150.10]]></IP>
      <MAC><![CDATA[00:03:c0:a8:96:0a]]></MAC>
      <SIZE><![CDATA[10]]></SIZE>
      <TYPE><![CDATA[IP4]]></TYPE>
      <MAC_END><![CDATA[00:03:c0:a8:96:13]]></MAC_END>
      <IP_END><![CDATA[192.168.150.19]]></IP_END>
      <USED_LEASES>4</USED_LEASES>
      <LEASES>
        <LEASE>
          <IP><![CDATA[192.168.150.10]]></IP>
          <MAC><![CDATA[00:03:c0:a8:96:0a]]></MAC>
          <VM><![CDATA[1]]></VM>
        </LEASE>
        <LEASE>
          <IP><![CDATA[192.168.150.11]]></IP>
          <MAC><![CDATA[00:03:c0:a8:96:0b]]></MAC>
          <VM><![CDATA[2]]></VM>
        </LEASE>
        <LEASE>
          <IP><![CDATA[192.168.150.12]]></IP>
          <MAC><![CDATA[00:03:c0:a8:96:0c]]></MAC>
          <VM><![CDATA[3]]></VM>
        </LEASE>
        <LEASE>
          <IP><![CDATA[192.168.150.13]]></IP>
          <MAC><![CDATA[00:03:c0:a8:96:0d]]></MAC>
          <VM><![CDATA[4]]></VM>
        </LEASE>
      </LEASES>
    </AR>
    <AR>
      <AR_ID><![CDATA[1]]></AR_ID>
      <IP><![CDATA[192.168.150.30]]></IP>
      <MAC><![CDATA[00:03:c0:a8:96:1e]]></MAC>
      <SIZE><![CDATA[10]]></SIZE>
      <TYPE><![CDATA[IP4]]></TYPE>
      <MAC_END><![CDATA[00:03:c0:a8:96:27]]></MAC_END>
      <IP_END><![CDATA[192.168.150.39]]></IP_END>
      <USED_LEASES>0</USED_LEASES>
      <LEASES/>
    </AR>
  </AR_POOL>

Details

  • Affected Component: [CLI]
  • Version: 7.0

Additional context

Progress Status

  • Code committed
  • Testing - QA
  • Documentation (Release notes - resolved issues, compatibility, known issues)

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions