Extending functionality of maasng:

* machine_power_state: Check power state of a node
* list_ipaddresses: get list of reserved IPs
* reserve_ipaddress: reserve ip address in specific subnet
* release_ipaddress: release specified ip address
* list_dnsresources: get list of dns records from maas
* sync_address_pool: sync address pool from pillar to maas

  Example:

    openstack_share_node02_deploy_address: deploy_network

  would be recognized as an ip address request from deploy_network
  maasng.reserve_ipaddress openstack_share_node02_deploy_address \
      deploy_network["cidr"]

  will happen.
  Maas reservation from CIDR would be used in ext_pillar to
  back populate and overwrite 'deploy_network' with an ip address.

    salt '*' pillar.get openstack_share_node02_deploy_address

  will return IP address instead of 'deploy_network'

Change-Id: Idac2849a82e30df683df2a83824544ca5f0265f2
diff --git a/README.rst b/README.rst
index 20da43e..6304634 100644
--- a/README.rst
+++ b/README.rst
@@ -594,6 +594,154 @@
               os_password: password
               os_authurl: http://url
 
+
+Ext pillar from MAAS address pool:
+==================================
+
+Set up salt master:
+
+.. code-block:: yaml
+
+    salt:
+      master:
+        ext_pillars:
+          1:
+            module: cmd_json
+            params: /usr/share/salt-formulas/env/_modules/maas-IPAM.py --address_pool ${salt:master:pillar:data_dir}/classes/cluster/${_param:cluster_name}/infra/address_pool.yml
+
+.. code-block:: bash
+
+    salt-call state.apply salt.master
+    salt '*' saltutil.refresh_pillar
+
+Update infra/address_pool.yml:
+
+.. code-block:: yaml
+
+    parameters:
+      address_pool:
+        external:
+          dns_server01: 8.8.8.8
+          dns_server02: 8.8.4.4
+          upstream_ntp_server: 193.27.208.100
+          remote_rsyslog_host: 127.0.0.3
+        deploy_network:
+          address: 192.168.0.0
+          netmask: 255.255.255.0
+          gateway: 192.168.0.1
+          prefix: 24
+          vlan: 0
+          # Static reservation which interfere with maas reserve pool
+          reserved:
+            cmp001_deploy_address: 192.168.0.101
+            cmp002_deploy_address: 192.168.0.102
+            infra_config_deploy_address: 192.168.0.253
+            infra_kvm_node01_deploy_address: 192.168.0.241
+            infra_kvm_node02_deploy_address: 192.168.0.242
+            infra_kvm_node03_deploy_address: 192.168.0.243
+            infra_kvm_node04_deploy_address: 192.168.0.244
+            infra_kvm_node05_deploy_address: 192.168.0.245
+            infra_kvm_node06_deploy_address: 192.168.0.246
+            ldap_ip_address: 192.168.0.249
+          pool:
+            # Static reservation out of maas reserved pool
+            aptly_server_deploy_address: 192.168.0.252
+            # Dynamic serialization
+            cicd_control_node01_deploy_address: dummy
+            cicd_control_node02_deploy_address: dummy
+            cicd_control_node03_deploy_address: dummy
+            # Release IP address
+            openstack_share_node02_proxy_address: ""
+      cluster_networks:
+        deploy_network:
+          name: 'deploy_network'
+          cidr: ${address_pool:deploy_network:address}/${address_pool:deploy_network:prefix}
+          fabric: deploy_fabric
+          vlan: ${address_pool:deploy_network:vlan}
+          gateway_ip: ${address_pool:deploy_network:gateway}
+          ipranges:
+            1:
+              start: 192.168.0.30
+              end: 192.168.0.80
+              type: dynamic
+              comment: 'dynamic range'
+            2:
+              start: 192.168.0.1
+              end: 192.168.0.29
+              type: reserved
+              comment: 'infra reserve'
+        control_network:
+          name: 'control_network'
+          cidr: ${address_pool:control_network:address}/${address_pool:control_network:prefix}
+          fabric: control_fabric
+          vlan: ${address_pool:control_network:vlan}
+          gateway_ip: ${address_pool:control_network:address}
+
+
+Update maas.yml:
+
+.. code-block:: yaml
+
+      maas:
+        region:
+          fabrics:
+            deploy_fabric:
+              name: ${cluster_networks:deploy_network:fabric}
+              description: 'Fabric for deploy_network'
+              vlans:
+                0:
+                  name: 'lan 0'
+                  description: Deploy VLAN
+                  dhcp: true
+                  primary_rack: "${linux:network:hostname}"
+            control_fabric:
+              name: 'control_fabric'
+              description: 'Fabric for control_network'
+              vlans:
+                0:
+                  name: ${cluster_networks:control_network:fabric}
+                  description: Control VLAN
+                  dhcp: false
+                  primary_rack: "${linux:network:hostname}"
+            mesh_fabric:
+              name: ${cluster_networks:mesh_network:fabric}
+              description: 'Fabric for mesh_network'
+              vlans:
+                0:
+                  name: 'mesh_network'
+                  description: Mesh VLAN
+                  dhcp: false
+                  primary_rack: "${linux:network:hostname}"
+          subnets:
+            deploy_network: ${cluster_networks:deploy_network}
+            control_network: ${cluster_networks:control_network}
+            mesh_network: ${cluster_networks:mesh_network}
+            proxy_network: ${cluster_networks:proxy_network}
+
+
+Populate maas with networks:
+
+.. code-block:: bash
+
+    salt-call state.apply maas.region
+
+Serialize ip addresses using maas network pools:
+
+.. code-block:: bash
+
+    salt-call maasng.sync_address_pool
+
+Verify pillar override works:
+
+.. code-block:: bash
+
+    salt-call pillar.get address_pool:deploy_network:pool:openstack_share_node02_deploy_address
+
+    # Sample output:
+    # local:
+    #     192.168.0.81
+
+
 Test pillars
 ==============