Merge "Parametrize getDomainProjectsFromApiServer for WebUI"
diff --git a/.kitchen.yml b/.kitchen.yml
index 113ee81..e9ab514 100644
--- a/.kitchen.yml
+++ b/.kitchen.yml
@@ -72,10 +72,10 @@
# provisioner:
# pillars-from-files:
# opencontrail.sls: tests/pillar/cluster<%= ENV['OC_VERSION'] || '' %>.sls
- - name: tor<%= ENV['OC_VERSION'] || '' %>
- provisioner:
- pillars-from-files:
- opencontrail.sls: tests/pillar/tor<%= ENV['OC_VERSION'] || '' %>.sls
+ # - name: tor<%= ENV['OC_VERSION'] || '' %>
+ # provisioner:
+ # pillars-from-files:
+ # opencontrail.sls: tests/pillar/tor<%= ENV['OC_VERSION'] || '' %>.sls
- name: vrouter<%= ENV['OC_VERSION'] || '' %>
provisioner:
pillars-from-files:
diff --git a/README.rst b/README.rst
index f858209..da9d0b4 100644
--- a/README.rst
+++ b/README.rst
@@ -137,6 +137,7 @@
name: 'Contrail'
original_token: 0
compaction_throughput_mb_per_sec: 16
+ concurrent_compactors: 1
data_dirs:
- /var/lib/cassandra
id: 1
diff --git a/_modules/contrail.py b/_modules/contrail.py
index 11d7ca1..3719653 100644
--- a/_modules/contrail.py
+++ b/_modules/contrail.py
@@ -14,6 +14,8 @@
# limitations under the License.
from netaddr import IPNetwork
+from vnc_api.vnc_api import PhysicalRouter, PhysicalInterface, LogicalInterface
+from vnc_api.vnc_api import EncapsulationPrioritiesType
try:
from vnc_api import vnc_api
@@ -23,6 +25,7 @@
ConfigNode, DatabaseNode, BgpRouter
from vnc_api.gen.resource_xsd import AddressFamilies, BgpSessionAttributes, \
BgpSession, BgpPeeringAttributes, BgpRouterParams
+
HAS_CONTRAIL = True
except ImportError:
HAS_CONTRAIL = False
@@ -53,13 +56,13 @@
use_ssl = False
auth_host = kwargs.get('auth_host_ip')
vnc_lib = vnc_api.VncApi(user, password, tenant_name,
- api_host, api_port, api_base_url, wait_for_connect=True,
- api_server_use_ssl=use_ssl, auth_host=auth_host)
+ api_host, api_port, api_base_url, wait_for_connect=True,
+ api_server_use_ssl=use_ssl, auth_host=auth_host)
return vnc_lib
-def _get_config(vnc_client, global_system_config = 'default-global-system-config'):
+def _get_config(vnc_client, global_system_config='default-global-system-config'):
try:
gsc_obj = vnc_client.global_system_config_read(id=global_system_config)
except vnc_api.NoIdError:
@@ -71,7 +74,6 @@
def _get_rt_inst_obj(vnc_client):
-
# TODO pick fqname hardcode from common
rt_inst_obj = vnc_client.routing_instance_read(
fq_name=['default-domain', 'default-project',
@@ -84,7 +86,6 @@
return str(IPNetwork(ip_w_pfx).ip)
-
def virtual_router_list(**kwargs):
'''
Return a list of all Contrail virtual routers
@@ -101,7 +102,9 @@
for vrouter_obj in vrouter_objs:
ret[vrouter_obj.name] = {
'ip_address': vrouter_obj.virtual_router_ip_address,
- 'dpdk_enabled': vrouter_obj.virtual_router_dpdk_enabled
+ 'dpdk_enabled': vrouter_obj.virtual_router_dpdk_enabled,
+ 'uuid': vrouter_obj.uuid
+
}
return ret
@@ -125,7 +128,7 @@
return ret
-def virtual_router_create(name, ip_address, dpdk_enabled=False, **kwargs):
+def virtual_router_create(name, ip_address, router_type=None, dpdk_enabled=False, **kwargs):
'''
Create specific Contrail virtual router
@@ -134,21 +137,48 @@
.. code-block:: bash
salt '*' contrail.virtual_router_create cmp02 10.10.10.102
+ router_types:
+ - tor-agent
+ - tor-service-node
+ - embedded
'''
ret = {}
vnc_client = _auth(**kwargs)
gsc_obj = _get_config(vnc_client)
vrouter_objs = virtual_router_list(**kwargs)
if name in vrouter_objs:
- return {'Error': 'Virtual router %s already exists' % name}
+ vrouter = virtual_router_get(name)
+ vrouter_obj = vnc_client._object_read('virtual-router', id=vrouter[name]['uuid'])
+ changed = False
+ if vrouter_obj.get_virtual_router_ip_address() != ip_address:
+ ret['ip_address'] = {'from': vrouter_obj.get_virtual_router_ip_address(), "to": ip_address}
+ vrouter_obj.set_virtual_router_ip_address(ip_address)
+ changed = True
+ if vrouter_obj.get_virtual_router_type() != router_type:
+ ret['router_type'] = {"from": vrouter_obj.get_virtual_router_type(), "to": router_type}
+ vrouter_obj.set_virtual_router_type(router_type)
+ changed = True
+ if vrouter_obj.get_virtual_router_dpdk_enabled() != dpdk_enabled:
+ ret['dpdk_enabled'] = {"from": vrouter_obj.get_virtual_router_dpdk_enabled(), "to": dpdk_enabled}
+ vrouter_obj.set_virtual_router_dpdk_enabled(dpdk_enabled)
+ changed = True
+ if changed:
+ if __opts__['test']:
+ return "Virtual router " + name + " will be updated"
+ vnc_client.virtual_router_update(vrouter_obj)
+ return ret
+ return {'OK': 'Virtual router %s already exists and is updated' % name}
else:
vrouter_obj = VirtualRouter(
name, gsc_obj,
- virtual_router_ip_address=ip_address)
+ virtual_router_ip_address=ip_address,
+ virtual_router_type=router_type)
vrouter_obj.set_virtual_router_dpdk_enabled(dpdk_enabled)
+ if __opts__['test']:
+ return "Virtual router " + name + " will be created"
vnc_client.virtual_router_create(vrouter_obj)
ret = virtual_router_list(**kwargs)
- return ret[name]
+ return "Create"
def virtual_router_delete(name, **kwargs):
@@ -164,8 +194,462 @@
vnc_client = _auth(**kwargs)
gsc_obj = _get_config(vnc_client)
vrouter_obj = VirtualRouter(name, gsc_obj)
+ if __opts__['test']:
+ return "Virtual router " + name + " will be deleted"
vnc_client.virtual_router_delete(
fq_name=vrouter_obj.get_fq_name())
+ return "Deleted"
+
+
+def physical_router_list(**kwargs):
+ '''
+ Return a list of all Contrail physical routers
+
+ CLI Example:
+
+ .. code-block:: bash
+
+ salt '*' contrail.physical_router_list
+ '''
+ ret = {}
+ vnc_client = _auth(**kwargs)
+ prouter_objs = vnc_client._objects_list('physical-router', detail=True)
+ for prouter_obj in prouter_objs:
+ ret[prouter_obj.name] = {
+ 'uuid': prouter_obj._uuid,
+ 'management_ip': prouter_obj._physical_router_management_ip,
+ 'product_name': prouter_obj._physical_router_product_name,
+ }
+
+ return ret
+
+
+def physical_router_get(name, **kwargs):
+ '''
+ Return a specific Contrail physical router
+
+ CLI Example:
+
+ .. code-block:: bash
+
+ salt '*' contrail.physical_router_get router_name
+ '''
+ ret = {}
+ vnc_client = _auth(**kwargs)
+ prouter_objs = vnc_client._objects_list('physical-router', detail=True)
+ for prouter_obj in prouter_objs:
+ if name == prouter_obj.name:
+ ret[name] = prouter_obj.__dict__
+ if len(ret) == 0:
+ return {'Error': 'Error in retrieving physical router.'}
+ return ret
+
+
+def physical_router_create(name, parent_type=None,
+ management_ip=None,
+ dataplane_ip=None, # VTEP address in web GUI
+ vendor_name=None,
+ product_name=None,
+ vnc_managed=None,
+ junos_service_ports=None,
+ agents=None, **kwargs):
+ '''
+ Create specific Contrail physical router
+
+ CLI Example:
+
+ .. code-block:: bash
+
+ salt '*' contrail.physical_router_create OVSDB_router management_ip=10.167.4.202 dataplane_ip=172.16.20.15 vendor_name=MyVendor product_name=MyProduct agents="['tor01','tns01']"
+ '''
+ ret = {}
+ vnc_client = _auth(**kwargs)
+ gsc_obj = _get_config(vnc_client)
+ prouter_objs = physical_router_list(**kwargs)
+ if name in prouter_objs:
+ prouter = physical_router_get(name)
+ prouter_obj = vnc_client._object_read('physical-router', id=prouter[name]['_uuid'])
+ if prouter_obj.physical_router_management_ip != management_ip:
+ ret['management_ip'] = {'from': prouter_obj.physical_router_management_ip, "to": management_ip}
+ prouter_obj.set_physical_router_management_ip(management_ip)
+ if prouter_obj.physical_router_dataplane_ip != dataplane_ip:
+ ret['dataplane_ip'] = {'from': prouter_obj.physical_router_dataplane_ip, "to": dataplane_ip}
+ prouter_obj.set_physical_router_dataplane_ip(dataplane_ip)
+ if prouter_obj.get_physical_router_vendor_name() != vendor_name:
+ ret['vendor_name'] = {'from': prouter_obj.get_physical_router_vendor_name(), "to": vendor_name}
+ prouter_obj.set_physical_router_vendor_name(vendor_name)
+ if prouter_obj.get_physical_router_product_name() != product_name:
+ ret['product_name'] = {'from': prouter_obj.get_physical_router_product_name(), "to": product_name}
+ prouter_obj.set_physical_router_product_name(product_name)
+ if prouter_obj.get_physical_router_vnc_managed() != vnc_managed:
+ ret['vnc_managed'] = {'from': prouter_obj.get_physical_router_vnc_managed(), "to": vnc_managed}
+ prouter_obj.set_physical_router_vnc_managed(vnc_managed)
+ if prouter_obj.get_physical_router_junos_service_ports() != junos_service_ports:
+ ret['junos_service_ports'] = {'from': prouter_obj.get_physical_router_junos_service_ports(),
+ "to": junos_service_ports}
+ prouter_obj.set_physical_router_junos_service_ports(junos_service_ports)
+
+ if __opts__['test']:
+ if len(ret) != 0:
+ return "Physical router " + name + " will be updated"
+ return {"OK": "Physical router exists and is updated"}
+
+ vrouter_objs = vnc_client._objects_list('virtual-router', detail=True) # all vrouter objects
+ c_agents = [] # referenced vrouters
+ for c_agent in prouter_obj.get_virtual_router_refs():
+ c_agents.append(c_agent['uuid'])
+ agent_objs = [] # required state of references
+ for vrouter_obj in vrouter_objs:
+ if vrouter_obj._display_name in agents and vrouter_obj._uuid not in c_agents:
+ prouter_obj.add_virtual_router(vrouter_obj)
+ ret['vrouter ' + vrouter_obj._display_name] = "Reference added"
+ if vrouter_obj._display_name not in agents and vrouter_obj._uuid in c_agents:
+ prouter_obj.del_virtual_router(vrouter_obj)
+ ret['vrouter ' + vrouter_obj._display_name] = "Reference removed"
+ vnc_client.physical_router_update(prouter_obj)
+
+ if len(ret) == 0:
+ return {"OK": "Physical router exists and is updated"}
+ return ret
+ else:
+ if __opts__['test']:
+ return "Physical router " + name + " will be created"
+ prouter_obj = PhysicalRouter(
+ name=name,
+ parent_obj=None,
+ physical_router_management_ip=management_ip,
+ physical_router_dataplane_ip=dataplane_ip,
+ physical_router_vendor_name=vendor_name,
+ physical_router_product_name=product_name,
+ physical_router_vnc_managed=vnc_managed,
+ physical_router_junos_service_ports=junos_service_ports,
+ )
+ for agent in agents:
+ vrouter = virtual_router_get(agent)
+ vrouter_obj = vnc_client._object_read('virtual-router', id=vrouter[agent]['uuid'])
+ prouter_obj.add_virtual_router(vrouter_obj)
+ vnc_client.physical_router_create(prouter_obj)
+ return "Created"
+
+
+def physical_router_delete(name, **kwargs):
+ '''
+ Delete specific Contrail physical router
+
+ CLI Example:
+
+ .. code-block:: bash
+
+ salt '*' contrail.physical_router_delete router_name
+ '''
+ vnc_client = _auth(**kwargs)
+ gsc_obj = _get_config(vnc_client)
+ prouter_obj = PhysicalRouter(name, gsc_obj)
+ if __opts__['test']:
+ return "Physical router " + name + " will be deleted"
+ vnc_client.physical_router_delete(
+ fq_name=prouter_obj.get_fq_name())
+ return "Deleted"
+
+
+def physical_interface_list(**kwargs):
+ '''
+ Return a list of all Contrail physical interface
+
+ CLI Example:
+
+ .. code-block:: bash
+
+ salt '*' contrail.physical_interface_list
+ '''
+ ret = {}
+ vnc_client = _auth(**kwargs)
+ pinterface_objs = vnc_client._objects_list('physical-interface', detail=True)
+ for pinterface_obj in pinterface_objs:
+ ret[pinterface_obj.name] = {
+ 'uuid': pinterface_obj._uuid,
+ 'fq_name': pinterface_obj.fq_name,
+ 'parent_type': pinterface_obj.parent_type,
+ }
+
+ return ret
+
+
+def physical_interface_get(name, physical_router, **kwargs):
+ '''
+ Return a specific Contrail physical interface
+
+ CLI Example:
+
+ .. code-block:: bash
+
+ salt '*' contrail.physical_interface_get interface_name physical_router_name
+ '''
+ ret = {}
+ vnc_client = _auth(**kwargs)
+ pinterf_objs = vnc_client._objects_list('physical-interface', detail=True)
+ for pinterf_obj in pinterf_objs:
+ if name == pinterf_obj.name and physical_router in pinterf_obj.fq_name:
+ ret[name] = pinterf_obj.__dict__
+ if len(ret) == 0:
+ return {'Error': 'Error in retrieving physical interface.'}
+ return ret
+
+
+def physical_interface_create(name, physical_router, **kwargs):
+ '''
+ Create specific Contrail physical interface
+
+ CLI Example:
+
+ .. code-block:: bash
+
+ salt '*' contrail.physical_interface_create ge-0/0/10 physical_router_name
+ '''
+ ret = {}
+ vnc_client = _auth(**kwargs)
+ gsc_obj = _get_config(vnc_client)
+ pinterf_obj = physical_interface_get(name, physical_router, **kwargs)
+ if 'Error' not in pinterf_obj:
+ return {'OK': 'Physical interface ' + name + ' on ' + physical_router + ' already exists'}
+ else:
+ if __opts__['test']:
+ return "Physical interface " + name + " will be created"
+ prouter = physical_router_get(physical_router)
+ prouter_obj = vnc_client._object_read('physical-router', id=prouter[physical_router]['_uuid'])
+ pinterf_obj = PhysicalInterface(name, prouter_obj)
+ vnc_client.physical_interface_create(pinterf_obj)
+ return "Created"
+
+
+def physical_interface_delete(name, physical_router, **kwargs):
+ '''
+ Delete specific Contrail physical interface
+
+ CLI Example:
+ .. code-block:: bash
+
+ salt '*' contrail.physical_interface_delete ge-0/0/0 phr01
+ '''
+ vnc_client = _auth(**kwargs)
+ gsc_obj = _get_config(vnc_client)
+ piface = physical_interface_get(name, physical_router)
+ if __opts__['test']:
+ return "Physical interface " + name + " will be deleted"
+ vnc_client.physical_interface_delete(id=piface[name]['_uuid'])
+ return "Deleted"
+
+
+def logical_interface_list(**kwargs):
+ '''
+ Return a list of all Contrail logical interfaces
+
+ CLI Example:
+
+ .. code-block:: bash
+
+ salt '*' contrail.logical_interface_list
+ '''
+ ret = []
+ vnc_client = _auth(**kwargs)
+ liface_objs = vnc_client._objects_list('logical-interface', detail=True)
+ for liface_obj in liface_objs:
+ ret.append({
+ 'name': liface_obj.name,
+ 'uuid': liface_obj._uuid,
+ 'fq_name': liface_obj.fq_name,
+ 'parent_type': liface_obj.parent_type,
+ })
+ return ret
+
+
+def logical_interface_get(name, parent_names, parent_type=None, **kwargs):
+ '''
+ Return a specific Contrail logical interface
+
+ CLI Example:
+
+ .. code-block:: bash
+
+ salt '*' contrail.logical_interface_get ge-0/0/0.10 ['phr01']
+ or
+ salt '*' contrail.logical_interface_get ge-0/0/0.10 ['ge-0/0/0','phr01']
+ or
+ salt '*' contrail.logical_interface_get ge-0/0/0.10 ['phr01'] parent_type=physcal-interface
+ '''
+ ret = {}
+ vnc_client = _auth(**kwargs)
+ liface_objs = vnc_client._objects_list('logical-interface', detail=True)
+ count = 0
+ for liface_obj in liface_objs:
+ if name == liface_obj.name and set(parent_names).issubset(liface_obj.fq_name):
+ if parent_type and parent_type == liface_obj.parent_type:
+ count += 1
+ ret[liface_obj.name] = liface_obj.__dict__
+ if not parent_type:
+ count += 1
+ ret[liface_obj.name] = liface_obj.__dict__
+ if len(ret) == 0:
+ return {'Error': 'Error in retrieving logical interface.'}
+ if count > 1:
+ return {
+ 'Error': 'Error Was found more then one logical interface. Please put more parent_name or put parent_type to chose one of them.'}
+ return ret
+
+
+def logical_interface_create(name, parent_names, parent_type='physical-interface', vlan_tag=None, interface_type="l2",
+ **kwargs):
+ '''
+ Create specific Contrail logical interface
+
+ CLI Example:
+
+ .. code-block:: bash
+
+ salt '*' contrail.logical_interface_create ge-0/0/10.11 parent_names="['ge-0/0/0','phr1']" parent_type=physical-interface vlan_tag=1025 interface_type=L2
+ '''
+ ret = {}
+ vnc_client = _auth(**kwargs)
+ gsc_obj = _get_config(vnc_client)
+ liface_obj = logical_interface_get(name, parent_names, parent_type, **kwargs)
+ if 'Error' not in liface_obj:
+ return {'OK': 'Logical interface ' + name + ' already exists'}
+ else:
+ if __opts__['test']:
+ return "Logical interface " + name + " will be created"
+ parent_obj = None
+ for router in parent_names:
+ parent_router = physical_router_get(router)
+ if 'Error' not in parent_router:
+ parent_obj = vnc_client._object_read('physical-router', id=parent_router[router]['_uuid'])
+ break
+ if not parent_obj:
+ return {'Error': 'Physical router have to be defined'}
+ if parent_type == 'physical-interface':
+ for interface in parent_names:
+ parent_interface = physical_interface_get(interface, parent_obj.name)
+ if 'Error' not in parent_interface:
+ parent_obj = vnc_client._object_read('physical-interface', id=parent_interface[interface]['_uuid'])
+ break
+ if interface_type.lower() == "l3":
+ return {'Error': "Virtual Network have to be defined for L3 interface type"}
+
+ liface_obj = LogicalInterface(name, parent_obj, vlan_tag, interface_type.lower())
+ vnc_client.logical_interface_create(liface_obj)
+ return "Created"
+
+
+def logical_interface_delete(name, parent_names, parent_type=None, **kwargs):
+ '''
+ Delete specific Contrail logical interface
+
+ CLI Example:
+
+ .. code-block:: bash
+
+ salt '*' contrail.logical_interface_delete ge-0/0/0.12 ['ge-0/0/0','phr01']
+ or
+ salt '*' contrail.logical_interface_delete ge-0/0/0.12 ['phr01'] parent_type=physical-router
+
+ '''
+ vnc_client = _auth(**kwargs)
+ gsc_obj = _get_config(vnc_client)
+ liface = logical_interface_get(name, parent_names, parent_type)
+ if 'Error' not in liface:
+ if __opts__['test']:
+ return "Logical interface " + name + " will be deleted"
+ vnc_client.logical_interface_delete(id=liface[name]['_uuid'])
+ return "Deleted"
+ else:
+ return liface
+
+
+def global_vrouter_config_list(**kwargs):
+ '''
+ Return a list of all Contrail global vrouter configs
+
+ CLI Example:
+
+ .. code-block:: bash"
+
+ salt '*' global_vrouter_config_list
+ '''
+ ret = {}
+ vnc_client = _auth(**kwargs)
+ vrouter_conf_objs = vnc_client._objects_list('global-vrouter-config', detail=True)
+ for vrouter_conf_obj in vrouter_conf_objs:
+ ret[vrouter_conf_obj._display_name] = vrouter_conf_obj.__dict__
+ return ret
+
+
+def global_vrouter_config_get(name, **kwargs):
+ '''
+ Return a specific Contrail global vrouter config
+
+ CLI Example:
+
+ .. code-block:: bash
+
+ salt '*' contrail.global_vrouter_get global-vrouter-config
+ '''
+ ret = {}
+ vrouter_conf_objs = global_vrouter_config_list(**kwargs)
+ if name in vrouter_conf_objs:
+ ret[name] = vrouter_conf_objs.get(name)
+ if len(ret) == 0:
+ return {'Error': 'Error in retrieving global vrouter config.'}
+ return ret
+
+
+def global_vrouter_config_create(name, parent_type, encap_priority, vxlan_vn_id_mode, *fq_names, **kwargs):
+ '''
+ Create specific Contrail global vrouter config
+
+ CLI Example:
+
+ .. code-block:: bash
+
+ salt '*' contrail.global_vrouter_config_create name=global-vrouter-config parent_type=global-system-config encap_priority="MPLSoUDP,MPLSoGRE" vxlan_vn_id_mode="automatic" fq_names="['default-global-system-config', 'default-global-vrouter-config']"
+ '''
+ ret = {}
+ vnc_client = _auth(**kwargs)
+ gsc_obj = _get_config(vnc_client)
+ vrouter_conf_objs = global_vrouter_config_list(**kwargs)
+ if name in vrouter_conf_objs:
+ return {'OK': 'Global vrouter config %s already exists' % name}
+ else:
+ vrouter_conf_obj = GlobalVrouterConfig(
+ name=name,
+ parent_obj=None,
+ encapsulation_priorities=EncapsulationPrioritiesType(encapsulation=encap_priority.split(",")),
+ fq_name=fq_names,
+ vxlan_network_identifier_mode=vxlan_vn_id_mode,
+ parent_type=parent_type,
+ )
+ if __opts__['test']:
+ return "Global vRouter config " + name + " will be created"
+ vnc_client.global_vrouter_config_create(vrouter_conf_obj)
+ return "Created"
+
+
+def global_vrouter_config_delete(name, **kwargs):
+ '''
+ Delete specific Contrail global vrouter config
+
+ CLI Example:
+
+ .. code-block:: bash
+
+ salt '*' contrail.global_vrouter_config_delete global-vrouter-config
+ '''
+ vnc_client = _auth(**kwargs)
+ gsc_obj = _get_config(vnc_client)
+ vrouter_conf_obj = GlobalVrouterConfig(name, gsc_obj)
+ if __opts__['test']:
+ return "Global vRouter config " + name + " will be deleted"
+ vnc_client.global_vrouter_config_delete(
+ fq_name=vrouter_conf_obj.get_fq_name())
+ return "Deleted"
def analytics_node_list(**kwargs):
@@ -220,14 +704,15 @@
gsc_obj = _get_config(vnc_client)
analytics_node_objs = analytics_node_list(**kwargs)
if name in analytics_node_objs:
- return {'Error': 'Analytics node %s already exists' % name}
+ return {'OK': 'Analytics node %s already exists' % name}
else:
analytics_node_obj = AnalyticsNode(
name, gsc_obj,
analytics_node_ip_address=ip_address)
+ if __opts__['test']:
+ return "AnalyticsNode " + name + " will be created"
vnc_client.analytics_node_create(analytics_node_obj)
- ret = analytics_node_list(**kwargs)
- return ret[name]
+ return "Created"
def analytics_node_delete(name, **kwargs):
@@ -243,8 +728,11 @@
vnc_client = _auth(**kwargs)
gsc_obj = _get_config(vnc_client)
analytics_node_obj = AnalyticsNode(name, gsc_obj)
+ if __opts__['test']:
+ return "AnalyticsNode " + name + " will be deleted"
vnc_client.analytics_node_delete(
fq_name=analytics_node_obj.get_fq_name())
+ return "Deleted"
def config_node_list(**kwargs):
@@ -299,14 +787,15 @@
gsc_obj = _get_config(vnc_client)
config_node_objs = config_node_list(**kwargs)
if name in config_node_objs:
- return {'Error': 'Config node %s already exists' % name}
+ return {'OK': 'Config node %s already exists' % name}
else:
config_node_obj = ConfigNode(
name, gsc_obj,
config_node_ip_address=ip_address)
+ if __opts__['test']:
+ return "ConfigNode " + name + " will be created"
vnc_client.config_node_create(config_node_obj)
- ret = config_node_list(**kwargs)
- return ret[name]
+ return "Created"
def config_node_delete(name, **kwargs):
@@ -322,8 +811,11 @@
vnc_client = _auth(**kwargs)
gsc_obj = _get_config(vnc_client)
config_node_obj = ConfigNode(name, gsc_obj)
+ if __opts__['test']:
+ return "ConfigNode " + name + " will be deleted"
vnc_client.config_node_delete(
fq_name=config_node_obj.get_fq_name())
+ return "Deleted"
def bgp_router_list(**kwargs):
@@ -377,39 +869,45 @@
ret = {}
vnc_client = _auth(**kwargs)
+ address_families = ['route-target', 'inet-vpn', 'e-vpn', 'erm-vpn',
+ 'inet6-vpn']
+ if type != 'control-node':
+ address_families.remove('erm-vpn')
+
+ bgp_addr_fams = AddressFamilies(address_families)
+ bgp_sess_attrs = [
+ BgpSessionAttributes(address_families=bgp_addr_fams)]
+ bgp_sessions = [BgpSession(attributes=bgp_sess_attrs)]
+ bgp_peering_attrs = BgpPeeringAttributes(session=bgp_sessions)
+ rt_inst_obj = _get_rt_inst_obj(vnc_client)
+
+ if type == 'control-node':
+ vendor = 'contrail'
+ elif type == 'router':
+ vendor = 'mx'
+ else:
+ vendor = 'unknown'
+
+ router_params = BgpRouterParams(router_type=type,
+ vendor=vendor, autonomous_system=int(asn),
+ identifier=_get_ip(ip_address),
+ address=_get_ip(ip_address),
+ port=179, address_families=bgp_addr_fams)
+
bgp_router_objs = bgp_router_list(**kwargs)
if name in bgp_router_objs:
- return {'Error': 'control node %s already exists' % name}
+ bgp_router_obj = vnc_client._object_read('bgp-router', id=bgp_router_objs[name]['_uuid'])
+ bgp_router_obj.set_bgp_router_parameters(router_params)
+ if __opts__['test']:
+ return "BGP router " + name + " will be updated"
+ vnc_client.bgp_router_update(bgp_router_obj)
else:
- address_families = ['route-target', 'inet-vpn', 'e-vpn', 'erm-vpn',
- 'inet6-vpn']
- if type != 'control-node':
- address_families.remove('erm-vpn')
-
- bgp_addr_fams = AddressFamilies(address_families)
- bgp_sess_attrs = [
- BgpSessionAttributes(address_families=bgp_addr_fams)]
- bgp_sessions = [BgpSession(attributes=bgp_sess_attrs)]
- bgp_peering_attrs = BgpPeeringAttributes(session=bgp_sessions)
- rt_inst_obj = _get_rt_inst_obj(vnc_client)
-
- if type == 'control-node':
- vendor = 'contrail'
- elif type == 'router':
- vendor = 'mx'
- else:
- vendor = 'unknown'
-
- router_params = BgpRouterParams(router_type=type,
- vendor=vendor, autonomous_system=int(asn),
- identifier=_get_ip(ip_address),
- address=_get_ip(ip_address),
- port=179, address_families=bgp_addr_fams)
- bgp_router_obj = BgpRouter(name, rt_inst_obj,
- bgp_router_parameters=router_params)
+ bgp_router_obj = BgpRouter(name, rt_inst_obj, bgp_router_parameters=router_params)
+ if __opts__['test']:
+ return "BGP router " + name + " will be created"
vnc_client.bgp_router_create(bgp_router_obj)
- ret = bgp_router_list(**kwargs)
- return ret[name]
+ return "Created"
+ return {'OK': 'Config node %s already exists' % name}
def bgp_router_delete(name, **kwargs):
@@ -423,11 +921,16 @@
salt '*' contrail.bgp_router_delete mx01
'''
vnc_client = _auth(**kwargs)
- gsc_obj = _get_control(vnc_client)
+ gsc_obj = _get_config(vnc_client)
bgp_router_obj = BgpRouter(name, gsc_obj)
+
+ if __opts__['test']:
+ return "BGP router " + name + " will be deleted"
vnc_client.bgp_router_delete(
fq_name=bgp_router_obj.get_fq_name())
+ return "Deleted"
+
def database_node_list(**kwargs):
'''
@@ -481,14 +984,15 @@
gsc_obj = _get_config(vnc_client)
database_node_objs = database_node_list(**kwargs)
if name in database_node_objs:
- return {'Error': 'Database node %s already exists' % name}
+ return {'OK': 'Database node %s already exists' % name}
else:
database_node_obj = DatabaseNode(
name, gsc_obj,
database_node_ip_address=ip_address)
+ if __opts__['test']:
+ return "DatabaseNode " + name + " will be created"
vnc_client.database_node_create(database_node_obj)
- ret = database_node_list(**kwargs)
- return ret[name]
+ return "Created"
def database_node_delete(name, **kwargs):
@@ -502,14 +1006,14 @@
salt '*' contrail.database_node_delete cmp01
'''
vnc_client = _auth(**kwargs)
- gsc_obj = _get_database(vnc_client)
- database_node_obj = databaseNode(name, gsc_obj)
+ gsc_obj = _get_config(vnc_client)
+ database_node_obj = DatabaseNode(name, gsc_obj)
+ if __opts__['test']:
+ return "DatabaseNode " + name + " will be deleted"
vnc_client.database_node_delete(
fq_name=database_node_obj.get_fq_name())
-
-
def _get_vrouter_config(vnc_client):
try:
config = vnc_client.global_vrouter_config_read(
@@ -520,7 +1024,6 @@
return config
-
def linklocal_service_list(**kwargs):
'''
Return a list of all Contrail link local services
@@ -602,7 +1105,11 @@
if current_config is None:
new_services = LinklocalServicesTypes([service_entry])
new_config = GlobalVrouterConfig(linklocal_services=new_services)
- vnc_client.global_vrouter_config_create(new_config)
+ if __opts__['test']:
+ ret['GlobalVrouterConfig'] = "Global vRouter Config will be created"
+ else:
+ ret = "Created"
+ vnc_client.global_vrouter_config_create(new_config)
else:
_current_service_list = current_config.get_linklocal_services()
if _current_service_list is None:
@@ -617,13 +1124,18 @@
entry = _entry.__dict__
if 'linklocal_service_name' in entry:
if entry['linklocal_service_name'] == name:
- return {'Error': 'Link local service "{0}" already exists'.format(name)}
+ return {'OK': 'Link local service "{0}" already exists'.format(name)}
new_services.append(_entry)
+ if __opts__['test']:
+ ret['Test'] = "LinkLocalSevices will be created"
service_list[key] = new_services
new_config = GlobalVrouterConfig(linklocal_services=service_list)
- vnc_client.global_vrouter_config_update(new_config)
- ret = linklocal_service_list(**kwargs)
- return ret[name]
+ if __opts__['test']:
+ ret['GlobalVrouterConfig'] = "Global vRouter Config will be updated"
+ else:
+ vnc_client.global_vrouter_config_update(new_config)
+ ret = "Created"
+ return ret
def linklocal_service_delete(name, **kwargs):
@@ -660,6 +1172,46 @@
new_services.append(_entry)
service_list[key] = new_services
new_config = GlobalVrouterConfig(linklocal_services=service_list)
+ if __opts__['test']:
+ return "Link local service " + name + " will be deleted"
vnc_client.global_vrouter_config_update(new_config)
+ return "Deleted"
if not found:
return {'Error': 'Link local service "{0}" not found'.format(name)}
+
+
+def virtual_machine_interface_list(**kwargs):
+ '''
+ Return a list of all Contrail virtual machine interfaces
+
+ CLI Example:
+
+ .. code-block:: bash
+
+ salt '*' contrail.virtual_machine_interfaces
+ '''
+ ret = {}
+ vnc_client = _auth(**kwargs)
+ vm_ifaces = vnc_client._objects_list('virtual-machine-interface', detail=True)
+ for vm_iface in vm_ifaces:
+ ret[vm_iface.name] = vm_iface.__dict__
+ return ret
+
+
+def virtual_network_list(**kwargs):
+ '''
+ Return a list of all Contrail virtual network
+
+ CLI Example:
+
+ .. code-block:: bash
+
+ salt '*' contrail.virtual_network
+ '''
+
+ ret = {}
+ vnc_client = _auth(**kwargs)
+ virtual_networks = vnc_client._objects_list('virtual-network', detail=True)
+ for virtual_network in virtual_networks:
+ ret[virtual_network.name] = virtual_network.__dict__
+ return ret
diff --git a/_states/contrail.py b/_states/contrail.py
index 17f579d..e64948e 100644
--- a/_states/contrail.py
+++ b/_states/contrail.py
@@ -26,9 +26,10 @@
virtual_router:
contrail.virtual_router_present:
- name: cmp01
+ name: tor01
ip_address: 10.0.0.23
dpdk_enabled: False
+ router_type: tor-agent
Enforce the virtual router absence
@@ -36,9 +37,116 @@
.. code-block:: yaml
- virtual_router_cmp01:
+ virtual_router_tor01:
contrail.virtual_router_absent:
- name: cmp01
+ name: tor01
+
+
+Enforce the physical router existence
+------------------------------------
+
+.. code-block:: yaml
+
+ physical_router_phr01:
+ contrail.physical_router_present:
+ name: phr01
+ parent_type: global-system-config
+ management_ip: 10.167.4.206
+ dataplane_ip: 172.17.56.9
+ vendor_name: MyVendor
+ product_name: MyProduct
+ agents:
+ - tor01
+ - tns01
+
+
+Enforce the physical router absence
+----------------------------------
+
+.. code-block:: yaml
+
+ physical_router_delete_phr01:
+ contrail.physical_router_absent:
+ name: phr01
+
+
+Enforce the physical interface present
+----------------------------------
+
+.. code-block:: yaml
+
+ create physical interface ge-0/1/10 for phr01:
+ contrail.physical_interface_present:
+ - name: ge-0/1/10
+ - physical_router: prh01
+
+
+Enforce the physical interface absence
+----------------------------------
+
+.. code-block:: yaml
+
+ physical_interface_delete ge-0/1/10:
+ contrail.physical_interface_absent:
+ name: ge-0/1/10
+
+
+Enforce the logical interface present
+----------------------------------
+
+.. code-block:: yaml
+
+ create logical interface 11/15:
+ contrail.logical_interface_present:
+ - name: ge-0/1/11.15
+ - parent_names:
+ - ge-0/1/11
+ - phr01
+ - parent_type: physical-interface
+ - vlan_tag: 15
+ - interface_type: L3
+
+
+Enforce the logical interface absence
+----------------------------------
+
+.. code-block:: yaml
+
+ logical interface delete ge-0/1/10.0 phr02:
+ contrail.logical_interface_absent:
+ - name: ge-0/1/10.0
+ - parent_names:
+ - ge-0/1/10
+ - phr02
+ - parent_type: physical-interface
+
+
+Enforce the global vrouter existence
+------------------------------------
+
+.. code-block:: yaml
+
+ #Example
+ opencontrail_client_virtual_router_global_conf_create:
+ contrail.global_vrouter_config_present:
+ - name: "global-vrouter-config"
+ - parent_type: "global-system-config"
+ - encap_priority : "MPLSoUDP,MPLSoGRE"
+ - vxlan_vn_id_mode : "automatic"
+ - fq_names:
+ - default-global-system-config
+ - default-global-vrouter-config
+
+
+Enforce the global vrouter absence
+----------------------------------
+
+.. code-block:: yaml
+
+ #Example
+ opencontrail_client_virtual_router_global_conf_delete:
+ contrail.global_vrouter_config_absent:
+ - name: "global-vrouter-config"
Enforce the link local service entry existence
@@ -122,6 +230,7 @@
'''
+
def __virtual__():
'''
Load Contrail module
@@ -129,24 +238,25 @@
return 'contrail'
-def virtual_router_present(name, ip_address, dpdk_enabled=False, **kwargs):
+def virtual_router_present(name, ip_address, router_type=None, dpdk_enabled=False, **kwargs):
'''
Ensures that the Contrail virtual router exists.
:param name: Virtual router name
:param ip_address: Virtual router IP address
+ :param router_type: Any of ['tor-agent', 'tor-service-node', 'embedded']
'''
ret = {'name': name,
'changes': {},
'result': True,
'comment': 'Virtual router "{0}" already exists'.format(name)}
- virtual_router = __salt__['contrail.virtual_router_get'](name, **kwargs)
- if 'Error' not in virtual_router:
+ result = __salt__['contrail.virtual_router_create'](name, ip_address, router_type, dpdk_enabled, **kwargs)
+ if 'OK' in result:
+ ret['comment'] = result
pass
else:
- __salt__['contrail.virtual_router_create'](name, ip_address, dpdk_enabled, **kwargs)
ret['comment'] = 'Virtual router {0} has been created'.format(name)
- ret['changes']['VirtualRouter'] = 'Created'
+ ret['changes']['VirtualRouter'] = result
return ret
@@ -162,10 +272,199 @@
'comment': 'Virtual router "{0}" is already absent'.format(name)}
virtual_router = __salt__['contrail.virtual_router_get'](name, **kwargs)
if 'Error' not in virtual_router:
- __salt__['contrail.virtual_router_delete'](name, **kwargs)
+ result = __salt__['contrail.virtual_router_delete'](name, **kwargs)
ret['comment'] = 'Virtual router {0} has been deleted'.format(name)
- ret['changes']['VirtualRouter'] = 'Deleted'
+ ret['changes']['VirtualRouter'] = result
+ return ret
+
+def physical_router_present(name, parent_type=None,
+ management_ip=None,
+ dataplane_ip=None, # VTEP address in web GUI
+ vendor_name=None,
+ product_name=None,
+ vnc_managed=None,
+ junos_service_ports=None,
+ agents=None, **kwargs):
+ '''
+ Ensures that the Contrail virtual router exists.
+
+ :param name: Physical router name
+ :param parent_type: Parent resource type: Any of ['global-system-config']
+ :param management_ip: Management ip for this physical router. It is used by the device manager to perform netconf and by SNMP collector if enabled.
+ :param dataplane_ip: VTEP address in web GUI. This is ip address in the ip-fabric(underlay) network that can be used in data plane by physical router. Usually it is the VTEP address in VxLAN for the TOR switch.
+ :param vendor_name: Vendor name of the physical router (e.g juniper). Used by the device manager to select driver.
+ :param product_name: Model name of the physical router (e.g juniper). Used by the device manager to select driver.
+ :param vnc_managed: This physical router is enabled to be configured by device manager.
+ :param user_credentials: Username and password for netconf to the physical router by device manager.
+ :param junos_service_ports: Juniper JUNOS specific service interfaces name to perform services like NAT.
+ :param agents: List of virtual-router references
+ '''
+ ret = {'name': name,
+ 'changes': {},
+ 'result': True,
+ 'comment': 'Physical router "{0}" already exists'.format(name)}
+ result = __salt__['contrail.physical_router_create'](name, parent_type, management_ip, dataplane_ip, vendor_name,
+ product_name, vnc_managed, junos_service_ports, agents,
+ **kwargs)
+ if 'OK' in result:
+ ret['comment'] = result
+ pass
+ else:
+ ret['comment'] = 'Physical router {0} has been created'.format(name)
+ ret['changes']['PhysicalRouter'] = result
+ return ret
+
+
+def physical_router_absent(name, **kwargs):
+ '''
+ Ensure that the Contrail physical router doesn't exist
+
+ :param name: The name of the physical router that should not exist
+ '''
+ ret = {'name': name,
+ 'changes': {},
+ 'result': True,
+ 'comment': 'Physical router "{0}" is already absent'.format(name)}
+ physical_router = __salt__['contrail.physical_router_get'](name, **kwargs)
+ if 'Error' not in physical_router:
+ result = __salt__['contrail.physical_router_delete'](name, **kwargs)
+ ret['comment'] = 'Physical router {0} has been deleted'.format(name)
+ ret['changes']['PhysicalRouter'] = result
+ return ret
+
+
+def physical_interface_present(name, physical_router, **kwargs):
+ '''
+ Ensures that the Contrail physical interface exists.
+
+ :param name: Physical interface name
+ :param physical_router: Name of existing physical router
+ '''
+ ret = {'name': name,
+ 'changes': {},
+ 'result': True,
+ 'comment': 'Physical interface "{0}" already exists'.format(name)}
+
+ result = __salt__['contrail.physical_interface_create'](name, physical_router, **kwargs)
+ if 'OK' in result:
+ ret['comment'] = result
+ pass
+ else:
+ ret['comment'] = 'Physical interface {0} has been created'.format(name)
+ ret['changes']['PhysicalInterface'] = result
+ return ret
+
+
+def physical_interface_absent(name, physical_router, **kwargs):
+ '''
+ Ensure that the Contrail physical interface doesn't exist
+
+ :param name: The name of the physical interface that should not exist
+ :param physical_router: Physical router name
+ '''
+ ret = {'name': name,
+ 'changes': {},
+ 'result': True,
+ 'comment': 'Physical interface "{0}" is already absent'.format(name)}
+ physical_interface = __salt__['contrail.physical_interface_get'](name, physical_router, **kwargs)
+ if 'Error' not in physical_interface:
+ result = __salt__['contrail.physical_interface_delete'](name, physical_router, **kwargs)
+ ret['comment'] = 'Physical interface {0} has been deleted'.format(name)
+ ret['changes']['PhysicalInterface'] = result
+ return ret
+
+
+def logical_interface_present(name, parent_names, parent_type, vlan_tag=None, interface_type="L2", **kwargs):
+ '''
+ Ensures that the Contrail logical interface exists.
+
+ :param name: Logical interface name
+ :param parent_names: List of parents
+ :param parent_type Parent resource type. Any of ['physical-router', 'physical-interface']
+ :param vlan_tag: VLAN tag (.1Q) classifier for this logical interface.
+ :param interface_type Logical interface type can be L2 or L3.
+ '''
+ ret = {'name': name,
+ 'changes': {},
+ 'result': True,
+ 'comment': 'Logical interface "{0}" already exists'.format(name)}
+ logical_interface = __salt__['contrail.logical_interface_get'](name, parent_names, parent_type, **kwargs)
+ if 'Error' not in logical_interface:
+ pass
+ else:
+ result = __salt__['contrail.logical_interface_create'](name, parent_names, parent_type, vlan_tag,
+ interface_type, **kwargs)
+ if 'Error' in result:
+ return False
+
+ ret['comment'] = 'Logical interface {0} has been created'.format(name)
+ ret['changes']['LogicalInterface'] = result
+ return ret
+
+
+def logical_interface_absent(name, parent_names, parent_type=None, **kwargs):
+ '''
+ Ensure that the Contrail logical interface doesn't exist
+
+ :param name: The name of the logical interface that should not exist
+ :param parent_names: List of parent names. Example ['phr01','ge-0/1/0']
+ :param parent_type: Parent resource type. Any of ['physical-router', 'physical-interface']
+ '''
+ ret = {'name': name,
+ 'changes': {},
+ 'result': True,
+ 'comment': 'logical interface "{0}" is already absent'.format(name)}
+ logical_interface = __salt__['contrail.logical_interface_get'](name, parent_names, parent_type, **kwargs)
+ if 'Error' not in logical_interface:
+ result = __salt__['contrail.logical_interface_delete'](name, parent_names, parent_type, **kwargs)
+ ret['comment'] = 'Logical interface {0} has been deleted'.format(name)
+ ret['changes']['LogicalInterface'] = result
+ return ret
+
+
+def global_vrouter_config_present(name, parent_type, encap_priority="MPLSoUDP,MPLSoGRE", vxlan_vn_id_mode="automatic",
+ *fq_names, **kwargs):
+ '''
+ Ensures that the Contrail global vrouter config exists.
+
+ :param name: Global vrouter config name
+ :param parent_type: Parent resource type
+ :param encap_priority: Ordered list of encapsulations that vrouter will use in priority order
+ :param vxlan_vn_id_mode: Method of allocation of VxLAN VNI(s).
+ :param fq_names: Fully Qualified Name of resource devided <string>array
+ '''
+ ret = {'name': name,
+ 'changes': {},
+ 'result': True,
+ 'comment': 'Global vrouter config "{0}" already exists'.format(name)}
+
+ result = __salt__['contrail.global_vrouter_config_create'](name, parent_type, encap_priority, vxlan_vn_id_mode,
+ *fq_names, **kwargs)
+ if 'OK' in result:
+ ret['comment'] = result
+ pass
+ else:
+ ret['comment'] = 'Global vrouter config {0} has been created'.format(name)
+ ret['changes']['GlobalVRouterConfig'] = result
+ return ret
+
+
+def global_vrouter_config_absent(name, **kwargs):
+ '''
+ Ensure that the Contrail global vrouter config doesn't exist
+
+ :param name: The name of the global vrouter config that should not exist
+ '''
+ ret = {'name': name,
+ 'changes': {},
+ 'result': True,
+ 'comment': 'Global vrouter config "{0}" is already absent'.format(name)}
+ vrouter_conf = __salt__['contrail.global_vrouter_config_get'](name, **kwargs)
+ if 'Error' not in vrouter_conf:
+ result = __salt__['contrail.global_vrouter_config_delete'](name, **kwargs)
+ ret['comment'] = 'Global vrouter config {0} has been deleted'.format(name)
+ ret['changes']['GlobalVRouterConfig'] = result
return ret
@@ -183,11 +482,14 @@
'changes': {},
'result': True,
'comment': 'Link local service "{0}" already exists'.format(name)}
- lls = __salt__['contrail.linklocal_service_get'](name, **kwargs)
- if 'Error' in lls:
- __salt__['contrail.linklocal_service_create'](name, lls_ip, lls_port, ipf_addresses, ipf_port, **kwargs)
+
+ result = __salt__['contrail.linklocal_service_create'](name, lls_ip, lls_port, ipf_addresses, ipf_port, **kwargs)
+ if 'OK' in result:
+ ret['comment'] = result
+ pass
+ else:
ret['comment'] = 'Link local service "{0}" has been created'.format(name)
- ret['changes']['LinkLocalService'] = 'Created'
+ ret['changes']['LinkLocalService'] = result
return ret
@@ -203,12 +505,12 @@
'comment': ' "{0}" is already absent'.format(name)}
lls = __salt__['contrail.linklocal_service_get'](name, **kwargs)
if 'Error' not in lls:
- __salt__['contrail.linklocal_service_delete'](name, **kwargs)
+ result = __salt__['contrail.linklocal_service_delete'](name, **kwargs)
ret['comment'] = 'Link local service "{0}" has been deleted'.format(name)
- ret['changes']['LinkLocalService'] = 'Deleted'
-
+ ret['changes']['LinkLocalService'] = result
return ret
+
def analytics_node_present(name, ip_address, **kwargs):
'''
Ensures that the Contrail analytics node exists.
@@ -219,13 +521,14 @@
'changes': {},
'result': True,
'comment': 'Analytics node {0} already exists'.format(name)}
- analytics_node = __salt__['contrail.analytics_node_get'](name, **kwargs)
- if 'Error' not in analytics_node:
+
+ result = __salt__['contrail.analytics_node_create'](name, ip_address, **kwargs)
+ if 'OK' in result:
+ ret['comment'] = result
pass
else:
- __salt__['contrail.analytics_node_create'](name, ip_address, **kwargs)
ret['comment'] = 'Analytics node {0} has been created'.format(name)
- ret['changes']['AnalyticsNode'] = 'Created'
+ ret['changes']['AnalyticsNode'] = result
return ret
@@ -239,13 +542,14 @@
'changes': {},
'result': True,
'comment': 'Config node {0} already exists'.format(name)}
- config_node = __salt__['contrail.config_node_get'](name, **kwargs)
- if 'Error' not in config_node:
+ result = __salt__['contrail.config_node_create'](name, ip_address, **kwargs)
+
+ if 'OK' in result:
+ ret['comment'] = result
pass
else:
- __salt__['contrail.config_node_create'](name, ip_address, **kwargs)
ret['comment'] = 'Config node {0} has been created'.format(name)
- ret['changes']['ConfigNode'] = 'Created'
+ ret['changes']['ConfigNode'] = result
return ret
@@ -259,13 +563,14 @@
'changes': {},
'result': True,
'comment': 'BGP router {0} already exists'.format(name)}
- bgp_router = __salt__['contrail.bgp_router_get'](name, **kwargs)
- if 'Error' not in bgp_router:
+
+ result = __salt__['contrail.bgp_router_create'](name, type, ip_address, asn, **kwargs)
+ if 'OK' in result:
+ ret['comment'] = result
pass
else:
- __salt__['contrail.bgp_router_create'](name, type, ip_address, asn, **kwargs)
ret['comment'] = 'BGP router {0} has been created'.format(name)
- ret['changes']['BgpRouter'] = 'Created'
+ ret['changes']['BgpRouter'] = result
return ret
@@ -279,11 +584,12 @@
'changes': {},
'result': True,
'comment': 'Database node {0} already exists'.format(name)}
- database_node = __salt__['contrail.database_node_get'](name, **kwargs)
- if 'Error' not in database_node:
+
+ result = __salt__['contrail.database_node_create'](name, ip_address, **kwargs)
+ if 'OK' in result:
+ ret['coment'] = result
pass
else:
- __salt__['contrail.database_node_create'](name, ip_address, **kwargs)
ret['comment'] = 'Database node {0} has been created'.format(name)
- ret['changes']['DatabaseNode'] = 'Created'
+ ret['changes']['DatabaseNode'] = result
return ret
diff --git a/metadata/service/compute/tor/cluster.yml b/metadata/service/compute/tor/cluster.yml
new file mode 100644
index 0000000..5115598
--- /dev/null
+++ b/metadata/service/compute/tor/cluster.yml
@@ -0,0 +1,16 @@
+applications:
+- opencontrail
+parameters:
+ opencontrail:
+ compute:
+ tor:
+ enabled: true
+ bind:
+ port: 8086
+ agent:
+ tor01:
+ id: 0
+ address: ${_param:single_address}
+ port: 6632
+ ssl:
+ enabled: True
diff --git a/metadata/service/compute/tor/single.yml b/metadata/service/compute/tor/single.yml
new file mode 100644
index 0000000..969b1ef
--- /dev/null
+++ b/metadata/service/compute/tor/single.yml
@@ -0,0 +1,15 @@
+applications:
+- opencontrail
+parameters:
+ opencontrail:
+ compute:
+ tor:
+ enabled: true
+ bind:
+ port: 8086
+ agent:
+ tor01:
+ id: 0
+ port: 6632
+ host: ${_param:tor_device01_address}
+ address: ${_param:single_address}
diff --git a/metadata/service/tor/single.yml b/metadata/service/tor/single.yml
deleted file mode 100644
index 7dc070c..0000000
--- a/metadata/service/tor/single.yml
+++ /dev/null
@@ -1,29 +0,0 @@
-applications:
-- opencontrail
-parameters:
- _param:
- opencontrail_version: 2.2
- opencontrail_tor_agents: 1
- opencontrail:
- common:
- version: ${_param:opencontrail_version}
- identity:
- engine: keystone
- host: 127.0.0.1
- port: 35357
- token: token
- password: password
- network:
- engine: neutron
- host: 127.0.0.1
- port: 9696
- tor:
- enabled: true
- version: ${_param:opencontrail_version}
- agents: ${_param:opencontrail_tor_agents}
- control:
- address: ${_param:single_address}
- interface:
- address: ${_param:single_address}
- device:
- host: ${_param:tor_device_address}
\ No newline at end of file
diff --git a/opencontrail/client.sls b/opencontrail/client.sls
index 35fe914..99b5bee 100644
--- a/opencontrail/client.sls
+++ b/opencontrail/client.sls
@@ -21,6 +21,7 @@
opencontrail_client_virtual_router_{{ virtual_router_name }}:
contrail.virtual_router_present:
- name: {{ virtual_router.get('name', virtual_router_name) }}
+ - router_type: {{ virtual_router.get('router_type', virtual_router_name)}}
- ip_address: {{ virtual_router.ip_address }}
- dpdk_enabled: {{ virtual_router.get('dpdk_enabled', False) }}
- user: {{ client.identity.user }}
@@ -33,6 +34,21 @@
{%- endfor %}
+{%- if pillar.opencontrail.get('compute',{}).get('tor', {}).get('enabled', False) %}
+
+{%- for tor_name, tor in pillar.opencontrail.compute.tor.get('agent', {}).items() %}
+
+opencontrail_client_tor_router_{{ tor_name }}:
+ contrail.virtual_router_present:
+ - name: {{ pillar.linux.system.name }}-{{ tor.id }}
+ - router_type: tor-agent
+ - ip_address: {{ tor.address }}
+
+{%- endfor %}
+
+{%- endif %}
+
+
{%- for config_node_name, config_node in client.get('config_node', {}).items() %}
opencontrail_client_config_node_{{ config_node_name }}:
diff --git a/opencontrail/compute.sls b/opencontrail/compute.sls
index 7df9d2b..9d5b7fd 100644
--- a/opencontrail/compute.sls
+++ b/opencontrail/compute.sls
@@ -151,8 +151,33 @@
{%- endif %}
{%- endif %}
+{%- if compute.get('tor', {}).get('enabled', False) %}
+
+{% for agent_name, agent in compute.tor.agent.iteritems() %}
+
+/etc/contrail/contrail-tor-agent-{{ agent.id }}.conf:
+ file.managed:
+ - source: salt://opencontrail/files/{{ compute.version }}/contrail-tor-agent.conf
+ - template: jinja
+ - defaults:
+ agent_name: {{ agent_name }}
+ - watch_in:
+ - service: opencontrail_compute_services
+
+/etc/contrail/supervisord_vrouter_files/contrail-tor-agent-{{ agent.id }}.ini:
+ file.managed:
+ - source: salt://opencontrail/files/{{ compute.version }}/tor/contrail-tor-agent.ini
+ - template: jinja
+ - defaults:
+ agent_name: {{ agent_name }}
+ - watch_in:
+ - service: opencontrail_compute_services
+
+{%- endfor %}
+{%- endif %}
+
opencontrail_compute_services:
- service.enabled:
+ service.running:
- names: {{ compute.services }}
{%- if grains.get('noservices') %}
- onlyif: /bin/false
diff --git a/opencontrail/files/2.2/cassandra.yaml b/opencontrail/files/2.2/cassandra.yaml
index f3ca089..0ffd86a 100644
--- a/opencontrail/files/2.2/cassandra.yaml
+++ b/opencontrail/files/2.2/cassandra.yaml
@@ -572,6 +572,9 @@
# If your data directories are backed by SSD, you should increase this
# to the number of cores.
#concurrent_compactors: 1
+{% if database.concurrent_compactors is defined %}
+concurrent_compactors: {{ database.concurrent_compactors }}
+{% endif %}
# Throttles compaction to the given total throughput across the entire
# system. The faster you insert data, the faster you need to compact in
diff --git a/opencontrail/files/3.0/cassandra.yaml b/opencontrail/files/3.0/cassandra.yaml
index f3ca089..0ffd86a 100644
--- a/opencontrail/files/3.0/cassandra.yaml
+++ b/opencontrail/files/3.0/cassandra.yaml
@@ -572,6 +572,9 @@
# If your data directories are backed by SSD, you should increase this
# to the number of cores.
#concurrent_compactors: 1
+{% if database.concurrent_compactors is defined %}
+concurrent_compactors: {{ database.concurrent_compactors }}
+{% endif %}
# Throttles compaction to the given total throughput across the entire
# system. The faster you insert data, the faster you need to compact in
diff --git a/opencontrail/files/3.0/contrail-database-nodemgr.conf b/opencontrail/files/3.0/contrail-database-nodemgr.conf
index 117c751..3cd6e74 100644
--- a/opencontrail/files/3.0/contrail-database-nodemgr.conf
+++ b/opencontrail/files/3.0/contrail-database-nodemgr.conf
@@ -2,6 +2,11 @@
[DEFAULT]
hostip={{ database.bind.host }}
minimum_diskGB={{ database.minimum_disk }}
+{%- if pillar.opencontrail.control is defined %}
+contrail_databases=config
+{%- else %}
+contrail_databases=Analytics
+{%- endif %}
[DISCOVERY]
server={{ database.discovery.host }}
diff --git a/opencontrail/files/3.0/contrail-tor-agent.conf b/opencontrail/files/3.0/contrail-tor-agent.conf
index 598a6d5..bb19a6c 100644
--- a/opencontrail/files/3.0/contrail-tor-agent.conf
+++ b/opencontrail/files/3.0/contrail-tor-agent.conf
@@ -1,7 +1,7 @@
-{%- from "opencontrail/map.jinja" import tor with context %}
{%- from "opencontrail/map.jinja" import compute with context %}
-{%- set port = tor.bind.port + number %}
-#
+
+{%- set agent = salt['pillar.get']('opencontrail:compute:tor:agent:'+agent_name) %}
+{%- set port = compute.tor.bind.port + agent.id %}
# Vnswad configuration options
#
@@ -12,7 +12,7 @@
# server=10.0.0.1 10.0.0.2
[DEFAULT]
-agent_name={{ pillar.linux.system.name }}-{{ number }}
+agent_name={{ pillar.linux.system.name }}-{{ agent.id }}
# Everything in this section is optional
# IP address and port to be used to connect to collector. If these are not
@@ -34,7 +34,7 @@
# log_category=
# Local log file name
-log_file=/var/log/contrail/contrail-tor-agent-{{ number }}.log
+log_file=/var/log/contrail/contrail-tor-agent-{{ agent.id }}.log
# Log severity levels. Possible values are SYS_EMERG, SYS_ALERT, SYS_CRIT,
# SYS_ERR, SYS_WARN, SYS_NOTICE, SYS_INFO and SYS_DEBUG. Default is SYS_DEBUG
@@ -54,7 +54,7 @@
# headless_mode=
# Define agent mode. Only supported value is "tor"
- agent_mode=tor
+agent_mode=tor
# Http server port for inspecting vnswad state (useful for debugging)
@@ -81,24 +81,42 @@
[NETWORKS]
# control-channel IP address used by WEB-UI to connect to vnswad to fetch
# required information (Optional)
-control_network_ip={{ tor.control.address }}
+{%- if compute.bind is defined %}
+control_network_ip={{ compute.bind.address }}
+{%- else %}
+control_network_ip={{ compute.interface.address }}
+{%- endif %}
[TOR]
+{%- if agent.ssl is not defined %}
# IP address of the TOR to manage
-tor_ip={{ tor.device.host }}
+tor_ip={{ agent.host }}
+{%- endif %}
# Identifier for ToR. Agent will subscribe to ifmap-configuration by this name
-tor_id={{ number }}
+tor_id={{ agent.id }}
# ToR management scheme is based on this type. Only supported value is "ovs"
tor_type=ovs
# OVS server port number on the ToR
-tor_ovs_port=6632
+tor_ovs_port={{ agent.port }}
# IP-Transport protocol used to connect to tor. Only supported value is "tcp"
+{%- if agent.ssl is defined %}
+tor_ovs_protocol=pssl
+{%- else %}
tor_ovs_protocol=tcp
+{%- endif %}
-tsn_ip={{ tor.interface.address }}
+tsn_ip={{ compute.interface.address }}
+tor_keepalive_interval={{ agent.get('tor_keepalive_interval', 10000) }}
+{%- if agent.ssl is defined %}
+ssl_cert={{ agent.ssl.get('cert', '/etc/contrail/ssl/certs/tor.crt') }}
+
+ssl_privkey={{ agent.ssl.get('key', '/etc/contrail/ssl/certs/tor.key') }}
+
+ssl_cacert={{ agent.ssl.get('ca', '/etc/contrail/ssl/certs/ca.crt') }}
+{%- endif %}
\ No newline at end of file
diff --git a/opencontrail/files/3.0/contrail-vrouter-agent.conf b/opencontrail/files/3.0/contrail-vrouter-agent.conf
index c3f94d4..75bfd4d 100644
--- a/opencontrail/files/3.0/contrail-vrouter-agent.conf
+++ b/opencontrail/files/3.0/contrail-vrouter-agent.conf
@@ -81,7 +81,7 @@
# DHCP relay mode (true or false) to determine if a DHCP request in fabric
# interface with an unconfigured IP should be relayed or not
# dhcp_relay_mode=
-{%- if pillar.opencontrail.tor is defined %}
+{%- if compute.get('tor', {}).get('enabled', False) %}
agent_mode = tsn
{%- endif %}
diff --git a/opencontrail/files/3.0/tor/contrail-tor-agent.ini b/opencontrail/files/3.0/tor/contrail-tor-agent.ini
index 3443c3a..22a8918 100644
--- a/opencontrail/files/3.0/tor/contrail-tor-agent.ini
+++ b/opencontrail/files/3.0/tor/contrail-tor-agent.ini
@@ -1,14 +1,14 @@
-{%- from "opencontrail/map.jinja" import tor with context %}
-
-[program:contrail-tor-agent-{{ number }}]
-command=/usr/bin/contrail-tor-agent --config_file /etc/contrail/contrail-tor-agent-{{ number }}.conf
+{%- from "opencontrail/map.jinja" import compute with context %}
+{%- set agent = salt['pillar.get']('opencontrail:compute:tor:agent:'+agent_name) %}
+[program:contrail-tor-agent-{{ agent.id }}]
+command=/usr/bin/contrail-tor-agent --config_file /etc/contrail/contrail-tor-agent-{{ agent.id }}.conf
priority=420
autostart=true
killasgroup=true
stopsignal=KILL
stdout_capture_maxbytes=1MB
redirect_stderr=true
-stdout_logfile=/var/log/contrail/contrail-tor-agent-{{ number }}-stdout.log
+stdout_logfile=/var/log/contrail/contrail-tor-agent-{{ agent.id }}-stdout.log
stderr_logfile=/dev/null
startsecs=5
exitcodes=0 ; 'expected' exit codes for process (default 0,2)
\ No newline at end of file
diff --git a/opencontrail/files/3.0/vnc_api_lib.ini b/opencontrail/files/3.0/vnc_api_lib.ini
index 072dc73..9795760 100644
--- a/opencontrail/files/3.0/vnc_api_lib.ini
+++ b/opencontrail/files/3.0/vnc_api_lib.ini
@@ -1,10 +1,12 @@
{%- from "opencontrail/map.jinja" import config with context %}
+
[global]
;WEB_SERVER = 127.0.0.1
;WEB_PORT = 9696 ; connection through quantum plugin
-WEB_SERVER = 127.0.0.1
-WEB_PORT = 8082 ; connection to api-server directly
+WEB_SERVER = {{ config.bind.address }}
+WEB_PORT = {{ config.bind.get('api_port', '8082') }}
+; connection to api-server directly
BASE_URL = /
;BASE_URL = /tenants/infra ; common-prefix for all URLs
@@ -15,10 +17,14 @@
AUTHN_PROTOCOL = http
AUTHN_SERVER= {{ config.identity.host }}
AUTHN_PORT = {{ config.identity.port }}
+AUTHN_TENANT = {{ config.identity.tenant }}
+AUTHN_USER = {{ config.identity.user }}
+AUTHN_PASSWORD = {{ config.identity.password }}
{%- if config.identity.version == "3" %}
AUTHN_URL = /v3/auth/tokens
{%- else %}
AUTHN_URL = /v2.0/tokens
{%- endif %}
+
{%- endif %}
diff --git a/opencontrail/files/4.0/cassandra.yaml b/opencontrail/files/4.0/cassandra.yaml
index f3ca089..0ffd86a 100644
--- a/opencontrail/files/4.0/cassandra.yaml
+++ b/opencontrail/files/4.0/cassandra.yaml
@@ -572,6 +572,9 @@
# If your data directories are backed by SSD, you should increase this
# to the number of cores.
#concurrent_compactors: 1
+{% if database.concurrent_compactors is defined %}
+concurrent_compactors: {{ database.concurrent_compactors }}
+{% endif %}
# Throttles compaction to the given total throughput across the entire
# system. The faster you insert data, the faster you need to compact in
diff --git a/opencontrail/files/4.0/contrail-database-nodemgr.conf b/opencontrail/files/4.0/contrail-database-nodemgr.conf
index 5ccad47..492fd8f 100644
--- a/opencontrail/files/4.0/contrail-database-nodemgr.conf
+++ b/opencontrail/files/4.0/contrail-database-nodemgr.conf
@@ -2,6 +2,11 @@
[DEFAULT]
hostip={{ database.bind.host }}
minimum_diskGB={{ database.minimum_disk }}
+{%- if pillar.opencontrail.control is defined %}
+contrail_databases=config
+{%- else %}
+contrail_databases=Analytics
+{%- endif %}
[COLLECTOR]
server_list={% for member in database.analytics.members %}{{ member.host }}:8086 {% endfor %}
diff --git a/opencontrail/files/4.0/contrail-tor-agent.conf b/opencontrail/files/4.0/contrail-tor-agent.conf
index b239bc7..cc8c05d 100644
--- a/opencontrail/files/4.0/contrail-tor-agent.conf
+++ b/opencontrail/files/4.0/contrail-tor-agent.conf
@@ -1,7 +1,7 @@
-{%- from "opencontrail/map.jinja" import tor with context %}
{%- from "opencontrail/map.jinja" import compute with context %}
-{%- set port = tor.bind.port + number %}
-#
+
+{%- set agent = salt['pillar.get']('opencontrail:compute:tor:agent:'+agent_name) %}
+{%- set port = compute.tor.bind.port + agent.id %}
# Vnswad configuration options
#
@@ -12,7 +12,7 @@
# server=10.0.0.1 10.0.0.2
[DEFAULT]
-agent_name={{ pillar.linux.system.name }}-{{ number }}
+agent_name={{ pillar.linux.system.name }}-{{ agent.id }}
# Everything in this section is optional
# IP address and port to be used to connect to collector. If these are not
@@ -34,7 +34,7 @@
# log_category=
# Local log file name
-log_file=/var/log/contrail/contrail-tor-agent-{{ number }}.log
+log_file=/var/log/contrail/contrail-tor-agent-{{ agent.id }}.log
# Log severity levels. Possible values are SYS_EMERG, SYS_ALERT, SYS_CRIT,
# SYS_ERR, SYS_WARN, SYS_NOTICE, SYS_INFO and SYS_DEBUG. Default is SYS_DEBUG
@@ -54,7 +54,7 @@
# headless_mode=
# Define agent mode. Only supported value is "tor"
- agent_mode=tor
+agent_mode=tor
# Http server port for inspecting vnswad state (useful for debugging)
@@ -70,24 +70,42 @@
[NETWORKS]
# control-channel IP address used by WEB-UI to connect to vnswad to fetch
# required information (Optional)
-control_network_ip={{ tor.control.address }}
+{%- if compute.bind is defined %}
+control_network_ip={{ compute.bind.address }}
+{%- else %}
+control_network_ip={{ compute.interface.address }}
+{%- endif %}
[TOR]
+{%- if agent.ssl is not defined %}
# IP address of the TOR to manage
-tor_ip={{ tor.device.host }}
+tor_ip={{ agent.host }}
+{%- endif %}
# Identifier for ToR. Agent will subscribe to ifmap-configuration by this name
-tor_id={{ number }}
+tor_id={{ agent.id }}
# ToR management scheme is based on this type. Only supported value is "ovs"
tor_type=ovs
# OVS server port number on the ToR
-tor_ovs_port=6632
+tor_ovs_port={{ agent.get('port', 6632) }}
# IP-Transport protocol used to connect to tor. Only supported value is "tcp"
+{%- if agent.ssl is defined %}
+tor_ovs_protocol=pssl
+{%- else %}
tor_ovs_protocol=tcp
+{%- endif %}
-tsn_ip={{ tor.interface.address }}
+tsn_ip={{ compute.interface.address }}
+tor_keepalive_interval={{ agent.get('tor_keepalive_interval', 10000) }}
+{%- if agent.ssl is defined %}
+ssl_cert={{ agent.ssl.get('cert', '/etc/contrail/ssl/certs/tor.crt') }}
+
+ssl_privkey={{ agent.ssl.get('key', '/etc/contrail/ssl/certs/tor.key') }}
+
+ssl_cacert={{ agent.ssl.get('ca', '/etc/contrail/ssl/certs/ca.crt') }}
+{%- endif %}
\ No newline at end of file
diff --git a/opencontrail/files/4.0/contrail-vrouter-agent.conf b/opencontrail/files/4.0/contrail-vrouter-agent.conf
index 94d170d..f23e22b 100644
--- a/opencontrail/files/4.0/contrail-vrouter-agent.conf
+++ b/opencontrail/files/4.0/contrail-vrouter-agent.conf
@@ -17,7 +17,7 @@
# Agent mode : can be vrouter / tsn / tor (default is vrouter)
# agent_mode=
-{%- if pillar.opencontrail.tor is defined %}
+{%- if compute.get('tor', {}).get('enabled', False) %}
agent_mode = tsn
{%- endif %}
diff --git a/opencontrail/files/4.0/server.properties b/opencontrail/files/4.0/server.properties
index a8ff61b..5560f5c 100644
--- a/opencontrail/files/4.0/server.properties
+++ b/opencontrail/files/4.0/server.properties
@@ -123,3 +123,6 @@
log.cleaner.dedupe.buffer.size=250000000
delete.topic.enable=true
+
+default.replication.factor={% if database.members|length>1 %}2{% else %}1{% endif %}
+
diff --git a/opencontrail/files/4.0/tor/contrail-tor-agent.ini b/opencontrail/files/4.0/tor/contrail-tor-agent.ini
index 3443c3a..22a8918 100644
--- a/opencontrail/files/4.0/tor/contrail-tor-agent.ini
+++ b/opencontrail/files/4.0/tor/contrail-tor-agent.ini
@@ -1,14 +1,14 @@
-{%- from "opencontrail/map.jinja" import tor with context %}
-
-[program:contrail-tor-agent-{{ number }}]
-command=/usr/bin/contrail-tor-agent --config_file /etc/contrail/contrail-tor-agent-{{ number }}.conf
+{%- from "opencontrail/map.jinja" import compute with context %}
+{%- set agent = salt['pillar.get']('opencontrail:compute:tor:agent:'+agent_name) %}
+[program:contrail-tor-agent-{{ agent.id }}]
+command=/usr/bin/contrail-tor-agent --config_file /etc/contrail/contrail-tor-agent-{{ agent.id }}.conf
priority=420
autostart=true
killasgroup=true
stopsignal=KILL
stdout_capture_maxbytes=1MB
redirect_stderr=true
-stdout_logfile=/var/log/contrail/contrail-tor-agent-{{ number }}-stdout.log
+stdout_logfile=/var/log/contrail/contrail-tor-agent-{{ agent.id }}-stdout.log
stderr_logfile=/dev/null
startsecs=5
exitcodes=0 ; 'expected' exit codes for process (default 0,2)
\ No newline at end of file
diff --git a/opencontrail/files/4.0/vnc_api_lib.ini b/opencontrail/files/4.0/vnc_api_lib.ini
index f131ab2..9795760 100644
--- a/opencontrail/files/4.0/vnc_api_lib.ini
+++ b/opencontrail/files/4.0/vnc_api_lib.ini
@@ -1,10 +1,12 @@
{%- from "opencontrail/map.jinja" import config with context %}
+
[global]
;WEB_SERVER = 127.0.0.1
;WEB_PORT = 9696 ; connection through quantum plugin
-WEB_SERVER = 127.0.0.1
-WEB_PORT = 8082 ; connection to api-server directly
+WEB_SERVER = {{ config.bind.address }}
+WEB_PORT = {{ config.bind.get('api_port', '8082') }}
+; connection to api-server directly
BASE_URL = /
;BASE_URL = /tenants/infra ; common-prefix for all URLs
@@ -15,10 +17,14 @@
AUTHN_PROTOCOL = http
AUTHN_SERVER= {{ config.identity.host }}
AUTHN_PORT = {{ config.identity.port }}
+AUTHN_TENANT = {{ config.identity.tenant }}
+AUTHN_USER = {{ config.identity.user }}
+AUTHN_PASSWORD = {{ config.identity.password }}
{%- if config.identity.version == "3" %}
AUTHN_URL = /v3/auth/tokens
{%- else %}
AUTHN_URL = /v2.0/tokens
{%- endif %}
-{%- endif %}
\ No newline at end of file
+
+{%- endif %}
diff --git a/opencontrail/files/cassandra.yaml.1 b/opencontrail/files/cassandra.yaml.1
index f90c30a..c2e028f 100644
--- a/opencontrail/files/cassandra.yaml.1
+++ b/opencontrail/files/cassandra.yaml.1
@@ -471,6 +471,9 @@
# concurrent_compactors defaults to the number of cores.
# Uncomment to make compaction mono-threaded, the pre-0.8 default.
#concurrent_compactors: 1
+{% if database.concurrent_compactors is defined %}
+concurrent_compactors: {{ database.concurrent_compactors }}
+{% endif %}
# Multi-threaded compaction. When enabled, each compaction will use
# up to one thread per core, plus one thread per sstable being merged.
diff --git a/opencontrail/files/grafana_dashboards/cassandra_prometheus.json b/opencontrail/files/grafana_dashboards/cassandra_prometheus.json
index 0ae2854..b9354ea 100644
--- a/opencontrail/files/grafana_dashboards/cassandra_prometheus.json
+++ b/opencontrail/files/grafana_dashboards/cassandra_prometheus.json
@@ -706,7 +706,7 @@
"steppedLine": false,
"targets": [
{
- "expr": "irate(assandra_metrics_Compaction_Value{host=~\"$host\",name=\"CompletedTasks\"}[1m])",
+ "expr": "irate(cassandra_metrics_Compaction_Value{host=~\"$host\",name=\"CompletedTasks\"}[1m])",
"format": "time_series",
"intervalFactor": 2,
"legendFormat": "Completed {{ host }}",
diff --git a/opencontrail/init.sls b/opencontrail/init.sls
index 863a72d..ee862a7 100644
--- a/opencontrail/init.sls
+++ b/opencontrail/init.sls
@@ -18,9 +18,6 @@
{% if pillar.opencontrail.web is defined %}
- opencontrail.web
{% endif %}
-{% if pillar.opencontrail.tor is defined %}
-- opencontrail.tor
-{% endif %}
{%- if pillar.opencontrail.client is defined %}
- opencontrail.client
{%- endif %}
diff --git a/opencontrail/map.jinja b/opencontrail/map.jinja
index e98c2f4..8c95fe0 100644
--- a/opencontrail/map.jinja
+++ b/opencontrail/map.jinja
@@ -107,11 +107,6 @@
RedHat:
pkgs:
[]
-tor:
- Debian:
- agents: 1
- bind:
- port: 8086
{%- elif vendor == 'juniper' -%}
@@ -220,11 +215,6 @@
RedHat:
pkgs:
[]
-tor:
- Debian:
- agents: 1
- bind:
- port: 8086
{%- endif %}
{%- endload %}
@@ -237,7 +227,6 @@
{% set database = salt['grains.filter_by'](base_defaults['database'], merge=salt['pillar.get']('opencontrail:database', {}), base='database') %}
{% set web = salt['grains.filter_by'](base_defaults['web'], merge=salt['pillar.get']('opencontrail:web', {}), base='web') %}
{% set client = salt['grains.filter_by'](base_defaults['client'], merge=salt['pillar.get']('opencontrail:client', {}), base='client') %}
-{% set tor = salt['grains.filter_by'](base_defaults['tor'], merge=salt['pillar.get']('opencontrail:tor', {}), base='tor') %}
{% set monitoring = salt['grains.filter_by']({
'default': {
diff --git a/opencontrail/tor.sls b/opencontrail/tor.sls
deleted file mode 100644
index f425087..0000000
--- a/opencontrail/tor.sls
+++ /dev/null
@@ -1,24 +0,0 @@
-{%- from "opencontrail/map.jinja" import tor with context %}
-{%- if tor.enabled %}
-
-include:
-- opencontrail.common
-
-{% for number in range(tor.agents) %}
-
-/etc/contrail/contrail-tor-agent-{{ number }}.conf:
- file.managed:
- - source: salt://opencontrail/files/{{ tor.version }}/contrail-tor-agent.conf
- - template: jinja
- - defaults:
- number: {{ number }}
-
-/etc/contrail/supervisord_vrouter_files/contrail-tor-agent-{{ number }}.ini:
- file.managed:
- - source: salt://opencontrail/files/{{ tor.version }}/tor/contrail-tor-agent.ini
- - template: jinja
- - defaults:
- number: {{ number }}
-
-{%- endfor %}
-{%- endif %}
\ No newline at end of file
diff --git a/tests/pillar/cluster.sls b/tests/pillar/cluster.sls
index 7d89d10..f3685e2 100644
--- a/tests/pillar/cluster.sls
+++ b/tests/pillar/cluster.sls
@@ -121,6 +121,7 @@
id: 2
- host: 127.0.0.1
id: 3
+ concurrent_compactors: 1
web:
version: 3.0
enabled: True
diff --git a/tests/pillar/tor.sls b/tests/pillar/tor.sls
deleted file mode 100644
index 04ecba0..0000000
--- a/tests/pillar/tor.sls
+++ /dev/null
@@ -1,35 +0,0 @@
-opencontrail:
- common:
- version: 3.0
- identity:
- engine: keystone
- host: 127.0.0.1
- port: 35357
- token: token
- password: password
- network:
- engine: neutron
- host: 127.0.0.1
- port: 9696
- tor:
- enabled: true
- version: 3.0
- agents: 1
- control:
- address: 127.0.0.1
- interface:
- address: 127.0.0.1
- device:
- host: 127.0.0.1
- compute:
- enabled: true
- version: 3.0
- discovery:
- host: 127.0.0.1
- interface:
- address: 127.0.0.1
- dev: eth0
- gateway: 127.0.0.1
- mask: /24
- dns: 127.0.0.1
- mtu: 9000
diff --git a/tests/pillar/tor4_0.sls b/tests/pillar/tor4_0.sls
deleted file mode 100644
index 16b59fc..0000000
--- a/tests/pillar/tor4_0.sls
+++ /dev/null
@@ -1,43 +0,0 @@
-opencontrail:
- common:
- version: 4.0
- identity:
- engine: keystone
- host: 127.0.0.1
- port: 35357
- token: token
- password: password
- network:
- engine: neutron
- host: 127.0.0.1
- port: 9696
- tor:
- enabled: true
- version: 4.0
- agents: 1
- control:
- address: 127.0.0.1
- interface:
- address: 127.0.0.1
- device:
- host: 127.0.0.1
- compute:
- enabled: true
- version: 4.0
- collector:
- members:
- - host: 127.0.0.1
- - host: 127.0.0.1
- - host: 127.0.0.1
- control:
- members:
- - host: 127.0.0.1
- - host: 127.0.0.1
- - host: 127.0.0.1
- interface:
- address: 127.0.0.1
- dev: eth0
- gateway: 127.0.0.1
- mask: /24
- dns: 127.0.0.1
- mtu: 9000
diff --git a/tests/pillar/vrouter.sls b/tests/pillar/vrouter.sls
index 45418a0..13e05e5 100644
--- a/tests/pillar/vrouter.sls
+++ b/tests/pillar/vrouter.sls
@@ -25,3 +25,14 @@
mask: /24
dns: 127.0.0.1
mtu: 9000
+ tor:
+ enabled: true
+ bind:
+ port: 8086
+ agent:
+ tor01:
+ id: 0
+ address: 127.0.0.1
+ port: 6632
+ ssl:
+ enabled: True
\ No newline at end of file
diff --git a/tests/pillar/vrouter4_0.sls b/tests/pillar/vrouter4_0.sls
index c875642..f19ce4e 100644
--- a/tests/pillar/vrouter4_0.sls
+++ b/tests/pillar/vrouter4_0.sls
@@ -33,3 +33,14 @@
mask: /24
dns: 127.0.0.1
mtu: 9000
+ tor:
+ enabled: true
+ bind:
+ port: 8086
+ agent:
+ tor01:
+ id: 0
+ address: 127.0.0.1
+ port: 6632
+ ssl:
+ enabled: True