Merge "Add fluentd support"
diff --git a/_modules/contrail.py b/_modules/contrail.py
index ab3df9e..2596b1a 100644
--- a/_modules/contrail.py
+++ b/_modules/contrail.py
@@ -1051,6 +1051,17 @@
     bgp_router_objs = bgp_router_list(**kwargs)
     if name in bgp_router_objs:
         bgp_router_obj = vnc_client._object_read('bgp-router', id=bgp_router_objs[name]['_uuid'])
+
+        if bgp_router_obj.bgp_router_parameters.autonomous_system != asn:
+            ret['changes'].update({"autonomous_system": {'old': bgp_router_obj.bgp_router_parameters.autonomous_system, 'new': asn}})
+        if bgp_router_obj.bgp_router_parameters.vendor != vendor:
+            ret['changes'].update({"vendor": {'old': bgp_router_obj.bgp_router_parameters.vendor, 'new': vendor}})
+        if bgp_router_obj.bgp_router_parameters.address != ip_address:
+            ret['changes'].update({"ip_address": {'old': bgp_router_obj.bgp_router_parameters.address, 'new': ip_address}})
+
+        if len(ret['changes']) == 0:
+            return ret
+
         bgp_router_obj.set_bgp_router_parameters(router_params)
         if __opts__['test']:
             ret['result'] = None
@@ -1058,7 +1069,6 @@
             return ret
         vnc_client.bgp_router_update(bgp_router_obj)
         ret['comment'] = "BGP router " + name + " has been updated"
-        ret['changes'] = {'new': name}
         return ret
     else:
         bgp_router_obj = BgpRouter(name, rt_inst_obj, bgp_router_parameters=router_params)
@@ -1087,16 +1097,17 @@
            'result': True,
            'comment': ''}
     vnc_client = _auth(**kwargs)
-    gsc_obj = _get_config(vnc_client)
-    bgp_router_obj = BgpRouter(name, gsc_obj)
 
     if __opts__['test']:
         ret['result'] = None
         ret['comment'] = "BGP router " + name + " will be deleted"
         return ret
-    vnc_client.bgp_router_delete(bgp_router_obj.get_uuid())
-    ret['comment'] = "BGP router " + name + " has been deleted"
-    ret['changes'] = {'BGP router': {'old': '', 'new': name}}
+
+    bgp_router = bgp_router_get(name)
+    if name in bgp_router:
+        vnc_client.bgp_router_delete(fq_name=bgp_router[name]['fq_name'])
+        ret['comment'] = "BGP router " + name + " has been deleted"
+        ret['changes'] = {'BGP router': {'old': '', 'new': name}}
     return ret
 
 
@@ -1199,17 +1210,21 @@
     return ret
 
 
-def _get_vrouter_config(vnc_client):
+def _get_vrouter_config(vnc_client, gvc_name=None):
     try:
+        if not gvc_name:
+            gvc_list = global_vrouter_config_list()
+            gvc_name = gvc_list.values()[0]['name']
+
         config = vnc_client.global_vrouter_config_read(
-            fq_name=['default-global-system-config', 'default-global-vrouter-config'])
+            fq_name=['default-global-system-config', gvc_name])
     except Exception:
         config = None
 
     return config
 
 
-def linklocal_service_list(**kwargs):
+def linklocal_service_list(global_vrouter_config_name=None, **kwargs):
     '''
     Return a list of all Contrail link local services
 
@@ -1222,7 +1237,7 @@
     ret = {}
     vnc_client = _auth(**kwargs)
 
-    current_config = _get_vrouter_config(vnc_client)
+    current_config = _get_vrouter_config(vnc_client, global_vrouter_config_name)
     if current_config is None:
         return ret
 
@@ -1258,7 +1273,7 @@
     return ret
 
 
-def linklocal_service_create(name, lls_ip, lls_port, ipf_dns_or_ip, ipf_port, **kwargs):
+def linklocal_service_create(name, lls_ip, lls_port, ipf_dns_or_ip, ipf_port, global_vrouter_config_name=None, **kwargs):
     '''
     Create specific Contrail link local service
 
@@ -1276,7 +1291,7 @@
            'result': True,
            'comment': ''}
     vnc_client = _auth(**kwargs)
-    current_config = _get_vrouter_config(vnc_client)
+    current_config = _get_vrouter_config(vnc_client, global_vrouter_config_name)
     service_entry = LinklocalServiceEntryType(
         linklocal_service_name=name,
         linklocal_service_ip=lls_ip,
diff --git a/metadata/service/control/cluster.yml b/metadata/service/control/cluster.yml
index 1c8b28b..fba6222 100644
--- a/metadata/service/control/cluster.yml
+++ b/metadata/service/control/cluster.yml
@@ -100,6 +100,16 @@
           port: 9160
         - host: ${_param:cluster_node03_address}
           port: 9160
+      identity:
+        engine: keystone
+        version: '2.0'
+        region: RegionOne
+        host: ${_param:cluster_vip_address}
+        port: 35357
+        user: admin
+        password: '${_param:keystone_admin_password}'
+        token: '${_param:keystone_service_token}'
+        tenant: admin
     database:
       version: ${_param:opencontrail_version}
       cassandra:
diff --git a/metadata/service/control/single.yml b/metadata/service/control/single.yml
index ef579f7..2f4ee9d 100644
--- a/metadata/service/control/single.yml
+++ b/metadata/service/control/single.yml
@@ -87,6 +87,16 @@
         members:
         - host: ${_param:single_address}
           port: 9160
+      identity:
+        engine: keystone
+        version: '2.0'
+        region: RegionOne
+        host: ${_param:single_address}
+        port: 35357
+        user: admin
+        password: '${_param:keystone_admin_password}'
+        token: '${_param:keystone_service_token}'
+        tenant: admin
     database:
       version: ${_param:opencontrail_version}
       cassandra: