/var/lib/one/remotes/ipam/dummy/* for testing IPAM

Can I use the dummy drivers to test the IPAM driver? I’m getting some strange results, I must be doing something wrong. I have this XML:

$ cat net1.xml
<IPAM_DRIVER_ACTION_DATA>
<AR>
  <TYPE>IP4</TYPE>
  <IP>10.123.0.10</IP>
  <SIZE>50</SIZE>
</AR>
</IPAM_DRIVER_ACTION_DATA>

I get:

$ base64 net1.xml | /var/lib/one/remotes/ipam/dummy/register_address_range
Traceback (most recent call last):
        4: from /var/lib/one/remotes/ipam/dummy/../../datastore/xpath.rb:62:in `<main>'
        3: from /var/lib/one/remotes/ipam/dummy/../../datastore/xpath.rb:62:in `new'
        2: from /usr/share/ruby/rexml/document.rb:45:in `initialize'
        1: from /usr/share/ruby/rexml/document.rb:288:in `build'
/usr/share/ruby/rexml/parsers/treeparser.rb:28:in `parse': No close tag for /IPAM_DRIVER_ACTION_DATA/AR/IP (REXML::ParseException)
Line: 4
Position: 57
Last 80 unconsumed characters:
        AR=[
          TYPE="IP4",
          IP  ="10.0.0.1",
          SIZE="100",
          NETWORK_MASK="255.255.255.0",
          GATEWAY="10.0.0.1",
          DNS="10.0.0.1",
          IPAM_MAD="dummy"
        ]

I have this block in /etc/one/oned.conf and opennebula has been restarted:

IPAM_MAD = [
    EXECUTABLE = "one_ipam",
    ARGUMENTS  = "-t 1 -i dummy"
]

Hello @christaylor

Yes, this dummy IPAM is for demo purpose, you have to it in the following way:

base64 net1.xml -w 0 | /var/lib/one/remotes/ipam/dummy/register_address_range

Best,
Álex.

That worked! Thanks-

Using this template,

$ cat tmp.xml
<IPAM_DRIVER_ACTION_DATA>
<AR>
  <TYPE>IP4</TYPE>
  <MAC></MAC>
  <NETWORK_ADDRESS>10.123.0.0</NETWORK_ADDRESS>
  <NETWORK_MASK>23</NETWORK_MASK>
  <IP>10.123.0.10</IP>
  <SIZE>50</SIZE>
  <GATEWAY>10.123.0.1</GATEWAY>
  <DNS>10.0.0.2 10.0.0.3</DNS>
  <GUEST_MTU>1500</GUEST_MTU>
  <SEARCH_DOMAIN>usc.edu</SEARCH_DOMAIN>
</AR>
</IPAM_DRIVER_ACTION_DATA>

I get this back:

$ base64 tmp.xml -w 0 | /var/lib/one/remotes/ipam/dummy/register_address_range
        AR=[
          TYPE="IP4",
          SIZE="50",
          IP="10.123.0.10",
          IPAM_MAD="dummy"
        ]

Is it expected behavior for it not to return the extra stuff I fed it like GATEWAY and DNS?

Hello @christaylor

Yes, that is the expected behavior, you can customize that output depending on your needs.

Best,
Álex.