Merge "Add state virtual network present and edit README"
diff --git a/README.rst b/README.rst
index a940cc6..d465fac 100644
--- a/README.rst
+++ b/README.rst
@@ -1128,6 +1128,35 @@
security_group: 'default'
virtual_network: 'virtual-network'
+Enforcing virtual networks
+
+
+.. code-block:: yaml
+
+ opencontrail:
+ client:
+ virtual_networks:
+ net01:
+ name: 'network01'
+ ip_address: '172.16.111.0'
+ ip_prefix: 24
+ asn: 64512
+ route_target: 10000
+ external: True
+ allow_transit: False
+ forwarding_mode: 'l2_l3'
+ rpf: 'disable'
+ mirror_destination: False
+ domain: 'default-domain'
+ project: 'admin'
+ ipam_domain: 'default-domain'
+ ipam_project: 'default-project'
+ ipam_name: 'default-network-ipam'
+ net02:
+ name: 'network02'
+ net03:
+ name: 'network03'
+
Contrail DNS custom forwarders
------------------------------
diff --git a/_states/contrail.py b/_states/contrail.py
index 4632370..b729d26 100644
--- a/_states/contrail.py
+++ b/_states/contrail.py
@@ -338,6 +338,31 @@
global_system_config_delete:
contrail.global_system_config_absent:
- name: global-system_config
+
+
+Enforce the virtual network existence
+----------------------------------------
+
+.. code-block: yaml
+
+ virtual_network_create:
+ contrail.virtual_network_present:
+ - name: virtual_network_name
+ - conf:
+ domain: domain name
+ project: domain project
+ ipam_domain: ipam domain name
+ ipam_project: ipam project name
+ ipam_name: ipam name
+ ip_prefix: xxx.xxx.xxx.xxx
+ ip_prefix_len: 24
+ asn: 64512
+ target: 10000
+ external: False
+ allow_transit: False
+ forwading_mode: 'l2_l3'
+ rpf: 'disabled'
+ mirror_destination: False
'''
@@ -792,3 +817,15 @@
if 'Error' not in gsc:
ret = __salt__['contrail.global_system_config_delete'](name, **kwargs)
return ret
+
+
+def virtual_network_present(name, conf=None, **kwargs):
+ '''
+ Ensure that the virtual network exists.
+
+ :param name: Name of the virtual network
+ :param conf: Key:Value pairs used for network creation
+ '''
+
+ ret = __salt__['contrail.virtual_network_create'](name, conf, **kwargs)
+ return ret